feat(blockstm): cache pre-state to optimize value-based validation#25814
feat(blockstm): cache pre-state to optimize value-based validation#25814mmsqe wants to merge 8 commits intocosmos:mainfrom
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #25814 +/- ##
==========================================
- Coverage 68.85% 68.78% -0.08%
==========================================
Files 926 930 +4
Lines 60567 60956 +389
==========================================
+ Hits 41706 41931 +225
- Misses 18861 19025 +164
🚀 New features to boost your workflow:
|
| const minSnapshotKeysCap = 1024 | ||
|
|
||
| type mvIndexEntry[V any] struct { | ||
| key []byte |
There was a problem hiding this comment.
If we'll choose an unordered data structure, you may give sync.Map a try?
There was a problem hiding this comment.
sec/op and B/op are similar on average, but seems syncmap allocate more (allocs/op geomean +10.08%).
There was a problem hiding this comment.
allocs/op don't matter if sec/op and B/op is the same right?
The main trade-off in all unordered data structure based approach, is the heavy iteration overhead.
* add Has operation validation that ignores version changes, only checking for existence state (Found/Deleted) * reduce memory overhead by packing HasDescriptor into ReadDescriptor * add negative caching for Has lookups to prevent repeated fallback to storage for non-existent keys * add readFound skip large value * handle snapshots * avoid storage.Get for Has() resolve fix
* add mvIndex sharded key->version-tree map * update mvData iterator/snapshot paths to use key snapshots * refactor MVIterator to iterate snapshot keys * cache mvIndex key snapshot
switch per-key version trees to an in-place, locked tidwall/btree to avoid btree.Copy on updates
* replace lock-holding btree iteration with a chunked cursor that releases locks between refills * use COW key snapshots so iterators stay serializable without blocking writers while waiting on dependencies
* avoid per-key COW snapshots: keep 0/1 item inline and promote to a locked B-tree on demand * avoid per-Set allocations on the single-item path
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days-before-close if no further activity occurs. |
Description
Closes: #25777