nicoloboschi commented on a change in pull request #2947:
URL: https://github.com/apache/bookkeeper/pull/2947#discussion_r773848090



##########
File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/zk/ZKMetadataDriverBase.java
##########
@@ -260,6 +269,46 @@ public synchronized LedgerManagerFactory 
getLedgerManagerFactory()
         return lmFactory;
     }
 
+    public CompletableFuture<Void> disableHealthCheck() {
+        CompletableFuture<Void> createResult = new CompletableFuture<>();
+        try {
+            zk.create(enableHealthCheckPath, 
BookKeeperConstants.EMPTY_BYTE_ARRAY, acls, CreateMode.PERSISTENT);
+            createResult.complete(null);
+        } catch (KeeperException.NodeExistsException nodeExistsException) {
+            log.debug("enableHealthCheckPath {} is existed!", 
enableHealthCheckPath);

Review comment:
       ```suggestion
               log.debug("health check already disabled");
   ```

##########
File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/zk/ZKMetadataDriverBase.java
##########
@@ -260,6 +269,46 @@ public synchronized LedgerManagerFactory 
getLedgerManagerFactory()
         return lmFactory;
     }
 
+    public CompletableFuture<Void> disableHealthCheck() {
+        CompletableFuture<Void> createResult = new CompletableFuture<>();
+        try {
+            zk.create(enableHealthCheckPath, 
BookKeeperConstants.EMPTY_BYTE_ARRAY, acls, CreateMode.PERSISTENT);
+            createResult.complete(null);
+        } catch (KeeperException.NodeExistsException nodeExistsException) {
+            log.debug("enableHealthCheckPath {} is existed!", 
enableHealthCheckPath);
+            createResult.complete(null);
+        } catch (Exception e) {
+            createResult.completeExceptionally(e);
+        }
+        return createResult;
+    }
+
+    public CompletableFuture<Void>  enableHealthCheck() {
+        CompletableFuture<Void> deleteResult = new CompletableFuture<>();
+
+        try {
+            zk.delete(enableHealthCheckPath, -1);
+            deleteResult.complete(null);
+        } catch (KeeperException.NoNodeException noNodeException) {
+            log.debug("enableHealthCheckPath {} is not existed!", 
enableHealthCheckPath);

Review comment:
       ```suggestion
               log.debug("health check already enabled");
   ```

##########
File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/MetadataBookieDriver.java
##########
@@ -68,6 +71,29 @@ LedgerManagerFactory getLedgerManagerFactory()
      */
     LayoutManager getLayoutManager();
 
+    /**
+     * Return health check is enable or disable.
+     *
+     * @return true if health check is enable, otherwise false.
+     */
+    default CompletableFuture<Boolean>  isEnableHealthCheck() {

Review comment:
       ```suggestion
       default CompletableFuture<Boolean>  isHealthCheckEnabled() {
   ```




-- 
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]


Reply via email to