You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "fujian-zfj (via GitHub)" <gi...@apache.org> on 2023/03/14 08:44:27 UTC

[GitHub] [rocketmq] fujian-zfj opened a new pull request, #6345: [ISSUE #6344] queueOffsets in topicQueueTable rollback when master changes to master in ha mode

fujian-zfj opened a new pull request, #6345:
URL: https://github.com/apache/rocketmq/pull/6345

   **Make sure set the target branch to `develop`**
   
   ## What is the purpose of the change
   
   fix #6344
   
   ## Brief changelog
   
   fix queueOffsets in topicQueueTable rollback when master changes to master in ha mode
   
   ## Verifying this change
   
   XXXX
   
   Follow this checklist to help us incorporate your contribution quickly and easily. Notice, `it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR`.
   
   - [x] Make sure there is a [Github issue](https://github.com/apache/rocketmq/issues) filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue. 
   - [x] Format the pull request title like `[ISSUE #123] Fix UnknownException when host config not exist`. Each commit in the pull request should have a meaningful subject line and body.
   - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [x] Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in [test module](https://github.com/apache/rocketmq/tree/master/test).
   - [x] Run `mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyle` to make sure basic checks pass. Run `mvn clean install -DskipITs` to make sure unit-test pass. Run `mvn clean test-compile failsafe:integration-test`  to make sure integration-test pass.
   - [ ] If this contribution is large, please file an [Apache Individual Contributor License Agreement](http://www.apache.org/licenses/#clas).
   


-- 
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@rocketmq.apache.org

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


[GitHub] [rocketmq] codecov-commenter commented on pull request #6345: [ISSUE #6344] queueOffsets in topicQueueTable rollback when master changes to master in ha mode

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #6345:
URL: https://github.com/apache/rocketmq/pull/6345#issuecomment-1469560047

   ## [Codecov](https://codecov.io/gh/apache/rocketmq/pull/6345?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#6345](https://codecov.io/gh/apache/rocketmq/pull/6345?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (15a8db8) into [develop](https://codecov.io/gh/apache/rocketmq/commit/ba00ff8b795a70f19a0fea635b30d66fae892a0e?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ba00ff8) will **increase** coverage by `0.03%`.
   > The diff coverage is `n/a`.
   
   ```diff
   @@              Coverage Diff              @@
   ##             develop    #6345      +/-   ##
   =============================================
   + Coverage      43.03%   43.07%   +0.03%     
   - Complexity      8896     8904       +8     
   =============================================
     Files           1103     1103              
     Lines          77755    77838      +83     
     Branches       10122    10134      +12     
   =============================================
   + Hits           33464    33525      +61     
   - Misses         40101    40102       +1     
   - Partials        4190     4211      +21     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/rocketmq/pull/6345?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ketmq/broker/dledger/DLedgerRoleChangeHandler.java](https://codecov.io/gh/apache/rocketmq/pull/6345?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvZGxlZGdlci9ETGVkZ2VyUm9sZUNoYW5nZUhhbmRsZXIuamF2YQ==) | `0.00% <ø> (ø)` | |
   
   ... and [39 files with indirect coverage changes](https://codecov.io/gh/apache/rocketmq/pull/6345/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
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@rocketmq.apache.org

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


[GitHub] [rocketmq] RongtongJin merged pull request #6345: [ISSUE #6344] queueOffsets in topicQueueTable rollback when master changes to master in ha mode

Posted by "RongtongJin (via GitHub)" <gi...@apache.org>.
RongtongJin merged PR #6345:
URL: https://github.com/apache/rocketmq/pull/6345


-- 
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@rocketmq.apache.org

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


[GitHub] [rocketmq] RongtongJin commented on a diff in pull request #6345: [ISSUE #6344] queueOffsets in topicQueueTable rollback when master changes to master in ha mode

Posted by "RongtongJin (via GitHub)" <gi...@apache.org>.
RongtongJin commented on code in PR #6345:
URL: https://github.com/apache/rocketmq/pull/6345#discussion_r1137904857


##########
broker/src/main/java/org/apache/rocketmq/broker/controller/ReplicasManager.java:
##########
@@ -308,20 +313,25 @@ public void changeToSlave(final String newMasterAddress, final int newMasterEpoc
                 this.haService.changeToSlave(newMasterAddress, newMasterEpoch, brokerControllerId);
 
                 this.brokerController.getTopicConfigManager().getDataVersion().nextVersion(newMasterEpoch);
+                registerBrokerWhenRoleChange();
+            }
+        }
+    }
 
-                this.executorService.submit(() -> {
-                    // Register broker to name-srv
-                    try {
-                        this.brokerController.registerBrokerAll(true, false, this.brokerController.getBrokerConfig().isForceRegister());
-                    } catch (final Throwable e) {
-                        LOGGER.error("Error happen when register broker to name server, Failed to change broker to slave", e);
-                        return;
-                    }
+    public void registerBrokerWhenRoleChange() {
+        String currentRole = this.brokerController.getMessageStoreConfig().getBrokerRole().equals(BrokerRole.SLAVE) ? "slave" : "master";
 
-                    LOGGER.info("Change broker [id:{}][address:{}] to slave, newMasterBrokerId:{}, newMasterAddress:{}, newMasterEpoch:{}", this.brokerControllerId, this.brokerAddress, newMasterBrokerId, newMasterAddress, newMasterEpoch);
-                });
+        this.executorService.submit(() -> {
+            // Register broker to name-srv
+            try {
+                this.brokerController.registerBrokerAll(true, false, this.brokerController.getBrokerConfig().isForceRegister());
+            } catch (final Throwable e) {
+                LOGGER.error("Error happen when register broker to name-srv, Failed to change broker to {}", currentRole, e);
+                return;
             }
-        }
+            LOGGER.info("Change broker [id:{}][address:{}] to {}, newMasterBrokerId:{}, newMasterAddress:{}, newMasterEpoch:{}, syncStateSetEpoch:{}",
+                this.brokerControllerId, this.brokerAddress, currentRole, this.masterBrokerId, this.masterAddress, this.masterEpoch, this.syncStateSetEpoch);
+        });

Review Comment:
   这个应该放上面,不是很适合放该方法中



-- 
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@rocketmq.apache.org

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