Fix snapshot point read cache options - #1079
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master-n3 #1079 +/- ##
=============================================
+ Coverage 50.34% 50.42% +0.08%
=============================================
Files 280 280
Lines 16473 16477 +4
Branches 2132 2132
=============================================
+ Hits 8293 8309 +16
+ Misses 7619 7605 -14
- Partials 561 563 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
What improvements have been made? |
|
The improvement is in the snapshot point-read path. Before this change, each storage snapshot used a single read option with The concrete symptom this can cause is high disk read I/O during transaction-heavy consensus processing. The DBFT path does many snapshot point reads while checking existing transactions, conflict hashes, and transaction verification state. When those reads do not populate the DB cache, the same hot storage blocks can be read/decompressed repeatedly instead of being served from the DB cache. On busy nodes this may show up as saturated read I/O and delayed or unresponsive consensus handling. This PR keeps
I also ran a local microbenchmark for repeated snapshot point reads. This is not a full chain benchmark, but it matches the hot point-read pattern this PR changes. Environment:
The main goal is not to speed up scans. The goal is to avoid making normal snapshot point reads behave like bulk scans from the cache perspective. |
|
But then Contains is not cached? |
| public class SnapshotReadOptionsTest | ||
| { | ||
| [TestMethod] | ||
| public void LevelDbSnapshotUsesDedicatedReadOptionsForScanAndPointReads() |
There was a problem hiding this comment.
[suggestion] LevelDbSnapshotUsesDedicatedReadOptionsForScanAndPointReads and RocksDbSnapshotUsesDedicatedReadOptionsForScanAndPointReads never construct a snapshot and never inspect fill-cache. They only scan method IL for the _scan* vs _point* field tokens. A constructor that set FillCache=false on the point-read options (or forgot SetFillCache(false) on the scan options) would still pass, which is the behavior this PR is meant to lock in. UsesField also matches a metadata token anywhere in the body (no ldfld/ldflda check) and AssertMethodUsesOnly treats “any overload/state-machine method references the expected field” as success, so one TryGet overload could silently miss the point-read options if the other hit.
Suggestion: Also scan the constructors (or otherwise assert setup) so scan options are the only ones that disable fill-cache, and require every TryGet overload to load the point-read field. Prefer opcode-aware ldfld matching over a raw 4-byte token search.
ping @Jim8y |
Summary
Testing