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

Add acknowledgement support to aggregate processor #5139

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kkondaka
Copy link
Collaborator

Description

Add acknowledgement support to aggregate processor

Issues Resolved

Resolves #[Issue number to be closed when this PR is merged]

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • [X ] Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@@ -62,6 +82,7 @@ boolean shouldConcludeGroup(final Duration groupDuration) {

void resetGroup() {
groupStart = Instant.now();
this.eventHandle = new AggregateEventHandle(groupStart);
Copy link
Member

Choose a reason for hiding this comment

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

Should this do something with the old eventHandle? Release it? Something else?

Copy link
Collaborator Author

@kkondaka kkondaka Dec 12, 2024

Choose a reason for hiding this comment

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

No. The previous event handle was sent with the concluded event and will be released after the event is sent to Sink. Every "aggregate duration" ONE aggregated event is created and one aggregate event handle is created. The aggregate event handle is attached to the aggregated event and the group will create a new handle for the new duration. If the event handle is not attached to any event, then it will be freed (by garbage collector) when a new event handle is created in resetGroup.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the explanation. This is clear. To be sure, are there any paths that could lead to resetting a group where we do need to handle the aggregate event?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It doesn't look like it. It looks like resetGroup() is called only in closeGroup() which is called only when the group is concluded.

@@ -26,6 +26,14 @@ public interface Processor<InputRecord extends Record<?>, OutputRecord extends R
*/
Collection<OutputRecord> execute(Collection<InputRecord> records);

/**
* indicates if the processor holds the events or not
Copy link
Member

Choose a reason for hiding this comment

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

Update this to be a little clear on what it means to hold events.

@dlvenable dlvenable marked this pull request as ready for review December 13, 2024 19:21
Copy link
Member

@dlvenable dlvenable left a comment

Choose a reason for hiding this comment

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

This looks good overall. I'm good once you make a few small tweaks such as documentation improvements and add tests.

Signed-off-by: Krishna Kondaka <krishkdk@amazon.com>
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