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/11/25 08:03:20 UTC
[1/4] ignite git commit: DEVNOTES fix
Repository: ignite
Updated Branches:
refs/heads/ignite-1282 8e1d6c0e8 -> 0f1dd6f53
DEVNOTES fix
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c23cda1d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c23cda1d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c23cda1d
Branch: refs/heads/ignite-1282
Commit: c23cda1d27816656e38937fb18c3e676248d7959
Parents: eee3b21
Author: Anton Vinogradov <av...@apache.org>
Authored: Tue Nov 24 12:57:13 2015 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Tue Nov 24 12:57:13 2015 +0300
----------------------------------------------------------------------
DEVNOTES.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c23cda1d/DEVNOTES.txt
----------------------------------------------------------------------
diff --git a/DEVNOTES.txt b/DEVNOTES.txt
index ea9cf17..784be96 100644
--- a/DEVNOTES.txt
+++ b/DEVNOTES.txt
@@ -10,7 +10,7 @@ With LGPL dependencies:
mvn clean package -DskipTests -Prelease,lgpl -Dignite.edition=fabric-lgpl
With LGPL dependencies and Scala 2.10:
- mvn clean package -DskipTests -Prelease,lgpl -Dscala-2.10
+ mvn clean package -DskipTests -Prelease,lgpl -Dignite.edition=fabric-lgpl -Dscala-2.10
Look for apache-ignite-fabric-<version>-bin.zip in ./target/bin directory.
[2/4] ignite git commit: IGNITE-1988 - Exception for explicit lock
inside a transaction
Posted by ag...@apache.org.
IGNITE-1988 - Exception for explicit lock inside a transaction
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4d29cb7f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4d29cb7f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4d29cb7f
Branch: refs/heads/ignite-1282
Commit: 4d29cb7f87aafa505807f4b10cddd0264cdac85f
Parents: c23cda1
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Tue Nov 24 16:23:05 2015 -0800
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Tue Nov 24 16:23:05 2015 -0800
----------------------------------------------------------------------
.../processors/cache/CacheLockImpl.java | 18 ++++++++-
.../colocated/GridDhtColocatedLockFuture.java | 8 ++--
.../cache/GridCacheAbstractFullApiSelfTest.java | 42 +++++++++++++++++++-
3 files changed, 61 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4d29cb7f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLockImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLockImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLockImpl.java
index 2e8dc9b..ae7b42e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLockImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheLockImpl.java
@@ -69,6 +69,8 @@ class CacheLockImpl<K, V> implements Lock {
CacheOperationContext prev = gate.enter(opCtx);
try {
+ checkTx();
+
delegate.lockAll(keys, 0);
incrementLockCounter();
@@ -102,6 +104,8 @@ class CacheLockImpl<K, V> implements Lock {
CacheOperationContext prev = gate.enter(opCtx);
try {
+ checkTx();
+
boolean res = delegate.lockAll(keys, -1);
if (res)
@@ -128,6 +132,8 @@ class CacheLockImpl<K, V> implements Lock {
CacheOperationContext prev = gate.enter(opCtx);
try {
+ checkTx();
+
IgniteInternalFuture<Boolean> fut = delegate.lockAllAsync(keys, unit.toMillis(time));
try {
@@ -198,8 +204,18 @@ class CacheLockImpl<K, V> implements Lock {
throw new UnsupportedOperationException();
}
+ /**
+ * Verifies there is no ongoing user transaction.
+ *
+ * @throws CacheException
+ */
+ private void checkTx() throws CacheException {
+ if (delegate.context().tm().inUserTx())
+ throw new CacheException("Explicit lock can't be acquired within a transaction.");
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(CacheLockImpl.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4d29cb7f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
index 7e6ce89..ecdf641 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedLockFuture.java
@@ -296,10 +296,6 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
GridCacheMvccCandidate cand = cctx.mvcc().explicitLock(threadId, txKey);
if (inTx()) {
- IgniteTxEntry txEntry = tx.entry(txKey);
-
- txEntry.cached(entry);
-
if (cand != null) {
if (!tx.implicit())
throw new IgniteCheckedException("Cannot access key within transaction if lock is " +
@@ -308,6 +304,10 @@ public final class GridDhtColocatedLockFuture extends GridCompoundIdentityFuture
return null;
}
else {
+ IgniteTxEntry txEntry = tx.entry(txKey);
+
+ txEntry.cached(entry);
+
// Check transaction entries (corresponding tx entries must be enlisted in transaction).
cand = new GridCacheMvccCandidate(entry,
cctx.localNodeId(),
http://git-wip-us.apache.org/repos/asf/ignite/blob/4d29cb7f/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 e8e86e9..89c4029 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
@@ -17,8 +17,6 @@
package org.apache.ignite.internal.processors.cache;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
@@ -38,6 +36,7 @@ import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.Lock;
import javax.cache.Cache;
+import javax.cache.CacheException;
import javax.cache.expiry.Duration;
import javax.cache.expiry.ExpiryPolicy;
import javax.cache.expiry.TouchedExpiryPolicy;
@@ -45,6 +44,8 @@ import javax.cache.processor.EntryProcessor;
import javax.cache.processor.EntryProcessorException;
import javax.cache.processor.EntryProcessorResult;
import javax.cache.processor.MutableEntry;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
import junit.framework.AssertionFailedError;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
@@ -5128,6 +5129,43 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
}
/**
+ * @throws Exception If failed.
+ */
+ public void testLockInsideTransaction() throws Exception {
+ if (txEnabled()) {
+ GridTestUtils.assertThrows(
+ log,
+ new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ try (Transaction tx = ignite(0).transactions().txStart()) {
+ jcache(0).lock("key").lock();
+ }
+
+ return null;
+ }
+ },
+ CacheException.class,
+ "Explicit lock can't be acquired within a transaction."
+ );
+
+ GridTestUtils.assertThrows(
+ log,
+ new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ try (Transaction tx = ignite(0).transactions().txStart()) {
+ jcache(0).lockAll(Arrays.asList("key1", "key2")).lock();
+ }
+
+ return null;
+ }
+ },
+ CacheException.class,
+ "Explicit lock can't be acquired within a transaction."
+ );
+ }
+ }
+
+ /**
* Sets given value, returns old value.
*/
public static final class SetValueProcessor implements EntryProcessor<String, Integer, Integer> {
[4/4] ignite git commit: Merge branch 'ignite-1.5' of
https://git-wip-us.apache.org/repos/asf/ignite into ignite-1282
Posted by ag...@apache.org.
Merge branch 'ignite-1.5' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-1282
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0f1dd6f5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0f1dd6f5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0f1dd6f5
Branch: refs/heads/ignite-1282
Commit: 0f1dd6f53a203b3530ca98db37405eac06b18c81
Parents: 8e1d6c0 dafad52
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Wed Nov 25 09:46:10 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Nov 25 09:46:10 2015 +0300
----------------------------------------------------------------------
DEVNOTES.txt | 2 +-
.../org/apache/ignite/internal/IgnitionEx.java | 9 +++--
.../processors/cache/CacheLockImpl.java | 18 ++++++++-
.../colocated/GridDhtColocatedLockFuture.java | 8 ++--
.../cache/GridCacheAbstractFullApiSelfTest.java | 42 +++++++++++++++++++-
5 files changed, 67 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0f1dd6f5/modules/core/src/main/java/org/apache/ignite/internal/IgnitionEx.java
----------------------------------------------------------------------
[3/4] ignite git commit: Better exception message if Ignite is not
started
Posted by ag...@apache.org.
Better exception message if Ignite is not started
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/dafad526
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/dafad526
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/dafad526
Branch: refs/heads/ignite-1282
Commit: dafad526f84ecbf503135c7538ffef07dd5e1c4f
Parents: 4d29cb7
Author: Valentin Kulichenko <va...@gmail.com>
Authored: Tue Nov 24 16:34:37 2015 -0800
Committer: Valentin Kulichenko <va...@gmail.com>
Committed: Tue Nov 24 16:34:37 2015 -0800
----------------------------------------------------------------------
.../main/java/org/apache/ignite/internal/IgnitionEx.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/dafad526/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 7d2b2dc..6bd74be 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
@@ -1187,8 +1187,8 @@ public class IgnitionEx {
Ignite res;
if (grid == null || (res = grid.grid()) == null)
- throw new IgniteIllegalStateException("Grid instance was not properly started " +
- "or was already stopped: " + name);
+ throw new IgniteIllegalStateException("Ignite instance with provided name doesn't exist. " +
+ "Did you call Ignition.start(..) to start an Ignite instance? [name=" + name + ']');
return res;
}
@@ -1205,7 +1205,8 @@ public class IgnitionEx {
IgniteKernal res;
if (grid == null || (res = grid.gridx()) == null)
- throw new IllegalStateException("Grid instance was not properly started or was already stopped: " + name);
+ throw new IgniteIllegalStateException("Ignite instance with provided name doesn't exist. " +
+ "Did you call Ignition.start(..) to start an Ignite instance? [name=" + name + ']');
return res;
}
@@ -2388,4 +2389,4 @@ public class IgnitionEx {
}
}
}
-}
\ No newline at end of file
+}