-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Classify write-batch failures as must_reload_view in RocksDB and storage-service backends #6515
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -282,7 +282,9 @@ impl RocksDbStoreExecutor { | |
| full_key[0] = STORED_ROOT_KEYS_PREFIX; | ||
| inner_batch.put(&full_key, vec![]); | ||
| } | ||
| self.db.write(inner_batch)?; | ||
| self.db | ||
| .write(inner_batch) | ||
| .map_err(RocksDbStoreInternalError::WriteBatchError)?; | ||
| Ok(()) | ||
| } | ||
| } | ||
|
|
@@ -711,6 +713,12 @@ pub enum RocksDbStoreInternalError { | |
| #[error("RocksDB error: {0}")] | ||
| RocksDb(#[from] rocksdb::Error), | ||
|
|
||
| /// RocksDB error while writing a batch. Unlike [`RocksDbStoreInternalError::RocksDb`] | ||
| /// (which also covers read failures), this error means a batch write may or may not | ||
| /// have been applied, so the in-memory view must be reloaded from storage. | ||
|
Comment on lines
+716
to
+718
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because it runs in the same process, I don't think rocksdb has ambiguous writes. Please link the doc if you found something.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, this was supposed to be a draft. A lot of this still needs to be verified
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Np. (Probably) just revert this part |
||
| #[error("RocksDB write-batch error: {0}")] | ||
| WriteBatchError(rocksdb::Error), | ||
|
|
||
| /// The database contains a file which is not a directory | ||
| #[error("Namespaces should be directories")] | ||
| NonDirectoryNamespace, | ||
|
|
@@ -777,6 +785,10 @@ impl Eq for PathWithGuard {} | |
|
|
||
| impl KeyValueStoreError for RocksDbStoreInternalError { | ||
| const BACKEND: &'static str = "rocks_db"; | ||
|
|
||
| fn must_reload_view(&self) -> bool { | ||
| matches!(self, Self::WriteBatchError(_)) | ||
| } | ||
| } | ||
|
|
||
| /// The composed error type for the `RocksDbStore` | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this makes sense!