#ignite-629: remove CacheFlag.SYNC_COMMIT
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/8de9a2dc Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/8de9a2dc Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/8de9a2dc Branch: refs/heads/gg-9998 Commit: 8de9a2dc663de30077dc6a59d907094863d2cf24 Parents: 078f99b Author: ivasilinets <ivasilin...@gridgain.com> Authored: Fri Mar 27 17:02:04 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Fri Mar 27 17:02:04 2015 +0300 ---------------------------------------------------------------------- .../internal/processors/cache/CacheFlag.java | 3 - .../processors/cache/GridCacheAdapter.java | 9 +- .../processors/cache/GridCacheContext.java | 2 +- .../cache/GridCacheSharedContext.java | 3 - .../handlers/cache/GridCacheCommandHandler.java | 3 - .../cache/GridCacheAbstractFlagsTest.java | 97 -------------------- .../near/GridCachePartitionedFlagsTest.java | 41 --------- .../GridCacheReplicatedFlagsTest.java | 28 ------ 8 files changed, 2 insertions(+), 184 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8de9a2dc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheFlag.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheFlag.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheFlag.java index 6744d76..7c482c1 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheFlag.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheFlag.java @@ -49,9 +49,6 @@ public enum CacheFlag { /** Skip swap space for reads and writes. */ SKIP_SWAP, - /** Synchronous commit. */ - SYNC_COMMIT, - /** * Switches a cache projection to work in {@code 'invalidation'} mode. * Instead of updating remote entries with new values, small invalidation http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8de9a2dc/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 492c07a..e68447f 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 @@ -4455,9 +4455,6 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, /** partition lock */false ); - if (ctx.hasFlag(SYNC_COMMIT)) - tx.syncCommit(true); - assert tx != null; try { @@ -4515,7 +4512,7 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, IgniteTxLocalAdapter tx = ctx.tm().threadLocalTx(ctx); - if (tx == null || tx.implicit()) { + if (tx == null || tx.implicit()) tx = ctx.tm().newTx( true, op.single(), @@ -4529,10 +4526,6 @@ public abstract class GridCacheAdapter<K, V> implements GridCache<K, V>, null, false); - if (ctx.hasFlag(SYNC_COMMIT)) - tx.syncCommit(true); - } - return asyncOp(tx, op); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8de9a2dc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java index 5cdefcf..8aede80 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java @@ -1531,7 +1531,7 @@ public class GridCacheContext<K, V> implements Externalizable { * @return {@code True} if synchronous commit is enabled. */ public boolean syncCommit() { - return cacheCfg.getWriteSynchronizationMode() == FULL_SYNC || hasFlag(SYNC_COMMIT); + return cacheCfg.getWriteSynchronizationMode() == FULL_SYNC; } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8de9a2dc/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java index 382c6be..6bc5f5d 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSharedContext.java @@ -466,9 +466,6 @@ public class GridCacheSharedContext<K, V> { if (flags.contains(INVALIDATE) && !tx.isInvalidate()) throw new CacheFlagException(INVALIDATE); - - if (flags.contains(SYNC_COMMIT) && !tx.syncCommit()) - throw new CacheFlagException(SYNC_COMMIT); } /** http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8de9a2dc/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java index 00647bc..cbee8c2 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/rest/handlers/cache/GridCacheCommandHandler.java @@ -114,9 +114,6 @@ public class GridCacheCommandHandler extends GridRestCommandHandlerAdapter { if ((cacheFlagsBits & (1 << 1)) != 0) flagSet.add(CacheFlag.SKIP_SWAP); - if ((cacheFlagsBits & (1 << 2)) != 0) - flagSet.add(CacheFlag.SYNC_COMMIT); - if ((cacheFlagsBits & (1 << 4)) != 0) flagSet.add(CacheFlag.INVALIDATE); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8de9a2dc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFlagsTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFlagsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFlagsTest.java deleted file mode 100644 index 72a8cfe..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFlagsTest.java +++ /dev/null @@ -1,97 +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.apache.ignite.*; -import org.apache.ignite.cache.*; -import org.apache.ignite.cache.store.*; -import org.apache.ignite.configuration.*; -import org.apache.ignite.internal.*; - -import java.util.concurrent.*; -import java.util.concurrent.atomic.*; - -import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; - -/** - * Tests cache flags. - */ -public abstract class GridCacheAbstractFlagsTest extends GridCacheAbstractSelfTest { - /** {@inheritDoc} */ - @Override protected int gridCount() { - return 6; - } - - /** {@inheritDoc} */ - @Override protected CacheWriteSynchronizationMode writeSynchronization() { - return FULL_ASYNC; - } - - /** {@inheritDoc} */ - @Override protected CacheConfiguration cacheConfiguration(String gridName) throws Exception { - CacheConfiguration c = super.cacheConfiguration(gridName); - - if (cacheMode() == CacheMode.PARTITIONED) - c.setBackups(1); - - c.setCacheStoreFactory(null); - - return c; - } - - /** {@inheritDoc} */ - @Override protected boolean swapEnabled() { - return false; - } - - /** - * Tests SYNC_COMMIT cache flag. - * - * @throws Exception If failed. - */ - public void testTestSyncCommitFlag() throws Exception { - for (int i = 0; i < 10; i++) { - final String key = "k" + i; - final Integer val = i; - - final CountDownLatch l = new CountDownLatch(1); - - final AtomicInteger cntr = new AtomicInteger(); - - IgniteInternalFuture<?> f = multithreadedAsync(new Callable() { - @Override public Object call() throws Exception { - int idx = cntr.getAndIncrement() % gridCount(); - - IgniteCache<String, Integer> c = jcache(idx); - - l.await(); - - assertEquals(val, c.get(key)); - - return null; - } - }, gridCount() * 3); - - ((IgniteCacheProxy)jcache(0)).flagOn(CacheFlag.SYNC_COMMIT).put(key, val); - - l.countDown(); - - f.get(); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8de9a2dc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFlagsTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFlagsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFlagsTest.java deleted file mode 100644 index d68f476..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedFlagsTest.java +++ /dev/null @@ -1,41 +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.distributed.near; - -import org.apache.ignite.cache.*; -import org.apache.ignite.internal.processors.cache.*; - -import java.text.*; -import java.util.*; - -public class GridCachePartitionedFlagsTest extends GridCacheAbstractFlagsTest { - - @Override - protected CacheMode cacheMode() { - return CacheMode.PARTITIONED; - } - - @Override - public void testTestSyncCommitFlag() throws Exception { - // Temporary disable test run. - if (new Date().compareTo(new SimpleDateFormat("dd.MM.yyyy").parse("01.06.2012")) < 0) - return; - - super.testTestSyncCommitFlag(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/8de9a2dc/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFlagsTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFlagsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFlagsTest.java deleted file mode 100644 index b9a321d..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/replicated/GridCacheReplicatedFlagsTest.java +++ /dev/null @@ -1,28 +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.distributed.replicated; - -import org.apache.ignite.cache.*; -import org.apache.ignite.internal.processors.cache.*; - -public class GridCacheReplicatedFlagsTest extends GridCacheAbstractFlagsTest { - /** {@inheritDoc} */ - @Override protected CacheMode cacheMode() { - return CacheMode.REPLICATED; - } -}