szetszwo commented on code in PR #5811:
URL: https://github.com/apache/ozone/pull/5811#discussion_r1435666532
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/ratis/OzoneManagerStateMachine.java:
##########
@@ -489,19 +489,24 @@ public OzoneManagerDoubleBuffer
buildDoubleBufferForRatis() {
*/
@Override
public long takeSnapshot() throws IOException {
- LOG.info("Current Snapshot Index {}", getLastAppliedTermIndex());
+ try {
+ awaitDoubleBufferFlush();
+ } catch (InterruptedException e) {
+ LOG.warn("double buffer wait is interrupted, ", e);
+ throw IOUtils.toInterruptedIOException("takeSnapshot is interrupted", e);
+ }
+ ozoneManager.getMetadataManager().getStore().flushDB();
+ TransactionInfo transactionInfo = ozoneManager.getMetadataManager()
+ .getTransactionInfoTable().get(TRANSACTION_INFO_KEY);
TermIndex lastTermIndex = getLastAppliedTermIndex();
- long lastAppliedIndex = lastTermIndex.getIndex();
+ LOG.info("Current Transaction Index {} lastAppliedTermIndex {}",
+ transactionInfo, lastTermIndex);
+ // update with lastAppliedTermIndex as snapshot have dependency with
+ // ratis commit index as triggered during notifyTermIndexUpdated after
+ // apply transaction. Can not use TRANSACTION_INFO_KEY from db
snapshotInfo.updateTermIndex(lastTermIndex.getTerm(),
Review Comment:
Let's don't make the logic more complicated. The direction is to remove
both `applyTransactionMap` and `ratisTransactionMap` from the code.
--
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]