guihecheng commented on a change in pull request #2288:
URL: https://github.com/apache/ozone/pull/2288#discussion_r642932590



##########
File path: 
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerPrepare.java
##########
@@ -408,21 +437,27 @@ private void assertClusterPrepared(long preparedIndex,
       LambdaTestUtils.await(WAIT_TIMEOUT_MILLIS,
           1000, () -> {
           if (!om.isRunning()) {
+            LOG.info("{} is not yet started.", om.getOMNodeId());
             return false;
           } else {
             boolean preparedAtIndex = false;
             OzoneManagerPrepareState.State state =
                 om.getPrepareState().getState();
 
+            LOG.info("{} has prepare status: {} index: {}.",
+                om.getOMNodeId(), state.getStatus(), state.getIndex());
+
             if (state.getStatus() == PrepareStatus.PREPARE_COMPLETED) {
-              if (state.getIndex() == preparedIndex) {
+              if (state.getIndex() >= expectedPreparedIndex) {
                 preparedAtIndex = true;
               } else {
                 // State will not change if we are prepared at the wrong index.

Review comment:
       IMHO, here we should consider a case: 2 successive prepares(just like 
the case testPrepareWithTransactions), we have a chance to get 
PREPARE_COMPLETED of the first round, then its index may be < 
expectedPreparedIndex of the second round,  because the status of om is async 
updated(just as we wait for it to update in prepare CLI).
   Maybe we could add a retry / sleep / wait for the updated prepare status? 
@errose28 




-- 
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to