ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: ignite-db-10884
Date Tue, 19 Apr 2016 13:56:54 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-db-x-10884 d69f6ea23 -> 3e88d8bf8


ignite-db-10884


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

Branch: refs/heads/ignite-db-x-10884
Commit: 3e88d8bf802e0a36c97d146cfe10f67dad587d4e
Parents: d69f6ea
Author: sboikov <sboikov@gridgain.com>
Authored: Tue Apr 19 16:50:55 2016 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Tue Apr 19 16:56:47 2016 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheMapEntry.java     |  33 ++--
 .../distributed/near/GridNearCacheEntry.java    |   5 +
 .../managers/GridManagerStopSelfTest.java       |  15 --
 .../GridSwapSpaceCustomLocalValue.java          |  85 ----------
 .../swapspace/GridSwapSpaceManagerSelfTest.java | 170 -------------------
 .../managers/swapspace/package-info.java        |  22 ---
 .../testsuites/IgniteKernalSelfTestSuite.java   |   2 -
 7 files changed, 22 insertions(+), 310 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/3e88d8bf/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 6057567..f3b296e 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
@@ -460,7 +460,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter
impleme
     }
 
     /** {@inheritDoc} */
-    @Override public CacheObject unswap() throws IgniteCheckedException, GridCacheEntryRemovedException
{
+    @Override public final CacheObject unswap() throws IgniteCheckedException, GridCacheEntryRemovedException
{
         return unswap(true);
     }
 
@@ -473,30 +473,25 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter
impleme
      */
     @Nullable @Override public CacheObject unswap(boolean needVal)
         throws IgniteCheckedException, GridCacheEntryRemovedException {
-        boolean swapEnabled = cctx.swap().swapEnabled();
-
-        if (!swapEnabled && !cctx.isOffHeapEnabled() && !cctx.isDatabaseEnabled())
-            return null;
-
         synchronized (this) {
             checkObsolete();
 
             if (isStartVersion() && ((flags & IS_UNSWAPPED_MASK) == 0)) {
-                if (cctx.isDatabaseEnabled()) {
-                    IgniteBiTuple<CacheObject, GridCacheVersion> read = cctx.offheap0().read(key,
partition());
+                IgniteBiTuple<CacheObject, GridCacheVersion> read = cctx.offheap0().read(key,
partition());
 
-                    flags |= IS_UNSWAPPED_MASK;
+                flags |= IS_UNSWAPPED_MASK;
 
-                    if (read != null) {
-                        CacheObject idxVal = read.get1();
+                if (read != null) {
+                    CacheObject idxVal = read.get1();
 
-                        // Set unswapped value.
-                        update(idxVal, 0, 0, read.get2());
+                    // Set unswapped value.
+                    update(idxVal, 0, 0, read.get2());
 
-                        return idxVal;
-                    }
+                    return idxVal;
                 }
-                else {
+
+                // TODO GG-10884.
+                if (false) {
                     GridCacheSwapEntry e;
 
                     if (cctx.offheapTiered()) {
@@ -1684,6 +1679,8 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter
impleme
 
                 update(updated, expireTime, ttl, ver);
 
+                cctx.offheap0().put(key, updated, ver, partition());
+
                 if (evt) {
                     CacheObject evtOld = null;
 
@@ -1721,6 +1718,8 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter
impleme
 
                 update(null, CU.TTL_ETERNAL, CU.EXPIRE_TIME_ETERNAL, ver);
 
+                cctx.offheap0().remove(key);
+
                 if (cctx.offheapTiered() && hasValPtr) {
                     boolean rmv = cctx.swap().removeOffheap(key);
 
@@ -2640,6 +2639,8 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter
impleme
 
                 releaseSwap();
 
+                cctx.offheap0().remove(key);
+
                 ret = true;
                 rmv = true;
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e88d8bf/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
index 0b9d32a..95e03fb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearCacheEntry.java
@@ -457,6 +457,11 @@ public class GridNearCacheEntry extends GridDistributedCacheEntry {
     }
 
     /** {@inheritDoc} */
+    @Nullable @Override public CacheObject unswap(boolean needVal) {
+        return null;
+    }
+
+    /** {@inheritDoc} */
     @Override public GridCacheMvccCandidate addLocal(
         long threadId,
         GridCacheVersion ver,

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e88d8bf/modules/core/src/test/java/org/apache/ignite/internal/managers/GridManagerStopSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/GridManagerStopSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/managers/GridManagerStopSelfTest.java
index 04eb8ef..1661972 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/GridManagerStopSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/managers/GridManagerStopSelfTest.java
@@ -207,19 +207,4 @@ public class GridManagerStopSelfTest extends GridCommonAbstractTest {
 
         mgr.stop(true);
     }
-
-    /**
-     * @throws Exception If failed.
-     */
-    public void testStopSwapSpaceManager() throws Exception {
-        SwapSpaceSpi spi = new FileSwapSpaceSpi();
-
-        injectLogger(spi);
-
-        ctx.config().setSwapSpaceSpi(spi);
-
-        GridSwapSpaceManager mgr = new GridSwapSpaceManager(ctx);
-
-        mgr.stop(true);
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e88d8bf/modules/core/src/test/java/org/apache/ignite/internal/managers/swapspace/GridSwapSpaceCustomLocalValue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/swapspace/GridSwapSpaceCustomLocalValue.java
b/modules/core/src/test/java/org/apache/ignite/internal/managers/swapspace/GridSwapSpaceCustomLocalValue.java
deleted file mode 100644
index fd27c0a..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/swapspace/GridSwapSpaceCustomLocalValue.java
+++ /dev/null
@@ -1,85 +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.managers.swapspace;
-
-import java.io.Serializable;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-/**
- */
-public class GridSwapSpaceCustomLocalValue implements Serializable {
-    /** */
-    private long id = -1;
-
-    /** */
-    private String data;
-
-    /**
-     *
-     */
-    public GridSwapSpaceCustomLocalValue() {
-        /* No-op. */
-    }
-
-    /**
-     *
-     * @param id Id.
-     * @param data Data.
-     */
-    public GridSwapSpaceCustomLocalValue(long id, String data) {
-        this.id = id;
-        this.data = data;
-    }
-
-    /**
-     *
-     * @return ID.
-     */
-    public long getId() {
-        return id;
-    }
-
-    /**
-     *
-     * @param id ID.
-     */
-    public void setId(long id) {
-        this.id = id;
-    }
-
-    /**
-     *
-     * @return Data.
-     */
-    public String getData() {
-        return data;
-    }
-
-    /**
-     *
-     * @param data Data.
-     */
-    public void setData(String data) {
-        this.data = data;
-    }
-
-    /** {@inheritDoc} */
-    @Override public String toString() {
-        return S.toString(GridSwapSpaceCustomLocalValue.class, this);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e88d8bf/modules/core/src/test/java/org/apache/ignite/internal/managers/swapspace/GridSwapSpaceManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/swapspace/GridSwapSpaceManagerSelfTest.java
b/modules/core/src/test/java/org/apache/ignite/internal/managers/swapspace/GridSwapSpaceManagerSelfTest.java
deleted file mode 100644
index 7d7f0ac..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/swapspace/GridSwapSpaceManagerSelfTest.java
+++ /dev/null
@@ -1,170 +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.managers.swapspace;
-
-import java.util.concurrent.CountDownLatch;
-import org.apache.ignite.Ignite;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.events.Event;
-import org.apache.ignite.events.SwapSpaceEvent;
-import org.apache.ignite.internal.IgniteKernal;
-import org.apache.ignite.internal.util.lang.GridTuple;
-import org.apache.ignite.internal.util.typedef.CI1;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.lang.IgnitePredicate;
-import org.apache.ignite.spi.swapspace.SwapKey;
-import org.apache.ignite.spi.swapspace.file.FileSwapSpaceSpi;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-import org.apache.ignite.testframework.junits.common.GridCommonTest;
-
-import static java.util.concurrent.TimeUnit.SECONDS;
-import static org.apache.ignite.events.EventType.EVTS_SWAPSPACE;
-import static org.apache.ignite.events.EventType.EVT_SWAP_SPACE_CLEARED;
-import static org.apache.ignite.events.EventType.EVT_SWAP_SPACE_DATA_READ;
-import static org.apache.ignite.events.EventType.EVT_SWAP_SPACE_DATA_REMOVED;
-import static org.apache.ignite.events.EventType.EVT_SWAP_SPACE_DATA_STORED;
-
-/**
- * Tests for {@link GridSwapSpaceManager}.
- */
-@SuppressWarnings({"ProhibitedExceptionThrown"})
-@GridCommonTest(group = "Kernal Self")
-public class GridSwapSpaceManagerSelfTest extends GridCommonAbstractTest {
-    /** */
-    private static final String spaceName = "swapspace_mgr";
-
-    /**
-     *
-     */
-    public GridSwapSpaceManagerSelfTest() {
-        super(/*start grid*/true);
-    }
-
-    /** {@inheritDoc} */
-    @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception
{
-        IgniteConfiguration c = super.getConfiguration(gridName);
-
-        c.setSwapSpaceSpi(new FileSwapSpaceSpi());
-
-        return c;
-    }
-
-    /**
-     * Returns swap space manager instance for given Grid.
-     *
-     * @param ignite Grid instance.
-     * @return Swap space manager.
-     */
-    private GridSwapSpaceManager getSwapSpaceManager(Ignite ignite) {
-        assert ignite != null;
-
-        return ((IgniteKernal) ignite).context().swap();
-    }
-
-    /**
-     * @throws Exception If test failed.
-     */
-    public void testSize() throws Exception {
-        final Ignite ignite = grid();
-
-        final CountDownLatch clearCnt = new CountDownLatch(1);
-        final CountDownLatch readCnt = new CountDownLatch(1);
-        final CountDownLatch storeCnt = new CountDownLatch(2);
-        final CountDownLatch rmvCnt = new CountDownLatch(1);
-
-        ignite.events().localListen(new IgnitePredicate<Event>() {
-            @Override public boolean apply(Event evt) {
-                assert evt instanceof SwapSpaceEvent;
-
-                info("Received event: " + evt);
-
-                SwapSpaceEvent e = (SwapSpaceEvent) evt;
-
-                assert spaceName.equals(e.space());
-                assert ignite.cluster().localNode().id().equals(e.node().id());
-
-                switch (evt.type()) {
-                    case EVT_SWAP_SPACE_CLEARED:
-                        clearCnt.countDown();
-
-                        break;
-
-                    case EVT_SWAP_SPACE_DATA_READ:
-                        readCnt.countDown();
-
-                        break;
-
-                    case EVT_SWAP_SPACE_DATA_STORED:
-                        storeCnt.countDown();
-
-                        break;
-
-                    case EVT_SWAP_SPACE_DATA_REMOVED:
-                        rmvCnt.countDown();
-
-                        break;
-
-                    default:
-                        assert false : "Unexpected event: " + evt;
-                }
-
-                return true;
-            }
-        }, EVTS_SWAPSPACE);
-
-        GridSwapSpaceManager mgr = getSwapSpaceManager(ignite);
-
-        assert mgr != null;
-
-        // Empty data space.
-        assertEquals(0, mgr.swapSize(spaceName));
-
-        SwapKey key = new SwapKey("key1");
-
-        String val = "value";
-
-        mgr.write(spaceName, key, val.getBytes(), null);
-
-        mgr.write(spaceName, new SwapKey("key2"), val.getBytes(), null);
-
-        assert storeCnt.await(10, SECONDS);
-
-        byte[] arr = mgr.read(spaceName, key, null);
-
-        assert arr != null;
-
-        assert val.equals(new String(arr));
-
-        final GridTuple<Boolean> b = F.t(false);
-
-        mgr.remove(spaceName, key, new CI1<byte[]>() {
-            @Override public void apply(byte[] rmv) {
-                b.set(rmv != null);
-            }
-        }, null);
-
-        assert b.get();
-
-        assert rmvCnt.await(10, SECONDS);
-        assert readCnt.await(10, SECONDS);
-
-        mgr.clear(spaceName);
-
-        assert clearCnt.await(10, SECONDS) : "Count: " + clearCnt.getCount();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e88d8bf/modules/core/src/test/java/org/apache/ignite/internal/managers/swapspace/package-info.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/managers/swapspace/package-info.java
b/modules/core/src/test/java/org/apache/ignite/internal/managers/swapspace/package-info.java
deleted file mode 100644
index 38ac153..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/managers/swapspace/package-info.java
+++ /dev/null
@@ -1,22 +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 description. -->
- * Contains internal tests or test related classes and interfaces.
- */
-package org.apache.ignite.internal.managers.swapspace;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/3e88d8bf/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
index d9e9b0f..0211ce5 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteKernalSelfTestSuite.java
@@ -44,7 +44,6 @@ import org.apache.ignite.internal.managers.discovery.GridDiscoveryManagerAttribu
 import org.apache.ignite.internal.managers.discovery.GridDiscoveryManagerSelfTest;
 import org.apache.ignite.internal.managers.discovery.IgniteTopologyPrintFormatSelfTest;
 import org.apache.ignite.internal.managers.events.GridEventStorageManagerSelfTest;
-import org.apache.ignite.internal.managers.swapspace.GridSwapSpaceManagerSelfTest;
 import org.apache.ignite.internal.processors.port.GridPortProcessorSelfTest;
 import org.apache.ignite.internal.processors.service.GridServiceClientNodeTest;
 import org.apache.ignite.internal.processors.service.GridServicePackagePrivateSelfTest;
@@ -89,7 +88,6 @@ public class IgniteKernalSelfTestSuite extends TestSuite {
         suite.addTestSuite(GridDiscoverySelfTest.class);
         suite.addTestSuite(GridCommunicationSelfTest.class);
         suite.addTestSuite(GridEventStorageManagerSelfTest.class);
-        suite.addTestSuite(GridSwapSpaceManagerSelfTest.class);
         suite.addTestSuite(GridCommunicationSendMessageSelfTest.class);
         suite.addTestSuite(GridCacheMessageSelfTest.class);
         suite.addTestSuite(GridDeploymentManagerStopSelfTest.class);


Mime
View raw message