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/08/15 03:48:48 UTC

[01/35] incubator-ignite git commit: ignite-946: added tests

Repository: incubator-ignite
Updated Branches:
  refs/heads/ignite-264 f9511aff9 -> 9278d805f


ignite-946: added tests


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

Branch: refs/heads/ignite-264
Commit: 325d06d3127e73554cfcf40a549d2ae9343dca50
Parents: 01c0246
Author: Denis Magda <dm...@gridgain.com>
Authored: Thu Jul 30 16:03:18 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Jul 31 15:49:10 2015 +0300

----------------------------------------------------------------------
 .../cache/version/CacheVersionedEntryImpl.java  |   2 -
 .../CacheVersionedEntryAbstractTest.java        | 184 +++++++++++++++++++
 .../CacheVersionedEntryLocalAtomicSelfTest.java |  40 ++++
 ...ersionedEntryLocalTransactionalSelfTest.java |  40 ++++
 ...edEntryPartitionedAtomicOffHeapSelfTest.java |  35 ++++
 ...VersionedEntryPartitionedAtomicSelfTest.java |  35 ++++
 ...PartitionedTransactionalOffHeapSelfTest.java |  36 ++++
 ...edEntryPartitionedTransactionalSelfTest.java |  35 ++++
 ...nedEntryReplicatedAtomicOffHeapSelfTest.java |  35 ++++
 ...eVersionedEntryReplicatedAtomicSelfTest.java |  35 ++++
 ...yReplicatedTransactionalOffHeapSelfTest.java |  36 ++++
 ...nedEntryReplicatedTransactionalSelfTest.java |  35 ++++
 .../testsuites/IgniteCacheTestSuite4.java       |  13 ++
 13 files changed, 559 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/325d06d3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
index 6d1e0c9..924eff9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
@@ -48,8 +48,6 @@ public class CacheVersionedEntryImpl<K, V> extends CacheEntryImpl<K, V> implemen
     public CacheVersionedEntryImpl(K key, V val, GridCacheVersion ver) {
         super(key, val);
 
-        assert val == null;
-
         this.ver = ver;
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/325d06d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
new file mode 100644
index 0000000..951d05a
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
@@ -0,0 +1,184 @@
+/*
+ * 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.version;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.*;
+import org.apache.ignite.cache.version.*;
+import org.apache.ignite.internal.processors.cache.*;
+
+import javax.cache.*;
+import javax.cache.processor.*;
+import java.util.*;
+import java.util.concurrent.atomic.*;
+
+/**
+ * Versioned entry abstract test.
+ */
+public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractSelfTest {
+    /** Entries number to store in a cache. */
+    private static final int ENTRIES_NUM = 1000;
+
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 2;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected void beforeTest() throws Exception {
+        super.beforeTest();
+
+        Cache<Integer, String> cache = grid(0).cache(null);
+
+        for (int i = 0 ; i < ENTRIES_NUM; i++)
+            cache.put(i, "value_" + i);
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testInvoke() throws Exception {
+        Cache<Integer, String> cache = grid(0).cache(null);
+
+        final AtomicBoolean invoked = new AtomicBoolean(false);
+
+        cache.invoke(100, new EntryProcessor<Integer, String, Object>() {
+            @Override public Object process(MutableEntry<Integer, String> entry, Object... arguments)
+                throws EntryProcessorException {
+
+                invoked.set(true);
+
+                VersionedEntry<Integer, String> verEntry = entry.unwrap(VersionedEntry.class);
+
+                checkVersionedEntry(verEntry);
+
+                return entry;
+            }
+        });
+
+        assertTrue(invoked.get());
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testInvokeAll() throws Exception {
+        Cache<Integer, String> cache = grid(0).cache(null);
+
+        Set<Integer> keys = new HashSet<>();
+
+        for (int i = 0; i < ENTRIES_NUM; i++)
+            keys.add(i);
+
+        final AtomicInteger invoked = new AtomicInteger();
+
+        cache.invokeAll(keys, new EntryProcessor<Integer, String, Object>() {
+            @Override public Object process(MutableEntry<Integer, String> entry, Object... arguments)
+                throws EntryProcessorException {
+
+                invoked.incrementAndGet();
+
+                VersionedEntry<Integer, String> verEntry = entry.unwrap(VersionedEntry.class);
+
+                checkVersionedEntry(verEntry);
+
+                return null;
+            }
+        });
+
+        assert invoked.get() > 0;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testRandomEntry() throws Exception {
+        IgniteCache<Integer, String> cache = grid(0).cache(null);
+
+        for (int i = 0; i < 5; i++)
+            checkVersionedEntry(cache.randomEntry().unwrap(VersionedEntry.class));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testIterator() throws Exception {
+        IgniteCache<Integer, String> cache = grid(0).cache(null);
+
+        Iterator<Cache.Entry<Integer, String>> entries = cache.iterator();
+
+        while (entries.hasNext())
+            checkVersionedEntry(entries.next().unwrap(VersionedEntry.class));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testLocalPeek() throws Exception {
+        IgniteCache<Integer, String> cache = grid(0).cache(null);
+
+        Iterable<Cache.Entry<Integer, String>> entries = offheapTiered(cache) ?
+            cache.localEntries(CachePeekMode.SWAP, CachePeekMode.OFFHEAP) :
+            cache.localEntries(CachePeekMode.ONHEAP);
+
+        for (Cache.Entry<Integer, String> entry : entries)
+            checkVersionedEntry(entry.unwrap(VersionedEntry.class));
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testVersionComparision() throws Exception {
+        IgniteCache<Integer, String> cache = grid(0).cache(null);
+
+        VersionedEntry<String, Integer> ver1 = cache.invoke(100,
+            new EntryProcessor<Integer, String, VersionedEntry<String, Integer>>() {
+                @Override public VersionedEntry<String, Integer> process(MutableEntry<Integer, String> entry,
+                    Object... arguments) throws EntryProcessorException {
+                        return entry.unwrap(VersionedEntry.class);
+                    }
+            });
+
+        cache.put(100, "new value 100");
+
+        VersionedEntry<String, Integer> ver2 = cache.invoke(100,
+            new EntryProcessor<Integer, String, VersionedEntry<String, Integer>>() {
+                @Override public VersionedEntry<String, Integer> process(MutableEntry<Integer, String> entry,
+                    Object... arguments) throws EntryProcessorException {
+                        return entry.unwrap(VersionedEntry.class);
+                    }
+            });
+
+        assert VersionedEntry.VERSIONS_COMPARATOR.compare(ver1, ver2) < 0;
+    }
+
+    /**
+     * @param entry Versioned entry.
+     */
+    private void checkVersionedEntry(VersionedEntry<Integer, String> entry) {
+        assertNotNull(entry);
+
+        assert entry.topologyVersion() > 0;
+        assert entry.order() > 0;
+        assert entry.nodeOrder() > 0;
+        assert entry.globalTime() > 0;
+
+        assertNotNull(entry.getKey());
+        assertNotNull(entry.getValue());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/325d06d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryLocalAtomicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryLocalAtomicSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryLocalAtomicSelfTest.java
new file mode 100644
index 0000000..a340413
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryLocalAtomicSelfTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.version;
+
+import org.apache.ignite.cache.*;
+
+/**
+ *
+ */
+public class CacheVersionedEntryLocalAtomicSelfTest extends CacheVersionedEntryAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.LOCAL;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return CacheAtomicityMode.ATOMIC;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/325d06d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryLocalTransactionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryLocalTransactionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryLocalTransactionalSelfTest.java
new file mode 100644
index 0000000..4833c2c
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryLocalTransactionalSelfTest.java
@@ -0,0 +1,40 @@
+/*
+ * 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.version;
+
+import org.apache.ignite.cache.*;
+
+/**
+ *
+ */
+public class CacheVersionedEntryLocalTransactionalSelfTest extends CacheVersionedEntryAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.LOCAL;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return CacheAtomicityMode.TRANSACTIONAL;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/325d06d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryPartitionedAtomicOffHeapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryPartitionedAtomicOffHeapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryPartitionedAtomicOffHeapSelfTest.java
new file mode 100644
index 0000000..2f33d84
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryPartitionedAtomicOffHeapSelfTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.version;
+
+import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
+
+/**
+ *
+ */
+public class CacheVersionedEntryPartitionedAtomicOffHeapSelfTest extends CacheVersionedEntryPartitionedAtomicSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
+        CacheConfiguration cfg = super.cacheConfiguration(gridName);
+
+        cfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
+
+        return cfg;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/325d06d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryPartitionedAtomicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryPartitionedAtomicSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryPartitionedAtomicSelfTest.java
new file mode 100644
index 0000000..f2197ad
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryPartitionedAtomicSelfTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.version;
+
+import org.apache.ignite.cache.*;
+
+/**
+ *
+ */
+public class CacheVersionedEntryPartitionedAtomicSelfTest extends CacheVersionedEntryAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.PARTITIONED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return CacheAtomicityMode.ATOMIC;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/325d06d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryPartitionedTransactionalOffHeapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryPartitionedTransactionalOffHeapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryPartitionedTransactionalOffHeapSelfTest.java
new file mode 100644
index 0000000..7494690
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryPartitionedTransactionalOffHeapSelfTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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.version;
+
+import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
+
+/**
+ *
+ */
+public class CacheVersionedEntryPartitionedTransactionalOffHeapSelfTest extends
+    CacheVersionedEntryPartitionedTransactionalSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
+        CacheConfiguration cfg = super.cacheConfiguration(gridName);
+
+        cfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
+
+        return cfg;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/325d06d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryPartitionedTransactionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryPartitionedTransactionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryPartitionedTransactionalSelfTest.java
new file mode 100644
index 0000000..95a63c8
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryPartitionedTransactionalSelfTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.version;
+
+import org.apache.ignite.cache.*;
+
+/**
+ *
+ */
+public class CacheVersionedEntryPartitionedTransactionalSelfTest extends CacheVersionedEntryAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.PARTITIONED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return CacheAtomicityMode.TRANSACTIONAL;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/325d06d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryReplicatedAtomicOffHeapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryReplicatedAtomicOffHeapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryReplicatedAtomicOffHeapSelfTest.java
new file mode 100644
index 0000000..dd3fd0c
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryReplicatedAtomicOffHeapSelfTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.version;
+
+import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
+
+/**
+ *
+ */
+public class CacheVersionedEntryReplicatedAtomicOffHeapSelfTest extends CacheVersionedEntryReplicatedAtomicSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
+        CacheConfiguration cfg = super.cacheConfiguration(gridName);
+
+        cfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
+
+        return cfg;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/325d06d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryReplicatedAtomicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryReplicatedAtomicSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryReplicatedAtomicSelfTest.java
new file mode 100644
index 0000000..fd9617d
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryReplicatedAtomicSelfTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.version;
+
+import org.apache.ignite.cache.*;
+
+/**
+ *
+ */
+public class CacheVersionedEntryReplicatedAtomicSelfTest extends CacheVersionedEntryAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.REPLICATED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return CacheAtomicityMode.ATOMIC;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/325d06d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryReplicatedTransactionalOffHeapSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryReplicatedTransactionalOffHeapSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryReplicatedTransactionalOffHeapSelfTest.java
new file mode 100644
index 0000000..d1bc5c3
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryReplicatedTransactionalOffHeapSelfTest.java
@@ -0,0 +1,36 @@
+/*
+ * 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.version;
+
+import org.apache.ignite.cache.*;
+import org.apache.ignite.configuration.*;
+
+/**
+ *
+ */
+public class CacheVersionedEntryReplicatedTransactionalOffHeapSelfTest extends
+    CacheVersionedEntryReplicatedTransactionalSelfTest {
+    /** {@inheritDoc} */
+    @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception {
+        CacheConfiguration cfg = super.cacheConfiguration(gridName);
+
+        cfg.setMemoryMode(CacheMemoryMode.OFFHEAP_TIERED);
+
+        return cfg;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/325d06d3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryReplicatedTransactionalSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryReplicatedTransactionalSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryReplicatedTransactionalSelfTest.java
new file mode 100644
index 0000000..8d37e7b
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryReplicatedTransactionalSelfTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.version;
+
+import org.apache.ignite.cache.*;
+
+/**
+ *
+ */
+public class CacheVersionedEntryReplicatedTransactionalSelfTest extends CacheVersionedEntryAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.REPLICATED;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return CacheAtomicityMode.TRANSACTIONAL;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/325d06d3/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
index 18b2409..dd9c799 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
@@ -25,6 +25,7 @@ import org.apache.ignite.internal.processors.cache.distributed.*;
 import org.apache.ignite.internal.processors.cache.distributed.dht.*;
 import org.apache.ignite.internal.processors.cache.distributed.near.*;
 import org.apache.ignite.internal.processors.cache.integration.*;
+import org.apache.ignite.internal.processors.cache.version.*;
 
 /**
  * Test suite.
@@ -153,6 +154,18 @@ public class IgniteCacheTestSuite4 extends TestSuite {
         suite.addTestSuite(CacheReadThroughLocalAtomicRestartSelfTest.class);
         suite.addTestSuite(CacheReadThroughAtomicRestartSelfTest.class);
 
+        // Versioned entry tests
+        suite.addTestSuite(CacheVersionedEntryLocalAtomicSelfTest.class);
+        suite.addTestSuite(CacheVersionedEntryLocalTransactionalSelfTest.class);
+        suite.addTestSuite(CacheVersionedEntryPartitionedAtomicSelfTest.class);
+        suite.addTestSuite(CacheVersionedEntryPartitionedTransactionalSelfTest.class);
+        suite.addTestSuite(CacheVersionedEntryPartitionedAtomicOffHeapSelfTest.class);
+        suite.addTestSuite(CacheVersionedEntryPartitionedTransactionalOffHeapSelfTest.class);
+        suite.addTestSuite(CacheVersionedEntryReplicatedAtomicSelfTest.class);
+        suite.addTestSuite(CacheVersionedEntryReplicatedTransactionalSelfTest.class);
+        suite.addTestSuite(CacheVersionedEntryReplicatedAtomicOffHeapSelfTest.class);
+        suite.addTestSuite(CacheVersionedEntryPartitionedTransactionalOffHeapSelfTest.class);
+
         return suite;
     }
 }


[02/35] incubator-ignite git commit: ignite-946: introduced VersionedEntry, supported versioned entry for Cache.invoke/randomEntry/localEntries methods

Posted by ag...@apache.org.
ignite-946: introduced VersionedEntry, supported versioned entry for Cache.invoke/randomEntry/localEntries methods


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

Branch: refs/heads/ignite-264
Commit: 01c02465ff6924842644bf5b3447d324966cc5f9
Parents: 7ed4d15
Author: Denis Magda <dm...@gridgain.com>
Authored: Thu Jul 30 13:50:40 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Jul 31 15:49:10 2015 +0300

----------------------------------------------------------------------
 .../ignite/cache/version/VersionedEntry.java    |  73 +++++++++++++
 .../ignite/cache/version/package-info.java      |  21 ++++
 .../processors/cache/CacheEntryImpl.java        |  20 ++++
 .../processors/cache/CacheInvokeEntry.java      |  24 ++++-
 .../cache/CacheVersionedEntryImpl.java          |  80 ---------------
 .../processors/cache/GridCacheAdapter.java      |  13 ++-
 .../processors/cache/GridCacheMapEntry.java     |  42 +++++---
 .../distributed/dht/GridDhtTxPrepareFuture.java |   2 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   3 +-
 .../local/atomic/GridLocalAtomicCache.java      |   3 +-
 .../cache/transactions/IgniteTxAdapter.java     |   2 +-
 .../cache/transactions/IgniteTxEntry.java       |   3 +-
 .../transactions/IgniteTxLocalAdapter.java      |   3 +-
 .../cache/version/CacheVersionedEntryImpl.java  | 102 +++++++++++++++++++
 .../resources/META-INF/classnames.properties    |   2 +-
 15 files changed, 287 insertions(+), 106 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/01c02465/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java b/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
new file mode 100644
index 0000000..6f9d8f6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
@@ -0,0 +1,73 @@
+/*
+ * 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.cache.version;
+
+import javax.cache.*;
+import java.util.*;
+
+/**
+ * Cache entry along with version information.
+ */
+public interface VersionedEntry<K, V> extends Cache.Entry<K, V> {
+    /**
+     * Versions comparator.
+     */
+    public static final Comparator<VersionedEntry> VERSIONS_COMPARATOR = new Comparator<VersionedEntry>() {
+        @Override public int compare(VersionedEntry o1, VersionedEntry o2) {
+            int res = Integer.compare(o1.topologyVersion(), o2.topologyVersion());
+
+            if (res != 0)
+                return res;
+
+            res = Long.compare(o1.order(), o2.order());
+
+            if (res != 0)
+                return res;
+
+            return Integer.compare(o1.nodeOrder(), o2.nodeOrder());
+        }
+    };
+
+    /**
+     * Gets entry's topology version.
+     *
+     * @return Topology version plus number of seconds from the start time of the first grid node.
+     */
+    public int topologyVersion();
+
+    /**
+     * Gets entry's order.
+     *
+     * @return Version order.
+     */
+    public long order();
+
+    /**
+     * Gets entry's node order.
+     *
+     * @return Node order on which this version was assigned.
+     */
+    public int nodeOrder();
+
+    /**
+     * Gets entry's global time.
+     *
+     * @return Adjusted time.
+     */
+    public long globalTime();
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/01c02465/modules/core/src/main/java/org/apache/ignite/cache/version/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/version/package-info.java b/modules/core/src/main/java/org/apache/ignite/cache/version/package-info.java
new file mode 100644
index 0000000..9aeaba2
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/cache/version/package-info.java
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+
+/**
+ * Contains cache version based implementations.
+ */
+package org.apache.ignite.cache.version;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/01c02465/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl.java
index 3bd7ef4..98f3616 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl.java
@@ -17,6 +17,9 @@
 
 package org.apache.ignite.internal.processors.cache;
 
+import org.apache.ignite.cache.version.*;
+import org.apache.ignite.internal.processors.cache.version.*;
+
 import javax.cache.*;
 import java.io.*;
 
@@ -33,6 +36,9 @@ public class CacheEntryImpl<K, V> implements Cache.Entry<K, V>, Externalizable {
     /** */
     private V val;
 
+    /** Entry version. */
+    private GridCacheVersion ver;
+
     /**
      * Required by {@link Externalizable}.
      */
@@ -49,6 +55,17 @@ public class CacheEntryImpl<K, V> implements Cache.Entry<K, V>, Externalizable {
         this.val = val;
     }
 
+    /**
+     * @param key Key.
+     * @param val Value.
+     * @param ver Entry version.
+     */
+    public CacheEntryImpl(K key, V val, GridCacheVersion ver) {
+        this.key = key;
+        this.val = val;
+        this.ver = ver;
+    }
+
     /** {@inheritDoc} */
     @Override public K getKey() {
         return key;
@@ -65,6 +82,9 @@ public class CacheEntryImpl<K, V> implements Cache.Entry<K, V>, Externalizable {
         if(cls.isAssignableFrom(getClass()))
             return cls.cast(this);
 
+        if (ver != null && cls.isAssignableFrom(VersionedEntry.class))
+            return (T)new CacheVersionedEntryImpl<>(key, val, ver);
+
         throw new IllegalArgumentException("Unwrapping to class is not supported: " + cls);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/01c02465/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java
index 2817748..e6f8d4e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java
@@ -17,6 +17,8 @@
 
 package org.apache.ignite.internal.processors.cache;
 
+import org.apache.ignite.cache.version.*;
+import org.apache.ignite.internal.processors.cache.version.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.jetbrains.annotations.*;
 
@@ -35,17 +37,23 @@ public class CacheInvokeEntry<K, V> extends CacheLazyEntry<K, V> implements Muta
     /** */
     private V oldVal;
 
+    /** Entry version. */
+    private GridCacheVersion ver;
+
     /**
      * @param cctx Cache context.
      * @param keyObj Key cache object.
      * @param valObj Cache object value.
+     * @param ver Entry version.
      */
     public CacheInvokeEntry(GridCacheContext cctx,
         KeyCacheObject keyObj,
-        @Nullable CacheObject valObj) {
+        @Nullable CacheObject valObj,
+        GridCacheVersion ver) {
         super(cctx, keyObj, valObj);
 
         this.hadVal = valObj != null;
+        this.ver = ver;
     }
 
     /** 
@@ -54,15 +62,18 @@ public class CacheInvokeEntry<K, V> extends CacheLazyEntry<K, V> implements Muta
      * @param key Key value.
      * @param valObj Value cache object.
      * @param val Value.
+     * @param ver Entry version.
      */
     public CacheInvokeEntry(GridCacheContext<K, V> ctx,
         KeyCacheObject keyObj,
         @Nullable K key,
         @Nullable CacheObject valObj,
-        @Nullable V val) {
+        @Nullable V val,
+        GridCacheVersion ver) {
         super(ctx, keyObj, key, valObj, val);
 
         this.hadVal = valObj != null || val != null;
+        this.ver = ver;
     }
 
     /** {@inheritDoc} */
@@ -108,6 +119,15 @@ public class CacheInvokeEntry<K, V> extends CacheLazyEntry<K, V> implements Muta
     }
 
     /** {@inheritDoc} */
+    @SuppressWarnings("unchecked")
+    @Override public <T> T unwrap(Class<T> cls) {
+        if (cls.isAssignableFrom(VersionedEntry.class))
+            return (T)new CacheVersionedEntryImpl<>(getKey(), getValue(), ver);
+
+        return super.unwrap(cls);
+    }
+
+    /** {@inheritDoc} */
     @Override public String toString() {
         return S.toString(CacheInvokeEntry.class, this);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/01c02465/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheVersionedEntryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheVersionedEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheVersionedEntryImpl.java
deleted file mode 100644
index 59394f5..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheVersionedEntryImpl.java
+++ /dev/null
@@ -1,80 +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 org.jetbrains.annotations.*;
-
-import java.io.*;
-
-/**
- *
- */
-public class CacheVersionedEntryImpl<K, V> extends CacheEntryImpl<K, V> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Version. */
-    private Object ver;
-
-    /**
-     * Required by {@link Externalizable}.
-     */
-    public CacheVersionedEntryImpl() {
-        // No-op.
-    }
-
-    /**
-     * @param key Key.
-     * @param val Value (always null).
-     * @param ver Version.
-     */
-    public CacheVersionedEntryImpl(K key, V val, Object ver) {
-        super(key, val);
-
-        assert val == null;
-
-        this.ver = ver;
-    }
-
-    /**
-     * @return Version.
-     */
-    @Nullable public Object version() {
-        return ver;
-    }
-
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        super.writeExternal(out);
-
-        out.writeObject(ver);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        super.readExternal(in);
-
-        ver = in.readObject();
-    }
-
-    /** {@inheritDoc} */
-    public String toString() {
-        return "VersionedEntry [key=" + getKey() + ", val=" + getValue() + ", ver=" + ver + ']';
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/01c02465/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 94bcc93..d125382 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
@@ -3691,7 +3691,16 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
                     try {
                         V val = localPeek(lazyEntry.getKey(), CachePeekModes.ONHEAP_ONLY, expiryPlc);
 
-                        return new CacheEntryImpl<>(lazyEntry.getKey(), val);
+                        GridCacheVersion ver = null;
+
+                        try {
+                            ver = lazyEntry.unwrap(GridCacheVersion.class);
+                        }
+                        catch (IllegalArgumentException e) {
+                            log.error("Failed to unwrap entry version information", e);
+                        }
+
+                        return new CacheEntryImpl<>(lazyEntry.getKey(), val, ver);
                     }
                     catch (IgniteCheckedException e) {
                         throw CU.convertToCacheException(e);
@@ -4614,7 +4623,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
                 val0 = ctx.unwrapPortableIfNeeded(val0, true);
             }
 
-            return new CacheEntryImpl<>((K)key0, (V)val0);
+            return new CacheEntryImpl<>((K)key0, (V)val0, entry.version());
         }
         catch (GridCacheFilterFailedException ignore) {
             assert false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/01c02465/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 f85a18b..45ff619 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
@@ -609,16 +609,16 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
         @Nullable IgniteCacheExpiryPolicy expirePlc)
         throws IgniteCheckedException, GridCacheEntryRemovedException {
         return innerGet0(tx,
-            readSwap,
-            readThrough,
-            evt,
-            unmarshal,
-            updateMetrics,
-            tmp,
-            subjId,
-            transformClo,
-            taskName,
-            expirePlc);
+                         readSwap,
+                         readThrough,
+                         evt,
+                         unmarshal,
+                         updateMetrics,
+                         tmp,
+                         subjId,
+                         transformClo,
+                         taskName,
+                         expirePlc);
     }
 
     /** {@inheritDoc} */
@@ -1385,7 +1385,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
 
                 assert entryProcessor != null;
 
-                CacheInvokeEntry<Object, Object> entry = new CacheInvokeEntry<>(cctx, key, old);
+                CacheInvokeEntry<Object, Object> entry = new CacheInvokeEntry<>(cctx, key, old, this.ver);
 
                 try {
                     Object computed = entryProcessor.process(entry, invokeArgs);
@@ -1653,7 +1653,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
 
                         oldVal = rawGetOrUnmarshalUnlocked(true);
 
-                        CacheInvokeEntry<Object, Object> entry = new CacheInvokeEntry(cctx, key, oldVal);
+                        CacheInvokeEntry<Object, Object> entry = new CacheInvokeEntry(cctx, key, oldVal, this.ver);
 
                         try {
                             Object computed = entryProcessor.process(entry, invokeArgs);
@@ -1878,7 +1878,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
 
                 EntryProcessor<Object, Object, ?> entryProcessor = (EntryProcessor<Object, Object, ?>)writeObj;
 
-                CacheInvokeEntry<Object, Object> entry = new CacheInvokeEntry(cctx, key, oldVal);
+                CacheInvokeEntry<Object, Object> entry = new CacheInvokeEntry(cctx, key, oldVal, this.ver);
 
                 try {
                     Object computed = entryProcessor.process(entry, invokeArgs);
@@ -3531,7 +3531,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
                 val = rawGetOrUnmarshal(false);
 
             return new CacheEntryImpl<>(key.<K>value(cctx.cacheObjectContext(), false),
-                CU.<V>value(val, cctx, false));
+                CU.<V>value(val, cctx, false), ver);
         }
         catch (GridCacheFilterFailedException ignored) {
             throw new IgniteException("Should never happen.");
@@ -3593,6 +3593,15 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
         return new CacheVersionedEntryImpl<>(key.<K>value(cctx.cacheObjectContext(), false), null, ver);
     }
 
+    /**
+     * @return Entry which holds key, value and version.
+     */
+    private synchronized <K, V> CacheVersionedEntryImpl<K, V> wrapVersionedWithValue() {
+        V val = this.val == null ? null : this.val.<V>value(cctx.cacheObjectContext(), false);
+
+        return new CacheVersionedEntryImpl<>(key.<K>value(cctx.cacheObjectContext(), false), val, ver);
+    }
+
     /** {@inheritDoc} */
     @Override public boolean evictInternal(boolean swap, GridCacheVersion obsoleteVer,
         @Nullable CacheEntryPredicate[] filter) throws IgniteCheckedException {
@@ -4020,7 +4029,10 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
                 return (T)wrapEviction();
 
             if (cls.isAssignableFrom(CacheVersionedEntryImpl.class))
-                return (T)wrapVersioned();
+                return cls == CacheVersionedEntryImpl.class ? (T)wrapVersioned() : (T)wrapVersionedWithValue();
+
+            if (cls.isAssignableFrom(GridCacheVersion.class))
+                return (T)ver;
 
             if (cls.isAssignableFrom(GridCacheMapEntry.this.getClass()))
                 return (T)GridCacheMapEntry.this;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/01c02465/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index fbc8c84..9bd5de2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -324,7 +324,7 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
                              for (T2<EntryProcessor<Object, Object, Object>, Object[]> t : txEntry.entryProcessors()) {
                                 try {
                                     CacheInvokeEntry<Object, Object> invokeEntry =
-                                        new CacheInvokeEntry<>(txEntry.context(), key, val);
+                                        new CacheInvokeEntry<>(txEntry.context(), key, val, txEntry.cached().version());
 
                                     EntryProcessor<Object, Object, Object> processor = t.get1();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/01c02465/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index 0a21979..5dff4ea 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -1313,7 +1313,8 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
                     Object oldVal = null;
                     Object updatedVal = null;
 
-                    CacheInvokeEntry<Object, Object> invokeEntry = new CacheInvokeEntry(ctx, entry.key(), old);
+                    CacheInvokeEntry<Object, Object> invokeEntry = new CacheInvokeEntry(ctx, entry.key(), old,
+                        entry.version());
 
                     CacheObject updated;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/01c02465/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
index bcbdec4..8dd3276 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/atomic/GridLocalAtomicCache.java
@@ -1057,7 +1057,8 @@ public class GridLocalAtomicCache<K, V> extends GridCacheAdapter<K, V> {
 
                         Object oldVal = null;
 
-                        CacheInvokeEntry<Object, Object> invokeEntry = new CacheInvokeEntry<>(ctx, entry.key(), old);
+                        CacheInvokeEntry<Object, Object> invokeEntry = new CacheInvokeEntry<>(ctx, entry.key(), old,
+                            entry.version());
 
                         CacheObject updated;
                         Object updatedVal = null;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/01c02465/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index 7190249..0d14012 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -1230,7 +1230,7 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter
 
                 for (T2<EntryProcessor<Object, Object, Object>, Object[]> t : txEntry.entryProcessors()) {
                     CacheInvokeEntry<Object, Object> invokeEntry = new CacheInvokeEntry(txEntry.context(),
-                        txEntry.key(), key, cacheVal, val);
+                        txEntry.key(), key, cacheVal, val, txEntry.cached().version());
 
                     try {
                         EntryProcessor<Object, Object, Object> processor = t.get1();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/01c02465/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
index 247d350..7f06380 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
@@ -573,7 +573,8 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
 
         for (T2<EntryProcessor<Object, Object, Object>, Object[]> t : entryProcessors()) {
             try {
-                CacheInvokeEntry<Object, Object> invokeEntry = new CacheInvokeEntry(ctx, key, keyVal, cacheVal, val);
+                CacheInvokeEntry<Object, Object> invokeEntry = new CacheInvokeEntry(ctx, key, keyVal, cacheVal, val,
+                    entry.version());
 
                 EntryProcessor processor = t.get1();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/01c02465/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 0a61b1a..d8797fe 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -2522,7 +2522,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
 
             for (T2<EntryProcessor<Object, Object, Object>, Object[]> t : txEntry.entryProcessors()) {
                 CacheInvokeEntry<Object, Object> invokeEntry =
-                    new CacheInvokeEntry(txEntry.context(), txEntry.key(), key0, cacheVal, val0);
+                    new CacheInvokeEntry(txEntry.context(), txEntry.key(), key0, cacheVal, val0,
+                        txEntry.cached().version());
 
                 EntryProcessor<Object, Object, ?> entryProcessor = t.get1();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/01c02465/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
new file mode 100644
index 0000000..6d1e0c9
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
@@ -0,0 +1,102 @@
+/*
+ * 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.version;
+
+import org.apache.ignite.cache.version.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.jetbrains.annotations.*;
+
+import java.io.*;
+
+/**
+ *
+ */
+public class CacheVersionedEntryImpl<K, V> extends CacheEntryImpl<K, V> implements VersionedEntry<K, V> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Version. */
+    private GridCacheVersion ver;
+
+    /**
+     * Required by {@link Externalizable}.
+     */
+    public CacheVersionedEntryImpl() {
+        // No-op.
+    }
+
+    /**
+     * @param key Key.
+     * @param val Value (always null).
+     * @param ver Version.
+     */
+    public CacheVersionedEntryImpl(K key, V val, GridCacheVersion ver) {
+        super(key, val);
+
+        assert val == null;
+
+        this.ver = ver;
+    }
+
+    /**
+     * @return Version.
+     */
+    @Nullable public GridCacheVersion version() {
+        return ver;
+    }
+
+    /** {@inheritDoc} */
+    @Override public int topologyVersion() {
+        return ver.topologyVersion();
+    }
+
+    /** {@inheritDoc} */
+    @Override public int nodeOrder() {
+        return ver.nodeOrder();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long order() {
+        return ver.order();
+    }
+
+    /** {@inheritDoc} */
+    @Override public long globalTime() {
+        return ver.globalTime();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        super.writeExternal(out);
+
+        out.writeObject(ver);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        super.readExternal(in);
+
+        ver = (GridCacheVersion)in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    public String toString() {
+        return "VersionedEntry [key=" + getKey() + ", val=" + getValue() + ", topVer=" + ver.topologyVersion() +
+            ", nodeOrder=" + ver.nodeOrder() + ", order=" + ver.order() + ", globalTime=" + ver.globalTime() + ']';
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/01c02465/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index b3eed46..ff75b02 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -289,7 +289,7 @@ org.apache.ignite.internal.processors.cache.CacheOperationContext
 org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedException
 org.apache.ignite.internal.processors.cache.CacheStorePartialUpdateException
 org.apache.ignite.internal.processors.cache.CacheType
-org.apache.ignite.internal.processors.cache.CacheVersionedEntryImpl
+org.apache.ignite.internal.processors.cache.version.CacheVersionedEntryImpl
 org.apache.ignite.internal.processors.cache.CacheWeakQueryIteratorsHolder$WeakQueryFutureIterator
 org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch
 org.apache.ignite.internal.processors.cache.DynamicCacheChangeRequest


[29/35] incubator-ignite git commit: Merge remote-tracking branch 'origin/master'

Posted by ag...@apache.org.
Merge remote-tracking branch 'origin/master'


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

Branch: refs/heads/ignite-264
Commit: 6697b0c98c098a96ce572048b0c82cbfdfd41dca
Parents: 7290d06 35e3e4e
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Aug 13 18:10:25 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Aug 13 18:10:25 2015 +0300

----------------------------------------------------------------------
 .../continuous/GridContinuousProcessor.java     | 44 ++++++++++++++++----
 .../IgniteCacheContinuousQueryClientTest.java   | 33 ++++++++++++---
 .../IgniteCacheQuerySelfTestSuite.java          |  1 +
 scripts/git-format-patch.sh                     |  2 +-
 4 files changed, 66 insertions(+), 14 deletions(-)
----------------------------------------------------------------------



[09/35] incubator-ignite git commit: ignite-946: fixing version retrieval for transactions

Posted by ag...@apache.org.
ignite-946: fixing version retrieval for transactions


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

Branch: refs/heads/ignite-264
Commit: 2e7799d446653bba379cc231628ba2b02c993e5e
Parents: f0fe076
Author: Denis Magda <dm...@gridgain.com>
Authored: Fri Jul 31 15:32:45 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Jul 31 15:49:14 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/CacheInvokeEntry.java      |  2 +-
 .../processors/cache/GridCacheMapEntry.java     |  4 +-
 .../cache/transactions/IgniteTxAdapter.java     | 14 ++-
 .../cache/transactions/IgniteTxEntry.java       | 11 ++-
 .../transactions/IgniteTxLocalAdapter.java      | 90 ++++++++++++++++----
 5 files changed, 98 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e7799d4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java
index e6f8d4e..2d8f738 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java
@@ -121,7 +121,7 @@ public class CacheInvokeEntry<K, V> extends CacheLazyEntry<K, V> implements Muta
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public <T> T unwrap(Class<T> cls) {
-        if (cls.isAssignableFrom(VersionedEntry.class))
+        if (cls.isAssignableFrom(VersionedEntry.class) && ver != null)
             return (T)new CacheVersionedEntryImpl<>(getKey(), getValue(), ver);
 
         return super.unwrap(cls);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e7799d4/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 ebcb908..43cf2fe 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
@@ -1653,7 +1653,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
 
                         oldVal = rawGetOrUnmarshalUnlocked(true);
 
-                        CacheInvokeEntry<Object, Object> entry = new CacheInvokeEntry(cctx, key, oldVal, this.ver);
+                        CacheInvokeEntry<Object, Object> entry = new CacheInvokeEntry(cctx, key, oldVal, version());
 
                         try {
                             Object computed = entryProcessor.process(entry, invokeArgs);
@@ -1878,7 +1878,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
 
                 EntryProcessor<Object, Object, ?> entryProcessor = (EntryProcessor<Object, Object, ?>)writeObj;
 
-                CacheInvokeEntry<Object, Object> entry = new CacheInvokeEntry(cctx, key, oldVal, this.ver);
+                CacheInvokeEntry<Object, Object> entry = new CacheInvokeEntry(cctx, key, oldVal, version());
 
                 try {
                     Object computed = entryProcessor.process(entry, invokeArgs);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e7799d4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index 0d14012..797f75e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -1228,9 +1228,21 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter
 
                 Object key = null;
 
+                GridCacheVersion ver;
+
+                try {
+                    ver = txEntry.cached().version();
+                }
+                catch (GridCacheEntryRemovedException e) {
+                    if (log.isDebugEnabled())
+                        log.debug("Failed to get entry version: [msg=" + e.getMessage() + ']');
+
+                    ver = null;
+                }
+
                 for (T2<EntryProcessor<Object, Object, Object>, Object[]> t : txEntry.entryProcessors()) {
                     CacheInvokeEntry<Object, Object> invokeEntry = new CacheInvokeEntry(txEntry.context(),
-                        txEntry.key(), key, cacheVal, val, txEntry.cached().version());
+                        txEntry.key(), key, cacheVal, val, ver);
 
                     try {
                         EntryProcessor<Object, Object, Object> processor = t.get1();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e7799d4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
index 7f06380..ed57bf2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
@@ -571,10 +571,19 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
         Object val = null;
         Object keyVal = null;
 
+        GridCacheVersion ver;
+
+        try {
+            ver = entry.version();
+        }
+        catch (GridCacheEntryRemovedException e) {
+            ver = null;
+        }
+
         for (T2<EntryProcessor<Object, Object, Object>, Object[]> t : entryProcessors()) {
             try {
                 CacheInvokeEntry<Object, Object> invokeEntry = new CacheInvokeEntry(ctx, key, keyVal, cacheVal, val,
-                    entry.version());
+                    ver);
 
                 EntryProcessor processor = t.get1();
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2e7799d4/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index d8797fe..7f171c2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -1938,13 +1938,13 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
         Map<KeyCacheObject, GridCacheDrInfo> drMap
     ) {
         return this.<Object, Object>putAllAsync0(cacheCtx,
-            null,
-            null,
-            null,
-            drMap,
-            false,
-            null,
-            null);
+                                                 null,
+                                                 null,
+                                                 null,
+                                                 drMap,
+                                                 false,
+                                                 null,
+                                                 null);
     }
 
     /** {@inheritDoc} */
@@ -2229,8 +2229,22 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                                     if (retval && !transform)
                                         ret.set(cacheCtx, old, true);
                                     else {
-                                        if (txEntry.op() == TRANSFORM)
-                                            addInvokeResult(txEntry, old, ret);
+                                        if (txEntry.op() == TRANSFORM) {
+                                            GridCacheVersion ver;
+
+                                            try {
+                                                ver = entry.version();
+                                            }
+                                            catch (GridCacheEntryRemovedException ex) {
+                                                if (log.isDebugEnabled())
+                                                    log.debug("Failed to get entry version: [msg=" +
+                                                        ex.getMessage() + ']');
+
+                                                ver = null;
+                                            }
+
+                                            addInvokeResult(txEntry, old, ret, ver);
+                                        }
                                         else
                                             ret.success(true);
                                     }
@@ -2290,8 +2304,21 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
 
                         enlisted.add(cacheKey);
 
-                        if (txEntry.op() == TRANSFORM)
-                            addInvokeResult(txEntry, txEntry.value(), ret);
+                        if (txEntry.op() == TRANSFORM) {
+                            GridCacheVersion ver;
+
+                            try {
+                                ver = entry.version();
+                            }
+                            catch (GridCacheEntryRemovedException e) {
+                                if (log.isDebugEnabled())
+                                    log.debug("Failed to get entry version: [msg=" + e.getMessage() + ']');
+
+                                ver = null;
+                            }
+
+                            addInvokeResult(txEntry, txEntry.value(), ret, ver);
+                        }
                     }
 
                     if (!pessimistic()) {
@@ -2328,8 +2355,21 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
 
                         CacheObject cacheVal = cacheCtx.toCacheObject(val);
 
-                        if (e.op() == TRANSFORM)
-                            addInvokeResult(e, cacheVal, ret);
+                        if (e.op() == TRANSFORM) {
+                            GridCacheVersion ver;
+
+                            try {
+                                ver = e.cached().version();
+                            }
+                            catch (GridCacheEntryRemovedException ex) {
+                                if (log.isDebugEnabled())
+                                    log.debug("Failed to get entry version: [msg=" + ex.getMessage() + ']');
+
+                                ver = null;
+                            }
+
+                            addInvokeResult(e, cacheVal, ret, ver);
+                        }
                         else
                             ret.set(cacheCtx, cacheVal, true);
                     }
@@ -2442,8 +2482,21 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                         }
 
                         if (txEntry.op() == TRANSFORM) {
-                            if (computeInvoke)
-                                addInvokeResult(txEntry, v, ret);
+                            if (computeInvoke) {
+                                GridCacheVersion ver;
+
+                                try {
+                                    ver = cached.version();
+                                }
+                                catch (GridCacheEntryRemovedException e) {
+                                    if (log.isDebugEnabled())
+                                        log.debug("Failed to get entry version: [msg=" + e.getMessage() + ']');
+
+                                    ver = null;
+                                }
+
+                                addInvokeResult(txEntry, v, ret, ver);
+                            }
                         }
                         else
                             ret.value(cacheCtx, v);
@@ -2510,8 +2563,10 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
      * @param txEntry Entry.
      * @param cacheVal Value.
      * @param ret Return value to update.
+     * @param ver Entry version.
      */
-    private void addInvokeResult(IgniteTxEntry txEntry, CacheObject cacheVal, GridCacheReturn ret) {
+    private void addInvokeResult(IgniteTxEntry txEntry, CacheObject cacheVal, GridCacheReturn ret,
+        GridCacheVersion ver) {
         GridCacheContext ctx = txEntry.context();
 
         Object key0 = null;
@@ -2522,8 +2577,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
 
             for (T2<EntryProcessor<Object, Object, Object>, Object[]> t : txEntry.entryProcessors()) {
                 CacheInvokeEntry<Object, Object> invokeEntry =
-                    new CacheInvokeEntry(txEntry.context(), txEntry.key(), key0, cacheVal, val0,
-                        txEntry.cached().version());
+                    new CacheInvokeEntry(txEntry.context(), txEntry.key(), key0, cacheVal, val0, ver);
 
                 EntryProcessor<Object, Object, ?> entryProcessor = t.get1();
 


[32/35] incubator-ignite git commit: Fixed threads cleanup in continuous processor

Posted by ag...@apache.org.
Fixed threads cleanup in continuous processor


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

Branch: refs/heads/ignite-264
Commit: 8ecddcc2dcb064b759486d43a4f09173f268b3cf
Parents: 260238e
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Thu Aug 13 16:25:09 2015 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Thu Aug 13 16:25:09 2015 -0700

----------------------------------------------------------------------
 .../internal/processors/continuous/GridEventConsumeSelfTest.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8ecddcc2/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
index 5ce2efd..7ab858b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/continuous/GridEventConsumeSelfTest.java
@@ -26,7 +26,6 @@ import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
-import org.apache.ignite.marshaller.optimized.*;
 import org.apache.ignite.resources.*;
 import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
@@ -125,6 +124,7 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
                 assertEquals(0, U.<Map>field(proc, "rmtInfos").size());
                 assertEquals(0, U.<Map>field(proc, "startFuts").size());
                 assertEquals(0, U.<Map>field(proc, "stopFuts").size());
+                assertEquals(0, U.<Map>field(proc, "bufCheckThreads").size());
             }
         }
         finally {
@@ -754,7 +754,7 @@ public class GridEventConsumeSelfTest extends GridCommonAbstractTest {
      */
     public void testNodeJoinWithP2P() throws Exception {
         fail("https://issues.apache.org/jira/browse/IGNITE-585");
-        
+
         final Collection<UUID> nodeIds = new HashSet<>();
         final AtomicInteger cnt = new AtomicInteger();
         final CountDownLatch latch = new CountDownLatch(GRID_CNT + 1);


[21/35] incubator-ignite git commit: # ignite-1229: stop ping process when node left topology

Posted by ag...@apache.org.
# ignite-1229: stop ping process when node left topology


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

Branch: refs/heads/ignite-264
Commit: d5986c265c9f68c2a98c48d4ba75444fad9e6725
Parents: ae11e9b
Author: sboikov <sb...@gridgain.com>
Authored: Wed Aug 12 11:42:22 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Aug 12 11:42:22 2015 +0300

----------------------------------------------------------------------
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 91 +++++++++++++-------
 1 file changed, 60 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d5986c26/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
index 92c21ed..76144e3 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java
@@ -388,12 +388,15 @@ class ServerImpl extends TcpDiscoveryImpl {
 
         TcpDiscoveryNode node = ring.node(nodeId);
 
-        if (node == null || !node.visible())
+        if (node == null)
+            return false;
+
+        if (!nodeAlive(nodeId))
             return false;
 
         boolean res = pingNode(node);
 
-        if (!res && !node.isClient()) {
+        if (!res && !node.isClient() && nodeAlive(nodeId)) {
             LT.warn(log, null, "Failed to ping node (status check will be initiated): " + nodeId);
 
             msgWorker.addMessage(new TcpDiscoveryStatusCheckMessage(locNode, node.id()));
@@ -421,14 +424,18 @@ class ServerImpl extends TcpDiscoveryImpl {
 
             node = ring.node(node.clientRouterNodeId());
 
-            if (node == null || !node.visible())
+            if (node == null || !nodeAlive(node.id()))
                 return false;
         }
 
         for (InetSocketAddress addr : spi.getNodeAddresses(node, U.sameMacs(locNode, node))) {
             try {
                 // ID returned by the node should be the same as ID of the parameter for ping to succeed.
-                IgniteBiTuple<UUID, Boolean> t = pingNode(addr, clientNodeId);
+                IgniteBiTuple<UUID, Boolean> t = pingNode(addr, node.id(), clientNodeId);
+
+                if (t == null)
+                    // Remote node left topology.
+                    return false;
 
                 boolean res = node.id().equals(t.get1()) && (clientNodeId == null || t.get2());
 
@@ -453,12 +460,14 @@ class ServerImpl extends TcpDiscoveryImpl {
      * Pings the node by its address to see if it's alive.
      *
      * @param addr Address of the node.
+     * @param nodeId Node ID to ping. In case when client node ID is not null this node ID is an ID of the router node.
      * @param clientNodeId Client node ID.
-     * @return ID of the remote node and "client exists" flag if node alive.
+     * @return ID of the remote node and "client exists" flag if node alive or {@code null} if the remote node has
+     *         left a topology during the ping process.
      * @throws IgniteCheckedException If an error occurs.
      */
-    private IgniteBiTuple<UUID, Boolean> pingNode(InetSocketAddress addr, @Nullable UUID clientNodeId)
-        throws IgniteCheckedException {
+    private @Nullable IgniteBiTuple<UUID, Boolean> pingNode(InetSocketAddress addr, @Nullable UUID nodeId,
+        @Nullable UUID clientNodeId) throws IgniteCheckedException {
         assert addr != null;
 
         UUID locNodeId = getLocalNodeId();
@@ -537,6 +546,16 @@ class ServerImpl extends TcpDiscoveryImpl {
                         return t;
                     }
                     catch (IOException | IgniteCheckedException e) {
+                        if (nodeId != null && !nodeAlive(nodeId)) {
+                            if (log.isDebugEnabled())
+                                log.debug("Failed to ping the node (has left or leaving topology): [nodeId=" + nodeId +
+                                    ']');
+
+                            fut.onDone((IgniteBiTuple<UUID, Boolean>)null);
+
+                            return null;
+                        }
+
                         if (errs == null)
                             errs = new ArrayList<>();
 
@@ -615,6 +634,28 @@ class ServerImpl extends TcpDiscoveryImpl {
     }
 
     /**
+     * Checks whether a node is alive or not.
+     *
+     * @param nodeId Node ID.
+     * @return {@code True} if node is in the ring and is not being removed from.
+     */
+    private boolean nodeAlive(UUID nodeId) {
+        // Is node alive or about to be removed from the ring?
+        TcpDiscoveryNode node = ring.node(nodeId);
+
+        boolean nodeAlive = node != null && node.visible();
+
+        if (nodeAlive) {
+            synchronized (mux) {
+                nodeAlive = !F.transform(failedNodes, F.node2id()).contains(nodeId) &&
+                    !F.transform(leavingNodes, F.node2id()).contains(nodeId);
+            }
+        }
+
+        return nodeAlive;
+    }
+
+    /**
      * Tries to join this node to topology.
      *
      * @throws IgniteSpiException If any error occurs.
@@ -1520,7 +1561,7 @@ class ServerImpl extends TcpDiscoveryImpl {
 
                         if (res == null) {
                             try {
-                                res = pingNode(addr, null).get1() != null;
+                                res = pingNode(addr, null, null).get1() != null;
                             }
                             catch (IgniteCheckedException e) {
                                 if (log.isDebugEnabled())
@@ -3775,9 +3816,17 @@ class ServerImpl extends TcpDiscoveryImpl {
                             else {
                                 int aliveCheck = clientNode.decrementAliveCheck();
 
-                                if (aliveCheck <= 0 && isLocalNodeCoordinator() && !failedNodes.contains(clientNode))
-                                    processNodeFailedMessage(new TcpDiscoveryNodeFailedMessage(locNodeId,
-                                        clientNode.id(), clientNode.internalOrder()));
+                                if (aliveCheck <= 0 && isLocalNodeCoordinator()) {
+                                    boolean failedNode;
+
+                                    synchronized (mux) {
+                                        failedNode = failedNodes.contains(clientNode);
+                                    }
+
+                                    if (!failedNode)
+                                        processNodeFailedMessage(new TcpDiscoveryNodeFailedMessage(locNodeId,
+                                            clientNode.id(), clientNode.internalOrder()));
+                                }
                             }
                         }
                     }
@@ -4689,26 +4738,6 @@ class ServerImpl extends TcpDiscoveryImpl {
         }
 
         /**
-         * @param nodeId Node ID.
-         * @return {@code True} if node is in the ring and is not being removed from.
-         */
-        private boolean nodeAlive(UUID nodeId) {
-            // Is node alive or about to be removed from the ring?
-            TcpDiscoveryNode node = ring.node(nodeId);
-
-            boolean nodeAlive = node != null && node.visible();
-
-            if (nodeAlive) {
-                synchronized (mux) {
-                    nodeAlive = !F.transform(failedNodes, F.node2id()).contains(nodeId) &&
-                        !F.transform(leavingNodes, F.node2id()).contains(nodeId);
-                }
-            }
-
-            return nodeAlive;
-        }
-
-        /**
          * @param msg Join request message.
          * @param clientMsgWrk Client message worker to start.
          * @return Whether connection was successful.


[24/35] incubator-ignite git commit: ignite-946: renamed VersionedEntry to CacheEntry

Posted by ag...@apache.org.
ignite-946: renamed VersionedEntry to CacheEntry


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

Branch: refs/heads/ignite-264
Commit: 4f8f32af80d2c13df3fd8d3c5b302c0fd04906c5
Parents: 954c459
Author: Denis Magda <dm...@gridgain.com>
Authored: Thu Aug 13 09:10:45 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Thu Aug 13 09:10:45 2015 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/cache/CacheEntry.java     | 94 ++++++++++++++++++++
 .../ignite/cache/version/VersionedEntry.java    | 92 -------------------
 .../ignite/cache/version/package-info.java      | 21 -----
 .../processors/cache/CacheEntryImpl.java        |  6 +-
 .../processors/cache/CacheEntryImpl0.java       |  6 +-
 .../processors/cache/CacheEntryImplEx.java      | 83 +++++++++++++++++
 .../processors/cache/CacheInvokeEntry.java      |  6 +-
 .../processors/cache/GridCacheEntryEx.java      |  2 +-
 .../processors/cache/GridCacheMapEntry.java     | 12 +--
 .../cache/version/CacheVersionedEntryImpl.java  | 83 -----------------
 .../resources/META-INF/classnames.properties    |  3 +-
 .../processors/cache/GridCacheTestEntryEx.java  |  2 +-
 .../CacheVersionedEntryAbstractTest.java        | 27 +++---
 13 files changed, 209 insertions(+), 228 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java b/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java
new file mode 100644
index 0000000..a6a2aa3
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/cache/CacheEntry.java
@@ -0,0 +1,94 @@
+/*
+ * 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.cache;
+
+import org.apache.ignite.*;
+
+import javax.cache.*;
+import javax.cache.processor.*;
+import java.util.*;
+
+/**
+ * Cache entry that extends {@link javax.cache.Cache.Entry} by providing additional entry related information.
+ *
+ * To get an instance of {@code CacheEntry} use {@link javax.cache.Cache.Entry#unwrap(Class)} method by passing
+ * {@code CacheEntry} class to it as the argument.
+ * <p>
+ * {@code CacheEntry} is supported only for {@link javax.cache.Cache.Entry} returned by one of the following methods:
+ * <ul>
+ * <li>{@link javax.cache.Cache#invoke(Object, EntryProcessor, Object...)}</li>
+ * <li>{@link javax.cache.Cache#invokeAll(Set, EntryProcessor, Object...)}</li>
+ * <li>invoke and invokeAll methods of {@link IgniteCache}</li>
+ * <li>{@link IgniteCache#randomEntry()}</li>
+ * </ul>
+ * <p>
+ * {@code CacheEntry} is not supported for {@link javax.cache.Cache#iterator()} because of performance reasons.
+ * {@link javax.cache.Cache#iterator()} loads entries from all the cluster nodes and to speed up the load additional
+ * information, like entry's version, is ignored.
+ *
+ * <h2 class="header">Java Example</h2>
+ * <pre name="code" class="java">
+ * IgniteCache<Integer, String> cache = grid(0).cache(null);
+ *
+ * CacheEntry<String, Integer> entry1 = cache.invoke(100,
+ *     new EntryProcessor<Integer, String, CacheEntry<String, Integer>>() {
+ *          public CacheEntry<String, Integer> process(MutableEntry<Integer, String> entry,
+ *              Object... arguments) throws EntryProcessorException {
+ *                  return entry.unwrap(CacheEntry.class);
+ *          }
+ *     });
+ *
+ * // Cache entry for the given key may be updated at some point later.
+ *
+ * CacheEntry<String, Integer> entry2 = cache.invoke(100,
+ *     new EntryProcessor<Integer, String, CacheEntry<String, Integer>>() {
+ *          public CacheEntry<String, Integer> process(MutableEntry<Integer, String> entry,
+ *              Object... arguments) throws EntryProcessorException {
+ *                  return entry.unwrap(CacheEntry.class);
+ *          }
+ *     });
+ *
+ * // Comparing entries' versions.
+ * if (entry1.version().compareTo(entry2.version()) < 0) {
+ *     // the entry has been updated
+ * }
+ * </pre>
+ */
+public interface CacheEntry<K, V> extends Cache.Entry<K, V> {
+    /**
+     * Returns a comparable object representing the version of this cache entry.
+     * <p>
+     * It is valid to compare cache entries' versions for the same key. In this case the latter update will be
+     * represented by a higher version. The result of versions comparison of cache entries of different keys is
+     * undefined.
+     *
+     * @return Version of this cache entry.
+     */
+    public Comparable version();
+
+    /**
+     * Returns the time when the cache entry for the given key has been updated or initially created.
+     * <p>
+     * It is valid to compare cache entries' update time for the same key. In this case the latter update will
+     * be represented by higher update time. The result of update time comparison of cache entries of different keys is
+     * undefined.
+     *
+     * @return Time in milliseconds.
+     */
+    public long updateTime();
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java b/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
deleted file mode 100644
index 135d681..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
+++ /dev/null
@@ -1,92 +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.cache.version;
-
-import org.apache.ignite.*;
-
-import javax.cache.*;
-import javax.cache.processor.*;
-import java.util.*;
-
-/**
- * Cache entry that stores entry's version related information along with its data.
- *
- * To get a {@code VersionedEntry} of an {@link Cache.Entry} use {@link Cache.Entry#unwrap(Class)} by passing
- * {@code VersionedEntry} class to it as the argument.
- * <p>
- * {@code VersionedEntry} is supported only for {@link Cache.Entry} returned by one of the following methods:
- * <ul>
- * <li>{@link Cache#invoke(Object, EntryProcessor, Object...)}</li>
- * <li>{@link Cache#invokeAll(Set, EntryProcessor, Object...)}</li>
- * <li>invoke and invokeAll methods of {@link IgniteCache}</li>
- * <li>{@link IgniteCache#randomEntry()}</li>
- * </ul>
- * <p>
- * {@code VersionedEntry} is not supported for {@link Cache#iterator()} because of performance reasons.
- * {@link Cache#iterator()} loads entries from all the cluster nodes and to speed up the load version information
- * is excluded from responses.
- * <h2 class="header">Java Example</h2>
- * <pre name="code" class="java">
- * IgniteCache<Integer, String> cache = grid(0).cache(null);
- *
- * VersionedEntry<String, Integer> entry1 = cache.invoke(100,
- *     new EntryProcessor<Integer, String, VersionedEntry<String, Integer>>() {
- *          public VersionedEntry<String, Integer> process(MutableEntry<Integer, String> entry,
- *              Object... arguments) throws EntryProcessorException {
- *                  return entry.unwrap(VersionedEntry.class);
- *          }
- *     });
- *
- * // Cache entry for the given key may be updated at some point later.
- *
- * VersionedEntry<String, Integer> entry2 = cache.invoke(100,
- *     new EntryProcessor<Integer, String, VersionedEntry<String, Integer>>() {
- *          public VersionedEntry<String, Integer> process(MutableEntry<Integer, String> entry,
- *              Object... arguments) throws EntryProcessorException {
- *                  return entry.unwrap(VersionedEntry.class);
- *          }
- *     });
- *
- * if (entry1.version().compareTo(entry2.version()) < 0) {
- *     // the entry has been updated
- * }
- * </pre>
- */
-public interface VersionedEntry<K, V> extends Cache.Entry<K, V> {
-    /**
-     * Returns a comparable object representing the version of this cache entry.
-     * <p>
-     * It is valid to compare cache entries' versions for the same key. In this case the latter update will be
-     * represented by a higher version. The result of versions comparison of cache entries of different keys is
-     * undefined.
-     *
-     * @return Version of this cache entry.
-     */
-    public Comparable version();
-
-    /**
-     * Returns the time when the cache entry for the given key has been updated or initially created.
-     * <p>
-     * It is valid to compare cache entries' update time for the same key. In this case the latter update will
-     * be represented by higher update time. The result of update time comparison of cache entries of different keys is
-     * undefined.
-     *
-     * @return Time in milliseconds.
-     */
-    public long updateTime();
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/main/java/org/apache/ignite/cache/version/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/version/package-info.java b/modules/core/src/main/java/org/apache/ignite/cache/version/package-info.java
deleted file mode 100644
index 50ceb13..0000000
--- a/modules/core/src/main/java/org/apache/ignite/cache/version/package-info.java
+++ /dev/null
@@ -1,21 +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.
- */
-
-/**
- * Contains cache versioned entry interface.
- */
-package org.apache.ignite.cache.version;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl.java
index 98f3616..3ef2889 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl.java
@@ -17,7 +17,7 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import org.apache.ignite.cache.version.*;
+import org.apache.ignite.cache.*;
 import org.apache.ignite.internal.processors.cache.version.*;
 
 import javax.cache.*;
@@ -82,8 +82,8 @@ public class CacheEntryImpl<K, V> implements Cache.Entry<K, V>, Externalizable {
         if(cls.isAssignableFrom(getClass()))
             return cls.cast(this);
 
-        if (ver != null && cls.isAssignableFrom(VersionedEntry.class))
-            return (T)new CacheVersionedEntryImpl<>(key, val, ver);
+        if (ver != null && cls.isAssignableFrom(CacheEntry.class))
+            return (T)new CacheEntryImplEx<>(key, val, ver);
 
         throw new IllegalArgumentException("Unwrapping to class is not supported: " + cls);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl0.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl0.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl0.java
index 987fbd3..eabd2af 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl0.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl0.java
@@ -17,7 +17,7 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import org.apache.ignite.cache.version.*;
+import org.apache.ignite.cache.*;
 import org.apache.ignite.internal.processors.cache.version.*;
 
 import javax.cache.*;
@@ -52,8 +52,8 @@ public class CacheEntryImpl0<K, V> implements Cache.Entry<K, V> {
     @Override public <T> T unwrap(Class<T> cls) {
         if(cls.isAssignableFrom(getClass()))
             return cls.cast(this);
-        else if (cls.isAssignableFrom(VersionedEntry.class) && e instanceof GridCacheVersionAware)
-            return (T)new CacheVersionedEntryImpl<>(e.getKey(), e.getValue(), ((GridCacheVersionAware)e).version());
+        else if (cls.isAssignableFrom(CacheEntry.class) && e instanceof GridCacheVersionAware)
+            return (T)new CacheEntryImplEx<>(e.getKey(), e.getValue(), ((GridCacheVersionAware)e).version());
 
         throw new IllegalArgumentException("Unwrapping to class is not supported: " + cls);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java
new file mode 100644
index 0000000..f674ba5
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImplEx.java
@@ -0,0 +1,83 @@
+/*
+ * 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.cache.*;
+import org.apache.ignite.internal.processors.cache.*;
+import org.apache.ignite.internal.processors.cache.version.*;
+
+import java.io.*;
+
+/**
+ *
+ */
+public class CacheEntryImplEx<K, V> extends CacheEntryImpl<K, V> implements CacheEntry<K, V> {
+    /** */
+    private static final long serialVersionUID = 0L;
+
+    /** Version. */
+    private GridCacheVersion ver;
+
+    /**
+     * Required by {@link Externalizable}.
+     */
+    public CacheEntryImplEx() {
+        // No-op.
+    }
+
+    /**
+     * @param key Key.
+     * @param val Value (always null).
+     * @param ver Version.
+     */
+    public CacheEntryImplEx(K key, V val, GridCacheVersion ver) {
+        super(key, val);
+
+        this.ver = ver;
+    }
+
+    /** {@inheritDoc} */
+    public GridCacheVersion version() {
+        return ver;
+    }
+
+    /** {@inheritDoc} */
+    @Override public long updateTime() {
+        return ver.globalTime();
+    }
+
+    /** {@inheritDoc} */
+    @Override public void writeExternal(ObjectOutput out) throws IOException {
+        super.writeExternal(out);
+
+        out.writeObject(ver);
+    }
+
+    /** {@inheritDoc} */
+    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        super.readExternal(in);
+
+        ver = (GridCacheVersion)in.readObject();
+    }
+
+    /** {@inheritDoc} */
+    public String toString() {
+        return "VersionedEntry [key=" + getKey() + ", val=" + getValue() + ", topVer=" + ver.topologyVersion() +
+            ", nodeOrder=" + ver.nodeOrder() + ", order=" + ver.order() + ", updateTime=" + ver.globalTime() + ']';
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java
index 515a4c5..711b598 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java
@@ -17,7 +17,7 @@
 
 package org.apache.ignite.internal.processors.cache;
 
-import org.apache.ignite.cache.version.*;
+import org.apache.ignite.cache.*;
 import org.apache.ignite.internal.processors.cache.version.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.jetbrains.annotations.*;
@@ -122,8 +122,8 @@ public class CacheInvokeEntry<K, V> extends CacheLazyEntry<K, V> implements Muta
     /** {@inheritDoc} */
     @SuppressWarnings("unchecked")
     @Override public <T> T unwrap(Class<T> cls) {
-        if (cls.isAssignableFrom(VersionedEntry.class) && ver != null)
-            return (T)new CacheVersionedEntryImpl<>(getKey(), getValue(), ver);
+        if (cls.isAssignableFrom(CacheEntry.class) && ver != null)
+            return (T)new CacheEntryImplEx<>(getKey(), getValue(), ver);
 
         return super.unwrap(cls);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
index c2d0271..1b5a717 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
@@ -163,7 +163,7 @@ public interface GridCacheEntryEx {
      * @return Entry which holds key and version (no value, since entry
      *      is intended to be used in sync evictions checks).
      */
-    public <K, V> CacheVersionedEntryImpl<K, V> wrapVersioned();
+    public <K, V> CacheEntryImplEx<K, V> wrapVersioned();
 
     /**
      * @return Not-null version if entry is obsolete.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/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 298f7a6..17cc8dd 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
@@ -3589,17 +3589,17 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
     }
 
     /** {@inheritDoc} */
-    @Override public synchronized <K, V> CacheVersionedEntryImpl<K, V> wrapVersioned() {
-        return new CacheVersionedEntryImpl<>(key.<K>value(cctx.cacheObjectContext(), false), null, ver);
+    @Override public synchronized <K, V> CacheEntryImplEx<K, V> wrapVersioned() {
+        return new CacheEntryImplEx<>(key.<K>value(cctx.cacheObjectContext(), false), null, ver);
     }
 
     /**
      * @return Entry which holds key, value and version.
      */
-    private synchronized <K, V> CacheVersionedEntryImpl<K, V> wrapVersionedWithValue() {
+    private synchronized <K, V> CacheEntryImplEx<K, V> wrapVersionedWithValue() {
         V val = this.val == null ? null : this.val.<V>value(cctx.cacheObjectContext(), false);
 
-        return new CacheVersionedEntryImpl<>(key.<K>value(cctx.cacheObjectContext(), false), val, ver);
+        return new CacheEntryImplEx<>(key.<K>value(cctx.cacheObjectContext(), false), val, ver);
     }
 
     /** {@inheritDoc} */
@@ -4028,8 +4028,8 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
             if (cls.isAssignableFrom(EvictableEntry.class))
                 return (T)wrapEviction();
 
-            if (cls.isAssignableFrom(CacheVersionedEntryImpl.class))
-                return cls == CacheVersionedEntryImpl.class ? (T)wrapVersioned() : (T)wrapVersionedWithValue();
+            if (cls.isAssignableFrom(CacheEntryImplEx.class))
+                return cls == CacheEntryImplEx.class ? (T)wrapVersioned() : (T)wrapVersionedWithValue();
 
             if (cls.isAssignableFrom(GridCacheVersion.class))
                 return (T)ver;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
deleted file mode 100644
index c036bc1..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
+++ /dev/null
@@ -1,83 +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.version;
-
-import org.apache.ignite.cache.version.*;
-import org.apache.ignite.internal.processors.cache.*;
-import org.jetbrains.annotations.*;
-
-import java.io.*;
-
-/**
- *
- */
-public class CacheVersionedEntryImpl<K, V> extends CacheEntryImpl<K, V> implements VersionedEntry<K, V> {
-    /** */
-    private static final long serialVersionUID = 0L;
-
-    /** Version. */
-    private GridCacheVersion ver;
-
-    /**
-     * Required by {@link Externalizable}.
-     */
-    public CacheVersionedEntryImpl() {
-        // No-op.
-    }
-
-    /**
-     * @param key Key.
-     * @param val Value (always null).
-     * @param ver Version.
-     */
-    public CacheVersionedEntryImpl(K key, V val, GridCacheVersion ver) {
-        super(key, val);
-
-        this.ver = ver;
-    }
-
-    /** {@inheritDoc} */
-    public GridCacheVersion version() {
-        return ver;
-    }
-
-    /** {@inheritDoc} */
-    @Override public long updateTime() {
-        return ver.globalTime();
-    }
-
-    /** {@inheritDoc} */
-    @Override public void writeExternal(ObjectOutput out) throws IOException {
-        super.writeExternal(out);
-
-        out.writeObject(ver);
-    }
-
-    /** {@inheritDoc} */
-    @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
-        super.readExternal(in);
-
-        ver = (GridCacheVersion)in.readObject();
-    }
-
-    /** {@inheritDoc} */
-    public String toString() {
-        return "VersionedEntry [key=" + getKey() + ", val=" + getValue() + ", topVer=" + ver.topologyVersion() +
-            ", nodeOrder=" + ver.nodeOrder() + ", order=" + ver.order() + ", updateTime=" + ver.globalTime() + ']';
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index ff75b02..1fb9a37 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -35,6 +35,7 @@ org.apache.ignite.cache.CacheMode
 org.apache.ignite.cache.CachePartialUpdateException
 org.apache.ignite.cache.CachePeekMode
 org.apache.ignite.cache.CacheRebalanceMode
+org.apache.ignite.cache.CacheEntry
 org.apache.ignite.cache.CacheServerNotFoundException
 org.apache.ignite.cache.CacheTypeFieldMetadata
 org.apache.ignite.cache.CacheTypeMetadata
@@ -289,7 +290,7 @@ org.apache.ignite.internal.processors.cache.CacheOperationContext
 org.apache.ignite.internal.processors.cache.CachePartialUpdateCheckedException
 org.apache.ignite.internal.processors.cache.CacheStorePartialUpdateException
 org.apache.ignite.internal.processors.cache.CacheType
-org.apache.ignite.internal.processors.cache.version.CacheVersionedEntryImpl
+org.apache.ignite.internal.processors.cache.CacheEntryImplEx
 org.apache.ignite.internal.processors.cache.CacheWeakQueryIteratorsHolder$WeakQueryFutureIterator
 org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch
 org.apache.ignite.internal.processors.cache.DynamicCacheChangeRequest

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
index eaa6e13..0055557 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
@@ -350,7 +350,7 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
     }
 
     /** {@inheritDoc} */
-    @Override public CacheVersionedEntryImpl wrapVersioned() {
+    @Override public CacheEntryImplEx wrapVersioned() {
         assert false;
 
         return null;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4f8f32af/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
index 9648b9b..2e1ca90 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.cache.version;
 
 import org.apache.ignite.*;
 import org.apache.ignite.cache.*;
-import org.apache.ignite.cache.version.*;
 import org.apache.ignite.internal.processors.cache.*;
 
 import javax.cache.*;
@@ -63,7 +62,7 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
 
                 invoked.incrementAndGet();
 
-                VersionedEntry<Integer, String> verEntry = entry.unwrap(VersionedEntry.class);
+                CacheEntry<Integer, String> verEntry = entry.unwrap(CacheEntry.class);
 
                 checkVersionedEntry(verEntry);
 
@@ -93,7 +92,7 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
 
                 invoked.incrementAndGet();
 
-                VersionedEntry<Integer, String> verEntry = entry.unwrap(VersionedEntry.class);
+                CacheEntry<Integer, String> verEntry = entry.unwrap(CacheEntry.class);
 
                 checkVersionedEntry(verEntry);
 
@@ -111,7 +110,7 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
         IgniteCache<Integer, String> cache = grid(0).cache(null);
 
         for (int i = 0; i < 5; i++)
-            checkVersionedEntry(cache.randomEntry().unwrap(VersionedEntry.class));
+            checkVersionedEntry(cache.randomEntry().unwrap(CacheEntry.class));
     }
 
     /**
@@ -125,7 +124,7 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
             cache.localEntries(CachePeekMode.ONHEAP);
 
         for (Cache.Entry<Integer, String> entry : entries)
-            checkVersionedEntry(entry.unwrap(VersionedEntry.class));
+            checkVersionedEntry(entry.unwrap(CacheEntry.class));
     }
 
     /**
@@ -134,21 +133,21 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
     public void testVersionComparision() throws Exception {
         IgniteCache<Integer, String> cache = grid(0).cache(null);
 
-        VersionedEntry<String, Integer> ver1 = cache.invoke(100,
-            new EntryProcessor<Integer, String, VersionedEntry<String, Integer>>() {
-                @Override public VersionedEntry<String, Integer> process(MutableEntry<Integer, String> entry,
+        CacheEntry<String, Integer> ver1 = cache.invoke(100,
+            new EntryProcessor<Integer, String, CacheEntry<String, Integer>>() {
+                @Override public CacheEntry<String, Integer> process(MutableEntry<Integer, String> entry,
                     Object... arguments) throws EntryProcessorException {
-                        return entry.unwrap(VersionedEntry.class);
+                        return entry.unwrap(CacheEntry.class);
                     }
             });
 
         cache.put(100, "new value 100");
 
-        VersionedEntry<String, Integer> ver2 = cache.invoke(100,
-            new EntryProcessor<Integer, String, VersionedEntry<String, Integer>>() {
-                @Override public VersionedEntry<String, Integer> process(MutableEntry<Integer, String> entry,
+        CacheEntry<String, Integer> ver2 = cache.invoke(100,
+            new EntryProcessor<Integer, String, CacheEntry<String, Integer>>() {
+                @Override public CacheEntry<String, Integer> process(MutableEntry<Integer, String> entry,
                     Object... arguments) throws EntryProcessorException {
-                        return entry.unwrap(VersionedEntry.class);
+                        return entry.unwrap(CacheEntry.class);
                     }
             });
 
@@ -159,7 +158,7 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
     /**
      * @param entry Versioned entry.
      */
-    private void checkVersionedEntry(VersionedEntry<Integer, String> entry) {
+    private void checkVersionedEntry(CacheEntry<Integer, String> entry) {
         assertNotNull(entry);
 
         assertNotNull(entry.version());


[33/35] incubator-ignite git commit: Merge branch 'ignite-946'

Posted by ag...@apache.org.
Merge branch 'ignite-946'


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

Branch: refs/heads/ignite-264
Commit: 776084772c06f6149d09726b2f6c3c7a08cef7bc
Parents: 8ecddcc 51a9bd8
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Fri Aug 14 12:54:34 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Aug 14 12:54:34 2015 +0300

----------------------------------------------------------------------
 .../org/apache/ignite/cache/CacheEntry.java     |  94 ++++++++++
 .../processors/cache/CacheEntryImpl.java        |  20 +++
 .../processors/cache/CacheEntryImpl0.java       |   5 +
 .../processors/cache/CacheEntryImplEx.java      |  83 +++++++++
 .../processors/cache/CacheInvokeEntry.java      |  27 ++-
 .../cache/CacheVersionedEntryImpl.java          |  80 ---------
 .../processors/cache/GridCacheAdapter.java      |  13 +-
 .../processors/cache/GridCacheEntryEx.java      |   2 +-
 .../processors/cache/GridCacheMapEntry.java     |  28 ++-
 .../processors/cache/GridCacheSwapManager.java  |  82 +++++----
 .../distributed/dht/GridDhtTxPrepareFuture.java |   2 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   3 +-
 .../local/atomic/GridLocalAtomicCache.java      |   3 +-
 .../cache/transactions/IgniteTxAdapter.java     |  16 +-
 .../cache/transactions/IgniteTxEntry.java       |  16 +-
 .../transactions/IgniteTxLocalAdapter.java      |  83 +++++++--
 .../cache/version/GridCacheVersion.java         |   2 +-
 .../cache/version/GridCacheVersionAware.java    |  30 ++++
 .../cache/version/GridCacheVersionManager.java  |   5 +-
 .../clock/GridClockSyncProcessor.java           |   2 +-
 .../resources/META-INF/classnames.properties    |   3 +-
 .../processors/cache/GridCacheTestEntryEx.java  |   2 +-
 .../CacheVersionedEntryAbstractTest.java        | 170 +++++++++++++++++++
 ...nedEntryLocalAtomicSwapDisabledSelfTest.java |  45 +++++
 ...ersionedEntryLocalTransactionalSelfTest.java |  40 +++++
 ...edEntryPartitionedAtomicOffHeapSelfTest.java |  35 ++++
 ...VersionedEntryPartitionedAtomicSelfTest.java |  35 ++++
 ...PartitionedTransactionalOffHeapSelfTest.java |  36 ++++
 ...edEntryPartitionedTransactionalSelfTest.java |  35 ++++
 ...nedEntryReplicatedAtomicOffHeapSelfTest.java |  35 ++++
 ...eVersionedEntryReplicatedAtomicSelfTest.java |  35 ++++
 ...yReplicatedTransactionalOffHeapSelfTest.java |  36 ++++
 ...nedEntryReplicatedTransactionalSelfTest.java |  35 ++++
 .../testsuites/IgniteCacheTestSuite4.java       |  13 ++
 34 files changed, 1005 insertions(+), 146 deletions(-)
----------------------------------------------------------------------



[13/35] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/master' into ignite-946

Posted by ag...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-946


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

Branch: refs/heads/ignite-264
Commit: 92e81dca00800b1b74f0ade328121aaf0ab1d4df
Parents: 2e7799d d9acbd1
Author: Denis Magda <dm...@gridgain.com>
Authored: Mon Aug 10 09:57:31 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Mon Aug 10 09:57:31 2015 +0300

----------------------------------------------------------------------
 assembly/release-hadoop.xml                     |   5 +
 .../ClientAbstractMultiNodeSelfTest.java        |   4 +-
 .../JettyRestProcessorAbstractSelfTest.java     |  14 +-
 .../apache/ignite/IgniteSystemProperties.java   |   2 +-
 .../store/jdbc/CacheAbstractJdbcStore.java      |  21 +-
 .../apache/ignite/internal/IgniteKernal.java    |   2 +-
 .../org/apache/ignite/internal/IgnitionEx.java  |  43 +-
 .../managers/communication/GridIoManager.java   | 188 +++++++-
 .../processors/cache/GridCacheMvccManager.java  |  73 +--
 .../processors/cache/GridCacheProcessor.java    |  12 +-
 .../processors/cache/GridCacheProxyImpl.java    |  42 +-
 .../processors/cache/GridCacheSwapManager.java  |   2 +-
 .../processors/cache/GridCacheUtils.java        |   1 -
 .../GridDhtPartitionsExchangeFuture.java        |  20 +-
 .../distributed/near/GridNearGetFuture.java     |  20 +-
 .../cache/query/GridCacheSqlQuery.java          |  33 +-
 .../cache/query/GridCacheTwoStepQuery.java      |  34 +-
 .../handlers/query/QueryCommandHandler.java     |   6 +-
 .../ignite/internal/util/GridLogThrottle.java   |  63 ++-
 .../ignite/internal/util/IgniteUtils.java       |  16 +
 .../util/nio/GridCommunicationClient.java       |   5 +-
 .../util/nio/GridNioFinishedFuture.java         |  12 +
 .../ignite/internal/util/nio/GridNioFuture.java |  14 +
 .../internal/util/nio/GridNioFutureImpl.java    |  15 +
 .../util/nio/GridNioRecoveryDescriptor.java     |  13 +-
 .../ignite/internal/util/nio/GridNioServer.java |   5 +
 .../util/nio/GridNioSessionMetaKey.java         |   5 +-
 .../util/nio/GridShmemCommunicationClient.java  |   7 +-
 .../util/nio/GridTcpNioCommunicationClient.java |  14 +-
 .../communication/tcp/TcpCommunicationSpi.java  |  84 +++-
 .../ignite/spi/discovery/tcp/ClientImpl.java    |  29 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  50 +-
 .../spi/discovery/tcp/TcpDiscoveryImpl.java     |  15 +
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |   7 +-
 .../TcpDiscoveryMulticastIpFinder.java          |   7 +-
 .../src/test/config/io-manager-benchmark.xml    |   3 +-
 .../GridJobMasterLeaveAwareSelfTest.java        |  10 +-
 .../IgniteClientReconnectAbstractTest.java      |   5 +-
 .../IgniteClientReconnectCacheTest.java         |   5 +-
 .../GridDeploymentMessageCountSelfTest.java     |   5 +-
 .../cache/CacheStopAndDestroySelfTest.java      |   8 +-
 .../GridCacheAtomicMessageCountSelfTest.java    |   6 +-
 .../processors/cache/GridCacheMvccSelfTest.java |   1 -
 ...ridCacheReplicatedSynchronousCommitTest.java |   5 +-
 .../cache/GridCacheSwapPreloadSelfTest.java     |   2 +
 .../IgniteCacheAbstractStopBusySelfTest.java    |   6 +-
 .../cache/IgniteCacheNearLockValueSelfTest.java |   6 +-
 ...eDynamicCacheStartNoExchangeTimeoutTest.java |   4 +-
 .../cache/IgniteTxReentryAbstractSelfTest.java  |   5 +-
 ...niteCacheClientNodeChangingTopologyTest.java |   6 +-
 ...teCacheClientNodePartitionsExchangeTest.java |   4 +-
 .../IgniteCacheNearOffheapGetSelfTest.java      | 131 ++++++
 ...xOriginatingNodeFailureAbstractSelfTest.java |   6 +-
 ...cOriginatingNodeFailureAbstractSelfTest.java |   6 +-
 .../GridCacheDhtPreloadMessageCountTest.java    |   5 +-
 ...ePrimaryNodeFailureRecoveryAbstractTest.java |   6 +-
 ...eAtomicInvalidPartitionHandlingSelfTest.java |   5 +-
 .../near/IgniteCacheNearTxRollbackTest.java     |   6 +-
 .../GridCacheReplicatedInvalidateSelfTest.java  |   6 +-
 ...CommunicationRecoveryAckClosureSelfTest.java | 464 +++++++++++++++++++
 .../tcp/TcpDiscoveryMultiThreadedTest.java      |   8 +-
 .../testsuites/IgniteCacheTestSuite2.java       |   1 +
 .../IgniteSpiCommunicationSelfTestSuite.java    |   1 +
 .../ignite/util/TestTcpCommunicationSpi.java    |   6 +-
 .../processors/query/h2/IgniteH2Indexing.java   |  27 +-
 .../processors/query/h2/sql/GridSqlElement.java |  18 +-
 .../query/h2/sql/GridSqlFunction.java           |  17 +-
 .../processors/query/h2/sql/GridSqlQuery.java   |   4 +-
 .../query/h2/sql/GridSqlQueryParser.java        |  94 ++--
 .../query/h2/sql/GridSqlQuerySplitter.java      | 117 +++--
 .../processors/query/h2/sql/GridSqlSelect.java  |  76 +--
 .../processors/query/h2/sql/GridSqlType.java    |  24 +-
 .../processors/query/h2/sql/GridSqlUnion.java   |   2 +-
 .../query/h2/twostep/GridMapQueryExecutor.java  |   7 +-
 .../query/h2/twostep/GridMergeIndex.java        |   7 +
 .../h2/twostep/GridMergeIndexUnsorted.java      |  17 +-
 .../query/h2/twostep/GridMergeTable.java        |  52 +--
 .../h2/twostep/GridReduceQueryExecutor.java     | 280 +++++------
 .../query/h2/twostep/GridThreadLocalTable.java  | 262 +++++++++++
 ...CacheScanPartitionQueryFallbackSelfTest.java |  15 +-
 ...idCacheReduceQueryMultithreadedSelfTest.java |  21 +-
 .../IgniteCacheAbstractFieldsQuerySelfTest.java |   2 +-
 modules/log4j2/README.txt                       |  15 +-
 .../ignite/logger/log4j2/Log4J2Logger.java      |   2 +-
 .../ignite/logger/log4j2/Log4j2FileAware.java   |  35 --
 .../http/jetty/GridJettyRestHandler.java        |  12 +-
 .../parser/dialect/OracleMetadataDialect.java   |   4 +-
 .../org/apache/ignite/spark/IgniteContext.scala |  19 +-
 .../src/test/java/config/ignite-test-config.xml |  43 ++
 .../ignite/internal/GridFactorySelfTest.java    |   9 +
 .../visor/commands/kill/VisorKillCommand.scala  |   2 +-
 .../config/benchmark-multicast.properties       |   1 +
 .../yardstick/config/benchmark-query.properties |   3 +-
 modules/yardstick/config/ignite-base-config.xml |   2 -
 .../yardstick/IgniteBenchmarkArguments.java     |  11 +
 .../cache/IgniteJdbcSqlQueryBenchmark.java      | 134 ++++++
 parent/pom.xml                                  |  97 ++--
 scripts/git-apply-patch.sh                      |  94 ----
 scripts/git-patch-functions.sh                  |  56 +--
 99 files changed, 2299 insertions(+), 897 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/92e81dca/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
----------------------------------------------------------------------


[04/35] incubator-ignite git commit: ignite-946: improving tests

Posted by ag...@apache.org.
ignite-946: improving tests


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

Branch: refs/heads/ignite-264
Commit: 4b9f4bad4191c357418996abc88748208461f18a
Parents: 325d06d
Author: Denis Magda <dm...@gridgain.com>
Authored: Fri Jul 31 10:19:46 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Jul 31 15:49:11 2015 +0300

----------------------------------------------------------------------
 .../cache/query/GridCacheQueryManager.java      |  1 +
 .../CacheVersionedEntryAbstractTest.java        | 24 ++++++-----
 .../CacheVersionedEntryLocalAtomicSelfTest.java | 40 -----------------
 ...nedEntryLocalAtomicSwapDisabledSelfTest.java | 45 ++++++++++++++++++++
 .../testsuites/IgniteCacheTestSuite4.java       |  2 +-
 5 files changed, 60 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4b9f4bad/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index 5d3f6a3..400d997 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -845,6 +845,7 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
 
                         try {
                             val = prj.localPeek(key, CachePeekModes.ONHEAP_ONLY, expiryPlc);
+
                         }
                         catch (IgniteCheckedException e) {
                             if (log.isDebugEnabled())

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4b9f4bad/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
index 951d05a..4cfacb7 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
@@ -55,23 +55,25 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
     public void testInvoke() throws Exception {
         Cache<Integer, String> cache = grid(0).cache(null);
 
-        final AtomicBoolean invoked = new AtomicBoolean(false);
+        final AtomicInteger invoked = new AtomicInteger();
 
-        cache.invoke(100, new EntryProcessor<Integer, String, Object>() {
-            @Override public Object process(MutableEntry<Integer, String> entry, Object... arguments)
-                throws EntryProcessorException {
+        for (int i = 0; i < ENTRIES_NUM; i++) {
+            cache.invoke(i, new EntryProcessor<Integer, String, Object>() {
+                @Override public Object process(MutableEntry<Integer, String> entry, Object... arguments)
+                    throws EntryProcessorException {
 
-                invoked.set(true);
+                    invoked.incrementAndGet();
 
-                VersionedEntry<Integer, String> verEntry = entry.unwrap(VersionedEntry.class);
+                    VersionedEntry<Integer, String> verEntry = entry.unwrap(VersionedEntry.class);
 
-                checkVersionedEntry(verEntry);
+                    checkVersionedEntry(verEntry);
 
-                return entry;
-            }
-        });
+                    return entry;
+                }
+            });
+        }
 
-        assertTrue(invoked.get());
+        assert invoked.get() > 0;
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4b9f4bad/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryLocalAtomicSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryLocalAtomicSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryLocalAtomicSelfTest.java
deleted file mode 100644
index a340413..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryLocalAtomicSelfTest.java
+++ /dev/null
@@ -1,40 +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.version;
-
-import org.apache.ignite.cache.*;
-
-/**
- *
- */
-public class CacheVersionedEntryLocalAtomicSelfTest extends CacheVersionedEntryAbstractTest {
-    /** {@inheritDoc} */
-    @Override protected int gridCount() {
-        return 1;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheMode cacheMode() {
-        return CacheMode.LOCAL;
-    }
-
-    /** {@inheritDoc} */
-    @Override protected CacheAtomicityMode atomicityMode() {
-        return CacheAtomicityMode.ATOMIC;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4b9f4bad/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryLocalAtomicSwapDisabledSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryLocalAtomicSwapDisabledSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryLocalAtomicSwapDisabledSelfTest.java
new file mode 100644
index 0000000..b0035d1
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryLocalAtomicSwapDisabledSelfTest.java
@@ -0,0 +1,45 @@
+/*
+ * 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.version;
+
+import org.apache.ignite.cache.*;
+
+/**
+ *
+ */
+public class CacheVersionedEntryLocalAtomicSwapDisabledSelfTest extends CacheVersionedEntryAbstractTest {
+    /** {@inheritDoc} */
+    @Override protected int gridCount() {
+        return 1;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheMode cacheMode() {
+        return CacheMode.LOCAL;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected CacheAtomicityMode atomicityMode() {
+        return CacheAtomicityMode.ATOMIC;
+    }
+
+    /** {@inheritDoc} */
+    @Override protected boolean swapEnabled() {
+        return false;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4b9f4bad/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
index dd9c799..3ac7879 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
@@ -155,7 +155,7 @@ public class IgniteCacheTestSuite4 extends TestSuite {
         suite.addTestSuite(CacheReadThroughAtomicRestartSelfTest.class);
 
         // Versioned entry tests
-        suite.addTestSuite(CacheVersionedEntryLocalAtomicSelfTest.class);
+        suite.addTestSuite(CacheVersionedEntryLocalAtomicSwapDisabledSelfTest.class);
         suite.addTestSuite(CacheVersionedEntryLocalTransactionalSelfTest.class);
         suite.addTestSuite(CacheVersionedEntryPartitionedAtomicSelfTest.class);
         suite.addTestSuite(CacheVersionedEntryPartitionedTransactionalSelfTest.class);


[35/35] incubator-ignite git commit: IGNITE-264 - Use correct version to check for committed near transaction.

Posted by ag...@apache.org.
IGNITE-264 - Use correct version to check for committed near transaction.


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

Branch: refs/heads/ignite-264
Commit: 9278d805f55beeff7e481a334a4fca8e77d9eaf6
Parents: 44c4a60
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Fri Aug 14 18:48:35 2015 -0700
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Fri Aug 14 18:48:35 2015 -0700

----------------------------------------------------------------------
 .../cache/transactions/IgniteTxManager.java     | 50 ++++++++------------
 .../cache/GridCachePutAllFailoverSelfTest.java  | 26 ++++++++++
 2 files changed, 47 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9278d805/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
index 124e71d..e2046de 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
@@ -1637,13 +1637,13 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
     }
 
     /**
-     * @param ver Version.
+     * @param xidVer Version.
      * @return Future for flag indicating if transactions was committed.
      */
-    public IgniteInternalFuture<Boolean> txCommitted(GridCacheVersion ver) {
+    public IgniteInternalFuture<Boolean> txCommitted(GridCacheVersion xidVer) {
         final GridFutureAdapter<Boolean> resFut = new GridFutureAdapter<>();
 
-        final IgniteInternalTx tx = cctx.tm().tx(ver);
+        final IgniteInternalTx tx = cctx.tm().tx(xidVer);
 
         if (tx != null) {
             assert tx.near() && tx.local() : tx;
@@ -1665,7 +1665,22 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
             return resFut;
         }
 
-        Boolean committed = completedVers.get(ver);
+        Boolean committed = null;
+
+        for (Map.Entry<GridCacheVersion, Boolean> entry : completedVers.entrySet()) {
+            if (entry.getValue() == null)
+                continue;
+
+            if (entry.getKey() instanceof CommittedVersion) {
+                CommittedVersion comm = (CommittedVersion)entry.getKey();
+
+                if (comm.nearVer.equals(xidVer)) {
+                    committed = entry.getValue();
+
+                    break;
+                }
+            }
+        }
 
         if (log.isDebugEnabled())
             log.debug("Near transaction committed: " + committed);
@@ -1806,29 +1821,6 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
     }
 
     /**
-     * @param nearVer Near version to check.
-     * @return Future.
-     */
-    public IgniteInternalFuture<Boolean> nearTxCommitted(GridCacheVersion nearVer) {
-        for (final IgniteInternalTx tx : txs()) {
-            if (tx.near() && tx.xidVersion().equals(nearVer)) {
-                return tx.done() ?
-                    new GridFinishedFuture<>(tx.state() == COMMITTED) :
-                    tx.finishFuture().chain(new C1<IgniteInternalFuture<IgniteInternalTx>, Boolean>() {
-                        @Override public Boolean apply(IgniteInternalFuture<IgniteInternalTx> f) {
-                            return tx.state() == COMMITTED;
-                        }
-                    });
-            }
-        }
-
-        // Transaction was not found. Check committed versions buffer.
-        Boolean res = completedVers.get(nearVer);
-
-        return new GridFinishedFuture<>(res != null && res);
-    }
-
-    /**
      * Gets local transaction for pessimistic tx recovery.
      *
      * @param nearXidVer Near tx ID.
@@ -1931,9 +1923,9 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
             try {
                 cctx.kernalContext().gateway().readLock();
             }
-            catch (IllegalStateException | IgniteClientDisconnectedException ignore) {
+            catch (IllegalStateException | IgniteClientDisconnectedException e) {
                 if (log.isDebugEnabled())
-                    log.debug("Failed to acquire kernal gateway [err=" + ignore + ']');
+                    log.debug("Failed to acquire kernal gateway [err=" + e + ']');
 
                 return;
             }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9278d805/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
index dc6e71e..6bbc764 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCachePutAllFailoverSelfTest.java
@@ -337,6 +337,32 @@ public class GridCachePutAllFailoverSelfTest extends GridCommonAbstractTest {
 
             info(">>> Absent keys: " + absentKeys);
 
+            if (!F.isEmpty(absentKeys)) {
+                for (Ignite g : runningWorkers) {
+                    IgniteKernal k = (IgniteKernal)g;
+
+                    info(">>>> Entries on node: " + k.getLocalNodeId());
+
+                    GridCacheAdapter<Object, Object> cache = k.internalCache("partitioned");
+
+                    for (Integer key : absentKeys) {
+                        GridCacheEntryEx entry = cache.peekEx(key);
+
+                        if (entry != null)
+                            info(" >>> " + entry);
+
+                        if (cache.context().isNear()) {
+                            GridCacheEntryEx entry0 = cache.context().near().dht().peekEx(key);
+
+                            if (entry0 != null)
+                                info(" >>> " + entry);
+                        }
+                    }
+
+                    info("");
+                }
+            }
+
             assertTrue(absentKeys.isEmpty());
 
             // Actual primary cache size.


[16/35] incubator-ignite git commit: ignite-946: fixed comments and bugs

Posted by ag...@apache.org.
ignite-946: fixed comments and bugs


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

Branch: refs/heads/ignite-264
Commit: c1582fc32884cdf9494df32fb33207d64ed1230f
Parents: 911ffbb
Author: Denis Magda <dm...@gridgain.com>
Authored: Mon Aug 10 12:44:31 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Mon Aug 10 12:44:31 2015 +0300

----------------------------------------------------------------------
 .../ignite/cache/version/VersionedEntry.java       | 17 +++++++++--------
 .../cache/version/CacheVersionedEntryImpl.java     |  4 ++--
 .../processors/clock/GridClockSyncProcessor.java   |  2 +-
 .../version/CacheVersionedEntryAbstractTest.java   |  2 +-
 4 files changed, 13 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1582fc3/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java b/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
index 2c0879b..1aac68a 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
@@ -73,30 +73,31 @@ public interface VersionedEntry<K, V> extends Cache.Entry<K, V> {
     };
 
     /**
-     * Gets entry's topology version.
+     * Gets the topology version at the time when the entry with a given pair of key and value has been created.
      *
      * @return Topology version plus number of seconds from the start time of the first grid node.
      */
     public int topologyVersion();
 
     /**
-     * Gets entry's order.
+     * Gets versioned entry unique order.
+     * Each time a cache entry for a given key is updated a new {@code VersionedEntry} with increased order is created.
      *
-     * @return Version order.
+     * @return Versioned entry unique order.
      */
     public long order();
 
     /**
-     * Gets entry's node order.
+     * Gets local node order at the time when the entry with a given pair of key and value has been created.
      *
-     * @return Node order on which this version was assigned.
+     * @return Local node order on which this version has been assigned.
      */
     public int nodeOrder();
 
     /**
-     * Gets entry's global time.
+     * Gets the time when the entry with a given pair of key and value has been created.
      *
-     * @return Adjusted time.
+     * @return Time in milliseconds.
      */
-    public long globalTime();
+    public long creationTime();
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1582fc3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
index 924eff9..74e4a9a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
@@ -74,7 +74,7 @@ public class CacheVersionedEntryImpl<K, V> extends CacheEntryImpl<K, V> implemen
     }
 
     /** {@inheritDoc} */
-    @Override public long globalTime() {
+    @Override public long creationTime() {
         return ver.globalTime();
     }
 
@@ -95,6 +95,6 @@ public class CacheVersionedEntryImpl<K, V> extends CacheEntryImpl<K, V> implemen
     /** {@inheritDoc} */
     public String toString() {
         return "VersionedEntry [key=" + getKey() + ", val=" + getValue() + ", topVer=" + ver.topologyVersion() +
-            ", nodeOrder=" + ver.nodeOrder() + ", order=" + ver.order() + ", globalTime=" + ver.globalTime() + ']';
+            ", nodeOrder=" + ver.nodeOrder() + ", order=" + ver.order() + ", creationTime=" + ver.globalTime() + ']';
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1582fc3/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSyncProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSyncProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSyncProcessor.java
index 3ac44f2..69b07b3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSyncProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/clock/GridClockSyncProcessor.java
@@ -264,7 +264,7 @@ public class GridClockSyncProcessor extends GridProcessorAdapter {
         long now = clockSrc.currentTimeMillis();
 
         if (snap == null)
-            return System.currentTimeMillis();
+            return now;
 
         Long delta = snap.deltas().get(ctx.localNodeId());
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c1582fc3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
index b121995..0ad8038 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
@@ -164,7 +164,7 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
         assert entry.topologyVersion() > 0;
         assert entry.order() > 0;
         assert entry.nodeOrder() > 0;
-        assert entry.globalTime() > 0;
+        assert entry.creationTime() > 0;
 
         assertNotNull(entry.getKey());
         assertNotNull(entry.getValue());


[26/35] incubator-ignite git commit: # Test for ignite-1245.

Posted by ag...@apache.org.
# Test for ignite-1245.


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

Branch: refs/heads/ignite-264
Commit: aed83af5f76c47bc9e4d0e8f60955fc6c6b42aac
Parents: 36f7ba6
Author: sboikov <sb...@gridgain.com>
Authored: Thu Aug 13 13:05:43 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Aug 13 13:05:43 2015 +0300

----------------------------------------------------------------------
 .../IgniteCacheContinuousQueryClientTest.java   | 114 +++++++++++++++++++
 1 file changed, 114 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/aed83af5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryClientTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryClientTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryClientTest.java
new file mode 100644
index 0000000..bb413a0
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryClientTest.java
@@ -0,0 +1,114 @@
+/*
+ * 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.query.continuous;
+
+import org.apache.ignite.*;
+import org.apache.ignite.cache.query.*;
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.resources.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.apache.ignite.testframework.junits.common.*;
+
+import javax.cache.event.*;
+import java.util.concurrent.*;
+
+import static java.util.concurrent.TimeUnit.*;
+import static org.apache.ignite.cache.CacheAtomicityMode.*;
+import static org.apache.ignite.cache.CacheMode.*;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
+
+/**
+ *
+ */
+public class IgniteCacheContinuousQueryClientTest extends GridCommonAbstractTest {
+    /** */
+    protected static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+    /** */
+    private boolean client;
+
+    /** {@inheritDoc} */
+    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+        IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+        CacheConfiguration ccfg = new CacheConfiguration();
+
+        ccfg.setCacheMode(PARTITIONED);
+        ccfg.setAtomicityMode(ATOMIC);
+        ccfg.setWriteSynchronizationMode(FULL_SYNC);
+
+        cfg.setCacheConfiguration(ccfg);
+
+        cfg.setClientMode(client);
+
+        return cfg;
+    }
+
+    /**
+     * @throws Exception If failed.
+     */
+    public void testNodeJoins() throws Exception {
+        startGrids(2);
+
+        client = true;
+
+        Ignite clientNode = startGrid(3);
+
+        client = false;
+
+        CacheEventListener lsnr = new CacheEventListener();
+
+        ContinuousQuery<Object, Object> qry = new ContinuousQuery<>();
+
+        qry.setLocalListener(lsnr);
+
+        QueryCursor<?> cur = clientNode.cache(null).query(qry);
+
+        Ignite joined = startGrid(4);
+
+        IgniteCache<Object, Object> joinedCache = joined.cache(null);
+
+        joinedCache.put(primaryKey(joinedCache), 1);
+
+        assertTrue("Failed to wait for event.", lsnr.latch.await(5, SECONDS));
+
+        cur.close();
+    }
+
+    /**
+     *
+     */
+    private static class CacheEventListener implements CacheEntryUpdatedListener<Object, Object> {
+        /** */
+        private final CountDownLatch latch = new CountDownLatch(1);
+
+        /** */
+        @LoggerResource
+        private IgniteLogger log;
+
+        /** {@inheritDoc} */
+        @Override public void onUpdated(Iterable<CacheEntryEvent<?, ?>> evts) {
+            for (CacheEntryEvent<?, ?> evt : evts) {
+                log.info("Received cache event: " + evt);
+
+                latch.countDown();
+            }
+        }
+    }
+}


[23/35] incubator-ignite git commit: Fixed error message

Posted by ag...@apache.org.
Fixed error message


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

Branch: refs/heads/ignite-264
Commit: 36f7ba669fd5b706fd9b01c06ce20dbb7610d50f
Parents: 653c0b2
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Wed Aug 12 16:56:18 2015 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Wed Aug 12 16:56:18 2015 -0700

----------------------------------------------------------------------
 .../apache/ignite/internal/processors/cache/GridCacheGateway.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/36f7ba66/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGateway.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGateway.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGateway.java
index 93c5858..58c9035 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGateway.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGateway.java
@@ -156,7 +156,7 @@ public class GridCacheGateway<K, V> {
             GridCachePreloader preldr = cache != null ? cache.preloader() : null;
 
             if (preldr == null)
-                throw new IllegalStateException("Cache has been closed: " + ctx.name());
+                throw new IllegalStateException("Cache has been closed or destroyed: " + ctx.name());
 
             preldr.startFuture().get();
         }


[19/35] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/master' into ignite-946

Posted by ag...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-946


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

Branch: refs/heads/ignite-264
Commit: 801d6df1acd2615c1a85e9e3829983011b5fd0a3
Parents: b6bef13 ae11e9b
Author: Denis Magda <dm...@gridgain.com>
Authored: Tue Aug 11 10:19:21 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Tue Aug 11 10:19:21 2015 +0300

----------------------------------------------------------------------
 .../configuration/IgniteConfiguration.java      |  1 -
 .../GridCachePartitionExchangeManager.java      | 48 +++++++----
 .../dht/atomic/GridDhtAtomicCache.java          | 36 +++++---
 .../cache/CacheStopAndDestroySelfTest.java      | 87 --------------------
 4 files changed, 56 insertions(+), 116 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/801d6df1/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------


[34/35] incubator-ignite git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-264

Posted by ag...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-264


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

Branch: refs/heads/ignite-264
Commit: 44c4a605e7828513f379745680d2c830f675d53a
Parents: f9511af 7760847
Author: Alexey Goncharuk <ag...@gridgain.com>
Authored: Fri Aug 14 10:01:36 2015 -0700
Committer: Alexey Goncharuk <ag...@gridgain.com>
Committed: Fri Aug 14 10:01:36 2015 -0700

----------------------------------------------------------------------
 .../org/apache/ignite/cache/CacheEntry.java     |  94 ++++++++++
 .../org/apache/ignite/internal/IgnitionEx.java  |  10 +-
 .../processors/cache/CacheEntryImpl.java        |  20 +++
 .../processors/cache/CacheEntryImpl0.java       |   5 +
 .../processors/cache/CacheEntryImplEx.java      |  83 +++++++++
 .../processors/cache/CacheInvokeEntry.java      |  27 ++-
 .../cache/CacheVersionedEntryImpl.java          |  80 ---------
 .../processors/cache/GridCacheAdapter.java      |  13 +-
 .../processors/cache/GridCacheEntryEx.java      |   2 +-
 .../processors/cache/GridCacheGateway.java      |   5 +-
 .../processors/cache/GridCacheMapEntry.java     |  28 ++-
 .../processors/cache/GridCacheSwapManager.java  |  82 +++++----
 .../distributed/dht/GridDhtTxPrepareFuture.java |   2 +-
 .../dht/atomic/GridDhtAtomicCache.java          |   3 +-
 .../local/atomic/GridLocalAtomicCache.java      |   3 +-
 .../cache/transactions/IgniteTxAdapter.java     |  16 +-
 .../cache/transactions/IgniteTxEntry.java       |  16 +-
 .../transactions/IgniteTxLocalAdapter.java      |  83 +++++++--
 .../cache/version/GridCacheVersion.java         |   2 +-
 .../cache/version/GridCacheVersionAware.java    |  30 ++++
 .../cache/version/GridCacheVersionManager.java  |   5 +-
 .../clock/GridClockSyncProcessor.java           |   2 +-
 .../continuous/GridContinuousProcessor.java     |  60 +++++--
 .../ignite/internal/util/nio/GridNioServer.java |   4 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  91 ++++++----
 .../resources/META-INF/classnames.properties    |   3 +-
 .../processors/cache/GridCacheTestEntryEx.java  |   2 +-
 ...ridCacheContinuousQueryAbstractSelfTest.java |   2 +-
 .../IgniteCacheContinuousQueryClientTest.java   | 137 +++++++++++++++
 .../CacheVersionedEntryAbstractTest.java        | 170 +++++++++++++++++++
 ...nedEntryLocalAtomicSwapDisabledSelfTest.java |  45 +++++
 ...ersionedEntryLocalTransactionalSelfTest.java |  40 +++++
 ...edEntryPartitionedAtomicOffHeapSelfTest.java |  35 ++++
 ...VersionedEntryPartitionedAtomicSelfTest.java |  35 ++++
 ...PartitionedTransactionalOffHeapSelfTest.java |  36 ++++
 ...edEntryPartitionedTransactionalSelfTest.java |  35 ++++
 ...nedEntryReplicatedAtomicOffHeapSelfTest.java |  35 ++++
 ...eVersionedEntryReplicatedAtomicSelfTest.java |  35 ++++
 ...yReplicatedTransactionalOffHeapSelfTest.java |  36 ++++
 ...nedEntryReplicatedTransactionalSelfTest.java |  35 ++++
 .../continuous/GridEventConsumeSelfTest.java    |   4 +-
 .../testsuites/IgniteCacheTestSuite4.java       |  13 ++
 .../IgniteCacheQuerySelfTestSuite.java          |   1 +
 .../java/org/apache/ignite/IgniteSpring.java    |   8 +-
 scripts/git-format-patch.sh                     |   2 +-
 45 files changed, 1268 insertions(+), 207 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/44c4a605/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/44c4a605/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/44c4a605/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/44c4a605/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/44c4a605/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
----------------------------------------------------------------------


[11/35] incubator-ignite git commit: review

Posted by ag...@apache.org.
review


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

Branch: refs/heads/ignite-264
Commit: fe2be79c8e4eccf8f823abeb32521f0fca8ddf42
Parents: b2e6734
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Tue Aug 4 17:49:48 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Tue Aug 4 17:49:48 2015 +0300

----------------------------------------------------------------------
 .../ignite/cache/version/package-info.java      |  4 ++--
 .../processors/cache/CacheInvokeEntry.java      |  5 +++--
 .../cache/transactions/IgniteTxEntry.java       |  4 +++-
 .../transactions/IgniteTxLocalAdapter.java      | 20 ++++++++++----------
 4 files changed, 18 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe2be79c/modules/core/src/main/java/org/apache/ignite/cache/version/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/version/package-info.java b/modules/core/src/main/java/org/apache/ignite/cache/version/package-info.java
index 9aeaba2..50ceb13 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/version/package-info.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/version/package-info.java
@@ -16,6 +16,6 @@
  */
 
 /**
- * Contains cache version based implementations.
+ * Contains cache versioned entry interface.
  */
-package org.apache.ignite.cache.version;
\ No newline at end of file
+package org.apache.ignite.cache.version;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe2be79c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java
index 2d8f738..515a4c5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheInvokeEntry.java
@@ -49,14 +49,15 @@ public class CacheInvokeEntry<K, V> extends CacheLazyEntry<K, V> implements Muta
     public CacheInvokeEntry(GridCacheContext cctx,
         KeyCacheObject keyObj,
         @Nullable CacheObject valObj,
-        GridCacheVersion ver) {
+        GridCacheVersion ver
+    ) {
         super(cctx, keyObj, valObj);
 
         this.hadVal = valObj != null;
         this.ver = ver;
     }
 
-    /** 
+    /**
      * @param ctx Cache context.
      * @param keyObj Key cache object.
      * @param key Key value.

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe2be79c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
index ed57bf2..73b9975 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
@@ -577,6 +577,8 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
             ver = entry.version();
         }
         catch (GridCacheEntryRemovedException e) {
+            assert tx.optimistic() : tx;
+
             ver = null;
         }
 
@@ -924,7 +926,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
                     return false;
 
                 reader.incrementState();
-                
+
             case 6:
                 flags = reader.readByte("flags");
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/fe2be79c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index 7f171c2..e03f34d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -1937,14 +1937,14 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
         GridCacheContext cacheCtx,
         Map<KeyCacheObject, GridCacheDrInfo> drMap
     ) {
-        return this.<Object, Object>putAllAsync0(cacheCtx,
-                                                 null,
-                                                 null,
-                                                 null,
-                                                 drMap,
-                                                 false,
-                                                 null,
-                                                 null);
+        return putAllAsync0(cacheCtx,
+            null,
+            null,
+            null,
+            drMap,
+            false,
+            null,
+            null);
     }
 
     /** {@inheritDoc} */
@@ -2237,8 +2237,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                                             }
                                             catch (GridCacheEntryRemovedException ex) {
                                                 if (log.isDebugEnabled())
-                                                    log.debug("Failed to get entry version: [msg=" +
-                                                        ex.getMessage() + ']');
+                                                    log.debug("Failed to get entry version " +
+                                                        "[err=" + ex.getMessage() + ']');
 
                                                 ver = null;
                                             }


[05/35] incubator-ignite git commit: ignite-946: supported VersionedEntry for IgniteCache.localEntries() when OFF_HEAP mode is used

Posted by ag...@apache.org.
ignite-946: supported VersionedEntry for IgniteCache.localEntries() when OFF_HEAP mode is used


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

Branch: refs/heads/ignite-264
Commit: 2d200a31b9903a165c9d70ec84b687e7bcc55c44
Parents: 719161f
Author: Denis Magda <dm...@gridgain.com>
Authored: Fri Jul 31 11:39:47 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Jul 31 15:49:12 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/CacheEntryImpl0.java       |  5 +++
 .../processors/cache/GridCacheSwapManager.java  |  8 ++++-
 .../cache/version/GridVersionedMapEntry.java    | 33 +++++++++++++++++++
 .../CacheVersionedEntryAbstractTest.java        | 34 ++++++--------------
 4 files changed, 55 insertions(+), 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2d200a31/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl0.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl0.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl0.java
index d2b1923..a5e27d6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl0.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl0.java
@@ -17,6 +17,9 @@
 
 package org.apache.ignite.internal.processors.cache;
 
+import org.apache.ignite.cache.version.*;
+import org.apache.ignite.internal.processors.cache.version.*;
+
 import javax.cache.*;
 import java.util.*;
 
@@ -49,6 +52,8 @@ public class CacheEntryImpl0<K, V> implements Cache.Entry<K, V> {
     @Override public <T> T unwrap(Class<T> cls) {
         if(cls.isAssignableFrom(getClass()))
             return cls.cast(this);
+        else if (cls.isAssignableFrom(VersionedEntry.class) && e instanceof GridVersionedMapEntry)
+            return (T)new CacheVersionedEntryImpl<>(e.getKey(), e.getValue(), ((GridVersionedMapEntry)e).version());
 
         throw new IllegalArgumentException("Unwrapping to class is not supported: " + cls);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2d200a31/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
index 9e9c958..0530c19 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
@@ -1513,7 +1513,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
             @Override protected Map.Entry<K, V> onNext() {
                 final Map.Entry<byte[], byte[]> cur0 = it.next();
 
-                cur = new Map.Entry<K, V>() {
+                cur = new GridVersionedMapEntry<K, V>() {
                     @Override public K getKey() {
                         try {
                             KeyCacheObject key = cctx.toCacheKeyObject(cur0.getKey());
@@ -1538,6 +1538,12 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
                         }
                     }
 
+                    @Override public GridCacheVersion version() {
+                        GridCacheSwapEntry e = unmarshalSwapEntry(cur0.getValue());
+
+                        return e.version();
+                    }
+
                     @Override public V setValue(V val) {
                         throw new UnsupportedOperationException();
                     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2d200a31/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridVersionedMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridVersionedMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridVersionedMapEntry.java
new file mode 100644
index 0000000..f653fac
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridVersionedMapEntry.java
@@ -0,0 +1,33 @@
+/*
+ * 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.version;
+
+import java.util.*;
+
+/**
+ * This interface extends {@link java.util.Map.Entry} by adding the method that returns entry's
+ * {@link GridCacheVersion}.
+ */
+public interface GridVersionedMapEntry<K, V> extends Map.Entry<K, V> {
+    /**
+     * Gets entry version.
+     *
+     * @return Entry version.
+     */
+    public GridCacheVersion version();
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2d200a31/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
index 4cfacb7..25a2a42 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
@@ -32,7 +32,7 @@ import java.util.concurrent.atomic.*;
  */
 public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractSelfTest {
     /** Entries number to store in a cache. */
-    private static final int ENTRIES_NUM = 1000;
+    private static final int ENTRIES_NUM = 500;
 
     /** {@inheritDoc} */
     @Override protected int gridCount() {
@@ -57,21 +57,19 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
 
         final AtomicInteger invoked = new AtomicInteger();
 
-        for (int i = 0; i < ENTRIES_NUM; i++) {
-            cache.invoke(i, new EntryProcessor<Integer, String, Object>() {
-                @Override public Object process(MutableEntry<Integer, String> entry, Object... arguments)
-                    throws EntryProcessorException {
+        cache.invoke(100, new EntryProcessor<Integer, String, Object>() {
+            @Override public Object process(MutableEntry<Integer, String> entry, Object... arguments)
+                throws EntryProcessorException {
 
-                    invoked.incrementAndGet();
+                invoked.incrementAndGet();
 
-                    VersionedEntry<Integer, String> verEntry = entry.unwrap(VersionedEntry.class);
+                VersionedEntry<Integer, String> verEntry = entry.unwrap(VersionedEntry.class);
 
-                    checkVersionedEntry(verEntry);
+                checkVersionedEntry(verEntry);
 
-                    return entry;
-                }
-            });
-        }
+                return entry;
+            }
+        });
 
         assert invoked.get() > 0;
     }
@@ -119,18 +117,6 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
     /**
      * @throws Exception If failed.
      */
-    public void testIterator() throws Exception {
-        IgniteCache<Integer, String> cache = grid(0).cache(null);
-
-        Iterator<Cache.Entry<Integer, String>> entries = cache.iterator();
-
-        while (entries.hasNext())
-            checkVersionedEntry(entries.next().unwrap(VersionedEntry.class));
-    }
-
-    /**
-     * @throws Exception If failed.
-     */
     public void testLocalPeek() throws Exception {
         IgniteCache<Integer, String> cache = grid(0).cache(null);
 


[14/35] incubator-ignite git commit: Merge remote-tracking branch 'origin/ignite-946' into ignite-946

Posted by ag...@apache.org.
Merge remote-tracking branch 'origin/ignite-946' into ignite-946


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

Branch: refs/heads/ignite-264
Commit: 9f16eb165f2aad48f05cef17f608eb2898c078a3
Parents: 92e81dc 53557e3
Author: Denis Magda <dm...@gridgain.com>
Authored: Mon Aug 10 09:58:27 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Mon Aug 10 09:58:27 2015 +0300

----------------------------------------------------------------------
 .../apache/ignite/cache/version/package-info.java |  4 ++--
 .../processors/cache/CacheInvokeEntry.java        |  5 +++--
 .../cache/transactions/IgniteTxEntry.java         |  4 +++-
 .../cache/transactions/IgniteTxLocalAdapter.java  | 18 +++++++++---------
 4 files changed, 17 insertions(+), 14 deletions(-)
----------------------------------------------------------------------



[15/35] incubator-ignite git commit: ignite-946: fixed review notes

Posted by ag...@apache.org.
ignite-946: fixed review notes


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

Branch: refs/heads/ignite-264
Commit: 911ffbb5de261d662a915677b99cae4a160407eb
Parents: 9f16eb1
Author: Denis Magda <dm...@gridgain.com>
Authored: Mon Aug 10 11:39:44 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Mon Aug 10 11:39:44 2015 +0300

----------------------------------------------------------------------
 .../ignite/cache/version/VersionedEntry.java    |  2 +-
 .../processors/cache/CacheEntryImpl0.java       |  4 +-
 .../processors/cache/GridCacheMapEntry.java     |  2 +-
 .../processors/cache/GridCacheSwapManager.java  | 88 ++++++++++++--------
 .../cache/transactions/IgniteTxAdapter.java     |  2 +
 .../cache/transactions/IgniteTxEntry.java       |  2 +-
 .../transactions/IgniteTxLocalAdapter.java      |  8 ++
 .../cache/version/GridCacheVersionAware.java    | 30 +++++++
 .../cache/version/GridVersionedMapEntry.java    | 33 --------
 .../CacheVersionedEntryAbstractTest.java        |  2 +-
 10 files changed, 99 insertions(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/911ffbb5/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java b/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
index e669f15..2c0879b 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
@@ -56,7 +56,7 @@ public interface VersionedEntry<K, V> extends Cache.Entry<K, V> {
     /**
      * Versions comparator.
      */
-    public static final Comparator<VersionedEntry> VERSIONS_COMPARATOR = new Comparator<VersionedEntry>() {
+    public static final Comparator<VersionedEntry> VER_COMP = new Comparator<VersionedEntry>() {
         @Override public int compare(VersionedEntry o1, VersionedEntry o2) {
             int res = Integer.compare(o1.topologyVersion(), o2.topologyVersion());
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/911ffbb5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl0.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl0.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl0.java
index a5e27d6..987fbd3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl0.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheEntryImpl0.java
@@ -52,8 +52,8 @@ public class CacheEntryImpl0<K, V> implements Cache.Entry<K, V> {
     @Override public <T> T unwrap(Class<T> cls) {
         if(cls.isAssignableFrom(getClass()))
             return cls.cast(this);
-        else if (cls.isAssignableFrom(VersionedEntry.class) && e instanceof GridVersionedMapEntry)
-            return (T)new CacheVersionedEntryImpl<>(e.getKey(), e.getValue(), ((GridVersionedMapEntry)e).version());
+        else if (cls.isAssignableFrom(VersionedEntry.class) && e instanceof GridCacheVersionAware)
+            return (T)new CacheVersionedEntryImpl<>(e.getKey(), e.getValue(), ((GridCacheVersionAware)e).version());
 
         throw new IllegalArgumentException("Unwrapping to class is not supported: " + cls);
     }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/911ffbb5/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 43cf2fe..298f7a6 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
@@ -1385,7 +1385,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
 
                 assert entryProcessor != null;
 
-                CacheInvokeEntry<Object, Object> entry = new CacheInvokeEntry<>(cctx, key, old, this.ver);
+                CacheInvokeEntry<Object, Object> entry = new CacheInvokeEntry<>(cctx, key, old, version());
 
                 try {
                     Object computed = entryProcessor.process(entry, invokeArgs);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/911ffbb5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
index ffe6169..ea9b0fd 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
@@ -1513,41 +1513,7 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
             @Override protected Map.Entry<K, V> onNext() {
                 final Map.Entry<byte[], byte[]> cur0 = it.next();
 
-                cur = new GridVersionedMapEntry<K, V>() {
-                    @Override public K getKey() {
-                        try {
-                            KeyCacheObject key = cctx.toCacheKeyObject(cur0.getKey());
-
-                            return key.value(cctx.cacheObjectContext(), false);
-                        }
-                        catch (IgniteCheckedException e) {
-                            throw new IgniteException(e);
-                        }
-                    }
-
-                    @Override public V getValue() {
-                        try {
-                            GridCacheSwapEntry e = unmarshalSwapEntry(cur0.getValue());
-
-                            swapEntry(e);
-
-                            return e.value().value(cctx.cacheObjectContext(), false);
-                        }
-                        catch (IgniteCheckedException ex) {
-                            throw new IgniteException(ex);
-                        }
-                    }
-
-                    @Override public GridCacheVersion version() {
-                        GridCacheSwapEntry e = unmarshalSwapEntry(cur0.getValue());
-
-                        return e.version();
-                    }
-
-                    @Override public V setValue(V val) {
-                        throw new UnsupportedOperationException();
-                    }
-                };
+                cur = new GridVersionedMapEntry<K, V>(cur0);
 
                 return cur;
             }
@@ -2330,4 +2296,56 @@ public class GridCacheSwapManager extends GridCacheManagerAdapter {
          */
         abstract protected GridCloseableIterator<T1> partitionIterator(int part) throws IgniteCheckedException;
     }
+
+    private class GridVersionedMapEntry<K,V> implements Map.Entry<K,V>, GridCacheVersionAware {
+        /** */
+        private Map.Entry<byte[], byte[]> entry;
+
+        /**
+         * Constructor.
+         *
+         * @param entry Entry.
+         */
+        public GridVersionedMapEntry(Map.Entry<byte[], byte[]> entry) {
+            this.entry = entry;
+        }
+
+        /** {@inheritDoc} */
+        @Override public K getKey() {
+            try {
+                KeyCacheObject key = cctx.toCacheKeyObject(entry.getKey());
+
+                return key.value(cctx.cacheObjectContext(), false);
+            }
+            catch (IgniteCheckedException e) {
+                throw new IgniteException(e);
+            }
+        }
+
+        /** {@inheritDoc} */
+        @Override public V getValue() {
+            try {
+                GridCacheSwapEntry e = unmarshalSwapEntry(entry.getValue());
+
+                swapEntry(e);
+
+                return e.value().value(cctx.cacheObjectContext(), false);
+            }
+            catch (IgniteCheckedException ex) {
+                throw new IgniteException(ex);
+            }
+        }
+
+        /** {@inheritDoc} */
+        @Override public GridCacheVersion version() {
+            GridCacheSwapEntry e = unmarshalSwapEntry(entry.getValue());
+
+            return e.version();
+        }
+
+        /** {@inheritDoc} */
+        @Override public V setValue(V val) {
+            throw new UnsupportedOperationException();
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/911ffbb5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index 797f75e..e9fdd22 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -1234,6 +1234,8 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter
                     ver = txEntry.cached().version();
                 }
                 catch (GridCacheEntryRemovedException e) {
+                    assert optimistic() : txEntry;
+
                     if (log.isDebugEnabled())
                         log.debug("Failed to get entry version: [msg=" + e.getMessage() + ']');
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/911ffbb5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
index 73b9975..3c792f6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxEntry.java
@@ -577,7 +577,7 @@ public class IgniteTxEntry implements GridPeerDeployAware, Message {
             ver = entry.version();
         }
         catch (GridCacheEntryRemovedException e) {
-            assert tx.optimistic() : tx;
+            assert tx == null || tx.optimistic() : tx;
 
             ver = null;
         }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/911ffbb5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index a209780..b354fed 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -2236,6 +2236,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                                                 ver = entry.version();
                                             }
                                             catch (GridCacheEntryRemovedException ex) {
+                                                assert optimistic() : txEntry;
+
                                                 if (log.isDebugEnabled())
                                                     log.debug("Failed to get entry version " +
                                                         "[err=" + ex.getMessage() + ']');
@@ -2311,6 +2313,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                                 ver = entry.version();
                             }
                             catch (GridCacheEntryRemovedException e) {
+                                assert optimistic() : txEntry;
+
                                 if (log.isDebugEnabled())
                                     log.debug("Failed to get entry version: [msg=" + e.getMessage() + ']');
 
@@ -2362,6 +2366,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                                 ver = e.cached().version();
                             }
                             catch (GridCacheEntryRemovedException ex) {
+                                assert optimistic() : e;
+
                                 if (log.isDebugEnabled())
                                     log.debug("Failed to get entry version: [msg=" + ex.getMessage() + ']');
 
@@ -2489,6 +2495,8 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
                                     ver = cached.version();
                                 }
                                 catch (GridCacheEntryRemovedException e) {
+                                    assert optimistic() : txEntry;
+
                                     if (log.isDebugEnabled())
                                         log.debug("Failed to get entry version: [msg=" + e.getMessage() + ']');
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/911ffbb5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionAware.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionAware.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionAware.java
new file mode 100644
index 0000000..0c0a270
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionAware.java
@@ -0,0 +1,30 @@
+/*
+ * 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.version;
+
+/**
+ * Interface implemented by classes that holds version related information.
+ */
+public interface GridCacheVersionAware {
+    /**
+     * Gets version.
+     *
+     * @return Cache entry version.
+     */
+    public GridCacheVersion version();
+}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/911ffbb5/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridVersionedMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridVersionedMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridVersionedMapEntry.java
deleted file mode 100644
index f653fac..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridVersionedMapEntry.java
+++ /dev/null
@@ -1,33 +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.version;
-
-import java.util.*;
-
-/**
- * This interface extends {@link java.util.Map.Entry} by adding the method that returns entry's
- * {@link GridCacheVersion}.
- */
-public interface GridVersionedMapEntry<K, V> extends Map.Entry<K, V> {
-    /**
-     * Gets entry version.
-     *
-     * @return Entry version.
-     */
-    public GridCacheVersion version();
-}

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/911ffbb5/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
index 25a2a42..b121995 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
@@ -152,7 +152,7 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
                     }
             });
 
-        assert VersionedEntry.VERSIONS_COMPARATOR.compare(ver1, ver2) < 0;
+        assert VersionedEntry.VER_COMP.compare(ver1, ver2) < 0;
     }
 
     /**


[28/35] incubator-ignite git commit: When NIO server port is set to -1, we do not need to check address for null.

Posted by ag...@apache.org.
When NIO server port is set to -1, we do not need to check address for null.


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

Branch: refs/heads/ignite-264
Commit: 7290d0658aa10675095f1a0379f5c21b9bb09bc4
Parents: aed83af
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Aug 13 18:09:54 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Aug 13 18:09:54 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/internal/util/nio/GridNioServer.java  | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7290d065/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
index c180837..2d60f98 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
@@ -209,7 +209,9 @@ public class GridNioServer<T> {
         IgniteBiInClosure<GridNioSession, Integer> msgQueueLsnr,
         GridNioFilter... filters
     ) throws IgniteCheckedException {
-        A.notNull(addr, "addr");
+        if (port != -1)
+            A.notNull(addr, "addr");
+
         A.notNull(lsnr, "lsnr");
         A.notNull(log, "log");
         A.notNull(order, "order");


[18/35] incubator-ignite git commit: ignite-946: simplified VersionedEntry interface

Posted by ag...@apache.org.
ignite-946: simplified VersionedEntry interface


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

Branch: refs/heads/ignite-264
Commit: b6bef13eef82d9a2e040c01881d07c186ade372e
Parents: dd3cecf
Author: Denis Magda <dm...@gridgain.com>
Authored: Tue Aug 11 10:17:24 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Tue Aug 11 10:17:24 2015 +0300

----------------------------------------------------------------------
 .../ignite/cache/version/VersionedEntry.java    | 83 +++++++++-----------
 .../cache/version/CacheVersionedEntryImpl.java  | 23 +-----
 .../cache/version/GridCacheVersionManager.java  |  4 +-
 .../CacheVersionedEntryAbstractTest.java        |  9 +--
 4 files changed, 45 insertions(+), 74 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b6bef13e/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java b/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
index 1aac68a..135d681 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
@@ -24,7 +24,7 @@ import javax.cache.processor.*;
 import java.util.*;
 
 /**
- * Cache entry that stores entry's version related information.
+ * Cache entry that stores entry's version related information along with its data.
  *
  * To get a {@code VersionedEntry} of an {@link Cache.Entry} use {@link Cache.Entry#unwrap(Class)} by passing
  * {@code VersionedEntry} class to it as the argument.
@@ -42,62 +42,51 @@ import java.util.*;
  * is excluded from responses.
  * <h2 class="header">Java Example</h2>
  * <pre name="code" class="java">
- * Cache<Integer, String> cache = grid(0).cache(null);
+ * IgniteCache<Integer, String> cache = grid(0).cache(null);
  *
- *  cache.invoke(100, new EntryProcessor<Integer, String, Object>() {
- *      public Object process(MutableEntry<Integer, String> entry, Object... arguments) throws EntryProcessorException {
- *          VersionedEntry<Integer, String> verEntry = entry.unwrap(VersionedEntry.class);
- *          return entry;
- *       }
- *   });
+ * VersionedEntry<String, Integer> entry1 = cache.invoke(100,
+ *     new EntryProcessor<Integer, String, VersionedEntry<String, Integer>>() {
+ *          public VersionedEntry<String, Integer> process(MutableEntry<Integer, String> entry,
+ *              Object... arguments) throws EntryProcessorException {
+ *                  return entry.unwrap(VersionedEntry.class);
+ *          }
+ *     });
+ *
+ * // Cache entry for the given key may be updated at some point later.
+ *
+ * VersionedEntry<String, Integer> entry2 = cache.invoke(100,
+ *     new EntryProcessor<Integer, String, VersionedEntry<String, Integer>>() {
+ *          public VersionedEntry<String, Integer> process(MutableEntry<Integer, String> entry,
+ *              Object... arguments) throws EntryProcessorException {
+ *                  return entry.unwrap(VersionedEntry.class);
+ *          }
+ *     });
+ *
+ * if (entry1.version().compareTo(entry2.version()) < 0) {
+ *     // the entry has been updated
+ * }
  * </pre>
  */
 public interface VersionedEntry<K, V> extends Cache.Entry<K, V> {
     /**
-     * Versions comparator.
-     */
-    public static final Comparator<VersionedEntry> VER_COMP = new Comparator<VersionedEntry>() {
-        @Override public int compare(VersionedEntry o1, VersionedEntry o2) {
-            int res = Integer.compare(o1.topologyVersion(), o2.topologyVersion());
-
-            if (res != 0)
-                return res;
-
-            res = Long.compare(o1.order(), o2.order());
-
-            if (res != 0)
-                return res;
-
-            return Integer.compare(o1.nodeOrder(), o2.nodeOrder());
-        }
-    };
-
-    /**
-     * Gets the topology version at the time when the entry with a given pair of key and value has been created.
-     *
-     * @return Topology version plus number of seconds from the start time of the first grid node.
-     */
-    public int topologyVersion();
-
-    /**
-     * Gets versioned entry unique order.
-     * Each time a cache entry for a given key is updated a new {@code VersionedEntry} with increased order is created.
-     *
-     * @return Versioned entry unique order.
-     */
-    public long order();
-
-    /**
-     * Gets local node order at the time when the entry with a given pair of key and value has been created.
+     * Returns a comparable object representing the version of this cache entry.
+     * <p>
+     * It is valid to compare cache entries' versions for the same key. In this case the latter update will be
+     * represented by a higher version. The result of versions comparison of cache entries of different keys is
+     * undefined.
      *
-     * @return Local node order on which this version has been assigned.
+     * @return Version of this cache entry.
      */
-    public int nodeOrder();
+    public Comparable version();
 
     /**
-     * Gets the time when the entry with a given pair of key and value has been created.
+     * Returns the time when the cache entry for the given key has been updated or initially created.
+     * <p>
+     * It is valid to compare cache entries' update time for the same key. In this case the latter update will
+     * be represented by higher update time. The result of update time comparison of cache entries of different keys is
+     * undefined.
      *
      * @return Time in milliseconds.
      */
-    public long creationTime();
+    public long updateTime();
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b6bef13e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
index 22b699a..97b1995 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
@@ -51,30 +51,13 @@ public class CacheVersionedEntryImpl<K, V> extends CacheEntryImpl<K, V> implemen
         this.ver = ver;
     }
 
-    /**
-     * @return Version.
-     */
-    @Nullable public GridCacheVersion version() {
-        return ver;
-    }
-
-    /** {@inheritDoc} */
-    @Override public int topologyVersion() {
-        return ver.topologyOrder();
-    }
-
-    /** {@inheritDoc} */
-    @Override public int nodeOrder() {
-        return ver.nodeOrder();
-    }
-
     /** {@inheritDoc} */
-    @Override public long order() {
-        return ver.order();
+    public GridCacheVersion version() {
+        return ver;
     }
 
     /** {@inheritDoc} */
-    @Override public long creationTime() {
+    @Override public long updateTime() {
         return ver.globalTime();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b6bef13e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java
index d465a0c..85b14a4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java
@@ -224,6 +224,8 @@ public class GridCacheVersionManager extends GridCacheSharedManagerAdapter {
         if (topVer == -1)
             topVer = cctx.kernalContext().discovery().topologyVersion();
 
+        long globalTime = cctx.kernalContext().clockSync().adjustedTime(topVer);
+
         if (addTime) {
             if (gridStartTime == 0)
                 gridStartTime = cctx.kernalContext().discovery().gridStartTime();
@@ -231,8 +233,6 @@ public class GridCacheVersionManager extends GridCacheSharedManagerAdapter {
             topVer += (gridStartTime - TOP_VER_BASE_TIME) / 1000;
         }
 
-        long globalTime = cctx.kernalContext().clockSync().adjustedTime(topVer);
-
         int locNodeOrder = (int)cctx.localNode().order();
 
         if (txSerEnabled) {

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b6bef13e/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
index 0ad8038..9648b9b 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryAbstractTest.java
@@ -152,7 +152,8 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
                     }
             });
 
-        assert VersionedEntry.VER_COMP.compare(ver1, ver2) < 0;
+        assert ver1.version().compareTo(ver2.version()) < 0;
+        assert ver1.updateTime() < ver2.updateTime();
     }
 
     /**
@@ -161,10 +162,8 @@ public abstract class CacheVersionedEntryAbstractTest extends GridCacheAbstractS
     private void checkVersionedEntry(VersionedEntry<Integer, String> entry) {
         assertNotNull(entry);
 
-        assert entry.topologyVersion() > 0;
-        assert entry.order() > 0;
-        assert entry.nodeOrder() > 0;
-        assert entry.creationTime() > 0;
+        assertNotNull(entry.version());
+        assert entry.updateTime() > 0;
 
         assertNotNull(entry.getKey());
         assertNotNull(entry.getValue());


[10/35] incubator-ignite git commit: Merge branches 'ignite-946' and 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-946

Posted by ag...@apache.org.
Merge branches 'ignite-946' and 'master' of https://git-wip-us.apache.org/repos/asf/incubator-ignite into ignite-946


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

Branch: refs/heads/ignite-264
Commit: b2e6734c76f17247a2801e63547e5edcc33f770c
Parents: 2e7799d b056a73
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Tue Aug 4 16:34:17 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Tue Aug 4 16:34:17 2015 +0300

----------------------------------------------------------------------
 .../ClientAbstractMultiNodeSelfTest.java        |   4 +-
 .../JettyRestProcessorAbstractSelfTest.java     |  14 +-
 .../apache/ignite/IgniteSystemProperties.java   |   2 +-
 .../store/jdbc/CacheAbstractJdbcStore.java      |  21 +-
 .../apache/ignite/internal/IgniteKernal.java    |   2 +-
 .../org/apache/ignite/internal/IgnitionEx.java  |  43 +-
 .../managers/communication/GridIoManager.java   | 188 +++++++-
 .../processors/cache/GridCacheMvccManager.java  |  73 +--
 .../processors/cache/GridCacheProcessor.java    |   2 +-
 .../processors/cache/GridCacheProxyImpl.java    |  42 +-
 .../processors/cache/GridCacheSwapManager.java  |   2 +-
 .../GridDhtPartitionsExchangeFuture.java        |  20 +-
 .../distributed/near/GridNearGetFuture.java     |  20 +-
 .../handlers/query/QueryCommandHandler.java     |   6 +-
 .../ignite/internal/util/IgniteUtils.java       |  16 +
 .../util/nio/GridCommunicationClient.java       |   5 +-
 .../util/nio/GridNioFinishedFuture.java         |  12 +
 .../ignite/internal/util/nio/GridNioFuture.java |  14 +
 .../internal/util/nio/GridNioFutureImpl.java    |  15 +
 .../util/nio/GridNioRecoveryDescriptor.java     |  13 +-
 .../ignite/internal/util/nio/GridNioServer.java |   5 +
 .../util/nio/GridNioSessionMetaKey.java         |   5 +-
 .../util/nio/GridShmemCommunicationClient.java  |   7 +-
 .../util/nio/GridTcpNioCommunicationClient.java |  14 +-
 .../communication/tcp/TcpCommunicationSpi.java  |  84 +++-
 .../ignite/spi/discovery/tcp/ClientImpl.java    |   2 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    |  45 +-
 .../spi/discovery/tcp/TcpDiscoverySpi.java      |   2 +-
 .../src/test/config/io-manager-benchmark.xml    |   3 +-
 .../GridJobMasterLeaveAwareSelfTest.java        |  10 +-
 .../IgniteClientReconnectAbstractTest.java      |   5 +-
 .../IgniteClientReconnectCacheTest.java         |   5 +-
 .../GridDeploymentMessageCountSelfTest.java     |   5 +-
 .../cache/CacheStopAndDestroySelfTest.java      |   8 +-
 .../GridCacheAtomicMessageCountSelfTest.java    |   6 +-
 .../processors/cache/GridCacheMvccSelfTest.java |   1 -
 ...ridCacheReplicatedSynchronousCommitTest.java |   5 +-
 .../IgniteCacheAbstractStopBusySelfTest.java    |   6 +-
 .../cache/IgniteCacheNearLockValueSelfTest.java |   6 +-
 ...eDynamicCacheStartNoExchangeTimeoutTest.java |   4 +-
 .../cache/IgniteTxReentryAbstractSelfTest.java  |   5 +-
 ...niteCacheClientNodeChangingTopologyTest.java |   6 +-
 ...teCacheClientNodePartitionsExchangeTest.java |   4 +-
 .../IgniteCacheNearOffheapGetSelfTest.java      | 131 ++++++
 ...xOriginatingNodeFailureAbstractSelfTest.java |   6 +-
 ...cOriginatingNodeFailureAbstractSelfTest.java |   6 +-
 .../GridCacheDhtPreloadMessageCountTest.java    |   5 +-
 ...ePrimaryNodeFailureRecoveryAbstractTest.java |   6 +-
 ...eAtomicInvalidPartitionHandlingSelfTest.java |   5 +-
 .../near/IgniteCacheNearTxRollbackTest.java     |   6 +-
 .../GridCacheReplicatedInvalidateSelfTest.java  |   6 +-
 ...CommunicationRecoveryAckClosureSelfTest.java | 464 +++++++++++++++++++
 .../tcp/TcpDiscoveryMultiThreadedTest.java      |   8 +-
 .../testsuites/IgniteCacheTestSuite2.java       |   1 +
 .../IgniteSpiCommunicationSelfTestSuite.java    |   1 +
 .../ignite/util/TestTcpCommunicationSpi.java    |   6 +-
 ...CacheScanPartitionQueryFallbackSelfTest.java |  15 +-
 .../http/jetty/GridJettyRestHandler.java        |  12 +-
 .../parser/dialect/OracleMetadataDialect.java   |   4 +-
 .../src/test/java/config/ignite-test-config.xml |  43 ++
 .../ignite/internal/GridFactorySelfTest.java    |   9 +
 .../visor/commands/kill/VisorKillCommand.scala  |   2 +-
 62 files changed, 1241 insertions(+), 252 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/b2e6734c/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java
----------------------------------------------------------------------


[22/35] incubator-ignite git commit: Fixed error message

Posted by ag...@apache.org.
Fixed error message


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

Branch: refs/heads/ignite-264
Commit: 653c0b28d340a37893741b0d381a63330732fd10
Parents: d5986c2
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Wed Aug 12 16:54:47 2015 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Wed Aug 12 16:54:47 2015 -0700

----------------------------------------------------------------------
 .../ignite/internal/processors/cache/GridCacheGateway.java      | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/653c0b28/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGateway.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGateway.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGateway.java
index a3c8da6..93c5858 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGateway.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheGateway.java
@@ -156,8 +156,7 @@ public class GridCacheGateway<K, V> {
             GridCachePreloader preldr = cache != null ? cache.preloader() : null;
 
             if (preldr == null)
-                throw new IllegalStateException("Grid is in invalid state to perform this operation. " +
-                    "It either not started yet or has already being or have stopped [gridName=" + ctx.gridName() + ']');
+                throw new IllegalStateException("Cache has been closed: " + ctx.name());
 
             preldr.startFuture().get();
         }
@@ -177,7 +176,7 @@ public class GridCacheGateway<K, V> {
         try {
             return setOperationContextPerCall(opCtx);
         }
-        catch (RuntimeException e) {
+        catch (Throwable e) {
             rwLock.readUnlock();
 
             throw e;


[07/35] incubator-ignite git commit: IGNITE-946 Added test to Suite.

Posted by ag...@apache.org.
IGNITE-946 Added test to Suite.


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

Branch: refs/heads/ignite-264
Commit: f0fe0769751b7957a64fc5dd56989e54f1223ab1
Parents: 26144dc
Author: nikolay_tikhonov <nt...@gridgain.com>
Authored: Fri Jul 31 13:00:09 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Jul 31 15:49:13 2015 +0300

----------------------------------------------------------------------
 .../java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/f0fe0769/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
index 3ac7879..228be92 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite4.java
@@ -164,7 +164,7 @@ public class IgniteCacheTestSuite4 extends TestSuite {
         suite.addTestSuite(CacheVersionedEntryReplicatedAtomicSelfTest.class);
         suite.addTestSuite(CacheVersionedEntryReplicatedTransactionalSelfTest.class);
         suite.addTestSuite(CacheVersionedEntryReplicatedAtomicOffHeapSelfTest.class);
-        suite.addTestSuite(CacheVersionedEntryPartitionedTransactionalOffHeapSelfTest.class);
+        suite.addTestSuite(CacheVersionedEntryReplicatedTransactionalOffHeapSelfTest.class);
 
         return suite;
     }


[25/35] incubator-ignite git commit: Merge remote-tracking branch 'remotes/origin/master' into ignite-946

Posted by ag...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-946


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

Branch: refs/heads/ignite-264
Commit: 51a9bd85e5cb7cb38fcc60b7adf808fe0545e7df
Parents: 4f8f32a 36f7ba6
Author: Denis Magda <dm...@gridgain.com>
Authored: Thu Aug 13 09:12:26 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Thu Aug 13 09:12:26 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheGateway.java      |  5 +-
 .../ignite/spi/discovery/tcp/ServerImpl.java    | 91 +++++++++++++-------
 2 files changed, 62 insertions(+), 34 deletions(-)
----------------------------------------------------------------------



[06/35] incubator-ignite git commit: ignite-946: added documentation

Posted by ag...@apache.org.
ignite-946: added documentation


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

Branch: refs/heads/ignite-264
Commit: 4928d99d80a837843ce733eab546a3ea6aa3c2d3
Parents: 2d200a3
Author: Denis Magda <dm...@gridgain.com>
Authored: Fri Jul 31 12:14:54 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Jul 31 15:49:12 2015 +0300

----------------------------------------------------------------------
 .../ignite/cache/version/VersionedEntry.java    | 31 +++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4928d99d/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java b/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
index 6f9d8f6..e669f15 100644
--- a/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/cache/version/VersionedEntry.java
@@ -17,11 +17,40 @@
 
 package org.apache.ignite.cache.version;
 
+import org.apache.ignite.*;
+
 import javax.cache.*;
+import javax.cache.processor.*;
 import java.util.*;
 
 /**
- * Cache entry along with version information.
+ * Cache entry that stores entry's version related information.
+ *
+ * To get a {@code VersionedEntry} of an {@link Cache.Entry} use {@link Cache.Entry#unwrap(Class)} by passing
+ * {@code VersionedEntry} class to it as the argument.
+ * <p>
+ * {@code VersionedEntry} is supported only for {@link Cache.Entry} returned by one of the following methods:
+ * <ul>
+ * <li>{@link Cache#invoke(Object, EntryProcessor, Object...)}</li>
+ * <li>{@link Cache#invokeAll(Set, EntryProcessor, Object...)}</li>
+ * <li>invoke and invokeAll methods of {@link IgniteCache}</li>
+ * <li>{@link IgniteCache#randomEntry()}</li>
+ * </ul>
+ * <p>
+ * {@code VersionedEntry} is not supported for {@link Cache#iterator()} because of performance reasons.
+ * {@link Cache#iterator()} loads entries from all the cluster nodes and to speed up the load version information
+ * is excluded from responses.
+ * <h2 class="header">Java Example</h2>
+ * <pre name="code" class="java">
+ * Cache<Integer, String> cache = grid(0).cache(null);
+ *
+ *  cache.invoke(100, new EntryProcessor<Integer, String, Object>() {
+ *      public Object process(MutableEntry<Integer, String> entry, Object... arguments) throws EntryProcessorException {
+ *          VersionedEntry<Integer, String> verEntry = entry.unwrap(VersionedEntry.class);
+ *          return entry;
+ *       }
+ *   });
+ * </pre>
  */
 public interface VersionedEntry<K, V> extends Cache.Entry<K, V> {
     /**


[03/35] incubator-ignite git commit: ignite-946: improving tests

Posted by ag...@apache.org.
ignite-946: improving tests


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

Branch: refs/heads/ignite-264
Commit: 719161f2d02dd1c589155800f60e02f86c469de4
Parents: 4b9f4ba
Author: Denis Magda <dm...@gridgain.com>
Authored: Fri Jul 31 10:20:22 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Jul 31 15:49:11 2015 +0300

----------------------------------------------------------------------
 .../internal/processors/cache/query/GridCacheQueryManager.java      | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/719161f2/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
index 400d997..5d3f6a3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java
@@ -845,7 +845,6 @@ public abstract class GridCacheQueryManager<K, V> extends GridCacheManagerAdapte
 
                         try {
                             val = prj.localPeek(key, CachePeekModes.ONHEAP_ONLY, expiryPlc);
-
                         }
                         catch (IgniteCheckedException e) {
                             if (log.isDebugEnabled())


[12/35] incubator-ignite git commit: review

Posted by ag...@apache.org.
review


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

Branch: refs/heads/ignite-264
Commit: 53557e327721fee683b9b37217d530db44166aec
Parents: fe2be79
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Aug 5 10:15:52 2015 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Aug 5 10:15:52 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/transactions/IgniteTxLocalAdapter.java        | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/53557e32/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
index e03f34d..a209780 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxLocalAdapter.java
@@ -1937,7 +1937,7 @@ public abstract class IgniteTxLocalAdapter extends IgniteTxAdapter
         GridCacheContext cacheCtx,
         Map<KeyCacheObject, GridCacheDrInfo> drMap
     ) {
-        return putAllAsync0(cacheCtx,
+        return this.<Object, Object>putAllAsync0(cacheCtx,
             null,
             null,
             null,


[31/35] incubator-ignite git commit: JavaDoc fix

Posted by ag...@apache.org.
JavaDoc fix


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

Branch: refs/heads/ignite-264
Commit: 260238e041c66a02f2552692bab2f44a923f7d41
Parents: ba3abce
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Thu Aug 13 15:50:48 2015 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Thu Aug 13 15:50:48 2015 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/ignite/internal/IgnitionEx.java  | 10 +++++-----
 .../src/main/java/org/apache/ignite/IgniteSpring.java     |  8 ++++----
 2 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/260238e0/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
index 3790703..fd74745 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
@@ -429,7 +429,7 @@ public class IgnitionEx {
      * @param springCtx Optional Spring application context, possibly {@code null}.
      *      Spring bean definitions for bean injection are taken from this context.
      *      If provided, this context can be injected into grid tasks and grid jobs using
-     *      {@link SpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation.
+     *      {@link SpringApplicationContextResource @SpringApplicationContextResource} annotation.
      * @return Started grid.
      * @throws IgniteCheckedException If default grid could not be started. This exception will be thrown
      *      also if default grid has already been started.
@@ -466,7 +466,7 @@ public class IgnitionEx {
      * @param springCtx Optional Spring application context, possibly {@code null}.
      *      Spring bean definitions for bean injection are taken from this context.
      *      If provided, this context can be injected into grid tasks and grid jobs using
-     *      {@link SpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation.
+     *      {@link SpringApplicationContextResource @SpringApplicationContextResource} annotation.
      * @return Started grid.
      * @throws IgniteCheckedException If grid could not be started. This exception will be thrown
      *      also if named grid has already been started.
@@ -642,7 +642,7 @@ public class IgnitionEx {
      * @param springCtx Optional Spring application context, possibly {@code null}.
      *      Spring bean definitions for bean injection are taken from this context.
      *      If provided, this context can be injected into grid tasks and grid jobs using
-     *      {@link SpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation.
+     *      {@link SpringApplicationContextResource @SpringApplicationContextResource} annotation.
      * @return Started grid. If Spring configuration contains multiple grid instances,
      *      then the 1st found instance is returned.
      * @throws IgniteCheckedException If grid could not be started or configuration
@@ -690,7 +690,7 @@ public class IgnitionEx {
      * @param springCtx Optional Spring application context, possibly {@code null}.
      *      Spring bean definitions for bean injection are taken from this context.
      *      If provided, this context can be injected into grid tasks and grid jobs using
-     *      {@link SpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation.
+     *      {@link SpringApplicationContextResource @SpringApplicationContextResource} annotation.
      * @return Started grid. If Spring configuration contains multiple grid instances,
      *      then the 1st found instance is returned.
      * @throws IgniteCheckedException If grid could not be started or configuration
@@ -769,7 +769,7 @@ public class IgnitionEx {
      * @param springCtx Optional Spring application context, possibly {@code null}.
      *      Spring bean definitions for bean injection are taken from this context.
      *      If provided, this context can be injected into grid tasks and grid jobs using
-     *      {@link SpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation.
+     *      {@link SpringApplicationContextResource @SpringApplicationContextResource} annotation.
      * @return Started grid. If Spring configuration contains multiple grid instances,
      *      then the 1st found instance is returned.
      * @throws IgniteCheckedException If grid could not be started or configuration

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/260238e0/modules/spring/src/main/java/org/apache/ignite/IgniteSpring.java
----------------------------------------------------------------------
diff --git a/modules/spring/src/main/java/org/apache/ignite/IgniteSpring.java b/modules/spring/src/main/java/org/apache/ignite/IgniteSpring.java
index 0fa6a1c..7d673df 100644
--- a/modules/spring/src/main/java/org/apache/ignite/IgniteSpring.java
+++ b/modules/spring/src/main/java/org/apache/ignite/IgniteSpring.java
@@ -27,7 +27,7 @@ import java.net.*;
 
 /**
  * Factory methods to start Ignite with optional Spring application context, this context can be injected into
- * grid tasks and grid jobs using {@link org.apache.ignite.resources.SpringApplicationContextResource @IgniteSpringApplicationContextResource}
+ * grid tasks and grid jobs using {@link org.apache.ignite.resources.SpringApplicationContextResource @SpringApplicationContextResource}
  * annotation.
  * <p>
  * You can also instantiate grid directly from Spring without using {@code Ignite}.
@@ -42,7 +42,7 @@ public class IgniteSpring {
      * @param springCtx Optional Spring application context, possibly {@code null}.
      *      Spring bean definitions for bean injection are taken from this context.
      *      If provided, this context can be injected into grid tasks and grid jobs using
-     *      {@link org.apache.ignite.resources.SpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation.
+     *      {@link org.apache.ignite.resources.SpringApplicationContextResource @SpringApplicationContextResource} annotation.
      * @return Started grid.
      * @throws IgniteCheckedException If default grid could not be started. This exception will be thrown
      *      also if default grid has already been started.
@@ -58,7 +58,7 @@ public class IgniteSpring {
      * @param springCtx Optional Spring application context, possibly {@code null}.
      *      Spring bean definitions for bean injection are taken from this context.
      *      If provided, this context can be injected into grid tasks and grid jobs using
-     *      {@link org.apache.ignite.resources.SpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation.
+     *      {@link org.apache.ignite.resources.SpringApplicationContextResource @SpringApplicationContextResource} annotation.
      * @return Started grid.
      * @throws IgniteCheckedException If grid could not be started. This exception will be thrown
      *      also if named grid has already been started.
@@ -80,7 +80,7 @@ public class IgniteSpring {
      * @param springCtx Optional Spring application context, possibly {@code null}.
      *      Spring bean definitions for bean injection are taken from this context.
      *      If provided, this context can be injected into grid tasks and grid jobs using
-     *      {@link org.apache.ignite.resources.SpringApplicationContextResource @IgniteSpringApplicationContextResource} annotation.
+     *      {@link org.apache.ignite.resources.SpringApplicationContextResource @SpringApplicationContextResource} annotation.
      * @return Started grid. If Spring configuration contains multiple grid instances,
      *      then the 1st found instance is returned.
      * @throws IgniteCheckedException If grid could not be started or configuration


[27/35] incubator-ignite git commit: # Register client continuous listeners on node join

Posted by ag...@apache.org.
 # Register client continuous listeners on node join


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

Branch: refs/heads/ignite-264
Commit: 35e3e4e048fa34b5b23ebd0ae235424f3e3492d9
Parents: aed83af
Author: sboikov <sb...@gridgain.com>
Authored: Thu Aug 13 17:37:00 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Thu Aug 13 17:37:00 2015 +0300

----------------------------------------------------------------------
 .../continuous/GridContinuousProcessor.java     | 44 ++++++++++++++++----
 .../IgniteCacheContinuousQueryClientTest.java   | 33 ++++++++++++---
 .../IgniteCacheQuerySelfTestSuite.java          |  1 +
 scripts/git-format-patch.sh                     |  2 +-
 4 files changed, 66 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/35e3e4e0/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
index daa9494..5f1c4bb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
@@ -193,10 +193,10 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
                         unregisterRemote(routineId);
 
                         if (snd.isClient()) {
-                            Map<UUID, LocalRoutineInfo> infoMap = clientInfos.get(snd.id());
+                            Map<UUID, LocalRoutineInfo> clientRoutineMap = clientInfos.get(snd.id());
 
-                            if (infoMap != null)
-                                infoMap.remove(msg.routineId());
+                            if (clientRoutineMap != null)
+                                clientRoutineMap.remove(msg.routineId());
                         }
                     }
                 }
@@ -370,6 +370,34 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
             }
 
             for (Map.Entry<UUID, Map<UUID, LocalRoutineInfo>> entry : data.clientInfos.entrySet()) {
+                UUID clientNodeId = entry.getKey();
+
+                Map<UUID, LocalRoutineInfo> clientRoutineMap = entry.getValue();
+
+                for (Map.Entry<UUID, LocalRoutineInfo> e : clientRoutineMap.entrySet()) {
+                    UUID routineId = e.getKey();
+                    LocalRoutineInfo info = e.getValue();
+
+                    try {
+                        if (info.prjPred != null)
+                            ctx.resource().injectGeneric(info.prjPred);
+
+                        if (info.prjPred == null || info.prjPred.apply(ctx.discovery().localNode())) {
+                            if (registerHandler(clientNodeId,
+                                routineId,
+                                info.hnd,
+                                info.bufSize,
+                                info.interval,
+                                info.autoUnsubscribe,
+                                false))
+                                info.hnd.onListenerRegistered(routineId, ctx);
+                        }
+                    }
+                    catch (IgniteCheckedException err) {
+                        U.error(log, "Failed to register continuous handler.", err);
+                    }
+                }
+
                 Map<UUID, LocalRoutineInfo> map = clientInfos.get(entry.getKey());
 
                 if (map == null) {
@@ -723,17 +751,17 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
         }
 
         if (node.isClient()) {
-            Map<UUID, LocalRoutineInfo> clientRouteMap = clientInfos.get(node.id());
+            Map<UUID, LocalRoutineInfo> clientRoutineMap = clientInfos.get(node.id());
 
-            if (clientRouteMap == null) {
-                clientRouteMap = new HashMap<>();
+            if (clientRoutineMap == null) {
+                clientRoutineMap = new HashMap<>();
 
-                Map<UUID, LocalRoutineInfo> old = clientInfos.put(node.id(), clientRouteMap);
+                Map<UUID, LocalRoutineInfo> old = clientInfos.put(node.id(), clientRoutineMap);
 
                 assert old == null;
             }
 
-            clientRouteMap.put(routineId, new LocalRoutineInfo(data.projectionPredicate(),
+            clientRoutineMap.put(routineId, new LocalRoutineInfo(data.projectionPredicate(),
                 hnd,
                 data.bufferSize(),
                 data.interval(),

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/35e3e4e0/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryClientTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryClientTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryClientTest.java
index bb413a0..d66d1d0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryClientTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/IgniteCacheContinuousQueryClientTest.java
@@ -20,7 +20,9 @@ package org.apache.ignite.internal.processors.cache.query.continuous;
 import org.apache.ignite.*;
 import org.apache.ignite.cache.query.*;
 import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.resources.*;
+import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
 import org.apache.ignite.testframework.junits.common.*;
@@ -38,7 +40,7 @@ import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
  */
 public class IgniteCacheContinuousQueryClientTest extends GridCommonAbstractTest {
     /** */
-    protected static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+    private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
 
     /** */
     private boolean client;
@@ -47,6 +49,8 @@ public class IgniteCacheContinuousQueryClientTest extends GridCommonAbstractTest
     @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
         IgniteConfiguration cfg = super.getConfiguration(gridName);
 
+        ((TcpDiscoverySpi)cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
         CacheConfiguration ccfg = new CacheConfiguration();
 
         ccfg.setCacheMode(PARTITIONED);
@@ -60,6 +64,13 @@ public class IgniteCacheContinuousQueryClientTest extends GridCommonAbstractTest
         return cfg;
     }
 
+    /** {@inheritDoc} */
+    @Override protected void afterTest() throws Exception {
+        super.afterTest();
+
+        stopAllGrids();
+    }
+
     /**
      * @throws Exception If failed.
      */
@@ -80,15 +91,27 @@ public class IgniteCacheContinuousQueryClientTest extends GridCommonAbstractTest
 
         QueryCursor<?> cur = clientNode.cache(null).query(qry);
 
-        Ignite joined = startGrid(4);
+        Ignite joined1 = startGrid(4);
 
-        IgniteCache<Object, Object> joinedCache = joined.cache(null);
+        IgniteCache<Object, Object> joinedCache1 = joined1.cache(null);
 
-        joinedCache.put(primaryKey(joinedCache), 1);
+        joinedCache1.put(primaryKey(joinedCache1), 1);
 
         assertTrue("Failed to wait for event.", lsnr.latch.await(5, SECONDS));
 
         cur.close();
+
+        lsnr.latch = new CountDownLatch(1);
+
+        Ignite joined2 = startGrid(5);
+
+        IgniteCache<Object, Object> joinedCache2 = joined2.cache(null);
+
+        joinedCache2.put(primaryKey(joinedCache2), 2);
+
+        U.sleep(1000);
+
+        assertEquals("Unexpected event received.", 1, lsnr.latch.getCount());
     }
 
     /**
@@ -96,7 +119,7 @@ public class IgniteCacheContinuousQueryClientTest extends GridCommonAbstractTest
      */
     private static class CacheEventListener implements CacheEntryUpdatedListener<Object, Object> {
         /** */
-        private final CountDownLatch latch = new CountDownLatch(1);
+        private volatile CountDownLatch latch = new CountDownLatch(1);
 
         /** */
         @LoggerResource

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/35e3e4e0/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
index 2d7d0ce..a3849d7 100644
--- a/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
+++ b/modules/indexing/src/test/java/org/apache/ignite/testsuites/IgniteCacheQuerySelfTestSuite.java
@@ -98,6 +98,7 @@ public class IgniteCacheQuerySelfTestSuite extends TestSuite {
         suite.addTestSuite(GridCacheContinuousQueryAtomicSelfTest.class);
         suite.addTestSuite(GridCacheContinuousQueryAtomicNearEnabledSelfTest.class);
         suite.addTestSuite(GridCacheContinuousQueryAtomicP2PDisabledSelfTest.class);
+        suite.addTestSuite(IgniteCacheContinuousQueryClientTest.class);
 
         // Reduce fields queries.
         suite.addTestSuite(GridCacheReduceFieldsQueryLocalSelfTest.class);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/35e3e4e0/scripts/git-format-patch.sh
----------------------------------------------------------------------
diff --git a/scripts/git-format-patch.sh b/scripts/git-format-patch.sh
index b11c73d..83aee3e 100755
--- a/scripts/git-format-patch.sh
+++ b/scripts/git-format-patch.sh
@@ -20,7 +20,7 @@
 # Git patch-file maker.
 #
 echo 'Usage: scripts/git-format-patch.sh [-ih|--ignitehome <path>] [-idb|--ignitedefbranch <branch-name>] [-ph|--patchhome <path>]'
-echo 'It is a script to create patch between Current branch (branch with changes) and Default branche. The script is safe and do not broke or lose your changes.'
+echo 'It is a script to create patch between Current branch (branch with changes) and Default branch. The script is safe and does not break or lose your changes.'
 echo "It should be called from IGNITE_HOME directory."
 echo "Patch will be created at PATCHES_HOME (= IGNITE_HOME, by default) between Default branch (IGNITE_DEFAULT_BRANCH) and Current branch."
 echo "Note: you can use ${IGNITE_HOME}/scripts/git-patch-prop-local.sh to set your own local properties (to rewrite settings at git-patch-prop-local.sh). "


[08/35] incubator-ignite git commit: ignite-946: formatting fixes

Posted by ag...@apache.org.
ignite-946: formatting fixes


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

Branch: refs/heads/ignite-264
Commit: 26144dc4f845af7533cc645d898202b80c0a29f6
Parents: 4928d99
Author: Denis Magda <dm...@gridgain.com>
Authored: Fri Jul 31 12:18:58 2015 +0300
Committer: nikolay_tikhonov <nt...@gridgain.com>
Committed: Fri Jul 31 15:49:13 2015 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheMapEntry.java     | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/26144dc4/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 45ff619..ebcb908 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
@@ -609,16 +609,16 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
         @Nullable IgniteCacheExpiryPolicy expirePlc)
         throws IgniteCheckedException, GridCacheEntryRemovedException {
         return innerGet0(tx,
-                         readSwap,
-                         readThrough,
-                         evt,
-                         unmarshal,
-                         updateMetrics,
-                         tmp,
-                         subjId,
-                         transformClo,
-                         taskName,
-                         expirePlc);
+            readSwap,
+            readThrough,
+            evt,
+            unmarshal,
+            updateMetrics,
+            tmp,
+            subjId,
+            transformClo,
+            taskName,
+            expirePlc);
     }
 
     /** {@inheritDoc} */


[20/35] incubator-ignite git commit: ignite-946: reverted renaming topVer to avoid breaking compatibility

Posted by ag...@apache.org.
ignite-946: reverted renaming topVer to avoid breaking compatibility


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

Branch: refs/heads/ignite-264
Commit: 954c4591c95b7625042657f7a7311f4ea0f17c19
Parents: 801d6df
Author: Denis Magda <dm...@gridgain.com>
Authored: Tue Aug 11 15:00:47 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Tue Aug 11 15:00:47 2015 +0300

----------------------------------------------------------------------
 .../cache/GridCacheAtomicVersionComparator.java |  4 +--
 .../processors/cache/GridCacheMapEntry.java     |  2 +-
 .../processors/cache/GridCacheUtils.java        |  2 +-
 .../cache/transactions/IgniteTxManager.java     |  2 +-
 .../cache/version/CacheVersionedEntryImpl.java  |  4 +--
 .../version/GridCachePlainVersionedEntry.java   |  2 +-
 .../version/GridCacheRawVersionedEntry.java     |  2 +-
 .../cache/version/GridCacheVersion.java         | 26 ++++++++++----------
 .../cache/version/GridCacheVersionManager.java  |  4 +--
 .../ignite/internal/util/IgniteUtils.java       |  4 +--
 .../cache/GridCacheEntryVersionSelfTest.java    |  4 +--
 11 files changed, 28 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/954c4591/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicVersionComparator.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicVersionComparator.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicVersionComparator.java
index 45288d9..3a06100 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicVersionComparator.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicVersionComparator.java
@@ -32,8 +32,8 @@ public class GridCacheAtomicVersionComparator {
      * @return Comparison value.
      */
     public int compare(GridCacheVersion one, GridCacheVersion other, boolean ignoreTime) {
-        int topVer = one.topologyOrder();
-        int otherTopVer = other.topologyOrder();
+        int topVer = one.topologyVersion();
+        int otherTopVer = other.topologyVersion();
 
         if (topVer == otherTopVer) {
             long globalTime = one.globalTime();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/954c4591/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 33c42c4..298f7a6 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
@@ -1927,7 +1927,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
 
             // Incorporate conflict version into new version if needed.
             if (conflictVer != null && conflictVer != newVer)
-                newVer = new GridCacheVersionEx(newVer.topologyOrder(),
+                newVer = new GridCacheVersionEx(newVer.topologyVersion(),
                     newVer.globalTime(),
                     newVer.order(),
                     newVer.nodeOrder(),

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/954c4591/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index 75f1dee..a313e3d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -1060,7 +1060,7 @@ public class GridCacheUtils {
 
         byte[] bytes = new byte[28];
 
-        U.intToBytes(ver.topologyOrder(), bytes, 0);
+        U.intToBytes(ver.topologyVersion(), bytes, 0);
         U.longToBytes(ver.globalTime(), bytes, 4);
         U.longToBytes(ver.order(), bytes, 12);
         U.intToBytes(ver.nodeOrderAndDrIdRaw(), bytes, 20);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/954c4591/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
index 446002e..630330e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
@@ -2098,7 +2098,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
          * @param nearVer Near transaction version.
          */
         private CommittedVersion(GridCacheVersion ver, GridCacheVersion nearVer) {
-            super(ver.topologyOrder(), ver.globalTime(), ver.order(), ver.nodeOrder(), ver.dataCenterId());
+            super(ver.topologyVersion(), ver.globalTime(), ver.order(), ver.nodeOrder(), ver.dataCenterId());
 
             assert nearVer != null;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/954c4591/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
index 97b1995..c036bc1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
@@ -77,7 +77,7 @@ public class CacheVersionedEntryImpl<K, V> extends CacheEntryImpl<K, V> implemen
 
     /** {@inheritDoc} */
     public String toString() {
-        return "VersionedEntry [key=" + getKey() + ", val=" + getValue() + ", topVer=" + ver.topologyOrder() +
-            ", nodeOrder=" + ver.nodeOrder() + ", order=" + ver.order() + ", creationTime=" + ver.globalTime() + ']';
+        return "VersionedEntry [key=" + getKey() + ", val=" + getValue() + ", topVer=" + ver.topologyVersion() +
+            ", nodeOrder=" + ver.nodeOrder() + ", order=" + ver.order() + ", updateTime=" + ver.globalTime() + ']';
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/954c4591/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java
index 102805c..4f13ae7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java
@@ -101,7 +101,7 @@ public class GridCachePlainVersionedEntry<K, V> implements GridCacheVersionedEnt
 
     /** {@inheritDoc} */
     @Override public int topologyVersion() {
-        return ver.topologyOrder();
+        return ver.topologyVersion();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/954c4591/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
index f8d33f6..87fe976 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
@@ -155,7 +155,7 @@ public class GridCacheRawVersionedEntry<K, V> extends DataStreamerEntry implemen
 
     /** {@inheritDoc} */
     @Override public int topologyVersion() {
-        return ver.topologyOrder();
+        return ver.topologyVersion();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/954c4591/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
index 7adfa2e..8df54c8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
@@ -42,7 +42,7 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
     private static final int DR_ID_MASK = 0x1F;
 
     /** Topology version. */
-    private int topOrder;
+    private int topVer;
 
     /** Node order (used as global order) and DR ID. */
     private int nodeOrderDrId;
@@ -76,7 +76,7 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
         if (nodeOrder > NODE_ORDER_MASK)
             throw new IllegalArgumentException("Node order overflow: " + nodeOrder);
 
-        this.topOrder = topVer;
+        this.topVer = topVer;
         this.globalTime = globalTime;
         this.order = order;
 
@@ -91,7 +91,7 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
      * @param order Version order.
      */
     public GridCacheVersion(int topVer, int nodeOrderDrId, long globalTime, long order) {
-        this.topOrder = topVer;
+        this.topVer = topVer;
         this.nodeOrderDrId = nodeOrderDrId;
         this.globalTime = globalTime;
         this.order = order;
@@ -100,8 +100,8 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
     /**
      * @return Topology version plus number of seconds from the start time of the first grid node..
      */
-    public int topologyOrder() {
-        return topOrder;
+    public int topologyVersion() {
+        return topVer;
     }
 
     /**
@@ -184,12 +184,12 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
      * @return Version represented as {@code GridUuid}
      */
     public IgniteUuid asGridUuid() {
-        return new IgniteUuid(new UUID(((long)topOrder << 32) | nodeOrderDrId, globalTime), order);
+        return new IgniteUuid(new UUID(((long)topVer << 32) | nodeOrderDrId, globalTime), order);
     }
 
     /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeInt(topOrder);
+        out.writeInt(topVer);
         out.writeLong(globalTime);
         out.writeLong(order);
         out.writeInt(nodeOrderDrId);
@@ -197,7 +197,7 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
 
     /** {@inheritDoc} */
     @Override public void readExternal(ObjectInput in) throws IOException {
-        topOrder = in.readInt();
+        topVer = in.readInt();
         globalTime = in.readLong();
         order = in.readLong();
         nodeOrderDrId = in.readInt();
@@ -213,12 +213,12 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
 
         GridCacheVersion that = (GridCacheVersion)o;
 
-        return topOrder == that.topOrder && order == that.order && nodeOrder() == that.nodeOrder();
+        return topVer == that.topVer && order == that.order && nodeOrder() == that.nodeOrder();
     }
 
     /** {@inheritDoc} */
     @Override public int hashCode() {
-        int res = topOrder;
+        int res = topVer;
 
         res = 31 * res + nodeOrder();
 
@@ -230,7 +230,7 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
     /** {@inheritDoc} */
     @SuppressWarnings("IfMayBeConditional")
     @Override public int compareTo(GridCacheVersion other) {
-        int res = Integer.compare(topologyOrder(), other.topologyOrder());
+        int res = Integer.compare(topologyVersion(), other.topologyVersion());
 
         if (res != 0)
             return res;
@@ -274,7 +274,7 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
                 writer.incrementState();
 
             case 3:
-                if (!writer.writeInt("topVer", topOrder))
+                if (!writer.writeInt("topVer", topVer))
                     return false;
 
                 writer.incrementState();
@@ -317,7 +317,7 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
                 reader.incrementState();
 
             case 3:
-                topOrder = reader.readInt("topVer");
+                topVer = reader.readInt("topVer");
 
                 if (!reader.isLastRead())
                     return false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/954c4591/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java
index 85b14a4..ecf79c9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java
@@ -196,7 +196,7 @@ public class GridCacheVersionManager extends GridCacheSharedManagerAdapter {
      * @return Next version for cache store operations.
      */
     public GridCacheVersion nextForLoad(GridCacheVersion ver) {
-        return next(ver.topologyOrder(), false, true);
+        return next(ver.topologyVersion(), false, true);
     }
 
     /**
@@ -206,7 +206,7 @@ public class GridCacheVersionManager extends GridCacheSharedManagerAdapter {
      * @return Next version based on given cache version.
      */
     public GridCacheVersion next(GridCacheVersion ver) {
-        return next(ver.topologyOrder(), false, false);
+        return next(ver.topologyVersion(), false, false);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/954c4591/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index a1c40f4..f8c4c7e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -8705,7 +8705,7 @@ public abstract class IgniteUtils {
 
             assert drVer != null;
 
-            UNSAFE.putInt(arr, off, drVer.topologyOrder());
+            UNSAFE.putInt(arr, off, drVer.topologyVersion());
 
             off += 4;
 
@@ -8722,7 +8722,7 @@ public abstract class IgniteUtils {
             off += 8;
         }
 
-        UNSAFE.putInt(arr, off, ver.topologyOrder());
+        UNSAFE.putInt(arr, off, ver.topologyVersion());
 
         off += 4;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/954c4591/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java
index 4e34e16..28358d4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java
@@ -116,7 +116,7 @@ public class GridCacheEntryVersionSelfTest extends GridCommonAbstractTest {
                         long order = grid.affinity(null).mapKeyToNode(key).order();
 
                         // Check topology version.
-                        assertEquals(3, ver.topologyOrder() -
+                        assertEquals(3, ver.topologyVersion() -
                             (grid.context().discovery().gridStartTime() - TOP_VER_BASE_TIME) / 1000);
 
                         // Check node order.
@@ -143,7 +143,7 @@ public class GridCacheEntryVersionSelfTest extends GridCommonAbstractTest {
                         long order = grid.affinity(null).mapKeyToNode(key).order();
 
                         // Check topology version.
-                        assertEquals(4, ver.topologyOrder() -
+                        assertEquals(4, ver.topologyVersion() -
                             (grid.context().discovery().gridStartTime() - TOP_VER_BASE_TIME) / 1000);
 
                         // Check node order.


[17/35] incubator-ignite git commit: ignite-946: renamed topologyVersion to topologyOrder for GridCacheVersion

Posted by ag...@apache.org.
ignite-946: renamed topologyVersion to topologyOrder for GridCacheVersion


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

Branch: refs/heads/ignite-264
Commit: dd3cecf6a68deec93c084af2f7d7e1be9de9f877
Parents: c1582fc
Author: Denis Magda <dm...@gridgain.com>
Authored: Tue Aug 11 09:02:00 2015 +0300
Committer: Denis Magda <dm...@gridgain.com>
Committed: Tue Aug 11 09:02:00 2015 +0300

----------------------------------------------------------------------
 .../cache/GridCacheAtomicVersionComparator.java |  4 +--
 .../processors/cache/GridCacheMapEntry.java     |  2 +-
 .../processors/cache/GridCacheUtils.java        |  2 +-
 .../cache/transactions/IgniteTxManager.java     |  2 +-
 .../cache/version/CacheVersionedEntryImpl.java  |  4 +--
 .../version/GridCachePlainVersionedEntry.java   |  2 +-
 .../version/GridCacheRawVersionedEntry.java     |  2 +-
 .../cache/version/GridCacheVersion.java         | 28 ++++++++++----------
 .../cache/version/GridCacheVersionManager.java  |  5 ++--
 .../ignite/internal/util/IgniteUtils.java       |  4 +--
 .../cache/GridCacheEntryVersionSelfTest.java    |  4 +--
 11 files changed, 29 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd3cecf6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicVersionComparator.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicVersionComparator.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicVersionComparator.java
index 3a06100..45288d9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicVersionComparator.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAtomicVersionComparator.java
@@ -32,8 +32,8 @@ public class GridCacheAtomicVersionComparator {
      * @return Comparison value.
      */
     public int compare(GridCacheVersion one, GridCacheVersion other, boolean ignoreTime) {
-        int topVer = one.topologyVersion();
-        int otherTopVer = other.topologyVersion();
+        int topVer = one.topologyOrder();
+        int otherTopVer = other.topologyOrder();
 
         if (topVer == otherTopVer) {
             long globalTime = one.globalTime();

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd3cecf6/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 298f7a6..33c42c4 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
@@ -1927,7 +1927,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
 
             // Incorporate conflict version into new version if needed.
             if (conflictVer != null && conflictVer != newVer)
-                newVer = new GridCacheVersionEx(newVer.topologyVersion(),
+                newVer = new GridCacheVersionEx(newVer.topologyOrder(),
                     newVer.globalTime(),
                     newVer.order(),
                     newVer.nodeOrder(),

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd3cecf6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index a313e3d..75f1dee 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -1060,7 +1060,7 @@ public class GridCacheUtils {
 
         byte[] bytes = new byte[28];
 
-        U.intToBytes(ver.topologyVersion(), bytes, 0);
+        U.intToBytes(ver.topologyOrder(), bytes, 0);
         U.longToBytes(ver.globalTime(), bytes, 4);
         U.longToBytes(ver.order(), bytes, 12);
         U.intToBytes(ver.nodeOrderAndDrIdRaw(), bytes, 20);

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd3cecf6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
index 630330e..446002e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java
@@ -2098,7 +2098,7 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter {
          * @param nearVer Near transaction version.
          */
         private CommittedVersion(GridCacheVersion ver, GridCacheVersion nearVer) {
-            super(ver.topologyVersion(), ver.globalTime(), ver.order(), ver.nodeOrder(), ver.dataCenterId());
+            super(ver.topologyOrder(), ver.globalTime(), ver.order(), ver.nodeOrder(), ver.dataCenterId());
 
             assert nearVer != null;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd3cecf6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
index 74e4a9a..22b699a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionedEntryImpl.java
@@ -60,7 +60,7 @@ public class CacheVersionedEntryImpl<K, V> extends CacheEntryImpl<K, V> implemen
 
     /** {@inheritDoc} */
     @Override public int topologyVersion() {
-        return ver.topologyVersion();
+        return ver.topologyOrder();
     }
 
     /** {@inheritDoc} */
@@ -94,7 +94,7 @@ public class CacheVersionedEntryImpl<K, V> extends CacheEntryImpl<K, V> implemen
 
     /** {@inheritDoc} */
     public String toString() {
-        return "VersionedEntry [key=" + getKey() + ", val=" + getValue() + ", topVer=" + ver.topologyVersion() +
+        return "VersionedEntry [key=" + getKey() + ", val=" + getValue() + ", topVer=" + ver.topologyOrder() +
             ", nodeOrder=" + ver.nodeOrder() + ", order=" + ver.order() + ", creationTime=" + ver.globalTime() + ']';
     }
 }

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd3cecf6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java
index 4f13ae7..102805c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java
@@ -101,7 +101,7 @@ public class GridCachePlainVersionedEntry<K, V> implements GridCacheVersionedEnt
 
     /** {@inheritDoc} */
     @Override public int topologyVersion() {
-        return ver.topologyVersion();
+        return ver.topologyOrder();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd3cecf6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
index 87fe976..f8d33f6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
@@ -155,7 +155,7 @@ public class GridCacheRawVersionedEntry<K, V> extends DataStreamerEntry implemen
 
     /** {@inheritDoc} */
     @Override public int topologyVersion() {
-        return ver.topologyVersion();
+        return ver.topologyOrder();
     }
 
     /** {@inheritDoc} */

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd3cecf6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
index 64eef99..7adfa2e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersion.java
@@ -42,7 +42,7 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
     private static final int DR_ID_MASK = 0x1F;
 
     /** Topology version. */
-    private int topVer;
+    private int topOrder;
 
     /** Node order (used as global order) and DR ID. */
     private int nodeOrderDrId;
@@ -76,7 +76,7 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
         if (nodeOrder > NODE_ORDER_MASK)
             throw new IllegalArgumentException("Node order overflow: " + nodeOrder);
 
-        this.topVer = topVer;
+        this.topOrder = topVer;
         this.globalTime = globalTime;
         this.order = order;
 
@@ -85,13 +85,13 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
 
 
     /**
-     * @param topVer Topology version.
+     * @param topVer Topology version plus number of seconds from the start time of the first grid node.
      * @param nodeOrderDrId Node order and DR ID.
      * @param globalTime Globally adjusted time.
      * @param order Version order.
      */
     public GridCacheVersion(int topVer, int nodeOrderDrId, long globalTime, long order) {
-        this.topVer = topVer;
+        this.topOrder = topVer;
         this.nodeOrderDrId = nodeOrderDrId;
         this.globalTime = globalTime;
         this.order = order;
@@ -100,8 +100,8 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
     /**
      * @return Topology version plus number of seconds from the start time of the first grid node..
      */
-    public int topologyVersion() {
-        return topVer;
+    public int topologyOrder() {
+        return topOrder;
     }
 
     /**
@@ -184,12 +184,12 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
      * @return Version represented as {@code GridUuid}
      */
     public IgniteUuid asGridUuid() {
-        return new IgniteUuid(new UUID(((long)topVer << 32) | nodeOrderDrId, globalTime), order);
+        return new IgniteUuid(new UUID(((long)topOrder << 32) | nodeOrderDrId, globalTime), order);
     }
 
     /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
-        out.writeInt(topVer);
+        out.writeInt(topOrder);
         out.writeLong(globalTime);
         out.writeLong(order);
         out.writeInt(nodeOrderDrId);
@@ -197,7 +197,7 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
 
     /** {@inheritDoc} */
     @Override public void readExternal(ObjectInput in) throws IOException {
-        topVer = in.readInt();
+        topOrder = in.readInt();
         globalTime = in.readLong();
         order = in.readLong();
         nodeOrderDrId = in.readInt();
@@ -213,12 +213,12 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
 
         GridCacheVersion that = (GridCacheVersion)o;
 
-        return topVer == that.topVer && order == that.order && nodeOrder() == that.nodeOrder();
+        return topOrder == that.topOrder && order == that.order && nodeOrder() == that.nodeOrder();
     }
 
     /** {@inheritDoc} */
     @Override public int hashCode() {
-        int res = topVer;
+        int res = topOrder;
 
         res = 31 * res + nodeOrder();
 
@@ -230,7 +230,7 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
     /** {@inheritDoc} */
     @SuppressWarnings("IfMayBeConditional")
     @Override public int compareTo(GridCacheVersion other) {
-        int res = Integer.compare(topologyVersion(), other.topologyVersion());
+        int res = Integer.compare(topologyOrder(), other.topologyOrder());
 
         if (res != 0)
             return res;
@@ -274,7 +274,7 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
                 writer.incrementState();
 
             case 3:
-                if (!writer.writeInt("topVer", topVer))
+                if (!writer.writeInt("topVer", topOrder))
                     return false;
 
                 writer.incrementState();
@@ -317,7 +317,7 @@ public class GridCacheVersion implements Message, Comparable<GridCacheVersion>,
                 reader.incrementState();
 
             case 3:
-                topVer = reader.readInt("topVer");
+                topOrder = reader.readInt("topVer");
 
                 if (!reader.isLastRead())
                     return false;

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd3cecf6/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java
index 90919c7..d465a0c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionManager.java
@@ -24,7 +24,6 @@ import org.apache.ignite.internal.managers.eventstorage.*;
 import org.apache.ignite.internal.processors.affinity.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
-import org.apache.ignite.lang.*;
 
 import java.util.*;
 import java.util.concurrent.atomic.*;
@@ -197,7 +196,7 @@ public class GridCacheVersionManager extends GridCacheSharedManagerAdapter {
      * @return Next version for cache store operations.
      */
     public GridCacheVersion nextForLoad(GridCacheVersion ver) {
-        return next(ver.topologyVersion(), false, true);
+        return next(ver.topologyOrder(), false, true);
     }
 
     /**
@@ -207,7 +206,7 @@ public class GridCacheVersionManager extends GridCacheSharedManagerAdapter {
      * @return Next version based on given cache version.
      */
     public GridCacheVersion next(GridCacheVersion ver) {
-        return next(ver.topologyVersion(), false, false);
+        return next(ver.topologyOrder(), false, false);
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd3cecf6/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index f8c4c7e..a1c40f4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -8705,7 +8705,7 @@ public abstract class IgniteUtils {
 
             assert drVer != null;
 
-            UNSAFE.putInt(arr, off, drVer.topologyVersion());
+            UNSAFE.putInt(arr, off, drVer.topologyOrder());
 
             off += 4;
 
@@ -8722,7 +8722,7 @@ public abstract class IgniteUtils {
             off += 8;
         }
 
-        UNSAFE.putInt(arr, off, ver.topologyVersion());
+        UNSAFE.putInt(arr, off, ver.topologyOrder());
 
         off += 4;
 

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd3cecf6/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java
index 28358d4..4e34e16 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheEntryVersionSelfTest.java
@@ -116,7 +116,7 @@ public class GridCacheEntryVersionSelfTest extends GridCommonAbstractTest {
                         long order = grid.affinity(null).mapKeyToNode(key).order();
 
                         // Check topology version.
-                        assertEquals(3, ver.topologyVersion() -
+                        assertEquals(3, ver.topologyOrder() -
                             (grid.context().discovery().gridStartTime() - TOP_VER_BASE_TIME) / 1000);
 
                         // Check node order.
@@ -143,7 +143,7 @@ public class GridCacheEntryVersionSelfTest extends GridCommonAbstractTest {
                         long order = grid.affinity(null).mapKeyToNode(key).order();
 
                         // Check topology version.
-                        assertEquals(4, ver.topologyVersion() -
+                        assertEquals(4, ver.topologyOrder() -
                             (grid.context().discovery().gridStartTime() - TOP_VER_BASE_TIME) / 1000);
 
                         // Check node order.


[30/35] incubator-ignite git commit: Fixed threads cleanup in continuous processor

Posted by ag...@apache.org.
Fixed threads cleanup in continuous processor


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

Branch: refs/heads/ignite-264
Commit: ba3abceca10a1745253a3c28e7a6fe6f5833d266
Parents: 6697b0c
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Thu Aug 13 15:50:39 2015 -0700
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Thu Aug 13 15:50:39 2015 -0700

----------------------------------------------------------------------
 .../continuous/GridContinuousProcessor.java         | 16 +++++++++++-----
 .../GridCacheContinuousQueryAbstractSelfTest.java   |  2 +-
 2 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba3abcec/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
index 5f1c4bb..a360e35 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/continuous/GridContinuousProcessor.java
@@ -29,7 +29,6 @@ import org.apache.ignite.internal.managers.eventstorage.*;
 import org.apache.ignite.internal.processors.*;
 import org.apache.ignite.internal.processors.cache.*;
 import org.apache.ignite.internal.processors.timeout.*;
-import org.apache.ignite.internal.util.*;
 import org.apache.ignite.internal.util.future.*;
 import org.apache.ignite.internal.util.tostring.*;
 import org.apache.ignite.internal.util.typedef.*;
@@ -72,7 +71,7 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
     private final ConcurrentMap<UUID, StopFuture> stopFuts = new ConcurrentHashMap8<>();
 
     /** Threads started by this processor. */
-    private final Collection<IgniteThread> threads = new GridConcurrentHashSet<>();
+    private final Map<UUID, IgniteThread> bufCheckThreads = new ConcurrentHashMap8<>();
 
     /** */
     private final ConcurrentMap<IgniteUuid, SyncMessageAckFuture> syncMsgFuts = new ConcurrentHashMap8<>();
@@ -311,8 +310,10 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
 
         ctx.io().removeMessageListener(TOPIC_CONTINUOUS);
 
-        U.interrupt(threads);
-        U.joinThreads(threads, log);
+        for (IgniteThread thread : bufCheckThreads.values()) {
+            U.interrupt(thread);
+            U.join(thread);
+        }
 
         if (log.isDebugEnabled())
             log.debug("Continuous processor stopped.");
@@ -915,7 +916,7 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
                     }
                 });
 
-                threads.add(checker);
+                bufCheckThreads.put(routineId, checker);
 
                 checker.start();
             }
@@ -947,6 +948,11 @@ public class GridContinuousProcessor extends GridProcessorAdapter {
             ctx.io().removeMessageListener(hnd.orderedTopic());
 
         hnd.unregister(routineId, ctx);
+
+        IgniteThread checker = bufCheckThreads.remove(routineId);
+
+        if (checker != null)
+            checker.interrupt();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba3abcec/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java
index 4681071..7b628b4 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java
@@ -29,7 +29,6 @@ import org.apache.ignite.internal.processors.datastructures.*;
 import org.apache.ignite.internal.util.typedef.*;
 import org.apache.ignite.internal.util.typedef.internal.*;
 import org.apache.ignite.lang.*;
-import org.apache.ignite.marshaller.optimized.*;
 import org.apache.ignite.spi.discovery.tcp.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.*;
 import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
@@ -177,6 +176,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
             assertEquals(String.valueOf(i), 0, ((Map)U.field(proc, "rmtInfos")).size());
             assertEquals(String.valueOf(i), 0, ((Map)U.field(proc, "startFuts")).size());
             assertEquals(String.valueOf(i), 0, ((Map)U.field(proc, "stopFuts")).size());
+            assertEquals(String.valueOf(i), 0, ((Map)U.field(proc, "bufCheckThreads")).size());
 
             CacheContinuousQueryManager mgr = grid(i).context().cache().internalCache().context().continuousQueries();