sync every txn

This commit is contained in:
Luke Parker 2024-03-09 03:18:52 -05:00
parent 89b237af7e
commit 68dc872b88
No known key found for this signature in database
2 changed files with 6 additions and 3 deletions

2
Cargo.lock generated
View file

@ -2953,7 +2953,7 @@ dependencies = [
"httpdate",
"itoa",
"pin-project-lite 0.2.13",
"socket2 0.5.5",
"socket2 0.4.10",
"tokio",
"tower-service",
"tracing",

View file

@ -1,7 +1,8 @@
use std::sync::Arc;
use rocksdb::{
DBCompressionType, ThreadMode, SingleThreaded, LogLevel, Options, Transaction, TransactionDB,
DBCompressionType, ThreadMode, SingleThreaded, LogLevel, WriteOptions, Transaction, Options,
TransactionDB,
};
use crate::*;
@ -31,7 +32,9 @@ impl<T: ThreadMode> Get for Arc<TransactionDB<T>> {
impl<T: ThreadMode + 'static> Db for Arc<TransactionDB<T>> {
type Transaction<'a> = Transaction<'a, TransactionDB<T>>;
fn txn(&mut self) -> Self::Transaction<'_> {
self.transaction()
let mut opts = WriteOptions::default();
opts.set_sync(true);
self.transaction_opt(&opts, &Default::default())
}
}