Skip to content

fix(compaction): batch filename collision causes up to 84% data loss …#359

Closed
xe-nvdk wants to merge 1 commit into
mainfrom
release/26.03.2
Closed

fix(compaction): batch filename collision causes up to 84% data loss …#359
xe-nvdk wants to merge 1 commit into
mainfrom
release/26.03.2

Conversation

@xe-nvdk

@xe-nvdk xe-nvdk commented Mar 27, 2026

Copy link
Copy Markdown
Member

…(#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. Updated extractNewestFileTime to handle both old and new filename formats.

…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.
Updated extractNewestFileTime to handle both old and new filename formats.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@xe-nvdk

xe-nvdk commented Mar 27, 2026

Copy link
Copy Markdown
Member Author

Fix already merged into main via PR #358. This release branch was a cherry-pick for the v26.03.2 hotfix.

@xe-nvdk xe-nvdk closed this Mar 27, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the compaction process to include nanosecond timestamps in generated filenames, preventing data loss from file overwrites during sequential batch runs. Corresponding changes were made to the file time extraction logic to support parsing these new formats. A review comment suggests correcting a descriptive comment to accurately reflect the new filename structure.

filename = strings.TrimSuffix(filename, ".parquet")

// Check if it's a daily compacted file: measurement_YYYYMMDD_HHMMSS_daily
// Check if it's a tier-compacted file: measurement_YYYYMMDD_HHMMSS_{nanos}_{daily|compacted}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The comment on this line describes the tier-compacted file format as measurement_YYYYMMDD_HHMMSS_{nanos}_{daily|compacted}. However, based on the new filename generation logic in job.go, the _nanos part is inserted before the _daily or _compacted suffix. A more accurate description of the filename structure (before stripping the .parquet extension) would be measurement_YYYYMMDD_HHMMSS_nanos_{daily|compacted}. Updating this comment would improve clarity and consistency with the actual file naming convention.

Suggested change
// Check if it's a tier-compacted file: measurement_YYYYMMDD_HHMMSS_{nanos}_{daily|compacted}
// Check if it's a tier-compacted file: measurement_YYYYMMDD_HHMMSS_nanos_{daily|compacted}

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant