diff options
author | metamuffin <metamuffin@disroot.org> | 2025-04-07 23:52:39 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-04-07 23:52:39 +0200 |
commit | cee0b647edf9c789daebb87b4e9878f129b38de5 (patch) | |
tree | e3a34dc15372e650538253c6476f52308590ffac | |
parent | 09c7a36f9ceda1007ff235924e24ece23e24e011 (diff) | |
download | weareearth-cee0b647edf9c789daebb87b4e9878f129b38de5.tar weareearth-cee0b647edf9c789daebb87b4e9878f129b38de5.tar.bz2 weareearth-cee0b647edf9c789daebb87b4e9878f129b38de5.tar.zst |
disable rocksdb WAL
-rw-r--r-- | src/cache.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/cache.rs b/src/cache.rs index d6fa818..b9b19c2 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -19,6 +19,7 @@ pub enum Cache { }, Rocksdb { db: rocksdb::DBWithThreadMode<rocksdb::MultiThreaded>, + wopts: rocksdb::WriteOptions, }, } const T_DOWNLOAD: redb::TableDefinition<&str, &[u8]> = redb::TableDefinition::new("dl"); @@ -49,11 +50,13 @@ impl Cache { pub fn new_rocksdb(path: &Path) -> Result<Self> { info!("opening rocksdb..."); let mut opts = rocksdb::Options::default(); + let mut wopts = rocksdb::WriteOptions::default(); opts.increase_parallelism(8); opts.create_if_missing(true); + wopts.disable_wal(true); let db = rocksdb::DBWithThreadMode::open(&opts, path)?; info!("done"); - Ok(Self::Rocksdb { db }) + Ok(Self::Rocksdb { db, wopts }) } pub async fn transfer_entries(&self, other: &Cache) -> Result<()> { @@ -118,7 +121,7 @@ impl Cache { Ok(None) } } - Cache::Rocksdb { db } => Ok(db.get(path)?), + Cache::Rocksdb { db, .. } => Ok(db.get(path)?), } } pub async fn insert(&self, path: &str, data: &[u8]) -> Result<()> { @@ -144,8 +147,8 @@ impl Cache { txn.commit()?; Ok(()) } - Cache::Rocksdb { db } => { - db.put(path, data)?; + Cache::Rocksdb { db, wopts } => { + db.put_opt(path, data, &wopts)?; Ok(()) } } |