-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Feature/migrate modification history #2260
base: master
Are you sure you want to change the base?
Conversation
bin/fuel-core/src/cli/run.rs
Outdated
while let Err(e) = | ||
rocks_db.migrate_modifications_history_at_height(height) | ||
{ | ||
tracing::warn!("Could not migrate modifications history at height {height}: {e:?}. Trying again.") | ||
} | ||
} | ||
} | ||
rocks_db.complete_migration(); |
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.
In case of Err
we will just warn in log and continue with next entry, and then call complete_migration();
.
I'm wondering if this leaves some entries not migrated? And if this is acceptable outcome.
I may be lacking some context, though.
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.
That's a good question. I also lack context to answer, probably @xgreenx knows
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.
Ah, I missed the point of your question. The rationale behind the loop is because I don't know whether we use pessmiistic or optimistic concurrency control, e.g. whether the migration transaction aborts in case of conflict. In the latter case, we need to retry the transaction. But if we employ pessimistic concurrency control then the loop is not necessary
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.
I think we need to skip failed entry and continue. But with changes that I asked from #2233 (comment), you will not have cases where error can occur.
a29e3a8
to
e671b0c
Compare
910186c
to
fe3e453
Compare
5c70a37
to
a3ecd66
Compare
bin/fuel-core/src/cli/run.rs
Outdated
// TODO: Handle graceful shutdown of migration processes | ||
#[cfg(feature = "rocksdb")] | ||
{ | ||
let on_chain_migration_handle = combined_database |
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.
I think the HistoricalRocksDB
should be responsible for launching the migration on construction.
@@ -329,10 +352,14 @@ where | |||
fn rollback_block_to(&self, height_to_rollback: u64) -> StorageResult<()> { | |||
let mut storage_transaction = self.db.read_transaction(); | |||
|
|||
let modifications_history_migration_in_progress = self |
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.
Looks like would be nice to have a getter for this field=)
bin/fuel-core/src/cli/run.rs
Outdated
while let Err(e) = | ||
rocks_db.migrate_modifications_history_at_height(height) | ||
{ | ||
tracing::warn!("Could not migrate modifications history at height {height}: {e:?}. Trying again.") | ||
} | ||
} | ||
} | ||
rocks_db.complete_migration(); |
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.
I think we need to skip failed entry and continue. But with changes that I asked from #2233 (comment), you will not have cases where error can occur.
8d4bd59
to
9e6247a
Compare
943f60c
to
0ff920e
Compare
9e6247a
to
f787cf6
Compare
8ac1bf0
to
db2ffc5
Compare
f787cf6
to
308c34a
Compare
7c1e835
to
e1bc889
Compare
308c34a
to
3c9eff4
Compare
e1bc889
to
14540b7
Compare
14540b7
to
aff310a
Compare
aff310a
to
a3f9c25
Compare
db51eeb
to
dbc1786
Compare
## Linked Issues/PRs <!-- List of related issues/PRs --> Related to #2095 ## Description <!-- List of detailed changes --> - [ ] Adds a ModificationsHistoryV2 column in the Historical RocksDB, with keys encoded in big endian - [ ] Adds a flag to the historical RocksDB that keeps track whether the migration is still in progress - [ ] Change HistoricalRocksDB to alway insert historical changes from V2 table. When the migration is in progress, delete key-value pairs from both V2 and V2, read key-value pairs from V2 falling back to V1 if no value in V2 is found #TODO (either this or next MR): - [x] Small task that performs the migration of key-value pairs from V1 to V2 (Done in #2260) ## Checklist - [ ] Breaking changes are clearly marked as such in the PR description and changelog - [x] New behavior is reflected in tests - [ ] [The specification](https://github.com/FuelLabs/fuel-specs/) matches the implemented behavior (link update PR if changes are needed) ### Before requesting review - [ ] I have reviewed the code myself - [ ] I have created follow-up issues caused by this PR and linked them here ### After merging, notify other teams [Add or remove entries as needed] - [ ] [Rust SDK](https://github.com/FuelLabs/fuels-rs/) - [ ] [Sway compiler](https://github.com/FuelLabs/sway/) - [ ] [Platform documentation](https://github.com/FuelLabs/devrel-requests/issues/new?assignees=&labels=new+request&projects=&template=NEW-REQUEST.yml&title=%5BRequest%5D%3A+) (for out-of-organization contributors, the person merging the PR will do this) - [ ] Someone else? --------- Co-authored-by: Green Baneling <[email protected]>
Linked Issues/PRs
Closes #2095
Description
Questions:
Checklist
Before requesting review
After merging, notify other teams
[Add or remove entries as needed]