Skip to content

perf(storage): skip unused inline payload decoding - #240

Merged
ovaistariq merged 2 commits into
mainfrom
perfloop-pr-open-xc9gpz33hk
Aug 23, 2026
Merged

ovaistariq merged 2 commits into
mainfrom
perfloop-pr-open-xc9gpz33hk

Conversation

@perfloop

@perfloop perfloop Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

What changed

Replace the temporary ValueMessage used by DeleteKey and overwrite cleanup with a bounded wire scan. These paths retain only the value type, length, and backing paths, so they skip inline payload data they do not use.

The scan is intentionally limited to cleanup fields. It validates the full record and copies retained paths before the RocksDB slice is released; callers that need payload bytes retain the full protobuf decode.

Add public delete benchmarks for inline, raw-file, and segment-backed values, plus overwrite guardrails for the shared cleanup path.

Testing

  • STATIC_BUILD=true make test-storage TESTRUN=DecodeValueMessageCleanupFields
  • STATIC_BUILD=true make test-storage TEST=TestStorage_DeleteKey_MalformedSegmentMetadataSkipsCleanup
  • STATIC_BUILD=true make test-storage TESTRUN=TestStorage_DeleteIndex
  • STATIC_BUILD=true make test-storage TESTRUN=TestPutOverwrite
  • STATIC_BUILD=true make test-server TEST=TestCacheServiceDeleteInlineAtDefaultThreshold
  • STATIC_BUILD=true make test-server TEST=TestCacheServiceDeleteSegment
  • STATIC_BUILD=true make test-server TEST=TestCacheServicePutObjectOverwriteSegment
  • STATIC_BUILD=true make lint
  • STATIC_BUILD=true make license-check

Workload: CacheService.Delete of a present 64 KiB INLINE value

Metric Before After Change
B/op 678 406.5 40% lower
allocs/op 15 13 13.3% lower
Checks: 1 passed.

Generated by Perfloop. Measurements and checks.


Note

Medium Risk
Touches delete and overwrite reclaim (size accounting, raw-file queueing, segment dead-byte credits). Decode mismatches could skip cleanup or mis-credit segments; tests cover malformed metadata and proto agreement.

Overview
Delete and overwrite cleanup no longer materialize a full ValueMessage (including up to 64 KiB of inline Data). DeleteKey and existingValue now scan only type, length, and backing paths via decodeValueMessageCleanupFields, then copy those paths so they remain valid after the RocksDB slice is released.

Malformed records still drop metadata without crediting a segment they cannot decode. Adds CacheService delete/overwrite benchmarks (inline, raw file, segment) and a Makefile compile target for paired runs.

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

@greptile-apps

greptile-apps Bot commented Aug 23, 2026

Copy link
Copy Markdown

Greptile Summary

The PR optimizes delete and overwrite cleanup by scanning only the protobuf fields needed for accounting and backing-storage reclamation, avoiding inline payload decoding.

  • Adds a bounded wire-level cleanup-field decoder that validates the complete record and copies retained paths.
  • Uses the reduced representation in DeleteKey and overwrite cleanup while preserving atomic segment crediting and post-commit raw-file deletion.
  • Adds service benchmarks and regression coverage for inline, raw-file, segment-backed, malformed, and overwrite scenarios.
  • Adds a Makefile target for compiling the service delete benchmark.

Confidence Score: 5/5

The PR appears safe to merge, with cleanup ordering and decoding behavior preserved by the optimized path.

The reduced decoder retains every field used by deletion and overwrite cleanup, validates the complete wire record, copies paths before releasing RocksDB storage, and leaves segment crediting and raw-file deletion at their required transactional boundaries.

Important Files Changed

Filename Overview
storage/value_wire.go Adds a bounded protobuf wire scan for cleanup fields while retaining complete-record validation, last-value scalar semantics, unknown-field handling, and owned path strings.
storage/storage.go Switches delete and overwrite cleanup to the reduced decoded representation while preserving segment-credit atomicity and post-commit raw-file queueing.
storage/value_wire_test.go Verifies parity with full protobuf decoding across normal, duplicate, unknown, malformed, and invalid UTF-8 records and confirms retained paths are copied.
server/service/cache_service_delete_benchmark_test.go Adds public-path delete and overwrite benchmarks plus storage-tier guardrails for inline, raw-file, and compacted segment values.
storage/delete_index_test.go Confirms malformed segment metadata is deleted without incorrectly crediting an incompletely decoded segment.
Makefile Adds a guarded target that compiles the CacheService delete benchmark outside paired benchmark timing.

Reviews (1): Last reviewed commit: "perf(storage): skip unused inline payloa..." | Re-trigger Greptile

@ovaistariq
ovaistariq merged commit 0c355b1 into main Aug 23, 2026
13 checks passed
@ovaistariq
ovaistariq deleted the perfloop-pr-open-xc9gpz33hk branch August 23, 2026 18:29
@tigrisdata-argocd-bot

Copy link
Copy Markdown

🎉 This PR is included in version 1.12.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants