Skip to content

Storage read visiblity#3566

Open
Kbhat1 wants to merge 5 commits into
mainfrom
StorageReadVisiblity
Open

Storage read visiblity#3566
Kbhat1 wants to merge 5 commits into
mainfrom
StorageReadVisiblity

Conversation

@Kbhat1

@Kbhat1 Kbhat1 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Describe your changes and provide context

Testing performed to validate your change

@cursor

cursor Bot commented Jun 9, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Metrics are off by default and only add counter increments on existing DB paths; the early-return in MVCC Get for pruned versions aligns with other read paths and is low risk.

Overview
Adds opt-in OpenTelemetry counters (pebble_estimated_reads / pebble_estimated_writes) on Pebble hot paths so operators can approximate read amplification (reads ÷ writes). Counters are tagged with a db attribute from the data directory name.

Configuration is wired end-to-end: new enable-read-write-metrics (or ss-enable-read-write-metrics) flags for FlatKV, state-store, and receipt-store, plus app.toml templates and GetConfig / parseSCConfigs / parseSSConfigs parsing. FlatKV propagates the flag into all Pebble DB configs; receipt parquet passes it into the Pebble tx-hash index.

Instrumentation lives in a new OperationMetrics helper and is hooked into the raw Pebble wrapper (get/set/delete/batch/iterator), MVCC SS (gets, batches, prune scans, iterators), FlatKV Pebble DBs, and receipt Pebble backends.

Behavior tweak: MVCC Get now returns (nil, nil) when targetVersion is below the earliest retained version, before choosing ascending vs descending read paths.

Reviewed by Cursor Bugbot for commit aeec698. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

The latest Buf updates on your PR. Results from workflow Buf / buf (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed✅ passed✅ passed✅ passedJun 9, 2026, 4:33 PM

@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 52.94118% with 88 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.55%. Comparing base (c2743f7) to head (aeec698).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...i-db/db_engine/pebbledb/mvcc/iterator_ascending.go 0.00% 25 Missing ⚠️
sei-db/db_engine/pebbledb/operation_metrics.go 33.33% 18 Missing ⚠️
sei-db/db_engine/pebbledb/mvcc/batch.go 48.27% 14 Missing and 1 partial ⚠️
sei-cosmos/server/config/config.go 44.44% 5 Missing and 5 partials ⚠️
sei-db/db_engine/pebbledb/mvcc/db_ascending.go 10.00% 9 Missing ⚠️
sei-db/db_engine/pebbledb/mvcc/db.go 89.28% 3 Missing ⚠️
sei-db/config/receipt_config.go 60.00% 1 Missing and 1 partial ⚠️
sei-db/db_engine/pebbledb/db.go 81.81% 2 Missing ⚠️
sei-db/db_engine/pebbledb/iterator.go 75.00% 1 Missing and 1 partial ⚠️
sei-db/db_engine/pebbledb/mvcc/iterator.go 77.77% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3566      +/-   ##
==========================================
- Coverage   59.18%   58.55%   -0.64%     
==========================================
  Files        2225     2168      -57     
  Lines      183619   178077    -5542     
==========================================
- Hits       108673   104266    -4407     
+ Misses      65152    64442     -710     
+ Partials     9794     9369     -425     
Flag Coverage Δ
sei-chain-pr 64.25% <51.11%> (?)
sei-db 70.41% <ø> (ø)
sei-db-state-db ?
sei-db-state-db-pr 74.90% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
app/receipt_store_config.go 75.00% <ø> (ø)
app/seidb.go 74.32% <100.00%> (+0.71%) ⬆️
sei-db/config/ss_config.go 100.00% <ø> (ø)
sei-db/db_engine/pebbledb/batch.go 89.47% <100.00%> (+1.23%) ⬆️
sei-db/db_engine/pebbledb/pebbledb_config.go 60.00% <ø> (ø)
sei-db/ledger_db/receipt/parquet_store.go 71.26% <100.00%> (ø)
sei-db/ledger_db/receipt/receipt_store.go 66.83% <100.00%> (+0.16%) ⬆️
sei-db/ledger_db/receipt/tx_hash_index.go 65.18% <100.00%> (+0.52%) ⬆️
sei-db/state_db/sc/flatkv/config/config.go 74.19% <ø> (ø)
sei-db/state_db/sc/flatkv/store.go 77.23% <100.00%> (+0.29%) ⬆️
... and 11 more

... and 62 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant