You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2019/10/17 12:57:12 UTC

[GitHub] [rocketmq] wqliang commented on a change in pull request #1536: [ISSUE #1535] Fix ha sync transfer timeout

wqliang commented on a change in pull request #1536: [ISSUE #1535] Fix ha sync transfer timeout
URL: https://github.com/apache/rocketmq/pull/1536#discussion_r335987289
 
 

 ##########
 File path: store/src/main/java/org/apache/rocketmq/store/ha/HAService.java
 ##########
 @@ -280,9 +280,14 @@ private void doWaitTransfer() {
                 if (!this.requestsRead.isEmpty()) {
                     for (CommitLog.GroupCommitRequest req : this.requestsRead) {
                         boolean transferOK = HAService.this.push2SlaveMaxOffset.get() >= req.getNextOffset();
-                        for (int i = 0; !transferOK && i < 5; i++) {
+                        long waitUntillWhen = HAService.this.defaultMessageStore.getSystemClock().now()
+                            + HAService.this.defaultMessageStore.getMessageStoreConfig().getSyncFlushTimeout();
+                        while (HAService.this.defaultMessageStore.getSystemClock().now() < waitUntillWhen) {
 
 Review comment:
   Yes,  transferOk was checked first(line282) and then enter while loop. In the while loop, it would check transferOk again each time after notifyTransferObject be notified or wait timeout for 1s. To reduce unnecessary block, at the end of loop, transferOk would be checked again to exit loop if tranfer success within timeout.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services