forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[rocksdb] introduce safe iterator (MystenLabs#10203)
currently there's a bug in the way we use iterators in the codebase we check iterators for [validity](https://github.com/MystenLabs/sui/blob/main/crates/typed-store/src/rocks/iter.rs#L45), but do not check for potential [errors](https://github.com/rust-rocksdb/rust-rocksdb/blob/master/src/db_iterator.rs#L132). So we can't really differentiate if the iterator stopped because it was fully consumed or there was an error. This PR introduces a new temporary method `safe_iter`. It's similar to the existing `iter` method but returns an iterator of results instead. We use iterators a lot, so migration of call sites will be split into a few batches. Once migration is done, `safe_iter` will be renamed back to `iter` Notes: * `.keys` and `.values` methods are fully migrated * `typed_store` internal call sites (including sally) and tests are migrated * `typed_store::Store` struct is deprecated and removed
- Loading branch information
Showing
15 changed files
with
289 additions
and
768 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.