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

[CURATOR-4] POST_INITIALIZED_EVENT race conditions / optimizations #525

Open
jira-importer opened this issue Mar 26, 2013 · 0 comments
Open

Comments

@jira-importer
Copy link
Collaborator

From Netflix/curator#261

We've been running a data structure modeled after PathChildrenCache for a while now on a path with ~2500 child nodes and using a async loading strategy very similar to the new POST_INITIALIZED_EVENT startup mode. I noticed a couple subtle race conditions that we've encountered in our own code - thought I'd share them back.

trun@5229c8c If a node is removed during startup (after getChildren() but before getDataAndStat()) the INITIALIZED_EVENT will never fire. Handling NONODE events fixes this.
trun@fb94530 Though highly unlikely, I think it's possible for the initialSet to appear to be fully initialized before all the getDataAndStat() calls have even been issued? Constructing the initialSet before issuing any getDataAndStat() calls eliminates this possibility.
trun@e4ddc6c Each call to maybeOfferInitializedEvent() loops over the entire initialSet, and since it's called after each updateInitialSet() this can get pretty expensive ( O(n2) ) with thousands of children. There doesn't seem to be much value in keeping the entire initialSet around so removing each node after it's loaded simplifies this check a great deal.
Also one simple bugfix (which may not even be necessary any more)...

trun@3385adb initialSet is keyed on node, not fullPath so this call was just a NOP before.


Originally reported by randgalt, imported from: POST_INITIALIZED_EVENT race conditions / optimizations
  • status: Open
  • priority: Major
  • resolution: Unresolved
  • imported: 2025-01-21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant