Skip to content

Refactor FutureStateChange implementation#11436

Merged
martint merged 1 commit intotrinodb:masterfrom
pettyjamesm:refactor-future-state-change
Apr 14, 2022
Merged

Refactor FutureStateChange implementation#11436
martint merged 1 commit intotrinodb:masterfrom
pettyjamesm:refactor-future-state-change

Conversation

@pettyjamesm
Copy link
Member

@pettyjamesm pettyjamesm commented Mar 11, 2022

Refactors FutureStateChange to reduce lock contention when notifications are triggered, by only attempting to remove listeners from the current set upon completion if they were cancelled.

Description

Is this change a fix, improvement, new feature, refactoring, or other?

Improvement to an abstraction used in a few places by the core engine

Is this a change to the core query engine, a connector, client library, or the SPI interfaces? (be specific)

The core query engine

How would you describe this change to a non-technical end user or system administrator?

No explanation to a non-technical end user or system administration should be necessary

Documentation

(x) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.

Release notes

(x) No release notes entries required.
( ) Release notes entries required with the following suggested text:

@cla-bot cla-bot bot added the cla-signed label Mar 11, 2022
@pettyjamesm pettyjamesm force-pushed the refactor-future-state-change branch 3 times, most recently from 39b9807 to 7e33375 Compare March 14, 2022 19:16
@pettyjamesm pettyjamesm marked this pull request as ready for review March 14, 2022 19:21
@pettyjamesm pettyjamesm force-pushed the refactor-future-state-change branch 2 times, most recently from abc97eb to 0a5c6f5 Compare March 15, 2022 16:53
@pettyjamesm pettyjamesm changed the title Refactor FutureStateChange to notify in order Refactor FutureStateChange implementation Mar 15, 2022
@pettyjamesm pettyjamesm requested a review from sopel39 March 15, 2022 16:55
@pettyjamesm pettyjamesm force-pushed the refactor-future-state-change branch 10 times, most recently from 8f99ae7 to 547d088 Compare March 28, 2022 17:42
Copy link
Member

@raunaqmorarka raunaqmorarka left a comment

Choose a reason for hiding this comment

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

Change looks ok to me.
Please add unit tests for this class

@pettyjamesm pettyjamesm force-pushed the refactor-future-state-change branch from 547d088 to 15169e1 Compare April 14, 2022 15:14
Avoids unnecessary listener removal and the associated object
monitor synchronization when listeners are completed as part of a
normal FutureStateChange notification event. Only listeners that
were canceled before being notified need to be removed from the
current listener set.

Also changes the logic for sending a change notification to copy
the current listeners set into a List instead of a Set, which has
more overhead and was not necessary.
@pettyjamesm pettyjamesm force-pushed the refactor-future-state-change branch from 15169e1 to c3f580d Compare April 14, 2022 18:14
@martint martint merged commit 7fc02df into trinodb:master Apr 14, 2022
@github-actions github-actions bot added this to the 378 milestone Apr 14, 2022
@pettyjamesm pettyjamesm deleted the refactor-future-state-change branch April 14, 2022 21: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.

3 participants