-
Notifications
You must be signed in to change notification settings - Fork 622
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
feat(resharding): Resharding state mapping integration #12269
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #12269 +/- ##
=======================================
Coverage 71.24% 71.25%
=======================================
Files 838 838
Lines 169020 169074 +54
Branches 169020 169074 +54
=======================================
+ Hits 120424 120475 +51
+ Misses 43351 43350 -1
- Partials 5245 5249 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
9089366
to
103279d
Compare
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 good overall, just some minor questions about testing.
Oh, and confirming, we still need to add the integration with state_sync to remove the mapping for a state sync on child shard right?
/// created later. | ||
pub fn process_memtrie_resharding_storage_update( | ||
/// Trigger resharding if shard layout changes after the given block. | ||
pub fn start_resharding( |
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.
Nice... thanks for renaming!
cbc01fa
to
2fc80bc
Compare
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.
LGTM, nice and clean integration :)
match resharding_event_type { | ||
Some(ReshardingEventType::SplitShard(split_shard_event)) => { | ||
self.split_shard( | ||
chain_store_update, | ||
block, | ||
shard_uid, | ||
tries, | ||
split_shard_event, | ||
next_shard_layout, | ||
)?; | ||
} | ||
None => { | ||
tracing::debug!(target: "resharding", ?resharding_event_type, "unsupported resharding event type, skipping"); | ||
} |
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.
nice
) -> io::Result<()> { | ||
let mut store_update = self.store.trie_store().store_update(); | ||
let parent_shard_uid = split_shard_event.parent_shard; | ||
// TODO(reshardingV3) No need to set the mapping for children shards that we won't track just after resharding? |
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.
Good call making that a todo. Let's come back to this question when we figure out the full picture for post resharding cleanup.
// Reshard the State column by setting ShardUId mapping from children to parent. | ||
self.set_state_shard_uid_mapping(&split_shard_event)?; | ||
|
||
// Create temporary children memtries by freezing parent memtrie and referencing it. | ||
self.process_memtrie_resharding_storage_update( | ||
chain_store_update, | ||
block, | ||
shard_uid, | ||
vec![split_shard_event.left_child_shard, split_shard_event.right_child_shard], | ||
tries, | ||
split_shard_event.clone(), | ||
)?; | ||
|
||
// Trigger resharding of flat storage. | ||
self.flat_storage_resharder.start_resharding( | ||
ReshardingEventType::SplitShard(split_shard_event.clone()), | ||
ReshardingEventType::SplitShard(split_shard_event), | ||
&next_shard_layout, | ||
)?; |
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 really like how this is shaping up - split_shard consists of splitting the State, FlatState and MemTrie.
Tracking issue: #12050
Summary:
ReshardingManager::process_memtrie_resharding_storage_update()
intostart_resharding()
as it is an entry point to start resharding.set_state_shard_uid_mapping()
and call it fromstart_resharding()
.resharding_v3.rs
testloop.Test would fail with
MissingTrieValue
for children shards if disabledset_state_shard_uid_mapping
.Perhaps
test_resharding_v3_base
should be as minimal as possible and I should not test State mapping there. But for now I do not see much value in doing it differently.