Skip to content

fix(storage): apply StorageConfig.TTL as the default entry TTL in Put - #223

Merged
ovaistariq merged 1 commit into
mainfrom
fix/default-entry-ttl
Aug 18, 2026
Merged

ovaistariq merged 1 commit into
mainfrom
fix/default-entry-ttl

Conversation

@ovaistariq

@ovaistariq ovaistariq commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Fixes the High-severity Cursor Bugbot finding on release PR #221: after #218 removed the metadata DB's engine-level TTL, StorageConfig.TTL had no remaining consumer — a Put with no key-level TTL never received an expiry, so the documented "default TTL when no key-level TTL is set" contract silently stopped working (server -ttl users would never expire data; TAG is unaffected since it passes explicit per-put TTLs).

Fix: apply the default app-side in Put (ttl <= 0 → s.defaultTTL), where expiry is enforced by the cleaner — which stages file/segment reclamation correctly — rather than by the engine filter, which dropped internal bookkeeping keys and orphaned backing bytes (the original #218 motivation).

Tests: new TestPut_AppliesConfiguredDefaultTTL (default applied when configured; no expiry when unconfigured), TestDeleteIndexSurvivesEntryTTL still passes, full ./storage/... suite green (11 packages).

🤖 Generated with Claude Code

https://claude.ai/code/session_01L5DLvDTo9dhD38YQXhHpU9


Note

Cursor Bugbot is generating a summary for commit 701d02d. Configure here.

Removing the metadata DB's engine-level TTL (#218) left
StorageConfig.TTL with no consumer: a Put with no key-level TTL never
received an expiry, so configured default expiry silently stopped
working (flagged by Cursor Bugbot on the release PR). Apply the default
app-side in Put, where expiry is enforced by the cleaner — which stages
file and segment reclamation — instead of the engine filter that
dropped bookkeeping keys and orphaned backing bytes.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01L5DLvDTo9dhD38YQXhHpU9
Signed-off-by: Ovais Tariq <[email protected]>
@greptile-apps

greptile-apps Bot commented Aug 18, 2026

Copy link
Copy Markdown

Greptile Summary

Applies StorageConfig.TTL to writes that omit a positive key-level TTL, restoring default expiration without enabling RocksDB’s engine-level TTL.

  • Stores the configured default TTL on each Storage instance and applies it in Put.
  • Adds coverage for configured and unconfigured default-TTL behavior.

Confidence Score: 5/5

The PR appears safe to merge, with default expiration restored through the existing application-level expiry and cleanup paths.

The configured TTL now reaches ValueMessage.Expiry for writes without a positive per-entry TTL, and existing read, cleaner, compaction, and reclamation paths consistently preserve and enforce that expiry.

Important Files Changed

Filename Overview
storage/storage.go Correctly applies the configured default before constructing metadata expiry for both inline and file-backed values; no actionable defect was identified.
storage/metadata_engine_ttl_test.go Adds focused regression coverage confirming that omitted per-entry TTLs inherit the configured default while an unconfigured default remains non-expiring.

Reviews (1): Last reviewed commit: "fix(storage): apply StorageConfig.TTL as..." | Re-trigger Greptile

@ovaistariq
ovaistariq merged commit 483aa5b into main Aug 18, 2026
12 checks passed
@ovaistariq
ovaistariq deleted the fix/default-entry-ttl branch August 18, 2026 05:49
@tigrisdata-argocd-bot

Copy link
Copy Markdown

🎉 This PR is included in version 1.10.2 🎉

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.

2 participants