JooHyukKim commented on code in PR #20642:
URL: https://github.com/apache/pulsar/pull/20642#discussion_r1241099760


##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/bookkeeper/PulsarRegistrationClient.java:
##########
@@ -153,42 +173,61 @@ public void unwatchReadOnlyBookies(RegistrationListener 
registrationListener) {
         readOnlyBookiesWatchers.remove(registrationListener);
     }
 
-    private void handleDeletedBookieNode(Notification n) {
-        if (n.getType() == NotificationType.Deleted) {
-            BookieId bookieId = stripBookieIdFromPath(n.getPath());
-            if (bookieId != null) {
-                log.info("Bookie {} disappeared", bookieId);
-                bookieServiceInfoCache.remove(bookieId);
-            }
+    /**
+     * This method will receive metadata store notifications and then update 
the
+     * local cache in background sequentially.
+     */
+    private void updatedBookies(Notification n) {
+        final BookieMode mode;
+        if (n.getPath().startsWith(bookieReadonlyRegistrationPath)) {
+            mode = BookieMode.READ_ONLY;
+        } else if (n.getPath().startsWith(bookieRegistrationPath)) {
+            mode = BookieMode.READ_WRITE;
+        } else {
+            // unknown notification, should not happen.
+            return;

Review Comment:
   Would there be any alternative location to do this parsing and `BookieMode` 
enum, like `RegistrationClient` interface?  I was wondering maybe this 
`if-else` block can at least be extracted as a method or become a Value Object.



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