You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/05/06 12:28:35 UTC
[1/8] incubator-ignite git commit: # IGNITE-865 Fixed code generation
logic.
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-157-2 f5f95fb8c -> d4908f244
# IGNITE-865 Fixed code generation logic.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/4a096d95
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/4a096d95
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/4a096d95
Branch: refs/heads/ignite-157-2
Commit: 4a096d95874f1585dcb5c2fdb6c9d09db4fa45d9
Parents: 07a4258
Author: AKuznetsov <ak...@gridgain.com>
Authored: Wed May 6 13:04:57 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Wed May 6 13:04:57 2015 +0700
----------------------------------------------------------------------
.../ignite/schema/generator/CodeGenerator.java | 41 ++++++++++++--------
1 file changed, 25 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/4a096d95/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
----------------------------------------------------------------------
diff --git a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
index f8901d2..f04aa01 100644
--- a/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
+++ b/modules/schema-import/src/main/java/org/apache/ignite/schema/generator/CodeGenerator.java
@@ -550,21 +550,25 @@ public class CodeGenerator {
* @param mtdName Method name to generate.
* @param comment Commentary text.
* @param first {@code true} if variable should be declared.
+ * @return {@code false} if variable was declared.
*/
- private static void addQueryFields(Collection<String> src, Collection<PojoField> fields, String varName,
+ private static boolean addQueryFields(Collection<String> src, Collection<PojoField> fields, String varName,
String mtdName, String comment, boolean first) {
- if (!fields.isEmpty()) {
- add2(src, comment);
- add2(src, (first ? "Map<String, Class<?>> " : "") + varName + " = new LinkedHashMap<>();");
- add0(src, "");
+ if (fields.isEmpty())
+ return true;
- for (PojoField field : fields)
- add2(src, varName + ".put(\"" + field.javaName() + "\", " + javaTypeName(field) + ".class);");
+ add2(src, comment);
+ add2(src, (first ? "Map<String, Class<?>> " : "") + varName + " = new LinkedHashMap<>();");
+ add0(src, "");
- add0(src, "");
- add2(src, "type." + mtdName + "(" + varName + ");");
- add0(src, "");
- }
+ for (PojoField field : fields)
+ add2(src, varName + ".put(\"" + field.javaName() + "\", " + javaTypeName(field) + ".class);");
+
+ add0(src, "");
+ add2(src, "type." + mtdName + "(" + varName + ");");
+ add0(src, "");
+
+ return false;
}
/**
@@ -623,6 +627,9 @@ public class CodeGenerator {
add0(src, "");
boolean first = true;
+ boolean firstAsc = true;
+ boolean firstDesc = true;
+ boolean firstGrps = true;
boolean firstGrp = true;
for (PojoDescriptor pojo : pojos) {
@@ -661,22 +668,24 @@ public class CodeGenerator {
addQueryFields(src, pojo.fields(), "qryFlds", "setQueryFields", "// Query fields for " + tbl + ".", first);
// Ascending fields.
- addQueryFields(src, pojo.ascendingFields(), "ascFlds", "setAscendingFields",
- "// Ascending fields for " + tbl + ".", first);
+ firstAsc = addQueryFields(src, pojo.ascendingFields(), "ascFlds", "setAscendingFields",
+ "// Ascending fields for " + tbl + ".", firstAsc);
// Descending fields.
- addQueryFields(src, pojo.descendingFields(), "descFlds", "setDescendingFields",
- "// Descending fields for " + tbl + ".", first);
+ firstDesc = addQueryFields(src, pojo.descendingFields(), "descFlds", "setDescendingFields",
+ "// Descending fields for " + tbl + ".", firstDesc);
// Groups.
Map<String, Map<String, IndexItem>> groups = pojo.groups();
if (!groups.isEmpty()) {
add2(src, "// Groups for " + tbl + ".");
- add2(src, (first ? "Map<String, LinkedHashMap<String, IgniteBiTuple<Class<?>, Boolean>>> " : "") +
+ add2(src, (firstGrps ? "Map<String, LinkedHashMap<String, IgniteBiTuple<Class<?>, Boolean>>> " : "") +
" grps = new LinkedHashMap<>();");
add0(src, "");
+ firstGrps = false;
+
for (Map.Entry<String, Map<String, IndexItem>> group : groups.entrySet()) {
add2(src, (firstGrp ? "LinkedHashMap<String, IgniteBiTuple<Class<?>, Boolean>> " : "") +
"grpItems = new LinkedHashMap<>();");
[4/8] incubator-ignite git commit: #ignite-834:
IgniteCache.clearAll() throws NPE. #ignite-732: IgniteCache.size() should not
fail in case of topology changes.
Posted by sb...@apache.org.
#ignite-834: IgniteCache.clearAll() throws NPE.
#ignite-732: IgniteCache.size() should not fail in case of topology changes.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/99c7e228
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/99c7e228
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/99c7e228
Branch: refs/heads/ignite-157-2
Commit: 99c7e228d12e25826f74d6d8706d158ec36004ed
Parents: 9ff8029
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed May 6 12:30:57 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed May 6 12:30:57 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheAdapter.java | 511 +++++++++----------
.../resources/META-INF/classnames.properties | 6 +-
2 files changed, 248 insertions(+), 269 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/99c7e228/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 3f4e97b..6674993 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
@@ -21,10 +21,10 @@ import org.apache.ignite.*;
import org.apache.ignite.cache.*;
import org.apache.ignite.cache.affinity.*;
import org.apache.ignite.cluster.*;
+import org.apache.ignite.compute.*;
import org.apache.ignite.configuration.*;
import org.apache.ignite.internal.*;
import org.apache.ignite.internal.cluster.*;
-import org.apache.ignite.internal.compute.*;
import org.apache.ignite.internal.processors.affinity.*;
import org.apache.ignite.internal.processors.cache.affinity.*;
import org.apache.ignite.internal.processors.cache.distributed.*;
@@ -1083,7 +1083,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
// Clear local cache synchronously.
clearLocally();
- clearRemotes(0, new GlobalClearAllCallable(name()));
+ clearRemotes(0, null);
}
/** {@inheritDoc} */
@@ -1091,7 +1091,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
// Clear local cache synchronously.
clearLocally(key);
- clearRemotes(0, new GlobalClearKeySetCallable<K, V>(name(), Collections.singleton(key)));
+ clearRemotes(0, Collections.singleton(key));
}
/** {@inheritDoc} */
@@ -1099,83 +1099,55 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
// Clear local cache synchronously.
clearLocallyAll(keys);
- clearRemotes(0, new GlobalClearKeySetCallable<K, V>(name(), keys));
+ clearRemotes(0, keys);
}
/** {@inheritDoc} */
@Override public IgniteInternalFuture<?> clearAsync(K key) {
- return clearAsync(new GlobalClearKeySetCallable<K, V>(name(), Collections.singleton(key)));
+ return clearKeysAsync(Collections.singleton(key));
}
/** {@inheritDoc} */
@Override public IgniteInternalFuture<?> clearAsync(Set<? extends K> keys) {
- return clearAsync(new GlobalClearKeySetCallable<K, V>(name(), keys));
+ return clearKeysAsync(keys);
}
/**
* @param timeout Timeout for clearLocally all task in milliseconds (0 for never).
* Set it to larger value for large caches.
- * @param clearCall Global clear callable object.
+ * @param keys Keys to clear or {@code null} if all cache should be cleared.
* @throws IgniteCheckedException In case of cache could not be cleared on any of the nodes.
*/
- private void clearRemotes(long timeout, GlobalClearCallable clearCall) throws IgniteCheckedException {
- try {
- // Send job to remote nodes only.
- Collection<ClusterNode> nodes =
- ctx.grid().cluster().forCacheNodes(name(), true, true, false).forRemotes().nodes();
-
- IgniteInternalFuture<Object> fut = null;
-
- if (!nodes.isEmpty()) {
- ctx.kernalContext().task().setThreadContext(TC_TIMEOUT, timeout);
+ private void clearRemotes(long timeout, @Nullable final Set<? extends K> keys) throws IgniteCheckedException {
+ // Send job to remote nodes only.
+ Collection<ClusterNode> nodes =
+ ctx.grid().cluster().forCacheNodes(name(), true, true, false).forRemotes().nodes();
- fut = ctx.closures().callAsyncNoFailover(BROADCAST, clearCall, nodes, true);
- }
+ if (!nodes.isEmpty()) {
+ ctx.kernalContext().task().setThreadContext(TC_TIMEOUT, timeout);
- if (fut != null)
- fut.get();
- }
- catch (ClusterGroupEmptyCheckedException ignore) {
- if (log.isDebugEnabled())
- log.debug("All remote nodes left while cache clearLocally [cacheName=" + name() + "]");
- }
- catch (ComputeTaskTimeoutCheckedException e) {
- U.warn(log, "Timed out waiting for remote nodes to finish cache clear (consider increasing " +
- "'networkTimeout' configuration property) [cacheName=" + name() + "]");
+ ctx.kernalContext().task().setThreadContext(TC_SUBGRID, nodes);
- throw e;
+ ctx.kernalContext().task().execute(new ClearTask(ctx, keys), null).get();
}
}
/** {@inheritDoc} */
@Override public IgniteInternalFuture<?> clearAsync() {
- return clearAsync(new GlobalClearAllCallable(name()));
+ return clearKeysAsync(null);
}
/**
- * @param clearCall Global clear callable object.
+ * @param keys Keys to clear or {@code null} if all cache should be cleared.
* @return Future.
*/
- private IgniteInternalFuture<?> clearAsync(GlobalClearCallable clearCall) {
+ private IgniteInternalFuture<?> clearKeysAsync(final Set<? extends K> keys) {
Collection<ClusterNode> nodes = ctx.grid().cluster().forCacheNodes(name(), true, true, false).nodes();
if (!nodes.isEmpty()) {
- IgniteInternalFuture<Object> fut =
- ctx.closures().callAsyncNoFailover(BROADCAST, clearCall, nodes, true);
+ ctx.kernalContext().task().setThreadContext(TC_SUBGRID, nodes);
- return fut.chain(new CX1<IgniteInternalFuture<Object>, Object>() {
- @Override public Object applyx(IgniteInternalFuture<Object> fut) throws IgniteCheckedException {
- try {
- return fut.get();
- }
- catch (ClusterGroupEmptyCheckedException ignore) {
- if (log.isDebugEnabled())
- log.debug("All remote nodes left while cache clearLocally [cacheName=" + name() + "]");
-
- return null;
- }
- }
- });
+ return ctx.kernalContext().task().execute(new ClearTask(ctx, keys), null);
}
else
return new GridFinishedFuture<>();
@@ -3562,7 +3534,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
}
/** {@inheritDoc} */
- @Override public IgniteInternalFuture<Integer> sizeAsync(CachePeekMode[] peekModes) {
+ @Override public IgniteInternalFuture<Integer> sizeAsync(final CachePeekMode[] peekModes) {
assert peekModes != null;
PeekModes modes = parsePeekModes(peekModes, true);
@@ -3576,22 +3548,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
if (nodes.isEmpty())
return new GridFinishedFuture<>(0);
- IgniteInternalFuture<Collection<Integer>> fut =
- ctx.closures().broadcastNoFailover(new SizeCallable(ctx.name(), peekModes), null, nodes);
-
- return fut.chain(new CX1<IgniteInternalFuture<Collection<Integer>>, Integer>() {
- @Override public Integer applyx(IgniteInternalFuture<Collection<Integer>> fut)
- throws IgniteCheckedException {
- Collection<Integer> res = fut.get();
+ ctx.kernalContext().task().setThreadContext(TC_SUBGRID, nodes);
- int totalSize = 0;
-
- for (Integer size : res)
- totalSize += size;
-
- return totalSize;
- }
- });
+ return ctx.kernalContext().task().execute(new SizeTask(ctx, peekModes), null);
}
/** {@inheritDoc} */
@@ -3909,50 +3868,6 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
}
/**
- * Gets cache global size (with or without backups).
- *
- * @param primaryOnly {@code True} if only primary sizes should be included.
- * @return Global size.
- * @throws IgniteCheckedException If internal task execution failed.
- */
- private int globalSize(boolean primaryOnly) throws IgniteCheckedException {
- try {
- // Send job to remote nodes only.
- Collection<ClusterNode> nodes = ctx.grid().cluster().forCacheNodes(name()).forRemotes().nodes();
-
- IgniteInternalFuture<Collection<Integer>> fut = null;
-
- if (!nodes.isEmpty()) {
- ctx.kernalContext().task().setThreadContext(TC_TIMEOUT, gridCfg.getNetworkTimeout());
-
- fut = ctx.closures().broadcastNoFailover(new GlobalSizeCallable(name(), primaryOnly), null, nodes);
- }
-
- // Get local value.
- int globalSize = primaryOnly ? primarySize() : size();
-
- if (fut != null) {
- for (Integer i : fut.get())
- globalSize += i;
- }
-
- return globalSize;
- }
- catch (ClusterGroupEmptyCheckedException ignore) {
- if (log.isDebugEnabled())
- log.debug("All remote nodes left while cache clearLocally [cacheName=" + name() + "]");
-
- return primaryOnly ? primarySize() : size();
- }
- catch (ComputeTaskTimeoutCheckedException e) {
- U.warn(log, "Timed out waiting for remote nodes to finish cache clear (consider increasing " +
- "'networkTimeout' configuration property) [cacheName=" + name() + "]");
-
- throw e;
- }
- }
-
- /**
* @param op Cache operation.
* @param <T> Return type.
* @return Operation result.
@@ -4893,67 +4808,32 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
}
/**
- * Internal callable which performs clear operation on a cache with the given name.
- */
- @GridInternal
- private static abstract class GlobalClearCallable implements Callable<Object>, Externalizable {
- /** Cache name. */
- protected String cacheName;
-
- /** Injected grid instance. */
- @IgniteInstanceResource
- protected Ignite ignite;
-
- /**
- * Empty constructor for serialization.
- */
- public GlobalClearCallable() {
- // No-op.
- }
-
- /**
- * @param cacheName Cache name.
- */
- protected GlobalClearCallable(String cacheName) {
- this.cacheName = cacheName;
- }
-
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- U.writeString(out, cacheName);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- cacheName = U.readString(in);
- }
- }
-
- /**
* Global clear all.
*/
@GridInternal
- private static class GlobalClearAllCallable extends GlobalClearCallable {
+ private static class GlobalClearAllJob extends TopologyVersionAwareJob {
/** */
private static final long serialVersionUID = 0L;
/**
* Empty constructor for serialization.
*/
- public GlobalClearAllCallable() {
+ public GlobalClearAllJob() {
// No-op.
}
/**
* @param cacheName Cache name.
+ * @param topVer Affinity topology version.
*/
- private GlobalClearAllCallable(String cacheName) {
- super(cacheName);
+ private GlobalClearAllJob(String cacheName, AffinityTopologyVersion topVer) {
+ super(cacheName, topVer);
}
/** {@inheritDoc} */
- @Override public Object call() throws Exception {
- ((IgniteEx)ignite).cachex(cacheName).clearLocally();
+ @Nullable @Override public Object localExecute(@Nullable IgniteInternalCache cache) {
+ if (cache != null)
+ cache.clearLocally();
return null;
}
@@ -4963,7 +4843,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
* Global clear keys.
*/
@GridInternal
- private static class GlobalClearKeySetCallable<K, V> extends GlobalClearCallable {
+ private static class GlobalClearKeySetJob<K> extends TopologyVersionAwareJob {
/** */
private static final long serialVersionUID = 0L;
@@ -4973,166 +4853,75 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
/**
* Empty constructor for serialization.
*/
- public GlobalClearKeySetCallable() {
+ public GlobalClearKeySetJob() {
// No-op.
}
/**
* @param cacheName Cache name.
+ * @param topVer Affinity topology version.
* @param keys Keys to clear.
*/
- private GlobalClearKeySetCallable(String cacheName, Set<? extends K> keys) {
- super(cacheName);
+ private GlobalClearKeySetJob(String cacheName, AffinityTopologyVersion topVer, Set<? extends K> keys) {
+ super(cacheName, topVer);
this.keys = keys;
}
/** {@inheritDoc} */
- @Override public Object call() throws Exception {
- ((IgniteEx)ignite).<K, V>cachex(cacheName).clearLocallyAll(keys);
+ @Nullable @Override public Object localExecute(@Nullable IgniteInternalCache cache) {
+ if (cache != null)
+ cache.clearLocallyAll(keys);
return null;
}
-
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- super.writeExternal(out);
-
- out.writeObject(keys);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- super.readExternal(in);
-
- keys = (Set<K>) in.readObject();
- }
}
/**
* Internal callable for global size calculation.
*/
@GridInternal
- private static class SizeCallable extends IgniteClosureX<Object, Integer> implements Externalizable {
+ private static class SizeJob extends TopologyVersionAwareJob {
/** */
private static final long serialVersionUID = 0L;
- /** Cache name. */
- private String cacheName;
-
/** Peek modes. */
private CachePeekMode[] peekModes;
- /** Injected grid instance. */
- @IgniteInstanceResource
- private Ignite ignite;
-
/**
* Required by {@link Externalizable}.
*/
- public SizeCallable() {
+ public SizeJob() {
// No-op.
}
/**
* @param cacheName Cache name.
+ * @param topVer Affinity topology version.
* @param peekModes Cache peek modes.
*/
- private SizeCallable(String cacheName, CachePeekMode[] peekModes) {
- this.cacheName = cacheName;
- this.peekModes = peekModes;
- }
-
- /** {@inheritDoc} */
- @Override public Integer applyx(Object o) throws IgniteCheckedException {
- IgniteInternalCache<Object, Object> cache = ((IgniteEx)ignite).cachex(cacheName);
-
- assert cache != null : cacheName;
-
- return cache.localSize(peekModes);
- }
-
- /** {@inheritDoc} */
- @SuppressWarnings("ForLoopReplaceableByForEach")
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- U.writeString(out, cacheName);
-
- out.writeInt(peekModes.length);
+ private SizeJob(String cacheName, AffinityTopologyVersion topVer, CachePeekMode[] peekModes) {
+ super(cacheName, topVer);
- for (int i = 0; i < peekModes.length; i++)
- U.writeEnum(out, peekModes[i]);
+ this.peekModes = peekModes;
}
/** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- cacheName = U.readString(in);
-
- int len = in.readInt();
+ @Nullable @Override public Object localExecute(@Nullable IgniteInternalCache cache) {
+ if (cache == null)
+ return 0;
- peekModes = new CachePeekMode[len];
-
- for (int i = 0; i < len; i++)
- peekModes[i] = CachePeekMode.fromOrdinal(in.readByte());
+ try {
+ return cache.localSize(peekModes);
+ }
+ catch (IgniteCheckedException e) {
+ throw U.convertException(e);
+ }
}
/** {@inheritDoc} */
public String toString() {
- return S.toString(SizeCallable.class, this);
- }
- }
-
- /**
- * Internal callable which performs {@link IgniteInternalCache#size()} or {@link IgniteInternalCache#primarySize()}
- * operation on a cache with the given name.
- */
- @GridInternal
- private static class GlobalSizeCallable implements IgniteClosure<Object, Integer>, Externalizable {
- /** */
- private static final long serialVersionUID = 0L;
-
- /** Cache name. */
- private String cacheName;
-
- /** Primary only flag. */
- private boolean primaryOnly;
-
- /** Injected grid instance. */
- @IgniteInstanceResource
- private Ignite ignite;
-
- /**
- * Empty constructor for serialization.
- */
- public GlobalSizeCallable() {
- // No-op.
- }
-
- /**
- * @param cacheName Cache name.
- * @param primaryOnly Primary only flag.
- */
- private GlobalSizeCallable(String cacheName, boolean primaryOnly) {
- this.cacheName = cacheName;
- this.primaryOnly = primaryOnly;
- }
-
- /** {@inheritDoc} */
- @Override public Integer apply(Object o) {
- IgniteInternalCache<Object, Object> cache = ((IgniteEx)ignite).cachex(cacheName);
-
- return primaryOnly ? cache.primarySize() : cache.size();
- }
-
- /** {@inheritDoc} */
- @Override public void writeExternal(ObjectOutput out) throws IOException {
- U.writeString(out, cacheName);
- out.writeBoolean(primaryOnly);
- }
-
- /** {@inheritDoc} */
- @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
- cacheName = U.readString(in);
- primaryOnly = in.readBoolean();
+ return S.toString(SizeJob.class, this);
}
}
@@ -5697,4 +5486,194 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
metrics.addPutAndGetTimeNanos(System.nanoTime() - start);
}
}
+
+ /**
+ * Delayed callable class.
+ */
+ protected static abstract class TopologyVersionAwareJob extends ComputeJobAdapter {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Injected job context. */
+ @JobContextResource
+ protected ComputeJobContext jobCtx;
+
+ /** Injected grid instance. */
+ @IgniteInstanceResource
+ protected Ignite ignite;
+
+ /** Affinity topology version. */
+ protected AffinityTopologyVersion topVer;
+
+ /** Cache name. */
+ protected String cacheName;
+
+ /**
+ * Empty constructor for serialization.
+ */
+ public TopologyVersionAwareJob() {
+ // No-op.
+ }
+
+ /**
+ * @param cacheName Cache name.
+ * @param topVer Affinity topology version.
+ */
+ public TopologyVersionAwareJob(String cacheName, AffinityTopologyVersion topVer) {
+ assert topVer != null;
+
+ this.cacheName = cacheName;
+ this.topVer = topVer;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public final Object execute() {
+ waitAffinityReadyFuture();
+
+ IgniteInternalCache cache = ((IgniteKernal)ignite).context().cache().cache(cacheName);
+
+ return localExecute(cache);
+ }
+
+ /**
+ * @param cache Cache.
+ * @return Local execution result.
+ */
+ @Nullable protected abstract Object localExecute(@Nullable IgniteInternalCache cache);
+
+ /**
+ * Holds (suspends) job execution until our cache version becomes equal to remote cache's version.
+ */
+ private void waitAffinityReadyFuture() {
+ GridCacheProcessor cacheProc = ((IgniteKernal)ignite).context().cache();
+
+ AffinityTopologyVersion locTopVer = cacheProc.context().exchange().readyAffinityVersion();
+
+ if (locTopVer.compareTo(topVer) < 0) {
+ IgniteInternalFuture<?> fut = cacheProc.context().exchange().affinityReadyFuture(topVer);
+
+ if (fut != null && !fut.isDone()) {
+ fut.listen(new CI1<IgniteInternalFuture<?>>() {
+ @Override public void apply(IgniteInternalFuture<?> t) {
+ jobCtx.callcc();
+ }
+ });
+
+ jobCtx.holdcc();
+ }
+ }
+ }
+ }
+
+ /**
+ * Size task.
+ */
+ private static class SizeTask extends ComputeTaskAdapter<Object, Integer> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Cache context. */
+ private GridCacheContext ctx;
+
+ /** Peek modes. */
+ private CachePeekMode[] peekModes;
+
+ /**
+ * Empty constructor for serialization.
+ */
+ public SizeTask() {
+ // No-op.
+ }
+
+ /**
+ * @param ctx Cache context.
+ */
+ public SizeTask(GridCacheContext ctx, CachePeekMode[] peekModes) {
+ this.ctx = ctx;
+ this.peekModes = peekModes;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
+ @Nullable Object arg) throws IgniteException {
+ Map<ComputeJob, ClusterNode> jobs = new HashMap();
+
+ for (ClusterNode node : subgrid)
+ jobs.put(new SizeJob(ctx.name(), ctx.affinity().affinityTopologyVersion(), peekModes), node);
+
+ return jobs;
+ }
+
+ /** {@inheritDoc} */
+ @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) {
+ return ComputeJobResultPolicy.WAIT;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Integer reduce(List<ComputeJobResult> results) throws IgniteException {
+ int size = 0;
+
+ for (ComputeJobResult res : results) {
+ if (res.getException() == null && res != null)
+ size += res.<Integer>getData();
+ }
+
+ return size;
+ }
+ }
+
+ /**
+ * Clear task.
+ */
+ private static class ClearTask<K> extends ComputeTaskAdapter<Object, Object> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Cache context. */
+ private GridCacheContext ctx;
+
+ /** Keys to clear. */
+ private Set<? extends K> keys;
+
+ /**
+ * Empty constructor for serialization.
+ */
+ public ClearTask() {
+ // No-op.
+ }
+
+ /**
+ * @param ctx Cache context.
+ * @param keys Keys to clear.
+ */
+ public ClearTask(GridCacheContext ctx, Set<? extends K> keys) {
+ this.ctx = ctx;
+ this.keys = keys;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid,
+ @Nullable Object arg) throws IgniteException {
+ Map<ComputeJob, ClusterNode> jobs = new HashMap();
+
+ for (ClusterNode node : subgrid) {
+ jobs.put(keys == null ?
+ new GlobalClearAllJob(ctx.name(), ctx.affinity().affinityTopologyVersion()) :
+ new GlobalClearKeySetJob<K>(ctx.name(), ctx.affinity().affinityTopologyVersion(), keys),
+ node);
+ }
+
+ return jobs;
+ }
+
+ /** {@inheritDoc} */
+ @Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) {
+ return ComputeJobResultPolicy.WAIT;
+ }
+
+ /** {@inheritDoc} */
+ @Nullable @Override public Object reduce(List<ComputeJobResult> results) throws IgniteException {
+ return null;
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/99c7e228/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 35495ed..ff263cd 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -323,13 +323,13 @@ org.apache.ignite.internal.processors.cache.GridCacheAdapter$72
org.apache.ignite.internal.processors.cache.GridCacheAdapter$73
org.apache.ignite.internal.processors.cache.GridCacheAdapter$74
org.apache.ignite.internal.processors.cache.GridCacheAdapter$9
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$GlobalClearAllCallable
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$GlobalClearAllJob
org.apache.ignite.internal.processors.cache.GridCacheAdapter$GlobalClearCallable
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$GlobalClearKeySetCallable
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$GlobalClearKeySetJob
org.apache.ignite.internal.processors.cache.GridCacheAdapter$GlobalSizeCallable
org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadCacheClosure
org.apache.ignite.internal.processors.cache.GridCacheAdapter$LoadKeysCallable
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$SizeCallable
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$SizeJob
org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdateGetTimeStatClosure
org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdatePutAndGetTimeStatClosure
org.apache.ignite.internal.processors.cache.GridCacheAdapter$UpdatePutTimeStatClosure
[5/8] incubator-ignite git commit: #gg-10186: NullPointerException at
CacheDrStateTransferHandler.java:320 #gg-10187: NullPointerException at
GridEntSecurityProcessor.java:263
Posted by sb...@apache.org.
#gg-10186: NullPointerException at CacheDrStateTransferHandler.java:320
#gg-10187: NullPointerException at GridEntSecurityProcessor.java:263
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/587103fd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/587103fd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/587103fd
Branch: refs/heads/ignite-157-2
Commit: 587103fdd1273e1d98897a07f98594dac85e38bc
Parents: 99c7e22
Author: ivasilinets <iv...@gridgain.com>
Authored: Wed May 6 12:40:27 2015 +0300
Committer: ivasilinets <iv...@gridgain.com>
Committed: Wed May 6 12:40:27 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheProcessor.java | 109 ++++++++++--------
.../processors/cache/CacheGetFromJobTest.java | 110 +++++++++++++++++++
.../testsuites/IgniteCacheRestartTestSuite.java | 1 +
3 files changed, 174 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/587103fd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index c0026ab..d22d224 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -124,6 +124,9 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/** Must use JDK marshaller since it is used by discovery to fire custom events. */
private Marshaller marshaller = new JdkMarshaller();
+ /** Count down latch for caches. */
+ private final CountDownLatch cacheStartedLatch = new CountDownLatch(1);
+
/**
* @param ctx Kernal context.
*/
@@ -657,87 +660,92 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public void onKernalStart() throws IgniteCheckedException {
- if (ctx.config().isDaemon())
- return;
+ try {
+ if (ctx.config().isDaemon())
+ return;
- ClusterNode locNode = ctx.discovery().localNode();
+ ClusterNode locNode = ctx.discovery().localNode();
- // Init cache plugin managers.
- final Map<String, CachePluginManager> cache2PluginMgr = new HashMap<>();
+ // Init cache plugin managers.
+ final Map<String, CachePluginManager> cache2PluginMgr = new HashMap<>();
- for (DynamicCacheDescriptor desc : registeredCaches.values()) {
- CacheConfiguration locCcfg = desc.cacheConfiguration();
+ for (DynamicCacheDescriptor desc : registeredCaches.values()) {
+ CacheConfiguration locCcfg = desc.cacheConfiguration();
- CachePluginManager pluginMgr = new CachePluginManager(ctx, locCcfg);
+ CachePluginManager pluginMgr = new CachePluginManager(ctx, locCcfg);
- cache2PluginMgr.put(locCcfg.getName(), pluginMgr);
- }
+ cache2PluginMgr.put(locCcfg.getName(), pluginMgr);
+ }
- if (!getBoolean(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK)) {
- for (ClusterNode n : ctx.discovery().remoteNodes()) {
- checkTransactionConfiguration(n);
+ if (!getBoolean(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK)) {
+ for (ClusterNode n : ctx.discovery().remoteNodes()) {
+ checkTransactionConfiguration(n);
- DeploymentMode locDepMode = ctx.config().getDeploymentMode();
- DeploymentMode rmtDepMode = n.attribute(IgniteNodeAttributes.ATTR_DEPLOYMENT_MODE);
+ DeploymentMode locDepMode = ctx.config().getDeploymentMode();
+ DeploymentMode rmtDepMode = n.attribute(IgniteNodeAttributes.ATTR_DEPLOYMENT_MODE);
- CU.checkAttributeMismatch(log, null, n.id(), "deploymentMode", "Deployment mode",
- locDepMode, rmtDepMode, true);
+ CU.checkAttributeMismatch(log, null, n.id(), "deploymentMode", "Deployment mode",
+ locDepMode, rmtDepMode, true);
- for (DynamicCacheDescriptor desc : registeredCaches.values()) {
- CacheConfiguration rmtCfg = desc.remoteConfiguration(n.id());
+ for (DynamicCacheDescriptor desc : registeredCaches.values()) {
+ CacheConfiguration rmtCfg = desc.remoteConfiguration(n.id());
- if (rmtCfg != null) {
- CacheConfiguration locCfg = desc.cacheConfiguration();
+ if (rmtCfg != null) {
+ CacheConfiguration locCfg = desc.cacheConfiguration();
- checkCache(locCfg, rmtCfg, n);
+ checkCache(locCfg, rmtCfg, n);
- // Check plugin cache configurations.
- CachePluginManager pluginMgr = cache2PluginMgr.get(locCfg.getName());
+ // Check plugin cache configurations.
+ CachePluginManager pluginMgr = cache2PluginMgr.get(locCfg.getName());
- assert pluginMgr != null : " Map=" + cache2PluginMgr;
+ assert pluginMgr != null : " Map=" + cache2PluginMgr;
- pluginMgr.validateRemotes(rmtCfg, n);
+ pluginMgr.validateRemotes(rmtCfg, n);
+ }
}
}
}
- }
- // Start dynamic caches received from collect discovery data.
- for (DynamicCacheDescriptor desc : registeredCaches.values()) {
- boolean started = desc.onStart();
+ // Start dynamic caches received from collect discovery data.
+ for (DynamicCacheDescriptor desc : registeredCaches.values()) {
+ boolean started = desc.onStart();
- assert started : "Failed to change started flag for locally configured cache: " + desc;
+ assert started : "Failed to change started flag for locally configured cache: " + desc;
- desc.clearRemoteConfigurations();
+ desc.clearRemoteConfigurations();
- CacheConfiguration ccfg = desc.cacheConfiguration();
+ CacheConfiguration ccfg = desc.cacheConfiguration();
- IgnitePredicate filter = ccfg.getNodeFilter();
+ IgnitePredicate filter = ccfg.getNodeFilter();
- if (filter.apply(locNode)) {
- CacheObjectContext cacheObjCtx = ctx.cacheObjects().contextForCache(ccfg);
+ if (filter.apply(locNode)) {
+ CacheObjectContext cacheObjCtx = ctx.cacheObjects().contextForCache(ccfg);
- CachePluginManager pluginMgr = cache2PluginMgr.get(ccfg.getName());
+ CachePluginManager pluginMgr = cache2PluginMgr.get(ccfg.getName());
- assert pluginMgr != null : " Map=" + cache2PluginMgr;
+ assert pluginMgr != null : " Map=" + cache2PluginMgr;
- GridCacheContext ctx = createCache(ccfg, pluginMgr, desc.cacheType(), cacheObjCtx);
+ GridCacheContext ctx = createCache(ccfg, pluginMgr, desc.cacheType(), cacheObjCtx);
- ctx.dynamicDeploymentId(desc.deploymentId());
+ ctx.dynamicDeploymentId(desc.deploymentId());
- sharedCtx.addCacheContext(ctx);
+ sharedCtx.addCacheContext(ctx);
- GridCacheAdapter cache = ctx.cache();
+ GridCacheAdapter cache = ctx.cache();
- String name = ccfg.getName();
+ String name = ccfg.getName();
- caches.put(maskNull(name), cache);
+ caches.put(maskNull(name), cache);
- startCache(cache);
+ startCache(cache);
- jCacheProxies.put(maskNull(name), new IgniteCacheProxy(ctx, cache, null, false));
+ jCacheProxies.put(maskNull(name), new IgniteCacheProxy(ctx, cache, null, false));
+ }
}
}
+ finally {
+ cacheStartedLatch.countDown();
+ }
ctx.marshallerContext().onMarshallerCacheStarted(ctx);
@@ -835,6 +843,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override public void onKernalStop(boolean cancel) {
+ cacheStartedLatch.countDown();
+
if (ctx.config().isDaemon())
return;
@@ -959,6 +969,13 @@ public class GridCacheProcessor extends GridProcessorAdapter {
}
/**
+ * @throws IgniteCheckedException If failed to wait.
+ */
+ public void awaitStarted() throws IgniteCheckedException {
+ U.await(cacheStartedLatch);
+ }
+
+ /**
* @param cache Cache.
* @throws IgniteCheckedException If failed.
*/
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/587103fd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetFromJobTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetFromJobTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetFromJobTest.java
new file mode 100644
index 0000000..5859bec
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/CacheGetFromJobTest.java
@@ -0,0 +1,110 @@
+/*
+ * 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.internal.*;
+import org.apache.ignite.internal.util.typedef.*;
+import org.apache.ignite.lang.*;
+import org.apache.ignite.resources.*;
+import org.apache.ignite.testframework.*;
+
+import java.util.concurrent.atomic.*;
+
+/**
+ * Job tries to get cache during topology change.
+ */
+public class CacheGetFromJobTest extends GridCacheAbstractSelfTest {
+ /** {@inheritDoc} */
+ @Override protected int gridCount() {
+ return 1;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testTopologyChange() throws Exception {
+ final AtomicReference<Exception> err = new AtomicReference<>();
+
+ final AtomicInteger id = new AtomicInteger(1);
+
+ IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync(new CA() {
+ @Override public void apply() {
+ info("Run topology change.");
+
+ try {
+ for (int i = 0; i < 5; i++) {
+ info("Topology change: " + i);
+
+ startGrid(id.getAndIncrement());
+ }
+ }
+ catch (Exception e) {
+ err.set(e);
+
+ log.error("Unexpected exception in topology-change-thread: " + e, e);
+ }
+ }
+ }, 3, "topology-change-thread");
+
+ int cntr = 0;
+
+ while (!fut.isDone()) {
+ grid(0).compute().broadcast(new TestJob());
+
+ cntr++;
+ }
+
+ log.info("Job execution count: " + cntr);
+
+ Exception err0 = err.get();
+
+ if (err0 != null)
+ throw err0;
+ }
+
+ /**
+ * Test job.
+ */
+ private static class TestJob implements IgniteCallable<Object> {
+ /** Ignite. */
+ @IgniteInstanceResource
+ private Ignite ignite;
+
+ /** */
+ public TestJob() {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
+ @Override public Object call() throws Exception {
+ IgniteCache cache = ignite.cache(null);
+
+ assertNotNull(cache);
+
+ assertEquals(0, cache.localSize());
+
+ return null;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/587103fd/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
index 0ced1c8..796d138 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
@@ -48,6 +48,7 @@ public class IgniteCacheRestartTestSuite extends TestSuite {
suite.addTestSuite(IgniteCacheAtomicPutAllFailoverSelfTest.class);
suite.addTestSuite(IgniteCachePutAllRestartTest.class);
suite.addTestSuite(GridCachePutAllFailoverSelfTest.class);
+ suite.addTestSuite(CacheGetFromJobTest.class);
return suite;
}
[6/8] incubator-ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-157-2' into ignite-sprint-4
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-157-2' into ignite-sprint-4
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/ba210bbb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/ba210bbb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/ba210bbb
Branch: refs/heads/ignite-157-2
Commit: ba210bbbfec66f4ff8913550e1e3b43ba65cf0e1
Parents: 99c7e22 f5f95fb
Author: sboikov <sb...@gridgain.com>
Authored: Wed May 6 12:41:02 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed May 6 12:41:02 2015 +0300
----------------------------------------------------------------------
.../ignite/codegen/MessageCodeGenerator.java | 4 +-
.../communication/GridIoMessageFactory.java | 4 +-
...ridCacheOptimisticCheckPreparedTxFuture.java | 434 ---------------
...idCacheOptimisticCheckPreparedTxRequest.java | 232 --------
...dCacheOptimisticCheckPreparedTxResponse.java | 179 -------
.../distributed/GridCacheTxRecoveryFuture.java | 506 ++++++++++++++++++
.../distributed/GridCacheTxRecoveryRequest.java | 261 +++++++++
.../GridCacheTxRecoveryResponse.java | 182 +++++++
.../GridDistributedTxRemoteAdapter.java | 2 +-
.../cache/transactions/IgniteInternalTx.java | 5 +-
.../cache/transactions/IgniteTxAdapter.java | 2 +-
.../cache/transactions/IgniteTxHandler.java | 38 +-
.../transactions/IgniteTxLocalAdapter.java | 2 +-
.../cache/transactions/IgniteTxManager.java | 173 ++----
.../resources/META-INF/classnames.properties | 6 +-
.../GridCacheAbstractFailoverSelfTest.java | 4 +-
.../GridCacheAbstractNodeRestartSelfTest.java | 94 ++--
...xOriginatingNodeFailureAbstractSelfTest.java | 2 +-
...rDisabledPrimaryNodeFailureRecoveryTest.java | 31 ++
...rtitionedPrimaryNodeFailureRecoveryTest.java | 31 ++
...woBackupsPrimaryNodeFailureRecoveryTest.java | 37 ++
...ePrimaryNodeFailureRecoveryAbstractTest.java | 533 +++++++++++++++++++
.../GridCachePartitionedNodeRestartTest.java | 4 +-
...ePartitionedOptimisticTxNodeRestartTest.java | 4 +-
.../GridCacheReplicatedNodeRestartSelfTest.java | 2 +
.../testsuites/IgniteCacheRestartTestSuite.java | 4 +-
.../ignite/testsuites/IgniteCacheTestSuite.java | 3 -
.../IgniteCacheTxRecoverySelfTestSuite.java | 4 +
28 files changed, 1737 insertions(+), 1046 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/ba210bbb/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
[3/8] incubator-ignite git commit: # GG-10218 Added support for local
query.
Posted by sb...@apache.org.
# GG-10218 Added support for local query.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9ff80298
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9ff80298
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9ff80298
Branch: refs/heads/ignite-157-2
Commit: 9ff80298f395315027883ade7771730b6182477f
Parents: 6d2a759
Author: AKuznetsov <ak...@gridgain.com>
Authored: Wed May 6 14:23:38 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Wed May 6 14:23:38 2015 +0700
----------------------------------------------------------------------
.../ignite/internal/visor/query/VisorQueryArg.java | 14 +++++++++++++-
.../ignite/internal/visor/query/VisorQueryJob.java | 2 ++
.../visor/commands/cache/VisorCacheScanCommand.scala | 2 +-
3 files changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9ff80298/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java
index becebda..5050414 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryArg.java
@@ -32,17 +32,22 @@ public class VisorQueryArg implements Serializable {
/** Query text. */
private final String qryTxt;
+ /** Flag whether to execute query locally. */
+ private final boolean local;
+
/** Result batch size. */
private final int pageSize;
/**
* @param cacheName Cache name for query.
* @param qryTxt Query text.
+ * @param local Flag whether to execute query locally.
* @param pageSize Result batch size.
*/
- public VisorQueryArg(String cacheName, String qryTxt, int pageSize) {
+ public VisorQueryArg(String cacheName, String qryTxt, boolean local, int pageSize) {
this.cacheName = cacheName;
this.qryTxt = qryTxt;
+ this.local = local;
this.pageSize = pageSize;
}
@@ -61,6 +66,13 @@ public class VisorQueryArg implements Serializable {
}
/**
+ * @return {@code true} if query should be executed locally.
+ */
+ public boolean local() {
+ return local;
+ }
+
+ /**
* @return Page size.
*/
public int pageSize() {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9ff80298/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
index ebf62fa..4a9daad 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryJob.java
@@ -75,6 +75,7 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
if (scan) {
ScanQuery<Object, Object> qry = new ScanQuery<>(null);
qry.setPageSize(arg.pageSize());
+ qry.setLocal(arg.local());
long start = U.currentTimeMillis();
@@ -100,6 +101,7 @@ public class VisorQueryJob extends VisorJob<VisorQueryArg, IgniteBiTuple<? exten
else {
SqlFieldsQuery qry = new SqlFieldsQuery(arg.queryTxt());
qry.setPageSize(arg.pageSize());
+ qry.setLocal(arg.local());
long start = U.currentTimeMillis();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9ff80298/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala
----------------------------------------------------------------------
diff --git a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala
index d40ec8d..4b66720 100644
--- a/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala
+++ b/modules/visor-console/src/main/scala/org/apache/ignite/visor/commands/cache/VisorCacheScanCommand.scala
@@ -139,7 +139,7 @@ class VisorCacheScanCommand {
val firstPage =
try
executeRandom(groupForDataNode(node, cacheName),
- classOf[VisorQueryTask], new VisorQueryArg(cacheName, "SCAN", pageSize)) match {
+ classOf[VisorQueryTask], new VisorQueryArg(cacheName, "SCAN", false, pageSize)) match {
case x if x.get1() != null =>
error(x.get1())
[2/8] incubator-ignite git commit: # ignite-sprint-4 Fixed update
notifier test.
Posted by sb...@apache.org.
# ignite-sprint-4 Fixed update notifier test.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6d2a7597
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6d2a7597
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6d2a7597
Branch: refs/heads/ignite-157-2
Commit: 6d2a7597658cee5c1bf2ff607762baefcc17783d
Parents: 4a096d9
Author: Andrey <an...@gridgain.com>
Authored: Wed May 6 13:50:00 2015 +0700
Committer: Andrey <an...@gridgain.com>
Committed: Wed May 6 13:50:00 2015 +0700
----------------------------------------------------------------------
.../internal/GridUpdateNotifierSelfTest.java | 21 ++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/6d2a7597/modules/core/src/test/java/org/apache/ignite/internal/GridUpdateNotifierSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridUpdateNotifierSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridUpdateNotifierSelfTest.java
index 65e927b..abc9109 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/GridUpdateNotifierSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/GridUpdateNotifierSelfTest.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal;
import org.apache.ignite.*;
+import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.lang.*;
import org.apache.ignite.plugin.*;
import org.apache.ignite.testframework.junits.common.*;
@@ -31,6 +32,8 @@ import java.util.concurrent.*;
*/
@GridCommonTest(group = "Kernal Self")
public class GridUpdateNotifierSelfTest extends GridCommonAbstractTest {
+ private String updateStatusParams;
+
/** {@inheritDoc} */
@Override protected long getTestTimeout() {
return 30 * 1000;
@@ -41,6 +44,12 @@ public class GridUpdateNotifierSelfTest extends GridCommonAbstractTest {
super.beforeTestsStarted();
System.setProperty(IgniteSystemProperties.IGNITE_UPDATE_NOTIFIER, "true");
+
+ Properties props = U.field(IgniteProperties.class, "PROPS");
+
+ updateStatusParams = props.getProperty("ignite.update.status.params");
+
+ props.setProperty("ignite.update.status.params", "ver=" + IgniteProperties.get("ignite.version"));
}
/** {@inheritDoc} */
@@ -48,6 +57,10 @@ public class GridUpdateNotifierSelfTest extends GridCommonAbstractTest {
super.afterTestsStopped();
System.setProperty(IgniteSystemProperties.IGNITE_UPDATE_NOTIFIER, "false");
+
+ Properties props = U.field(IgniteProperties.class, "PROPS");
+
+ props.setProperty("ignite.update.status.params", updateStatusParams);
}
/**
@@ -67,8 +80,12 @@ public class GridUpdateNotifierSelfTest extends GridCommonAbstractTest {
assertNotNull("Ignite latest version has not been detected.", ver);
- assertEquals("Wrong latest version.", IgniteProductVersion.fromString(nodeVer).maintenance(),
- IgniteProductVersion.fromString(ver).maintenance());
+ byte nodeMaintenance = IgniteProductVersion.fromString(nodeVer).maintenance();
+
+ byte lastMaintenance = IgniteProductVersion.fromString(ver).maintenance();
+
+ assertTrue("Wrong latest version.", (nodeMaintenance == 0 && lastMaintenance == 0) ||
+ (nodeMaintenance > 0 && lastMaintenance > 0));
ntf.reportStatus(log);
}
[7/8] incubator-ignite git commit: Merge remote-tracking branch
'origin/ignite-sprint-4' into ignite-sprint-4
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-sprint-4' into ignite-sprint-4
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7be25bd7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7be25bd7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7be25bd7
Branch: refs/heads/ignite-157-2
Commit: 7be25bd7859f6cf45e6454c44ed9b1501d87fd4b
Parents: ba210bb 587103f
Author: sboikov <sb...@gridgain.com>
Authored: Wed May 6 12:44:56 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed May 6 12:44:56 2015 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheProcessor.java | 109 ++++++++++--------
.../processors/cache/CacheGetFromJobTest.java | 110 +++++++++++++++++++
.../testsuites/IgniteCacheRestartTestSuite.java | 1 +
3 files changed, 174 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7be25bd7/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheRestartTestSuite.java
----------------------------------------------------------------------
[8/8] incubator-ignite git commit: ignite-862: Fixed.
Posted by sb...@apache.org.
ignite-862: Fixed.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d4908f24
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d4908f24
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d4908f24
Branch: refs/heads/ignite-157-2
Commit: d4908f2449a4fde9298f6ca11590e0a94a94c955
Parents: 7be25bd
Author: Artem Shutak <as...@gridgain.com>
Authored: Wed May 6 12:58:08 2015 +0300
Committer: Artem Shutak <as...@gridgain.com>
Committed: Wed May 6 12:58:08 2015 +0300
----------------------------------------------------------------------
.../cache/DynamicCacheDescriptor.java | 16 ++++++++++-
.../processors/cache/GridCacheProcessor.java | 30 ++++++--------------
2 files changed, 24 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d4908f24/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
index d8da9ef..6f6f422 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/DynamicCacheDescriptor.java
@@ -18,6 +18,8 @@
package org.apache.ignite.internal.processors.cache;
import org.apache.ignite.configuration.*;
+import org.apache.ignite.internal.*;
+import org.apache.ignite.internal.processors.plugin.*;
import org.apache.ignite.internal.util.tostring.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.apache.ignite.lang.*;
@@ -56,13 +58,17 @@ public class DynamicCacheDescriptor {
/** Template configuration flag. */
private boolean template;
+ /** Cache plugin manager. */
+ private final CachePluginManager pluginMgr;
+
/**
* @param cacheCfg Cache configuration.
* @param cacheType Cache type.
* @param template {@code True} if this is template configuration.
* @param deploymentId Deployment ID.
*/
- public DynamicCacheDescriptor(CacheConfiguration cacheCfg,
+ public DynamicCacheDescriptor(GridKernalContext ctx,
+ CacheConfiguration cacheCfg,
CacheType cacheType,
boolean template,
IgniteUuid deploymentId) {
@@ -70,6 +76,7 @@ public class DynamicCacheDescriptor {
this.cacheType = cacheType;
this.template = template;
this.deploymentId = deploymentId;
+ pluginMgr = new CachePluginManager(ctx, cacheCfg);
}
/**
@@ -149,6 +156,13 @@ public class DynamicCacheDescriptor {
}
/**
+ * @return Cache plugin manager.
+ */
+ public CachePluginManager pluginManager() {
+ return pluginMgr;
+ }
+
+ /**
* Sets cancelled flag.
*/
public void onCancelled() {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d4908f24/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index d22d224..2b9a821 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -610,7 +610,8 @@ public class GridCacheProcessor extends GridProcessorAdapter {
boolean template = cfg.getName() != null && cfg.getName().endsWith("*");
- DynamicCacheDescriptor desc = new DynamicCacheDescriptor(cfg, cacheType, template, IgniteUuid.randomUuid());
+ DynamicCacheDescriptor desc = new DynamicCacheDescriptor(ctx, cfg, cacheType, template,
+ IgniteUuid.randomUuid());
desc.locallyConfigured(true);
desc.staticallyConfigured(true);
@@ -638,7 +639,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (cfg.getName() == null) { // Use cache configuration with null name as template.
DynamicCacheDescriptor desc0 =
- new DynamicCacheDescriptor(cfg, cacheType, true, IgniteUuid.randomUuid());
+ new DynamicCacheDescriptor(ctx, cfg, cacheType, true, IgniteUuid.randomUuid());
desc0.locallyConfigured(true);
desc0.staticallyConfigured(true);
@@ -666,17 +667,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
ClusterNode locNode = ctx.discovery().localNode();
- // Init cache plugin managers.
- final Map<String, CachePluginManager> cache2PluginMgr = new HashMap<>();
-
- for (DynamicCacheDescriptor desc : registeredCaches.values()) {
- CacheConfiguration locCcfg = desc.cacheConfiguration();
-
- CachePluginManager pluginMgr = new CachePluginManager(ctx, locCcfg);
-
- cache2PluginMgr.put(locCcfg.getName(), pluginMgr);
- }
-
if (!getBoolean(IGNITE_SKIP_CONFIGURATION_CONSISTENCY_CHECK)) {
for (ClusterNode n : ctx.discovery().remoteNodes()) {
checkTransactionConfiguration(n);
@@ -696,9 +686,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
checkCache(locCfg, rmtCfg, n);
// Check plugin cache configurations.
- CachePluginManager pluginMgr = cache2PluginMgr.get(locCfg.getName());
-
- assert pluginMgr != null : " Map=" + cache2PluginMgr;
+ CachePluginManager pluginMgr = desc.pluginManager();
pluginMgr.validateRemotes(rmtCfg, n);
}
@@ -721,9 +709,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (filter.apply(locNode)) {
CacheObjectContext cacheObjCtx = ctx.cacheObjects().contextForCache(ccfg);
- CachePluginManager pluginMgr = cache2PluginMgr.get(ccfg.getName());
-
- assert pluginMgr != null : " Map=" + cache2PluginMgr;
+ CachePluginManager pluginMgr = desc.pluginManager();
GridCacheContext ctx = createCache(ccfg, pluginMgr, desc.cacheType(), cacheObjCtx);
@@ -1657,6 +1643,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (existing == null) {
DynamicCacheDescriptor desc = new DynamicCacheDescriptor(
+ ctx,
ccfg,
req.cacheType(),
true,
@@ -1690,6 +1677,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
assert req.cacheType() != null : req;
DynamicCacheDescriptor desc = new DynamicCacheDescriptor(
+ ctx,
ccfg,
req.cacheType(),
false,
@@ -2039,7 +2027,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (desc == null) {
DynamicCacheDescriptor templateDesc =
- new DynamicCacheDescriptor(ccfg, req.cacheType(), true, req.deploymentId());
+ new DynamicCacheDescriptor(ctx, ccfg, req.cacheType(), true, req.deploymentId());
DynamicCacheDescriptor old = registeredTemplates.put(maskNull(ccfg.getName()), templateDesc);
@@ -2093,7 +2081,7 @@ public class GridCacheProcessor extends GridProcessorAdapter {
assert req.cacheType() != null : req;
DynamicCacheDescriptor startDesc =
- new DynamicCacheDescriptor(ccfg, req.cacheType(), false, req.deploymentId());
+ new DynamicCacheDescriptor(ctx, ccfg, req.cacheType(), false, req.deploymentId());
DynamicCacheDescriptor old = registeredCaches.put(maskNull(ccfg.getName()), startDesc);