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 #3247 +/- ##
==========================================
- Coverage 58.55% 58.31% -0.24%
==========================================
Files 2072 2085 +13
Lines 207968 208904 +936
==========================================
+ Hits 121773 121823 +50
- Misses 77420 78302 +882
- Partials 8775 8779 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
| @@ -0,0 +1,78 @@ | |||
| package blockdb | |||
There was a problem hiding this comment.
Recommend move blockDB code to ledger_db/block
| // Periodic prune. | ||
| if blk.Height > b.config.UnprunedBlocks { | ||
| b.metrics.SetMainThreadPhase("prune") | ||
| lowestToKeep := blk.Height - b.config.UnprunedBlocks | ||
| if err := b.db.Prune(b.ctx, lowestToKeep); err != nil { |
There was a problem hiding this comment.
The comment says periodic prune, but we are pruning for every block here
There was a problem hiding this comment.
Oops, fixed. Is now periodic. This was a bug.
|
|
||
| // ResolveAndCreateDir expands ~ to the home directory, resolves the path to | ||
| // an absolute path, and creates the directory if it doesn't exist. | ||
| func ResolveAndCreateDir(dataDir string) (string, error) { |
There was a problem hiding this comment.
Good catch. Yes, this was duplicated when I moved around code in feature branches. Deleted the duplicate.
| b.totalBlocksWritten = 0 | ||
| b.totalTransactionsWritten = 0 | ||
| b.startTimestamp = time.Now() | ||
| fmt.Printf("Benchmark resumed.\n") |
There was a problem hiding this comment.
also reset b.totalBytesWritten = 0 here?
There was a problem hiding this comment.
Oops, forgot that field. Fixed.
| } | ||
|
|
||
| // openBlockDB creates a BlockDB for the given backend name. | ||
| func openBlockDB(backend string, dataDir string, unprunedBlocks uint64) (block.BlockDB, error) { |
There was a problem hiding this comment.
seems dataDir and unprunedBlocks params are not used
There was a problem hiding this comment.
unprunedBlocks does not belong here (removed). But the dataDir is going to be needed for DB implementations that write their data to disk. In my experimental branch, I've got two such implementations (pebble and littDB), but I didn't include those in this PR to reduce scope.
| // The number of blocks to keep in the database after pruning. | ||
| UnprunedBlocks uint64 | ||
|
|
||
| // Iniitate pruning every this many blocks. |
| "github.com/sei-protocol/sei-chain/sei-db/common/utils" | ||
| ) | ||
|
|
||
| const AddressLen = 20 // EVM address length |
There was a problem hiding this comment.
should we put this in sei-db/common/keys as it's not random number
There was a problem hiding this comment.
Good suggestion, change made
Created a benchmarking framework for the block DB. This benchmark currently exercises the write pathway. The read pathway benchmarking will come in a future PR.