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

refactor(resharding): renaming resharding code from "state split" to "resharding" #10393

Merged
merged 5 commits into from
Jan 8, 2024

Conversation

wacban
Copy link
Contributor

@wacban wacban commented Jan 8, 2024

The current naming is centered around "state split". It's really confusing to newcomers and even experienced developers as it's not obvious what spltting state pertains to. The new naming is centered around "resharding" which should be clear to anyone. Moreover in the future we may want to add more resharding ops, beyond splitting shards, so this refactoring makes it more future proof.

Care needs to be taken when handling the configs. Ideally this PR should be included in the same rollout as the resharding itself. Otherwise a node operator may configure resharding using the legacy "state_split_config" which will become obsolete as of this PR. cc @posvyatokum

@wacban wacban marked this pull request as ready for review January 8, 2024 13:56
@wacban wacban requested a review from a team as a code owner January 8, 2024 13:56
Copy link

codecov bot commented Jan 8, 2024

Codecov Report

Attention: 50 lines in your changes are missing coverage. Please review.

Comparison is base (a72ab6c) 72.01% compared to head (882f084) 71.99%.

Files Patch % Lines
chain/chain/src/chain.rs 76.59% 6 Missing and 5 partials ⚠️
chain/client/src/sync/state.rs 76.00% 4 Missing and 2 partials ⚠️
chain/chain/src/resharding.rs 80.76% 5 Missing ⚠️
chain/chain/src/update_shard.rs 90.47% 0 Missing and 4 partials ⚠️
chain/chain/src/test_utils/kv_runtime.rs 0.00% 3 Missing ⚠️
chain/client-primitives/src/types.rs 25.00% 3 Missing ⚠️
chain/client/src/client.rs 62.50% 2 Missing and 1 partial ⚠️
chain/client/src/sync_jobs_actor.rs 0.00% 3 Missing ⚠️
chain/client/src/test_utils/client.rs 70.00% 3 Missing ⚠️
tools/speedy_sync/src/main.rs 0.00% 3 Missing ⚠️
... and 4 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10393      +/-   ##
==========================================
- Coverage   72.01%   71.99%   -0.02%     
==========================================
  Files         718      718              
  Lines      144527   144520       -7     
  Branches   144527   144520       -7     
==========================================
- Hits       104077   104047      -30     
- Misses      35699    35718      +19     
- Partials     4751     4755       +4     
Flag Coverage Δ
backward-compatibility 0.08% <0.00%> (+<0.01%) ⬆️
db-migration 0.08% <0.00%> (+<0.01%) ⬆️
genesis-check 1.26% <0.39%> (+<0.01%) ⬆️
integration-tests 36.69% <76.22%> (-0.06%) ⬇️
linux 71.53% <69.43%> (-0.03%) ⬇️
linux-nightly 71.57% <81.13%> (-0.02%) ⬇️
macos 54.88% <66.79%> (+<0.01%) ⬆️
pytests 1.48% <0.39%> (+<0.01%) ⬆️
sanity-checks 1.27% <0.39%> (+<0.01%) ⬆️
unittests 68.21% <78.49%> (-0.03%) ⬇️
upgradability 0.13% <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

@shreyan-gupta shreyan-gupta left a comment

Choose a reason for hiding this comment

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

This greatly improves readability! 🥇

nearcore/src/runtime/tests.rs Show resolved Hide resolved
chain/chain/src/update_shard.rs Show resolved Hide resolved
@@ -133,8 +133,8 @@ impl ToString for ShardSyncStatus {
ShardSyncStatus::StateDownloadScheduling => "scheduling".to_string(),
ShardSyncStatus::StateDownloadApplying => "applying".to_string(),
ShardSyncStatus::StateDownloadComplete => "download complete".to_string(),
ShardSyncStatus::StateSplitScheduling => "split scheduling".to_string(),
ShardSyncStatus::StateSplitApplying => "split applying".to_string(),
ShardSyncStatus::ReshardingScheduling => "split scheduling".to_string(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it safe to change the ToString value here? Say from "split scheduling" to "resharding scheduling"? I don't think we store this anywhere, but potentially might need to revisit logging/dashboards.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, let's do this. I don't know of any dependencie. Either way we should be fine as long as nobody upgrades to this version in the middle of resharding which shouldn't happen anyway.

core/chain-configs/src/client_config.rs Show resolved Hide resolved
core/store/src/columns.rs Show resolved Hide resolved
@@ -580,7 +580,7 @@ mod tests {
(b"aaa".to_vec(), Some(vec![3; value_len])),
(b"aaaa".to_vec(), Some(vec![4; value_len])),
];
// We split state into `num_keys + 1` parts for convenience of testing,
// We resharding into `num_keys + 1` parts for convenience of testing,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: We reshard into...

chain/chain/src/chain.rs Show resolved Hide resolved
@@ -314,7 +314,7 @@ fn test_flat_storage_creation_start_from_state_part() {
let store = create_test_store();

// Process some blocks with flat storage.
// Split state into two parts and return trie keys corresponding to each part.
// resharding into two parts and return trie keys corresponding to each part.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Reshard state into two parts...

nearcore/src/config.rs Show resolved Hide resolved
chain/chain/src/types.rs Show resolved Hide resolved
@wacban wacban enabled auto-merge January 8, 2024 15:55
@wacban wacban added this pull request to the merge queue Jan 8, 2024
Merged via the queue into master with commit d62d7f6 Jan 8, 2024
26 checks passed
@wacban wacban deleted the waclaw-resharding-rename branch January 8, 2024 16:22
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.

2 participants