amaliujia commented on a change in pull request #1725:
URL: https://github.com/apache/ozone/pull/1725#discussion_r557866528
##########
File path:
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMStateMachine.java
##########
@@ -54,7 +54,7 @@ public SCMStateMachine(SCMDBTransactionBuffer buffer) throws
SCMException {
this.handlers = new EnumMap<>(RequestType.class);
this.transactionBuffer = buffer;
SCMTransactionInfo latestTrxInfo = buffer.getLatestTrxInfo();
- if (latestTrxInfo.shouldUpdate()) {
+ if (!latestTrxInfo.isInitialized()) {
Review comment:
Actually it is `!latestTrxInfo.isInitialized()`.
`SCMTransactionInfo latestTrxInfo = buffer.getLatestTrxInfo();` comes from
the buffer. The buffer will load the SCMTransactionInfo from the DB. If there
was no snapshot taken before (e.g. brand new SCM), there isn't a
SCMTransactionInfo from DB thus buffer will create a default one.
So we only need to updateLastAppliedTermIndex when latestTrxInfo is not
initialized (thus it is loaded from DB and it's meaningful).
----------------------------------------------------------------
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]