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 and refactor log merge policy, fixes #1035 #1043

Merged
merged 6 commits into from
May 19, 2021

Conversation

PSeitz
Copy link
Contributor

@PSeitz PSeitz commented May 17, 2021

fixes a bug in log merge policy where an index was wrongly referenced by its index

@PSeitz PSeitz requested a review from fulmicoton May 17, 2021 17:46
if let Some(&(first_segment, log_size)) = sorted_segments_with_log_size.first() {
let mut current_max_log_size = log_size;
let mut levels = vec![vec![first_segment]];
for &(segment, segment_log_size) in (&sorted_segments_with_log_size).iter().skip(1) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

isn't it the same without the parenthesis and the &?

Copy link
Collaborator

Choose a reason for hiding this comment

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

for &(segment, segment_log_size) in sorted_segments_with_log_size.iter().skip(1) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I assume someone started with an iter on the ref &sorted_segments_with_log_size and added the skip later

.map(|ind_vec| {
MergeCandidate(ind_vec.iter().map(|&ind| segments[ind].id()).collect())
})
.map(|segments| MergeCandidate(segments.iter().map(|&seg| seg.id()).collect()))
.collect()
} else {
return vec![];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is dead code btw because of the early exit above

@PSeitz PSeitz requested a review from fulmicoton May 18, 2021 09:25
use std::cmp;
use std::f64;

const DEFAULT_LEVEL_LOG_SIZE: f64 = 0.75;
const DEFAULT_MIN_LAYER_SIZE: u32 = 10_000;
const DEFAULT_MIN_MERGE_SIZE: usize = 8;
const DEFAULT_MAX_MERGE_SIZE: usize = 10_000_000;
const DEFAULT_MIN_NUM_SEGMENTS_IN_MERGE: usize = 8;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thank you!

@fulmicoton fulmicoton merged commit bcd72e5 into quickwit-oss:main May 19, 2021
This was referenced Feb 18, 2022
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.

None yet

2 participants