lordcheng10 commented on a change in pull request #2947:
URL: https://github.com/apache/bookkeeper/pull/2947#discussion_r773801951
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/zk/ZKMetadataDriverBase.java
##########
@@ -260,6 +262,47 @@ public synchronized LedgerManagerFactory
getLedgerManagerFactory()
return lmFactory;
}
+ public CompletableFuture<Void> disableHealthCheck() {
+ CompletableFuture<Void> createResult = new CompletableFuture<>();
+ try {
+ zk.create(getEnableHealthPath(), new byte[0],
ZkUtils.getACLs(conf), CreateMode.PERSISTENT);
+ createResult.complete(null);
+ } catch (Exception e) {
+ createResult.completeExceptionally(e);
+ }
+ return createResult;
+ }
+
+ public CompletableFuture<Void> enableHealthCheck() {
+ CompletableFuture<Void> deleteResult = new CompletableFuture<>();
+
+ try {
+ zk.delete(getEnableHealthPath(), -1);
+ deleteResult.complete(null);
+ } catch (Exception e) {
+ deleteResult.completeExceptionally(e);
+ }
+ return deleteResult;
+ }
+
+ public CompletableFuture<Boolean> isEnableHealthCheck() {
+ CompletableFuture<Boolean> enableResult = new CompletableFuture<>();
+ try {
+ boolean isEnable = (null == zk.exists(getEnableHealthPath(),
false));
+ enableResult.complete(isEnable);
+ } catch (Exception e) {
+ enableResult.completeExceptionally(e);
+ }
+ return enableResult;
+ }
+
+
+ public String getEnableHealthPath() {
+ String zkLedgersRootPath =
ZKMetadataDriverBase.resolveZkLedgersRootPath(conf);
Review comment:
The same path seems to be defined, can I use ledgerRootPath directly?
@nicoloboschi
https://github.com/apache/bookkeeper/blob/370d785ff674841943fa8cddee1964408e826f5b/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/zk/ZKMetadataDriverBase.java#L143-L145
##########
File path:
bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/zk/ZKMetadataDriverBase.java
##########
@@ -260,6 +262,47 @@ public synchronized LedgerManagerFactory
getLedgerManagerFactory()
return lmFactory;
}
+ public CompletableFuture<Void> disableHealthCheck() {
+ CompletableFuture<Void> createResult = new CompletableFuture<>();
+ try {
+ zk.create(getEnableHealthPath(), new byte[0],
ZkUtils.getACLs(conf), CreateMode.PERSISTENT);
+ createResult.complete(null);
+ } catch (Exception e) {
+ createResult.completeExceptionally(e);
+ }
+ return createResult;
+ }
+
+ public CompletableFuture<Void> enableHealthCheck() {
+ CompletableFuture<Void> deleteResult = new CompletableFuture<>();
+
+ try {
+ zk.delete(getEnableHealthPath(), -1);
+ deleteResult.complete(null);
+ } catch (Exception e) {
+ deleteResult.completeExceptionally(e);
+ }
+ return deleteResult;
+ }
+
+ public CompletableFuture<Boolean> isEnableHealthCheck() {
+ CompletableFuture<Boolean> enableResult = new CompletableFuture<>();
+ try {
+ boolean isEnable = (null == zk.exists(getEnableHealthPath(),
false));
+ enableResult.complete(isEnable);
+ } catch (Exception e) {
+ enableResult.completeExceptionally(e);
+ }
+ return enableResult;
+ }
+
+
+ public String getEnableHealthPath() {
+ String zkLedgersRootPath =
ZKMetadataDriverBase.resolveZkLedgersRootPath(conf);
+ String ledgerParentPath = zkLedgersRootPath.substring(0,
zkLedgersRootPath.lastIndexOf("/ledgers"));
+ return String.format("%s/%s", ledgerParentPath, "enableHealthCheck");
Review comment:
OK,I will fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]