Skip to content

Conversation

@evanvdia
Copy link
Contributor

@evanvdia evanvdia commented Jan 29, 2025

Description

Add support for multiple query event listeners to allow multiple plugins to handle events independently.
Cherry-pick of trinodb/trino#3128

Motivation and Context

Issue : #24454

Test Plan

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

Add support for multiple query event listeners.

@evanvdia evanvdia requested review from a team, elharo and steveburnett as code owners January 29, 2025 16:34
@evanvdia evanvdia requested a review from presto-oss January 29, 2025 16:34
Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

Thanks for the doc! Could an example be added?

@evanvdia evanvdia force-pushed the multiple_event_listener_changes branch from 676726f to 9e29e22 Compare January 29, 2025 17:44
steveburnett
steveburnett previously approved these changes Jan 29, 2025
Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

Thanks for the doc!

Pull updated branch, new doc build, looks good. Thanks!

@tdcmeehan
Copy link
Contributor

Please attribute the author of the commit as mentioned in our contributing guide (see backport commits).

Please write a test with dummy event listeners. You should be able to create internal dummy listeners by writing properties to temp files, invoke the EventListenerManager with a dummy event and prove that two or more events are triggered.

elharo
elharo previously approved these changes Jan 31, 2025
@tdcmeehan tdcmeehan added the from:IBM PR from IBM label Feb 5, 2025
@prestodb-ci prestodb-ci requested review from a team, pdabre12 and sh-shamsan and removed request for a team February 5, 2025 03:01
@prestodb-ci
Copy link
Contributor

Saved that user @evanvdia is from IBM

@ethanyzhang
Copy link
Contributor

Hi @jaystarshot , would it be possible for you to take a look at this? Thank you!!

@ethanyzhang
Copy link
Contributor

Sorry I missed Tim's previous comments, will ping the author to update

@evanvdia evanvdia force-pushed the multiple_event_listener_changes branch from 9e29e22 to 928e6c5 Compare February 11, 2025 04:28
@evanvdia
Copy link
Contributor Author

@tdcmeehan Added the author of the commit and working on the test case for multiple event listeners.

@jaystarshot
Copy link
Member

Cherry-pick of https://github.com/prestodb/presto/commit/30e36dae0cdb9debd991931370b86301cd17e261
This is the commit description but that commit is not found

@evanvdia evanvdia force-pushed the multiple_event_listener_changes branch from 928e6c5 to b2f27c4 Compare February 11, 2025 16:57
@ethanyzhang
Copy link
Contributor

ethanyzhang commented Feb 12, 2025

@evanvdia I think the commit to mention in your cherry-pick message should be trinodb/trino@72a7511

Let's update the commit message to the following:

Support multiple event listener plugins

Cherry-pick of https://github.com/trinodb/trino/commit/72a7511a5353cf995d34d6571862f065260b9dfe

Co-authored-by: Jack Dintruff <[email protected]>

@evanvdia evanvdia force-pushed the multiple_event_listener_changes branch from b2f27c4 to a07f2c3 Compare February 12, 2025 05:48
@evanvdia
Copy link
Contributor Author

@ethanyzhang update the commit message.


private void createEventListener(File configFile)
{
log.info("-- Loading event listener %s --", configFile);
Copy link
Member

Choose a reason for hiding this comment

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

private final AtomicBoolean loading = new AtomicBoolean(false);
Loading seems guaraded by an atomic boolean in the trino change

https://github.com/s2lomon/presto/blob/3c7bd73c7c1971069a63a6881f42dd9796606426/presto-main/src/main/java/io/prestosql/eventlistener/EventListenerManager.java#L70

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@aaneja aaneja self-requested a review February 17, 2025 06:26
@evanvdia evanvdia dismissed stale reviews from steveburnett and elharo via 5b40300 February 18, 2025 14:00
@evanvdia evanvdia force-pushed the multiple_event_listener_changes branch from a07f2c3 to 5b40300 Compare February 18, 2025 14:00

private static class EventsCapture
{
private ImmutableList.Builder<QueryCreatedEvent> queryCreatedEvents;
Copy link
Contributor

Choose a reason for hiding this comment

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

Make the fields final, and instantiate inline

Suggested change
private ImmutableList.Builder<QueryCreatedEvent> queryCreatedEvents;
private final ImmutableList.Builder<QueryCreatedEvent> queryCreatedEvents = ImmutableList.builder();
private final ImmutableList.Builder<QueryCompletedEvent> queryCompletedEvents = ImmutableList.builder();
private final ImmutableList.Builder<SplitCompletedEvent> splitCompletedEvents = ImmutableList.builder();
public EventsCapture()
{
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@evanvdia evanvdia force-pushed the multiple_event_listener_changes branch 3 times, most recently from 85bfad5 to 871ff5e Compare March 5, 2025 19:29
@evanvdia evanvdia requested a review from aaneja March 5, 2025 19:30
aaneja
aaneja previously approved these changes Mar 6, 2025
Copy link
Contributor

@aaneja aaneja left a comment

Choose a reason for hiding this comment

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

LGTM, just some nits about whitespace


@VisibleForTesting
protected void setConfiguredEventListener(String name, Map<String, String> properties)
private void setConfiguredEventListener(String name, Map<String, String> properties)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: This method can be moved up to L105 to keep all private methods together

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aaneja Done

@evanvdia evanvdia force-pushed the multiple_event_listener_changes branch from 871ff5e to da6ee5c Compare March 6, 2025 16:46
aaneja
aaneja previously approved these changes Mar 7, 2025
@evanvdia
Copy link
Contributor Author

evanvdia commented Mar 7, 2025

@jaystarshot @pdabre12 Could you please approve the changes.

@evanvdia evanvdia force-pushed the multiple_event_listener_changes branch from da6ee5c to d5a55f8 Compare March 11, 2025 06:58
@evanvdia evanvdia force-pushed the multiple_event_listener_changes branch 4 times, most recently from a1b87da to 30f6ae9 Compare March 12, 2025 05:01
@evanvdia evanvdia force-pushed the multiple_event_listener_changes branch from 30f6ae9 to a4e9bc4 Compare March 12, 2025 06:57
@evanvdia
Copy link
Contributor Author

@aaneja @jaystarshot @pdabre12 Could you please approve the changes.

Copy link
Contributor

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

Thanks. This should help Manta integration.

@aditi-pandit aditi-pandit merged commit 7f0f4e1 into prestodb:master Mar 13, 2025
93 checks passed
ScrapCodes added a commit to ScrapCodes/presto that referenced this pull request Mar 19, 2025
A previous PR
prestodb#24456
added the needed changes to support Multiple event listener in tests, query runners and across the codebase.
@prestodb-ci prestodb-ci mentioned this pull request Mar 28, 2025
30 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants