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

[ENH]: move materialization into operator #3357

Merged
merged 5 commits into from
Jan 3, 2025

Conversation

codetheweb
Copy link
Contributor

@codetheweb codetheweb commented Dec 26, 2024

Description of changes

Log materialization is now in its own operator. Having materialization in its own operator unlocks two main benefits:

  • allows us to pipeline log applications across segment types (currently unrealized)
  • we can easily bail for any partition with an empty set of materialized records before constructing writers

Test plan

How are these changes tested?

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

Tested locally with SciDocs as well.

Documentation Changes

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

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)

UnintializedWriter,
ApplyMaterializedLogsErrorMetadataSegment(#[from] MetadataSegmentError),
#[error("Uninitialized writer")]
UninitializedWriter,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

misspelling fixes

@codetheweb codetheweb force-pushed the feat-materialize-operator-2 branch from c8fca26 to 500bf8a Compare December 26, 2024 18:34
@codetheweb codetheweb marked this pull request as ready for review December 26, 2024 20:56
@codetheweb codetheweb force-pushed the feat-materialize-operator-2 branch 2 times, most recently from 99780f2 to b25da8b Compare December 27, 2024 16:27
max_compaction_size: usize,
max_partition_size: usize,
// Populated during the compaction process
cached_segments: Option<Vec<Segment>>,
writers: OnceCell<CompactWriters>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice use of OnceCell

@@ -70,16 +76,16 @@ understand. We can always add more abstraction later if we need it.
enum ExecutionState {
Pending,
Partition,
Write,
MaterializeAndWrite,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should these be two separate states?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

because of partitioning, there may be simultaneous materialization and segment writing occurring
we could add a synchronization point between the two steps if that's what you mean?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes that is what I am asking, materialization seems lightweight enough to make this discrete but I am not sure if there are any valid reasons other than it feels cleaner.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

understood
I prefer to leave it as-is for now
after the third PR in this stack materialization, segment writing, committing, and flushing can all (theoretically) be running concurrently for different partitions
so if there's a good reason to have a sync point here (debugging? not sure how helpful it would be though) we should probably also add a sync point for all other steps

@codetheweb codetheweb force-pushed the feat-materialize-operator-2 branch from b25da8b to 88c8462 Compare January 2, 2025 22:07
Copy link
Contributor Author

codetheweb commented Jan 3, 2025

Merge activity

  • Jan 3, 11:14 AM EST: A user started a stack merge that includes this pull request via Graphite.
  • Jan 3, 11:15 AM EST: Graphite rebased this pull request as part of a merge.
  • Jan 3, 11:16 AM EST: A user merged this pull request with Graphite.

@codetheweb codetheweb force-pushed the feat-materialize-operator-2 branch from 88c8462 to b170c08 Compare January 3, 2025 16:15
@codetheweb codetheweb merged commit 19e1971 into main Jan 3, 2025
76 of 77 checks passed
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