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

[PERF] Move write to blockfiles off main runtime #2740

Merged
merged 2 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
22 changes: 21 additions & 1 deletion rust/worker/src/execution/operators/flush_s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,26 @@ impl Operator<FlushS3Input, FlushS3Output> for FlushS3Operator {
}

async fn run(&self, input: &FlushS3Input) -> Result<FlushS3Output, Self::Error> {
// TODO: Ideally we shouldn't even have to make an explicit call to
// write_to_blockfiles since it is not the workflow for other segments
// and is exclusive to metadata segment. We should figure out a way
// to make this call a part of commit itself. It's not obvious directly
// how to do that since commit is per partition but write_to_blockfiles
// only need to be called once across all partitions combined.
// Eventually, we want the blockfile itself to support read then write semantics
// so we will get rid of this write_to_blockfile() extravaganza.
let mut metadata_segment_writer = input.metadata_segment_writer.clone();
match metadata_segment_writer
.write_to_blockfiles()
.instrument(tracing::info_span!("Writing to blockfiles"))
.await
{
Ok(()) => (),
Err(e) => {
tracing::error!("Error writing metadata segment out to blockfiles: {:?}", e);
return Err(Box::new(e));
}
}
let record_segment_flusher = input.record_segment_writer.clone().commit();
let record_segment_flush_info = match record_segment_flusher {
Ok(flusher) => {
Expand Down Expand Up @@ -113,7 +133,7 @@ impl Operator<FlushS3Input, FlushS3Output> for FlushS3Operator {
}
};

let metadata_segment_flusher = input.metadata_segment_writer.clone().commit();
let metadata_segment_flusher = metadata_segment_writer.commit();
let metadata_segment_flush_info = match metadata_segment_flusher {
Ok(flusher) => {
let segment_id = input.metadata_segment_writer.id;
Expand Down
19 changes: 0 additions & 19 deletions rust/worker/src/execution/orchestration/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,25 +622,6 @@ impl Handler<TaskResult<WriteSegmentsOutput, WriteSegmentsOperatorError>> for Co
}
};
if self.num_write_tasks == 0 {
// TODO: Ideally we shouldn't even have to make an explicit call to
// write_to_blockfiles since it is not the workflow for other segments
// and is exclusive to metadata segment. We should figure out a way
// to make this call a part of commit itself. It's not obvious directly
// how to do that since commit is per partition but write_to_blockfiles
// only need to be called once across all partitions combined.
let mut writer = output.metadata_segment_writer.clone();
match writer
.write_to_blockfiles()
.instrument(tracing::info_span!("Writing to blockfiles"))
.await
{
Ok(()) => (),
Err(e) => {
tracing::error!("Error writing metadata segment out to blockfiles: {:?}", e);
terminate_with_error(self.result_channel.take(), Box::new(e), ctx);
return;
}
}
self.flush_s3(
output.record_segment_writer,
output.hnsw_segment_writer,
Expand Down
Loading