Restructure sei data folder for Giga#3155
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 #3155 +/- ##
==========================================
+ Coverage 58.50% 58.77% +0.26%
==========================================
Files 2072 2101 +29
Lines 207965 175825 -32140
==========================================
- Hits 121680 103334 -18346
+ Misses 77494 63325 -14169
- Partials 8791 9166 +375
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
| return filepath.Join(baseDir, subDir) | ||
| } | ||
|
|
||
| func pathExists(path string) bool { |
There was a problem hiding this comment.
You mean this one and the one in sei-db? I think this is fine we don't wanna couple sei-tendemrint and sei-db. Tendermint manages their own db separately than sei-db
| if !os.FileExists(filepath.Join(cfg.DBDir(), "blockstore.db")) { | ||
| blockstoreDir := tmcfg.ResolveDBDir("blockstore", cfg.DBDir()) | ||
| if !os.FileExists(filepath.Join(blockstoreDir, "blockstore.db")) { | ||
| return nil, nil, fmt.Errorf("no blockstore found in %v", cfg.DBDir()) |
There was a problem hiding this comment.
the error msg seems to should be against blockstoreDir instead of cfg.DBDir()
| return nil, nil, fmt.Errorf("no blockstore found in %v", cfg.DBDir()) | ||
| stateDir := tmcfg.ResolveDBDir("state", cfg.DBDir()) | ||
| if !os.FileExists(filepath.Join(stateDir, "state.db")) { | ||
| return nil, nil, fmt.Errorf("no state store found in %v", cfg.DBDir()) |
There was a problem hiding this comment.
same as above, error msg against stateDir instead of cfg.DBDir()
| } | ||
| // ResetState removes all blocks, tendermint state, indexed transactions and evidence. | ||
| // It handles both the legacy flat layout and the new subdirectory layout. | ||
| func ResetState(dbDir string) error { |
There was a problem hiding this comment.
consider updating reset related unit testings
| } | ||
| if receiptConfig.DBDirectory == "" { | ||
| receiptConfig.DBDirectory = filepath.Join(homePath, "data", "receipt.db") | ||
| receiptConfig.DBDirectory = utils.GetReceiptStorePath(homePath) |
There was a problem hiding this comment.
readReceiptStoreConfig() was changed to default to data/ledger/receipt.db, but the emitted config template still says /data/receipt.db
need to update the related toml.go
* main: plt-228 fixed static check on app and evmrpc package (#3154) flatkv cache (#3027) Make cryptosim state store backend configurable + No Op Wrapper + Read Disable Config (#3145) Add warning message for IAVL deprecation (#3159) Change default min valid per window to zero (#3157) support for starting autobahn from non-zero global block (#3136) Fix upgrade list comparison to respect semver (#3153)
| func GetStateStorePath(homePath string, backend string) string { | ||
| return filepath.Join(homePath, "data", backend) | ||
| legacyPath := filepath.Join(homePath, "data", backend) | ||
| if PathExists(legacyPath) { |
There was a problem hiding this comment.
Minor: Is there ever a case where an abrupt node failure could cause the creation of an empty directory here?
If so, for robustness i recommend checking if this dir is empty and proceed with legacy path iff it is not empty.
There was a problem hiding this comment.
If the creation of empty dir happens, then it will continue proceed with the old path, which is fine. I don't think there's any case where it is started with the new path first and then suddenly crash and create an old path
| return filepath.Join(homePath, "data", "committer.db") | ||
| // PathExists returns true if the given path exists on disk. | ||
| func PathExists(path string) bool { | ||
| _, err := os.Stat(path) |
There was a problem hiding this comment.
Harden this by requiring the type of path? e.g. directory? file etc.
This is racy in that it doesn't atomically check and it repeatedly checks but hopefully the probability of race is low enough that we can accept the race condition as negligible.
There was a problem hiding this comment.
Make sense, will do
cody-littley
left a comment
There was a problem hiding this comment.
Does this PR handle migration (i.e. moving memiavl data from original location to new location)?
We can handle that in the future, this PR doesn't do the migration, it's preparing the new folder structure for new nodes only |
* main: (51 commits) Giga storage integration test (#3268) test(flatkv): add flatkv integration testings (#3262) perf(app): reuse decoded transactions across ProcessProposalHandler hot path (#3257) Fix of the proto conv testing (#3261) FlatKV refactor for state sync import + export (#3250) Validate block part index matches proof index (CON-20) (#3256) fix: add retry to apt-get update in Docker CI (#3264) fix: autobahn InitChain, GetValidators, and mempool TTL (CON-249) (#3243) Fix buffer offset in ProposerPriorityHash (CON-200) (#3255) Handle error case in light client divergence detector (#3254) perf(evmrpc): eliminate redundant block fetches in simulate backend (#3208) fix(evmrpc): omit notifications from legacy JSON-RPC batch responses per spec (#3246) fix: deduplicate block fetch in getTransactionReceipt (#3244) Made autobahn producer use TxMempool (#3224) Skip signature event building during Cosmos CheckTx/ReCheckTx (#3230) Regenerate changelog in prep to tag v6.4.2 (#3240) Fix receipt default retention (#3237) feat(flatkv): introduce module-prefix physical keys across all FlatKV DBs (#3229) added a ProposerAddress check to setProposal CON-250 (#3232) feat: add AUTOBAHN option to local docker cluster (CON-247) (#3220) ...
* main: Giga store migration guide (#3227) Update SS write/read modes into single evm-ss-mode (#3278) fix(evmrpc): return empty array instead of null for eth_getFilterLogs and eth_getFilterChanges (#3292) feat: add autobahn integration tests - batch 1 (CON-249) (#3234) add block height modified to legacy data (#3276) Export ProposerPriorityHash metric for divergence monitoring (#3277) backport CW/wasmd@76eaff4 (#3258)
Describe your changes and provide context
The current data folder is not intuitive and not very clean for Giga storage. It currently looks like this:

The goal of this PR is to restructure the data folder for Giga into this new structure while also making it backward compatible:

Testing performed to validate your change
Added unit test to make sure it works for both new nodes and existing nodes which has the old path