如何禁用RocksDB数据库调试日志记录?

时间:2017-08-08 15:22:53

标签: logging rust rocksdb

RocksDB writes detailed database debug logs

  

数据库调试日志

     

RocksDB将详细日志写入名为LOG *的文件中。这些主要用于调试和分析正在运行的系统。该LOG可以配置为以指定的周期滚动。

在我的Rust应用程序中,我通过\包与RocksDB进行交互,我尝试通过以下方式将keep_log_file_num设置为rust-rocksdb

0

但这导致我的应用程序因超出范围错误而中止。

let mut opts = Options::new();
opts.set_parsed_options("keep_log_file_num=0")?;

将其设置为terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 1) >= this->size() (which is 1) Thread 1 "client" received signal SIGABRT, Aborted. __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:58 58 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:58 #1 0x00007ffff7a4737a in __GI_abort () at abort.c:89 #2 0x00007ffff771956d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #3 0x00007ffff7717316 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #4 0x00007ffff7717361 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #5 0x00007ffff7717579 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #6 0x00007ffff7741317 in std::__throw_out_of_range_fmt(char const*, ...) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #7 0x0000555558a1ce9a in std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_range_check (this=0x7ffffffe2420, __n=1) at /usr/include/c++/6/bits/stl_vector.h:804 #8 0x0000555558a11aef in std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::at (this=0x7ffffffe2420, __n=1) at /usr/include/c++/6/bits/stl_vector.h:825 #9 0x00005555589f1a2f in rocksdb::DBImpl::PurgeObsoleteFiles (this=0x7ffff5fabe00, state=..., schedule_only=false) at rocksdb/db/db_impl.cc:1094 #10 0x00005555589f201a in rocksdb::DBImpl::DeleteObsoleteFiles (this=0x7ffff5fabe00) at rocksdb/db/db_impl.cc:1128 #11 0x0000555558a0aad3 in rocksdb::DB::Open (db_options=..., dbname="/tmp/client-0002/chains/main/db/906a34e69aec8c0d/overlayrecent/db", column_families=std::vector of length 1, capacity 1 = {...}, handles=0x7ffffffe2e60, dbptr=0x7ffffffe3490) at rocksdb/db/db_impl.cc:5771 #12 0x0000555558a09e45 in rocksdb::DB::Open (options=..., dbname="/tmp/client-0002/chains/main/db/906a34e69aec8c0d/overlayrecent/db", dbptr=0x7ffffffe3490) at rocksdb/db/db_impl.cc:5662 #13 0x00005555589d48ad in rocksdb_open (options=0x7ffff57ff800, name=0x7ffff5f086e0 "/tmp/client-0002/chains/main/db/906a34e69aec8c0d/overlayrecent/db", errptr=0x7ffffffe38d8) at rocksdb/db/c.cc:408 #14 0x00005555589ca4de in rocksdb::rocksdb::DB::open_cf (opts=0x7ffffffe3ea0, path=..., cfs=..., cf_opts=...) at /home/user/.cargo/git/checkouts/rust-rocksdb-9e499ea8a4c2fa74/4364cae/src/rocksdb.rs:317 #15 0x000055555889b42c in ethcore_util::kvdb::Database::open (config=0x7ffffffe5700, path=...) at util/src/kvdb.rs:537 #16 0x0000555557b8e288 in ethcore::service::ClientService::start (config=..., spec=0x7ffffffeb548, client_path=0x7ffff5e5bfc0, snapshot_path=0x7ffff5e5c6e0, ipc_path=0x7ffff5a307a0, miner=...) at ethcore/src/service.rs:91 #17 0x000055555646d742 in client::run::execute (cmd=..., can_restart=false, logger=...) at client/run.rs:547 #18 0x0000555556484ea6 in client::execute (command=..., can_restart=false) at client/main.rs:159 #19 0x0000555556486720 in client::start (can_restart=false) at client/main.rs:185 #20 0x0000555556487518 in client::main_direct (can_restart=false) at client/main.rs:286 #21 0x0000555556488a71 in client::main () at client/main.rs:367 可以正常工作,但我想完全摆脱它。

假设将最大日志文件编号设置为1不是可行的方法,但我的想法已经不多了。如何禁用RocksDB数据库调试日志记录?我希望控制这种行为。

0 个答案:

没有答案