3

RocksDB写了详细的数据库调试日志

数据库调试日志

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

在通过 crate 与 RocksDB 交互的 Rust 应用程序中rust-rocksdb,我尝试将keep_log_file_num设置为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工作正常,但我想完全摆脱它。

认为将最大日志文件数设置0为不是可行的方法,但我已经没有想法了。如何禁用 RocksDB 数据库调试日志记录?我想控制这种行为。

4

0 回答 0