Skip to content

improve: thread-safe idempotent dynamic informer event source start #2174

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

Merged
merged 6 commits into from
Jan 9, 2024

Conversation

csviri
Copy link
Collaborator

@csviri csviri commented Dec 20, 2023

this will allow to multiple threads wait idempotently for the start of an informer event source

@csviri csviri self-assigned this Dec 20, 2023
@metacosm metacosm changed the title imrove: thread-safe idempotent informer event source start improve: thread-safe idempotent informer event source start Dec 21, 2023
@metacosm
Copy link
Collaborator

Can you elaborate on what this changes, please?

@csviri csviri marked this pull request as draft December 21, 2023 09:24
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 21, 2023
@csviri
Copy link
Collaborator Author

csviri commented Dec 21, 2023

Converted it to draft (meant it that way originally), until not finished.

The reason for this is related to dynamic registration, if in a reconciliation multiple event sources are registered dynamically possible of same name from different thread (and also different type), it is hard to make that efficient ATM. Thus to not make all the threads possibly wait in the synchronized block of here. One way to do this si to query if the ES is already registered. But if registered does not mean it is started. By this change, calling the start method should ensure that it is started (in a thread-safe way) and also simultaneously waiting for the other thread if that is starting the event source. We can look on this as a lock striping.

@csviri csviri force-pushed the ies-idenpotet-sync-start branch from 3212130 to 4ae0266 Compare January 5, 2024 09:36
@csviri csviri marked this pull request as ready for review January 5, 2024 14:29
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 5, 2024
@csviri csviri requested a review from metacosm January 5, 2024 15:56
@csviri csviri added this to the 4.7 milestone Jan 8, 2024
csviri added 6 commits January 8, 2024 15:25
this will allow to multiple threads wait idempotently for the start of an informer event source

Signed-off-by: Attila Mészáros <csviri@gmail.com>
Signed-off-by: Attila Mészáros <csviri@gmail.com>
Signed-off-by: Attila Mészáros <csviri@gmail.com>
Signed-off-by: Attila Mészáros <csviri@gmail.com>
Signed-off-by: Attila Mészáros <csviri@gmail.com>
Signed-off-by: Attila Mészáros <csviri@gmail.com>
@csviri csviri force-pushed the ies-idenpotet-sync-start branch from 247a58f to ac65a28 Compare January 8, 2024 14:25
@csviri csviri changed the title improve: thread-safe idempotent informer event source start improve: thread-safe idempotent dynamic informer event source start Jan 9, 2024
@csviri csviri merged commit e9b1936 into next Jan 9, 2024
@csviri csviri deleted the ies-idenpotet-sync-start branch January 9, 2024 20:50
csviri added a commit that referenced this pull request Jan 10, 2024
…2174)

* imrove: thread-safe idempotent informer event source start

this will allow to multiple threads wait idempotently for the start of an informer event source

Signed-off-by: Attila Mészáros <csviri@gmail.com>

* improvements on dynamic registration

Signed-off-by: Attila Mészáros <csviri@gmail.com>

* signing

Signed-off-by: Attila Mészáros <csviri@gmail.com>

* decoration

Signed-off-by: Attila Mészáros <csviri@gmail.com>

* format

Signed-off-by: Attila Mészáros <csviri@gmail.com>

* minor changes

Signed-off-by: Attila Mészáros <csviri@gmail.com>

---------

Signed-off-by: Attila Mészáros <csviri@gmail.com>
csviri added a commit that referenced this pull request Jan 10, 2024
…2174)

Signed-off-by: Attila Mészáros <csviri@gmail.com>
csviri added a commit that referenced this pull request Jan 10, 2024
…2174)

Signed-off-by: Attila Mészáros <csviri@gmail.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