IGNITE-264 - WIP
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/65324d66 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/65324d66 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/65324d66 Branch: refs/heads/ignite-264 Commit: 65324d66a7df9310af41df7d8d2553aa7f51056c Parents: 0a6557a Author: Alexey Goncharuk <agoncha...@gridgain.com> Authored: Mon Feb 23 12:50:44 2015 -0800 Committer: Alexey Goncharuk <agoncha...@gridgain.com> Committed: Mon Feb 23 12:50:44 2015 -0800 ---------------------------------------------------------------------- .../ignite/codegen/MessageCodeGenerator.java | 4 ++ .../GridDistributedUnlockRequest.java | 4 +- .../distributed/dht/GridDhtUnlockRequest.java | 4 +- .../cache/GridCacheAbstractFullApiSelfTest.java | 47 ++++++++++++++++++++ 4 files changed, 55 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/65324d66/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java ---------------------------------------------------------------------- diff --git a/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java b/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java index 169aeb9..be84a93 100644 --- a/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java +++ b/modules/codegen/src/main/java/org/apache/ignite/codegen/MessageCodeGenerator.java @@ -138,6 +138,10 @@ public class MessageCodeGenerator { gen.generateAll(true); +// gen.generateAndWrite(GridDistributedUnlockRequest.class); +// gen.generateAndWrite(GridNearUnlockRequest.class); +// gen.generateAndWrite(GridDhtUnlockRequest.class); +// // gen.generateAndWrite(GridDistributedLockRequest.class); // gen.generateAndWrite(GridDistributedLockResponse.class); // gen.generateAndWrite(GridNearLockRequest.class); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/65324d66/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java index 694c30c..ae7d740 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedUnlockRequest.java @@ -129,7 +129,7 @@ public class GridDistributedUnlockRequest<K, V> extends GridDistributedBaseMessa } switch (writer.state()) { - case 8: + case 6: if (!writer.writeCollection("keyBytes", keyBytes, Type.BYTE_ARR)) return false; @@ -148,7 +148,7 @@ public class GridDistributedUnlockRequest<K, V> extends GridDistributedBaseMessa return false; switch (readState) { - case 8: + case 6: keyBytes = reader.readCollection("keyBytes", Type.BYTE_ARR); if (!reader.isLastRead()) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/65324d66/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java index a9d035f..ec5dc5c 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtUnlockRequest.java @@ -118,7 +118,7 @@ public class GridDhtUnlockRequest<K, V> extends GridDistributedUnlockRequest<K, } switch (writer.state()) { - case 9: + case 7: if (!writer.writeCollection("nearKeyBytes", nearKeyBytes, Type.BYTE_ARR)) return false; @@ -137,7 +137,7 @@ public class GridDhtUnlockRequest<K, V> extends GridDistributedUnlockRequest<K, return false; switch (readState) { - case 9: + case 7: nearKeyBytes = reader.readCollection("nearKeyBytes", Type.BYTE_ARR); if (!reader.isLastRead()) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/65324d66/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java index f36a018..99fec63 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java @@ -2593,6 +2593,53 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract } /** + * @param keys0 Keys to check. + * @throws IgniteCheckedException If failed. + */ + protected void checkUnlocked(final Collection<String> keys0) throws IgniteCheckedException { + GridTestUtils.waitForCondition(new GridAbsPredicate() { + @Override public boolean apply() { + try { + for (int i = 0; i < gridCount(); i++) { + GridCacheAdapter<Object, Object> cache = ((IgniteKernal)ignite(i)).internalCache(); + + for (String key : keys0) { + GridCacheEntryEx<Object, Object> entry = cache.peekEx(key); + + if (entry != null) { + if (entry.lockedByAny()) { + info("Entry is still locked [i=" + i + ", entry=" + entry + ']'); + + return false; + } + } + + if (cache.isNear()) { + entry = cache.context().near().dht().peekEx(key); + + if (entry != null) { + if (entry.lockedByAny()) { + info("Entry is still locked [i=" + i + ", entry=" + entry + ']'); + + return false; + } + } + } + } + } + + return true; + } + catch (GridCacheEntryRemovedException ignore) { + info("Entry was removed, will retry"); + + return false; + } + } + }, 10_000); + } + + /** * @throws Exception If failed. */ public void testGlobalClearAll() throws Exception {