-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
HBASE-28464: Make replication ZKWatcher config customizable in extens… #5785
Open
BukrosSzabolcs
wants to merge
4
commits into
apache:master
Choose a base branch
from
BukrosSzabolcs:HBASE-28464
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+90
−8
Open
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d4e614a
HBASE-28464: Make replication ZKWatcher config customizable in extens…
BukrosSzabolcs 21e3c53
HBASE-28464: Make replication ZKWatcher config customizable in extens…
BukrosSzabolcs eeec72f
HBASE-28464: Make replication ZKWatcher config customizable in extens…
BukrosSzabolcs 5f34949
HBASE-28464: Make replication ZKWatcher config customizable in extens…
BukrosSzabolcs 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 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 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 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 |
---|---|---|
|
@@ -44,6 +44,7 @@ | |
import org.apache.zookeeper.Watcher; | ||
import org.apache.zookeeper.ZooDefs.Ids; | ||
import org.apache.zookeeper.ZooDefs.Perms; | ||
import org.apache.zookeeper.client.ZKClientConfig; | ||
import org.apache.zookeeper.data.ACL; | ||
import org.apache.zookeeper.data.Id; | ||
import org.apache.zookeeper.data.Stat; | ||
|
@@ -120,6 +121,20 @@ public ZKWatcher(Configuration conf, String identifier, Abortable abortable) | |
this(conf, identifier, abortable, false); | ||
} | ||
|
||
/** | ||
* Instantiate a ZooKeeper connection and watcher. | ||
* @param identifier string that is passed to RecoverableZookeeper to be used as identifier for | ||
* this instance. Use null for default. | ||
* @param zkConfig zkClientConfig to use for the connection, can be null | ||
* @throws IOException if the connection to ZooKeeper fails | ||
* @throws ZooKeeperConnectionException if the client can't connect to ZooKeeper | ||
*/ | ||
public ZKWatcher(Configuration conf, String identifier, Abortable abortable, | ||
ZKClientConfig zkConfig) | ||
throws ZooKeeperConnectionException, IOException { | ||
this(conf, identifier, abortable, false, zkConfig); | ||
} | ||
|
||
/** | ||
* Instantiate a ZooKeeper connection and watcher. | ||
* @param conf the configuration to use | ||
|
@@ -133,7 +148,24 @@ public ZKWatcher(Configuration conf, String identifier, Abortable abortable) | |
*/ | ||
public ZKWatcher(Configuration conf, String identifier, Abortable abortable, | ||
boolean canCreateBaseZNode) throws IOException, ZooKeeperConnectionException { | ||
this(conf, identifier, abortable, canCreateBaseZNode, false); | ||
this(conf, identifier, abortable, canCreateBaseZNode, false, null); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. |
||
} | ||
|
||
/** | ||
* Instantiate a ZooKeeper connection and watcher. | ||
* @param conf the configuration to use | ||
* @param identifier string that is passed to RecoverableZookeeper to be used as | ||
* identifier for this instance. Use null for default. | ||
* @param abortable Can be null if there is on error there is no host to abort: e.g. | ||
* client context. | ||
* @param canCreateBaseZNode true if a base ZNode can be created | ||
* @param zkConfig zkClientConfig to use for the connection, can be null | ||
* @throws IOException if the connection to ZooKeeper fails | ||
* @throws ZooKeeperConnectionException if the client can't connect to ZooKeeper | ||
*/ | ||
public ZKWatcher(Configuration conf, String identifier, Abortable abortable, | ||
boolean canCreateBaseZNode, ZKClientConfig zkConfig) throws IOException, ZooKeeperConnectionException { | ||
this(conf, identifier, abortable, canCreateBaseZNode, false, zkConfig); | ||
} | ||
|
||
/** | ||
|
@@ -151,6 +183,25 @@ public ZKWatcher(Configuration conf, String identifier, Abortable abortable, | |
*/ | ||
public ZKWatcher(Configuration conf, String identifier, Abortable abortable, | ||
boolean canCreateBaseZNode, boolean clientZK) throws IOException, ZooKeeperConnectionException { | ||
this(conf, identifier, abortable, canCreateBaseZNode, clientZK, null); | ||
} | ||
|
||
/** | ||
* Instantiate a ZooKeeper connection and watcher. | ||
* @param conf the configuration to use | ||
* @param identifier string that is passed to RecoverableZookeeper to be used as | ||
* identifier for this instance. Use null for default. | ||
* @param abortable Can be null if there is on error there is no host to abort: e.g. | ||
* client context. | ||
* @param canCreateBaseZNode true if a base ZNode can be created | ||
* @param clientZK whether this watcher is set to access client ZK | ||
* @param zkConfig zkClientConfig to use for the connection, can be null | ||
* @throws IOException if the connection to ZooKeeper fails | ||
* @throws ZooKeeperConnectionException if the connection to Zookeeper fails when create base | ||
* ZNodes | ||
*/ | ||
public ZKWatcher(Configuration conf, String identifier, Abortable abortable, | ||
boolean canCreateBaseZNode, boolean clientZK, ZKClientConfig zkConfig) throws IOException, ZooKeeperConnectionException { | ||
this.conf = conf; | ||
if (clientZK) { | ||
String clientZkQuorumServers = ZKConfig.getClientZKQuorumServersString(conf); | ||
|
@@ -177,7 +228,7 @@ public ZKWatcher(Configuration conf, String identifier, Abortable abortable, | |
this.znodePaths = new ZNodePaths(conf); | ||
PendingWatcher pendingWatcher = new PendingWatcher(); | ||
this.recoverableZooKeeper = | ||
RecoverableZooKeeper.connect(conf, quorum, pendingWatcher, identifier); | ||
RecoverableZooKeeper.connect(conf, quorum, pendingWatcher, identifier, zkConfig); | ||
pendingWatcher.prepare(this); | ||
if (canCreateBaseZNode) { | ||
try { | ||
|
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.
Better add some comments here to describe why we want to add this method? It is not used directly in the hbase code base, so maybe later other developers may decided to remove it...
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.
Thanks for pointing it out, let me add an explanation.