errose28 commented on a change in pull request #1613:
URL: https://github.com/apache/ozone/pull/1613#discussion_r536449658
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/upgrade/OMPrepareRequest.java
##########
@@ -137,16 +137,21 @@ private static void waitForDoubleBufferFlush(
// If no transactions have been persisted to the DB, transaction info
// will be null, not zero, causing a null pointer exception within
// ozoneManager#getRatisSnaphotIndex.
- // Get the transaction directly instead.
- OMTransactionInfo txnInfo = ozoneManager.getMetadataManager()
+ // Get the transaction directly instead to handle the case when it is
+ // null.
+ OMTransactionInfo dbTxnInfo = ozoneManager.getMetadataManager()
.getTransactionInfoTable().get(TRANSACTION_INFO_KEY);
- if (txnInfo == null) {
- success = (txnLogIndex == 0);
+ if (dbTxnInfo == null) {
+ // If there are no transactions in the DB, we are prepared to log
Review comment:
Right, the condition should never be met. Because of that, we could just
set `success = false` when the dbTxnInfo is null, but since we have to do the
null check anyways, I figured it was better to add a line to handle the case
correctly, even if it should never arise.
----------------------------------------------------------------
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]