szetszwo commented on code in PR #5811:
URL: https://github.com/apache/ozone/pull/5811#discussion_r1431948192


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerStateMachine.java:
##########
@@ -489,19 +488,24 @@ public OzoneManagerDoubleBuffer 
buildDoubleBufferForRatis() {
    */
   @Override
   public long takeSnapshot() throws IOException {
-    LOG.info("Current Snapshot Index {}", getLastAppliedTermIndex());
-    TermIndex lastTermIndex = getLastAppliedTermIndex();
-    long lastAppliedIndex = lastTermIndex.getIndex();
-    snapshotInfo.updateTermIndex(lastTermIndex.getTerm(),
-        lastAppliedIndex);
-    TransactionInfo build = new TransactionInfo.Builder()
-        .setTransactionIndex(lastAppliedIndex)
-        .setCurrentTerm(lastTermIndex.getTerm()).build();
-    Table<String, TransactionInfo> txnInfoTable =
-        ozoneManager.getMetadataManager().getTransactionInfoTable();
-    txnInfoTable.put(TRANSACTION_INFO_KEY, build);
+    // when called from request prepare, there is a wait that
+    // double buffer is flushed. When called from db snapshot,
+    // need ensure flushed from double buffer
+    try {
+      awaitDoubleBufferFlush();
+    } catch (InterruptedException e) {
+      LOG.warn("double buffer wait is interrupted, ", e);
+      Thread.interrupted();

Review Comment:
   It should re-throw
   ```java
         throw IOUtils.toInterruptedIOException("takeSnapshot is interrupted", 
e);
   ```
   
   FYI, ` Thread.interrupted()` is incorrect.  It should be:
   ```java
         Thread.currentThread().interrupt();
   ```



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


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

Reply via email to