fix: skip unchanged L0 retention checks - #1481
Open
UniversePeak wants to merge 2 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Avoid repeated replica LIST requests from the L0 retention monitor when a database's local L0 watermark and cached L1 watermark have not changed. The retention pass now serializes per database, reuses the existing L1 max-file cache, and retries time-only eligibility changes at the next eligible timestamp.
Problem
Store.monitorL0Retentionruns everyL0RetentionCheckInterval(15 seconds by default) andDB.EnforceL0RetentionByTimepreviously listed the replica at level 1 and level 0 on every tick, even when an idle database had not changed. That creates up to 5,760 unnecessary LIST requests per database per day.Solution
MaxLTXFileInfofor the cached L1 max file instead of listing level 1 directly on every pass.Scope
In scope:
Not in scope:
Test Plan
CGO_ENABLED=0 go.exe test -run TestDB_EnforceL0RetentionByTime_SkipsUnchangedDatabase -count=10 .(pass)CGO_ENABLED=0 go.exe test -run '^$' ./...(pass; all packages compile)CGO_ENABLED=0 go.exe vet ./...(pass)go test -race ...was attempted but this Windows host has no CGO compiler/toolchain; Go reported-race requires cgo.pre-commit run --files db.go db_test.go store.gowas attempted; hook environment setup was blocked by a network read timeout downloading setuptools.gofmtandgit diff --checkpass.The full package test suite was also attempted, but this Windows environment's file-backend tests fail with
Access is deniedwhile syncing temporary directories; this is independent of the focused regression test, which passes repeatedly.Related