-
Notifications
You must be signed in to change notification settings - Fork 7
Split state persistent on parts #983
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
base: master
Are you sure you want to change the base?
Conversation
🧪 Network TestsTo run network tests for this PR, use: gh workflow run network-tests.yml -f pr_number=983Available test options:
Test types: Results will be posted as workflow runs in the Actions tab. |
|
❌ Python formatting check failed in CI. Please run |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #983 +/- ##
==========================================
+ Coverage 46.30% 47.83% +1.52%
==========================================
Files 357 361 +4
Lines 62235 64416 +2181
Branches 62235 64416 +2181
==========================================
+ Hits 28820 30811 +1991
+ Misses 31914 31911 -3
- Partials 1501 1694 +193 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
cfd4ce6 to
18f40f7
Compare
38f8a69 to
4146a59
Compare
7f35ecc to
9723205
Compare
9723205 to
8d2bc28
Compare
+ and store additional flag HAS_STATE_PARTS to block handle
- add HAS_STATE_PARTS flag to existing blocks in the `block_handles`
+ do not double store partition subtree root cell in the main storage
…d check downloaded
8d2bc28 to
af375e8
Compare
RATIONALE
Support local state data sharding on parts - shard accounts cells tree is split into parts by shards at the configured
split_depth. The top of the state tree is stored in the main cells db, and parts subtrees are stored each in separate physical databases that can be placed on separate disks.Pull Request Checklist
NODE CONFIGURATION MODEL CHANGES
[Yes]
Added
core_storage.state_partssplit_depth: 0- no parts used;Default value is
state_parts: nullthat means no parts configured.BLOCKCHAIN CONFIGURATION MODEL CHANGES
[None]
COMPATIBILITY
Affected features:
Fully compatible.
State will be saved with parts if they are specified in config. If state was saved with parts it will be read with parts. If it was saved without parts (e.g. before update) it will be read without.
Parts map
{key - cell hash: value - shard prefix}will be saved toCellsDB.shard_statesright afterroot cell hash. If no parts used nothing will be added toShardStatesvalue. So existing values inShardStatestable will be treated as "no parts used".A new flag
HAS_STATE_PARTS = 1 << 13added to theBlockHandlebit flags. It means that no parts were used / or all required state parts were successfully stored in separate storages. NowBlockHandle.has_state()returnstrueonly when both new flag and old oneHAS_STATE_MAIN = 1 << 3are set. The migration script (0.0.4 -> 0.0.5) setHAS_STATE_PARTSfor all existing block handles.Persistent state files will be split on main file and parts if persistent was stored when state split on parts configured. E.g.:
{block_id}.boc{block_id}_part_{shard prefix hex}.bocPersistent part file has additional meta after header at the offset 6. It contains shard prefix (8 bytes) and part root hash (32 bytes).
Persistent main file has additional meta when stored with parts:
Previous persistent state file format is fully backward compatible.
Manual compatibility tests were passed:
core_storage.state_parts = nullor remove param from configfeat/split-state-storagebarch version.temp/config1.json.temp/config1.jsonManual persistent state test 1:
run-node4.shscript where--import-zerostatearg is omitted)If nodes 1-3 where configured without state split on parts and persistent state was created without parts it will be correctly downloaded and stored on the node 4 (that configured with 4 parts). We will have a single persistent state file but state will be split stored into 4 different storages.
SPECIAL DEPLOYMENT ACTIONS
[Not Required]
Without additional changes in the node config it works with a single part without split.
PERFORMANCE IMPACT
[Expected impact]
TESTS
Unit Tests
Network Tests
[No coverage]
Manual Tests
Performance testing:
(metrics are in the PERFORMANCE IMPACT block)