Add exporter for FlatKV and CompositeSC#3064
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 @@
## main #3064 +/- ##
==========================================
+ Coverage 58.42% 58.50% +0.07%
==========================================
Files 2088 2090 +2
Lines 172108 172238 +130
==========================================
+ Hits 100552 100763 +211
+ Misses 62620 62496 -124
- Partials 8936 8979 +43
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
| if err != nil { | ||
| return nil, fmt.Errorf("open iterator for db %d: %w", e.currentDB, err) | ||
| } | ||
| if iter == nil || !iter.First() { |
There was a problem hiding this comment.
if iter.First() fails because of an iterator/IO error rather than because the DB is empty, we should also handle the iter.Error()?
| }, nil | ||
| } | ||
|
|
||
| func (s *SnapshotExporter) Next() (interface{}, error) { |
There was a problem hiding this comment.
Short godoc explaining the methods in struct would be helpful. Purpose of these methods wasn't immediately obvious based on function names and context.
| pendingNodes []*types.SnapshotNode | ||
| } | ||
|
|
||
| func NewKVExporter(store *CommitStore, version int64) *KVExporter { |
There was a problem hiding this comment.
Does this sort of export happen on validators on mainnet? If so, would it make sense to have throttles to prevent an export from impacting the handling of regular traffic? Do we currently throttle export from memIAVL?
There was a problem hiding this comment.
Export only happens on RPC nodes, validator doesn't export at all
Kbhat1
left a comment
There was a problem hiding this comment.
this would break ss state sync since it isn't aware of the new module evm_flatkv. We can either normalize em_flatkv to evm before sending nodes into ssImporter in rootmulti.restore or update ss/composite.Import to treat both evm and evm_flatkv the same
* main: fix(giga): match v2 correctness checks (#3071) Added clone method to canned random (#3076) Helper files for the flatKV cache implementation (#3072) fix: restore PRs inadvertently reverted by #3039 squash-merge (#3070) Refine logging to avoid printing expensive objects on hot path (#3066) Fix flaky tendermint syncer test (#3065) Add runtime log level control via gRPC admin service (#3062) chore: dcoument run RPC suite on legacy vs giga (#3041) chore: self-contained revert tests, contract reorg, and failure analysis (#3033)
This PR is adding exporter used by state sync to export live state into snapshot files. Composite Exporter (composite/exporter.go): Orchestrates the export stream from both the Cosmos (memiavl) and FlatKV backends. All Cosmos modules are exported first, then FlatKV EVM data is appended as a distinct module named "evm_flatkv". The FlatKV phase is only included when WriteMode == SplitWrite or DualWrite. Composite Importer routing (composite/importer.go): Updated to route the "evm_flatkv" module exclusively to the FlatKV importer, and all other modules exclusively to the Cosmos importer. Previously, EVM data was duplicated to both importers based on the "evm" module name. FlatKV Importer snapshot fix (flatkv/importer.go): The importer now writes a snapshot after import completes. Import bypasses the WAL and writes directly to PebbleDB in the working directory. Without a snapshot, the next LoadVersion would re-clone the working directory from the pre-import snapshot (e.g. snapshot-0), destroying all imported data.
Describe your changes and provide context
This PR is adding exporter used by state sync to export live state into snapshot files.
Composite Exporter (composite/exporter.go): Orchestrates the export stream from both the Cosmos (memiavl) and FlatKV backends. All Cosmos modules are exported first, then FlatKV EVM data is appended as a distinct module named "evm_flatkv". The FlatKV phase is only included when WriteMode == SplitWrite or DualWrite.
Composite Importer routing (composite/importer.go): Updated to route the "evm_flatkv" module exclusively to the FlatKV importer, and all other modules exclusively to the Cosmos importer. Previously, EVM data was duplicated to both importers based on the "evm" module name.
FlatKV Importer snapshot fix (flatkv/importer.go): The importer now writes a snapshot after import completes. Import bypasses the WAL and writes directly to PebbleDB in the working directory. Without a snapshot, the next LoadVersion would re-clone the working directory from the pre-import snapshot (e.g. snapshot-0), destroying all imported data.
Testing performed to validate your change