You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2017/01/09 09:49:55 UTC

[1/2] ignite git commit: ignite gg 11208 fix test fail

Repository: ignite
Updated Branches:
  refs/heads/ignite-3477 ceff09cbc -> 06de69947


ignite gg 11208 fix test fail


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0f0158d3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0f0158d3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0f0158d3

Branch: refs/heads/ignite-3477
Commit: 0f0158d3e887f0e130fca9807914a1711c1aa866
Parents: 9776f3f
Author: Dmitriy Govorukhin <dg...@gridgain.com>
Authored: Wed Jan 4 13:06:50 2017 +0300
Committer: Dmitriy Govorukhin <dg...@gridgain.com>
Committed: Wed Jan 4 13:06:50 2017 +0300

----------------------------------------------------------------------
 .../cache/CacheOffheapEvictionManager.java      | 90 ++++++++++++++++++++
 .../cache/CacheOfheapEvictionManager.java       | 90 --------------------
 .../processors/cache/GridCacheProcessor.java    |  6 +-
 .../processors/cache/GridCacheTtlManager.java   |  9 +-
 .../cache/IgniteCacheOffheapManagerImpl.java    | 16 ++--
 .../processors/cache/local/GridLocalCache.java  |  5 +-
 .../cache/GridCacheAbstractTxReadTest.java      |  2 -
 .../cache/GridCacheBasicStoreAbstractTest.java  |  2 +-
 ...cheLocalBasicStoreMultithreadedSelfTest.java |  1 +
 9 files changed, 110 insertions(+), 111 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/0f0158d3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOffheapEvictionManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOffheapEvictionManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOffheapEvictionManager.java
new file mode 100644
index 0000000..12c1e80
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOffheapEvictionManager.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.cache;
+
+import java.util.Collection;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * TODO GG-11140.
+ *
+ * Temporary implementation, ignores configured EvictionPolicy, evictions to be reconsidered as
+ * part of GG-1140.
+ *
+ */
+public class CacheOffheapEvictionManager extends GridCacheManagerAdapter implements CacheEvictionManager {
+    /** {@inheritDoc} */
+    @Override public void touch(IgniteTxEntry txEntry, boolean loc) {
+        touch(txEntry.cached(), null);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void touch(GridCacheEntryEx e, AffinityTopologyVersion topVer) {
+        if (e.detached())
+            return;
+
+        try {
+            if (e.markObsoleteIfEmpty(null) || e.obsolete()) {
+                e.context().cache().removeEntry(e);
+
+                return;
+            }
+
+            boolean evicted = e.evictInternal(cctx.versions().next(), null);
+
+            if (evicted)
+                cctx.cache().removeEntry(e);
+        }
+        catch (IgniteCheckedException ex) {
+            U.error(log, "Failed to evict entry from cache: " + e, ex);
+        }
+    }
+
+    /** {@inheritDoc} */
+    @Override public void unwind() {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean evict(@Nullable GridCacheEntryEx entry,
+        @Nullable GridCacheVersion obsoleteVer,
+        boolean explicit,
+        @Nullable CacheEntryPredicate[] filter) throws IgniteCheckedException {
+        return false;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int evictQueueSize() {
+        return 0;
+    }
+
+    /** {@inheritDoc} */
+    @Override public void batchEvict(Collection<?> keys, @Nullable GridCacheVersion obsoleteVer) {
+        // No-op.
+    }
+
+    /** {@inheritDoc} */
+    @Override public boolean evictSyncOrNearSync() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/ignite/blob/0f0158d3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOfheapEvictionManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOfheapEvictionManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOfheapEvictionManager.java
deleted file mode 100644
index d5279fb..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheOfheapEvictionManager.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache;
-
-import java.util.Collection;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
-import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
-import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.jetbrains.annotations.Nullable;
-
-/**
- * TODO GG-11140.
- *
- * Temporary implementation, ignores configured EvictionPolicy, evictions to be reconsidered as
- * part of GG-1140.
- *
- */
-public class CacheOfheapEvictionManager extends GridCacheManagerAdapter implements CacheEvictionManager {
-    /** {@inheritDoc} */
-    @Override public void touch(IgniteTxEntry txEntry, boolean loc) {
-        touch(txEntry.cached(), null);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void touch(GridCacheEntryEx e, AffinityTopologyVersion topVer) {
-        if (e.detached())
-            return;
-
-        try {
-            if (e.markObsoleteIfEmpty(null) || e.obsolete()) {
-                e.context().cache().removeEntry(e);
-
-                return;
-            }
-
-            boolean evicted = e.evictInternal(cctx.versions().next(), null);
-
-            if (evicted)
-                cctx.cache().removeEntry(e);
-        }
-        catch (IgniteCheckedException ex) {
-            U.error(log, "Failed to evict entry from cache: " + e, ex);
-        }
-    }
-
-    /** {@inheritDoc} */
-    @Override public void unwind() {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean evict(@Nullable GridCacheEntryEx entry,
-        @Nullable GridCacheVersion obsoleteVer,
-        boolean explicit,
-        @Nullable CacheEntryPredicate[] filter) throws IgniteCheckedException {
-        return false;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int evictQueueSize() {
-        return 0;
-    }
-
-    /** {@inheritDoc} */
-    @Override public void batchEvict(Collection<?> keys, @Nullable GridCacheVersion obsoleteVer) {
-        // No-op.
-    }
-
-    /** {@inheritDoc} */
-    @Override public boolean evictSyncOrNearSync() {
-        return false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/ignite/blob/0f0158d3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 4f299dd..141d94f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -1396,7 +1396,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
         GridCacheAffinityManager affMgr = new GridCacheAffinityManager();
         GridCacheEventManager evtMgr = new GridCacheEventManager();
-        CacheEvictionManager evictMgr = nearEnabled ? new GridCacheEvictionManager() : new CacheOfheapEvictionManager();
+        CacheEvictionManager evictMgr = nearEnabled ? new GridCacheEvictionManager() : new CacheOffheapEvictionManager();
         GridCacheQueryManager qryMgr = queryManager(cfg);
         CacheContinuousQueryManager contQryMgr = new CacheContinuousQueryManager();
         CacheDataStructuresManager dataStructuresMgr = new CacheDataStructuresManager();
@@ -1409,7 +1409,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
 
         storeMgr.initialize(cfgStore, sesHolders);
 
-        boolean affNode = CU.affinityNode(ctx.discovery().localNode(), cfg.getNodeFilter());
+        boolean affNode = cfg.getCacheMode() == LOCAL || CU.affinityNode(ctx.discovery().localNode(), cfg.getNodeFilter());
 
         GridCacheContext<?, ?> cacheCtx = new GridCacheContext(
             ctx,
@@ -1534,7 +1534,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
              * 7. GridCacheTtlManager.
              * ===============================================
              */
-            evictMgr = new CacheOfheapEvictionManager();
+            evictMgr = new CacheOffheapEvictionManager();
             evtMgr = new GridCacheEventManager();
             pluginMgr = new CachePluginManager(ctx, cfg);
             drMgr = pluginMgr.createComponent(GridCacheDrManager.class);

http://git-wip-us.apache.org/repos/asf/ignite/blob/0f0158d3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
index a336a80..0c7eebb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
@@ -17,12 +17,10 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import java.util.concurrent.atomic.AtomicLongFieldUpdater;
 import org.apache.ignite.IgniteCheckedException;
 import org.apache.ignite.IgniteException;
 import org.apache.ignite.configuration.CacheConfiguration;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
-import org.apache.ignite.internal.IgniteInterruptedCheckedException;
 import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheEntry;
 import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
 import org.apache.ignite.internal.util.GridConcurrentSkipListSet;
@@ -31,8 +29,6 @@ import org.apache.ignite.internal.util.typedef.X;
 import org.apache.ignite.internal.util.typedef.internal.CU;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.internal.util.worker.GridWorker;
-import org.apache.ignite.thread.IgniteThread;
 import org.jetbrains.annotations.Nullable;
 import org.jsr166.LongAdder8;
 
@@ -87,7 +83,8 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter {
 
         cctx.shared().ttl().register(this);
 
-        pendingEntries = cctx.config().getNearConfiguration() != null ? new GridConcurrentSkipListSetEx() : null;
+        //todo check condition for local cache
+        pendingEntries = (!cctx.isLocal() && cctx.config().getNearConfiguration() != null) ? new GridConcurrentSkipListSetEx() : null;
     }
 
     /** {@inheritDoc} */
@@ -156,9 +153,9 @@ public class GridCacheTtlManager extends GridCacheManagerAdapter {
     public boolean expire(int amount) {
         long now = U.currentTimeMillis();
 
-
         try {
             if (pendingEntries != null) {
+                //todo may be not only for near? may be for local too.
                 GridNearCacheAdapter nearCache = cctx.near();
 
                 GridCacheVersion obsoleteVer = null;

http://git-wip-us.apache.org/repos/asf/ignite/blob/0f0158d3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
index 2fc568f..7e9b03b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
@@ -211,10 +211,13 @@ public class IgniteCacheOffheapManagerImpl extends GridCacheManagerAdapter imple
     }
 
     /** {@inheritDoc} */
-    @Override public long entriesCount(boolean primary, boolean backup,
-        AffinityTopologyVersion topVer) throws IgniteCheckedException {
+    @Override public long entriesCount(
+        boolean primary,
+        boolean backup,
+        AffinityTopologyVersion topVer
+    ) throws IgniteCheckedException {
         if (cctx.isLocal())
-            return 0; // TODO: GG-11208.
+            return entriesCount(0);
         else {
             ClusterNode locNode = cctx.localNode();
 
@@ -241,8 +244,11 @@ public class IgniteCacheOffheapManagerImpl extends GridCacheManagerAdapter imple
 
     /** {@inheritDoc} */
     @Override public long entriesCount(int part) {
-        if (cctx.isLocal())
-            return 0; // TODO: GG-11208.
+        if (cctx.isLocal()){
+            assert part == 0;
+
+            return locCacheDataStore.size();
+        }
         else {
             GridDhtLocalPartition locPart = cctx.topology().localPartition(part, AffinityTopologyVersion.NONE, false);
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0f0158d3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
index ee75bd3..b978a46 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCache.java
@@ -55,9 +55,6 @@ public class GridLocalCache<K, V> extends GridCacheAdapter<K, V> {
     /** */
     private GridCachePreloader preldr;
 
-    /** Storage size. */
-    private final AtomicLong storageSize = new AtomicLong(); // TODO GG-11208 need restore after restart.
-
     /**
      * Empty constructor required by {@link Externalizable}.
      */
@@ -247,7 +244,7 @@ public class GridLocalCache<K, V> extends GridCacheAdapter<K, V> {
         modes.backup = true;
 
         if (modes.offheap)
-            return storageSize.get();
+            return ctx.offheap().entriesCount(0);
         else if (modes.heap)
             return size();
         else

http://git-wip-us.apache.org/repos/asf/ignite/blob/0f0158d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractTxReadTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractTxReadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractTxReadTest.java
index 14d0be2..54ec4e9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractTxReadTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractTxReadTest.java
@@ -47,8 +47,6 @@ public abstract class GridCacheAbstractTxReadTest extends GridCacheAbstractSelfT
 
         cfg.setWriteSynchronizationMode(FULL_SYNC);
 
-        cfg.setCacheStoreFactory(null);
-
         return cfg;
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/0f0158d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java
index 0b1f8ae..20bc4c2 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java
@@ -570,7 +570,7 @@ public abstract class GridCacheBasicStoreAbstractTest extends GridCommonAbstract
 
             assert cached != null;
 
-            assert cached == val : "Cached value mismatch [expected=" + val + ", cached=" + cached + ']';
+            assert cached.equals(val) : "Cached value mismatch [expected=" + val + ", cached=" + cached + ']';
 
             // Make sure that value is coming from cache, not from store.
             checkLastMethod(null);

http://git-wip-us.apache.org/repos/asf/ignite/blob/0f0158d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalBasicStoreMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalBasicStoreMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalBasicStoreMultithreadedSelfTest.java
index fba8371..811682a 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalBasicStoreMultithreadedSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/local/GridCacheLocalBasicStoreMultithreadedSelfTest.java
@@ -24,6 +24,7 @@ import org.apache.ignite.internal.processors.cache.GridCacheBasicStoreMultithrea
  * Local test.
  */
 public class GridCacheLocalBasicStoreMultithreadedSelfTest extends GridCacheBasicStoreMultithreadedAbstractTest {
+    /** {@inheritDoc} */
     @Override protected CacheMode cacheMode() {
         return CacheMode.LOCAL;
     }


[2/2] ignite git commit: Merge branch ignite-gg-8.0.2.ea2

Posted by ag...@apache.org.
Merge branch ignite-gg-8.0.2.ea2


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/06de6994
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/06de6994
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/06de6994

Branch: refs/heads/ignite-3477
Commit: 06de699470092e0014a112617d44dbb57945fa08
Parents: ceff09c 0f0158d
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Mon Jan 9 12:42:53 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Mon Jan 9 12:42:53 2017 +0300

----------------------------------------------------------------------
 .../cache/CacheOffheapEvictionManager.java      | 90 ++++++++++++++++++++
 .../cache/CacheOfheapEvictionManager.java       | 90 --------------------
 .../processors/cache/GridCacheProcessor.java    |  4 +-
 .../processors/cache/GridCacheTtlManager.java   |  1 +
 .../cache/IgniteCacheOffheapManagerImpl.java    | 16 ++--
 .../cache/GridCacheAbstractTxReadTest.java      |  2 -
 .../cache/GridCacheBasicStoreAbstractTest.java  |  2 +-
 ...cheLocalBasicStoreMultithreadedSelfTest.java |  1 +
 8 files changed, 106 insertions(+), 100 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/06de6994/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/06de6994/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheTtlManager.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/ignite/blob/06de6994/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
----------------------------------------------------------------------