Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: find latest window #5037

Merged
merged 2 commits into from
Nov 21, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/mito2/src/compaction/twcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,10 @@ fn find_latest_window_in_seconds<'a>(
let mut latest_timestamp = None;
for f in files {
let (_, end) = f.time_range();
if let Some(latest) = latest_timestamp
&& end > latest
{
latest_timestamp = Some(end);
if let Some(latest) = latest_timestamp {
if end > latest {
latest_timestamp = Some(end);
}
} else {
latest_timestamp = Some(end);
}
Expand Down Expand Up @@ -406,6 +406,14 @@ mod tests {
)
.unwrap()
);

assert_eq!(
Some((i64::MAX / 3600000 + 1) * 3600),
find_latest_window_in_seconds(
[new_file_handle(FileId::random(), i64::MIN, i64::MAX, 0),].iter(),
3600
)
);
}

#[test]
Expand Down
Loading