Skip to content
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

fix(resharding): double resharding state mapping #12688

Merged
merged 2 commits into from
Jan 6, 2025

Conversation

staffik
Copy link
Contributor

@staffik staffik commented Jan 6, 2025

Introduce the fix from #12635 now, will add test later as it requires one of two:

  • memtrie support for double resharding without restart
  • testloop support for restarting a node

@staffik staffik requested a review from a team as a code owner January 6, 2025 11:07
@staffik staffik requested review from akhi3030, wacban and Trisfald and removed request for akhi3030 January 6, 2025 11:07
fn set_state_shard_uid_mapping(
&mut self,
split_shard_event: &ReshardingSplitShardParams,
) -> io::Result<()> {
let mut store_update = self.store.trie_store().store_update();
let parent_shard_uid = split_shard_event.parent_shard;
let parent_shard_uid_prefix = get_shard_uid_mapping(&self.store, parent_shard_uid);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we do this in a loop until the last iteration returns the same value as the previous (meaning we navigated all children), would it be a good way to support any number of sub reshardings?

Although I don't see it likely going further down than shard grand children..

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it already works for any number of sub reshardings. E.g. split A -> B -> C, then we save to the db mapping from C to A. If we then split C -> D, then we would save to the db mapping from D to get_mapping(C)=A.
Is this what you meant?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.. I think it should work as you said. We'll be sure after adding tests :)

Copy link

codecov bot commented Jan 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.53%. Comparing base (07ca150) to head (de5be6e).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #12688   +/-   ##
=======================================
  Coverage   70.53%   70.53%           
=======================================
  Files         847      847           
  Lines      172835   172839    +4     
  Branches   172835   172839    +4     
=======================================
+ Hits       121901   121918   +17     
+ Misses      45833    45821   -12     
+ Partials     5101     5100    -1     
Flag Coverage Δ
backward-compatibility 0.16% <0.00%> (ø)
db-migration 0.16% <0.00%> (ø)
genesis-check 1.36% <0.00%> (-0.01%) ⬇️
linux 69.22% <0.00%> (-0.01%) ⬇️
linux-nightly 70.14% <100.00%> (+0.01%) ⬆️
pytests 1.66% <0.00%> (-0.01%) ⬇️
sanity-checks 1.47% <0.00%> (-0.01%) ⬇️
unittests 70.36% <100.00%> (+<0.01%) ⬆️
upgradability 0.20% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@wacban wacban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

chain/chain/src/resharding/manager.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@Trisfald Trisfald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@staffik staffik enabled auto-merge January 6, 2025 11:43
@staffik staffik added this pull request to the merge queue Jan 6, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 6, 2025
@staffik staffik added this pull request to the merge queue Jan 6, 2025
Merged via the queue into master with commit 445ee6f Jan 6, 2025
28 checks passed
@staffik staffik deleted the stafik/resharding/grandparent branch January 6, 2025 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants