Repository navigation
Conversation
kyasbal
requested review from
K53,
RyuSA,
jyane,
kkuchima and
renamoo
as code owners
December 1, 2026 03:25
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the TTLCleaner implementation to improve concurrency safety, idempotency, and support restarting. The internal synchronization mechanism was updated to replace sync.WaitGroup and a boolean running flag with coordinated stopChan and doneChan channels, ensuring that Stop() waits for any in-flight sweep to complete. Additionally, the test suite was significantly expanded using testing/synctest to cover edge cases such as stopping before starting, restarting, concurrent races, and synchronous panics on non-positive intervals. There are no review comments, and I have no feedback to provide.
Go Quality Report (
|
| Metric | Result |
|---|---|
| Changed Scope | 1 prod file(s), 1 test file(s), 8 unit(s) |
| Patch Coverage | 100.0% (35/35 lines) |
| Mutation Score | 100.0% (8/8 killed, 0 survived) |
| Function Similarity | OK (2 new unit(s), 0 matches across 3185 corpus units) |
Commit: ddda61c7d36b · Cloud Build Logs
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
Aligns
pkg/common/ttlcleanerwith KHI Go coding and testing conventions without modifying exported APIs, while fixing five concurrency and lifecycle bugs:sync.WaitGroup+running+ sharedstopChanlifecycle with mutex-guarded per-runstopChananddoneChanchannels (tryStart/run), eliminatingStart/Stopraces and WaitGroup reuse panics.Start -> Stop -> Startrestarts safe and single-flight (Startwaits for any stopping run goroutine to finish before spawning a new one).Stop()callers wait until any in-flightSweep()and ticker teardown complete.time.NewTicker(c.interval)intotryStart()before mutating state so a non-positive interval panics synchronously without leaving corrupted state or crashing an unrecoverable background goroutine.<-stopChanover buffered<-ticker.Cticks during shutdown and registers LIFO defers soticker.Stop()completes beforedoneChancloses.time.Sleeptotesting/synctestand adds boundary, partial-eviction error isolation, restart, concurrentStop/Startbarrier, non-positive interval panic, and-racestress tests (100.0%statement coverage).Verification
make pre-push— PASS (0 mustfix, 0 advisory, 0 skipped)make qa-all-advisory CODEQUALITY_SIMILARITY=true— PASS (0 mustfix, 0 advisory, 0 skipped; 8/8 mutants killed, 0 similarity advisories)go test -race -count=1 -cover ./pkg/common/ttlcleaner/... ./pkg/server/chunkedupload/... ./pkg/server/streamingutil/...— PASS (pkg/common/ttlcleaner:100.0%statement coverage)