-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Fix Huge Number of Watches in ZooKeeper #17482
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
Changes from all commits
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
50c1f7a
* Fix huge number of watches in zk
asdf2014 8420d73
Patch comments
asdf2014 da8538b
Add license
asdf2014 67b5064
Patch comments
asdf2014 23cd4d8
Merge branch 'master' into tmp
asdf2014 ce64445
Merge reduce ZK
GWphua da2f212
Update to use CloseableUtils instead of CloseQuietly.
GWphua a5d0669
Add Javadocs for Announceable class
GWphua f3b21a4
Javadocs on Announcers
GWphua 1053042
Refactor announce method
GWphua 903db88
Refactor NodeAnnouncer
GWphua 954fa53
Add Unit Tests
GWphua 25de238
Remove humor from logs
GWphua a7733e3
Add unit test for NodeAnnouncer announcing same path different payload.
GWphua 31f1d3d
Merge branch 'apache:master' into zk-fix
GWphua f541b84
Tweak import and change Javadocs
GWphua 20cfb0f
Update Druid unannouncement logging to make sense
GWphua 2a1f803
Replace deprecated inTransaction() with transaction()
GWphua a857bfc
Refactor buildParentPath
GWphua 1cbfa99
Merge branch 'github' into zk-fix
GWphua e50e2aa
Merge branch 'github' into zk-fix
GWphua 582691e
Add executorService for NodeCache
GWphua a305748
Try replace all Announcer
GWphua 438bfd9
Add JavaDocs
GWphua c6bfbd6
Refactor Test classes
GWphua 1aea321
Add JavaDocs and logging messages
GWphua 6e262f8
Fix Checkstyle
GWphua b412415
Add debug logs for update
GWphua 6c9bb94
Replace CloseableExecutorService within NodeCaches with ExecutorService
GWphua c8636d2
Debug logs for NodeAnnouncer starting and stopping
GWphua f12e09d
Add debug logs for Announcer.java
GWphua 8d3cd1c
Merge branch 'github' into zk-fix
GWphua eb350fb
Merge branch 'github' into zk-fix
GWphua cf7c45e
Merge remote-tracking branch 'origin/master' into zk-fix
GWphua 64bce5c
Remove ZKPathsUtils
GWphua 431f7b5
Remove usage of ZKPathUtils in NodeAnnouncer.java
GWphua c58d8a5
Remove ZKPathUtils usage in test classes
GWphua 1a5f663
Migrate unit tests away from ZkPathUtils
GWphua 948d721
Use computeIfAbsent where necessary
GWphua f964497
Use JUnit5 for new Test class
GWphua 6f6b12d
Fix checkstyle
GWphua d27e27e
Revert NodeAnnouncer changes
GWphua 9648155
Fix compile
GWphua a0513b9
Upgrade to CuratorCache
GWphua c3d89fc
Revert logging of exceptions
GWphua 384849c
Changes to avoid race conditions when announcing
GWphua 7a9e09f
Feature flag for announcers
GWphua 5e67ed2
Checkstyle
GWphua c0fc475
Dependency injection for Announcers
GWphua 5c0845a
Rename announcer to serviceAnnouncer
GWphua ea5d905
Fix checkstyle for import order
GWphua 4090566
Merge branch 'apache:master' into zk-fix
GWphua 195b9e0
Merge branch 'github' into zk-fix
GWphua File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
server/src/main/java/org/apache/druid/curator/announcement/Announceable.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package org.apache.druid.curator.announcement; | ||
|
|
||
| /** | ||
| * The {@link Announceable} is a representation of an announcement to be made in ZooKeeper. | ||
| */ | ||
| class Announceable | ||
| { | ||
| /** | ||
| * Represents the path in ZooKeeper where the announcement will be made. | ||
| */ | ||
| final String path; | ||
|
|
||
| /** | ||
| * Holds the actual data to be announced. | ||
| */ | ||
| final byte[] bytes; | ||
|
|
||
| /** | ||
| * Indicates whether parent nodes should be removed if the announcement is created successfully. | ||
| * This can be useful for cleaning up unused paths in ZooKeeper. | ||
| */ | ||
| final boolean removeParentsIfCreated; | ||
|
|
||
| public Announceable(String path, byte[] bytes, boolean removeParentsIfCreated) | ||
| { | ||
| this.path = path; | ||
| this.bytes = bytes; | ||
| this.removeParentsIfCreated = removeParentsIfCreated; | ||
| } | ||
|
|
||
| // This should be used for updates only, where removeParentsIfCreated is not relevant. | ||
| public Announceable(String path, byte[] bytes) | ||
| { | ||
| // removeParentsIfCreated is irrelevant, so we can use dummy value "false". | ||
| this(path, bytes, false); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder why not make the
NodeCacheapproach the default as that should work better - but retain the old approach if some issue happens?cc: @cryptoe