Skip to content

Commit

Permalink
ShardId Semantics (#572)
Browse files Browse the repository at this point in the history
  • Loading branch information
wacban authored Nov 7, 2024
1 parent 6e431ff commit 5368857
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions neps/nep-0568.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ supporting smooth transitions without altering storage structures directly.

### ShardId Semantics

Currently, shard IDs are represented as numbers within the range `[0,n)`, where n is the total number of shards. These shard IDs are sorted in the same order as the account ID ranges assigned to them. While this approach is straightforward, it complicates resharding operations, particularly when splitting a shard in the middle of the range. Such a split requires reindexing all subsequent shards with higher IDs, adding complexity to the process.

In this NEP, we propose updating the ShardId semantics to allow for arbitrary identifiers. Although ShardIds will remain integers, they will no longer be restricted to the `[0,n)` range, and they may appear in any order. The only requirement is that each ShardId must be unique. In practice, during resharding, the ID of a parent shard will be removed from the ShardLayout, and the new child shards will be assigned unique IDs - `max(shard_ids)+1` and `max(shard_ids)+2`.

## Reference Implementation

```text
Expand Down

0 comments on commit 5368857

Please sign in to comment.