You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2016/02/05 13:25:37 UTC
[01/14] ignite git commit: fixed
https://issues.apache.org/jira/browse/IGNITE-2329 + forceKeysFuture opts
Repository: ignite
Updated Branches:
refs/heads/ignite-2329-1 [created] 11c369a93
fixed https://issues.apache.org/jira/browse/IGNITE-2329 + forceKeysFuture opts
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/914b365f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/914b365f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/914b365f
Branch: refs/heads/ignite-2329-1
Commit: 914b365f79311e56c46ee4e214f60d60753030cc
Parents: 1f5b202
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Mon Jan 25 21:34:43 2016 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Mon Jan 25 21:34:43 2016 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheAdapter.java | 17 +-
.../processors/cache/GridCacheMvccManager.java | 40 ++---
.../processors/cache/GridCacheUtils.java | 21 ++-
.../cache/distributed/dht/GridDhtGetFuture.java | 156 ++++++++++++-------
.../distributed/dht/GridDhtTxPrepareFuture.java | 7 +-
.../dht/atomic/GridDhtAtomicCache.java | 3 +-
.../dht/colocated/GridDhtColocatedCache.java | 40 +++--
.../dht/preloader/GridDhtPreloader.java | 3 +
.../cache/distributed/near/GridNearTxLocal.java | 1 -
.../ignite/internal/util/nio/GridNioServer.java | 137 ++++++++++++++--
.../util/nio/SelectedSelectionKeySet.java | 111 +++++++++++++
.../near/GridCacheNearReadersSelfTest.java | 19 ++-
12 files changed, 412 insertions(+), 143 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/914b365f/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 2582e6c..0bacae3 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
@@ -99,7 +99,6 @@ import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException;
import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException;
import org.apache.ignite.internal.util.F0;
-import org.apache.ignite.internal.util.GridLeanMap;
import org.apache.ignite.internal.util.future.GridEmbeddedFuture;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
@@ -1633,7 +1632,8 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
* @param needVer If {@code true} returns values as tuples containing value and version.
* @return Future.
*/
- public final <K1, V1> IgniteInternalFuture<Map<K1, V1>> getAllAsync0(@Nullable final Collection<KeyCacheObject> keys,
+ public final <K1, V1> IgniteInternalFuture<Map<K1, V1>> getAllAsync0(
+ @Nullable final Collection<KeyCacheObject> keys,
final boolean readThrough,
boolean checkTx,
@Nullable final UUID subjId,
@@ -1644,7 +1644,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
final boolean keepCacheObjects,
boolean canRemap,
final boolean needVer
- ) {
+ ) {
if (F.isEmpty(keys))
return new GridFinishedFuture<>(Collections.<K1, V1>emptyMap());
@@ -1663,11 +1663,12 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
if (tx == null || tx.implicit()) {
try {
- final AffinityTopologyVersion topVer = tx == null
- ? (canRemap ? ctx.affinity().affinityTopologyVersion(): ctx.shared().exchange().readyAffinityVersion())
- : tx.topologyVersion();
+ final AffinityTopologyVersion topVer = tx == null ?
+ (canRemap ?
+ ctx.affinity().affinityTopologyVersion() : ctx.shared().exchange().readyAffinityVersion()) :
+ tx.topologyVersion();
- final Map<K1, V1> map = new GridLeanMap<>(keys.size());
+ final Map<K1, V1> map = U.newHashMap(keys.size());
final boolean storeEnabled = !skipVals && readThrough && ctx.readThrough();
@@ -1703,7 +1704,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
GridCacheVersion ver = entry.version();
if (misses == null)
- misses = new GridLeanMap<>();
+ misses = new HashMap<>();
misses.put(key, ver);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/914b365f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
index c7d1f62..d4f55b6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
@@ -17,6 +17,18 @@
package org.apache.ignite.internal.processors.cache;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ConcurrentMap;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteLogger;
import org.apache.ignite.events.DiscoveryEvent;
@@ -52,18 +64,6 @@ import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentHashMap8;
import org.jsr166.ConcurrentLinkedDeque8;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.ConcurrentMap;
-
import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
import static org.apache.ignite.internal.util.GridConcurrentFactory.newMap;
@@ -77,10 +77,10 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
private static final int MAX_REMOVED_LOCKS = 10240;
/** Pending locks per thread. */
- private final ThreadLocal<LinkedList<GridCacheMvccCandidate>> pending =
- new ThreadLocal<LinkedList<GridCacheMvccCandidate>>() {
- @Override protected LinkedList<GridCacheMvccCandidate> initialValue() {
- return new LinkedList<>();
+ private final ThreadLocal<Deque<GridCacheMvccCandidate>> pending =
+ new ThreadLocal<Deque<GridCacheMvccCandidate>>() {
+ @Override protected Deque<GridCacheMvccCandidate> initialValue() {
+ return new ArrayDeque<>();
}
};
@@ -683,7 +683,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
* @return Remote candidates.
*/
public Collection<GridCacheMvccCandidate> remoteCandidates() {
- Collection<GridCacheMvccCandidate> rmtCands = new LinkedList<>();
+ Collection<GridCacheMvccCandidate> rmtCands = new ArrayList<>();
for (GridDistributedCacheEntry entry : locked())
rmtCands.addAll(entry.remoteMvccSnapshot());
@@ -697,7 +697,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
* @return Local candidates.
*/
public Collection<GridCacheMvccCandidate> localCandidates() {
- Collection<GridCacheMvccCandidate> locCands = new LinkedList<>();
+ Collection<GridCacheMvccCandidate> locCands = new ArrayList<>();
for (GridDistributedCacheEntry entry : locked()) {
try {
@@ -726,7 +726,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
if (cacheCtx.isNear() || cand.singleImplicit())
return true;
- LinkedList<GridCacheMvccCandidate> queue = pending.get();
+ Deque<GridCacheMvccCandidate> queue = pending.get();
GridCacheMvccCandidate prev = null;
@@ -751,7 +751,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
* Reset MVCC context.
*/
public void contextReset() {
- pending.set(new LinkedList<GridCacheMvccCandidate>());
+ pending.remove();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/914b365f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
index 51f6dcd..ea57071 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
@@ -752,23 +752,28 @@ public class GridCacheUtils {
* @param <T> Collection element type.
* @return Reducer.
*/
- public static <T> IgniteReducer<Collection<T>, Collection<T>> collectionsReducer() {
+ public static <T> IgniteReducer<Collection<T>, Collection<T>> collectionsReducer(final int size) {
return new IgniteReducer<Collection<T>, Collection<T>>() {
- private final Collection<T> ret = new ConcurrentLinkedQueue<>();
+ private List<T> ret;
+
+ @Override public synchronized boolean collect(Collection<T> c) {
+ if (c == null)
+ return true;
+
+ if (ret == null)
+ ret = new ArrayList<>(size);
- @Override public boolean collect(Collection<T> c) {
- if (c != null)
- ret.addAll(c);
+ ret.addAll(c);
return true;
}
- @Override public Collection<T> reduce() {
- return ret;
+ @Override public synchronized Collection<T> reduce() {
+ return ret == null ? Collections.<T>emptyList() : ret;
}
/** {@inheritDoc} */
- @Override public String toString() {
+ @Override public synchronized String toString() {
return "Collection reducer: " + ret;
}
};
http://git-wip-us.apache.org/repos/asf/ignite/blob/914b365f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
index cb8c842..ab166d5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
@@ -137,7 +137,7 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col
@Nullable IgniteCacheExpiryPolicy expiryPlc,
boolean skipVals
) {
- super(CU.<GridCacheEntryInfo>collectionsReducer());
+ super(CU.<GridCacheEntryInfo>collectionsReducer(keys.size()));
assert reader != null;
assert !F.isEmpty(keys);
@@ -209,60 +209,72 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col
private void map(final Map<KeyCacheObject, Boolean> keys) {
GridDhtFuture<Object> fut = cctx.dht().dhtPreloader().request(keys.keySet(), topVer);
- if (!F.isEmpty(fut.invalidPartitions())) {
- if (retries == null)
- retries = new HashSet<>();
+ if (fut != null) {
+ if (F.isEmpty(fut.invalidPartitions())) {
+ if (retries == null)
+ retries = new HashSet<>();
- retries.addAll(fut.invalidPartitions());
- }
+ retries.addAll(fut.invalidPartitions());
+ }
- add(new GridEmbeddedFuture<>(
- new IgniteBiClosure<Object, Exception, Collection<GridCacheEntryInfo>>() {
- @Override public Collection<GridCacheEntryInfo> apply(Object o, Exception e) {
- if (e != null) { // Check error first.
- if (log.isDebugEnabled())
- log.debug("Failed to request keys from preloader [keys=" + keys + ", err=" + e + ']');
+ add(new GridEmbeddedFuture<>(
+ new IgniteBiClosure<Object, Exception, Collection<GridCacheEntryInfo>>() {
+ @Override public Collection<GridCacheEntryInfo> apply(Object o, Exception e) {
+ if (e != null) { // Check error first.
+ if (log.isDebugEnabled())
+ log.debug("Failed to request keys from preloader [keys=" + keys + ", err=" + e + ']');
- onDone(e);
+ onDone(e);
+ }
+ else
+ map0(keys);
+
+ // Finish this one.
+ return Collections.emptyList();
}
+ },
+ fut));
+ }
+ else
+ map0(keys);
+ }
- Map<KeyCacheObject, Boolean> mappedKeys = null;
- // Assign keys to primary nodes.
- for (Map.Entry<KeyCacheObject, Boolean> key : keys.entrySet()) {
- int part = cctx.affinity().partition(key.getKey());
+ /**
+ * @param keys Keys to map.
+ */
+ private void map0(Map<KeyCacheObject, Boolean> keys) {
+ Map<KeyCacheObject, Boolean> mappedKeys = null;
+
+ // Assign keys to primary nodes.
+ for (Map.Entry<KeyCacheObject, Boolean> key : keys.entrySet()) {
+ int part = cctx.affinity().partition(key.getKey());
- if (retries == null || !retries.contains(part)) {
- if (!map(key.getKey(), parts)) {
- if (retries == null)
- retries = new HashSet<>();
+ if (retries == null || !retries.contains(part)) {
+ if (!map(key.getKey(), parts)) {
+ if (retries == null)
+ retries = new HashSet<>();
- retries.add(part);
+ retries.add(part);
- if (mappedKeys == null) {
- mappedKeys = U.newLinkedHashMap(keys.size());
+ if (mappedKeys == null) {
+ mappedKeys = U.newLinkedHashMap(keys.size());
- for (Map.Entry<KeyCacheObject, Boolean> key1 : keys.entrySet()) {
- if (key1.getKey() == key.getKey())
- break;
+ for (Map.Entry<KeyCacheObject, Boolean> key1 : keys.entrySet()) {
+ if (key1.getKey() == key.getKey())
+ break;
- mappedKeys.put(key.getKey(), key1.getValue());
- }
- }
- }
- else if (mappedKeys != null)
- mappedKeys.put(key.getKey(), key.getValue());
+ mappedKeys.put(key.getKey(), key1.getValue());
}
}
-
- // Add new future.
- add(getAsync(mappedKeys == null ? keys : mappedKeys));
-
- // Finish this one.
- return Collections.emptyList();
}
- },
- fut));
+ else if (mappedKeys != null)
+ mappedKeys.put(key.getKey(), key.getValue());
+ }
+ }
+
+ // Add new future.
+ add(getAsync(mappedKeys == null ? keys : mappedKeys));
}
/**
@@ -420,37 +432,63 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col
);
}
+ if (fut.isDone()) {
+ if (fut.error() != null)
+ onDone(fut.error());
+ else {
+ Map<KeyCacheObject, T2<CacheObject, GridCacheVersion>> map = null;
+
+ try {
+ map = fut.get();
+ }
+ catch (IgniteCheckedException e) {
+ assert false; // Should never happen.
+ }
+
+ return new GridFinishedFuture<>(toEntryInfos(map));
+ }
+ }
+
return new GridEmbeddedFuture<>(
new C2<Map<KeyCacheObject, T2<CacheObject, GridCacheVersion>>, Exception, Collection<GridCacheEntryInfo>>() {
- @Override public Collection<GridCacheEntryInfo> apply(Map<KeyCacheObject, T2<CacheObject, GridCacheVersion>> map, Exception e) {
+ @Override public Collection<GridCacheEntryInfo> apply(
+ Map<KeyCacheObject, T2<CacheObject, GridCacheVersion>> map, Exception e
+ ) {
if (e != null) {
onDone(e);
return Collections.emptyList();
}
- else {
- Collection<GridCacheEntryInfo> infos = new ArrayList<>(map.size());
+ else
+ return toEntryInfos(map);
+ }
+ },
+ fut);
+ }
- for (Map.Entry<KeyCacheObject, T2<CacheObject, GridCacheVersion>> entry : map.entrySet()) {
- T2<CacheObject, GridCacheVersion> val = entry.getValue();
+ /**
+ * @param map Map to convert.
+ * @return List of infos.
+ */
+ private Collection<GridCacheEntryInfo> toEntryInfos(Map<KeyCacheObject, T2<CacheObject, GridCacheVersion>> map) {
+ Collection<GridCacheEntryInfo> infos = new ArrayList<>(map.size());
- assert val != null;
+ for (Map.Entry<KeyCacheObject, T2<CacheObject, GridCacheVersion>> entry : map.entrySet()) {
+ T2<CacheObject, GridCacheVersion> val = entry.getValue();
- GridCacheEntryInfo info = new GridCacheEntryInfo();
+ assert val != null;
- info.cacheId(cctx.cacheId());
- info.key(entry.getKey());
- info.value(skipVals ? null : val.get1());
- info.version(val.get2());
+ GridCacheEntryInfo info = new GridCacheEntryInfo();
- infos.add(info);
- }
+ info.cacheId(cctx.cacheId());
+ info.key(entry.getKey());
+ info.value(skipVals ? null : val.get1());
+ info.version(val.get2());
- return infos;
- }
- }
- },
- fut);
+ infos.add(info);
+ }
+
+ return infos;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/914b365f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
index d8b2f37..228dfda 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
@@ -988,7 +988,7 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
lastForceFut = cctx.cacheContext(cacheId).preloader().request(keys, tx.topologyVersion());
- if (compFut != null)
+ if (compFut != null && lastForceFut != null)
compFut.add(lastForceFut);
}
@@ -997,11 +997,8 @@ public final class GridDhtTxPrepareFuture extends GridCompoundFuture<IgniteInter
return compFut;
}
- else {
- assert lastForceFut != null;
-
+ else
return lastForceFut;
- }
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/914b365f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
index aa79cfa..1202de8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
@@ -77,7 +77,6 @@ import org.apache.ignite.internal.processors.cache.distributed.near.GridNearSing
import org.apache.ignite.internal.processors.cache.dr.GridCacheDrExpirationInfo;
import org.apache.ignite.internal.processors.cache.dr.GridCacheDrInfo;
import org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalEx;
-import org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersionConflictContext;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersionEx;
@@ -1216,7 +1215,7 @@ public class GridDhtAtomicCache<K, V> extends GridDhtCacheAdapter<K, V> {
) {
IgniteInternalFuture<Object> forceFut = preldr.request(req.keys(), req.topologyVersion());
- if (forceFut.isDone())
+ if (forceFut == null || forceFut.isDone())
updateAllAsyncInternal0(nodeId, req, completionCb);
else {
forceFut.listen(new CI1<IgniteInternalFuture<Object>>() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/914b365f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
index 073043d..cdd63f6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
@@ -893,28 +893,24 @@ public class GridDhtColocatedCache<K, V> extends GridDhtTransactionalCacheAdapte
IgniteInternalFuture<Object> keyFut = ctx.dht().dhtPreloader().request(keys, topVer);
// Prevent embedded future creation if possible.
- if (keyFut.isDone()) {
- try {
- // Check for exception.
- keyFut.get();
-
- return lockAllAsync0(cacheCtx,
- tx,
- threadId,
- ver,
- topVer,
- keys,
- txRead,
- retval,
- timeout,
- accessTtl,
- filter,
- skipStore,
- keepBinary);
- }
- catch (IgniteCheckedException e) {
- return new GridFinishedFuture<>(e);
- }
+ if (keyFut == null || keyFut.isDone()) {
+ // Check for exception.
+ if (keyFut != null && keyFut.error() != null)
+ return new GridFinishedFuture<>(keyFut.error());
+
+ return lockAllAsync0(cacheCtx,
+ tx,
+ threadId,
+ ver,
+ topVer,
+ keys,
+ txRead,
+ retval,
+ timeout,
+ accessTtl,
+ filter,
+ skipStore,
+ keepBinary);
}
else {
return new GridEmbeddedFuture<>(keyFut,
http://git-wip-us.apache.org/repos/asf/ignite/blob/914b365f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
index f0054e4..9f1e25d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
@@ -698,6 +698,9 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
*/
@SuppressWarnings( {"unchecked", "RedundantCast"})
@Override public GridDhtFuture<Object> request(Collection<KeyCacheObject> keys, AffinityTopologyVersion topVer) {
+ if (rebalanceFuture().isDone())
+ return null;
+
final GridDhtForceKeysFuture<?, ?> fut = new GridDhtForceKeysFuture<>(cctx, topVer, keys, this);
IgniteInternalFuture<?> topReadyFut = cctx.affinity().affinityReadyFuturex(topVer);
http://git-wip-us.apache.org/repos/asf/ignite/blob/914b365f/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
index b7b480e..0853b77 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/near/GridNearTxLocal.java
@@ -23,7 +23,6 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
-import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
import javax.cache.expiry.ExpiryPolicy;
import org.apache.ignite.IgniteCheckedException;
http://git-wip-us.apache.org/repos/asf/ignite/blob/914b365f/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
index 84c8157..c44e1ac 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.util.nio;
import java.io.IOException;
+import java.lang.reflect.Field;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
@@ -43,10 +44,10 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentLinkedQueue;
-
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.IgniteException;
import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.IgniteSystemProperties;
import org.apache.ignite.configuration.ConnectorConfiguration;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
@@ -102,6 +103,24 @@ public class GridNioServer<T> {
/** SSL write buf limit. */
private static final int WRITE_BUF_LIMIT = GridNioSessionMetaKey.nextUniqueKey();
+ /** */
+ private static final boolean DISABLE_KEYSET_OPTIMIZATION =
+ IgniteSystemProperties.getBoolean("IGNITE_NO_SELECTOR_OPTS", false);
+
+ /**
+ *
+ */
+ static {
+ // This is a workaround for JDK bug (NPE in Selector.open()).
+ // http://bugs.sun.com/view_bug.do?bug_id=6427854
+ try {
+ Selector.open().close();
+ }
+ catch (IOException ignored) {
+ // No-op.
+ }
+ }
+
/** Accept worker thread. */
@GridToStringExclude
private final IgniteThread acceptThread;
@@ -184,17 +203,6 @@ public class GridNioServer<T> {
/** Optional listener to monitor outbound message queue size. */
private IgniteBiInClosure<GridNioSession, Integer> msgQueueLsnr;
- /** Static initializer ensures single-threaded execution of workaround. */
- static {
- // This is a workaround for JDK bug (NPE in Selector.open()).
- // http://bugs.sun.com/view_bug.do?bug_id=6427854
- try {
- Selector.open().close();
- }
- catch (IOException ignored) {
- }
- }
-
/**
* @param addr Address.
* @param port Port.
@@ -1263,6 +1271,9 @@ public class GridNioServer<T> {
/** Selector to select read events. */
private Selector selector;
+ /** Selected keys. */
+ private SelectedSelectionKeySet selectedKeys;
+
/** Worker index. */
private final int idx;
@@ -1277,7 +1288,7 @@ public class GridNioServer<T> {
throws IgniteCheckedException {
super(gridName, name, log);
- selector = createSelector(null);
+ createSelector();
this.idx = idx;
}
@@ -1286,10 +1297,11 @@ public class GridNioServer<T> {
@Override protected void body() throws InterruptedException, IgniteInterruptedCheckedException {
try {
boolean reset = false;
+
while (!closed) {
try {
if (reset)
- selector = createSelector(null);
+ createSelector();
bodyInternal();
}
@@ -1314,6 +1326,50 @@ public class GridNioServer<T> {
}
/**
+ * @throws IgniteCheckedException If failed.
+ */
+ private void createSelector() throws IgniteCheckedException {
+ selectedKeys = null;
+
+ selector = GridNioServer.this.createSelector(null);
+
+ if (DISABLE_KEYSET_OPTIMIZATION)
+ return;
+
+ try {
+ SelectedSelectionKeySet selectedKeySet = new SelectedSelectionKeySet();
+
+ Class<?> selectorImplClass =
+ Class.forName("sun.nio.ch.SelectorImpl", false, U.gridClassLoader());
+
+ // Ensure the current selector implementation is what we can instrument.
+ if (!selectorImplClass.isAssignableFrom(selector.getClass()))
+ return;
+
+ Field selectedKeysField = selectorImplClass.getDeclaredField("selectedKeys");
+ Field publicSelectedKeysField = selectorImplClass.getDeclaredField("publicSelectedKeys");
+
+ selectedKeysField.setAccessible(true);
+ publicSelectedKeysField.setAccessible(true);
+
+ selectedKeysField.set(selector, selectedKeySet);
+ publicSelectedKeysField.set(selector, selectedKeySet);
+
+ selectedKeys = selectedKeySet;
+
+ if (log.isDebugEnabled())
+ log.debug("Instrumented an optimized java.util.Set into: " + selector);
+ }
+ catch (Exception e) {
+ selectedKeys = null;
+
+ if (log.isDebugEnabled())
+ log.debug("Failed to instrument an optimized java.util.Set into selector [selector=" + selector
+ + ", err=" + e + ']');
+ }
+ }
+
+ /**
* Adds socket channel to the registration queue and wakes up reading thread.
*
* @param req Change request.
@@ -1409,7 +1465,10 @@ public class GridNioServer<T> {
// Wake up every 2 seconds to check if closed.
if (selector.select(2000) > 0) {
// Walk through the ready keys collection and process network events.
- processSelectedKeys(selector.selectedKeys());
+ if (selectedKeys == null)
+ processSelectedKeys(selector.selectedKeys());
+ else
+ processSelectedKeysOptimized(selectedKeys.flip());
}
long now = U.currentTimeMillis();
@@ -1455,10 +1514,58 @@ public class GridNioServer<T> {
* @param keys Selected keys.
* @throws ClosedByInterruptException If this thread was interrupted while reading data.
*/
+ private void processSelectedKeysOptimized(SelectionKey[] keys) throws ClosedByInterruptException {
+ for (int i = 0; ; i ++) {
+ final SelectionKey key = keys[i];
+
+ if (key == null)
+ break;
+
+ // null out entry in the array to allow to have it GC'ed once the Channel close
+ // See https://github.com/netty/netty/issues/2363
+ keys[i] = null;
+
+ // Was key closed?
+ if (!key.isValid())
+ continue;
+
+ GridSelectorNioSessionImpl ses = (GridSelectorNioSessionImpl)key.attachment();
+
+ assert ses != null;
+
+ try {
+ if (key.isReadable())
+ processRead(key);
+
+ if (key.isValid() && key.isWritable())
+ processWrite(key);
+ }
+ catch (ClosedByInterruptException e) {
+ // This exception will be handled in bodyInternal() method.
+ throw e;
+ }
+ catch (Exception e) {
+ if (!closed)
+ U.warn(log, "Failed to process selector key (will close): " + ses, e);
+
+ close(ses, new GridNioException(e));
+ }
+ }
+ }
+
+ /**
+ * Processes keys selected by a selector.
+ *
+ * @param keys Selected keys.
+ * @throws ClosedByInterruptException If this thread was interrupted while reading data.
+ */
private void processSelectedKeys(Set<SelectionKey> keys) throws ClosedByInterruptException {
if (log.isTraceEnabled())
log.trace("Processing keys in client worker: " + keys.size());
+ if (keys.isEmpty())
+ return;
+
for (Iterator<SelectionKey> iter = keys.iterator(); iter.hasNext(); ) {
SelectionKey key = iter.next();
http://git-wip-us.apache.org/repos/asf/ignite/blob/914b365f/modules/core/src/main/java/org/apache/ignite/internal/util/nio/SelectedSelectionKeySet.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/SelectedSelectionKeySet.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/SelectedSelectionKeySet.java
new file mode 100644
index 0000000..d91f0e9
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/SelectedSelectionKeySet.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright 2013 The Netty Project
+ *
+ * The Netty Project 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.util.nio;
+
+
+import java.nio.channels.SelectionKey;
+import java.util.AbstractSet;
+import java.util.Iterator;
+
+final class SelectedSelectionKeySet extends AbstractSet<SelectionKey> {
+
+ private SelectionKey[] keysA;
+ private int keysASize;
+ private SelectionKey[] keysB;
+ private int keysBSize;
+ private boolean isA = true;
+
+ SelectedSelectionKeySet() {
+ keysA = new SelectionKey[1024];
+ keysB = keysA.clone();
+ }
+
+ @Override
+ public boolean add(SelectionKey o) {
+ if (o == null) {
+ return false;
+ }
+
+ if (isA) {
+ int size = keysASize;
+ keysA[size ++] = o;
+ keysASize = size;
+ if (size == keysA.length) {
+ doubleCapacityA();
+ }
+ } else {
+ int size = keysBSize;
+ keysB[size ++] = o;
+ keysBSize = size;
+ if (size == keysB.length) {
+ doubleCapacityB();
+ }
+ }
+
+ return true;
+ }
+
+ private void doubleCapacityA() {
+ SelectionKey[] newKeysA = new SelectionKey[keysA.length << 1];
+ System.arraycopy(keysA, 0, newKeysA, 0, keysASize);
+ keysA = newKeysA;
+ }
+
+ private void doubleCapacityB() {
+ SelectionKey[] newKeysB = new SelectionKey[keysB.length << 1];
+ System.arraycopy(keysB, 0, newKeysB, 0, keysBSize);
+ keysB = newKeysB;
+ }
+
+ SelectionKey[] flip() {
+ if (isA) {
+ isA = false;
+ keysA[keysASize] = null;
+ keysBSize = 0;
+ return keysA;
+ } else {
+ isA = true;
+ keysB[keysBSize] = null;
+ keysASize = 0;
+ return keysB;
+ }
+ }
+
+ @Override
+ public int size() {
+ if (isA) {
+ return keysASize;
+ } else {
+ return keysBSize;
+ }
+ }
+
+ @Override
+ public boolean remove(Object o) {
+ return false;
+ }
+
+ @Override
+ public boolean contains(Object o) {
+ return false;
+ }
+
+ @Override
+ public Iterator<SelectionKey> iterator() {
+ throw new UnsupportedOperationException();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/914b365f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
index b4e1ae6..2247acf 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
@@ -33,6 +33,7 @@ import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.NearCacheConfiguration;
+import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.IgniteKernal;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
@@ -233,8 +234,20 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
List<KeyCacheObject> cacheKeys = F.asList(ctx.toCacheKeyObject(1), ctx.toCacheKeyObject(2));
- ((IgniteKernal)g1).internalCache(null).preloader().request(cacheKeys, new AffinityTopologyVersion(2)).get();
- ((IgniteKernal)g2).internalCache(null).preloader().request(cacheKeys, new AffinityTopologyVersion(2)).get();
+ IgniteInternalFuture<Object> f1 = ((IgniteKernal)g1).internalCache(null).preloader().request(
+ cacheKeys,
+ new AffinityTopologyVersion(2));
+
+ if (f1 != null)
+ f1.get();
+
+
+ IgniteInternalFuture<Object> f2 = ((IgniteKernal)g2).internalCache(null).preloader().request(
+ cacheKeys,
+ new AffinityTopologyVersion(2));
+
+ if (f2 != null)
+ f2.get();
IgniteCache<Integer, String> cache1 = g1.cache(null);
IgniteCache<Integer, String> cache2 = g2.cache(null);
@@ -602,4 +615,4 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
lock1.unlock();
}
}
-}
\ No newline at end of file
+}
[07/14] ignite git commit: Minor + merge from master
Posted by vo...@apache.org.
Minor + merge from master
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/36c55008
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/36c55008
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/36c55008
Branch: refs/heads/ignite-2329-1
Commit: 36c55008b355254e3944d7447bafa3078a51fe0d
Parents: f8a55ad
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Fri Jan 29 14:38:54 2016 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Fri Jan 29 14:38:54 2016 +0300
----------------------------------------------------------------------
.../cache/distributed/dht/preloader/GridDhtPreloader.java | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/36c55008/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
index a72596c..0bff618 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
@@ -699,10 +699,12 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
*/
@SuppressWarnings( {"unchecked", "RedundantCast"})
@Override public GridDhtFuture<Object> request(Collection<KeyCacheObject> keys, AffinityTopologyVersion topVer) {
- if (cctx.rebalanceEnabled() &&
- rebalanceFuture().isDone() &&
- Boolean.TRUE.equals(rebalanceFuture().result()))
- return null;
+ if (cctx.rebalanceEnabled()) {
+ IgniteInternalFuture<Boolean> rebalanceFut = rebalanceFuture();
+
+ if (rebalanceFut.isDone() && Boolean.TRUE.equals(rebalanceFut.result()))
+ return null;
+ }
final GridDhtForceKeysFuture<?, ?> fut = new GridDhtForceKeysFuture<>(cctx, topVer, keys, this);
[14/14] ignite git commit: Reverting changes to compound future.
Posted by vo...@apache.org.
Reverting changes to compound future.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/11c369a9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/11c369a9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/11c369a9
Branch: refs/heads/ignite-2329-1
Commit: 11c369a9337ab905b95bb73c866bf7e3d8df6a23
Parents: c66d16c
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Feb 5 15:24:04 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Feb 5 15:24:04 2016 +0300
----------------------------------------------------------------------
.../util/future/GridCompoundFuture.java | 46 ++++++++++----------
1 file changed, 23 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/11c369a9/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
index fca8741..c382497 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
@@ -17,10 +17,6 @@
package org.apache.ignite.internal.util.future;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.IgniteFutureCancelledCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -35,6 +31,10 @@ import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.lang.IgniteReducer;
import org.jetbrains.annotations.Nullable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
+
/**
* Future composed of multiple inner futures.
*/
@@ -54,7 +54,7 @@ public class GridCompoundFuture<T, R> extends GridFutureAdapter<R> implements Ig
AtomicIntegerFieldUpdater.newUpdater(GridCompoundFuture.class, "lsnrCalls");
/** Futures. */
- protected ArrayList<IgniteInternalFuture<T>> futs;
+ protected final ArrayList<IgniteInternalFuture<T>> futs = new ArrayList<>();
/** Reducer. */
@GridToStringInclude
@@ -154,8 +154,10 @@ public class GridCompoundFuture<T, R> extends GridFutureAdapter<R> implements Ig
*
* @return Collection of futures.
*/
- public synchronized Collection<IgniteInternalFuture<T>> futures() {
- return futs == null ? Collections.<IgniteInternalFuture<T>>emptyList() : new ArrayList<>(futs);
+ public Collection<IgniteInternalFuture<T>> futures() {
+ synchronized (futs) {
+ return new ArrayList<>(futs);
+ }
}
/**
@@ -176,16 +178,15 @@ public class GridCompoundFuture<T, R> extends GridFutureAdapter<R> implements Ig
* @return {@code True} if there are pending futures.
*/
@SuppressWarnings("ForLoopReplaceableByForEach")
- public synchronized boolean hasPending() {
- if (futs == null)
- return false;
-
- // Avoid iterator creation and collection copy.
- for (int i = 0; i < futs.size(); i++) {
- IgniteInternalFuture<T> fut = futs.get(i);
-
- if (!fut.isDone())
- return true;
+ public boolean hasPending() {
+ synchronized (futs) {
+ // Avoid iterator creation and collection copy.
+ for (int i = 0; i < futs.size(); i++) {
+ IgniteInternalFuture<T> fut = futs.get(i);
+
+ if (!fut.isDone())
+ return true;
+ }
}
return false;
@@ -199,10 +200,7 @@ public class GridCompoundFuture<T, R> extends GridFutureAdapter<R> implements Ig
public void add(IgniteInternalFuture<T> fut) {
assert fut != null;
- synchronized (this) {
- if (futs == null)
- futs = new ArrayList<>();
-
+ synchronized (futs) {
futs.add(fut);
}
@@ -260,8 +258,10 @@ public class GridCompoundFuture<T, R> extends GridFutureAdapter<R> implements Ig
/**
* @return Futures size.
*/
- protected synchronized int futuresSize() {
- return futs == null ? 0 : futs.size();
+ private int futuresSize() {
+ synchronized (futs) {
+ return futs.size();
+ }
}
/** {@inheritDoc} */
[09/14] ignite git commit:
https://issues.apache.org/jira/browse/IGNITE-2329 - single get
Posted by vo...@apache.org.
https://issues.apache.org/jira/browse/IGNITE-2329 - single get
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7b987466
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7b987466
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7b987466
Branch: refs/heads/ignite-2329-1
Commit: 7b987466af3fa0789e4cde8eb3f9a44126be129c
Parents: 3e97d82
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Tue Feb 2 18:50:11 2016 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Tue Feb 2 18:50:11 2016 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheAdapter.java | 18 +-
.../processors/cache/GridCachePreloader.java | 6 +
.../cache/GridCachePreloaderAdapter.java | 5 +
.../distributed/dht/GridDhtCacheAdapter.java | 69 ++-
.../distributed/dht/GridDhtEmbeddedFuture.java | 13 +-
.../distributed/dht/GridDhtGetSingleFuture.java | 479 +++++++++++++++++++
.../dht/preloader/GridDhtPreloader.java | 12 +
7 files changed, 564 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7b987466/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 986e529..ef7d30a 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
@@ -1852,7 +1852,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
ctx.affinity().affinityTopologyVersion() : ctx.shared().exchange().readyAffinityVersion()) :
tx.topologyVersion();
- final Map<K1, V1> map = U.newHashMap(keys.size());
+ final Map<K1, V1> map = keys.size() == 1 ?
+ (Map<K1, V1>)new IgniteBiTuple<>() :
+ U.<K1, V1>newHashMap(keys.size());
final boolean storeEnabled = !skipVals && readThrough && ctx.readThrough();
@@ -2046,17 +2048,9 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
}
);
}
- else {
- // If misses is not empty and store is disabled, we should touch missed entries.
- if (misses != null) {
- for (KeyCacheObject key : misses.keySet()) {
- GridCacheEntryEx entry = peekEx(key);
-
- if (entry != null)
- ctx.evicts().touch(entry, topVer);
- }
- }
- }
+ else
+ // Misses can be non-zero only if store is enabled.
+ assert misses == null;
return new GridFinishedFuture<>(map);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7b987466/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
index c8fcb90..be019fc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloader.java
@@ -137,6 +137,12 @@ public interface GridCachePreloader {
public IgniteInternalFuture<Boolean> rebalanceFuture();
/**
+ * @return {@code true} if there is no need to force keys preloading
+ * (e.g. rebalancing has been completed).
+ */
+ public boolean needForceKeys();
+
+ /**
* Requests that preloader sends the request for the key.
*
* @param keys Keys to request.
http://git-wip-us.apache.org/repos/asf/ignite/blob/7b987466/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
index a1704fc..5d98c6f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePreloaderAdapter.java
@@ -93,6 +93,11 @@ public class GridCachePreloaderAdapter implements GridCachePreloader {
}
/** {@inheritDoc} */
+ @Override public boolean needForceKeys() {
+ return false;
+ }
+
+ /** {@inheritDoc} */
@Override public void onReconnected() {
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7b987466/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index 749ee4d..8e456e3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -719,21 +719,63 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
/**
* @param nodeId Node ID.
+ * @param msgId Message ID.
+ * @param key Key.
+ * @param addRdr Add reader flag.
+ * @param readThrough Read through flag.
+ * @param topVer Topology version flag.
+ * @param subjId Subject ID.
+ * @param taskNameHash Task name hash.
+ * @param expiry Expiry.
+ * @param skipVals Skip vals flag.
+ * @return Future for the operation.
+ */
+ private IgniteInternalFuture<GridCacheEntryInfo> getDhtSingleAsync(
+ UUID nodeId,
+ long msgId,
+ KeyCacheObject key,
+ boolean addRdr,
+ boolean readThrough,
+ AffinityTopologyVersion topVer,
+ @Nullable UUID subjId,
+ int taskNameHash,
+ @Nullable IgniteCacheExpiryPolicy expiry,
+ boolean skipVals
+ ) {
+ GridDhtGetSingleFuture<K, V> fut = new GridDhtGetSingleFuture<>(
+ ctx,
+ msgId,
+ nodeId,
+ key,
+ addRdr,
+ readThrough,
+ /*tx*/null,
+ topVer,
+ subjId,
+ taskNameHash,
+ expiry,
+ skipVals);
+
+ fut.init();
+
+ return fut;
+ }
+
+ /**
+ * @param nodeId Node ID.
* @param req Get request.
*/
protected void processNearSingleGetRequest(final UUID nodeId, final GridNearSingleGetRequest req) {
assert ctx.affinityNode();
- long ttl = req.accessTtl();
-
- final CacheExpiryPolicy expiryPlc = CacheExpiryPolicy.forAccess(ttl);
-
- Map<KeyCacheObject, Boolean> map = Collections.singletonMap(req.key(), req.addReader());
+ final CacheExpiryPolicy expiryPlc = CacheExpiryPolicy.forAccess(req.accessTtl());
- IgniteInternalFuture<Collection<GridCacheEntryInfo>> fut =
- getDhtAsync(nodeId,
+ IgniteInternalFuture<GridCacheEntryInfo> fut =
+ getDhtSingleAsync(
+ nodeId,
req.messageId(),
- map,
+ req.key(),
+ req.addReader(),
req.readThrough(),
req.topologyVersion(),
req.subjectId(),
@@ -741,19 +783,16 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
expiryPlc,
req.skipValues());
- fut.listen(new CI1<IgniteInternalFuture<Collection<GridCacheEntryInfo>>>() {
- @Override public void apply(IgniteInternalFuture<Collection<GridCacheEntryInfo>> f) {
+ fut.listen(new CI1<IgniteInternalFuture<GridCacheEntryInfo>>() {
+ @Override public void apply(IgniteInternalFuture<GridCacheEntryInfo> f) {
GridNearSingleGetResponse res;
- GridDhtFuture<Collection<GridCacheEntryInfo>> fut =
- (GridDhtFuture<Collection<GridCacheEntryInfo>>)f;
+ GridDhtFuture<GridCacheEntryInfo> fut = (GridDhtFuture<GridCacheEntryInfo>)f;
try {
- Collection<GridCacheEntryInfo> entries = fut.get();
+ GridCacheEntryInfo info = fut.get();
if (F.isEmpty(fut.invalidPartitions())) {
- GridCacheEntryInfo info = F.first(entries);
-
Message res0 = null;
if (info != null) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/7b987466/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtEmbeddedFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtEmbeddedFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtEmbeddedFuture.java
index 0d10a93..1b9f743 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtEmbeddedFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtEmbeddedFuture.java
@@ -21,7 +21,6 @@ import java.util.Collection;
import java.util.Collections;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.util.future.GridEmbeddedFuture;
-import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.lang.IgniteBiClosure;
@@ -32,10 +31,6 @@ public class GridDhtEmbeddedFuture<A, B> extends GridEmbeddedFuture<A, B> implem
/** */
private static final long serialVersionUID = 0L;
- /** Retries. */
- @GridToStringInclude
- private Collection<Integer> invalidParts;
-
/**
* @param c Closure.
* @param embedded Embedded.
@@ -45,8 +40,6 @@ public class GridDhtEmbeddedFuture<A, B> extends GridEmbeddedFuture<A, B> implem
IgniteInternalFuture<B> embedded
) {
super(c, embedded);
-
- invalidParts = Collections.emptyList();
}
/**
@@ -58,17 +51,15 @@ public class GridDhtEmbeddedFuture<A, B> extends GridEmbeddedFuture<A, B> implem
IgniteBiClosure<B, Exception, IgniteInternalFuture<A>> c
) {
super(embedded, c);
-
- invalidParts = Collections.emptyList();
}
/** {@inheritDoc} */
@Override public Collection<Integer> invalidPartitions() {
- return invalidParts;
+ return Collections.emptyList();
}
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(GridDhtEmbeddedFuture.class, this, super.toString());
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7b987466/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
new file mode 100644
index 0000000..4439307
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
@@ -0,0 +1,479 @@
+/*
+ * 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.dht;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicReference;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheEntryInfo;
+import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
+import org.apache.ignite.internal.processors.cache.IgniteCacheExpiryPolicy;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalEx;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.util.future.GridFutureAdapter;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.T2;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.lang.IgniteUuid;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ *
+ */
+public final class GridDhtGetSingleFuture<K, V> extends GridFutureAdapter<GridCacheEntryInfo>
+ implements GridDhtFuture<GridCacheEntryInfo> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Logger reference. */
+ private static final AtomicReference<IgniteLogger> logRef = new AtomicReference<>();
+
+ /** Logger. */
+ private static IgniteLogger log;
+
+ /** Message ID. */
+ private long msgId;
+
+ /** */
+ private UUID reader;
+
+ /** Read through flag. */
+ private boolean readThrough;
+
+ /** Context. */
+ private GridCacheContext<K, V> cctx;
+
+ /** Key. */
+ private KeyCacheObject key;
+
+ /** */
+ private boolean addRdr;
+
+ /** Reserved partitions. */
+ private int part = -1;
+
+ /** Future ID. */
+ private IgniteUuid futId;
+
+ /** Version. */
+ private GridCacheVersion ver;
+
+ /** Topology version .*/
+ private AffinityTopologyVersion topVer;
+
+ /** Transaction. */
+ private IgniteTxLocalEx tx;
+
+ /** Retries because ownership changed. */
+ private Collection<Integer> retries;
+
+ /** Subject ID. */
+ private UUID subjId;
+
+ /** Task name. */
+ private int taskNameHash;
+
+ /** Expiry policy. */
+ private IgniteCacheExpiryPolicy expiryPlc;
+
+ /** Skip values flag. */
+ private boolean skipVals;
+
+ /**
+ * @param cctx Context.
+ * @param msgId Message ID.
+ * @param reader Reader.
+ * @param key Key.
+ * @param addRdr Add reader flag.
+ * @param readThrough Read through flag.
+ * @param tx Transaction.
+ * @param topVer Topology version.
+ * @param subjId Subject ID.
+ * @param taskNameHash Task name hash code.
+ * @param expiryPlc Expiry policy.
+ * @param skipVals Skip values flag.
+ */
+ public GridDhtGetSingleFuture(
+ GridCacheContext<K, V> cctx,
+ long msgId,
+ UUID reader,
+ KeyCacheObject key,
+ Boolean addRdr,
+ boolean readThrough,
+ @Nullable IgniteTxLocalEx tx,
+ @NotNull AffinityTopologyVersion topVer,
+ @Nullable UUID subjId,
+ int taskNameHash,
+ @Nullable IgniteCacheExpiryPolicy expiryPlc,
+ boolean skipVals
+ ) {
+ assert reader != null;
+ assert key != null;
+
+ this.reader = reader;
+ this.cctx = cctx;
+ this.msgId = msgId;
+ this.key = key;
+ this.addRdr = addRdr;
+ this.readThrough = readThrough;
+ this.tx = tx;
+ this.topVer = topVer;
+ this.subjId = subjId;
+ this.taskNameHash = taskNameHash;
+ this.expiryPlc = expiryPlc;
+ this.skipVals = skipVals;
+
+ futId = IgniteUuid.randomUuid();
+
+ ver = tx == null ? cctx.versions().next() : tx.xidVersion();
+
+ if (log == null)
+ log = U.logger(cctx.kernalContext(), logRef, GridDhtGetSingleFuture.class);
+ }
+
+ /**
+ * Initializes future.
+ */
+ void init() {
+ map();
+ }
+
+ /**
+ * @return Future ID.
+ */
+ public IgniteUuid futureId() {
+ return futId;
+ }
+
+ /**
+ * @return Future version.
+ */
+ public GridCacheVersion version() {
+ return ver;
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean onDone(GridCacheEntryInfo res, Throwable err) {
+ if (super.onDone(res, err)) {
+ // Release all partitions reserved by this future.
+ if (part != -1)
+ cctx.topology().releasePartitions(part);
+
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ *
+ */
+ private void map() {
+ if (cctx.dht().dhtPreloader().needForceKeys()) {
+ GridDhtFuture<Object> fut = cctx.dht().dhtPreloader().request(
+ Collections.singleton(key),
+ topVer);
+
+ if (fut != null) {
+ if (F.isEmpty(fut.invalidPartitions())) {
+ if (retries == null)
+ retries = new HashSet<>();
+
+ retries.addAll(fut.invalidPartitions());
+ }
+
+ fut.listen(
+ new IgniteInClosure<IgniteInternalFuture<Object>>() {
+ @Override public void apply(IgniteInternalFuture<Object> fut) {
+ Throwable e = fut.error();
+
+ if (e != null) { // Check error first.
+ if (log.isDebugEnabled())
+ log.debug("Failed to request keys from preloader " +
+ "[keys=" + key + ", err=" + e + ']');
+
+ onDone(e);
+ }
+ else
+ map0();
+ }
+ }
+ );
+
+ return;
+ }
+ }
+
+ map0();
+ }
+
+ /**
+ *
+ */
+ private void map0() {
+ // Assign keys to primary nodes.
+ int part = cctx.affinity().partition(key);
+
+ if (retries == null || !retries.contains(part)) {
+ if (!map(key)) {
+ retries = Collections.singleton(part);
+
+ onDone((GridCacheEntryInfo)null);
+
+ return;
+ }
+ }
+
+ getAsync();
+ }
+
+ /** {@inheritDoc} */
+ @Override public Collection<Integer> invalidPartitions() {
+ return retries == null ? Collections.<Integer>emptyList() : retries;
+ }
+
+ /**
+ * @param key Key.
+ * @return {@code True} if mapped.
+ */
+ private boolean map(KeyCacheObject key) {
+ GridDhtLocalPartition part = topVer.topologyVersion() > 0 ?
+ cache().topology().localPartition(cctx.affinity().partition(key), topVer, true) :
+ cache().topology().localPartition(key, false);
+
+ if (part == null)
+ return false;
+
+ assert this.part == -1;
+
+ // By reserving, we make sure that partition won't be unloaded while processed.
+ if (part.reserve()) {
+ this.part = part.id();
+
+ return true;
+ }
+ else
+ return false;
+ }
+
+ /**
+ *
+ */
+ @SuppressWarnings( {"unchecked", "IfMayBeConditional"})
+ private void getAsync() {
+ assert part != -1;
+
+ String taskName0 = cctx.kernalContext().job().currentTaskName();
+
+ if (taskName0 == null)
+ taskName0 = cctx.kernalContext().task().resolveTaskName(taskNameHash);
+
+ final String taskName = taskName0;
+
+ IgniteInternalFuture<Boolean> rdrFut = null;
+
+ ClusterNode readerNode = cctx.discovery().node(reader);
+
+ if (readerNode != null && !readerNode.isLocal() && cctx.discovery().cacheNearNode(readerNode, cctx.name())) {
+ while (true) {
+ GridDhtCacheEntry e = cache().entryExx(key, topVer);
+
+ try {
+ if (e.obsolete())
+ continue;
+
+ boolean addReader = (!e.deleted() && addRdr && !skipVals);
+
+ if (addReader)
+ e.unswap(false);
+
+ // Register reader. If there are active transactions for this entry,
+ // then will wait for their completion before proceeding.
+ // TODO: GG-4003:
+ // TODO: What if any transaction we wait for actually removes this entry?
+ // TODO: In this case seems like we will be stuck with untracked near entry.
+ // TODO: To fix, check that reader is contained in the list of readers once
+ // TODO: again after the returned future completes - if not, try again.
+ rdrFut = addReader ? e.addReader(reader, msgId, topVer) : null;
+
+ break;
+ }
+ catch (IgniteCheckedException err) {
+ onDone(err);
+
+ return;
+ }
+ catch (GridCacheEntryRemovedException ignore) {
+ if (log.isDebugEnabled())
+ log.debug("Got removed entry when getting a DHT value: " + e);
+ }
+ finally {
+ cctx.evicts().touch(e, topVer);
+ }
+ }
+ }
+
+ IgniteInternalFuture<Map<KeyCacheObject, T2<CacheObject, GridCacheVersion>>> fut;
+
+ if (rdrFut == null || rdrFut.isDone()) {
+ if (tx == null) {
+ fut = cache().getDhtAllAsync(
+ Collections.singleton(key),
+ readThrough,
+ subjId,
+ taskName,
+ expiryPlc,
+ skipVals,
+ /*can remap*/true);
+ }
+ else {
+ fut = tx.getAllAsync(cctx,
+ Collections.singleton(key),
+ /*deserialize binary*/false,
+ skipVals,
+ /*keep cache objects*/true,
+ /*skip store*/!readThrough,
+ false);
+ }
+ }
+ else {
+ rdrFut.listen(
+ new IgniteInClosure<IgniteInternalFuture<Boolean>>() {
+ @Override public void apply(IgniteInternalFuture<Boolean> fut) {
+ Throwable e = fut.error();
+
+ if (e != null) {
+ onDone(e);
+
+ return;
+ }
+
+ IgniteInternalFuture<Map<KeyCacheObject, T2<CacheObject, GridCacheVersion>>> fut0;
+
+ if (tx == null) {
+ fut0 = cache().getDhtAllAsync(
+ Collections.singleton(key),
+ readThrough,
+ subjId,
+ taskName,
+ expiryPlc,
+ skipVals,
+ /*can remap*/true);
+ }
+ else {
+ fut0 = tx.getAllAsync(cctx,
+ Collections.singleton(key),
+ /*deserialize binary*/false,
+ skipVals,
+ /*keep cache objects*/true,
+ /*skip store*/!readThrough,
+ false
+ );
+ }
+
+ fut0.listen(createGetFutureListener());
+ }
+ }
+ );
+
+ return;
+ }
+
+ if (fut.isDone())
+ onResult(fut);
+ else
+ fut.listen(createGetFutureListener());
+ }
+
+ /**
+ * @return Listener for get future.
+ */
+ @NotNull private IgniteInClosure<IgniteInternalFuture<Map<KeyCacheObject, T2<CacheObject, GridCacheVersion>>>>
+ createGetFutureListener() {
+ return new IgniteInClosure<IgniteInternalFuture<Map<KeyCacheObject, T2<CacheObject, GridCacheVersion>>>>() {
+ @Override public void apply(
+ IgniteInternalFuture<Map<KeyCacheObject, T2<CacheObject, GridCacheVersion>>> fut
+ ) {
+ onResult(fut);
+ }
+ };
+ }
+
+ /**
+ * @param fut Completed future to finish this process with.
+ */
+ private void onResult(IgniteInternalFuture<Map<KeyCacheObject, T2<CacheObject, GridCacheVersion>>> fut) {
+ assert fut.isDone();
+
+ if (fut.error() != null)
+ onDone(fut.error());
+ else {
+ try {
+ onDone(toEntryInfo(fut.get()));
+ }
+ catch (IgniteCheckedException e) {
+ assert false; // Should never happen.
+ }
+ }
+ }
+
+ /**
+ * @param map Map to convert.
+ * @return List of infos.
+ */
+ private GridCacheEntryInfo toEntryInfo(Map<KeyCacheObject, T2<CacheObject, GridCacheVersion>> map) {
+ Map.Entry<KeyCacheObject, T2<CacheObject, GridCacheVersion>> e = F.firstEntry(map);
+
+ if (e != null) {
+ GridCacheEntryInfo info = new GridCacheEntryInfo();
+
+ T2<CacheObject, GridCacheVersion> val = e.getValue();
+
+ assert val != null;
+
+ info.cacheId(cctx.cacheId());
+ info.key(e.getKey());
+ info.value(skipVals ? null : val.get1());
+ info.version(val.get2());
+
+ return info;
+ }
+
+ return null;
+ }
+
+ /**
+ * @return DHT cache.
+ */
+ private GridDhtCacheAdapter<K, V> cache() {
+ return (GridDhtCacheAdapter<K, V>)cctx.cache();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7b987466/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
index 0bff618..a92a080 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
@@ -693,6 +693,18 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
}
}
+ /** {@inheritDoc} */
+ @Override public boolean needForceKeys() {
+ if (cctx.rebalanceEnabled()) {
+ IgniteInternalFuture<Boolean> rebalanceFut = rebalanceFuture();
+
+ if (rebalanceFut.isDone() && Boolean.TRUE.equals(rebalanceFut.result()))
+ return false;
+ }
+
+ return true;
+ }
+
/**
* @param keys Keys to request.
* @return Future for request.
[08/14] ignite git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/ignite into ignite-gc-opts
Posted by vo...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-gc-opts
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3e97d82d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3e97d82d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3e97d82d
Branch: refs/heads/ignite-2329-1
Commit: 3e97d82d428ae5e672c4901cfc94224d19143c0f
Parents: 36c5500 4035d40
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Tue Feb 2 16:48:17 2016 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Tue Feb 2 16:48:17 2016 +0300
----------------------------------------------------------------------
.gitignore | 1 +
.../java/org/apache/ignite/IgniteCache.java | 45 +-
.../ignite/binary/BinaryBasicIdMapper.java | 167 +++
.../ignite/binary/BinaryBasicNameMapper.java | 141 +++
.../apache/ignite/binary/BinaryIdMapper.java | 19 +-
.../apache/ignite/binary/BinaryNameMapper.java | 47 +
.../ignite/binary/BinaryTypeConfiguration.java | 23 +-
.../configuration/BinaryConfiguration.java | 28 +
.../configuration/IgniteConfiguration.java | 8 +-
.../ignite/internal/IgniteNodeAttributes.java | 3 +
.../org/apache/ignite/internal/IgnitionEx.java | 4 +-
.../internal/binary/BinaryClassDescriptor.java | 23 +-
.../ignite/internal/binary/BinaryContext.java | 347 ++++--
.../internal/binary/BinaryEnumObjectImpl.java | 13 +-
.../internal/binary/BinaryInternalIdMapper.java | 161 ---
.../internal/binary/BinaryInternalMapper.java | 131 ++
.../binary/BinaryMetadataCollector.java | 22 +-
.../internal/binary/BinaryReaderExImpl.java | 14 +-
.../internal/binary/BinaryWriterExImpl.java | 30 +-
.../internal/binary/GridBinaryMarshaller.java | 28 +-
.../binary/builder/BinaryBuilderSerializer.java | 16 +-
.../binary/builder/BinaryObjectBuilderImpl.java | 2 +-
.../processors/cache/CacheEntryImplEx.java | 14 +-
.../processors/cache/CacheOperationContext.java | 43 +-
.../processors/cache/GridCacheAdapter.java | 305 ++++-
.../processors/cache/GridCacheContext.java | 33 +-
.../processors/cache/GridCacheMapEntry.java | 8 +-
.../processors/cache/GridCacheProcessor.java | 43 +-
.../processors/cache/GridCacheProxyImpl.java | 62 +-
.../processors/cache/IgniteCacheProxy.java | 94 +-
.../processors/cache/IgniteInternalCache.java | 85 ++
.../binary/CacheObjectBinaryProcessorImpl.java | 123 +-
.../dht/CacheDistributedGetFutureAdapter.java | 15 -
.../distributed/dht/GridDhtCacheAdapter.java | 7 +-
.../cache/distributed/dht/GridDhtGetFuture.java | 6 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 4 +-
.../dht/GridPartitionedGetFuture.java | 38 +-
.../dht/GridPartitionedSingleGetFuture.java | 17 +-
.../dht/atomic/GridDhtAtomicCache.java | 189 ++-
.../dht/atomic/GridNearAtomicUpdateFuture.java | 10 +-
.../dht/atomic/GridNearAtomicUpdateRequest.java | 22 +-
.../dht/colocated/GridDhtColocatedCache.java | 42 +-
.../distributed/near/GridNearAtomicCache.java | 6 +-
.../distributed/near/GridNearCacheAdapter.java | 6 +-
.../distributed/near/GridNearCacheEntry.java | 3 +-
.../distributed/near/GridNearGetFuture.java | 45 +-
...arOptimisticSerializableTxPrepareFuture.java | 2 +-
.../near/GridNearOptimisticTxPrepareFuture.java | 4 +
.../GridNearPessimisticTxPrepareFuture.java | 2 +
.../near/GridNearTransactionalCache.java | 9 +-
.../processors/cache/dr/GridCacheDrInfo.java | 49 +-
.../local/atomic/GridLocalAtomicCache.java | 97 +-
.../cache/transactions/IgniteTxEntry.java | 32 +-
.../transactions/IgniteTxLocalAdapter.java | 277 +++--
.../cache/transactions/IgniteTxLocalEx.java | 3 +-
.../cache/transactions/IgniteTxManager.java | 4 +-
.../cache/version/GridCacheVersionManager.java | 23 +-
.../processors/platform/PlatformIgnition.java | 6 +-
.../platform/PlatformNoopProcessor.java | 15 +
.../processors/platform/PlatformProcessor.java | 25 +
.../platform/PlatformProcessorImpl.java | 34 +-
.../platform/cache/PlatformCache.java | 16 +-
.../cpp/PlatformCppConfigurationClosure.java | 32 +
.../dotnet/PlatformDotNetCacheStore.java | 39 +-
.../PlatformDotNetConfigurationClosure.java | 80 +-
.../utils/PlatformConfigurationUtils.java | 621 ++++++++++
.../platform/utils/PlatformUtils.java | 52 +-
.../processors/task/GridTaskProcessor.java | 2 +-
.../ignite/internal/util/IgniteUtils.java | 7 +
.../OptimizedObjectStreamRegistry.java | 4 +-
.../PlatformDotNetCacheStoreFactoryNative.java | 58 +
.../ignite/spi/discovery/tcp/ClientImpl.java | 6 +-
.../ignite/spi/discovery/tcp/ServerImpl.java | 11 +-
.../spi/discovery/tcp/TcpDiscoverySpi.java | 1 -
.../TcpDiscoveryMulticastIpFinder.java | 12 +-
.../TcpDiscoveryCustomEventMessage.java | 10 +-
.../binary/BinaryBasicIdMapperSelfTest.java | 51 +
.../binary/BinaryBasicNameMapperSelfTest.java | 50 +
.../BinaryConfigurationConsistencySelfTest.java | 231 ++++
.../internal/binary/BinaryEnumsSelfTest.java | 12 +-
.../binary/BinaryMarshallerSelfTest.java | 508 ++++++--
.../BinaryObjectBuilderAdditionalSelfTest.java | 4 +-
...naryObjectBuilderDefaultMappersSelfTest.java | 1149 ++++++++++++++++++
.../binary/BinaryObjectBuilderSelfTest.java | 1108 -----------------
...ilderSimpleNameLowerCaseMappersSelfTest.java | 41 +
.../BinarySimpleNameTestPropertySelfTest.java | 94 ++
.../binary/GridBinaryMetaDataSelfTest.java | 371 ------
.../binary/GridBinaryWildcardsSelfTest.java | 338 +++++-
...aultBinaryMappersBinaryMetaDataSelfTest.java | 389 ++++++
...CaseBinaryMappersBinaryMetaDataSelfTest.java | 41 +
.../internal/binary/TestMappedObject.java | 25 +
...BuilderNonCompactDefaultMappersSelfTest.java | 30 +
.../BinaryObjectBuilderNonCompactSelfTest.java | 30 -
...mpactSimpleNameLowerCaseMappersSelfTest.java | 31 +
.../cache/CacheGetEntryAbstractTest.java | 803 ++++++++++++
...GetEntryOptimisticReadCommittedSeltTest.java | 36 +
...etEntryOptimisticRepeatableReadSeltTest.java | 36 +
...eGetEntryOptimisticSerializableSeltTest.java | 36 +
...etEntryPessimisticReadCommittedSeltTest.java | 36 +
...tEntryPessimisticRepeatableReadSeltTest.java | 36 +
...GetEntryPessimisticSerializableSeltTest.java | 36 +
.../cache/CacheReadThroughRestartSelfTest.java | 43 +-
.../CacheSerializableTransactionsTest.java | 142 ++-
.../cache/GridCacheAbstractFullApiSelfTest.java | 141 +++
.../GridCacheConditionalDeploymentSelfTest.java | 4 +-
.../GridCacheDeploymentOffHeapSelfTest.java | 4 +-
...ridCacheDeploymentOffHeapValuesSelfTest.java | 41 +
.../GridCacheInterceptorAbstractSelfTest.java | 172 ++-
.../GridCacheBinaryObjectsAbstractSelfTest.java | 17 +-
.../GridCacheBinaryStoreAbstractSelfTest.java | 10 +
...naryStoreBinariesDefaultMappersSelfTest.java | 81 ++
.../GridCacheBinaryStoreBinariesSelfTest.java | 66 -
...yStoreBinariesSimpleNameMappersSelfTest.java | 40 +
...GridCacheDhtEvictionNearReadersSelfTest.java | 2 +-
.../GridCacheRebalancingSyncSelfTest.java | 8 +
.../GridCacheReplicatedPreloadSelfTest.java | 108 ++
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 3 +-
.../config/GridTestProperties.java | 5 +-
.../testframework/junits/GridAbstractTest.java | 26 +-
.../multijvm/IgniteCacheProcessProxy.java | 59 +-
.../ignite/testsuites/IgniteBasicTestSuite.java | 2 +-
.../testsuites/IgniteBinaryBasicTestSuite.java | 95 ++
...ctsSimpleNameMapperComputeGridTestSuite.java | 38 +
.../IgniteBinaryObjectsTestSuite.java | 34 +-
...iteBinarySimpleNameMapperBasicTestSuite.java | 38 +
...rySimpleNameMapperCacheFullApiTestSuite.java | 39 +
.../testsuites/IgniteCacheTestSuite3.java | 2 +
.../testsuites/IgniteCacheTestSuite4.java | 12 +
.../tests/p2p/CacheDeploymentTestEnumValue.java | 47 +
.../p2p/CacheDeploymentTestStoreFactory.java | 113 ++
.../query/h2/opt/GridH2IndexBase.java | 5 +-
.../query/h2/opt/GridH2TreeIndex.java | 2 +-
.../IgniteBinaryCacheQueryTestSuite.java | 186 +--
...narySimpleNameMapperCacheQueryTestSuite.java | 38 +
modules/kafka/README.txt | 111 +-
modules/kafka/pom.xml | 69 +-
.../ignite/stream/kafka/KafkaStreamer.java | 2 +-
.../kafka/connect/IgniteSinkConnector.java | 91 ++
.../kafka/connect/IgniteSinkConstants.java | 38 +
.../stream/kafka/connect/IgniteSinkTask.java | 165 +++
.../kafka/IgniteKafkaStreamerSelfTestSuite.java | 9 +-
.../stream/kafka/KafkaEmbeddedBroker.java | 387 ------
.../kafka/KafkaIgniteStreamerSelfTest.java | 13 +-
.../ignite/stream/kafka/SimplePartitioner.java | 53 -
.../ignite/stream/kafka/TestKafkaBroker.java | 237 ++++
.../kafka/connect/IgniteSinkConnectorTest.java | 250 ++++
.../kafka/src/test/resources/example-ignite.xml | 71 ++
.../cpp/common/include/ignite/common/exports.h | 3 +
.../cpp/common/include/ignite/common/java.h | 9 +
.../platforms/cpp/common/project/vs/module.def | 5 +-
modules/platforms/cpp/common/src/exports.cpp | 12 +
modules/platforms/cpp/common/src/java.cpp | 44 +
.../Apache.Ignite.Core.Tests.csproj | 3 +
.../Binary/BinarySelfTest.cs | 9 +
.../Cache/CacheAbstractTest.cs | 2 +-
.../Cache/CacheAffinityTest.cs | 2 +-
.../Cache/CacheConfigurationTest.cs | 538 ++++++++
.../Cache/CacheDynamicStartTest.cs | 4 +-
.../Cache/CacheTestAsyncWrapper.cs | 7 +
.../Query/CacheQueriesCodeConfigurationTest.cs | 295 +++++
.../Cache/Query/CacheQueriesTest.cs | 2 +-
.../Continuous/ContinuousQueryAbstractTest.cs | 2 +-
.../Cache/Store/CacheStoreSessionTest.cs | 2 +-
.../Cache/Store/CacheStoreTest.cs | 23 +-
.../Config/Compute/compute-grid2.xml | 21 +
.../Config/Compute/compute-grid3.xml | 31 +-
.../Dataload/DataStreamerTest.cs | 4 +-
.../Apache.Ignite.Core.Tests/ExceptionsTest.cs | 2 +-
.../IgniteConfigurationTest.cs | 367 ++++++
.../Apache.Ignite.Core.Tests/MarshallerTest.cs | 4 +-
.../SerializationTest.cs | 2 +-
.../Apache.Ignite.Core.Tests/TestRunner.cs | 5 +-
.../Apache.Ignite.Core.csproj | 29 +-
.../Binary/BinaryConfiguration.cs | 27 +-
.../Configuration/CacheAtomicWriteOrderMode.cs | 43 +
.../Cache/Configuration/CacheAtomicityMode.cs | 54 +
.../Cache/Configuration/CacheConfiguration.cs | 601 +++++++++
.../Cache/Configuration/CacheMemoryMode.cs | 60 +
.../Cache/Configuration/CacheMode.cs | 52 +
.../Cache/Configuration/CacheRebalanceMode.cs | 51 +
.../CacheWriteSynchronizationMode.cs | 45 +
.../Cache/Configuration/QueryAlias.cs | 59 +
.../Cache/Configuration/QueryEntity.cs | 401 ++++++
.../Cache/Configuration/QueryField.cs | 109 ++
.../Cache/Configuration/QueryIndex.cs | 137 +++
.../Cache/Configuration/QueryIndexField.cs | 66 +
.../Cache/Configuration/QueryIndexType.cs | 40 +
.../Configuration/QuerySqlFieldAttribute.cs | 60 +
.../Configuration/QueryTextFieldAttribute.cs | 36 +
.../dotnet/Apache.Ignite.Core/Cache/ICache.cs | 6 +
.../Apache.Ignite.Core/Common/IFactory.cs | 34 +
.../Discovery/IDiscoverySpi.cs | 32 +
.../Discovery/Tcp/ITcpDiscoveryIpFinder.cs | 34 +
.../Multicast/TcpDiscoveryMulticastIpFinder.cs | 133 ++
.../Tcp/Static/TcpDiscoveryStaticIpFinder.cs | 84 ++
.../Discovery/Tcp/TcpDiscoveryIpFinderBase.cs | 78 ++
.../Discovery/Tcp/TcpDiscoverySpi.cs | 144 +++
.../dotnet/Apache.Ignite.Core/IIgnite.cs | 29 +-
.../Apache.Ignite.Core/IgniteConfiguration.cs | 347 +++++-
.../dotnet/Apache.Ignite.Core/Ignition.cs | 29 +-
.../Apache.Ignite.Core/Impl/Binary/Binary.cs | 3 -
.../Impl/Binary/BinaryReaderExtensions.cs | 19 +
.../Apache.Ignite.Core/Impl/Binary/JavaTypes.cs | 92 ++
.../Impl/Binary/Marshaller.cs | 8 +-
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 9 +-
.../Apache.Ignite.Core/Impl/Cache/CacheOp.cs | 3 +-
.../Impl/Cache/Store/CacheStore.cs | 20 +-
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 48 +
.../Impl/IgniteConfigurationEx.cs | 57 -
.../Apache.Ignite.Core/Impl/IgniteManager.cs | 5 +-
.../Apache.Ignite.Core/Impl/IgniteProxy.cs | 18 +-
.../Apache.Ignite.Core/Impl/IgniteUtils.cs | 2 +-
.../Impl/Memory/PlatformRawMemory.cs | 2 +-
.../Impl/Transactions/TransactionsImpl.cs | 2 +-
.../Impl/Unmanaged/IgniteJniNativeMethods.cs | 11 +-
.../Impl/Unmanaged/UnmanagedUtils.cs | 22 +-
.../visor/commands/node/VisorNodeCommand.scala | 1 +
.../commands/top/VisorTopologyCommand.scala | 5 +-
.../scala/org/apache/ignite/visor/visor.scala | 3 +-
.../config/benchmark-multicast.properties | 7 +
.../org/apache/ignite/yardstick/IgniteNode.java | 3 +
.../IgniteGetEntriesPutAllTxBenchmark.java | 73 ++
.../cache/IgnitePutGetEntryBenchmark.java | 47 +
.../cache/IgnitePutGetEntryTxBenchmark.java | 73 ++
.../apache/ignite/yarn/ApplicationMaster.java | 12 +-
.../apache/ignite/yarn/ClusterProperties.java | 144 ++-
.../yarn/IgniteApplicationMasterSelfTest.java | 52 +
parent/pom.xml | 121 +-
pom.xml | 16 -
229 files changed, 14138 insertions(+), 3625 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3e97d82d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3e97d82d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3e97d82d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3e97d82d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtTxPrepareFuture.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3e97d82d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3e97d82d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/colocated/GridDhtColocatedCache.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3e97d82d/parent/pom.xml
----------------------------------------------------------------------
[12/14] ignite git commit:
https://issues.apache.org/jira/browse/IGNITE-2329 - fixes after review
Posted by vo...@apache.org.
https://issues.apache.org/jira/browse/IGNITE-2329 - fixes after review
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/daa60f5a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/daa60f5a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/daa60f5a
Branch: refs/heads/ignite-2329-1
Commit: daa60f5ab1927dd894d85de51f3b93cc8403c7cb
Parents: c9b44cf
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Feb 4 18:18:21 2016 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Feb 4 18:18:21 2016 +0300
----------------------------------------------------------------------
.../apache/ignite/IgniteSystemProperties.java | 12 ++++++++++-
.../processors/cache/GridCacheMvccManager.java | 12 +++++------
.../distributed/dht/GridDhtGetSingleFuture.java | 22 +++++++-------------
.../dht/preloader/GridDhtPreloader.java | 8 ++-----
.../util/future/GridCompoundFuture.java | 9 ++++----
.../ignite/internal/util/nio/GridNioServer.java | 2 +-
6 files changed, 31 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/daa60f5a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
index de7c10b..6f07702 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -370,11 +370,21 @@ public final class IgniteSystemProperties {
/**
* Manages {@link OptimizedMarshaller} behavior of {@code serialVersionUID} computation for
* {@link Serializable} classes.
- * */
+ */
public static final String IGNITE_OPTIMIZED_MARSHALLER_USE_DEFAULT_SUID =
"IGNITE_OPTIMIZED_MARSHALLER_USE_DEFAULT_SUID";
/**
+ * If set to {@code true}, then default selected keys set is used inside
+ * {@code GridNioServer} which lead to some extra garbage generation when
+ * processing selected keys.
+ * <p>
+ * Default value is {@code false}. Should be switched to {@code true} if there are
+ * any problems in communication layer.
+ */
+ public static final String IGNITE_NO_SELECTOR_OPTS = "IGNITE_NO_SELECTOR_OPTS";
+
+ /**
* Enforces singleton.
*/
private IgniteSystemProperties() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/daa60f5a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
index d4f55b6..b2c23f5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvccManager.java
@@ -77,12 +77,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
private static final int MAX_REMOVED_LOCKS = 10240;
/** Pending locks per thread. */
- private final ThreadLocal<Deque<GridCacheMvccCandidate>> pending =
- new ThreadLocal<Deque<GridCacheMvccCandidate>>() {
- @Override protected Deque<GridCacheMvccCandidate> initialValue() {
- return new ArrayDeque<>();
- }
- };
+ private final ThreadLocal<Deque<GridCacheMvccCandidate>> pending = new ThreadLocal<>();
/** Pending near local locks and topology version per thread. */
private ConcurrentMap<Long, GridCacheExplicitLockSpan> pendingExplicit;
@@ -728,6 +723,9 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
Deque<GridCacheMvccCandidate> queue = pending.get();
+ if (queue == null)
+ pending.set(queue = new ArrayDeque<>());
+
GridCacheMvccCandidate prev = null;
if (!queue.isEmpty())
@@ -751,7 +749,7 @@ public class GridCacheMvccManager extends GridCacheSharedManagerAdapter {
* Reset MVCC context.
*/
public void contextReset() {
- pending.remove();
+ pending.set(null);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/daa60f5a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
index b0e346d..d9851c7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
@@ -453,24 +453,18 @@ public final class GridDhtGetSingleFuture<K, V> extends GridFutureAdapter<GridCa
if (map.isEmpty())
return null;
- Map.Entry<KeyCacheObject, T2<CacheObject, GridCacheVersion>> e = F.firstEntry(map);
+ T2<CacheObject, GridCacheVersion> val = map.get(key);
- if (e != null) {
- GridCacheEntryInfo info = new GridCacheEntryInfo();
+ assert val != null;
- T2<CacheObject, GridCacheVersion> val = e.getValue();
+ GridCacheEntryInfo info = new GridCacheEntryInfo();
- assert val != null;
+ info.cacheId(cctx.cacheId());
+ info.key(key);
+ info.value(skipVals ? null : val.get1());
+ info.version(val.get2());
- info.cacheId(cctx.cacheId());
- info.key(e.getKey());
- info.value(skipVals ? null : val.get1());
- info.version(val.get2());
-
- return info;
- }
-
- return null;
+ return info;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/daa60f5a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
index a92a080..6ec02a6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
@@ -711,12 +711,8 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
*/
@SuppressWarnings( {"unchecked", "RedundantCast"})
@Override public GridDhtFuture<Object> request(Collection<KeyCacheObject> keys, AffinityTopologyVersion topVer) {
- if (cctx.rebalanceEnabled()) {
- IgniteInternalFuture<Boolean> rebalanceFut = rebalanceFuture();
-
- if (rebalanceFut.isDone() && Boolean.TRUE.equals(rebalanceFut.result()))
- return null;
- }
+ if (!needForceKeys())
+ return null;
final GridDhtForceKeysFuture<?, ?> fut = new GridDhtForceKeysFuture<>(cctx, topVer, keys, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/daa60f5a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
index 9bec886..fca8741 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
@@ -17,6 +17,10 @@
package org.apache.ignite.internal.util.future;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.IgniteFutureCancelledCheckedException;
import org.apache.ignite.internal.IgniteInternalFuture;
@@ -31,11 +35,6 @@ import org.apache.ignite.lang.IgniteInClosure;
import org.apache.ignite.lang.IgniteReducer;
import org.jetbrains.annotations.Nullable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
-
/**
* Future composed of multiple inner futures.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/daa60f5a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
index d42e771..75fa9f2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
@@ -105,7 +105,7 @@ public class GridNioServer<T> {
/** */
private static final boolean DISABLE_KEYSET_OPTIMIZATION =
- IgniteSystemProperties.getBoolean("IGNITE_NO_SELECTOR_OPTS", false);
+ IgniteSystemProperties.getBoolean(IgniteSystemProperties.IGNITE_NO_SELECTOR_OPTS);
/**
*
[03/14] ignite git commit: fixed rat
Posted by vo...@apache.org.
fixed rat
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/975966c9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/975966c9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/975966c9
Branch: refs/heads/ignite-2329-1
Commit: 975966c96f05fb04ab759bc01ebef73f8727bc40
Parents: f85d2e6
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Jan 27 19:22:14 2016 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Jan 27 19:22:14 2016 +0300
----------------------------------------------------------------------
parent/pom.xml | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/975966c9/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 4497d01..4cbc556 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -830,6 +830,7 @@
<exclude>**/NOTICE*</exclude>
<exclude>**/LICENSE*</exclude>
<exclude>src/main/java/org/apache/ignite/internal/util/offheap/unsafe/GridOffHeapSnapTreeMap.java</exclude><!--BSD license-->
+ <exclude>src/main/java/org/apache/ignite/internal/util/nio/SelectedSelectionKeySet.java</exclude><!-- Apache 2.0 license -->
<exclude>src/main/java/org/apache/ignite/internal/util/snaptree/*.java</exclude><!--BSD license-->
<exclude>src/main/java/org/jsr166/*.java</exclude>
<exclude>src/test/java/org/apache/ignite/p2p/p2p.properties</exclude><!--test depends on file content-->
[11/14] ignite git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/ignite into ignite-gc-opts
Posted by vo...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-gc-opts
Conflicts:
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c9b44cf0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c9b44cf0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c9b44cf0
Branch: refs/heads/ignite-2329-1
Commit: c9b44cf057e5e6fba10ae0049f3eca02fe3ae0f1
Parents: f095126 e2be94e
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Feb 4 17:08:42 2016 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Feb 4 17:08:42 2016 +0300
----------------------------------------------------------------------
.../jmh/cache/JmhCacheAbstractBenchmark.java | 3 +
.../benchmarks/jmh/cache/JmhCacheBenchmark.java | 145 ++
.../jmh/cache/JmhCachePutBenchmark.java | 124 --
.../jmh/runner/JmhIdeBenchmarkRunner.java | 20 +-
.../org/apache/ignite/cache/CacheEntry.java | 9 +-
.../apache/ignite/cache/CacheInterceptor.java | 5 +
.../org/apache/ignite/internal/IgnitionEx.java | 3 +-
.../internal/binary/BinaryClassDescriptor.java | 6 +-
.../internal/binary/BinaryFieldAccessor.java | 45 +-
.../internal/binary/BinaryMarshaller.java | 5 +-
.../binary/BinaryObjectOffheapImpl.java | 34 +-
.../internal/binary/BinaryPrimitives.java | 117 +-
.../streams/BinaryAbstractInputStream.java | 53 +-
.../streams/BinaryAbstractOutputStream.java | 90 +-
.../binary/streams/BinaryAbstractStream.java | 34 -
.../binary/streams/BinaryHeapInputStream.java | 43 +-
.../binary/streams/BinaryHeapOutputStream.java | 86 +-
.../streams/BinaryMemoryAllocatorChunk.java | 9 +-
.../streams/BinaryOffheapInputStream.java | 42 +-
.../streams/BinaryOffheapOutputStream.java | 94 +-
.../internal/direct/DirectMessageReader.java | 2 +-
.../internal/direct/DirectMessageWriter.java | 2 +-
.../stream/v1/DirectByteBufferStreamImplV1.java | 106 +-
.../stream/v2/DirectByteBufferStreamImplV2.java | 351 ++++-
.../processors/cache/GridCacheAdapter.java | 100 +-
.../cache/GridCacheEvictionManager.java | 7 +-
.../processors/cache/GridCacheMapEntry.java | 4 +-
.../cache/GridCacheOffheapSwapEntry.java | 24 +-
.../cache/GridCacheSwapEntryImpl.java | 61 +-
.../cache/GridCacheUpdateAtomicResult.java | 4 +-
.../binary/CacheObjectBinaryProcessorImpl.java | 8 +-
.../dht/atomic/GridDhtAtomicCache.java | 13 +-
.../dht/atomic/GridDhtAtomicUpdateFuture.java | 2 +-
.../local/atomic/GridLocalAtomicCache.java | 9 +-
.../continuous/CacheContinuousQueryHandler.java | 9 +
.../IgniteCacheObjectProcessorImpl.java | 7 +-
.../platform/memory/PlatformAbstractMemory.java | 6 +-
.../PlatformBigEndianOutputStreamImpl.java | 14 +-
.../memory/PlatformInputStreamImpl.java | 53 +-
.../platform/memory/PlatformMemoryUtils.java | 108 +-
.../memory/PlatformOutputStreamImpl.java | 58 +-
.../ignite/internal/util/GridHandleTable.java | 17 +-
.../ignite/internal/util/GridJavaProcess.java | 3 -
.../internal/util/GridSpinReadWriteLock.java | 10 +-
.../apache/ignite/internal/util/GridUnsafe.java | 1483 +++++++++++++++++-
.../ignite/internal/util/IgniteUtils.java | 99 +-
.../internal/util/io/GridUnsafeDataInput.java | 145 +-
.../internal/util/io/GridUnsafeDataOutput.java | 165 +-
.../ignite/internal/util/nio/GridNioServer.java | 28 +-
.../util/offheap/unsafe/GridUnsafeMap.java | 75 +-
.../util/offheap/unsafe/GridUnsafeMemory.java | 106 +-
.../optimized/OptimizedClassDescriptor.java | 22 +-
.../optimized/OptimizedMarshaller.java | 5 +-
.../optimized/OptimizedMarshallerUtils.java | 44 +-
.../optimized/OptimizedObjectInputStream.java | 10 +-
.../java/org/apache/ignite/GridTestIoUtils.java | 117 +-
.../ignite/internal/GridAffinitySelfTest.java | 2 +-
.../binary/BinaryFieldsOffheapSelfTest.java | 13 +-
.../BinaryFooterOffsetsOffheapSelfTest.java | 13 +-
.../binary/BinaryMarshallerSelfTest.java | 17 +-
...naryObjectBuilderDefaultMappersSelfTest.java | 24 +-
.../mutabletest/GridBinaryTestClasses.java | 3 +-
.../AbstractBinaryStreamByteOrderSelfTest.java | 464 ++++++
.../BinaryHeapStreamByteOrderSelfTest.java | 29 +
.../BinaryOffheapStreamByteOrderSelfTest.java | 31 +
...ByteBufferStreamImplV2ByteOrderSelfTest.java | 244 +++
.../cache/GridCacheConcurrentMapSelfTest.java | 13 +-
...ContinuousQueryFailoverAbstractSelfTest.java | 6 +
...ntinuousQueryPartitionAtomicOneNodeTest.java | 37 +
...heContinuousQueryPartitionTxOneNodeTest.java | 37 +
...tinuousQueryReplicatedAtomicOneNodeTest.java | 31 +
...ontinuousQueryReplicatedOneNodeSelfTest.java | 120 --
...eContinuousQueryReplicatedTxOneNodeTest.java | 193 +++
...dUnsafeDataInputOutputByteOrderSelfTest.java | 249 +++
.../ignite/lang/GridBasicPerformanceTest.java | 11 +-
.../spi/discovery/tcp/TcpDiscoverySelfTest.java | 2 +-
.../testframework/junits/GridAbstractTest.java | 4 +-
.../IgniteBinaryObjectsTestSuite.java | 6 +
.../IgniteMarshallerSelfTestSuite.java | 4 +
.../hadoop/shuffle/HadoopShuffleJob.java | 5 +-
.../hadoop/shuffle/HadoopShuffleMessage.java | 10 +-
.../shuffle/streams/HadoopDataOutStream.java | 6 +-
.../HadoopConcurrentHashMultimapSelftest.java | 6 +-
.../collections/HadoopSkipListSelfTest.java | 5 +-
.../IgniteCacheQuerySelfTestSuite.java | 10 +-
.../org/apache/ignite/spark/IgniteContext.scala | 11 +-
.../ignite/internal/GridFactorySelfTest.java | 2 +-
87 files changed, 4450 insertions(+), 1402 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c9b44cf0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
index 3356052,2c3a197..ed768f2
--- 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
@@@ -100,6 -101,8 +101,7 @@@ import org.apache.ignite.internal.proce
import org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException;
import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException;
import org.apache.ignite.internal.util.F0;
-import org.apache.ignite.internal.util.GridLeanMap;
+ import org.apache.ignite.internal.util.future.GridCompoundFuture;
import org.apache.ignite.internal.util.future.GridEmbeddedFuture;
import org.apache.ignite.internal.util.future.GridFinishedFuture;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
http://git-wip-us.apache.org/repos/asf/ignite/blob/c9b44cf0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicCache.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c9b44cf0/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c9b44cf0/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
----------------------------------------------------------------------
[10/14] ignite git commit:
https://issues.apache.org/jira/browse/IGNITE-2329 - single get
Posted by vo...@apache.org.
https://issues.apache.org/jira/browse/IGNITE-2329 - single get
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f0951265
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f0951265
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f0951265
Branch: refs/heads/ignite-2329-1
Commit: f095126588a5f6d6263ebe8cf2ec963ce37e7d77
Parents: 7b98746
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Feb 3 17:49:14 2016 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Feb 3 17:49:14 2016 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheAdapter.java | 8 ++--
.../cache/distributed/dht/GridDhtGetFuture.java | 19 +++------
.../distributed/dht/GridDhtGetSingleFuture.java | 3 ++
.../org/apache/ignite/lang/IgniteBiTuple.java | 6 ++-
.../apache/ignite/lang/GridTupleSelfTest.java | 42 +++++++++++++++++++-
5 files changed, 59 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0951265/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 ef7d30a..3356052 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
@@ -1852,9 +1852,11 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
ctx.affinity().affinityTopologyVersion() : ctx.shared().exchange().readyAffinityVersion()) :
tx.topologyVersion();
- final Map<K1, V1> map = keys.size() == 1 ?
+ int keysSize = keys.size();
+
+ final Map<K1, V1> map = keysSize == 1 ?
(Map<K1, V1>)new IgniteBiTuple<>() :
- U.<K1, V1>newHashMap(keys.size());
+ U.<K1, V1>newHashMap(keysSize);
final boolean storeEnabled = !skipVals && readThrough && ctx.readThrough();
@@ -1910,7 +1912,7 @@ public abstract class GridCacheAdapter<K, V> implements IgniteInternalCache<K, V
if (tx == null || (!tx.implicit() && tx.isolation() == READ_COMMITTED))
ctx.evicts().touch(entry, topVer);
- if (keys.size() == 1)
+ if (keysSize == 1)
// Safe to return because no locks are required in READ_COMMITTED mode.
return new GridFinishedFuture<>(map);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0951265/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
index d55ede5..fa753b0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
@@ -211,7 +211,7 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col
GridDhtFuture<Object> fut = cctx.dht().dhtPreloader().request(keys.keySet(), topVer);
if (fut != null) {
- if (F.isEmpty(fut.invalidPartitions())) {
+ if (!F.isEmpty(fut.invalidPartitions())) {
if (retries == null)
retries = new HashSet<>();
@@ -452,18 +452,8 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col
if (fut.isDone()) {
if (fut.error() != null)
onDone(fut.error());
- else {
- Map<KeyCacheObject, T2<CacheObject, GridCacheVersion>> map = null;
-
- try {
- map = fut.get();
- }
- catch (IgniteCheckedException e) {
- assert false; // Should never happen.
- }
-
- return new GridFinishedFuture<>(toEntryInfos(map));
- }
+ else
+ return new GridFinishedFuture<>(toEntryInfos(fut.result()));
}
return new GridEmbeddedFuture<>(
@@ -488,6 +478,9 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col
* @return List of infos.
*/
private Collection<GridCacheEntryInfo> toEntryInfos(Map<KeyCacheObject, T2<CacheObject, GridCacheVersion>> map) {
+ if (map.isEmpty())
+ return Collections.emptyList();
+
Collection<GridCacheEntryInfo> infos = new ArrayList<>(map.size());
for (Map.Entry<KeyCacheObject, T2<CacheObject, GridCacheVersion>> entry : map.entrySet()) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0951265/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
index 4439307..b0e346d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetSingleFuture.java
@@ -450,6 +450,9 @@ public final class GridDhtGetSingleFuture<K, V> extends GridFutureAdapter<GridCa
* @return List of infos.
*/
private GridCacheEntryInfo toEntryInfo(Map<KeyCacheObject, T2<CacheObject, GridCacheVersion>> map) {
+ if (map.isEmpty())
+ return null;
+
Map.Entry<KeyCacheObject, T2<CacheObject, GridCacheVersion>> e = F.firstEntry(map);
if (e != null) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0951265/modules/core/src/main/java/org/apache/ignite/lang/IgniteBiTuple.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/lang/IgniteBiTuple.java b/modules/core/src/main/java/org/apache/ignite/lang/IgniteBiTuple.java
index 6098007..89e5f16 100644
--- a/modules/core/src/main/java/org/apache/ignite/lang/IgniteBiTuple.java
+++ b/modules/core/src/main/java/org/apache/ignite/lang/IgniteBiTuple.java
@@ -250,7 +250,9 @@ public class IgniteBiTuple<V1, V2> implements Map<V1, V2>, Map.Entry<V1, V2>,
/** {@inheritDoc} */
@Override public Set<Map.Entry<V1, V2>> entrySet() {
- return Collections.<Entry<V1, V2>>singleton(this);
+ return isEmpty() ?
+ Collections.<Entry<V1,V2>>emptySet() :
+ Collections.<Entry<V1, V2>>singleton(this);
}
/** {@inheritDoc} */
@@ -301,4 +303,4 @@ public class IgniteBiTuple<V1, V2> implements Map<V1, V2>, Map.Entry<V1, V2>,
@Override public String toString() {
return S.toString(IgniteBiTuple.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0951265/modules/core/src/test/java/org/apache/ignite/lang/GridTupleSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/lang/GridTupleSelfTest.java b/modules/core/src/test/java/org/apache/ignite/lang/GridTupleSelfTest.java
index a21ed30..5865cad 100644
--- a/modules/core/src/test/java/org/apache/ignite/lang/GridTupleSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/lang/GridTupleSelfTest.java
@@ -20,10 +20,12 @@ package org.apache.ignite.lang;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.NoSuchElementException;
import org.apache.ignite.internal.util.lang.GridTuple;
import org.apache.ignite.internal.util.lang.GridTuple3;
import org.apache.ignite.internal.util.lang.GridTupleV;
+import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.testframework.junits.common.GridCommonTest;
@@ -102,6 +104,44 @@ public class GridTupleSelfTest extends GridCommonAbstractTest {
/**
* JUnit.
*/
+ public void testGridTuple2AsMap() {
+ String str1 = "A test string 1";
+ String str2 = "A test string 2";
+
+ IgniteBiTuple<String, String> tpl = new IgniteBiTuple<>();
+
+ tpl.put(str1, str2);
+
+ assertEquals(str2, tpl.get(str1));
+ assertEquals(1, tpl.size());
+
+ assert tpl.containsKey(str1);
+ assert tpl.containsValue(str2);
+
+ Iterator<Map.Entry<String, String>> it = tpl.entrySet().iterator();
+
+ assert it.hasNext();
+
+ Map.Entry<String, String> next = it.next();
+
+ assertEquals(str1, next.getKey());
+ assertEquals(str2, next.getValue());
+
+ assert !it.hasNext();
+
+ next = F.firstEntry(tpl);
+
+ assertEquals(str1, next.getKey());
+ assertEquals(str2, next.getValue());
+
+ tpl = new IgniteBiTuple<>();
+
+ assert !tpl.entrySet().iterator().hasNext();
+ }
+
+ /**
+ * JUnit.
+ */
public void testGridTuple3AsIterable() {
String str1 = "A test string 1";
String str2 = "A test string 2";
@@ -166,4 +206,4 @@ public class GridTupleSelfTest extends GridCommonAbstractTest {
info("Caught expected exception: " + e);
}
}
-}
\ No newline at end of file
+}
[13/14] ignite git commit: Merge branch 'ignite-gc-opts' of
https://github.com/yzhdanov/ignite into yakov_opto
Posted by vo...@apache.org.
Merge branch 'ignite-gc-opts' of https://github.com/yzhdanov/ignite into yakov_opto
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c66d16c3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c66d16c3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c66d16c3
Branch: refs/heads/ignite-2329-1
Commit: c66d16c3c556e273d938e1077982223b26ae23f7
Parents: 88b0eeb daa60f5
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Fri Feb 5 13:47:26 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Fri Feb 5 13:47:26 2016 +0300
----------------------------------------------------------------------
.../apache/ignite/IgniteSystemProperties.java | 12 +-
.../processors/cache/GridCacheAdapter.java | 37 +-
.../processors/cache/GridCacheMvccManager.java | 42 +-
.../processors/cache/GridCachePreloader.java | 6 +
.../cache/GridCachePreloaderAdapter.java | 5 +
.../processors/cache/GridCacheUtils.java | 21 +-
.../dht/GridClientPartitionTopology.java | 5 +
.../distributed/dht/GridDhtCacheAdapter.java | 72 ++-
.../distributed/dht/GridDhtEmbeddedFuture.java | 13 +-
.../cache/distributed/dht/GridDhtGetFuture.java | 176 ++++---
.../distributed/dht/GridDhtGetSingleFuture.java | 476 +++++++++++++++++++
.../distributed/dht/GridDhtLocalPartition.java | 76 +--
.../distributed/dht/GridDhtPartitionState.java | 2 +-
.../dht/GridDhtPartitionTopology.java | 5 +
.../dht/GridDhtPartitionTopologyImpl.java | 9 +
.../distributed/dht/GridDhtTxPrepareFuture.java | 7 +-
.../dht/atomic/GridDhtAtomicCache.java | 2 +-
.../dht/colocated/GridDhtColocatedCache.java | 40 +-
.../dht/preloader/GridDhtPreloader.java | 16 +
.../cache/distributed/near/GridNearTxLocal.java | 1 -
.../IgniteCacheObjectProcessorImpl.java | 2 +-
.../util/future/GridCompoundFuture.java | 46 +-
.../ignite/internal/util/nio/GridNioServer.java | 143 +++++-
.../util/nio/GridSelectorNioSessionImpl.java | 2 +-
.../util/nio/SelectedSelectionKeySet.java | 111 +++++
.../org/apache/ignite/lang/IgniteBiTuple.java | 6 +-
.../IgniteTxPreloadAbstractTest.java | 2 +-
.../near/GridCacheNearReadersSelfTest.java | 19 +-
.../apache/ignite/lang/GridTupleSelfTest.java | 42 +-
parent/pom.xml | 1 +
30 files changed, 1141 insertions(+), 256 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c66d16c3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c66d16c3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
[06/14] ignite git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/ignite into ignite-gc-opts
Posted by vo...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-gc-opts
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f8a55ad6
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f8a55ad6
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f8a55ad6
Branch: refs/heads/ignite-2329-1
Commit: f8a55ad63d5f98e6c2663e35785dbf51beb412b2
Parents: dcdf2da d2a107b
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Fri Jan 29 14:36:08 2016 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Fri Jan 29 14:36:08 2016 +0300
----------------------------------------------------------------------
modules/benchmarks/pom.xml | 2 +-
.../jmh/cache/JmhCachePutBenchmark.java | 2 +
.../jmh/runner/JmhIdeBenchmarkRunner.java | 18 +++++++
.../dht/preloader/GridDhtPartitionDemander.java | 4 +-
.../GridServicePackagePrivateSelfTest.java | 17 ++++---
modules/docker/1.5.0.final/Dockerfile | 40 ++++++++++++++++
modules/docker/1.5.0.final/run.sh | 50 ++++++++++++++++++++
modules/docker/Dockerfile | 6 +--
8 files changed, 128 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
[04/14] ignite git commit: Merge branch 'master' of
https://git-wip-us.apache.org/repos/asf/ignite into ignite-gc-opts
Posted by vo...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/ignite into ignite-gc-opts
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a5aa7e63
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a5aa7e63
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a5aa7e63
Branch: refs/heads/ignite-2329-1
Commit: a5aa7e634a0d3140158b9c7fd40f62ddbcebf24a
Parents: 975966c 79db260
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Thu Jan 28 19:19:10 2016 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Thu Jan 28 19:19:10 2016 +0300
----------------------------------------------------------------------
examples/pom.xml | 2 +-
examples/schema-import/pom.xml | 2 +-
.../examples/datagrid/CacheAffinityExample.java | 8 +-
.../java8/datagrid/CacheAffinityExample.java | 6 +-
modules/aop/pom.xml | 2 +-
modules/apache-license-gen/pom.xml | 2 +-
modules/aws/pom.xml | 2 +-
modules/benchmarks/pom.xml | 140 +++++++
.../benchmarks/jmh/JmhAbstractBenchmark.java | 150 ++++++++
.../jmh/cache/JmhCacheAbstractBenchmark.java | 181 +++++++++
.../jmh/cache/JmhCachePutBenchmark.java | 122 +++++++
.../jmh/runner/JmhIdeBenchmarkRunner.java | 214 +++++++++++
.../internal/benchmarks/model/IntValue.java | 91 +++++
modules/camel/pom.xml | 2 +-
modules/clients/pom.xml | 2 +-
.../internal/client/ClientGetAffinityTask.java | 4 +-
modules/cloud/pom.xml | 2 +-
modules/codegen/pom.xml | 2 +-
modules/core/pom.xml | 5 +-
.../java/org/apache/ignite/IgniteCluster.java | 7 +-
.../apache/ignite/cache/affinity/Affinity.java | 24 +-
.../internal/binary/BinaryClassDescriptor.java | 32 +-
.../ignite/internal/jdbc/JdbcConnection.java | 14 +-
.../affinity/GridAffinityProcessor.java | 60 ++-
.../processors/cache/CacheMetricsSnapshot.java | 4 +-
.../processors/cache/GridCacheAdapter.java | 78 +---
.../cache/GridCacheAffinityManager.java | 47 ++-
.../processors/cache/GridCacheUtils.java | 36 +-
.../cache/affinity/GridCacheAffinityImpl.java | 48 ++-
.../near/GridNearTxFinishFuture.java | 96 ++---
.../handlers/log/GridLogCommandHandler.java | 16 +-
.../processors/service/ServiceContextImpl.java | 4 +-
.../plugin/security/SecurityCredentials.java | 4 +-
.../core/src/main/resources/ignite.properties | 2 +-
.../ignite/internal/GridAffinityMappedTest.java | 8 +-
.../internal/GridAffinityNoCacheSelfTest.java | 290 +++++++++++++++
.../internal/GridAffinityP2PSelfTest.java | 8 +-
.../ignite/internal/GridAffinitySelfTest.java | 8 +-
.../cache/GridCacheAbstractFullApiSelfTest.java | 4 +-
.../cache/GridCacheAffinityRoutingSelfTest.java | 10 +-
.../GridCacheConcurrentTxMultiNodeTest.java | 4 +-
.../GridCacheDaemonNodeAbstractSelfTest.java | 17 +-
.../cache/GridCacheDeploymentSelfTest.java | 8 +-
.../cache/GridCacheEntryMemorySizeSelfTest.java | 6 +-
...hePartitionedProjectionAffinitySelfTest.java | 8 +-
.../cache/GridCachePutAllFailoverSelfTest.java | 4 +-
.../cache/GridCacheUtilsSelfTest.java | 136 +------
.../dht/GridCacheDhtMultiBackupTest.java | 4 +-
.../near/GridCacheNearOnlyTopologySelfTest.java | 4 +-
.../near/GridCacheNearTxMultiNodeSelfTest.java | 4 +-
...titionedExplicitLockNodeFailureSelfTest.java | 6 +-
.../RandomEvictionPolicyCacheSizeSelfTest.java | 79 ----
.../random/RandomEvictionPolicySelfTest.java | 363 -------------------
...ridCacheContinuousQueryAbstractSelfTest.java | 10 +-
.../processors/igfs/IgfsStreamsSelfTest.java | 4 +-
.../handlers/log/GridLogCommandHandlerTest.java | 58 ++-
.../GridServicePackagePrivateSelfTest.java | 46 +++
.../processors/service/inner/MyService.java | 30 ++
.../service/inner/MyServiceFactory.java | 30 ++
.../processors/service/inner/MyServiceImpl.java | 45 +++
.../ignite/loadtests/dsi/GridDsiClient.java | 4 +-
.../tcp/GridCacheDhtLockBackupSelfTest.java | 4 +-
.../IgniteCacheEvictionSelfTestSuite.java | 4 -
.../testsuites/IgniteComputeGridTestSuite.java | 4 +-
.../testsuites/IgniteKernalSelfTestSuite.java | 4 +-
modules/extdata/p2p/pom.xml | 2 +-
.../extdata/uri/modules/uri-dependency/pom.xml | 2 +-
modules/extdata/uri/pom.xml | 2 +-
modules/flume/pom.xml | 2 +-
modules/gce/pom.xml | 2 +-
modules/geospatial/pom.xml | 2 +-
modules/hadoop/pom.xml | 2 +-
modules/hibernate/pom.xml | 2 +-
modules/indexing/pom.xml | 2 +-
modules/jcl/pom.xml | 2 +-
modules/jms11/pom.xml | 2 +-
modules/jta/pom.xml | 2 +-
modules/kafka/pom.xml | 2 +-
modules/log4j/pom.xml | 2 +-
modules/log4j2/pom.xml | 2 +-
modules/mesos/pom.xml | 2 +-
modules/mqtt/pom.xml | 2 +-
modules/osgi-karaf/pom.xml | 2 +-
modules/osgi-paxlogging/pom.xml | 2 +-
modules/osgi/pom.xml | 2 +-
modules/platforms/cpp/common/configure.ac | 2 +-
.../cpp/common/project/vs/common.vcxproj | 2 +-
modules/platforms/cpp/core-test/configure.ac | 2 +-
modules/platforms/cpp/core/configure.ac | 2 +-
modules/platforms/cpp/examples/configure.ac | 2 +-
modules/platforms/cpp/ignite/configure.ac | 2 +-
.../Apache.Ignite.Benchmarks.csproj | 4 +-
.../Properties/AssemblyInfo.cs | 6 +-
.../Apache.Ignite.Core.Tests.TestDll.csproj | 4 +-
.../Properties/AssemblyInfo.cs | 6 +-
.../Apache.Ignite.Core.Tests.csproj | 2 +-
.../Properties/AssemblyInfo.cs | 6 +-
.../Apache.Ignite.Core.csproj | 8 +-
.../Apache.Ignite.Core.ruleset | 26 ++
.../Binary/BinaryConfiguration.cs | 3 +
.../Binary/BinaryTypeConfiguration.cs | 5 +
.../Binary/BinaryTypeNames.cs | 64 ++--
.../Cache/CachePartialUpdateException.cs | 3 +
.../Apache.Ignite.Core/Cache/CacheResult.cs | 41 ++-
.../Cache/Event/ICacheEntryEventFilter.cs | 1 +
.../Cache/Event/ICacheEntryEventListener.cs | 1 +
.../Cache/Query/Continuous/ContinuousQuery.cs | 2 +-
.../Apache.Ignite.Core/Cache/Query/QueryBase.cs | 2 +-
.../Cache/Query/SqlFieldsQuery.cs | 2 +-
.../Apache.Ignite.Core/Cache/Query/SqlQuery.cs | 6 +-
.../Apache.Ignite.Core/Cache/Query/TextQuery.cs | 7 +-
.../Cache/Store/CacheStoreAdapter.cs | 4 +
.../Compute/ComputeJobAdapter.cs | 2 +-
.../Compute/ComputeJobResultPolicy.cs | 2 -
.../Compute/ComputeTaskAdapter.cs | 3 +
.../Compute/ComputeTaskSplitAdapter.cs | 18 +-
.../Datastream/StreamTransformer.cs | 2 +
.../Datastream/StreamVisitor.cs | 2 +
.../Apache.Ignite.Core/Events/CacheEvent.cs | 8 +-
.../Events/CacheQueryExecutedEvent.cs | 4 +-
.../Events/CacheQueryReadEvent.cs | 6 +-
.../Events/CacheRebalancingEvent.cs | 4 +-
.../Events/CheckpointEvent.cs | 4 +-
.../Apache.Ignite.Core/Events/DiscoveryEvent.cs | 4 +-
.../Apache.Ignite.Core/Events/EventBase.cs | 70 +++-
.../dotnet/Apache.Ignite.Core/Ignition.cs | 3 +-
.../Apache.Ignite.Core/Impl/Binary/Binary.cs | 47 +--
.../Impl/Binary/BinaryFullTypeDescriptor.cs | 2 +-
.../Impl/Binary/BinaryObject.cs | 44 ++-
.../Impl/Binary/BinaryObjectBuilder.cs | 75 ++--
.../Impl/Binary/BinaryReader.cs | 1 +
.../Impl/Binary/BinaryReflectiveSerializer.cs | 2 +-
.../Impl/Binary/BinarySystemHandlers.cs | 9 +-
.../Impl/Binary/BinaryUtils.cs | 7 +-
.../Impl/Binary/BinaryWriter.cs | 3 +
.../Impl/Binary/Io/BinaryHeapStream.cs | 9 +
.../Impl/Binary/Marshaller.cs | 19 +-
.../Impl/Binary/Metadata/BinaryType.cs | 2 +
.../Impl/Binary/SerializableObjectHolder.cs | 13 +-
.../Impl/Binary/Structure/BinaryStructure.cs | 3 +-
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 42 ++-
.../Impl/Cache/Query/AbstractQueryCursor.cs | 4 +-
.../Continuous/ContinuousQueryFilterHolder.cs | 2 +-
.../Continuous/ContinuousQueryHandleImpl.cs | 4 +-
.../Impl/Cache/Query/FieldsQueryCursor.cs | 2 +
.../Impl/Cache/Query/QueryCursor.cs | 2 +
.../Impl/Common/CancelledTask.cs | 3 +
.../Common/CopyOnWriteConcurrentDictionary.cs | 1 +
.../Impl/Common/DelegateConverter.cs | 11 +-
.../Apache.Ignite.Core/Impl/Common/Future.cs | 2 +
.../Impl/Common/LoadedAssembliesResolver.cs | 1 +
.../Closure/ComputeAbstractClosureTask.cs | 3 +
.../Compute/Closure/ComputeMultiClosureTask.cs | 2 +
.../Closure/ComputeReducingClosureTask.cs | 2 +
.../Compute/Closure/ComputeSingleClosureTask.cs | 2 +
.../Impl/Datastream/DataStreamerBatch.cs | 1 +
.../Impl/Datastream/DataStreamerImpl.cs | 5 +-
.../Apache.Ignite.Core/Impl/ExceptionUtils.cs | 56 +--
.../Impl/Handle/HandleRegistry.cs | 1 +
.../Apache.Ignite.Core/Impl/IgniteUtils.cs | 11 +-
.../Impl/InteropExceptionHolder.cs | 11 +-
.../Memory/PlatformBigEndianMemoryStream.cs | 8 +
.../Impl/Memory/PlatformMemory.cs | 2 +
.../Impl/Memory/PlatformMemoryManager.cs | 2 +
.../Impl/Memory/PlatformMemoryStream.cs | 2 +
.../Impl/Memory/PlatformRawMemory.cs | 2 +
.../Apache.Ignite.Core/Impl/PlatformTarget.cs | 3 +-
.../Impl/Resource/ResourceProcessor.cs | 2 +-
.../Impl/Resource/ResourceTypeDescriptor.cs | 2 +-
.../Impl/Services/ServiceProxy.cs | 2 +
.../Impl/Services/ServiceProxyInvoker.cs | 1 +
.../Impl/Transactions/TransactionsImpl.cs | 2 +
.../Impl/Unmanaged/UnmanagedCallbacks.cs | 5 +-
.../Properties/AssemblyInfo.cs | 6 +-
.../Services/ServiceInvocationException.cs | 2 +
modules/platforms/dotnet/Apache.Ignite.FxCop | 354 +++---------------
modules/platforms/dotnet/Apache.Ignite.sln | 4 +-
.../Apache.Ignite.sln.TeamCity.DotSettings | 30 ++
.../dotnet/Apache.Ignite/Apache.Ignite.csproj | 5 +-
.../Apache.Ignite/Properties/AssemblyInfo.cs | 6 +-
.../Apache.Ignite.Examples.csproj | 4 +-
.../Properties/AssemblyInfo.cs | 6 +-
.../Apache.Ignite.ExamplesDll.csproj | 4 +-
.../Properties/AssemblyInfo.cs | 6 +-
modules/rest-http/pom.xml | 2 +-
modules/scalar-2.10/pom.xml | 2 +-
modules/scalar/pom.xml | 2 +-
modules/schedule/pom.xml | 2 +-
modules/schema-import/pom.xml | 2 +-
modules/slf4j/pom.xml | 2 +-
modules/spark-2.10/pom.xml | 2 +-
modules/spark/pom.xml | 2 +-
modules/spring/pom.xml | 2 +-
modules/ssh/pom.xml | 2 +-
modules/storm/pom.xml | 6 +-
modules/tools/pom.xml | 2 +-
modules/twitter/pom.xml | 2 +-
modules/urideploy/pom.xml | 2 +-
modules/visor-console-2.10/pom.xml | 2 +-
modules/visor-console/pom.xml | 2 +-
modules/visor-plugins/pom.xml | 2 +-
modules/web/pom.xml | 2 +-
modules/yardstick/pom.xml | 2 +-
modules/yarn/pom.xml | 2 +-
modules/zookeeper/pom.xml | 2 +-
parent/pom.xml | 3 +-
pom.xml | 3 +-
207 files changed, 2383 insertions(+), 1545 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a5aa7e63/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a5aa7e63/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheUtils.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a5aa7e63/parent/pom.xml
----------------------------------------------------------------------
[02/14] ignite git commit: fixed
https://issues.apache.org/jira/browse/IGNITE-2329 + forceKeysFuture opts +
disabled partition map
Posted by vo...@apache.org.
fixed https://issues.apache.org/jira/browse/IGNITE-2329 + forceKeysFuture opts + disabled partition map
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f85d2e68
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f85d2e68
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f85d2e68
Branch: refs/heads/ignite-2329-1
Commit: f85d2e68e9ea5c8af44d44c531be016beef102e1
Parents: 914b365
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Wed Jan 27 18:42:41 2016 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Wed Jan 27 18:42:41 2016 +0300
----------------------------------------------------------------------
.../dht/GridClientPartitionTopology.java | 5 ++
.../distributed/dht/GridDhtCacheAdapter.java | 3 +-
.../cache/distributed/dht/GridDhtGetFuture.java | 35 ++++++---
.../distributed/dht/GridDhtLocalPartition.java | 76 +++++++++++---------
.../distributed/dht/GridDhtPartitionState.java | 2 +-
.../dht/GridDhtPartitionTopology.java | 5 ++
.../dht/GridDhtPartitionTopologyImpl.java | 9 +++
.../dht/preloader/GridDhtPreloader.java | 5 +-
.../util/future/GridCompoundFuture.java | 39 +++++-----
.../ignite/internal/util/nio/GridNioServer.java | 6 +-
.../util/nio/GridSelectorNioSessionImpl.java | 2 +-
.../IgniteTxPreloadAbstractTest.java | 2 +-
12 files changed, 119 insertions(+), 70 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f85d2e68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
index dcfc038..ad4943e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
@@ -336,6 +336,11 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
}
/** {@inheritDoc} */
+ @Override public void releasePartitions(int... parts) {
+ // No-op.
+ }
+
+ /** {@inheritDoc} */
@Override public List<GridDhtLocalPartition> localPartitions() {
return Collections.emptyList();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f85d2e68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
index 9cf8084..c3146d1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtCacheAdapter.java
@@ -695,7 +695,8 @@ public abstract class GridDhtCacheAdapter<K, V> extends GridDistributedCacheAdap
@Nullable UUID subjId,
int taskNameHash,
@Nullable IgniteCacheExpiryPolicy expiry,
- boolean skipVals) {
+ boolean skipVals
+ ) {
GridDhtGetFuture<K, V> fut = new GridDhtGetFuture<>(ctx,
msgId,
reader,
http://git-wip-us.apache.org/repos/asf/ignite/blob/f85d2e68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
index ab166d5..fb417df 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtGetFuture.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.cache.distributed.dht;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
@@ -82,7 +83,7 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col
private Map<KeyCacheObject, Boolean> keys;
/** Reserved partitions. */
- private Collection<GridDhtLocalPartition> parts = new HashSet<>();
+ private int[] parts;
/** Future ID. */
private IgniteUuid futId;
@@ -194,8 +195,8 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col
@Override public boolean onDone(Collection<GridCacheEntryInfo> res, Throwable err) {
if (super.onDone(res, err)) {
// Release all partitions reserved by this future.
- for (GridDhtLocalPartition part : parts)
- part.release();
+ if (parts != null)
+ cctx.topology().releasePartitions(parts);
return true;
}
@@ -239,7 +240,6 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col
map0(keys);
}
-
/**
* @param keys Keys to map.
*/
@@ -251,7 +251,7 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col
int part = cctx.affinity().partition(key.getKey());
if (retries == null || !retries.contains(part)) {
- if (!map(key.getKey(), parts)) {
+ if (!map(key.getKey())) {
if (retries == null)
retries = new HashSet<>();
@@ -274,15 +274,28 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col
}
// Add new future.
- add(getAsync(mappedKeys == null ? keys : mappedKeys));
+ IgniteInternalFuture<Collection<GridCacheEntryInfo>> fut = getAsync(mappedKeys == null ? keys : mappedKeys);
+
+ // Optimization to avoid going through compound future,
+ // if getAsync() has been completed and no other futures added to this
+ // compound future.
+ if (fut.isDone() && futuresSize() == 0) {
+ if (fut.error() != null)
+ onDone(fut.error());
+ else
+ onDone(fut.result());
+
+ return;
+ }
+
+ add(fut);
}
/**
* @param key Key.
- * @param parts Parts to map.
* @return {@code True} if mapped.
*/
- private boolean map(KeyCacheObject key, Collection<GridDhtLocalPartition> parts) {
+ private boolean map(KeyCacheObject key) {
GridDhtLocalPartition part = topVer.topologyVersion() > 0 ?
cache().topology().localPartition(cctx.affinity().partition(key), topVer, true) :
cache().topology().localPartition(key, false);
@@ -290,10 +303,12 @@ public final class GridDhtGetFuture<K, V> extends GridCompoundIdentityFuture<Col
if (part == null)
return false;
- if (!parts.contains(part)) {
+ if (parts == null || !F.contains(parts, part.id())) {
// By reserving, we make sure that partition won't be unloaded while processed.
if (part.reserve()) {
- parts.add(part);
+ parts = parts == null ? new int[1] : Arrays.copyOf(parts, parts.length + 1);
+
+ parts[parts.length - 1] = part.id();
return true;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f85d2e68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
index c4312b5..4fc1eaf 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLocalPartition.java
@@ -26,7 +26,6 @@ import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
-import java.util.concurrent.atomic.AtomicStampedReference;
import java.util.concurrent.locks.ReentrantLock;
import javax.cache.CacheException;
import org.apache.ignite.IgniteCheckedException;
@@ -83,8 +82,7 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
/** State. */
@GridToStringExclude
- private final AtomicStampedReference<GridDhtPartitionState> state =
- new AtomicStampedReference<>(MOVING, 0);
+ private final AtomicLong state = new AtomicLong((long)MOVING.ordinal() << 32);
/** Rent future. */
@GridToStringExclude
@@ -153,8 +151,9 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
* @return {@code false} If such reservation already added.
*/
public boolean addReservation(GridDhtPartitionsReservation r) {
- assert state.getReference() != EVICTED : "we can reserve only active partitions";
- assert state.getStamp() != 0 : "partition must be already reserved before adding group reservation";
+ assert GridDhtPartitionState.fromOrdinal((int)(state.get() >> 32)) != EVICTED :
+ "we can reserve only active partitions";
+ assert (state.get() & 0xFFFF) != 0 : "partition must be already reserved before adding group reservation";
return reservations.addIfAbsent(r);
}
@@ -185,14 +184,14 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
* @return Partition state.
*/
public GridDhtPartitionState state() {
- return state.getReference();
+ return GridDhtPartitionState.fromOrdinal((int)(state.get() >> 32));
}
/**
* @return Reservations.
*/
public int reservations() {
- return state.getStamp();
+ return (int)(state.get() & 0xFFFF);
}
/**
@@ -385,14 +384,12 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
*/
@Override public boolean reserve() {
while (true) {
- int reservations = state.getStamp();
+ long reservations = state.get();
- GridDhtPartitionState s = state.getReference();
-
- if (s == EVICTED)
+ if ((int)(reservations >> 32) == EVICTED.ordinal())
return false;
- if (state.compareAndSet(s, s, reservations, reservations + 1))
+ if (state.compareAndSet(reservations, reservations + 1))
return true;
}
}
@@ -402,17 +399,15 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
*/
@Override public void release() {
while (true) {
- int reservations = state.getStamp();
+ long reservations = state.get();
- if (reservations == 0)
+ if ((int)(reservations & 0xFFFF) == 0)
return;
- GridDhtPartitionState s = state.getReference();
-
- assert s != EVICTED;
+ assert (int)(reservations >> 32) != EVICTED.ordinal();
// Decrement reservations.
- if (state.compareAndSet(s, s, reservations, --reservations)) {
+ if (state.compareAndSet(reservations, --reservations)) {
tryEvict();
break;
@@ -421,23 +416,32 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
}
/**
+ * @param reservations Current aggregated value.
+ * @param toState State to switch to.
+ * @return {@code true} if cas succeeds.
+ */
+ private boolean casState(long reservations, GridDhtPartitionState toState) {
+ return state.compareAndSet(reservations, (reservations & 0xFFFF) | ((long)toState.ordinal() << 32));
+ }
+
+ /**
* @return {@code True} if transitioned to OWNING state.
*/
boolean own() {
while (true) {
- int reservations = state.getStamp();
+ long reservations = state.get();
- GridDhtPartitionState s = state.getReference();
+ int ord = (int)(reservations >> 32);
- if (s == RENTING || s == EVICTED)
+ if (ord == RENTING.ordinal() || ord == EVICTED.ordinal())
return false;
- if (s == OWNING)
+ if (ord == OWNING.ordinal())
return true;
- assert s == MOVING;
+ assert ord == MOVING.ordinal();
- if (state.compareAndSet(MOVING, OWNING, reservations, reservations)) {
+ if (casState(reservations, OWNING)) {
if (log.isDebugEnabled())
log.debug("Owned partition: " + this);
@@ -455,14 +459,14 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
*/
IgniteInternalFuture<?> rent(boolean updateSeq) {
while (true) {
- int reservations = state.getStamp();
+ long reservations = state.get();
- GridDhtPartitionState s = state.getReference();
+ int ord = (int)(reservations >> 32);
- if (s == RENTING || s == EVICTED)
+ if (ord == RENTING.ordinal() || ord == EVICTED.ordinal())
return rent;
- if (state.compareAndSet(s, RENTING, reservations, reservations)) {
+ if (casState(reservations, RENTING)) {
if (log.isDebugEnabled())
log.debug("Moved partition to RENTING state: " + this);
@@ -481,9 +485,13 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
* @param updateSeq Update sequence.
*/
void tryEvictAsync(boolean updateSeq) {
+ long reservations = state.get();
+
+ int ord = (int)(reservations >> 32);
+
if (map.isEmpty() && !GridQueryProcessor.isEnabled(cctx.config()) &&
- state.getReference() == RENTING && state.getStamp() == 0 &&
- state.compareAndSet(RENTING, EVICTED, 0, 0)) {
+ ord == RENTING.ordinal() && (reservations & 0xFFFF) == 0 &&
+ casState(reservations, EVICTED)) {
if (log.isDebugEnabled())
log.debug("Evicted partition: " + this);
@@ -520,13 +528,17 @@ public class GridDhtLocalPartition implements Comparable<GridDhtLocalPartition>,
*
*/
public void tryEvict() {
- if (state.getReference() != RENTING || state.getStamp() != 0 || groupReserved())
+ long reservations = state.get();
+
+ int ord = (int)(reservations >> 32);
+
+ if (ord != RENTING.ordinal() || (reservations & 0xFFFF) != 0 || groupReserved())
return;
// Attempt to evict partition entries from cache.
clearAll();
- if (map.isEmpty() && state.compareAndSet(RENTING, EVICTED, 0, 0)) {
+ if (map.isEmpty() && casState(reservations, EVICTED)) {
if (log.isDebugEnabled())
log.debug("Evicted partition: " + this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/f85d2e68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionState.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionState.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionState.java
index 7b49369..041f135 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionState.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionState.java
@@ -52,4 +52,4 @@ public enum GridDhtPartitionState {
public boolean active() {
return this != EVICTED;
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f85d2e68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
index dd06d6f..84889f8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
@@ -112,6 +112,11 @@ public interface GridDhtPartitionTopology {
throws GridDhtInvalidPartitionException;
/**
+ * @param parts Partitions to release (should be reserved before).
+ */
+ public void releasePartitions(int... parts);
+
+ /**
* @param key Cache key.
* @param create If {@code true}, then partition will be created if it's not there.
* @return Local partition.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f85d2e68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index 2ab8a12..8269378 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
@@ -611,6 +611,15 @@ class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
}
/** {@inheritDoc} */
+ @Override public void releasePartitions(int... parts) {
+ assert parts != null;
+ assert parts.length > 0;
+
+ for (int i = 0; i < parts.length; i++)
+ locParts.get(parts[i]).release();
+ }
+
+ /** {@inheritDoc} */
@Override public GridDhtLocalPartition localPartition(Object key, boolean create) {
return localPartition(cctx.affinity().partition(key), AffinityTopologyVersion.NONE, create);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f85d2e68/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
index 9f1e25d..a72596c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java
@@ -403,6 +403,7 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
try {
demandLock.readLock().lock();
+
try {
demander.handleSupplyMessage(idx, id, s);
}
@@ -698,7 +699,9 @@ public class GridDhtPreloader extends GridCachePreloaderAdapter {
*/
@SuppressWarnings( {"unchecked", "RedundantCast"})
@Override public GridDhtFuture<Object> request(Collection<KeyCacheObject> keys, AffinityTopologyVersion topVer) {
- if (rebalanceFuture().isDone())
+ if (cctx.rebalanceEnabled() &&
+ rebalanceFuture().isDone() &&
+ Boolean.TRUE.equals(rebalanceFuture().result()))
return null;
final GridDhtForceKeysFuture<?, ?> fut = new GridDhtForceKeysFuture<>(cctx, topVer, keys, this);
http://git-wip-us.apache.org/repos/asf/ignite/blob/f85d2e68/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
index c382497..9bec886 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/future/GridCompoundFuture.java
@@ -33,6 +33,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
/**
@@ -54,7 +55,7 @@ public class GridCompoundFuture<T, R> extends GridFutureAdapter<R> implements Ig
AtomicIntegerFieldUpdater.newUpdater(GridCompoundFuture.class, "lsnrCalls");
/** Futures. */
- protected final ArrayList<IgniteInternalFuture<T>> futs = new ArrayList<>();
+ protected ArrayList<IgniteInternalFuture<T>> futs;
/** Reducer. */
@GridToStringInclude
@@ -154,10 +155,8 @@ public class GridCompoundFuture<T, R> extends GridFutureAdapter<R> implements Ig
*
* @return Collection of futures.
*/
- public Collection<IgniteInternalFuture<T>> futures() {
- synchronized (futs) {
- return new ArrayList<>(futs);
- }
+ public synchronized Collection<IgniteInternalFuture<T>> futures() {
+ return futs == null ? Collections.<IgniteInternalFuture<T>>emptyList() : new ArrayList<>(futs);
}
/**
@@ -178,15 +177,16 @@ public class GridCompoundFuture<T, R> extends GridFutureAdapter<R> implements Ig
* @return {@code True} if there are pending futures.
*/
@SuppressWarnings("ForLoopReplaceableByForEach")
- public boolean hasPending() {
- synchronized (futs) {
- // Avoid iterator creation and collection copy.
- for (int i = 0; i < futs.size(); i++) {
- IgniteInternalFuture<T> fut = futs.get(i);
-
- if (!fut.isDone())
- return true;
- }
+ public synchronized boolean hasPending() {
+ if (futs == null)
+ return false;
+
+ // Avoid iterator creation and collection copy.
+ for (int i = 0; i < futs.size(); i++) {
+ IgniteInternalFuture<T> fut = futs.get(i);
+
+ if (!fut.isDone())
+ return true;
}
return false;
@@ -200,7 +200,10 @@ public class GridCompoundFuture<T, R> extends GridFutureAdapter<R> implements Ig
public void add(IgniteInternalFuture<T> fut) {
assert fut != null;
- synchronized (futs) {
+ synchronized (this) {
+ if (futs == null)
+ futs = new ArrayList<>();
+
futs.add(fut);
}
@@ -258,10 +261,8 @@ public class GridCompoundFuture<T, R> extends GridFutureAdapter<R> implements Ig
/**
* @return Futures size.
*/
- private int futuresSize() {
- synchronized (futs) {
- return futs.size();
- }
+ protected synchronized int futuresSize() {
+ return futs == null ? 0 : futs.size();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/f85d2e68/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
index c44e1ac..e4a5063 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridNioServer.java
@@ -453,10 +453,8 @@ public class GridNioServer<T> {
// Change from 0 to 1 means that worker thread should be waken up.
clientWorkers.get(ses.selectorIndex()).offer(fut);
- IgniteBiInClosure<GridNioSession, Integer> lsnr0 = msgQueueLsnr;
-
- if (lsnr0 != null)
- lsnr0.apply(ses, msgCnt);
+ if (msgQueueLsnr != null)
+ msgQueueLsnr.apply(ses, msgCnt);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/f85d2e68/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
index deb7d2b..1241f99 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/nio/GridSelectorNioSessionImpl.java
@@ -309,4 +309,4 @@ class GridSelectorNioSessionImpl extends GridNioSessionImpl {
@Override public String toString() {
return S.toString(GridSelectorNioSessionImpl.class, this, super.toString());
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f85d2e68/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java
index 0a7845b..662cee3 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/IgniteTxPreloadAbstractTest.java
@@ -231,4 +231,4 @@ public abstract class IgniteTxPreloadAbstractTest extends GridCacheAbstractSelfT
return cfg;
}
-}
\ No newline at end of file
+}
[05/14] ignite git commit: Minor + merge from master
Posted by vo...@apache.org.
Minor + merge from master
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/dcdf2da8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/dcdf2da8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/dcdf2da8
Branch: refs/heads/ignite-2329-1
Commit: dcdf2da8323c2ebb9a4ad4a91823441e2bf58a14
Parents: a5aa7e6
Author: Yakov Zhdanov <yz...@gridgain.com>
Authored: Fri Jan 29 10:04:03 2016 +0300
Committer: Yakov Zhdanov <yz...@gridgain.com>
Committed: Fri Jan 29 10:04:03 2016 +0300
----------------------------------------------------------------------
.../processors/cacheobject/IgniteCacheObjectProcessorImpl.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/dcdf2da8/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
index 5b764b6..827891b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cacheobject/IgniteCacheObjectProcessorImpl.java
@@ -305,7 +305,7 @@ public class IgniteCacheObjectProcessorImpl extends GridProcessorAdapter impleme
ClassLoader ldr = ctx.p2pEnabled() ?
IgniteUtils.detectClassLoader(IgniteUtils.detectClass(this.val)) : U.gridClassLoader();
- Object val = ctx.processor().unmarshal(ctx, valBytes, ldr);
+ Object val = ctx.processor().unmarshal(ctx, valBytes, ldr);
return new KeyCacheObjectImpl(val, valBytes);
}