-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[CLN] Refactor log materializer to not need to pass in offset id explicitly for readers #2354
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,16 +164,8 @@ impl Operator<MergeMetadataResultsOperatorInput, MergeMetadataResultsOperatorOut | |
}; | ||
|
||
// Step 1: Materialize the logs. | ||
let mut offset_id = Arc::new(AtomicU32::new(1)); | ||
match record_segment_reader.as_ref() { | ||
Some(reader) => { | ||
offset_id = reader.get_current_max_offset_id(); | ||
offset_id.fetch_add(1, std::sync::atomic::Ordering::SeqCst); | ||
} | ||
None => {} | ||
}; | ||
let materializer = | ||
LogMaterializer::new(record_segment_reader, input.filtered_log.clone(), offset_id); | ||
LogMaterializer::new(record_segment_reader, input.filtered_log.clone(), None); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why were we loading it before? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We still need to read the curr_max_offset_id from the record segment. For readers, the onus of doing that has shifted to the materializer now. And writers need to still pass it explicitly since all the writer threads need to share the same curr_max_offset_id. |
||
let mat_records = match materializer.materialize().await { | ||
Ok(records) => records, | ||
Err(e) => { | ||
|
@@ -490,8 +482,7 @@ mod test { | |
}; | ||
} | ||
}; | ||
let materializer = | ||
LogMaterializer::new(record_segment_reader, data, Arc::new(AtomicU32::new(1))); | ||
let materializer = LogMaterializer::new(record_segment_reader, data, None); | ||
let mat_records = materializer | ||
.materialize() | ||
.await | ||
|
@@ -779,8 +770,7 @@ mod test { | |
}; | ||
} | ||
}; | ||
let materializer = | ||
LogMaterializer::new(record_segment_reader, data, Arc::new(AtomicU32::new(1))); | ||
let materializer = LogMaterializer::new(record_segment_reader, data, None); | ||
let mat_records = materializer | ||
.materialize() | ||
.await | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. This is the default value that we are passing in case the segment is uninitialized. Previously we were passing the next_offset_id (as opposed to curr_max_offset_id). I changed that to pass curr_max_offset_id now.