This is an automated email from the ASF dual-hosted git repository.

sboikov pushed a commit to branch ignite-11704
in repository https://gitbox.apache.org/repos/asf/ignite.git


The following commit(s) were added to refs/heads/ignite-11704 by this push:
     new db16252  ignite-11704
db16252 is described below

commit db1625276b61cba1b87d287a133b979031728c11
Author: sboikov <sboi...@apache.org>
AuthorDate: Wed Jul 24 09:58:40 2019 +0300

    ignite-11704
---
 .../cache/persistence/CacheDataRowAdapter.java     | 58 ++++++++++------------
 .../IgniteCacheDatabaseSharedManager.java          | 11 +++-
 2 files changed, 37 insertions(+), 32 deletions(-)

diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
index 5216e21..c0a421e 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/CacheDataRowAdapter.java
@@ -262,33 +262,8 @@ public class CacheDataRowAdapter implements CacheDataRow {
                         incomplete = readIncomplete(incomplete, sharedCtx, 
coctx, pageMem,
                                 grpId, pageAddr, itemId, io, rowData, 
readCacheId, skipVer);
 
-                        if (incomplete == null) {
-                            if (rowData == TOMBSTONES && val != null && 
!sharedCtx.database().isTombstone(this)) {
-                                // TODO IGNITE-11704.
-                                ver = null;
-                                key = null;
-                                val = null;
-                                verReady = true;
-                            }
-
+                        if (incomplete == null || (rowData == KEY_ONLY && key 
!= null))
                             return;
-                        }
-
-                        if (rowData == KEY_ONLY) {
-                            if (key != null)
-                                return;
-                        }
-                        else if (rowData == TOMBSTONES) {
-                            // TODO IGNITE-11704.
-                            if (val != null && 
!sharedCtx.database().isTombstone(this)) {
-                                ver = null;
-                                key = null;
-                                val = null;
-                                verReady = true;
-
-                                return;
-                            }
-                        }
 
                         nextLink = incomplete.getNextLink();
                     }
@@ -377,9 +352,7 @@ public class CacheDataRowAdapter implements CacheDataRow {
         buf.position(off);
         buf.limit(off + payloadSize);
 
-        boolean keyOnly = rowData == RowData.KEY_ONLY;
-
-        incomplete = readFragment(sharedCtx, coctx, buf, keyOnly, readCacheId, 
incomplete, skipVer);
+        incomplete = readFragment(sharedCtx, coctx, buf, rowData, readCacheId, 
incomplete, skipVer);
 
         if (incomplete != null)
             incomplete.setNextLink(nextLink);
@@ -416,11 +389,13 @@ public class CacheDataRowAdapter implements CacheDataRow {
         GridCacheSharedContext<?, ?> sharedCtx,
         CacheObjectContext coctx,
         ByteBuffer buf,
-        boolean keyOnly,
+        RowData rowData,
         boolean readCacheId,
         IncompleteObject<?> incomplete,
         boolean skipVer
     ) throws IgniteCheckedException {
+        boolean tombstones = rowData == TOMBSTONES;
+
         if (readCacheId && cacheId == 0) {
             incomplete = readIncompleteCacheId(buf, incomplete);
 
@@ -442,6 +417,12 @@ public class CacheDataRowAdapter implements CacheDataRow {
 
         // Read key.
         if (key == null) {
+            if (tombstones && sharedCtx.database().isTombstone(buf, key, 
(IncompleteCacheObject)incomplete) == Boolean.FALSE) {
+                verReady = true;
+
+                return null;
+            }
+
             incomplete = readIncompleteKey(coctx, buf, 
(IncompleteCacheObject)incomplete);
 
             if (key == null) {
@@ -449,7 +430,7 @@ public class CacheDataRowAdapter implements CacheDataRow {
                 return incomplete; // Need to finish reading the key.
             }
 
-            if (keyOnly)
+            if (rowData == RowData.KEY_ONLY)
                 return null; // Key is ready - we are done!
 
             incomplete = null;
@@ -468,6 +449,13 @@ public class CacheDataRowAdapter implements CacheDataRow {
 
         // Read value.
         if (val == null) {
+            if (tombstones && sharedCtx.database().isTombstone(buf, key, 
(IncompleteCacheObject)incomplete) == Boolean.FALSE) {
+                key = null;
+                verReady = true;
+
+                return null;
+            }
+
             incomplete = readIncompleteValue(coctx, buf, 
(IncompleteCacheObject)incomplete);
 
             if (val == null) {
@@ -478,6 +466,14 @@ public class CacheDataRowAdapter implements CacheDataRow {
             incomplete = null;
         }
 
+        if (tombstones && !sharedCtx.database().isTombstone(this)) {
+            key = null;
+            val = null;
+            verReady = true;
+
+            return null;
+        }
+
         // Read version.
         if (!verReady) {
             incomplete = readIncompleteVersion(buf, incomplete, skipVer);
diff --git 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
index 16c43ef..feb2e78 100644
--- 
a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
+++ 
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
@@ -18,6 +18,7 @@
 package org.apache.ignite.internal.processors.cache.persistence;
 
 import java.io.File;
+import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -55,6 +56,8 @@ import 
org.apache.ignite.internal.processors.cache.CacheObject;
 import org.apache.ignite.internal.processors.cache.CacheObjectImpl;
 import org.apache.ignite.internal.processors.cache.GridCacheMapEntry;
 import 
org.apache.ignite.internal.processors.cache.GridCacheSharedManagerAdapter;
+import org.apache.ignite.internal.processors.cache.IncompleteCacheObject;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
 import 
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
 import 
org.apache.ignite.internal.processors.cache.persistence.evict.FairFifoPageEvictionTracker;
 import 
org.apache.ignite.internal.processors.cache.persistence.evict.NoOpPageEvictionTracker;
@@ -179,6 +182,13 @@ public class IgniteCacheDatabaseSharedManager extends 
GridCacheSharedManagerAdap
         return false;
     }
 
+    public Boolean isTombstone(ByteBuffer buf,
+        @Nullable KeyCacheObject key,
+        @Nullable IncompleteCacheObject incomplete) {
+        // TODO IGNITE-11704
+        return null;
+    }
+
     public boolean isTombstone(long addr) throws IgniteCheckedException {
         int off = 0;
 
@@ -206,7 +216,6 @@ public class IgniteCacheDatabaseSharedManager extends 
GridCacheSharedManagerAdap
         return true;
     }
 
-
     /**
      * @param cfg Ignite configuration.
      * @param groupName Name of group.

Reply via email to