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]: pipeline segment committing/flushing #3360

Merged
merged 5 commits into from
Jan 6, 2025

Conversation

codetheweb
Copy link
Contributor

@codetheweb codetheweb commented Dec 27, 2024

Description of changes

This introduces two new operators that allow committing and flushing individual segments. This enables pipelining across all segment types.

Some changes in service of this:

  • write_to_blockfiles() is renamed to a generic finish() method on the SegmentWriter trait.
  • There is an enum over all segment writer and flusher types to allow for enum dispatch.
  • Tasks for each segment are grouped together under the same span.

An example trace (with two partitions):

Screen.Recording.2024-11-20.at.5.09.37.PM.mov

Test plan

How are these changes tested?

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Also tested with SciDocs.

Documentation Changes

Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs repository?

n/a

Copy link

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@codetheweb codetheweb force-pushed the feat-pipeline-flushing-2 branch from 220a7ee to c81c89f Compare December 27, 2024 19:30
@codetheweb codetheweb marked this pull request as ready for review December 27, 2024 19:33
@codetheweb codetheweb requested a review from HammadB December 27, 2024 19:33
@codetheweb codetheweb force-pushed the feat-pipeline-flushing-2 branch from c81c89f to 1e493ab Compare December 28, 2024 17:49
@codetheweb codetheweb force-pushed the perf-parallelize-applying-log-2 branch from 2e9a2e0 to d09d690 Compare January 2, 2025 22:07
@codetheweb codetheweb force-pushed the feat-pipeline-flushing-2 branch from 1e493ab to ad6e0db Compare January 2, 2025 22:07
@codetheweb codetheweb changed the base branch from perf-parallelize-applying-log-2 to graphite-base/3360 January 3, 2025 16:18
@codetheweb codetheweb force-pushed the feat-pipeline-flushing-2 branch from ad6e0db to 3b1a65f Compare January 3, 2025 16:20
@codetheweb codetheweb changed the base branch from graphite-base/3360 to main January 3, 2025 16:21
@codetheweb codetheweb force-pushed the feat-pipeline-flushing-2 branch from 3b1a65f to a37ca15 Compare January 3, 2025 16:21
// Result Channel
result_channel: Option<Sender<Result<CompactionResponse, CompactionError>>>,
max_compaction_size: usize,
max_partition_size: usize,
// Populated during the compaction process
cached_segments: Option<Vec<Segment>>,
writers: OnceCell<CompactWriters>,
flush_results: Vec<SegmentFlushInfo>,
// We track a parent span for each segment type so we can group all the spans for a given segment type (makes the resulting trace much easier to read)
segment_spans: HashMap<SegmentUuid, Span>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

<3

@codetheweb codetheweb force-pushed the feat-pipeline-flushing-2 branch from a37ca15 to 8ff398b Compare January 3, 2025 19:24
num_write_tasks: i32,
// Tracks the total remaining number of MaterializeLogs tasks
num_uncompleted_materialization_tasks: usize,
// Tracks the total remaining number of tasks per segment
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is write tasks + commit tasks + flush tasks right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep

@codetheweb codetheweb force-pushed the feat-pipeline-flushing-2 branch from 34de5a2 to d165237 Compare January 6, 2025 20:59
Copy link
Contributor Author

codetheweb commented Jan 6, 2025

Merge activity

  • Jan 6, 4:47 PM EST: A user started a stack merge that includes this pull request via Graphite.
  • Jan 6, 4:47 PM EST: A user merged this pull request with Graphite.

@codetheweb codetheweb merged commit e916633 into main Jan 6, 2025
79 checks passed
@codetheweb codetheweb deleted the feat-pipeline-flushing-2 branch January 6, 2025 21:47
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.

2 participants