Draft
Conversation
baca0ca to
c8f4f64
Compare
c8f4f64 to
84c6d7d
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.
Two-loop Partition Conversion
This MR refactors the converter to support flexible sub-daily partitions alongside daily historical conversion, enabling fresher data availability for recent metrics.
Key Changes
2025/01/19/parts/00-02for sub-daily,2025/01/19for dailyPartition Loop
Handles recent data within the lookback window (default 24h from now).
Behavior:
YYYY/MM/DD/parts/HH-HH(e.g.,2025/01/19/parts/00-02)Flags:
--convert.partition.run-interval30m--convert.partition.run-timeout2h--convert.partition.duration2h--convert.partition.lookback24h--convert.partition.max-steps1Historical Loop
Handles completed days that are fully in the past.
Behavior:
YYYY/MM/DD(e.g.,2025/01/19)Flags:
--convert.historical.run-interval1h--convert.historical.run-timeout24h--convert.historical.max-steps1Running Modes
The
--convert.modeflag controls which loops run:both(default)partitionhistoricalEach mode creates separate discoverers to avoid concurrent map access issues.
Serve
Query-time filtering prevents duplicate data when both partitions and daily blocks exist:
filterOverlappingPartitions()removes partition blocks from queries if a daily block exists for the same date2025/01/19and2025/01/19/parts/00-02exist, only the daily block is queriedCleanup
Once a daily block is created, partitions for that day become redundant. Three layers ensure they're cleaned up:
Bucket Cleanup
Runs after historical conversion via
cleanupStalePartitions(). Scans for partitions that have a corresponding daily block and deletes all files underYYYY/MM/DD/parts/. Only cleans days before yesterday (24-48h safety window) to ensure serve pods have discovered the daily block first.Syncer Cleanup
Runs on each sync cycle in serve pods. Detects partitions superseded by daily blocks, removes them from the in-memory block map, and deletes cached label files from local disk. Without this, serve pods would accumulate stale block references and orphaned label files, wasting memory and disk.
Query-time Filtering
filterOverlappingPartitions()runs at query time as a safety net. Excludes partition blocks if a daily block exists for the same date, preventing duplicate data during the transition window. This handles the race condition between daily block creation and syncer discovery, since different pods sync at different times.Latest Evaluation
Partition duration: 2h
Run interval: 30m
Converted Partitions (2026/02/10)