bharatviswa504 commented on a change in pull request #986:
URL: https://github.com/apache/hadoop-ozone/pull/986#discussion_r438435882
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerStateMachine.java
##########
@@ -338,20 +352,19 @@ public void unpause(long newLastAppliedSnaphsotIndex,
}
/**
- * Take OM Ratis snapshot. Write the snapshot index to file. Snapshot index
- * is the log index corresponding to the last applied transaction on the OM
- * State Machine.
+ * Take OM Ratis snapshot is a dummy operation as when double buffer
+ * flushes the lastAppliedIndex is flushed to DB and that is used as
+ * snapshot index.
*
* @return the last applied index on the state machine which has been
* stored in the snapshot file.
*/
@Override
public long takeSnapshot() throws IOException {
- LOG.info("Saving Ratis snapshot on the OM.");
- if (ozoneManager != null) {
- return ozoneManager.saveRatisSnapshot().getIndex();
- }
- return 0;
+ LOG.info("Current Snapshot Index {}", getLastAppliedTermIndex());
+ long lastAppliedIndex = getLastAppliedTermIndex().getIndex();
+ ozoneManager.getMetadataManager().getStore().flush();
+ return lastAppliedIndex;
Review comment:
So, that is the reason get lastAppliedIndex first, then flush. If we
change the order, it will lead to data loss.
----------------------------------------------------------------
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]