Skip to content

Conversation

@tanujnay112
Copy link
Contributor

@tanujnay112 tanujnay112 commented Oct 30, 2025

Description of changes

Summarize the changes made by this PR.

We were flushing the input collection's pulled offset to the output collection's compacted offset field during function invocation. This change fixes that.

  • Improvements & Bug fixes
    • ^^^
  • New functionality
    • ...

Test plan

How are these changes tested?

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

Migration plan

Are there any migrations, or any forwards/backwards compatibility changes needed in order to make sure this change deploys reliably?

Observability plan

What is the plan to instrument and monitor this change?

Documentation Changes

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

Copy link
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions
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)

@tanujnay112 tanujnay112 marked this pull request as ready for review October 30, 2025 08:47
@tanujnay112 tanujnay112 requested a review from rescrv October 30, 2025 08:48
@propel-code-bot
Copy link
Contributor

propel-code-bot bot commented Oct 30, 2025

Separate input vs output log offsets during compaction registration

Introduces distinct tracking for the pulled log offset of the input collection versus the output collection during compaction/attached-function execution. The change corrects a bug where the input offset was incorrectly flushed as the output collection’s compacted offset, leading to wrong completion_offset calculations for attached functions.

Key Changes

• Replaced pulled_log_offset with input_pulled_log_offset and new output_pulled_log_offset in CompactOrchestrator (rust/worker/src/execution/orchestration/compact.rs).
• Added helper method set_input_log_offset() to synchronise offsets only when input and output collections are identical.
• Propagated new fields through constructor, state initialisation, fetch-log handling, and register flow.
• Extended RegisterInput with input_pulled_log_offset and updated completion_offset computation to use it, avoiding prior off-by-one bug.
• Adjusted all call sites (compactor path & unit tests) to pass the additional parameter.

Affected Areas

rust/worker/src/execution/orchestration/compact.rs – state struct, fetch-log handling, register logic
rust/worker/src/execution/operators/register.rs – input struct, offset calculation, tests

This summary was automatically generated by @propel-code-bot

// In practice, input_pulled_log_offset means "next offset to start compacting from"
// So to get "last offset processed"/"completion_offset", we subtract 1
let last_offset_processed = if input.input_pulled_log_offset > 0 {
(input.input_pulled_log_offset - 1).max(0) as u64
Copy link
Contributor

Choose a reason for hiding this comment

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

why .max(0) if you're guaranteeing it's greater than zero?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, thanks!

@tanujnay112 tanujnay112 force-pushed the fix_output_collection_offset branch from 0b80e07 to ad62555 Compare October 30, 2025 17:38
@tanujnay112 tanujnay112 requested a review from rescrv October 30, 2025 17:39
@tanujnay112 tanujnay112 merged commit 12db1ea into main Oct 30, 2025
62 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.

3 participants