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 2015/06/23 23:52:38 UTC

incubator-ignite git commit: #DEBUG

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-sprint-4-7.0.5-debug 768051344 -> 8d1f49608


#DEBUG


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

Branch: refs/heads/ignite-sprint-4-7.0.5-debug
Commit: 8d1f49608aa2add81268721b9dae70ccf3f5dadf
Parents: 7680513
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Tue Jun 23 14:52:32 2015 -0700
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Tue Jun 23 14:52:32 2015 -0700

----------------------------------------------------------------------
 .../processors/cache/GridCacheMapEntry.java     |  7 +-
 .../IgniteCacheNearReaderOffheapSelfTest.java   | 95 ++++++++++++++++++++
 2 files changed, 101 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8d1f4960/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 71858d1..855ba7d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -2501,6 +2501,8 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
             if (mvcc == null || mvcc.isEmpty(ver)) {
                 obsoleteVer = ver;
 
+                U.dumpStack(log, "Marking entry as obsolete [entry=" + this + ", thread=" + Thread.currentThread().getName() + ']');
+
                 obsoleteVersionExtras(obsoleteVer);
 
                 if (clear)
@@ -2509,8 +2511,11 @@ public abstract class GridCacheMapEntry implements GridCacheEntryEx {
 
             return obsoleteVer != null;
         }
-        else
+        else {
+            U.debug(log, "Did not mark entry as obsolete (ver was null): " + this);
+
             return obsoleteVer != null;
+        }
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8d1f4960/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNearReaderOffheapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNearReaderOffheapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNearReaderOffheapSelfTest.java
new file mode 100644
index 0000000..091877e
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheNearReaderOffheapSelfTest.java
@@ -0,0 +1,95 @@
+/*
+ * 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 org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
+
+import java.util.concurrent.*;
+
+/**
+ *
+ */
+public class IgniteCacheNearReaderOffheapSelfTest extends GridCacheAbstractSelfTest {
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 4;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
+        CacheConfiguration cfg = super.cacheConfiguration(gridName);
+
+        cfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
+        cfg.setBackups(1);
+        cfg.setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL);
+
+        return cfg;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        if (getTestGridName(2).equals(gridName) || getTestGridName(3).equals(gridName))
+            cfg.setClientMode(true);
+
+        cfg.setConnectorConfiguration(new ConnectorConfiguration());
+
+        return cfg;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testReader() throws Exception {
+        ignite(3).getOrCreateNearCache(null, new NearCacheConfiguration<>());
+
+        awaitPartitionMapExchange();
+
+        String prev = null;
+
+        info("ITERATION: " + 0);
+
+        int idx = 1;
+
+        assertEquals(prev, ignite(2).cache(null).get("key"));
+
+        info("DONE READING FROM CLIENT");
+
+        ignite(idx).cache(null).put("key", "value" + 0);
+
+        prev = "value" + 0;
+
+        assertEquals(prev, ignite(3).cache(null).get("key"));
+
+        info("Entry: " + ((IgniteKernal)ignite(0)).internalCache(null).peekEx("key"));
+
+        ignite(idx).cache(null).put("key", "value" + 1);
+
+        assertEquals("value1", ignite(3).cache(null).get("key"));
+    }
+
+    @Override
+    protected long getTestTimeout() {
+        return Long.MAX_VALUE;
+    }
+}