IGNITE-9739 fix NPE on MVCC path - Fixes #5846.
authorSergey Kosarev <skosarev@gridgain.com>
Thu, 17 Jan 2019 14:48:09 +0000 (17:48 +0300)
committerIvan Rakov <irakov@apache.org>
Thu, 17 Jan 2019 14:48:09 +0000 (17:48 +0300)
Signed-off-by: Ivan Rakov <irakov@apache.org>
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java

index e55676c..6c11cbc 100644 (file)
@@ -2429,8 +2429,9 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
             cctx.database().checkpointReadLock();
 
             try {
-                if (cctx.wal() != null)
-                    ptr = cctx.wal().log(newTxRecord(tx));
+                TxRecord rec;
+                if (cctx.wal() != null && (rec = newTxRecord(tx)) != null)
+                    cctx.wal().log(rec);
 
                 cctx.coordinators().updateState(tx.mvccSnapshot, commit ? TxState.COMMITTED : TxState.ABORTED, tx.local());
             }
@@ -2454,8 +2455,9 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
             cctx.database().checkpointReadLock();
 
             try {
-                if (cctx.wal() != null)
-                    cctx.wal().log(newTxRecord(tx));
+                TxRecord rec;
+                if (cctx.wal() != null && (rec = newTxRecord(tx)) != null)
+                    cctx.wal().log(rec);
 
                 cctx.coordinators().updateState(tx.mvccSnapshot, TxState.PREPARED);
             }
@@ -2497,7 +2499,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
      * @param tx Transaction.
      * @return Tx state record.
      */
-    private TxRecord newTxRecord(IgniteTxAdapter tx) {
+    private @Nullable TxRecord newTxRecord(IgniteTxAdapter tx) {
         BaselineTopology baselineTop = cctx.kernalContext().state().clusterState().baselineTopology();
 
         if (baselineTop != null && baselineTop.consistentIds().contains(cctx.localNode().consistentId())) {