Skip to content

Commit e1bdd59

Browse files
committed
fix reopen error
1 parent 927f609 commit e1bdd59

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

interactive_engine/executor/store/groot/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ grpcio = "0.10"
2222
grpcio-sys = { version = "0.10", features = ["openssl"] }
2323
# deactivation of bzip2 due to https://github.com/rust-rocksdb/rust-rocksdb/issues/609
2424
# deactivation of zstd due to the 'hidden symbol "ZSTD_maxCLevel" is referenced by DSO' error
25-
rocksdb = { version = "0.21.0", features = ["snappy", "lz4", "zlib"], default-features = false }
26-
#rocksdb = { git = "https://github.com/siyuan0322/rust-rocksdb.git", rev = "c44ea2b", features = ["snappy", "lz4", "zlib"], default-features = false }
25+
rocksdb = { version = "0.21.0", features = ["snappy", "lz4", "zlib", "multi-threaded-cf"], default-features = false }
2726
dyn_type = { path = "../../common/dyn_type" }
2827
rustversion = "1.0"
2928
mimalloc-rust = {version = "0.2.1", optional = true}

interactive_engine/executor/store/groot/src/db/storage/rocksdb.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ impl RocksDB {
8585

8686
let prev = self.db.swap(cur, Ordering::Release, guard);
8787
unsafe {
88-
drop(prev.into_owned());
88+
let prev = prev.into_owned();
89+
prev.cancel_all_background_work(true);
90+
std::thread::sleep(Duration::from_secs(30));
91+
drop(prev);
8992
}
9093
info!("RocksDB replaced");
9194
}
@@ -109,7 +112,7 @@ impl RocksDB {
109112
return Ok(());
110113
}
111114
let db = self.get_db()?;
112-
let opt = WriteOptions::default();
115+
let mut opt = WriteOptions::default();
113116
opt.set_sync(false);
114117
db.put_opt(key, val, &opt).map_err(|e| {
115118
let msg = format!("rocksdb.put failed because {}", e.into_string());
@@ -385,10 +388,9 @@ fn init_options(options: &HashMap<String, String>) -> Options {
385388
opts.set_max_write_buffer_number(4);
386389
opts.set_allow_concurrent_memtable_write(true);
387390
opts.set_enable_write_thread_adaptive_yield(true);
388-
opts.set_enable_pipelined_write(true);
389-
390391
opts.set_bytes_per_sync(1048576);
391-
opts.set_unordered_write(true);
392+
opts.set_enable_pipelined_write(true);
393+
opts.set_unordered_write(false);
392394

393395
if let Some(conf_str) = options.get("store.rocksdb.disable.auto.compactions") {
394396
let val = conf_str.parse().unwrap();

0 commit comments

Comments
 (0)