ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [ignite] branch ignite-11704 updated: ignite-11704
Date Sun, 28 Jul 2019 06:27:35 GMT
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 8294495  ignite-11704
8294495 is described below

commit 829449525fffdc4e0bac14c6b1905abe164f96d0
Author: sboikov <sboikov@apache.org>
AuthorDate: Fri Jul 26 11:13:19 2019 +0300

    ignite-11704
---
 .../dht/topology/GridDhtLocalPartition.java        |   6 +-
 .../dht/topology/PartitionsEvictManager.java       | 344 +++++++++++++++++----
 .../IgniteCacheDatabaseSharedManager.java          |  22 +-
 .../distributed/CacheRemoveWithTombstonesTest.java |  12 +-
 4 files changed, 300 insertions(+), 84 deletions(-)

diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtLocalPartition.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtLocalPartition.java
index d24cfee..9097463 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/GridDhtLocalPartition.java
@@ -1138,13 +1138,13 @@ public class GridDhtLocalPartition extends GridCacheConcurrentMapImpl
implements
      */
     private void submitClearTombstones() {
         if (tombstoneCreated)
-            grp.shared().kernalContext().closure().runLocalSafe(this::clearTombstones, true);
+            grp.shared().evict().clearTombstonesAsync(grp, this);
     }
 
     /**
      *
      */
-    private void clearTombstones() {
+    public void clearTombstones(EvictionContext evictionCtx) {
         final int stopCheckingFreq = 1000;
 
         CacheMapHolder hld = grp.sharedGroup() ? null : singleCacheEntryMap;
@@ -1202,7 +1202,7 @@ public class GridDhtLocalPartition extends GridCacheConcurrentMapImpl
implements
                 cntr++;
 
                 if (cntr % stopCheckingFreq == 0) {
-                    if (ctx.kernalContext().isStopping() || state() != OWNING)
+                    if (evictionCtx.shouldStop() || state() != OWNING)
                         break;
                 }
             }
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/PartitionsEvictManager.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/PartitionsEvictManager.java
index 826902c..b2fd276 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/PartitionsEvictManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/topology/PartitionsEvictManager.java
@@ -21,6 +21,7 @@ import java.util.Collection;
 import java.util.Comparator;
 import java.util.HashSet;
 import java.util.Map;
+import java.util.Objects;
 import java.util.Queue;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
@@ -104,6 +105,14 @@ public class PartitionsEvictManager extends GridCacheSharedManagerAdapter
{
         }
     }
 
+    public void clearTombstonesAsync(CacheGroupContext grp, GridDhtLocalPartition part) {
+        if (addAsyncTask(grp, part, TaskType.CLEAR_TOMBSTONES)) {
+            if (log.isDebugEnabled())
+                log.debug("Partition has been scheduled for tomstones cleanup [grp=" + grp.cacheOrGroupName()
+                        + ", p=" + part.id() + ", state=" + part.state() + "]");
+        }
+    }
+
     /**
      * Adds partition to eviction queue and starts eviction process if permit available.
      *
@@ -111,29 +120,56 @@ public class PartitionsEvictManager extends GridCacheSharedManagerAdapter
{
      * @param part Partition to evict.
      */
     public void evictPartitionAsync(CacheGroupContext grp, GridDhtLocalPartition part) {
+        if (addAsyncTask(grp, part, TaskType.EVICT)) {
+            if (log.isDebugEnabled())
+                log.debug("Partition has been scheduled for eviction [grp=" + grp.cacheOrGroupName()
+                        + ", p=" + part.id() + ", state=" + part.state() + "]");
+        }
+    }
+
+    /**
+     * @param grp Group context.
+     * @param part Partition.
+     * @param type Task type.
+     * @return {@code True} if task was added.
+     */
+    private boolean addAsyncTask(CacheGroupContext grp, GridDhtLocalPartition part, TaskType
type) {
         GroupEvictionContext grpEvictionCtx = evictionGroupsMap.computeIfAbsent(
             grp.groupId(), (k) -> new GroupEvictionContext(grp));
 
         // Check node stop.
         if (grpEvictionCtx.shouldStop())
-            return;
+            return false;
 
         int bucket;
 
+        AbstractEvictionTask task;
+
+        switch (type) {
+            case EVICT:
+                task = new PartitionEvictionTask(part, grpEvictionCtx);
+                break;
+
+            case CLEAR_TOMBSTONES:
+                task = new ClearTombstonesTask(part, grpEvictionCtx);
+                break;
+
+            default:
+                throw new UnsupportedOperationException("Unsupported task type: " + type);
+        }
+
         synchronized (mux) {
-            if (!grpEvictionCtx.partIds.add(part.id()))
-                return;
+            if (!grpEvictionCtx.taskIds.add(task.id))
+                return false;
 
-            bucket = evictionQueue.offer(new PartitionEvictionTask(part, grpEvictionCtx));
+            bucket = evictionQueue.offer(task);
         }
 
-        grpEvictionCtx.totalTasks.incrementAndGet();
+        grpEvictionCtx.taskAdded(task);
 
-        if (log.isDebugEnabled())
-            log.debug("Partition has been scheduled for eviction [grp=" + grp.cacheOrGroupName()
-                + ", p=" + part.id() + ", state=" + part.state() + "]");
+        scheduleNextTask(bucket);
 
-        scheduleNextPartitionEviction(bucket);
+        return true;
     }
 
     /**
@@ -141,7 +177,7 @@ public class PartitionsEvictManager extends GridCacheSharedManagerAdapter
{
      *
      * @param bucket Bucket.
      */
-    private void scheduleNextPartitionEviction(int bucket) {
+    private void scheduleNextTask(int bucket) {
         // Check node stop.
         if (sharedEvictionCtx.shouldStop())
             return;
@@ -156,7 +192,7 @@ public class PartitionsEvictManager extends GridCacheSharedManagerAdapter
{
                 // Get task until we have permits.
                 while (permits >= 0) {
                     // Get task from bucket.
-                    PartitionEvictionTask evictionTask = evictionQueue.poll(bucket);
+                    AbstractEvictionTask evictionTask = evictionQueue.poll(bucket);
 
                     // If bucket empty try get from another.
                     if (evictionTask == null) {
@@ -196,8 +232,8 @@ public class PartitionsEvictManager extends GridCacheSharedManagerAdapter
{
                             permits++;
                         }
 
-                        // Re-schedule new one task form same bucket.
-                        scheduleNextPartitionEviction(bucket);
+                        // Re-schedule new one task for same bucket.
+                        scheduleNextTask(bucket);
                     });
 
                     // Submit task to executor.
@@ -217,10 +253,10 @@ public class PartitionsEvictManager extends GridCacheSharedManagerAdapter
{
             int size = evictionQueue.size() + 1; // Queue size plus current partition.
 
             if (log.isInfoEnabled())
-                log.info("Eviction in progress [permits=" + permits+
+                log.info("Partition cleanup in progress [permits=" + permits+
                     ", threads=" + threads +
                     ", groups=" + evictionGroupsMap.keySet().size() +
-                    ", remainingPartsToEvict=" + size + "]");
+                    ", remainingTasks=" + size + "]");
 
             evictionGroupsMap.values().forEach(GroupEvictionContext::showProgress);
 
@@ -266,30 +302,55 @@ public class PartitionsEvictManager extends GridCacheSharedManagerAdapter
{
     /**
      *
      */
+    private class TasksStatistics {
+        private int total;
+
+        private int inProgress;
+
+        void taskAdded() {
+            total++;
+        }
+
+        void taskStarted() {
+            inProgress++;
+        }
+
+        void taskFinished() {
+            total--;
+            inProgress--;
+        }
+    }
+
+    /**
+     *
+     */
     private class GroupEvictionContext implements EvictionContext {
         /** */
         private final CacheGroupContext grp;
 
-        /** Deduplicate set partition ids. */
-        private final Set<Integer> partIds = new HashSet<>();
+        /** Deduplicate set partition tasks. */
+        private final Set<TaskId> taskIds = new HashSet<>();
 
         /** Future for currently running partition eviction task. */
-        private final Map<Integer, IgniteInternalFuture<?>> partsEvictFutures
= new ConcurrentHashMap<>();
+        private final Map<TaskId, IgniteInternalFuture<?>> taskFutures = new
ConcurrentHashMap<>();
 
         /** Flag indicates that eviction process has stopped for this group. */
         private volatile boolean stop;
 
-        /** Total partition to evict. */
+        /** Total tasks. */
         private AtomicInteger totalTasks = new AtomicInteger();
 
-        /** Total partition evict in progress. */
-        private int taskInProgress;
+        /** */
+        private Map<TaskType, TasksStatistics> stats = U.newHashMap(2);
 
         /**
          * @param grp Group context.
          */
         private GroupEvictionContext(CacheGroupContext grp) {
             this.grp = grp;
+
+            for (TaskType type : TaskType.VALS)
+                stats.put(type, new TasksStatistics());
         }
 
         /** {@inheritDoc} */
@@ -297,29 +358,35 @@ public class PartitionsEvictManager extends GridCacheSharedManagerAdapter
{
             return stop || sharedEvictionCtx.shouldStop();
         }
 
+        void taskAdded(AbstractEvictionTask task) {
+            totalTasks.incrementAndGet();
+
+            synchronized (this) {
+                stats.get(task.id.type).taskAdded();
+            }
+        }
+
         /**
          *
          * @param task Partition eviction task.
          */
-        private synchronized void taskScheduled(PartitionEvictionTask task) {
+        private synchronized void taskScheduled(AbstractEvictionTask task) {
             if (shouldStop())
                 return;
 
-            taskInProgress++;
+           stats.get(task.id.type).taskStarted();
 
             GridFutureAdapter<?> fut = task.finishFut;
 
-            int partId = task.part.id();
-
-            partIds.remove(partId);
+            taskIds.remove(task.id);
 
-            partsEvictFutures.put(partId, fut);
+            taskFutures.put(task.id, fut);
 
             fut.listen(f -> {
                 synchronized (this) {
-                    taskInProgress--;
+                    stats.get(task.id.type).taskFinished();
 
-                    partsEvictFutures.remove(partId, f);
+                    taskFutures.remove(task.id, f);
 
                     if (totalTasks.decrementAndGet() == 0)
                         evictionGroupsMap.remove(grp.groupId());
@@ -338,7 +405,7 @@ public class PartitionsEvictManager extends GridCacheSharedManagerAdapter
{
          * Await evict finish.
          */
         private void awaitFinishAll(){
-            partsEvictFutures.forEach(this::awaitFinish);
+            taskFutures.forEach(this::awaitFinish);
 
             evictionGroupsMap.remove(grp.groupId());
         }
@@ -346,17 +413,17 @@ public class PartitionsEvictManager extends GridCacheSharedManagerAdapter
{
         /**
          * Await evict finish partition.
          */
-        private void awaitFinish(Integer part, IgniteInternalFuture<?> fut) {
+        private void awaitFinish(TaskId taskId, IgniteInternalFuture<?> fut) {
             // Wait for last offered partition eviction completion
             try {
-                log.info("Await partition evict, grpName=" + grp.cacheOrGroupName() +
-                    ", grpId=" + grp.groupId() + ", partId=" + part);
+                log.info("Await partition cleanup [grpName=" + grp.cacheOrGroupName() +
+                    ", grpId=" + grp.groupId() + ", task=" + taskId.type + ", partId=" +
taskId.part + ']');
 
                 fut.get();
             }
             catch (IgniteCheckedException e) {
                 if (log.isDebugEnabled())
-                    log.warning("Failed to await partition eviction during stopping.", e);
+                    log.warning("Failed to await partition cleanup during stopping.", e);
             }
         }
 
@@ -364,47 +431,132 @@ public class PartitionsEvictManager extends GridCacheSharedManagerAdapter
{
          * Shows progress group of eviction.
          */
         private void showProgress() {
-            if (log.isInfoEnabled())
-                log.info("Group eviction in progress [grpName=" + grp.cacheOrGroupName()+
-                    ", grpId=" + grp.groupId() +
-                    ", remainingPartsToEvict=" + (totalTasks.get() - taskInProgress) +
-                    ", partsEvictInProgress=" + taskInProgress +
-                    ", totalParts= " + grp.topology().localPartitions().size() + "]");
+            if (log.isInfoEnabled()) {
+                StringBuilder msg = new StringBuilder(
+                    "Group cleanup in progress [grpName=" + grp.cacheOrGroupName() + ", grpId="
+ grp.groupId());
+
+                synchronized (this) {
+                    TasksStatistics evicts = stats.get(TaskType.EVICT);
+                    if (evicts.total > 0) {
+                        msg.append(", remainingPartsToEvict=" + (evicts.total - evicts.inProgress)).
+                            append(", partsEvictInProgress=" + evicts.inProgress);
+                    }
+
+                    TasksStatistics tombstones = stats.get(TaskType.CLEAR_TOMBSTONES);
+                    if (tombstones.total > 0) {
+                        msg.append(", remainingPartsToClearTombstones=" + (tombstones.total
- tombstones.inProgress)).
+                            append(", tombstoneClearInProgress=" + tombstones.inProgress);
+                    }
+                }
+
+                msg.append(", totalParts= " + grp.topology().localPartitions().size() + "]");
+
+                log.info(msg.toString());
+            }
         }
     }
 
     /**
-     * Task for self-scheduled partition eviction / clearing.
+     *
      */
-    private class PartitionEvictionTask implements Runnable {
+    private enum TaskType {
+        /** */
+        EVICT,
+
+        /** */
+        CLEAR_TOMBSTONES;
+
+        /** */
+        private static TaskType[] VALS = values();
+    }
+
+    /**
+     *
+     */
+    private static class TaskId {
+        /** */
+        final int part;
+
+        /** */
+        final TaskType type;
+
+        /**
+         * @param part Partiotion id.
+         * @param type Task type.
+         */
+        TaskId(int part, TaskType type) {
+            this.part = part;
+            this.type = type;
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean equals(Object o) {
+            if (this == o)
+                return true;
+
+            if (o == null || getClass() != o.getClass())
+                return false;
+
+            TaskId taskKey = (TaskId)o;
+
+            return part == taskKey.part && type == taskKey.type;
+        }
+
+        /** {@inheritDoc} */
+        @Override public int hashCode() {
+            return Objects.hash(part, type);
+        }
+    }
+
+    /**
+     *
+     */
+    private abstract class AbstractEvictionTask implements Runnable {
         /** Partition to evict. */
-        private final GridDhtLocalPartition part;
+        protected final GridDhtLocalPartition part;
 
         /** */
-        private final long size;
+        protected final long size;
 
         /** Eviction context. */
-        private final GroupEvictionContext grpEvictionCtx;
+        protected final GroupEvictionContext grpEvictionCtx;
 
         /** */
-        private final GridFutureAdapter<?> finishFut = new GridFutureAdapter<>();
+        protected final GridFutureAdapter<?> finishFut = new GridFutureAdapter<>();
+
+        /** */
+        private final TaskId id;
 
         /**
          * @param part Partition.
          * @param grpEvictionCtx Eviction context.
          */
-        private PartitionEvictionTask(
-            GridDhtLocalPartition part,
-            GroupEvictionContext grpEvictionCtx
+        private AbstractEvictionTask(
+                GridDhtLocalPartition part,
+                GroupEvictionContext grpEvictionCtx,
+                TaskType type
         ) {
             this.part = part;
             this.grpEvictionCtx = grpEvictionCtx;
 
+            id = new TaskId(part.id(), type);
+
             size = part.fullSize();
         }
 
+        /**
+         * @return {@code False} if need retry task later.
+         * @throws IgniteCheckedException If failed.
+         */
+        abstract boolean run0() throws IgniteCheckedException;
+
+        /**
+         *
+         */
+        abstract void scheduleRetry();
+
         /** {@inheritDoc} */
-        @Override public void run() {
+        @Override public final void run() {
             if (grpEvictionCtx.shouldStop()) {
                 finishFut.onDone();
 
@@ -412,16 +564,7 @@ public class PartitionsEvictManager extends GridCacheSharedManagerAdapter
{
             }
 
             try {
-                assert part.state() != GridDhtPartitionState.OWNING : part;
-
-                boolean success = part.tryClear(grpEvictionCtx);
-
-                assert part.state() != GridDhtPartitionState.OWNING : part;
-
-                if (success) {
-                    if (part.state() == GridDhtPartitionState.EVICTED && part.markForDestroy())
-                        part.destroy();
-                }
+                boolean success = run0();
 
                 // Complete eviction future before schedule new to prevent deadlock with
                 // simultaneous eviction stopping and scheduling new eviction.
@@ -429,7 +572,7 @@ public class PartitionsEvictManager extends GridCacheSharedManagerAdapter
{
 
                 // Re-offer partition if clear was unsuccessful due to partition reservation.
                 if (!success)
-                    evictPartitionAsync(grpEvictionCtx.grp, part);
+                    scheduleRetry();
             }
             catch (Throwable ex) {
                 finishFut.onDone(ex);
@@ -446,11 +589,76 @@ public class PartitionsEvictManager extends GridCacheSharedManagerAdapter
{
     }
 
     /**
+     * Task for self-scheduled partition eviction / clearing.
+     */
+    private class PartitionEvictionTask extends AbstractEvictionTask {
+        /**
+         * @param part Partition.
+         * @param grpEvictionCtx Eviction context.
+         */
+        private PartitionEvictionTask(
+            GridDhtLocalPartition part,
+            GroupEvictionContext grpEvictionCtx
+        ) {
+            super(part, grpEvictionCtx, TaskType.EVICT);
+        }
+
+        /** {@inheritDoc} */
+        @Override void scheduleRetry() {
+            evictPartitionAsync(grpEvictionCtx.grp, part);
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean run0() throws IgniteCheckedException {
+            assert part.state() != GridDhtPartitionState.OWNING : part;
+
+            boolean success = part.tryClear(grpEvictionCtx);
+
+            assert part.state() != GridDhtPartitionState.OWNING : part;
+
+            if (success) {
+                if (part.state() == GridDhtPartitionState.EVICTED && part.markForDestroy())
+                    part.destroy();
+            }
+
+            return success;
+        }
+    }
+
+    /**
+     *
+     */
+    private class ClearTombstonesTask extends AbstractEvictionTask {
+        /**
+         * @param part Partition.
+         * @param grpEvictionCtx Eviction context.
+         */
+        private ClearTombstonesTask(
+                GridDhtLocalPartition part,
+                GroupEvictionContext grpEvictionCtx
+        ) {
+            super(part, grpEvictionCtx, TaskType.CLEAR_TOMBSTONES);
+        }
+
+        /** {@inheritDoc} */
+        @Override void scheduleRetry() {
+            throw new UnsupportedOperationException();
+        }
+
+        /** {@inheritDoc} */
+        @Override public boolean run0() throws IgniteCheckedException {
+            part.clearTombstones(grpEvictionCtx);
+
+            return true;
+        }
+    }
+
+    /**
      *
      */
     private class BucketQueue {
         /** Queues contains partitions scheduled for eviction. */
-        private final Queue<PartitionEvictionTask>[] buckets;
+        private final Queue<AbstractEvictionTask>[] buckets;
 
         /** */
         private final long[] bucketSizes;
@@ -473,8 +681,8 @@ public class PartitionsEvictManager extends GridCacheSharedManagerAdapter
{
          * @param bucket Bucket index.
          * @return Partition evict task, or {@code null} if bucket queue is empty.
          */
-        PartitionEvictionTask poll(int bucket) {
-            PartitionEvictionTask task = buckets[bucket].poll();
+        AbstractEvictionTask poll(int bucket) {
+            AbstractEvictionTask task = buckets[bucket].poll();
 
             if (task != null)
                 bucketSizes[bucket] -= task.size;
@@ -487,7 +695,7 @@ public class PartitionsEvictManager extends GridCacheSharedManagerAdapter
{
          *
          * @return Partition evict task.
          */
-        PartitionEvictionTask pollAny() {
+        AbstractEvictionTask pollAny() {
             for (int bucket = 0; bucket < bucketSizes.length; bucket++){
                 if (!buckets[bucket].isEmpty())
                     return poll(bucket);
@@ -502,7 +710,7 @@ public class PartitionsEvictManager extends GridCacheSharedManagerAdapter
{
          * @param task Eviction task.
          * @return Bucket index.
          */
-        int offer(PartitionEvictionTask task) {
+        int offer(AbstractEvictionTask task) {
             int bucket = calculateBucket();
 
             buckets[bucket].offer(task);
@@ -526,7 +734,7 @@ public class PartitionsEvictManager extends GridCacheSharedManagerAdapter
{
         int size(){
             int size = 0;
 
-            for (Queue<PartitionEvictionTask> queue : buckets)
+            for (Queue<AbstractEvictionTask> queue : buckets)
                 size += queue.size();
 
             return size;
@@ -556,7 +764,7 @@ public class PartitionsEvictManager extends GridCacheSharedManagerAdapter
{
          *
          * @return Queue for evict partitions.
          */
-        private Queue<PartitionEvictionTask> createEvictPartitionQueue() {
+        private Queue<AbstractEvictionTask> createEvictPartitionQueue() {
             switch (QUEUE_TYPE) {
                 case 1:
                     return new PriorityBlockingQueue<>(
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 567c104..88521f8 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
@@ -164,11 +164,19 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
         tombstoneVal = new CacheObjectImpl(null, tombstoneBytes);
     }
 
+    /**
+     * @return Value to be stored for removed entry.
+     */
     public CacheObject tombstoneValue() {
         return tombstoneVal;
     }
 
-    public boolean isTombstone(CacheDataRow row) throws IgniteCheckedException {
+    /**
+     * @param row Row.
+     * @return {@code True} if given row is tombstone.
+     * @throws IgniteCheckedException If failed.
+     */
+    public boolean isTombstone(@Nullable CacheDataRow row) throws IgniteCheckedException
{
         if (row == null)
             return false;
 
@@ -191,11 +199,10 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
      * @param key Row key.
      * @param incomplete Incomplete object.
      * @return Tombstone flag or {@code null} if there is no enough data.
-     * @throws IgniteCheckedException If failed.
      */
     public Boolean isTombstone(ByteBuffer buf,
         @Nullable KeyCacheObject key,
-        @Nullable IncompleteCacheObject incomplete) throws IgniteCheckedException {
+        @Nullable IncompleteCacheObject incomplete) {
         if (key == null) {
             if (incomplete == null) { // Did not start read key yet.
                 if (buf.remaining() < IncompleteCacheObject.HEAD_LEN) {
@@ -257,9 +264,8 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
      * @param buf Buffer.
      * @param offset Value offset.
      * @return Tombstone flag or {@code null} if there is no enough data.
-     * @throws IgniteCheckedException If failed.
      */
-     private Boolean isTombstone(ByteBuffer buf, int offset) throws IgniteCheckedException
{
+     private Boolean isTombstone(ByteBuffer buf, int offset) {
          int valLen = buf.getInt(buf.position() + offset);
          if (valLen != tombstoneBytes.length)
              return Boolean.FALSE;
@@ -279,7 +285,11 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
          return Boolean.TRUE;
      }
 
-    public boolean isTombstone(long addr) throws IgniteCheckedException {
+    /**
+     * @param addr Row address.
+     * @return {@code True} if stored value is tombstone.
+     */
+    public boolean isTombstone(long addr) {
         int off = 0;
 
         byte type = PageUtils.getByte(addr, off + 4);
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheRemoveWithTombstonesTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheRemoveWithTombstonesTest.java
index 05962c4..dcd7f6c 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheRemoveWithTombstonesTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheRemoveWithTombstonesTest.java
@@ -127,9 +127,7 @@ public class CacheRemoveWithTombstonesTest extends GridCommonAbstractTest
{
     public void testRemoveAndRebalanceRaceTxWithPersistence() throws Exception {
         persistence = true;
 
-        cleanPersistenceDir();
-
-        testRemoveAndRebalanceRace(TRANSACTIONAL, true);
+        testRemoveAndRebalanceRaceTx();
     }
 
     /**
@@ -139,7 +137,7 @@ public class CacheRemoveWithTombstonesTest extends GridCommonAbstractTest
{
     public void testRemoveAndRebalanceRaceTxMvccWithPersistence() throws Exception {
         persistence = true;
 
-        testRemoveAndRebalanceRace(TRANSACTIONAL_SNAPSHOT, false);
+        testRemoveAndRebalanceRaceTxMvcc();
     }
 
     /**
@@ -149,7 +147,7 @@ public class CacheRemoveWithTombstonesTest extends GridCommonAbstractTest
{
     public void testRemoveAndRebalanceRaceAtomicWithPersistence() throws Exception {
         persistence = true;
 
-        testRemoveAndRebalanceRace(ATOMIC, false);
+        testRemoveAndRebalanceRaceAtomic();
     }
 
     /**
@@ -164,7 +162,7 @@ public class CacheRemoveWithTombstonesTest extends GridCommonAbstractTest
{
 
         IgniteCache<Integer, Integer> cache0 = ignite0.createCache(cacheConfiguration(atomicityMode));
 
-        LongMetric tombstoneMetric0 =  (LongMetric)ignite0.context().metric().registry(
+        LongMetric tombstoneMetric0 = ignite0.context().metric().registry(
                 cacheMetricsRegistryName(DEFAULT_CACHE_NAME, false)).findMetric("Tombstones");
 
         Map<Integer, Integer> map = new HashMap<>();
@@ -203,7 +201,7 @@ public class CacheRemoveWithTombstonesTest extends GridCommonAbstractTest
{
             }
         }
 
-        final LongMetric tombstoneMetric1 =  (LongMetric)ignite1.context().metric().registry(
+        final LongMetric tombstoneMetric1 =  ignite1.context().metric().registry(
                 cacheMetricsRegistryName(DEFAULT_CACHE_NAME, false)).findMetric("Tombstones");
 
         // On first node there should not be tombstones.


Mime
View raw message