Composite State Store Part 5: WAL integration + Composite Pruning Manager#2785
Composite State Store Part 5: WAL integration + Composite Pruning Manager#2785Kbhat1 wants to merge 8 commits intofeature/composite-ss-read-pathfrom
Conversation
|
The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feature/composite-ss-read-path #2785 +/- ##
===============================================================
Coverage 41.61% 41.61%
===============================================================
Files 1925 1925
Lines 153234 153324 +90
===============================================================
+ Hits 63762 63811 +49
- Misses 83467 83484 +17
- Partials 6005 6029 +24
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
c0a7f5b to
db4a5a9
Compare
42e19d3 to
4084fe1
Compare
ee8ea44 to
a401330
Compare
4055a6d to
ae9502c
Compare
0cefbd5 to
1fc46b6
Compare
ae9502c to
a11dc21
Compare
1fc46b6 to
dedf0c0
Compare
a11dc21 to
ca81638
Compare
c9ef455 to
f9a3987
Compare
ca81638 to
8efe6df
Compare
c769c02 to
7803574
Compare
8efe6df to
9be2e36
Compare
7803574 to
d0ff8d9
Compare
| logger.Info("Replaying WAL to EVM store", "startOffset", startOffset, "endOffset", lastOffset) | ||
|
|
||
| return streamHandler.Replay(startOffset, lastOffset, func(index uint64, entry proto.ChangelogEntry) error { | ||
| if entry.Version > cosmosVersion { |
There was a problem hiding this comment.
optional: logging wal replay progress something like:
if index % 1000 == 0 { logger.Info("WAL replay progress", "offset", index, "version", entry.Version) }
9be2e36 to
da06ac5
Compare
d0ff8d9 to
4e18ca2
Compare
da06ac5 to
bca19d0
Compare
4e18ca2 to
53da684
Compare
bca19d0 to
b3b7cd4
Compare
53da684 to
17c7f7d
Compare
| ) | ||
|
|
||
| // Sync EVM_SS if behind | ||
| if evmVersion < cosmosVersion { |
There was a problem hiding this comment.
I think we should not compare EVM version with cosmos Version to determine behind or not, because both SS could be falling behind at the same time even if they are at the same height
There was a problem hiding this comment.
@yzang2019 The logic handles both cases:
syncEVMStoreonly runs if EVM_SS < Cosmos_SS (catches EVM up to Cosmos)recoverStandardWALalways runs after and replays throughCompositeStateStore, which dual-writes to both stores
So if both are at version 80 and WAL is at 100, we skip step 1 (they're equal), then step 2 replays 81-100 to both stores via dual-write. The two-phase approach covers all scenarios.
There was a problem hiding this comment.
Hmm why do we need separate steps here? Would it be easier to just recover both SS till latest height?
| } | ||
|
|
||
| // syncEVMStore replays WAL entries to catch up EVM_SS to Cosmos_SS version | ||
| func syncEVMStore( |
There was a problem hiding this comment.
Can we consolidate the changelog restore logic into one function?
b3b7cd4 to
ba26486
Compare
c75185b to
34c9a63
Compare
ba26486 to
d7bca53
Compare
c1cafb6 to
d53e24f
Compare
d7bca53 to
eb51830
Compare
d53e24f to
3eb8a27
Compare
Add recovery mechanism ensuring both Cosmos_SS and EVM_SS stay in sync: - RecoverCompositeStateStore: Syncs EVM_SS if behind, replays new WAL entries - syncEVMStore: Catches up EVM_SS via WAL replay - Standard WAL replay goes through ApplyChangesetSync (dual-writes) Usage: Call RecoverCompositeStateStore after creating CompositeStateStore.
…function - Replace separate syncEVMStore and recoverStandardWAL functions with a single generic replayWAL function that takes a handler callback - replayWAL(fromVersion, toVersion, handler) handles all WAL replay: - fromVersion: start replaying from entries > this version - toVersion: stop at this version (-1 = replay to end of WAL) - handler: callback to process each entry - RecoverCompositeStateStore now uses replayWAL for both phases: - Phase 1: Sync EVM if behind (replay only to EVM store) - Phase 2: Replay new entries (dual-write through CompositeStateStore)
Move newCompositeStateStoreWithStores from store.go to recovery_test.go since it's only used for testing recovery scenarios.
Since Cosmos_SS and EVM_SS share the same changelog, consolidate recovery into a single pass that routes each WAL entry appropriately: - Entries Cosmos needs: dual-write through CompositeStateStore - Entries only EVM needs (catch-up): write only to EVM store - Entries both have: skip This opens the WAL once instead of potentially twice, and the routing logic is clear and consolidated in one place.
eb51830 to
8e4dc3a
Compare
b68f249 to
f5d8315
Compare
Replace EnableRead/EnableWrite with WriteMode/ReadMode enums in test config.
Describe your changes and provide context
RecoverCompositeStateStoreto handle WAL replay for both stores on startupEVM_SSis behind (e.g., newly enabled or crash), sync it from WAL before standard recoveryApplyChangesetSyncwhich dual-writes to both stores automaticallyRecoverStateStorepatternTesting performed to validate your change