-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
[Storage][Pruner] Split state k/v pruning to a separate pruner. #6829
Conversation
2f63e52
to
2a008bc
Compare
898b3fd
to
002e105
Compare
self.state_store.clone(), | ||
&mut batch, | ||
)?; | ||
LedgerPruner::prune_genesis(self.ledger_db.clone(), &mut batch)?; |
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.
curious why we need to prune ledger, statekv while not seeing state_merkel's genesis being pruned?
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.
We do. see ~7 lines below.
|
||
// Loop that does the real pruning job. | ||
pub(crate) fn work(&self) { | ||
while !self.quit_worker.load(Ordering::Relaxed) { |
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.
are there multiple threads running the same StateKvPrunerWorker?
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.
No, there is only one worker. We use atomic variable here just because the stop_pruning signal is from other thread (not the worker thread).
config/src/config/storage_config.rs
Outdated
/// Similar to the variable above but for state store pruner. It means the number of stale | ||
/// nodes to prune a time. |
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.
update comment
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.
Done
assert_eq!(peers_with_ready_subscriptions, vec![( | ||
peer_network_1, | ||
synced_ledger_info | ||
)]); |
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.
hmm.. nit: previous commit needs cargo +nightly fmt
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.
Done
if pruned { | ||
assert!(state_store.get_usage(Some(version)).is_err()) | ||
} else { | ||
assert!(state_store.get_usage(Some(version)).is_ok()) | ||
} |
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.
is this still verified somewhere?
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.
Add several lines in txn store pruner test to check this.
if index.stale_since_version > target_version { | ||
break; | ||
} | ||
// Prune the stale state value index itself first. |
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.
"first"? they are the same batch, right?
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.
Done...
@lightmark originally wrote this LOL
78fe983
to
3bd0238
Compare
let usage = StateStorageUsage::zero(); | ||
batch | ||
.put::<VersionDataSchema>(&i, &usage.into()) | ||
.expect("Must succeed."); |
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.
🤣 come on, it's a test, just unwrap()
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 felt it was weird when writing expect
, but my brain was stuck at that time and couldn't find the unwrap
to use. 🤣
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
✅ Forge suite
|
Description
Test Plan