IGNITE-10756: MVCC: Query trackers are not released sometimes. This closes #5789.
authorrkondakov <kondakov87@mail.ru>
Fri, 11 Jan 2019 14:06:10 +0000 (17:06 +0300)
committerIgor Seliverstov <gvvinblade@gmail.com>
Fri, 11 Jan 2019 14:06:35 +0000 (17:06 +0300)
modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccAbstractTest.java
modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccBasicContinuousQueryTest.java

index 343fd59..29eb572 100644 (file)
@@ -76,6 +76,7 @@ import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException;
 import org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException;
 import org.apache.ignite.internal.util.future.GridCompoundIdentityFuture;
 import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+import org.apache.ignite.internal.util.lang.GridCloseableIterator;
 import org.apache.ignite.internal.util.lang.GridInClosure3;
 import org.apache.ignite.internal.util.typedef.F;
 import org.apache.ignite.internal.util.typedef.G;
@@ -1632,21 +1633,20 @@ public abstract class CacheMvccAbstractTest extends GridCommonAbstractTest {
                 if (!cctx.userCache() || !cctx.group().mvccEnabled() || F.isEmpty(cctx.group().caches()) || cctx.shared().closed(cctx))
                     continue;
 
-                for (Iterator it = cache.withKeepBinary().iterator(); it.hasNext(); ) {
-                    IgniteBiTuple entry = (IgniteBiTuple)it.next();
+                try (GridCloseableIterator it = (GridCloseableIterator)cache.withKeepBinary().iterator()) {
+                    while (it.hasNext()) {
+                        IgniteBiTuple entry = (IgniteBiTuple)it.next();
 
-                    KeyCacheObject key = cctx.toCacheKeyObject(entry.getKey());
+                        KeyCacheObject key = cctx.toCacheKeyObject(entry.getKey());
 
-                    List<IgniteBiTuple<Object, MvccVersion>> vers = cctx.offheap().mvccAllVersions(cctx, key)
-                        .stream().filter(t -> t.get1() != null).collect(Collectors.toList());
+                        List<IgniteBiTuple<Object, MvccVersion>> vers = cctx.offheap().mvccAllVersions(cctx, key)
+                            .stream().filter(t -> t.get1() != null).collect(Collectors.toList());
 
-                    if (vers.size() > 1) {
-                        if (failIfNotCleaned)
-                            fail("[key=" + key.value(null, false) + "; vers=" + vers + ']');
-                        else {
-                            U.closeQuiet((AutoCloseable)it);
-
-                            return false;
+                        if (vers.size() > 1) {
+                            if (failIfNotCleaned)
+                                fail("[key=" + key.value(null, false) + "; vers=" + vers + ']');
+                            else
+                                return false;
                         }
                     }
                 }
index e05b846..e4c8180 100644 (file)
@@ -398,7 +398,6 @@ public class CacheMvccBasicContinuousQueryTest extends CacheMvccAbstractTest  {
     /**
      * @throws Exception  If failed.
      */
-    @Ignore("https://issues.apache.org/jira/browse/IGNITE-10756")
     @Test
     public void testUpdateCountersGapClosedPartitioned() throws Exception {
         checkUpdateCountersGapsClosed(CacheMode.PARTITIONED);
@@ -554,7 +553,6 @@ public class CacheMvccBasicContinuousQueryTest extends CacheMvccAbstractTest  {
         assertEquals(range * 2, arrivedEvts.size());
 
         cur.close();
-        nearNode.close();
     }
 
     /**