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

Modify AcknowledgementSet add API to accept EventHandle instead of Event #4948

Merged
merged 8 commits into from
Oct 21, 2024

Conversation

kkondaka
Copy link
Collaborator

Description

Modify AcknowledgementSet add API to accept EventHandle instead of Event.
This is part of supporting acknowledgements in aggregate processor (local mode).

Issues Resolved

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

Check List

  • [X ] 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.

* @since 2.2
*/
public void add(Event event);
public void add(EventHandle eventHandle);
Copy link
Member

Choose a reason for hiding this comment

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

Why not support both for now?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because it is not required. Do you mean we should support it just so the number of code changes would be less? If that matters, we could support both.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Modified to support both using a default method in the interface.

eventHandle.addAcknowledgementSet(acknowledgementSet1);
eventHandle.addAcknowledgementSet(acknowledgementSet2);
AggregateEventHandle eventHandle2 = new AggregateEventHandle(now);
doNothing().when(acknowledgementSet1).add(any(EventHandle.class));
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you need these doNothing() calls. This should be the default.

@@ -452,7 +452,7 @@ private void processRecord(final AcknowledgementSet acknowledgementSet, final Re
// buffer contents before the event record is added
// to acknowledgement set
if (acknowledgementSet != null) {
acknowledgementSet.add(record.getData());
acknowledgementSet.add(((Event)record.getData()).getEventHandle());
Copy link
Member

Choose a reason for hiding this comment

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

If we continue to support add(Event) then all of this code should be simpler and you can remove for this PR.

acknowledgementSet = mock(AcknowledgementSet.class);
eventHandle.addAcknowledgementSet(acknowledgementSet);
DefaultEventHandle eventHandle2 = new DefaultEventHandle(now);
doNothing().when(acknowledgementSet).add(any(EventHandle.class));
Copy link
Member

Choose a reason for hiding this comment

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

I don't think you need this line.

totalEventsAdded.incrementAndGet();
}
InternalEventHandle internalEventHandle;
if (eventHandle instanceof AggregateEventHandle) {
Copy link
Member

Choose a reason for hiding this comment

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

Why do you have this condition?

These lines should just become:

InternalEventHandle internalEventHandle = (InternalEventHandle) eventHandle;

@kkondaka kkondaka force-pushed the ackset-with-eventhandle branch from 30b46c6 to 95d0d7d Compare October 17, 2024 20:56
Krishna Kondaka added 2 commits October 17, 2024 21:19
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
@kkondaka kkondaka force-pushed the ackset-with-eventhandle branch from 87bbd60 to aa3e2d5 Compare October 17, 2024 21:25
Krishna Kondaka added 3 commits October 17, 2024 21:29
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
dlvenable
dlvenable previously approved these changes Oct 18, 2024
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.

Thank you @kkondaka !

oeyh
oeyh previously approved these changes Oct 18, 2024
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
@kkondaka kkondaka dismissed stale reviews from oeyh and dlvenable via 7bd2d63 October 18, 2024 17:38
Krishna Kondaka added 2 commits October 18, 2024 18:10
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
Signed-off-by: Krishna Kondaka <krishkdk@dev-dsk-krishkdk-2c-bd29c437.us-west-2.amazon.com>
@kkondaka kkondaka merged commit 38b8db5 into opensearch-project:main Oct 21, 2024
68 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