Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pref(rocksdb): enable async io for iterators #286

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use grovedb_costs::{
storage_cost::key_value_cost::KeyValueStorageCost, ChildrenSizesWithIsSumTree, CostResult,
CostsExt,
};
use rocksdb::{ColumnFamily, DBRawIteratorWithThreadMode, WriteBatchWithTransaction};
use rocksdb::{ColumnFamily, DBRawIteratorWithThreadMode, ReadOptions, WriteBatchWithTransaction};

use super::{make_prefixed_key, PrefixedRocksDbBatch, PrefixedRocksDbRawIterator};
use crate::{
Expand Down Expand Up @@ -232,9 +232,12 @@ impl<'db> StorageContext<'db> for PrefixedRocksDbImmediateStorageContext<'db> {
}

fn raw_iter(&self) -> Self::RawIterator {
let mut opts = ReadOptions::default();
opts.set_async_io(true);

PrefixedRocksDbRawIterator {
prefix: self.prefix,
raw_iterator: self.transaction.raw_iterator(),
raw_iterator: self.transaction.raw_iterator_opt(opts),
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use grovedb_costs::{
storage_cost::key_value_cost::KeyValueStorageCost, ChildrenSizesWithIsSumTree, CostResult,
CostsExt, OperationCost,
};
use rocksdb::{ColumnFamily, DBRawIteratorWithThreadMode};
use rocksdb::{ColumnFamily, DBRawIteratorWithThreadMode, ReadOptions};

use super::{batch::PrefixedMultiContextBatchPart, make_prefixed_key, PrefixedRocksDbRawIterator};
use crate::{
Expand Down Expand Up @@ -278,9 +278,12 @@ impl<'db> StorageContext<'db> for PrefixedRocksDbStorageContext<'db> {
}

fn raw_iter(&self) -> Self::RawIterator {
let mut opts = ReadOptions::default();
opts.set_async_io(true);

PrefixedRocksDbRawIterator {
prefix: self.prefix,
raw_iterator: self.storage.raw_iterator(),
raw_iterator: self.storage.raw_iterator_opt(opts),
}
}
}
7 changes: 5 additions & 2 deletions storage/src/rocksdb_storage/storage_context/context_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use grovedb_costs::{
cost_return_on_error, storage_cost::key_value_cost::KeyValueStorageCost,
ChildrenSizesWithIsSumTree, CostResult, CostsExt, OperationCost,
};
use rocksdb::{ColumnFamily, DBRawIteratorWithThreadMode};
use rocksdb::{ColumnFamily, DBRawIteratorWithThreadMode, ReadOptions};

use super::{batch::PrefixedMultiContextBatchPart, make_prefixed_key, PrefixedRocksDbRawIterator};
use crate::{
Expand Down Expand Up @@ -310,9 +310,12 @@ impl<'db> StorageContext<'db> for PrefixedRocksDbTransactionContext<'db> {
}

fn raw_iter(&self) -> Self::RawIterator {
let mut opts = ReadOptions::default();
opts.set_async_io(true);

PrefixedRocksDbRawIterator {
prefix: self.prefix,
raw_iterator: self.transaction.raw_iterator(),
raw_iterator: self.transaction.raw_iterator_opt(opts),
}
}
}
Loading