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

[CLN] Refactor log materializer to not need to pass in offset id explicitly for readers #2354

Merged
merged 4 commits into from
Jun 18, 2024

Conversation

sanketkedia
Copy link
Contributor

Description of changes

Summarize the changes made by this PR.

  • Improvements & Bug fixes
    Readers can pass None for the current offset id when materializing and the materializer takes care of using the correct value by reading from the record segment. Writers still need to pass it in since it is shared by writers of different partitions.

Test plan

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

Documentation Changes

None

@sanketkedia sanketkedia requested a review from HammadB June 17, 2024 03:11
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)

@sanketkedia sanketkedia changed the title [CLN] Cleanup log materializer to not use offset id for readers [CLN] Cleanup log materializer to not need to pass in offset id explicitly for readers Jun 17, 2024
@sanketkedia sanketkedia changed the title [CLN] Cleanup log materializer to not need to pass in offset id explicitly for readers [CLN] Refactor log materializer to not need to pass in offset id explicitly for readers Jun 17, 2024
@sanketkedia sanketkedia mentioned this pull request Jun 17, 2024
4 tasks
@@ -113,7 +113,7 @@ impl CompactionManager {
dispatcher.clone(),
None,
None,
Arc::new(AtomicU32::new(1)),
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this correct?

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. 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.

let materializer =
LogMaterializer::new(record_segment_reader, input.filtered_log.clone(), offset_id);
LogMaterializer::new(record_segment_reader, input.filtered_log.clone(), None);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why were we loading it before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Collaborator

@HammadB HammadB left a comment

Choose a reason for hiding this comment

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

I think this is fine but I skimmed it.

@sanketkedia sanketkedia force-pushed the refactor_offset_id_materializer branch from d088e99 to 2f76cb8 Compare June 17, 2024 19:56
@sanketkedia sanketkedia force-pushed the refactor_offset_id_materializer branch from 2f76cb8 to c4199a4 Compare June 17, 2024 22:13
@sanketkedia sanketkedia merged commit f4d45f0 into main Jun 18, 2024
63 checks passed
Anush008 pushed a commit to Anush008/chroma that referenced this pull request Jun 27, 2024
…icitly for readers (chroma-core#2354)

## Description of changes

*Summarize the changes made by this PR.*
 - Improvements & Bug fixes
Readers can pass None for the current offset id when materializing and
the materializer takes care of using the correct value by reading from
the record segment. Writers still need to pass it in since it is shared
by writers of different partitions.

## Test plan
- [x] Tests pass locally with `pytest` for python, `yarn test` for js,
`cargo test` for rust

## Documentation Changes
None
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