You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/08/23 04:06:52 UTC

[GitHub] [pulsar] hangc0276 opened a new pull request, #17226: [Branch-2.8][improve][broker]Add retry for zk operation on connection loss

hangc0276 opened a new pull request, #17226:
URL: https://github.com/apache/pulsar/pull/17226

   ### Motivation
   In the master branch, we have supported zk retry logic for connection loss cases, which will reduce data inconsistency for Pulsar broker with Zookeeper. 
   
   https://github.com/apache/pulsar/blob/423ab75425211c52f43384a915fb775b8ecb5070/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKMetadataStore.java#L163-L169
   
   ### Modification 
   We backport this feature into branch-2.8


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] hangc0276 commented on a diff in pull request #17226: [Branch-2.8][improve][broker]Add retry for zk operation on connection loss

Posted by GitBox <gi...@apache.org>.
hangc0276 commented on code in PR #17226:
URL: https://github.com/apache/pulsar/pull/17226#discussion_r952301563


##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKMetadataStore.java:
##########
@@ -163,6 +169,11 @@ public CompletableFuture<List<String>> getChildrenFromStore(String path) {
                             future.completeExceptionally(ex);
                             return null;
                         });
+                    } else if (code == Code.CONNECTIONLOSS) {
+                        // There is the chance that we caused a connection reset by sending or requesting a batch
+                        // that passed the max ZK limit. Retry with the individual operations
+                        executor.schedule(() -> getChildrenFromStore(path),

Review Comment:
   Good point, addressed.



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] zymap commented on a diff in pull request #17226: [Branch-2.8][improve][broker]Add retry for zk operation on connection loss

Posted by GitBox <gi...@apache.org>.
zymap commented on code in PR #17226:
URL: https://github.com/apache/pulsar/pull/17226#discussion_r952221278


##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKMetadataStore.java:
##########
@@ -120,7 +121,12 @@ public CompletableFuture<Optional<GetResult>> get(String path) {
                             return null;
                         });
                         future.complete(Optional.empty());
-                    } else {
+                    } else if (code == Code.CONNECTIONLOSS) {
+                        // There is the chance that we caused a connection reset by sending or requesting a batch

Review Comment:
   Do we need to log something before retrying? 



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] hangc0276 commented on a diff in pull request #17226: [Branch-2.8][improve][broker]Add retry for zk operation on connection loss

Posted by GitBox <gi...@apache.org>.
hangc0276 commented on code in PR #17226:
URL: https://github.com/apache/pulsar/pull/17226#discussion_r952236930


##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKMetadataStore.java:
##########
@@ -120,7 +121,12 @@ public CompletableFuture<Optional<GetResult>> get(String path) {
                             return null;
                         });
                         future.complete(Optional.empty());
-                    } else {
+                    } else if (code == Code.CONNECTIONLOSS) {
+                        // There is the chance that we caused a connection reset by sending or requesting a batch

Review Comment:
   Good idea



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] codelipenghui merged pull request #17226: [Branch-2.8][improve][broker]Add retry for zk operation on connection loss

Posted by GitBox <gi...@apache.org>.
codelipenghui merged PR #17226:
URL: https://github.com/apache/pulsar/pull/17226


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [pulsar] Jason918 commented on a diff in pull request #17226: [Branch-2.8][improve][broker]Add retry for zk operation on connection loss

Posted by GitBox <gi...@apache.org>.
Jason918 commented on code in PR #17226:
URL: https://github.com/apache/pulsar/pull/17226#discussion_r952243511


##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKMetadataStore.java:
##########
@@ -163,6 +169,11 @@ public CompletableFuture<List<String>> getChildrenFromStore(String path) {
                             future.completeExceptionally(ex);
                             return null;
                         });
+                    } else if (code == Code.CONNECTIONLOSS) {
+                        // There is the chance that we caused a connection reset by sending or requesting a batch
+                        // that passed the max ZK limit. Retry with the individual operations
+                        executor.schedule(() -> getChildrenFromStore(path),

Review Comment:
   We need pass the result of `getChildrenFromStore` to `future` in this.



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org