fix(compaction): batch filename collision causes up to 84% data loss - #358
#358Merged
xe-nvdk merged 1 commit intoMar 27, 2026
mainBasekick-Labs/arc:mainfrom
fix/compaction-batch-filename-collisionBasekick-Labs/arc:fix/compaction-batch-filename-collisionCopy head branch name to clipboard
Merged
fix(compaction): batch filename collision causes up to 84% data loss#358xe-nvdk merged 1 commit intomainBasekick-Labs/arc:mainfrom fix/compaction-batch-filename-collisionBasekick-Labs/arc:fix/compaction-batch-filename-collisionCopy head branch name to clipboard
xe-nvdk merged 1 commit into
mainBasekick-Labs/arc:mainfrom
fix/compaction-batch-filename-collisionBasekick-Labs/arc:fix/compaction-batch-filename-collisionCopy head branch name to clipboard
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request addresses a critical data loss bug where compaction batches would overwrite each other due to filename collisions caused by second-precision timestamps. The fix introduces nanosecond precision to ensure unique filenames. Feedback suggests refining the filename format by using a single nanosecond-precision timestamp string instead of appending a raw Unix nanosecond value, which improves readability and maintains the existing filename structure.
…357) When partitions had >30 files, SplitCandidateIntoBatches created sequential batches of 30. Each batch generated output filenames with second-precision timestamps, causing all batches within the same second to produce identical filenames. Each batch overwrote the previous, destroying up to 84% of data. Fixed by adding UnixNano to compacted filenames for guaranteed uniqueness: system_20260327_020510_1774577110783053268_compacted.parquet Also updated extractNewestFileTime to handle both old format (measurement_YYYYMMDD_HHMMSS_compacted) and new format with nanos (measurement_YYYYMMDD_HHMMSS_nanos_compacted). Closes #357 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
xe-nvdk
force-pushed
the
fix/compaction-batch-filename-collision
branch
from
March 27, 2026 02:24
becec24 to
0efc610
Compare
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
SplitCandidateIntoBatchescreates sequential batches of 30. Each batch generated output filenames with second-precision timestamps (YYYYMMDD_HHMMSS), causing all batches to produce identical filenames. Each batch overwrote the previous — only the last batch survived.max_buffer_age_ms=500which produces ~120 files/hour.YYYYMMDD_HHMMSSprefix forextractNewestFileTimecompatibility.Closes #357
Test plan
go build ./cmd/... ./internal/...— cleango test ./internal/compaction/...— pass