-
Notifications
You must be signed in to change notification settings - Fork 66
[WIP] Ack/Nack for routing in transform_processor #1798
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
base: main
Are you sure you want to change the base?
[WIP] Ack/Nack for routing in transform_processor #1798
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1798 +/- ##
==========================================
- Coverage 84.22% 83.56% -0.67%
==========================================
Files 486 506 +20
Lines 140885 147598 +6713
==========================================
+ Hits 118657 123336 +4679
- Misses 21694 23728 +2034
Partials 534 534
🚀 New features to boost your workflow:
|
|
@jmacd could I ask you for a review on this :)? I was using the batch_processor Ack/Nack implementation as inspiration. One thing in particular I'd like to ensure is correct is the behaviour of juggling the contexts. Basically when we find we've split the batch
Then when we receive an Ack/Nack:
I'm also curious if, when testing, is this the correct way to setup test otel-arrow/rust/otap-dataflow/crates/otap/src/transform_processor.rs Lines 996 to 1017 in e5a0975
I realize I'm asking you to reverse engineer a lot of code here, so happy to walk through on teams if it's easier :) |
jmacd
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Looks like maybe the new code could be applied to the batch_processor in a future PR, maybe.
|
@albertlockett I think you want to use a call to Context::next_ack, for the test section you quoted. This does what the effect handler would have done when the recipient responded with an Ack. See how batch_processor.rs tests use Context::next_ack, basically. |
|
Yeah I think we could reuse the |
| } | ||
|
|
||
| pub fn set_failed(&mut self, outbound_key: Key, error_reason: String) { | ||
| if let Some(inbound) = self.inbound.get_mut(outbound_key) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we first lookup the outbound to get the inbound_key, as done in clear_outbound (line 115) ?
| /// Ack/NAck'd | ||
| pub fn clear_outbound(&mut self, outbound_key: Key) -> Option<(Context, Option<String>)> { | ||
| let inbound_key = { | ||
| let outbound = self.outbound.get(outbound_key)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I am missing something, but seems we get the slot, but never remove it from self.outbound ?
| // insert outbound | ||
| let outbound = Outbound { inbound_key }; | ||
| self.outbound | ||
| .allocate(|| (outbound, ())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If allocate fails, we return early but already incremented num_outbound at line 88 - this would leave the inbound context stuck.
Opening this as draft for now. There are some addition test cases and cleanup I want to do, but I wanted to first ensure my handling of the Pdata Contexts was correct.
Closes: #1784
Now that we have
route_toin OPL, in combination withif/else, this can create a scenario where we split the batch.A pipeline like this would emit two batches:
If the batch had subscribers, when we process a pdata we must keep the context for the inbound batch, and create new contexts for the outbound batches. When all the outbound batches Ack/Nack'd, we must then Ack/Nack the inbound context.
This PR adds a
Contextstype for juggling the inbound/outbound contexts and updates the transform processor to manage contexts + Ack/NAck correctly.