forked from near/nearcore
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(resharding) - Make shard ids non-contiguous (near#12181)
This is part 1 of adding support for non-contiguous shard ids. The principle idea is to make ShardId into a newtype so that it's not possible to use it to index arrays with chunk data. In addition I'm adding ShardIndex type and a mapping between shard indices and shard ids so that it's possible to covert one to another as necessary. The TLDR of this approach is to make the types right, fix compiler errors and pray to the software gods that things work out. I am now giving up on trying to make the migration in a single PR. Instead I am introducing some temporary structures and methods that are compatible with both approaches. My current plan for the migration is as follows: 1) Switch to the new ShardId definition. 2) Fix some number of compilation errors (using the temporary objects) 3) Switch back to the old definition 4) PR, review, merge 5) Repeat 1-4 until there are no more errors. 6) Cleanup the temporary objects 7) Adjust some tests to use the new ShardLayout with non-contiguous shard ids. 8) Try to get rid of the mapping wherever possible There are a few common themes in this PR: * read the shard layout and convert shard id to shard index in order to use it to index some array or chunk data * replace enumerate with reading the shard id directly from the chunk header / other chunk data * replace using shard id by adding enumerate to get the shard index * add `?` to shard id in tracing logs because the newtype ShardId doesn't work without it must-review files: * shard_layout.rs * primitives-core/src/types.rs * shard_assignment.rs good-to-review files: * state_transition_data.rs
- Loading branch information
Showing
105 changed files
with
1,593 additions
and
893 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.