Skip to content

Fix TestingTrinoServer connector event listener registration#13360

Closed
wendigo wants to merge 2 commits intotrinodb:masterfrom
wendigo:serafin/register-connector-event-listeners-for-tests
Closed

Fix TestingTrinoServer connector event listener registration#13360
wendigo wants to merge 2 commits intotrinodb:masterfrom
wendigo:serafin/register-connector-event-listeners-for-tests

Conversation

@wendigo
Copy link
Contributor

@wendigo wendigo commented Jul 26, 2022

Tests like TestConnectorEventListener.testConnectorEventHandlerReceivingEvents are broken on master because connector's event listeners are never registered when createCatalog is called on TestingTrinoServer (changed since ff323dc)

@cla-bot cla-bot bot added the cla-signed label Jul 26, 2022
@wendigo wendigo force-pushed the serafin/register-connector-event-listeners-for-tests branch from a425385 to f4bcf1b Compare July 26, 2022 15:26
@wendigo wendigo force-pushed the serafin/register-connector-event-listeners-for-tests branch from a8b4411 to ed8c639 Compare July 26, 2022 15:43
@leveyja
Copy link
Member

leveyja commented Jul 26, 2022

@wendigo

Error:  src/main/java/io/trino/server/testing/TestingTrinoServer.java:[45,8] (imports) UnusedImports: Unused import - io.trino.connector.ConnectorServicesProvider.
Error:  src/main/java/io/trino/server/testing/TestingTrinoServer.java:[62,8] (imports) UnusedImports: Unused import - io.trino.metadata.CatalogManager.

@leveyja
Copy link
Member

leveyja commented Jul 26, 2022

Created #13365 with the fixup / without the change to the timeout

updateConnectorIdAnnouncement(announcer, catalogHandle, nodeManager);

EventListenerManager eventListenerManager = injector.getInstance(EventListenerManager.class);
connectorManager.getConnectorServices(catalogHandle).getEventListeners().forEach(eventListenerManager::addEventListener);
Copy link
Member

Choose a reason for hiding this comment

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

Do we need product tests to make sure that event listeners are truly registered?

Copy link
Member

Choose a reason for hiding this comment

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

Server correctly registered EventListeners, TestingTrinoServer did not, so it only affected (some) tests


QueryEvents queryEvents = eventsCollector.getQueryEvents(queryId);
queryEvents.waitForQueryCompletion(new Duration(30, SECONDS));
queryEvents.waitForQueryCompletion(new Duration(3, SECONDS));
Copy link
Member

Choose a reason for hiding this comment

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

How is that possible that longer timeout fixed the issue? If there was no event listener registered then it should not work at all? Are you referring here to a different problem?

According #13321 it should be 30 seconds.

Copy link
Member

Choose a reason for hiding this comment

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

#13321 (comment) - no effect but considered an improvement.
FYI - #13370 - This PR is probably superseded @wendigo @kokosing

@dain
Copy link
Member

dain commented Jul 27, 2022

This is fixed in Trino trunk now

@wendigo wendigo closed this Jul 27, 2022
@findepi
Copy link
Member

findepi commented Aug 12, 2022

This is fixed in Trino trunk now

What's the fix?

(especially in the context of #3364 (comment) )

@kokosing
Copy link
Member

See #13370 the connector event listener was not registered in the engine. Only in tests

@kokosing
Copy link
Member

I doubt this issue has anything with flakiness. However there were other changes in Trino related to event listener that could be related.

@wendigo wendigo deleted the serafin/register-connector-event-listeners-for-tests branch January 21, 2025 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

5 participants