You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2017/06/20 06:00:03 UTC
[01/50] ignite git commit: Merge branch 'ignite-2.1.1' of
https://github.com/gridgain/apache-ignite into ignite-2.1.1
Repository: ignite
Updated Branches:
refs/heads/ignite-2.1.2-exchange [created] e6bcaf5dd
Merge branch 'ignite-2.1.1' of https://github.com/gridgain/apache-ignite into ignite-2.1.1
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/be0957a8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/be0957a8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/be0957a8
Branch: refs/heads/ignite-2.1.2-exchange
Commit: be0957a865f5c83b88358136a8a442674c96dee3
Parents: 96b1f61 6483ef6
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Fri Jun 16 16:24:53 2017 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Fri Jun 16 16:24:53 2017 +0300
----------------------------------------------------------------------
.../local/atomic/GridLocalAtomicCache.java | 13 ++----
.../datastreamer/DataStreamerImpl.java | 11 +++--
.../DistributedCollectionMetadata.java | 17 +++++++
.../cache/GridCacheAbstractMetricsSelfTest.java | 2 +-
...LocalAtomicMetricsNoReadThroughSelfTest.java | 48 ++++++++++++++++++++
.../IgniteCacheMetricsSelfTestSuite.java | 4 +-
6 files changed, 81 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
[43/50] ignite git commit: Call GridDhtPartitionTopology.onExchange
done for each group, not cache.
Posted by sb...@apache.org.
Call GridDhtPartitionTopology.onExchange done for each group, not cache.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fefffc04
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fefffc04
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fefffc04
Branch: refs/heads/ignite-2.1.2-exchange
Commit: fefffc04b0665c6d8cf65a88ec24ef7945b7bce6
Parents: f6f5e49
Author: sboikov <sb...@gridgain.com>
Authored: Mon Jun 19 17:54:42 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Jun 19 17:54:42 2017 +0300
----------------------------------------------------------------------
.../cache/distributed/dht/GridClientPartitionTopology.java | 2 +-
.../cache/distributed/dht/GridDhtPartitionTopologyImpl.java | 2 ++
.../dht/preloader/GridDhtPartitionsExchangeFuture.java | 8 ++------
3 files changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fefffc04/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 20b6296..a17df36 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
@@ -805,7 +805,7 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
/** {@inheritDoc} */
@Override public void onExchangeDone(AffinityAssignment assignment) {
- // no-op
+ // No-op.
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/fefffc04/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 2ea5336..1620633 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
@@ -71,7 +71,9 @@ import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDh
*/
@GridToStringExclude
public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
+ /** */
private static final GridDhtPartitionState[] MOVING_STATES = new GridDhtPartitionState[] {MOVING};
+
/** Flag to control amount of output for full map. */
private static final boolean FULL_MAP_DEBUG = false;
http://git-wip-us.apache.org/repos/asf/ignite/blob/fefffc04/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 939fa80..5f416da 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -1299,12 +1299,8 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
cctx.database().releaseHistoryForExchange();
if (err == null && realExchange) {
- for (GridCacheContext cacheCtx : cctx.cacheContexts()) {
- if (cacheCtx.isLocal())
- continue;
-
- cacheCtx.topology().onExchangeDone(cacheCtx.affinity().assignment(topologyVersion()));
- }
+ for (CacheGroupContext grp : cctx.cache().cacheGroups())
+ grp.topology().onExchangeDone(grp.affinity().cachedAffinity(topologyVersion()));
}
if (super.onDone(res, err) && realExchange) {
[14/50] ignite git commit: GG-12317 Restore snapshot functionality
after split GridCacheDatabaseSharedManager and GridCacheSnapshotManager
GG-12318 Remove possibility to edit snapshot by deletion certain cache from
snasphot
Posted by sb...@apache.org.
GG-12317 Restore snapshot functionality after split GridCacheDatabaseSharedManager and GridCacheSnapshotManager
GG-12318 Remove possibility to edit snapshot by deletion certain cache from snasphot
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/848af360
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/848af360
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/848af360
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 848af3609f9aad462d5e939e708d8284eb5d00e0
Parents: 6483ef6
Author: EdShangGG <es...@gridgain.com>
Authored: Fri Jun 16 21:07:15 2017 +0300
Committer: EdShangGG <es...@gridgain.com>
Committed: Fri Jun 16 21:07:15 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheProcessor.java | 25 ++++++++++----------
.../GridDhtPartitionsExchangeFuture.java | 8 ++++++-
.../GridCacheDatabaseSharedManager.java | 17 +++++--------
.../persistence/tree/util/PageHandler.java | 2 +-
4 files changed, 27 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/848af360/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 7130e0f..0016291 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -1944,15 +1944,15 @@ public class GridCacheProcessor extends GridProcessorAdapter {
// Break the proxy before exchange future is done.
IgniteCacheProxy<?, ?> proxy = jCacheProxies.get(cacheName);
- if (proxy != null) {
- if (stop){
- if (restart)
- proxy.restart();
+ if (proxy != null) {
+ if (stop) {
+ if (restart)
+ proxy.restart();
- proxy.gate().stopped();
- }
- else
- proxy.closeProxy();
+ proxy.gate().stopped();
+ }
+ else
+ proxy.closeProxy();
}
}
@@ -2009,11 +2009,12 @@ public class GridCacheProcessor extends GridProcessorAdapter {
void initCacheProxies(
AffinityTopologyVersion startTopVer, @Nullable
Throwable err) {
- for (GridCacheAdapter<?, ?> cache : caches.values()) {
- GridCacheContext<?, ?> cacheCtx = cache.context();
+ for (GridCacheAdapter<?, ?> cache : caches.values()) {
+ GridCacheContext<?, ?> cacheCtx = cache.context();
- if (cacheCtx.startTopologyVersion().equals(startTopVer) && !jCacheProxies.containsKey(cacheCtx.name())) {
- jCacheProxies.putIfAbsent(cacheCtx.name(), new IgniteCacheProxy(cache.context(), cache, null, false));
+ if (cacheCtx.startTopologyVersion().equals(startTopVer) ) {
+ if (!jCacheProxies.containsKey(cacheCtx.name()))
+ jCacheProxies.putIfAbsent(cacheCtx.name(), new IgniteCacheProxy(cache.context(), cache, null, false));
if (cacheCtx.preloader() != null)
cacheCtx.preloader().onInitialExchangeComplete(err);
http://git-wip-us.apache.org/repos/asf/ignite/blob/848af360/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index ea5ada7..fe7527a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -57,6 +57,7 @@ import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.affinity.GridAffinityAssignmentCache;
import org.apache.ignite.internal.processors.cache.CacheAffinityChangeMessage;
import org.apache.ignite.internal.processors.cache.CacheGroupContext;
+import org.apache.ignite.internal.processors.cache.CacheGroupDescriptor;
import org.apache.ignite.internal.processors.cache.CachePartitionExchangeWorkerTask;
import org.apache.ignite.internal.processors.cache.ClusterState;
import org.apache.ignite.internal.processors.cache.DynamicCacheChangeBatch;
@@ -893,10 +894,14 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
/**
*/
- private void startLocalSnasphotOperation() {StartSnapshotOperationAckDiscoveryMessage snapOpMsg= getSnapshotOperationMessage();
+ private void startLocalSnasphotOperation() {
+ StartSnapshotOperationAckDiscoveryMessage snapOpMsg= getSnapshotOperationMessage();
+
if (snapOpMsg != null) {
SnapshotOperation op = snapOpMsg.snapshotOperation();
+ assert snapOpMsg.needExchange();
+
try {
IgniteInternalFuture fut = cctx.snapshot()
.startLocalSnapshotOperation(snapOpMsg.initiatorNodeId(), snapOpMsg.snapshotOperation());
@@ -1334,6 +1339,7 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
if (customMsg instanceof StartSnapshotOperationAckDiscoveryMessage)
return (StartSnapshotOperationAckDiscoveryMessage)customMsg;
}
+
return null;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/848af360/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index 4ce61e2..77da248 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -138,6 +138,7 @@ import org.apache.ignite.internal.util.worker.GridWorker;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.mxbean.PersistenceMetricsMXBean;
import org.apache.ignite.thread.IgniteThread;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import static org.apache.ignite.IgniteSystemProperties.IGNITE_PDS_SKIP_CRC;
@@ -1965,12 +1966,6 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
Checkpoint chp = markCheckpointBegin(tracker);
- if (chp.cpPages == null){
- markCheckpointEnd(chp);
-
- return;
- }
-
boolean interrupted = true;
try {
@@ -2019,8 +2014,6 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
return;
}
- snapshotMgr.afterCheckpointPageWritten();
-
tracker.onFsyncStart();
if (!skipSync) {
@@ -2040,6 +2033,8 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
tracker.onFsyncStart();
}
+ snapshotMgr.afterCheckpointPageWritten();
+
// Must mark successful checkpoint only if there are no exceptions or interrupts.
interrupted = false;
}
@@ -2267,7 +2262,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
curr.reason));
}
- return new Checkpoint(null, null, curr);
+ return new Checkpoint(null, new GridMultiCollectionWrapper<>(new Collection[0]), curr);
}
}
@@ -2473,7 +2468,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
*/
private Checkpoint(
CheckpointEntry cpEntry,
- GridMultiCollectionWrapper<FullPageId> cpPages,
+ @NotNull GridMultiCollectionWrapper<FullPageId> cpPages,
CheckpointProgress progress
) {
assert cpEntry == null || cpEntry.initGuard != 0;
@@ -2482,7 +2477,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
this.cpPages = cpPages;
this.progress = progress;
- pagesSize = cpPages == null ? 0 : cpPages.size();
+ pagesSize = cpPages.size();
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/848af360/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/util/PageHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/util/PageHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/util/PageHandler.java
index 648ddf7..b42258e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/util/PageHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/util/PageHandler.java
@@ -244,7 +244,7 @@ public abstract class PageHandler<X, R> {
public static <X, R> R writePage(
PageMemory pageMem,
int cacheId,
- long pageId,
+ final long pageId,
PageLockListener lsnr,
PageHandler<X, R> h,
PageIO init,
[33/50] ignite git commit: ignite-5519 : Muted test with link to
another ticket - ignite-5529.
Posted by sb...@apache.org.
ignite-5519 : Muted test with link to another ticket - ignite-5529.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/993c021f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/993c021f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/993c021f
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 993c021f1a926ee54bb03ffba2a22cde67ea9a5f
Parents: 6a8b991
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Sat Jun 17 17:33:00 2017 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Sat Jun 17 17:33:00 2017 +0300
----------------------------------------------------------------------
.../distributed/near/GridCachePartitionedNodeRestartTest.java | 5 +++++
1 file changed, 5 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/993c021f/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
index d7a0cdd..1d325a5 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
@@ -56,6 +56,11 @@ public class GridCachePartitionedNodeRestartTest extends GridCacheAbstractNodeRe
return cc;
}
+ @Override protected void beforeTest() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-5529");
+ }
+
+
/** {@inheritDoc} */
@Override public void testRestart() throws Exception {
super.testRestart();
[20/50] ignite git commit: JavaDoc fix.
Posted by sb...@apache.org.
JavaDoc fix.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/636ddb08
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/636ddb08
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/636ddb08
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 636ddb088154b8019d1e748ca1e43a2e627b2b52
Parents: ace3976
Author: devozerov <pp...@gmail.com>
Authored: Fri Jun 16 23:40:25 2017 +0300
Committer: devozerov <pp...@gmail.com>
Committed: Fri Jun 16 23:40:25 2017 +0300
----------------------------------------------------------------------
.../apache/ignite/internal/visor/cache/VisorMemoryMetrics.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/636ddb08/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java
index 14eaba6..8193db6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java
@@ -102,7 +102,9 @@ public class VisorMemoryMetrics extends VisorDataTransferObject {
return allocationRate;
}
- /** {@inheritDoc} */
+ /**
+ * @return Eviction rate.
+ */
public float getEvictionRate() {
return evictionRate;
}
[18/50] ignite git commit: Fixed serialization of conflict version.
Posted by sb...@apache.org.
Fixed serialization of conflict version.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ba809d22
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ba809d22
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ba809d22
Branch: refs/heads/ignite-2.1.2-exchange
Commit: ba809d2276b1cf2ffab4260dfffaf709a7faa37a
Parents: 8c04df6
Author: Konstantin Dudkov <kd...@ya.ru>
Authored: Fri Jun 16 22:27:22 2017 +0300
Committer: devozerov <pp...@gmail.com>
Committed: Fri Jun 16 22:27:22 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheContext.java | 3 +-
.../processors/cache/GridCacheProcessor.java | 7 ++
.../cache/IgniteCacheOffheapManagerImpl.java | 7 +-
.../persistence/freelist/FreeListImpl.java | 11 ++-
.../persistence/tree/io/CacheVersionIO.java | 99 +++++++++++++++++---
.../cache/transactions/IgniteTxAdapter.java | 31 +++---
.../version/CacheVersionConflictResolver.java | 2 +
.../GridCacheLazyPlainVersionedEntry.java | 5 +-
.../version/GridCachePlainVersionedEntry.java | 3 +-
.../version/GridCacheRawVersionedEntry.java | 5 +-
.../GridCacheVersionConflictContext.java | 16 +++-
.../cache/version/GridCacheVersionedEntry.java | 4 +-
12 files changed, 151 insertions(+), 42 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ba809d22/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
index 2dc575a..33db2ff 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheContext.java
@@ -1608,7 +1608,8 @@ public class GridCacheContext<K, V> implements Externalizable {
GridCacheVersionedEntryEx<K, V> newEntry, boolean atomicVerComp) throws IgniteCheckedException {
assert conflictRslvr != null : "Should not reach this place.";
- GridCacheVersionConflictContext<K, V> ctx = conflictRslvr.resolve(oldEntry, newEntry, atomicVerComp);
+ GridCacheVersionConflictContext<K, V> ctx = conflictRslvr.resolve(cacheObjCtx, oldEntry, newEntry,
+ atomicVerComp);
if (ctx.isManualResolve())
drMgr.onReceiveCacheConflictResolved(ctx.isUseNew(), ctx.isUseOld(), ctx.isMerge());
http://git-wip-us.apache.org/repos/asf/ignite/blob/ba809d22/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 2729829..6750582 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -3191,6 +3191,13 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (ctx.discovery().localNode().isClient()) {
IgniteCacheProxy<K, V> proxy = (IgniteCacheProxy<K, V>)jCacheProxies.get(name);
+ if (proxy == null) {
+ GridCacheAdapter<?, ?> cacheAdapter = caches.get(name);
+
+ if (cacheAdapter != null)
+ proxy = new IgniteCacheProxy(cacheAdapter.context(), cacheAdapter, null, false);
+ }
+
assert proxy != null;
return proxy.internalProxy();
http://git-wip-us.apache.org/repos/asf/ignite/blob/ba809d22/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
index 74863f8..e90a6c4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManagerImpl.java
@@ -42,6 +42,7 @@ import org.apache.ignite.internal.processors.cache.persistence.CacheSearchRow;
import org.apache.ignite.internal.processors.cache.persistence.RootPage;
import org.apache.ignite.internal.processors.cache.persistence.RowStore;
import org.apache.ignite.internal.processors.cache.persistence.freelist.FreeList;
+import org.apache.ignite.internal.processors.cache.persistence.freelist.FreeListImpl;
import org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.BPlusIO;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.BPlusInnerIO;
@@ -1081,14 +1082,12 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager
if (oldRow.expireTime() != dataRow.expireTime())
return false;
- CacheObjectContext coCtx = cctx.cacheObjectContext();
-
- int oldLen = oldRow.key().valueBytesLength(coCtx) + oldRow.value().valueBytesLength(coCtx);
+ int oldLen = FreeListImpl.getRowSize(oldRow);
if (oldLen > updateValSizeThreshold)
return false;
- int newLen = dataRow.key().valueBytesLength(coCtx) + dataRow.value().valueBytesLength(coCtx);
+ int newLen = FreeListImpl.getRowSize(dataRow);
return oldLen == newLen;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ba809d22/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/FreeListImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/FreeListImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/FreeListImpl.java
index 4e8b8d8..139c6f3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/FreeListImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/FreeListImpl.java
@@ -28,6 +28,8 @@ import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageInsertFragmen
import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageInsertRecord;
import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageRemoveRecord;
import org.apache.ignite.internal.pagemem.wal.record.delta.DataPageUpdateRecord;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.cache.persistence.MemoryMetricsImpl;
import org.apache.ignite.internal.processors.cache.persistence.MemoryPolicy;
@@ -580,9 +582,12 @@ public class FreeListImpl extends PagesList implements FreeList, ReuseList {
* @return Entry size on page.
* @throws IgniteCheckedException If failed.
*/
- private static int getRowSize(CacheDataRow row) throws IgniteCheckedException {
- int keyLen = row.key().valueBytesLength(null);
- int valLen = row.value().valueBytesLength(null);
+ public static int getRowSize(CacheDataRow row) throws IgniteCheckedException {
+ KeyCacheObject key = row.key();
+ CacheObject val = row.value();
+
+ int keyLen = key.valueBytesLength(null);
+ int valLen = val.valueBytesLength(null);
return keyLen + valLen + CacheVersionIO.size(row.version(), false) + 8 + (row.cacheId() == 0 ? 0 : 4);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ba809d22/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/CacheVersionIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/CacheVersionIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/CacheVersionIO.java
index fef5612..d9fdf0e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/CacheVersionIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/CacheVersionIO.java
@@ -21,6 +21,7 @@ import java.nio.ByteBuffer;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.pagemem.PageUtils;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
+import org.apache.ignite.internal.processors.cache.version.GridCacheVersionEx;
/**
* Utility to read and write {@link GridCacheVersion} instances.
@@ -30,7 +31,7 @@ public class CacheVersionIO {
private static final byte NULL_PROTO_VER = 0;
/** */
- private static final byte MAX_PROTO_VER = 1;
+ private static final byte MAX_PROTO_VER = 2;
/** */
private static final int NULL_SIZE = 1;
@@ -38,6 +39,9 @@ public class CacheVersionIO {
/** Serialized size in bytes. */
private static final int SIZE_V1 = 17;
+ /** Serialized size in bytes. */
+ private static final int SIZE_V2 = 33;
+
/**
* @param ver Version.
* @param allowNull Is {@code null} version allowed.
@@ -51,7 +55,7 @@ public class CacheVersionIO {
throw new IllegalStateException("Cache version is null");
}
- return SIZE_V1;
+ return ver instanceof GridCacheVersionEx ? SIZE_V2 : SIZE_V1;
}
/**
@@ -66,6 +70,18 @@ public class CacheVersionIO {
else
throw new IllegalStateException("Cache version is null");
}
+ else if (ver instanceof GridCacheVersionEx) {
+ byte protoVer = 2; // Version of serialization protocol.
+
+ buf.put(protoVer);
+ buf.putInt(ver.topologyVersion());
+ buf.putInt(ver.nodeOrderAndDrIdRaw());
+ buf.putLong(ver.order());
+
+ buf.putInt(ver.conflictVersion().topologyVersion());
+ buf.putInt(ver.conflictVersion().nodeOrderAndDrIdRaw());
+ buf.putLong(ver.conflictVersion().order());
+ }
else {
byte protoVer = 1; // Version of serialization protocol.
@@ -88,6 +104,18 @@ public class CacheVersionIO {
else
throw new IllegalStateException("Cache version is null");
}
+ else if (ver instanceof GridCacheVersionEx) {
+ byte protoVer = 2; // Version of serialization protocol.
+
+ PageUtils.putByte(addr, 0, protoVer);
+ PageUtils.putInt(addr, 1, ver.topologyVersion());
+ PageUtils.putInt(addr, 5, ver.nodeOrderAndDrIdRaw());
+ PageUtils.putLong(addr, 9, ver.order());
+
+ PageUtils.putInt(addr, 17, ver.conflictVersion().topologyVersion());
+ PageUtils.putInt(addr, 21, ver.conflictVersion().nodeOrderAndDrIdRaw());
+ PageUtils.putLong(addr, 25, ver.conflictVersion().order());
+ }
else {
byte protoVer = 1; // Version of serialization protocol.
@@ -134,6 +162,9 @@ public class CacheVersionIO {
case 1:
return SIZE_V1;
+ case 2:
+ return SIZE_V2;
+
default:
throw new IllegalStateException();
}
@@ -151,14 +182,34 @@ public class CacheVersionIO {
public static GridCacheVersion read(ByteBuffer buf, boolean allowNull) throws IgniteCheckedException {
byte protoVer = checkProtocolVersion(buf.get(), allowNull);
- if (protoVer == NULL_PROTO_VER)
- return null;
+ switch (protoVer) {
+ case NULL_PROTO_VER:
+ return null;
+
+ case 1: {
+ int topVer = buf.getInt();
+ int nodeOrderDrId = buf.getInt();
+ long order = buf.getLong();
+
+ return new GridCacheVersion(topVer, nodeOrderDrId, order);
+ }
+
+ case 2: {
+ int topVer = buf.getInt();
+ int nodeOrderDrId = buf.getInt();
+ long order = buf.getLong();
+
+ int conflictTop = buf.getInt();
+ int conflictNodeOrderDrId = buf.getInt();
+ long conflictOrder = buf.getLong();
- int topVer = buf.getInt();
- int nodeOrderDrId = buf.getInt();
- long order = buf.getLong();
+ return new GridCacheVersionEx(topVer, nodeOrderDrId, order,
+ new GridCacheVersion(conflictTop, conflictNodeOrderDrId, conflictOrder));
+ }
- return new GridCacheVersion(topVer, nodeOrderDrId, order);
+ default:
+ throw new IllegalStateException();
+ }
}
/**
@@ -172,13 +223,33 @@ public class CacheVersionIO {
public static GridCacheVersion read(long pageAddr, boolean allowNull) throws IgniteCheckedException {
byte protoVer = checkProtocolVersion(PageUtils.getByte(pageAddr, 0), allowNull);
- if (protoVer == NULL_PROTO_VER)
- return null;
+ switch (protoVer) {
+ case NULL_PROTO_VER:
+ return null;
+
+ case 1: {
+ int topVer = PageUtils.getInt(pageAddr, 1);
+ int nodeOrderDrId = PageUtils.getInt(pageAddr, 5);
+ long order = PageUtils.getLong(pageAddr, 9);
+
+ return new GridCacheVersion(topVer, nodeOrderDrId, order);
+ }
+
+ case 2: {
+ int topVer = PageUtils.getInt(pageAddr, 1);
+ int nodeOrderDrId = PageUtils.getInt(pageAddr, 5);
+ long order = PageUtils.getLong(pageAddr, 9);
- int topVer = PageUtils.getInt(pageAddr, 1);
- int nodeOrderDrId = PageUtils.getInt(pageAddr, 5);
- long order = PageUtils.getLong(pageAddr, 9);
+ int conflictTop = PageUtils.getInt(pageAddr, 17);
+ int conflictNodeOrderDrId = PageUtils.getInt(pageAddr, 21);
+ long conflictOrder = PageUtils.getLong(pageAddr, 25);
- return new GridCacheVersion(topVer, nodeOrderDrId, order);
+ return new GridCacheVersionEx(topVer, nodeOrderDrId, order,
+ new GridCacheVersion(conflictTop, conflictNodeOrderDrId, conflictOrder));
+ }
+
+ default:
+ throw new IllegalStateException();
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ba809d22/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
index 96af425..ee8afb0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java
@@ -415,24 +415,29 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter implement
*/
@SuppressWarnings({"CatchGenericClass"})
protected void uncommit() {
- for (IgniteTxEntry e : writeMap().values()) {
- try {
- GridCacheEntryEx Entry = e.cached();
+ try {
+ for (IgniteTxEntry e : writeMap().values()) {
+ try {
+ GridCacheEntryEx Entry = e.cached();
- if (e.op() != NOOP)
- Entry.invalidate(null, xidVer);
- }
- catch (Throwable t) {
- U.error(log, "Failed to invalidate transaction entries while reverting a commit.", t);
+ if (e.op() != NOOP)
+ Entry.invalidate(null, xidVer);
+ }
+ catch (Throwable t) {
+ U.error(log, "Failed to invalidate transaction entries while reverting a commit.", t);
- if (t instanceof Error)
- throw (Error)t;
+ if (t instanceof Error)
+ throw (Error)t;
- break;
+ break;
+ }
}
- }
- cctx.tm().uncommitTx(this);
+ cctx.tm().uncommitTx(this);
+ }
+ catch (Exception ex) {
+ U.error(log, "Failed to do uncommit.", ex);
+ }
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/ba809d22/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionConflictResolver.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionConflictResolver.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionConflictResolver.java
index 0fb3ebf..0559937 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionConflictResolver.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/CacheVersionConflictResolver.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.cache.version;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.processors.cache.CacheObjectValueContext;
/**
* Cache version conflict resolver.
@@ -33,6 +34,7 @@ public interface CacheVersionConflictResolver {
* @throws IgniteCheckedException If failed.
*/
public <K, V> GridCacheVersionConflictContext<K, V> resolve(
+ CacheObjectValueContext ctx,
GridCacheVersionedEntryEx<K, V> oldEntry,
GridCacheVersionedEntryEx<K, V> newEntry,
boolean atomicVerComparator
http://git-wip-us.apache.org/repos/asf/ignite/blob/ba809d22/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheLazyPlainVersionedEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheLazyPlainVersionedEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheLazyPlainVersionedEntry.java
index dae50bf..0fa2f7e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheLazyPlainVersionedEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheLazyPlainVersionedEntry.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.cache.version;
import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.CacheObjectValueContext;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -87,7 +88,7 @@ public class GridCacheLazyPlainVersionedEntry<K, V> extends GridCachePlainVersio
}
/** {@inheritDoc} */
- @Override public V value() {
+ @Override public V value(CacheObjectValueContext ctx) {
return value(keepBinary);
}
@@ -108,6 +109,6 @@ public class GridCacheLazyPlainVersionedEntry<K, V> extends GridCachePlainVersio
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(GridCacheLazyPlainVersionedEntry.class, this,
- "super", super.toString(), "key", key(), "val", value());
+ "super", super.toString(), "key", key(), "val", value(keepBinary));
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ba809d22/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java
index f4d7e08..d8034a8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCachePlainVersionedEntry.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.processors.cache.version;
+import org.apache.ignite.internal.processors.cache.CacheObjectValueContext;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.jetbrains.annotations.Nullable;
@@ -80,7 +81,7 @@ public class GridCachePlainVersionedEntry<K, V> implements GridCacheVersionedEnt
}
/** {@inheritDoc} */
- @Override public V value() {
+ @Override public V value(CacheObjectValueContext ctx) {
return val;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ba809d22/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
index 1146496..586a043 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheRawVersionedEntry.java
@@ -26,6 +26,7 @@ import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.GridDirectTransient;
import org.apache.ignite.internal.processors.cache.CacheObject;
import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+import org.apache.ignite.internal.processors.cache.CacheObjectValueContext;
import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.datastreamer.DataStreamerEntry;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -133,8 +134,8 @@ public class GridCacheRawVersionedEntry<K, V> extends DataStreamerEntry implemen
}
/** {@inheritDoc} */
- @Override public V value() {
- return val != null ? val.<V>value(null, false) : null;
+ @Override public V value(CacheObjectValueContext ctx) {
+ return val != null ? val.<V>value(ctx, false) : null;
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/ba809d22/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictContext.java
index fa40206..c666b1f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionConflictContext.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.processors.cache.version;
+import org.apache.ignite.internal.processors.cache.CacheObjectValueContext;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
import org.apache.ignite.internal.util.typedef.internal.CU;
@@ -35,6 +36,9 @@ public class GridCacheVersionConflictContext<K, V> {
@GridToStringInclude
private final GridCacheVersionedEntry<K, V> newEntry;
+ /** Object context. */
+ private final CacheObjectValueContext ctx;
+
/** Current state. */
private State state;
@@ -54,13 +58,14 @@ public class GridCacheVersionConflictContext<K, V> {
* @param oldEntry Old entry.
* @param newEntry New entry.
*/
- public GridCacheVersionConflictContext(GridCacheVersionedEntry<K, V> oldEntry,
+ public GridCacheVersionConflictContext(CacheObjectValueContext ctx, GridCacheVersionedEntry<K, V> oldEntry,
GridCacheVersionedEntry<K, V> newEntry) {
assert oldEntry != null && newEntry != null;
assert oldEntry.ttl() >= 0 && newEntry.ttl() >= 0;
this.oldEntry = oldEntry;
this.newEntry = newEntry;
+ this.ctx = ctx;
// Set initial state.
useNew();
@@ -85,6 +90,15 @@ public class GridCacheVersionConflictContext<K, V> {
}
/**
+ * Gets cache object context.
+ *
+ * @return Cache object context.
+ */
+ public CacheObjectValueContext valueContext() {
+ return ctx;
+ }
+
+ /**
* Force cache to ignore new entry and leave old (existing) entry unchanged.
*/
public void useOld() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/ba809d22/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionedEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionedEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionedEntry.java
index e685d79..5016393 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionedEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/version/GridCacheVersionedEntry.java
@@ -17,6 +17,7 @@
package org.apache.ignite.internal.processors.cache.version;
+import org.apache.ignite.internal.processors.cache.CacheObjectValueContext;
import org.jetbrains.annotations.Nullable;
/**
@@ -33,9 +34,10 @@ public interface GridCacheVersionedEntry<K, V> {
/**
* Gets entry's value.
*
+ * @param ctx Object value context.
* @return Entry's value.
*/
- @Nullable public V value();
+ @Nullable public V value(CacheObjectValueContext ctx);
/**
* Gets entry's TTL.
[40/50] ignite git commit: IGNITE-5531: Fixed hang in Hibernate
example (caused by not closed SessionFactory).
Posted by sb...@apache.org.
IGNITE-5531: Fixed hang in Hibernate example (caused by not closed SessionFactory).
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/59ea90dd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/59ea90dd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/59ea90dd
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 59ea90dd1f231cf3722fa2b9d4df6e0891b7a40c
Parents: 2cc0b73
Author: devozerov <pp...@gmail.com>
Authored: Sun Jun 18 10:04:47 2017 +0300
Committer: devozerov <pp...@gmail.com>
Committed: Sun Jun 18 10:04:47 2017 +0300
----------------------------------------------------------------------
.../hibernate/HibernateL2CacheExample.java | 94 ++++++++++----------
1 file changed, 47 insertions(+), 47 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/59ea90dd/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
index 28aa6ca..551e5d0 100644
--- a/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
+++ b/examples/src/main/java-lgpl/org/apache/ignite/examples/datagrid/hibernate/HibernateL2CacheExample.java
@@ -125,71 +125,71 @@ public class HibernateL2CacheExample {
) {
URL hibernateCfg = ExamplesUtils.url(HIBERNATE_CFG);
- SessionFactory sesFactory = createHibernateSessionFactory(hibernateCfg);
+ try (SessionFactory sesFactory = createHibernateSessionFactory(hibernateCfg)) {
+ System.out.println();
+ System.out.println(">>> Creating objects.");
- System.out.println();
- System.out.println(">>> Creating objects.");
+ final long userId;
- final long userId;
+ Session ses = sesFactory.openSession();
- Session ses = sesFactory.openSession();
-
- try {
- Transaction tx = ses.beginTransaction();
+ try {
+ Transaction tx = ses.beginTransaction();
- User user = new User("jedi", "Luke", "Skywalker");
+ User user = new User("jedi", "Luke", "Skywalker");
- user.getPosts().add(new Post(user, "Let the Force be with you."));
+ user.getPosts().add(new Post(user, "Let the Force be with you."));
- ses.save(user);
+ ses.save(user);
- tx.commit();
+ tx.commit();
- // Create a user object, store it in DB, and save the database-generated
- // object ID. You may try adding more objects in a similar way.
- userId = user.getId();
- }
- finally {
- ses.close();
- }
+ // Create a user object, store it in DB, and save the database-generated
+ // object ID. You may try adding more objects in a similar way.
+ userId = user.getId();
+ }
+ finally {
+ ses.close();
+ }
- // Output L2 cache and Ignite cache stats. You may notice that
- // at this point the object is not yet stored in L2 cache, because
- // the read was not yet performed.
- printStats(sesFactory);
+ // Output L2 cache and Ignite cache stats. You may notice that
+ // at this point the object is not yet stored in L2 cache, because
+ // the read was not yet performed.
+ printStats(sesFactory);
- System.out.println();
- System.out.println(">>> Querying object by ID.");
+ System.out.println();
+ System.out.println(">>> Querying object by ID.");
- // Query user by ID several times. First time we get an L2 cache
- // miss, and the data is queried from DB, but it is then stored
- // in cache and successive queries hit the cache and return
- // immediately, no SQL query is made.
- for (int i = 0; i < 3; i++) {
- ses = sesFactory.openSession();
+ // Query user by ID several times. First time we get an L2 cache
+ // miss, and the data is queried from DB, but it is then stored
+ // in cache and successive queries hit the cache and return
+ // immediately, no SQL query is made.
+ for (int i = 0; i < 3; i++) {
+ ses = sesFactory.openSession();
- try {
- Transaction tx = ses.beginTransaction();
+ try {
+ Transaction tx = ses.beginTransaction();
- User user = (User)ses.get(User.class, userId);
+ User user = (User)ses.get(User.class, userId);
- System.out.println("User: " + user);
+ System.out.println("User: " + user);
- for (Post post : user.getPosts())
- System.out.println("\tPost: " + post);
+ for (Post post : user.getPosts())
+ System.out.println("\tPost: " + post);
- tx.commit();
+ tx.commit();
+ }
+ finally {
+ ses.close();
+ }
}
- finally {
- ses.close();
- }
- }
- // Output the stats. We should see 1 miss and 2 hits for
- // User and Collection object (stored separately in L2 cache).
- // The Post is loaded with the collection, so it won't imply
- // a miss.
- printStats(sesFactory);
+ // Output the stats. We should see 1 miss and 2 hits for
+ // User and Collection object (stored separately in L2 cache).
+ // The Post is loaded with the collection, so it won't imply
+ // a miss.
+ printStats(sesFactory);
+ }
}
finally {
// Distributed cache could be removed from cluster only by #destroyCache() call.
[03/50] ignite git commit: IGNITE-5271 Use same blank cluster for
basic and advanced configuration.
Posted by sb...@apache.org.
IGNITE-5271 Use same blank cluster for basic and advanced configuration.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d52aa800
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d52aa800
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d52aa800
Branch: refs/heads/ignite-2.1.2-exchange
Commit: d52aa800c95f1b9fa6c2fcc2e349fc88a259102c
Parents: f6df8fb
Author: Ilya Borisov <ib...@gridgain.com>
Authored: Fri Jun 16 20:40:34 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Fri Jun 16 20:40:34 2017 +0700
----------------------------------------------------------------------
modules/web-console/frontend/.eslintrc | 2 +-
.../page-configure-basic/controller.js | 50 +++---
.../page-configure-basic/controller.spec.js | 159 ++++++++++++++++---
.../components/page-configure-basic/reducer.js | 20 +--
.../page-configure-basic/reducer.spec.js | 2 +-
.../components/page-configure-basic/service.js | 6 +-
.../page-configure-basic/service.spec.js | 24 ++-
.../page-configure-basic/template.pug | 2 +-
.../frontend/app/services/Clusters.js | 52 ++++++
.../frontend/app/services/Clusters.spec.js | 55 +++++++
.../frontend/controllers/clusters-controller.js | 45 +-----
11 files changed, 306 insertions(+), 111 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d52aa800/modules/web-console/frontend/.eslintrc
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/.eslintrc b/modules/web-console/frontend/.eslintrc
index 9680678..6778b86 100644
--- a/modules/web-console/frontend/.eslintrc
+++ b/modules/web-console/frontend/.eslintrc
@@ -120,7 +120,7 @@ rules:
no-loop-func: 2
no-mixed-requires: [0, false]
no-mixed-spaces-and-tabs: [2, true]
- no-multi-spaces: 2
+ no-multi-spaces: ["error", {"exceptions": { "VariableDeclarator": true }}]
no-multi-str: 2
no-multiple-empty-lines: [0, {"max": 2}]
no-native-reassign: 2
http://git-wip-us.apache.org/repos/asf/ignite/blob/d52aa800/modules/web-console/frontend/app/components/page-configure-basic/controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-basic/controller.js b/modules/web-console/frontend/app/components/page-configure-basic/controller.js
index 4a67c6a..ac99977 100644
--- a/modules/web-console/frontend/app/components/page-configure-basic/controller.js
+++ b/modules/web-console/frontend/app/components/page-configure-basic/controller.js
@@ -34,21 +34,7 @@ export default class PageConfigureBasicController {
}
$onInit() {
- this.subscription = this.ConfigureState.state$
- .combineLatest(this.Version.currentSbj)
- .do(([state, version]) => {
- this.$scope.$applyAsync(() => {
- this.clusters = state.list.clusters;
- this.caches = state.list.caches;
- this.state = state.configureBasic;
- this.allClusterCaches = this.getAllClusterCaches();
- this.cachesMenu = this.getCachesMenu();
- this.clustersMenu = this.getClustersMenu();
- this.defaultMemoryPolicy = this.getDefaultClusterMemoryPolicy(this.state.cluster);
- this.memorySizeInputVisible = this.getMemorySizeInputVisibility(version);
- });
- }).subscribe();
-
+ this.subscription = this.getObservable(this.ConfigureState.state$, this.Version.currentSbj).subscribe();
this.discoveries = this.Clusters.discoveries;
this.minMemorySize = this.Clusters.minMemoryPolicySize;
@@ -63,6 +49,24 @@ export default class PageConfigureBasicController {
this.pageService.setCluster(-1);
}
+ getObservable(state$, version$) {
+ return state$.combineLatest(version$, (state, version) => ({
+ clusters: state.list.clusters,
+ caches: state.list.caches,
+ state: state.configureBasic,
+ allClusterCaches: this.getAllClusterCaches(state.configureBasic),
+ cachesMenu: this.getCachesMenu(state.list.caches),
+ clustersMenu: this.getClustersMenu(state.list.clusters),
+ defaultMemoryPolicy: this.getDefaultClusterMemoryPolicy(state.configureBasic.cluster),
+ memorySizeInputVisible: this.getMemorySizeInputVisibility(version)
+ }))
+ .do((value) => this.applyValue(value));
+ }
+
+ applyValue(value) {
+ this.$scope.$applyAsync(() => Object.assign(this, value));
+ }
+
$onDestroy() {
this.subscription.unsubscribe();
}
@@ -106,21 +110,19 @@ export default class PageConfigureBasicController {
));
}
- getClustersMenu() {
+ getClustersMenu(clusters = new Map()) {
const newOne = {_id: -1, name: '+ Add new cluster'};
- return get(this, 'clusters.size')
- ? [newOne, {}, ...this.clusters.values()]
+ return clusters.size
+ ? [newOne, {}, ...clusters.values()]
: [newOne];
}
- getCachesMenu() {
- return [...(this.caches || []).values()].map((c) => ({_id: c._id, name: c.name}));
+ getCachesMenu(caches = []) {
+ return [...caches.values()].map((c) => ({_id: c._id, name: c.name}));
}
- getAllClusterCaches() {
- return this.state
- ? [...this.state.oldClusterCaches, ...this.state.newClusterCaches]
- : [];
+ getAllClusterCaches(state = {oldClusterCaches: [], newClusterCaches: []}) {
+ return [...state.oldClusterCaches, ...state.newClusterCaches];
}
getDefaultClusterMemoryPolicy(cluster) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/d52aa800/modules/web-console/frontend/app/components/page-configure-basic/controller.spec.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-basic/controller.spec.js b/modules/web-console/frontend/app/components/page-configure-basic/controller.spec.js
index a9de1ec..4798219 100644
--- a/modules/web-console/frontend/app/components/page-configure-basic/controller.spec.js
+++ b/modules/web-console/frontend/app/components/page-configure-basic/controller.spec.js
@@ -19,14 +19,15 @@ import {suite, test} from 'mocha';
import {assert} from 'chai';
import {spy} from 'sinon';
+import {TestScheduler} from 'rxjs/testing/TestScheduler';
import {Subject} from 'rxjs/Subject';
+import {BehaviorSubject} from 'rxjs/BehaviorSubject';
+import {Subscriber} from 'rxjs/Subscriber';
import Controller from './controller';
const mocks = () => new Map([
['$scope', {
- $applyAsync: spy(function() {
- this._fn = fn;
- })
+ $applyAsync: spy((fn) => fn())
}],
['pageService', {
setCluster: spy()
@@ -42,14 +43,22 @@ const mocks = () => new Map([
downloadClusterConfiguration: spy()
}],
['IgniteVersion', {
- currentSbj: new BehaviorSubject({ignite: '1.9.0'})
+ currentSbj: new BehaviorSubject({ignite: '1.9.0'}),
+ since: (a, b) => a === b
}]
]);
suite('page-configure-basic component controller', () => {
- test('$onInit', () => {
+ test('$onInit method', () => {
const c = new Controller(...mocks().values());
+ c.getObservable = spy(c.getObservable.bind(c));
c.$onInit();
+ assert.deepEqual(
+ c.getObservable.lastCall.args,
+ [c.ConfigureState.state$, c.Version.currentSbj],
+ 'calls getObservable with correct arguments'
+ );
+ assert.instanceOf(c.subscription, Subscriber, 'stores subscription for later');
assert.equal(c.discoveries, 1, 'exposes discoveries');
assert.equal(c.minMemorySize, 1000, 'exposes minMemorySize');
assert.deepEqual(
@@ -62,34 +71,138 @@ suite('page-configure-basic component controller', () => {
'exposes sizesMenu'
);
assert.equal(c.memorySizeScale, c.sizesMenu[2], 'sets default memorySizeScale to Gb');
- assert.deepEqual(c.pageService.setCluster.getCall(0).args, [-1], 'sets cluster to -1');
+ assert.deepEqual(c.pageService.setCluster.lastCall.args, [-1], 'sets cluster to -1');
});
- // TODO IGNITE-5271 Cover rest of controller features with tests
- test.skip('State subscription', () => {
+
+ test('$onDestroy method', () => {
const c = new Controller(...mocks().values());
c.$onInit();
- const state = {
- list: {
+ c.subscription.unsubscribe = spy(c.subscription.unsubscribe);
+ c.$onDestroy();
+ assert(c.subscription.unsubscribe.calledOnce, 'unsubscribes from Observable');
+ });
+
+ test('getObservable method', () => {
+ const testScheduler = new TestScheduler((...args) => assert.deepEqual(...args));
+ const c = new Controller(...mocks().values());
+
+ c.applyValue = spy(c.applyValue.bind(c));
+
+ const version = 'a-b-';
+ const state = '-a-b';
+ const expected = '-abc';
+
+ const version$ = testScheduler.createHotObservable(version, {
+ a: {ignite: '1.9.0'},
+ b: {ignite: '2.0.0'}
+ });
+
+ const state$ = testScheduler.createHotObservable(state, {
+ a: {
+ list: {
+ clusters: new Map(),
+ caches: new Map()
+ },
+ configureBasic: {
+ newClusterCaches: [],
+ oldClusterCaches: [],
+ cluster: null
+ }
+ },
+ b: {
+ list: {
+ clusters: new Map([
+ [1, {_id: 1, name: '1', caches: [1, 2]}],
+ [2, {_id: 2, name: '2'}]
+ ]),
+ caches: new Map([
+ [1, {_id: 1, name: '1'}],
+ [2, {_id: 2, name: '2'}]
+ ])
+ },
+ configureBasic: {
+ newClusterCaches: [],
+ oldClusterCaches: [
+ {_id: 1, name: '1'},
+ {_id: 2, name: '2'}
+ ],
+ cluster: {_id: 1, name: '1', caches: [1, 2]}
+ }
+ }
+ });
+
+
+ const expectedValues = {
+ a: {
+ clusters: new Map(),
+ caches: new Map(),
+ state: {
+ newClusterCaches: [],
+ oldClusterCaches: [],
+ cluster: null
+ },
+ allClusterCaches: [],
+ cachesMenu: [],
+ clustersMenu: [{_id: -1, name: '+ Add new cluster'}],
+ defaultMemoryPolicy: void 0,
+ memorySizeInputVisible: false
+ },
+ b: {
+ clusters: new Map(),
+ caches: new Map(),
+ state: {
+ newClusterCaches: [],
+ oldClusterCaches: [],
+ cluster: null
+ },
+ allClusterCaches: [],
+ cachesMenu: [],
+ clustersMenu: [{_id: -1, name: '+ Add new cluster'}],
+ defaultMemoryPolicy: void 0,
+ memorySizeInputVisible: true
+ },
+ c: {
clusters: new Map([
- [1, {_id: 1, name: '1'}],
+ [1, {_id: 1, name: '1', caches: [1, 2]}],
[2, {_id: 2, name: '2'}]
]),
caches: new Map([
[1, {_id: 1, name: '1'}],
[2, {_id: 2, name: '2'}]
- ])
- },
- configureBasic: {
- newClusterCaches: [1, 2, 3],
- oldClusterCaches: [4, 5, 6],
- cluster: {
- memoryConfiguration: {
- memoryPolicies: [{name: 'Default'}]
- }
- }
+ ]),
+ state: {
+ newClusterCaches: [],
+ oldClusterCaches: [
+ {_id: 1, name: '1'},
+ {_id: 2, name: '2'}
+ ],
+ cluster: {_id: 1, name: '1', caches: [1, 2]}
+ },
+ allClusterCaches: [
+ {_id: 1, name: '1'},
+ {_id: 2, name: '2'}
+ ],
+ cachesMenu: [
+ {_id: 1, name: '1'},
+ {_id: 2, name: '2'}
+ ],
+ clustersMenu: [
+ {_id: -1, name: '+ Add new cluster'},
+ {},
+ {_id: 1, name: '1', caches: [1, 2]},
+ {_id: 2, name: '2'}
+ ],
+ defaultMemoryPolicy: void 0,
+ memorySizeInputVisible: true
}
};
- c.ConfigureState.state$.next(state);
- assert.equal(c.clusters, state.list.clusters, 'gets clusters from state');
+
+ testScheduler.expectObservable(c.getObservable(state$, version$)).toBe(expected, expectedValues);
+ testScheduler.flush();
+
+ assert.deepEqual(c.applyValue.getCall(0).args[0], expectedValues.a, 'applies value a');
+ assert.deepEqual(c.applyValue.getCall(1).args[0], expectedValues.b, 'applies value b');
+ assert.deepEqual(c.applyValue.getCall(2).args[0], expectedValues.c, 'applies value c');
+ assert.equal(c.applyValue.callCount, 3, 'applyValue was called correct amount of times');
});
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/d52aa800/modules/web-console/frontend/app/components/page-configure-basic/reducer.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-basic/reducer.js b/modules/web-console/frontend/app/components/page-configure-basic/reducer.js
index 1eca38e..ff02a05 100644
--- a/modules/web-console/frontend/app/components/page-configure-basic/reducer.js
+++ b/modules/web-console/frontend/app/components/page-configure-basic/reducer.js
@@ -53,25 +53,11 @@ export const reducer = (state = defaults, action, root) => {
case SET_CLUSTER: {
const cluster = !isNewItem(action)
? cloneDeep(root.list.clusters.get(action._id))
- : {
+ : Object.assign({}, action.cluster, {
_id: -1,
- discovery: {
- kind: 'Multicast',
- Vm: {addresses: ['127.0.0.1:47500..47510']},
- Multicast: {addresses: ['127.0.0.1:47500..47510']},
- Jdbc: {initSchema: true},
- Cloud: {regions: [], zones: []}
- },
space: defaultSpace(root),
- name: uniqueName('New cluster', [...root.list.clusters.values()]),
- memoryConfiguration: {
- memoryPolicies: [{
- name: 'default',
- maxSize: null
- }]
- },
- caches: []
- };
+ name: uniqueName('New cluster', [...root.list.clusters.values()])
+ });
const value = Object.assign({}, state, {
clusterID: cluster._id,
cluster,
http://git-wip-us.apache.org/repos/asf/ignite/blob/d52aa800/modules/web-console/frontend/app/components/page-configure-basic/reducer.spec.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-basic/reducer.spec.js b/modules/web-console/frontend/app/components/page-configure-basic/reducer.spec.js
index 4a84183..01aad14 100644
--- a/modules/web-console/frontend/app/components/page-configure-basic/reducer.spec.js
+++ b/modules/web-console/frontend/app/components/page-configure-basic/reducer.spec.js
@@ -63,7 +63,7 @@ suite('page-configure-basic component reducer', () => {
caches: []
};
assert.deepEqual(
- reducer(void 0, {type: SET_CLUSTER, _id: -1}, root),
+ reducer(void 0, {type: SET_CLUSTER, _id: -1, cluster: defaultCluster}, root),
{
clusterID: -1,
cluster: Object.assign({}, defaultCluster, {
http://git-wip-us.apache.org/repos/asf/ignite/blob/d52aa800/modules/web-console/frontend/app/components/page-configure-basic/service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-basic/service.js b/modules/web-console/frontend/app/components/page-configure-basic/service.js
index 5940058..4db61ea 100644
--- a/modules/web-console/frontend/app/components/page-configure-basic/service.js
+++ b/modules/web-console/frontend/app/components/page-configure-basic/service.js
@@ -113,7 +113,11 @@ export default class PageConfigureBasic {
}
setCluster(_id) {
- this.ConfigureState.dispatchAction({type: SET_CLUSTER, _id});
+ this.ConfigureState.dispatchAction(
+ isNewItem({_id})
+ ? {type: SET_CLUSTER, _id, cluster: this.clusters.getBlankCluster()}
+ : {type: SET_CLUSTER, _id}
+ );
}
addCache() {
http://git-wip-us.apache.org/repos/asf/ignite/blob/d52aa800/modules/web-console/frontend/app/components/page-configure-basic/service.spec.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-basic/service.spec.js b/modules/web-console/frontend/app/components/page-configure-basic/service.spec.js
index a5ba658..7d8d30c 100644
--- a/modules/web-console/frontend/app/components/page-configure-basic/service.spec.js
+++ b/modules/web-console/frontend/app/components/page-configure-basic/service.spec.js
@@ -38,7 +38,8 @@ const mocks = () => new Map([
saveCluster: spy(function(c) {
if (this._nextID === 2) return Promise.reject(`Cluster with name ${c.name} already exists`);
return Promise.resolve({data: this._nextID++});
- })
+ }),
+ getBlankCluster: spy(() => ({name: 'Cluster'}))
}],
['caches', {
_nextID: 1,
@@ -298,4 +299,25 @@ suite('page-configure-basic service', () => {
);
});
});
+ suite('setCluster', () => {
+ test('new cluster', () => {
+ const service = new Provider(...mocks().values());
+ service.setCluster(-1);
+ assert.isOk(service.clusters.getBlankCluster.calledOnce, 'calls clusters.getBlankCluster');
+ assert.deepEqual(
+ service.ConfigureState.dispatchAction.lastCall.args[0],
+ {type: SET_CLUSTER, _id: -1, cluster: service.clusters.getBlankCluster.returnValues[0]},
+ 'dispatches correct action'
+ );
+ });
+ test('existing cluster', () => {
+ const service = new Provider(...mocks().values());
+ service.setCluster(1);
+ assert.deepEqual(
+ service.ConfigureState.dispatchAction.lastCall.args[0],
+ {type: SET_CLUSTER, _id: 1},
+ 'dispatches correct action'
+ );
+ });
+ });
});
http://git-wip-us.apache.org/repos/asf/ignite/blob/d52aa800/modules/web-console/frontend/app/components/page-configure-basic/template.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/components/page-configure-basic/template.pug b/modules/web-console/frontend/app/components/page-configure-basic/template.pug
index e6d479c..91b0692 100644
--- a/modules/web-console/frontend/app/components/page-configure-basic/template.pug
+++ b/modules/web-console/frontend/app/components/page-configure-basic/template.pug
@@ -45,7 +45,7 @@ form(novalidate name=form)
| You can create a new one on this tab or #[a(ui-sref='^.advanced.clusters') edit existing ones].
.settings-row
- +ignite-form-field-dropdown('Cluster:', '$ctrl.clusterID', '"clusters"', false, true, false, 'Select a cluster', '', '$ctrl.clustersMenu')(
+ +ignite-form-field-dropdown('Cluster:', '$ctrl.clusterID', '"clusters"', false, true, false, 'Select a cluster', '', '$ctrl.clustersMenu', 'Add new cluster or select existing one.')(
bs-options='cluster._id as cluster.name for cluster in $ctrl.clustersMenu'
)
.settings-row
http://git-wip-us.apache.org/repos/asf/ignite/blob/d52aa800/modules/web-console/frontend/app/services/Clusters.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/services/Clusters.js b/modules/web-console/frontend/app/services/Clusters.js
index 0192c5a..4e38a58 100644
--- a/modules/web-console/frontend/app/services/Clusters.js
+++ b/modules/web-console/frontend/app/services/Clusters.js
@@ -40,4 +40,56 @@ export default class Clusters {
saveCluster(cluster) {
return this.$http.post('/api/v1/configuration/clusters/save', cluster);
}
+
+ getBlankCluster() {
+ return {
+ activeOnStart: true,
+ cacheSanityCheckEnabled: true,
+ atomicConfiguration: {},
+ cacheKeyConfiguration: [],
+ deploymentSpi: {
+ URI: {
+ uriList: [],
+ scanners: []
+ }
+ },
+ marshaller: {},
+ peerClassLoadingLocalClassPathExclude: [],
+ sslContextFactory: {
+ trustManagers: []
+ },
+ swapSpaceSpi: {},
+ transactionConfiguration: {},
+ memoryConfiguration: {
+ memoryPolicies: [{
+ name: 'default',
+ maxSize: null
+ }]
+ },
+ hadoopConfiguration: {
+ nativeLibraryNames: []
+ },
+ serviceConfigurations: [],
+ executorConfiguration: [],
+ sqlConnectorConfiguration: {
+ tcpNoDelay: true
+ },
+ space: void 0,
+ discovery: {
+ kind: 'Multicast',
+ Vm: {addresses: ['127.0.0.1:47500..47510']},
+ Multicast: {addresses: ['127.0.0.1:47500..47510']},
+ Jdbc: {initSchema: true},
+ Cloud: {regions: [], zones: []}
+ },
+ binaryConfiguration: {typeConfigurations: [], compactFooter: true},
+ communication: {tcpNoDelay: true},
+ connector: {noDelay: true},
+ collision: {kind: 'Noop', JobStealing: {stealingEnabled: true}, PriorityQueue: {starvationPreventionEnabled: true}},
+ failoverSpi: [],
+ logger: {Log4j: { mode: 'Default'}},
+ caches: [],
+ igfss: []
+ };
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d52aa800/modules/web-console/frontend/app/services/Clusters.spec.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/services/Clusters.spec.js b/modules/web-console/frontend/app/services/Clusters.spec.js
new file mode 100644
index 0000000..92bfa2e
--- /dev/null
+++ b/modules/web-console/frontend/app/services/Clusters.spec.js
@@ -0,0 +1,55 @@
+/*
+ * 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.
+ */
+
+import {suite, test} from 'mocha';
+import {assert} from 'chai';
+import {spy} from 'sinon';
+
+import Provider from './Clusters.js';
+
+const mocks = () => new Map([
+ ['$http', {
+ post: spy()
+ }]
+]);
+
+suite('Clusters service', () => {
+ test('discoveries', () => {
+ const s = new Provider(...mocks().values());
+ assert.isArray(s.discoveries, 'has discoveries array');
+ assert.isOk(s.discoveries.every((d) => d.value && d.label), 'discoveries have correct format');
+ });
+
+ test('minMemoryPolicySize', () => {
+ const s = new Provider(...mocks().values());
+ assert.isNumber(s.minMemoryPolicySize, 'has minMemoryPolicySize number');
+ });
+
+ test('saveCluster', () => {
+ const s = new Provider(...mocks().values());
+ const cluster = {id: 1, name: 'Test'};
+ s.saveCluster(cluster);
+ assert.isOk(s.$http.post.called, 'calls $http.post');
+ assert.equal(s.$http.post.lastCall.args[0], '/api/v1/configuration/clusters/save', 'uses correct API URL');
+ assert.deepEqual(s.$http.post.lastCall.args[1], cluster, 'sends cluster');
+ });
+
+ test('getBlankCluster', () => {
+ const s = new Provider(...mocks().values());
+ assert.isObject(s.getBlankCluster());
+ });
+});
http://git-wip-us.apache.org/repos/asf/ignite/blob/d52aa800/modules/web-console/frontend/controllers/clusters-controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/controllers/clusters-controller.js b/modules/web-console/frontend/controllers/clusters-controller.js
index cb59c20..8340b4d 100644
--- a/modules/web-console/frontend/controllers/clusters-controller.js
+++ b/modules/web-console/frontend/controllers/clusters-controller.js
@@ -16,8 +16,8 @@
*/
// Controller for Clusters screen.
-export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'IgniteInput', 'IgniteLoading', 'IgniteModelNormalizer', 'IgniteUnsavedChangesGuard', 'IgniteEventGroups', 'DemoInfo', 'IgniteLegacyTable', 'IgniteConfigurationResource', 'IgniteErrorPopover', 'IgniteFormUtils', 'IgniteVersion',
- function($root, $scope, $http, $state, $timeout, LegacyUtils, Messages, Confirm, Input, Loading, ModelNormalizer, UnsavedChangesGuard, igniteEventGroups, DemoInfo, LegacyTable, Resource, ErrorPopover, FormUtils, Version) {
+export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'IgniteInput', 'IgniteLoading', 'IgniteModelNormalizer', 'IgniteUnsavedChangesGuard', 'IgniteEventGroups', 'DemoInfo', 'IgniteLegacyTable', 'IgniteConfigurationResource', 'IgniteErrorPopover', 'IgniteFormUtils', 'IgniteVersion', 'Clusters',
+ function($root, $scope, $http, $state, $timeout, LegacyUtils, Messages, Confirm, Input, Loading, ModelNormalizer, UnsavedChangesGuard, igniteEventGroups, DemoInfo, LegacyTable, Resource, ErrorPopover, FormUtils, Version, Clusters) {
let __original_value;
this.available = Version.available.bind(Version);
@@ -75,46 +75,7 @@ export default ['$rootScope', '$scope', '$http', '$state', '$timeout', 'IgniteLe
const emptyCluster = {empty: true};
- const blank = {
- activeOnStart: true,
- cacheSanityCheckEnabled: true,
- atomicConfiguration: {},
- binaryConfiguration: {},
- cacheKeyConfiguration: [],
- communication: {},
- connector: {},
- deploymentSpi: {
- URI: {
- uriList: [],
- scanners: []
- }
- },
- discovery: {
- Cloud: {
- regions: [],
- zones: []
- }
- },
- marshaller: {},
- peerClassLoadingLocalClassPathExclude: [],
- sslContextFactory: {
- trustManagers: []
- },
- swapSpaceSpi: {},
- transactionConfiguration: {},
- collision: {},
- memoryConfiguration: {
- memoryPolicies: []
- },
- hadoopConfiguration: {
- nativeLibraryNames: []
- },
- serviceConfigurations: [],
- executorConfiguration: [],
- sqlConnectorConfiguration: {
- tcpNoDelay: true
- }
- };
+ const blank = Clusters.getBlankCluster();
const pairFields = {
attributes: {id: 'Attribute', idPrefix: 'Key', searchCol: 'name', valueCol: 'key', dupObjName: 'name', group: 'attributes'},
[48/50] ignite git commit: Call GridDhtPartitionTopology.onExchange
done for each group, not cache.
Posted by sb...@apache.org.
Call GridDhtPartitionTopology.onExchange done for each group, not cache.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9bf4ca49
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9bf4ca49
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9bf4ca49
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 9bf4ca4987a0b4eeddb857db6941efbe1bec9690
Parents: 2503f9e
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 20 07:47:11 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 20 07:47:11 2017 +0300
----------------------------------------------------------------------
.../ignite/internal/processors/cache/CacheGroupContext.java | 2 +-
.../dht/preloader/GridDhtPartitionsExchangeFuture.java | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9bf4ca49/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
index 4a66a85..c3ddc5f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheGroupContext.java
@@ -540,7 +540,7 @@ public class CacheGroupContext {
*/
public GridDhtPartitionTopology topology() {
if (top == null)
- throw new IllegalStateException("Topology is not initialized: " + name());
+ throw new IllegalStateException("Topology is not initialized: " + cacheOrGroupName());
return top;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9bf4ca49/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 5f416da..230a25c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -1299,8 +1299,10 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
cctx.database().releaseHistoryForExchange();
if (err == null && realExchange) {
- for (CacheGroupContext grp : cctx.cache().cacheGroups())
- grp.topology().onExchangeDone(grp.affinity().cachedAffinity(topologyVersion()));
+ for (CacheGroupContext grp : cctx.cache().cacheGroups()) {
+ if (!grp.isLocal())
+ grp.topology().onExchangeDone(grp.affinity().cachedAffinity(topologyVersion()));
+ }
}
if (super.onDone(res, err) && realExchange) {
[32/50] ignite git commit: Merge remote-tracking branch
'upstream/ignite-2.1.1' into ignite-2.1.1
Posted by sb...@apache.org.
Merge remote-tracking branch 'upstream/ignite-2.1.1' into ignite-2.1.1
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1feca217
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1feca217
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1feca217
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 1feca2176b33ef9c2260d06107c700d68a55189f
Parents: b172b4b e7d0e79
Author: devozerov <vo...@gridgain.com>
Authored: Sat Jun 17 17:32:04 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Sat Jun 17 17:32:04 2017 +0300
----------------------------------------------------------------------
.../org/apache/ignite/internal/visor/util/VisorTaskUtils.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
[02/50] ignite git commit: IGNITE-5366 Fixed tables position in
modals.
Posted by sb...@apache.org.
IGNITE-5366 Fixed tables position in modals.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f6df8fb0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f6df8fb0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f6df8fb0
Branch: refs/heads/ignite-2.1.2-exchange
Commit: f6df8fb0eb18fabb8d74c1a5825192b36b390545
Parents: be0957a
Author: Andrey Novikov <an...@gridgain.com>
Authored: Fri Jun 16 20:35:46 2017 +0700
Committer: Andrey Novikov <an...@gridgain.com>
Committed: Fri Jun 16 20:35:46 2017 +0700
----------------------------------------------------------------------
modules/web-console/frontend/app/primitives/modal/index.scss | 1 +
.../java/org/apache/ignite/console/demo/AgentClusterDemo.java | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6df8fb0/modules/web-console/frontend/app/primitives/modal/index.scss
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/primitives/modal/index.scss b/modules/web-console/frontend/app/primitives/modal/index.scss
index a5b6a40..58b7370 100644
--- a/modules/web-console/frontend/app/primitives/modal/index.scss
+++ b/modules/web-console/frontend/app/primitives/modal/index.scss
@@ -54,6 +54,7 @@
.modal .modal-dialog {
width: 650px;
+ transform: translateZ(1px);
}
.modal .modal-content {
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6df8fb0/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/AgentClusterDemo.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/AgentClusterDemo.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/AgentClusterDemo.java
index 80c8c0c..cf7ae55 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/AgentClusterDemo.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/demo/AgentClusterDemo.java
@@ -177,7 +177,7 @@ public class AgentClusterDemo {
int port = basePort.get();
try {
- IgniteEx ignite = (IgniteEx)Ignition.start(igniteConfiguration(port, idx, idx == NODE_CNT));
+ IgniteEx ignite = (IgniteEx)Ignition.start(igniteConfiguration(port, idx, false));
if (idx == 0) {
Collection<String> jettyAddrs = ignite.localNode().attribute(ATTR_REST_JETTY_ADDRS);
@@ -201,7 +201,7 @@ public class AgentClusterDemo {
initLatch.countDown();
- deployServices(ignite.services());
+ deployServices(ignite.services(ignite.cluster().forServers()));
}
}
catch (Throwable e) {
[24/50] ignite git commit: ignite-5512 enabled test
Posted by sb...@apache.org.
ignite-5512 enabled test
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bf3643dd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bf3643dd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bf3643dd
Branch: refs/heads/ignite-2.1.2-exchange
Commit: bf3643dd64c7bf309774a87ccf38153a7a8ee118
Parents: 7603b0c
Author: sboikov <sb...@gridgain.com>
Authored: Sat Jun 17 09:20:14 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Sat Jun 17 09:20:14 2017 +0300
----------------------------------------------------------------------
.../internal/processors/cache/IgniteDynamicCacheStartSelfTest.java | 2 --
1 file changed, 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bf3643dd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
index ae49522..4f606c9 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/IgniteDynamicCacheStartSelfTest.java
@@ -1252,8 +1252,6 @@ public class IgniteDynamicCacheStartSelfTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testStartStopWithClientJoin() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-5512");
-
Ignite ignite1 = ignite(1);
final AtomicBoolean stop = new AtomicBoolean();
[47/50] ignite git commit: IGNITE-5545: fix for Ignite PDS1:
ignitePdsCheckpointSimulationTest 2 tests failed
Posted by sb...@apache.org.
IGNITE-5545: fix for Ignite PDS1: ignitePdsCheckpointSimulationTest 2 tests failed
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4c8cc089
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4c8cc089
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4c8cc089
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 4c8cc0896e2a11d8fa810acecfc5a90e2c866df5
Parents: 2503f9e
Author: dpavlov <dp...@gridgain.com>
Authored: Mon Jun 19 20:41:52 2017 +0300
Committer: dpavlov <dp...@gridgain.com>
Committed: Mon Jun 19 20:42:24 2017 +0300
----------------------------------------------------------------------
.../pagemem/wal/record/CheckpointRecord.java | 6 +-
.../wal/record/MemoryRecoveryRecord.java | 8 +-
.../internal/pagemem/wal/record/WALRecord.java | 2 +-
...ckpointSimulationWithRealCpDisabledTest.java | 1037 ++++++++++++++++++
.../file/ignitePdsCheckpointSimulationTest.java | 1018 -----------------
.../ignite/testsuites/IgnitePdsTestSuite.java | 4 +-
6 files changed, 1048 insertions(+), 1027 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4c8cc089/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/CheckpointRecord.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/CheckpointRecord.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/CheckpointRecord.java
index cfcd62a..6337f99 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/CheckpointRecord.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/CheckpointRecord.java
@@ -31,7 +31,7 @@ public class CheckpointRecord extends WALRecord {
/** Checkpoint ID. */
private UUID cpId;
- /** */
+ /** todo ?, always false */
private boolean end;
/** */
@@ -42,7 +42,7 @@ public class CheckpointRecord extends WALRecord {
/**
* @param cpMark Checkpoint mark.
- * @param end Checkpoint end flag.
+ * @param end Checkpoint end flag - deprecated todo ?, always false
*/
public CheckpointRecord(WALPointer cpMark, boolean end) {
this(UUID.randomUUID(), cpMark, end);
@@ -51,7 +51,7 @@ public class CheckpointRecord extends WALRecord {
/**
* @param cpId Checkpoint ID.
* @param cpMark Checkpoint mark.
- * @param end Checkpoint end flag.
+ * @param end Checkpoint end flag - deprecated todo ?, always false
*/
public CheckpointRecord(UUID cpId, WALPointer cpMark, boolean end) {
this.cpId = cpId;
http://git-wip-us.apache.org/repos/asf/ignite/blob/4c8cc089/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/MemoryRecoveryRecord.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/MemoryRecoveryRecord.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/MemoryRecoveryRecord.java
index 9cdef71..99248d7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/MemoryRecoveryRecord.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/MemoryRecoveryRecord.java
@@ -21,13 +21,12 @@ package org.apache.ignite.internal.pagemem.wal.record;
* Marker that we start memory recovering
*/
public class MemoryRecoveryRecord extends WALRecord {
- /** Time. */
+ /** Create timestamp, millis */
private long time;
-
/**
* Default constructor.
- * @param time
+ * @param time current timestamp, millis
*/
public MemoryRecoveryRecord(long time) {
this.time = time;
@@ -38,6 +37,9 @@ public class MemoryRecoveryRecord extends WALRecord {
return RecordType.MEMORY_RECOVERY;
}
+ /**
+ * @return memory recovery start timestamp, millis
+ */
public long time() {
return time;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4c8cc089/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/WALRecord.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/WALRecord.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/WALRecord.java
index b76bcc6..c97f8f0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/WALRecord.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/record/WALRecord.java
@@ -127,7 +127,7 @@ public abstract class WALRecord {
/** */
PARTITION_META_PAGE_UPDATE_COUNTERS,
- /** */
+ /** Memory recovering start marker */
MEMORY_RECOVERY,
/** */
http://git-wip-us.apache.org/repos/asf/ignite/blob/4c8cc089/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java
new file mode 100644
index 0000000..035693a
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/IgnitePdsCheckpointSimulationWithRealCpDisabledTest.java
@@ -0,0 +1,1037 @@
+/*
+ * 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.persistence.db.file;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ThreadLocalRandom;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.nio.ByteOrder;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheRebalanceMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.PersistentStoreConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.IgniteInternalFuture;
+import org.apache.ignite.internal.pagemem.FullPageId;
+import org.apache.ignite.internal.pagemem.PageIdAllocator;
+import org.apache.ignite.internal.pagemem.PageMemory;
+import org.apache.ignite.internal.pagemem.PageUtils;
+import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
+import org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryEx;
+import org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryImpl;
+import org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPageIO;
+import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
+import org.apache.ignite.internal.processors.cache.persistence.tree.io.TrackingPageIO;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.internal.pagemem.store.IgnitePageStoreManager;
+import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager;
+import org.apache.ignite.internal.pagemem.wal.WALIterator;
+import org.apache.ignite.internal.pagemem.wal.WALPointer;
+import org.apache.ignite.internal.pagemem.wal.record.CheckpointRecord;
+import org.apache.ignite.internal.pagemem.wal.record.DataEntry;
+import org.apache.ignite.internal.pagemem.wal.record.DataRecord;
+import org.apache.ignite.internal.pagemem.wal.record.PageSnapshot;
+import org.apache.ignite.internal.pagemem.wal.record.WALRecord;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.GridCacheOperation;
+import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteBiTuple;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ * Test simulated chekpoints,
+ * Disables integrated check pointer thread
+ */
+public class IgnitePdsCheckpointSimulationWithRealCpDisabledTest extends GridCommonAbstractTest {
+ /** */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static final int TOTAL_PAGES = 1000;
+
+ /** */
+ private static final boolean VERBOSE = false;
+
+ /** Cache name. */
+ private static final String cacheName = "cache";
+
+ /**
+ * toggle flag, inline if CP end record is not possible
+ */
+ private static final boolean cpEndRecord = false;
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ CacheConfiguration ccfg = new CacheConfiguration(cacheName);
+
+ ccfg.setRebalanceMode(CacheRebalanceMode.NONE);
+
+ cfg.setCacheConfiguration(ccfg);
+
+ MemoryConfiguration dbCfg = new MemoryConfiguration();
+
+ cfg.setMemoryConfiguration(dbCfg);
+
+ cfg.setPersistentStoreConfiguration(
+ new PersistentStoreConfiguration()
+ .setCheckpointingFrequency(500)
+ .setWalMode(WALMode.LOG_ONLY)
+ .setAlwaysWriteFullPages(true)
+ );
+
+ TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
+
+ discoSpi.setIpFinder(IP_FINDER);
+
+ cfg.setDiscoverySpi(discoSpi);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ stopAllGrids();
+
+ deleteWorkFiles();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ deleteWorkFiles();
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
+ public void testCheckpointSimulationMultiThreaded() throws Exception {
+ IgniteEx ig = startGrid(0);
+
+ ig.active(true);
+
+ GridCacheSharedContext<Object, Object> shared = ig.context().cache().context();
+
+ GridCacheDatabaseSharedManager dbMgr = (GridCacheDatabaseSharedManager)shared.database();
+
+ IgnitePageStoreManager pageStore = shared.pageStore();
+
+ U.sleep(1_000);
+
+ // Disable integrated checkpoint thread.
+ dbMgr.enableCheckpoints(false).get();
+
+ // Must put something in partition 0 in order to initialize meta page.
+ // Otherwise we will violate page store integrity rules.
+ ig.cache(cacheName).put(0, 0);
+
+ PageMemory mem = shared.database().memoryPolicy(null).pageMemory();
+
+ IgniteBiTuple<Map<FullPageId, Integer>, WALPointer> res;
+
+ try {
+ res = runCheckpointing(ig, (PageMemoryImpl)mem, pageStore, shared.wal(),
+ shared.cache().cache(cacheName).context().cacheId());
+ }
+ catch (Throwable th) {
+ log().error("Error while running checkpointing", th);
+
+ throw th;
+ }
+ finally {
+ dbMgr.enableCheckpoints(true).get();
+
+ stopAllGrids(false);
+ }
+
+ ig = startGrid(0);
+
+ ig.active(true);
+
+ shared = ig.context().cache().context();
+
+ dbMgr = (GridCacheDatabaseSharedManager)shared.database();
+
+ dbMgr.enableCheckpoints(false).get();
+
+ mem = shared.database().memoryPolicy(null).pageMemory();
+
+ verifyReads(res.get1(), mem, res.get2(), shared.wal());
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
+ public void testGetForInitialWrite() throws Exception {
+ IgniteEx ig = startGrid(0);
+
+ ig.active(true);
+
+ GridCacheSharedContext<Object, Object> shared = ig.context().cache().context();
+
+ int cacheId = shared.cache().cache(cacheName).context().cacheId();
+
+ GridCacheDatabaseSharedManager dbMgr = (GridCacheDatabaseSharedManager)shared.database();
+
+ // Disable integrated checkpoint thread.
+ dbMgr.enableCheckpoints(false);
+
+ PageMemory mem = shared.database().memoryPolicy(null).pageMemory();
+
+ IgniteWriteAheadLogManager wal = shared.wal();
+
+ WALPointer start = wal.log(new CheckpointRecord(null, false));
+
+ final FullPageId[] initWrites = new FullPageId[10];
+
+ ig.context().cache().context().database().checkpointReadLock();
+
+ try {
+ for (int i = 0; i < initWrites.length; i++)
+ initWrites[i] = new FullPageId(mem.allocatePage(cacheId, 0, PageIdAllocator.FLAG_DATA), cacheId);
+
+ // Check getForInitialWrite methods.
+ for (FullPageId fullId : initWrites) {
+ long page = mem.acquirePage(fullId.cacheId(), fullId.pageId());
+ try {
+ long pageAddr = mem.writeLock(fullId.cacheId(), fullId.pageId(), page);
+
+ try {
+ DataPageIO.VERSIONS.latest().initNewPage(pageAddr, fullId.pageId(), mem.pageSize());
+
+ for (int i = PageIO.COMMON_HEADER_END; i < mem.pageSize(); i++)
+ PageUtils.putByte(pageAddr, i, (byte)0xAB);
+ }
+ finally {
+ mem.writeUnlock(fullId.cacheId(), fullId.pageId(), page, null, true);
+ }
+ }
+ finally {
+ mem.releasePage(fullId.cacheId(), fullId.pageId(), page);
+ }
+ }
+
+ wal.fsync(null);
+ }
+ finally {
+ ig.context().cache().context().database().checkpointReadUnlock();
+ stopAllGrids(false);
+ }
+
+ ig = startGrid(0);
+
+ ig.active(true);
+
+ shared = ig.context().cache().context();
+
+ dbMgr = (GridCacheDatabaseSharedManager)shared.database();
+
+ dbMgr.enableCheckpoints(false);
+
+ wal = shared.wal();
+
+ try (WALIterator it = wal.replay(start)) {
+ it.nextX();
+
+ for (FullPageId initialWrite : initWrites) {
+ IgniteBiTuple<WALPointer, WALRecord> tup = it.nextX();
+
+ assertTrue(String.valueOf(tup.get2()), tup.get2() instanceof PageSnapshot);
+
+ PageSnapshot snap = (PageSnapshot)tup.get2();
+
+ FullPageId actual = snap.fullPageId();
+
+ //there are extra tracking pages, skip them
+ if (TrackingPageIO.VERSIONS.latest().trackingPageFor(actual.pageId(), mem.pageSize()) == actual.pageId()) {
+ tup = it.nextX();
+
+ assertTrue(tup.get2() instanceof PageSnapshot);
+
+ actual = ((PageSnapshot)tup.get2()).fullPageId();
+ }
+
+ assertEquals(initialWrite, actual);
+ }
+ }
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
+ public void testDataWalEntries() throws Exception {
+ IgniteEx ig = startGrid(0);
+
+ ig.active(true);
+
+ GridCacheSharedContext<Object, Object> sharedCtx = ig.context().cache().context();
+ GridCacheContext<Object, Object> cctx = sharedCtx.cache().cache(cacheName).context();
+
+ GridCacheDatabaseSharedManager db = (GridCacheDatabaseSharedManager)sharedCtx.database();
+ IgniteWriteAheadLogManager wal = sharedCtx.wal();
+
+ assertTrue(wal.isAlwaysWriteFullPages());
+
+ db.enableCheckpoints(false).get();
+
+ final int cnt = 10;
+
+ List<DataEntry> entries = new ArrayList<>(cnt);
+
+ for (int i = 0; i < cnt; i++) {
+ GridCacheOperation op = i % 2 == 0 ? GridCacheOperation.UPDATE : GridCacheOperation.DELETE;
+
+ KeyCacheObject key = cctx.toCacheKeyObject(i);
+
+ CacheObject val = null;
+
+ if (op != GridCacheOperation.DELETE)
+ val = cctx.toCacheObject("value-" + i);
+
+ entries.add(new DataEntry(cctx.cacheId(), key, val, op, null, cctx.versions().next(), 0L,
+ cctx.affinity().partition(i), i));
+ }
+
+ UUID cpId = UUID.randomUUID();
+
+ WALPointer start = wal.log(new CheckpointRecord(cpId, null, false));
+
+ wal.fsync(start);
+
+ for (DataEntry entry : entries)
+ wal.log(new DataRecord(entry));
+
+ WALPointer end;
+ if (cpEndRecord) {
+ end = wal.log(new CheckpointRecord(cpId, start, true));
+
+ wal.fsync(end);
+ }
+
+ // Data will not be written to the page store.
+ stopAllGrids();
+
+ ig = startGrid(0);
+
+ ig.active(true);
+
+ sharedCtx = ig.context().cache().context();
+ cctx = sharedCtx.cache().cache(cacheName).context();
+
+ db = (GridCacheDatabaseSharedManager)sharedCtx.database();
+ wal = sharedCtx.wal();
+
+ db.enableCheckpoints(false).get();
+
+ try (WALIterator it = wal.replay(start)) {
+ IgniteBiTuple<WALPointer, WALRecord> cpRecordTup = it.nextX();
+
+ assert cpRecordTup.get2() instanceof CheckpointRecord;
+
+ assertEquals(start, cpRecordTup.get1());
+
+ CheckpointRecord cpRec = (CheckpointRecord)cpRecordTup.get2();
+
+ assertEquals(cpId, cpRec.checkpointId());
+ assertNull(cpRec.checkpointMark());
+ assertFalse(cpRec.end());
+
+ int idx = 0;
+ CacheObjectContext coctx = cctx.cacheObjectContext();
+
+ while (idx < entries.size()) {
+ IgniteBiTuple<WALPointer, WALRecord> dataRecTup = it.nextX();
+
+ assert dataRecTup.get2() instanceof DataRecord;
+
+ DataRecord dataRec = (DataRecord)dataRecTup.get2();
+
+ DataEntry entry = entries.get(idx);
+
+ assertEquals(1, dataRec.writeEntries().size());
+
+ DataEntry readEntry = dataRec.writeEntries().get(0);
+
+ assertEquals(entry.cacheId(), readEntry.cacheId());
+ assertEquals(entry.key().<Integer>value(coctx, true), readEntry.key().<Integer>value(coctx, true));
+ assertEquals(entry.op(), readEntry.op());
+
+ if (entry.op() == GridCacheOperation.UPDATE)
+ assertEquals(entry.value().value(coctx, true), readEntry.value().value(coctx, true));
+ else
+ assertNull(entry.value());
+
+ assertEquals(entry.writeVersion(), readEntry.writeVersion());
+ assertEquals(entry.nearXidVersion(), readEntry.nearXidVersion());
+ assertEquals(entry.partitionCounter(), readEntry.partitionCounter());
+
+ idx++;
+ }
+
+
+
+ if(cpEndRecord) {
+ IgniteBiTuple<WALPointer, WALRecord> tup = it.nextX();
+ WALRecord walRecord = tup.get2();
+ boolean exp = walRecord instanceof CheckpointRecord;
+ assert exp : walRecord;
+
+ assertEquals(end, tup.get1());
+
+ cpRec = (CheckpointRecord)tup.get2();
+
+ assertEquals(cpId, cpRec.checkpointId());
+ assertEquals(start, cpRec.checkpointMark());
+ assertTrue(cpRec.end());
+ }
+ }
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
+ public void testPageWalEntries() throws Exception {
+ IgniteEx ig = startGrid(0);
+
+ ig.active(true);
+
+ GridCacheSharedContext<Object, Object> sharedCtx = ig.context().cache().context();
+ int cacheId = sharedCtx.cache().cache(cacheName).context().cacheId();
+
+ GridCacheDatabaseSharedManager db = (GridCacheDatabaseSharedManager)sharedCtx.database();
+ PageMemory pageMem = sharedCtx.database().memoryPolicy(null).pageMemory();
+ IgniteWriteAheadLogManager wal = sharedCtx.wal();
+
+ db.enableCheckpoints(false).get();
+
+ int pageCnt = 100;
+
+ List<FullPageId> pageIds = new ArrayList<>();
+
+ for (int i = 0; i < pageCnt; i++) {
+ db.checkpointReadLock();
+ try {
+ pageIds.add(new FullPageId(pageMem.allocatePage(cacheId, PageIdAllocator.INDEX_PARTITION,
+ PageIdAllocator.FLAG_IDX), cacheId));
+ }
+ finally {
+ db.checkpointReadUnlock();
+ }
+ }
+
+ UUID cpId = UUID.randomUUID();
+
+ WALPointer start = wal.log(new CheckpointRecord(cpId, null, false));
+
+ wal.fsync(start);
+
+ ig.context().cache().context().database().checkpointReadLock();
+
+ try {
+ for (FullPageId pageId : pageIds)
+ writePageData(pageId, pageMem);
+ }
+ finally {
+ ig.context().cache().context().database().checkpointReadUnlock();
+ }
+
+ WALPointer end;
+ if(cpEndRecord) {
+ end = wal.log(new CheckpointRecord(cpId, start, true));
+
+ wal.fsync(end);
+ }
+
+ // Data will not be written to the page store.
+ stopAllGrids();
+
+ ig = startGrid(0);
+
+ ig.active(true);
+
+ sharedCtx = ig.context().cache().context();
+
+ db = (GridCacheDatabaseSharedManager)sharedCtx.database();
+ wal = sharedCtx.wal();
+
+ db.enableCheckpoints(false);
+
+ try (WALIterator it = wal.replay(start)) {
+ IgniteBiTuple<WALPointer, WALRecord> tup = it.nextX();
+
+ assert tup.get2() instanceof CheckpointRecord : tup.get2();
+
+ assertEquals(start, tup.get1());
+
+ CheckpointRecord cpRec = (CheckpointRecord)tup.get2();
+
+ assertEquals(cpId, cpRec.checkpointId());
+ assertNull(cpRec.checkpointMark());
+ assertFalse(cpRec.end());
+
+ int idx = 0;
+
+ while (idx < pageIds.size()) {
+ tup = it.nextX();
+
+ assert tup.get2() instanceof PageSnapshot : tup.get2().getClass();
+
+ PageSnapshot snap = (PageSnapshot)tup.get2();
+
+ //there are extra tracking pages, skip them
+ if (TrackingPageIO.VERSIONS.latest().trackingPageFor(snap.fullPageId().pageId(), pageMem.pageSize()) == snap.fullPageId().pageId()) {
+ tup = it.nextX();
+
+ assertTrue(tup.get2() instanceof PageSnapshot);
+
+ snap = (PageSnapshot)tup.get2();
+ }
+
+ assertEquals(pageIds.get(idx), snap.fullPageId());
+
+ idx++;
+ }
+
+ if(cpEndRecord) {
+ tup = it.nextX();
+
+ assert tup.get2() instanceof CheckpointRecord;
+
+ assertEquals(end, tup.get1());
+
+ cpRec = (CheckpointRecord)tup.get2();
+
+ assertEquals(cpId, cpRec.checkpointId());
+ assertEquals(start, cpRec.checkpointMark());
+ assertTrue(cpRec.end());
+ }
+ }
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
+ public void testDirtyFlag() throws Exception {
+ IgniteEx ig = startGrid(0);
+
+ ig.active(true);
+
+ GridCacheSharedContext<Object, Object> shared = ig.context().cache().context();
+
+ int cacheId = shared.cache().cache(cacheName).context().cacheId();
+
+ GridCacheDatabaseSharedManager dbMgr = (GridCacheDatabaseSharedManager)shared.database();
+
+ // Disable integrated checkpoint thread.
+ dbMgr.enableCheckpoints(false);
+
+ PageMemoryEx mem = (PageMemoryEx) dbMgr.memoryPolicy(null).pageMemory();
+
+ ig.context().cache().context().database().checkpointReadLock();
+
+ FullPageId[] pageIds = new FullPageId[100];
+
+ try {
+ for (int i = 0; i < pageIds.length; i++)
+ pageIds[i] = new FullPageId(mem.allocatePage(cacheId, 0, PageIdAllocator.FLAG_DATA), cacheId);
+
+ for (FullPageId fullId : pageIds) {
+ long page = mem.acquirePage(fullId.cacheId(), fullId.pageId());
+
+ try {
+ assertTrue(mem.isDirty(fullId.cacheId(), fullId.pageId(), page)); //page is dirty right after allocation
+
+ long pageAddr = mem.writeLock(fullId.cacheId(), fullId.pageId(), page);
+
+ PageIO.setPageId(pageAddr, fullId.pageId());
+
+ try {
+ assertTrue(mem.isDirty(fullId.cacheId(), fullId.pageId(), page));
+ }
+ finally {
+ mem.writeUnlock(fullId.cacheId(), fullId.pageId(),page, null,true);
+ }
+
+ assertTrue(mem.isDirty(fullId.cacheId(), fullId.pageId(), page));
+ }
+ finally {
+ mem.releasePage(fullId.cacheId(), fullId.pageId(), page);
+ }
+ }
+ }
+ finally {
+ ig.context().cache().context().database().checkpointReadUnlock();
+ }
+
+ Collection<FullPageId> cpPages = mem.beginCheckpoint();
+
+ ig.context().cache().context().database().checkpointReadLock();
+
+ try {
+ for (FullPageId fullId : pageIds) {
+ assertTrue(cpPages.contains(fullId));
+
+ ByteBuffer buf = ByteBuffer.allocate(mem.pageSize());
+
+ long page = mem.acquirePage(fullId.cacheId(), fullId.pageId());
+
+ try {
+ assertTrue(mem.isDirty(fullId.cacheId(), fullId.pageId(), page));
+
+ long pageAddr = mem.writeLock(fullId.cacheId(), fullId.pageId(), page);
+
+ try {
+ assertFalse(mem.isDirty(fullId.cacheId(), fullId.pageId(), page));
+
+ for (int i = PageIO.COMMON_HEADER_END; i < mem.pageSize(); i++)
+ PageUtils.putByte(pageAddr, i, (byte)1);
+ }
+ finally {
+ mem.writeUnlock(fullId.cacheId(), fullId.pageId(), page, null, true);
+ }
+
+ assertTrue(mem.isDirty(fullId.cacheId(), fullId.pageId(), page));
+
+ buf.rewind();
+
+ mem.getForCheckpoint(fullId, buf, null);
+
+ buf.position(PageIO.COMMON_HEADER_END);
+
+ while (buf.hasRemaining())
+ assertEquals((byte)0, buf.get());
+ }
+ finally {
+ mem.releasePage(fullId.cacheId(), fullId.pageId(), page);
+ }
+ }
+ }
+ finally {
+ ig.context().cache().context().database().checkpointReadUnlock();
+ }
+
+ mem.finishCheckpoint();
+
+ for (FullPageId fullId : pageIds) {
+ long page = mem.acquirePage(fullId.cacheId(), fullId.pageId());
+ try {
+ assertTrue(mem.isDirty(fullId.cacheId(), fullId.pageId(), page));
+ }
+ finally {
+ mem.releasePage(fullId.cacheId(), fullId.pageId(), page);
+ }
+ }
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
+ private void writePageData(FullPageId fullId, PageMemory mem) throws Exception {
+ long page = mem.acquirePage(fullId.cacheId(), fullId.pageId());
+ try {
+ long pageAddr = mem.writeLock(fullId.cacheId(), fullId.pageId(), page);
+
+ try {
+ DataPageIO.VERSIONS.latest().initNewPage(pageAddr, fullId.pageId(), mem.pageSize());
+
+ ThreadLocalRandom rnd = ThreadLocalRandom.current();
+
+ for (int i = PageIO.COMMON_HEADER_END; i < mem.pageSize(); i++)
+ PageUtils.putByte(pageAddr, i, (byte)rnd.nextInt(255));
+ }
+ finally {
+ mem.writeUnlock(fullId.cacheId(), fullId.pageId(), page, null, true);
+ }
+ }
+ finally {
+ mem.releasePage(fullId.cacheId(), fullId.pageId(), page);
+ }
+ }
+
+ /**
+ * @param res Result map to verify.
+ * @param mem Memory.
+ */
+ private void verifyReads(
+ Map<FullPageId, Integer> res,
+ PageMemory mem,
+ WALPointer start,
+ IgniteWriteAheadLogManager wal
+ ) throws Exception {
+ Map<FullPageId, byte[]> replay = new HashMap<>();
+
+ try (WALIterator it = wal.replay(start)) {
+ IgniteBiTuple<WALPointer, WALRecord> tup = it.nextX();
+
+ assertTrue("Invalid record: " + tup, tup.get2() instanceof CheckpointRecord);
+
+ CheckpointRecord cpRec = (CheckpointRecord)tup.get2();
+
+ while (it.hasNextX()) {
+ tup = it.nextX();
+
+ WALRecord rec = tup.get2();
+
+ if (rec instanceof CheckpointRecord) {
+ CheckpointRecord end = (CheckpointRecord)rec;
+
+ // Found the finish mark.
+ if (end.checkpointId().equals(cpRec.checkpointId()) && end.end())
+ break;
+ }
+ else if (rec instanceof PageSnapshot) {
+ PageSnapshot page = (PageSnapshot)rec;
+
+ replay.put(page.fullPageId(), page.pageData());
+ }
+ }
+ }
+
+ // Check read-through from the file store.
+ for (Map.Entry<FullPageId, Integer> entry : res.entrySet()) {
+ FullPageId fullId = entry.getKey();
+ int state = entry.getValue();
+
+ if (state == -1) {
+ info("Page was never written: " + fullId);
+
+ continue;
+ }
+
+ byte[] walData = replay.get(fullId);
+
+ assertNotNull("Missing WAL record for a written page: " + fullId, walData);
+
+ long page = mem.acquirePage(fullId.cacheId(), fullId.pageId());
+ try {
+ long pageAddr = mem.readLock(fullId.cacheId(), fullId.pageId(), page);
+
+ try {
+ for (int i = PageIO.COMMON_HEADER_END; i < mem.pageSize(); i++) {
+ assertEquals("Invalid state [pageId=" + fullId + ", pos=" + i + ']',
+ state & 0xFF, PageUtils.getByte(pageAddr, i) & 0xFF);
+
+ assertEquals("Invalid WAL state [pageId=" + fullId + ", pos=" + i + ']',
+ state & 0xFF, walData[i] & 0xFF);
+ }
+ }
+ finally {
+ mem.readUnlock(fullId.cacheId(), fullId.pageId(), page);
+ }
+ }
+ finally {
+ mem.releasePage(fullId.cacheId(), fullId.pageId(), page);
+ }
+ }
+ }
+
+ /**
+ * @param mem Memory to use.
+ * @param storeMgr Store manager.
+ * @param cacheId Cache ID.
+ * @return Result map of random operations.
+ * @throws Exception If failure occurred.
+ */
+ private IgniteBiTuple<Map<FullPageId, Integer>, WALPointer> runCheckpointing(
+ final IgniteEx ig,
+ final PageMemoryImpl mem,
+ final IgnitePageStoreManager storeMgr,
+ final IgniteWriteAheadLogManager wal,
+ final int cacheId
+ ) throws Exception {
+ final ConcurrentMap<FullPageId, Integer> resMap = new ConcurrentHashMap<>();
+
+ final FullPageId pages[] = new FullPageId[TOTAL_PAGES];
+
+ Set<FullPageId> allocated = new HashSet<>();
+
+ for (int i = 0; i < TOTAL_PAGES; i++) {
+ FullPageId fullId = new FullPageId(mem.allocatePage(cacheId, 0, PageIdAllocator.FLAG_DATA), cacheId);
+
+ resMap.put(fullId, -1);
+
+ pages[i] = fullId;
+
+ allocated.add(fullId);
+ }
+
+ final AtomicBoolean run = new AtomicBoolean(true);
+
+ // Simulate transaction lock.
+ final ReadWriteLock updLock = new ReentrantReadWriteLock();
+
+ // Mark the start position.
+ CheckpointRecord cpRec = new CheckpointRecord(null, false);
+
+ WALPointer start = wal.log(cpRec);
+
+ wal.fsync(start);
+
+ IgniteInternalFuture<Long> updFut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
+ @Override public Object call() throws Exception {
+ while (true) {
+ FullPageId fullId = pages[ThreadLocalRandom.current().nextInt(TOTAL_PAGES)];
+
+ updLock.readLock().lock();
+
+ try {
+ if (!run.get())
+ return null;
+
+ ig.context().cache().context().database().checkpointReadLock();
+
+ try {
+ long page = mem.acquirePage(fullId.cacheId(), fullId.pageId());
+
+ try {
+ long pageAddr = mem.writeLock(fullId.cacheId(), fullId.pageId(), page);
+
+ PageIO.setPageId(pageAddr, fullId.pageId());
+
+ try {
+ int state = resMap.get(fullId);
+
+ if (state != -1) {
+ if (VERBOSE)
+ info("Verify page [fullId=" + fullId + ", state=" + state +
+ ", buf=" + pageAddr +
+ ", bhc=" + U.hexLong(System.identityHashCode(pageAddr)) +
+ ", page=" + U.hexLong(System.identityHashCode(page)) + ']');
+
+ for (int i = PageIO.COMMON_HEADER_END; i < mem.pageSize(); i++)
+ assertEquals("Verify page failed [fullId=" + fullId +
+ ", i=" + i +
+ ", state=" + state +
+ ", buf=" + pageAddr +
+ ", bhc=" + U.hexLong(System.identityHashCode(pageAddr)) +
+ ", page=" + U.hexLong(System.identityHashCode(page)) + ']',
+ state & 0xFF, PageUtils.getByte(pageAddr, i) & 0xFF);
+ }
+
+ state = (state + 1) & 0xFF;
+
+ if (VERBOSE)
+ info("Write page [fullId=" + fullId + ", state=" + state +
+ ", buf=" + pageAddr +
+ ", bhc=" + U.hexLong(System.identityHashCode(pageAddr)) +
+ ", page=" + U.hexLong(System.identityHashCode(page)) + ']');
+
+ for (int i = PageIO.COMMON_HEADER_END; i < mem.pageSize(); i++)
+ PageUtils.putByte(pageAddr, i, (byte)state);
+
+ resMap.put(fullId, state);
+ }
+ finally {
+ mem.writeUnlock(fullId.cacheId(), fullId.pageId(),page, null,true);
+ }
+ }
+ finally {
+ mem.releasePage(fullId.cacheId(), fullId.pageId(),page);}
+ }
+ finally {
+ ig.context().cache().context().database().checkpointReadUnlock();
+ }
+ }
+ finally {
+ updLock.readLock().unlock();
+ }
+ }
+ }
+ }, 8, "update-thread");
+
+ int checkpoints = 20;
+
+ while (checkpoints > 0) {
+ Map<FullPageId, Integer> snapshot = null;
+
+ Collection<FullPageId> pageIds;
+
+ updLock.writeLock().lock();
+
+ try {
+ snapshot = new HashMap<>(resMap);
+
+ pageIds = mem.beginCheckpoint();
+
+ checkpoints--;
+
+ if (checkpoints == 0)
+ // No more writes should be done at this point.
+ run.set(false);
+
+ info("Acquired pages for checkpoint: " + pageIds.size());
+ }
+ finally {
+ updLock.writeLock().unlock();
+ }
+
+ boolean ok = false;
+
+ try {
+ ByteBuffer tmpBuf = ByteBuffer.allocate(mem.pageSize());
+
+ tmpBuf.order(ByteOrder.nativeOrder());
+
+ long begin = System.currentTimeMillis();
+
+ long cp = 0;
+
+ long write = 0;
+
+ for (FullPageId fullId : pageIds) {
+ long cpStart = System.nanoTime();
+
+ Integer tag = mem.getForCheckpoint(fullId, tmpBuf, null);
+
+ if (tag == null)
+ continue;
+
+ long cpEnd = System.nanoTime();
+
+ cp += cpEnd - cpStart;
+
+ Integer state = snapshot.get(fullId);
+
+ if (allocated.contains(fullId) && state != -1) {
+ tmpBuf.rewind();
+
+ Integer first = null;
+
+ for (int i = PageIO.COMMON_HEADER_END; i < mem.pageSize(); i++) {
+ int val = tmpBuf.get(i) & 0xFF;
+
+ if (first == null)
+ first = val;
+
+ // Avoid string concat.
+ if (first != val)
+ assertEquals("Corrupted buffer at position [pageId=" + fullId + ", pos=" + i + ']',
+ (int)first, val);
+
+ // Avoid string concat.
+ if (state != val)
+ assertEquals("Invalid value at position [pageId=" + fullId + ", pos=" + i + ']',
+ (int)state, val);
+ }
+ }
+
+ tmpBuf.rewind();
+
+ long writeStart = System.nanoTime();
+
+ storeMgr.write(cacheId, fullId.pageId(), tmpBuf, tag);
+
+ long writeEnd = System.nanoTime();
+
+ write += writeEnd - writeStart;
+
+ tmpBuf.rewind();
+ }
+
+ long syncStart = System.currentTimeMillis();
+
+ storeMgr.sync(cacheId, 0);
+
+ long end = System.currentTimeMillis();
+
+ info("Written pages in " + (end - begin) + "ms, copy took " + (cp / 1_000_000) + "ms, " +
+ "write took " + (write / 1_000_000) + "ms, sync took " + (end - syncStart) + "ms");
+
+ ok = true;
+ }
+ finally {
+ info("Finishing checkpoint...");
+
+ mem.finishCheckpoint();
+
+ info("Finished checkpoint");
+
+ if (!ok) {
+ info("Cancelling updates...");
+
+ run.set(false);
+
+ updFut.get();
+ }
+ }
+
+ if (checkpoints != 0)
+ Thread.sleep(2_000);
+ }
+
+ info("checkpoints=" + checkpoints + ", done=" + updFut.isDone());
+
+ updFut.get();
+
+ // Mark the end.
+ wal.fsync(wal.log(new CheckpointRecord(cpRec.checkpointId(), start, true)));
+
+ assertEquals(0, mem.activePagesCount());
+
+ for (FullPageId fullId : pages) {
+
+ long page = mem.acquirePage(fullId.cacheId(), fullId.pageId());
+
+ try {
+ assertFalse("Page has a temp heap copy after the last checkpoint: [cacheId=" +
+ fullId.cacheId() + ", pageId=" + fullId.pageId() + "]", mem.hasTempCopy(page));
+
+ assertFalse("Page is dirty after the last checkpoint: [cacheId=" +
+ fullId.cacheId() + ", pageId=" + fullId.pageId() + "]", mem.isDirty(fullId.cacheId(), fullId.pageId(), page));
+ }
+ finally {
+ mem.releasePage(fullId.cacheId(), fullId.pageId(), page);
+ }
+ }
+
+ return F.t((Map<FullPageId, Integer>)resMap, start);
+ }
+
+ /**
+ *
+ */
+ private void deleteWorkFiles() throws IgniteCheckedException {
+ deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4c8cc089/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/ignitePdsCheckpointSimulationTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/ignitePdsCheckpointSimulationTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/ignitePdsCheckpointSimulationTest.java
deleted file mode 100644
index 2716cdc..0000000
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/file/ignitePdsCheckpointSimulationTest.java
+++ /dev/null
@@ -1,1018 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.cache.persistence.db.file;
-
-import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.ThreadLocalRandom;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-import java.nio.ByteOrder;
-import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.cache.CacheRebalanceMode;
-import org.apache.ignite.configuration.CacheConfiguration;
-import org.apache.ignite.configuration.MemoryConfiguration;
-import org.apache.ignite.configuration.IgniteConfiguration;
-import org.apache.ignite.configuration.PersistentStoreConfiguration;
-import org.apache.ignite.configuration.WALMode;
-import org.apache.ignite.internal.IgniteEx;
-import org.apache.ignite.internal.IgniteInternalFuture;
-import org.apache.ignite.internal.pagemem.FullPageId;
-import org.apache.ignite.internal.pagemem.PageIdAllocator;
-import org.apache.ignite.internal.pagemem.PageMemory;
-import org.apache.ignite.internal.pagemem.PageUtils;
-import org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager;
-import org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryEx;
-import org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryImpl;
-import org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPageIO;
-import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
-import org.apache.ignite.internal.processors.cache.persistence.tree.io.TrackingPageIO;
-import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
-import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
-import org.apache.ignite.internal.pagemem.store.IgnitePageStoreManager;
-import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager;
-import org.apache.ignite.internal.pagemem.wal.WALIterator;
-import org.apache.ignite.internal.pagemem.wal.WALPointer;
-import org.apache.ignite.internal.pagemem.wal.record.CheckpointRecord;
-import org.apache.ignite.internal.pagemem.wal.record.DataEntry;
-import org.apache.ignite.internal.pagemem.wal.record.DataRecord;
-import org.apache.ignite.internal.pagemem.wal.record.PageSnapshot;
-import org.apache.ignite.internal.pagemem.wal.record.WALRecord;
-import org.apache.ignite.internal.processors.cache.CacheObject;
-import org.apache.ignite.internal.processors.cache.CacheObjectContext;
-import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheOperation;
-import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
-import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.lang.IgniteBiTuple;
-import org.apache.ignite.testframework.GridTestUtils;
-import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
-
-/**
- *
- */
-public class ignitePdsCheckpointSimulationTest extends GridCommonAbstractTest {
- /** */
- private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
-
- /** */
- private static final int TOTAL_PAGES = 1000;
-
- /** */
- private static final boolean VERBOSE = false;
-
- /** Cache name. */
- private final String cacheName = "cache";
-
- /** {@inheritDoc} */
- @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
- IgniteConfiguration cfg = super.getConfiguration(gridName);
-
- CacheConfiguration ccfg = new CacheConfiguration(cacheName);
-
- ccfg.setRebalanceMode(CacheRebalanceMode.NONE);
-
- cfg.setCacheConfiguration(ccfg);
-
- MemoryConfiguration dbCfg = new MemoryConfiguration();
-
- cfg.setMemoryConfiguration(dbCfg);
-
- cfg.setPersistentStoreConfiguration(
- new PersistentStoreConfiguration()
- .setCheckpointingFrequency(500)
- .setWalMode(WALMode.LOG_ONLY)
- .setAlwaysWriteFullPages(true)
- );
-
- TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
-
- discoSpi.setIpFinder(IP_FINDER);
-
- cfg.setDiscoverySpi(discoSpi);
-
- return cfg;
- }
-
- /** {@inheritDoc} */
- @Override protected void beforeTest() throws Exception {
- stopAllGrids();
-
- deleteWorkFiles();
- }
-
- /** {@inheritDoc} */
- @Override protected void afterTest() throws Exception {
- stopAllGrids();
-
- deleteWorkFiles();
- }
-
- /**
- * @throws Exception if failed.
- */
- public void testCheckpointSimulationMultiThreaded() throws Exception {
- IgniteEx ig = startGrid(0);
-
- ig.active(true);
-
- GridCacheSharedContext<Object, Object> shared = ig.context().cache().context();
-
- GridCacheDatabaseSharedManager dbMgr = (GridCacheDatabaseSharedManager)shared.database();
-
- IgnitePageStoreManager pageStore = shared.pageStore();
-
- U.sleep(1_000);
-
- // Disable integrated checkpoint thread.
- dbMgr.enableCheckpoints(false).get();
-
- // Must put something in partition 0 in order to initialize meta page.
- // Otherwise we will violate page store integrity rules.
- ig.cache(cacheName).put(0, 0);
-
- PageMemory mem = shared.database().memoryPolicy(null).pageMemory();
-
- IgniteBiTuple<Map<FullPageId, Integer>, WALPointer> res;
-
- try {
- res = runCheckpointing(ig, (PageMemoryImpl)mem, pageStore, shared.wal(),
- shared.cache().cache(cacheName).context().cacheId());
- }
- catch (Throwable th) {
- log().error("Error while running checkpointing", th);
-
- throw th;
- }
- finally {
- dbMgr.enableCheckpoints(true).get();
-
- stopAllGrids(false);
- }
-
- ig = startGrid(0);
-
- ig.active(true);
-
- shared = ig.context().cache().context();
-
- dbMgr = (GridCacheDatabaseSharedManager)shared.database();
-
- dbMgr.enableCheckpoints(false).get();
-
- mem = shared.database().memoryPolicy(null).pageMemory();
-
- verifyReads(res.get1(), mem, res.get2(), shared.wal());
- }
-
- /**
- * @throws Exception if failed.
- */
- public void testGetForInitialWrite() throws Exception {
- IgniteEx ig = startGrid(0);
-
- ig.active(true);
-
- GridCacheSharedContext<Object, Object> shared = ig.context().cache().context();
-
- int cacheId = shared.cache().cache(cacheName).context().cacheId();
-
- GridCacheDatabaseSharedManager dbMgr = (GridCacheDatabaseSharedManager)shared.database();
-
- // Disable integrated checkpoint thread.
- dbMgr.enableCheckpoints(false);
-
- PageMemory mem = shared.database().memoryPolicy(null).pageMemory();
-
- IgniteWriteAheadLogManager wal = shared.wal();
-
- WALPointer start = wal.log(new CheckpointRecord(null, false));
-
- final FullPageId[] initWrites = new FullPageId[10];
-
- ig.context().cache().context().database().checkpointReadLock();
-
- try {
- for (int i = 0; i < initWrites.length; i++)
- initWrites[i] = new FullPageId(mem.allocatePage(cacheId, 0, PageIdAllocator.FLAG_DATA), cacheId);
-
- // Check getForInitialWrite methods.
- for (FullPageId fullId : initWrites) {
- long page = mem.acquirePage(fullId.cacheId(), fullId.pageId());
- try {
- long pageAddr = mem.writeLock(fullId.cacheId(), fullId.pageId(), page);
-
- try {
- DataPageIO.VERSIONS.latest().initNewPage(pageAddr, fullId.pageId(), mem.pageSize());
-
- for (int i = PageIO.COMMON_HEADER_END; i < mem.pageSize(); i++)
- PageUtils.putByte(pageAddr, i, (byte)0xAB);
- }
- finally {
- mem.writeUnlock(fullId.cacheId(), fullId.pageId(), page, null, true);
- }
- }
- finally {
- mem.releasePage(fullId.cacheId(), fullId.pageId(), page);
- }
- }
-
- wal.fsync(null);
- }
- finally {
- ig.context().cache().context().database().checkpointReadUnlock();
- stopAllGrids(false);
- }
-
- ig = startGrid(0);
-
- ig.active(true);
-
- shared = ig.context().cache().context();
-
- dbMgr = (GridCacheDatabaseSharedManager)shared.database();
-
- dbMgr.enableCheckpoints(false);
-
- wal = shared.wal();
-
- try (WALIterator it = wal.replay(start)) {
- it.nextX();
-
- for (FullPageId initialWrite : initWrites) {
- IgniteBiTuple<WALPointer, WALRecord> tup = it.nextX();
-
- assertTrue(String.valueOf(tup.get2()), tup.get2() instanceof PageSnapshot);
-
- PageSnapshot snap = (PageSnapshot)tup.get2();
-
- FullPageId actual = snap.fullPageId();
-
- //there are extra tracking pages, skip them
- if (TrackingPageIO.VERSIONS.latest().trackingPageFor(actual.pageId(), mem.pageSize()) == actual.pageId()) {
- tup = it.nextX();
-
- assertTrue(tup.get2() instanceof PageSnapshot);
-
- actual = ((PageSnapshot)tup.get2()).fullPageId();
- }
-
- assertEquals(initialWrite, actual);
- }
- }
- }
-
- /**
- * @throws Exception if failed.
- */
- public void testDataWalEntries() throws Exception {
- IgniteEx ig = startGrid(0);
-
- ig.active(true);
-
- GridCacheSharedContext<Object, Object> sharedCtx = ig.context().cache().context();
- GridCacheContext<Object, Object> cctx = sharedCtx.cache().cache(cacheName).context();
-
- GridCacheDatabaseSharedManager db = (GridCacheDatabaseSharedManager)sharedCtx.database();
- IgniteWriteAheadLogManager wal = sharedCtx.wal();
-
- assertTrue(wal.isAlwaysWriteFullPages());
-
- db.enableCheckpoints(false);
-
- final int cnt = 10;
-
- List<DataEntry> entries = new ArrayList<>(cnt);
-
- for (int i = 0; i < cnt; i++) {
- GridCacheOperation op = i % 2 == 0 ? GridCacheOperation.UPDATE : GridCacheOperation.DELETE;
-
- KeyCacheObject key = cctx.toCacheKeyObject(i);
-
- CacheObject val = null;
-
- if (op != GridCacheOperation.DELETE)
- val = cctx.toCacheObject("value-" + i);
-
- entries.add(new DataEntry(cctx.cacheId(), key, val, op, null, cctx.versions().next(), 0L,
- cctx.affinity().partition(i), i));
- }
-
- UUID cpId = UUID.randomUUID();
-
- WALPointer start = wal.log(new CheckpointRecord(cpId, null, false));
-
- wal.fsync(start);
-
- for (DataEntry entry : entries)
- wal.log(new DataRecord(entry));
-
- WALPointer end = wal.log(new CheckpointRecord(cpId, start, true));
-
- wal.fsync(end);
-
- // Data will not be written to the page store.
- stopAllGrids();
-
- ig = startGrid(0);
-
- ig.active(true);
-
- sharedCtx = ig.context().cache().context();
- cctx = sharedCtx.cache().cache(cacheName).context();
-
- db = (GridCacheDatabaseSharedManager)sharedCtx.database();
- wal = sharedCtx.wal();
-
- db.enableCheckpoints(false);
-
- try (WALIterator it = wal.replay(start)) {
- IgniteBiTuple<WALPointer, WALRecord> tup = it.nextX();
-
- assert tup.get2() instanceof CheckpointRecord;
-
- assertEquals(start, tup.get1());
-
- CheckpointRecord cpRec = (CheckpointRecord)tup.get2();
-
- assertEquals(cpId, cpRec.checkpointId());
- assertNull(cpRec.checkpointMark());
- assertFalse(cpRec.end());
-
- int idx = 0;
- CacheObjectContext coctx = cctx.cacheObjectContext();
-
- while (idx < entries.size()) {
- tup = it.nextX();
-
- assert tup.get2() instanceof DataRecord;
-
- DataRecord dataRec = (DataRecord)tup.get2();
-
- DataEntry entry = entries.get(idx);
-
- assertEquals(1, dataRec.writeEntries().size());
-
- DataEntry readEntry = dataRec.writeEntries().get(0);
-
- assertEquals(entry.cacheId(), readEntry.cacheId());
- assertEquals(entry.key().<Integer>value(coctx, true), readEntry.key().<Integer>value(coctx, true));
- assertEquals(entry.op(), readEntry.op());
-
- if (entry.op() == GridCacheOperation.UPDATE)
- assertEquals(entry.value().value(coctx, true), readEntry.value().value(coctx, true));
- else
- assertNull(entry.value());
-
- assertEquals(entry.writeVersion(), readEntry.writeVersion());
- assertEquals(entry.nearXidVersion(), readEntry.nearXidVersion());
- assertEquals(entry.partitionCounter(), readEntry.partitionCounter());
-
- idx++;
- }
-
- tup = it.nextX();
-
- assert tup.get2() instanceof CheckpointRecord;
-
- assertEquals(end, tup.get1());
-
- cpRec = (CheckpointRecord)tup.get2();
-
- assertEquals(cpId, cpRec.checkpointId());
- assertEquals(start, cpRec.checkpointMark());
- assertTrue(cpRec.end());
- }
- }
-
- /**
- * @throws Exception if failed.
- */
- public void testPageWalEntries() throws Exception {
- IgniteEx ig = startGrid(0);
-
- ig.active(true);
-
- GridCacheSharedContext<Object, Object> sharedCtx = ig.context().cache().context();
- int cacheId = sharedCtx.cache().cache(cacheName).context().cacheId();
-
- GridCacheDatabaseSharedManager db = (GridCacheDatabaseSharedManager)sharedCtx.database();
- PageMemory pageMem = sharedCtx.database().memoryPolicy(null).pageMemory();
- IgniteWriteAheadLogManager wal = sharedCtx.wal();
-
- db.enableCheckpoints(false).get();
-
- int pageCnt = 100;
-
- List<FullPageId> pageIds = new ArrayList<>();
-
- for (int i = 0; i < pageCnt; i++) {
- db.checkpointReadLock();
- try {
- pageIds.add(new FullPageId(pageMem.allocatePage(cacheId, PageIdAllocator.INDEX_PARTITION,
- PageIdAllocator.FLAG_IDX), cacheId));
- }
- finally {
- db.checkpointReadUnlock();
- }
- }
-
- UUID cpId = UUID.randomUUID();
-
- WALPointer start = wal.log(new CheckpointRecord(cpId, null, false));
-
- wal.fsync(start);
-
- ig.context().cache().context().database().checkpointReadLock();
-
- try {
- for (FullPageId pageId : pageIds)
- writePageData(pageId, pageMem);
- }
- finally {
- ig.context().cache().context().database().checkpointReadUnlock();
- }
-
- WALPointer end = wal.log(new CheckpointRecord(cpId, start, true));
-
- wal.fsync(end);
-
- // Data will not be written to the page store.
- stopAllGrids();
-
- ig = startGrid(0);
-
- ig.active(true);
-
- sharedCtx = ig.context().cache().context();
-
- db = (GridCacheDatabaseSharedManager)sharedCtx.database();
- wal = sharedCtx.wal();
-
- db.enableCheckpoints(false);
-
- try (WALIterator it = wal.replay(start)) {
- IgniteBiTuple<WALPointer, WALRecord> tup = it.nextX();
-
- assert tup.get2() instanceof CheckpointRecord : tup.get2();
-
- assertEquals(start, tup.get1());
-
- CheckpointRecord cpRec = (CheckpointRecord)tup.get2();
-
- assertEquals(cpId, cpRec.checkpointId());
- assertNull(cpRec.checkpointMark());
- assertFalse(cpRec.end());
-
- int idx = 0;
-
- while (idx < pageIds.size()) {
- tup = it.nextX();
-
- assert tup.get2() instanceof PageSnapshot : tup.get2().getClass();
-
- PageSnapshot snap = (PageSnapshot)tup.get2();
-
- //there are extra tracking pages, skip them
- if (TrackingPageIO.VERSIONS.latest().trackingPageFor(snap.fullPageId().pageId(), pageMem.pageSize()) == snap.fullPageId().pageId()) {
- tup = it.nextX();
-
- assertTrue(tup.get2() instanceof PageSnapshot);
-
- snap = (PageSnapshot)tup.get2();
- }
-
- assertEquals(pageIds.get(idx), snap.fullPageId());
-
- idx++;
- }
-
- tup = it.nextX();
-
- assert tup.get2() instanceof CheckpointRecord;
-
- assertEquals(end, tup.get1());
-
- cpRec = (CheckpointRecord)tup.get2();
-
- assertEquals(cpId, cpRec.checkpointId());
- assertEquals(start, cpRec.checkpointMark());
- assertTrue(cpRec.end());
- }
- }
-
- /**
- * @throws Exception if failed.
- */
- public void testDirtyFlag() throws Exception {
- IgniteEx ig = startGrid(0);
-
- ig.active(true);
-
- GridCacheSharedContext<Object, Object> shared = ig.context().cache().context();
-
- int cacheId = shared.cache().cache(cacheName).context().cacheId();
-
- GridCacheDatabaseSharedManager dbMgr = (GridCacheDatabaseSharedManager)shared.database();
-
- // Disable integrated checkpoint thread.
- dbMgr.enableCheckpoints(false);
-
- PageMemoryEx mem = (PageMemoryEx) dbMgr.memoryPolicy(null).pageMemory();
-
- ig.context().cache().context().database().checkpointReadLock();
-
- FullPageId[] pageIds = new FullPageId[100];
-
- try {
- for (int i = 0; i < pageIds.length; i++)
- pageIds[i] = new FullPageId(mem.allocatePage(cacheId, 0, PageIdAllocator.FLAG_DATA), cacheId);
-
- for (FullPageId fullId : pageIds) {
- long page = mem.acquirePage(fullId.cacheId(), fullId.pageId());
-
- try {
- assertTrue(mem.isDirty(fullId.cacheId(), fullId.pageId(), page)); //page is dirty right after allocation
-
- long pageAddr = mem.writeLock(fullId.cacheId(), fullId.pageId(), page);
-
- PageIO.setPageId(pageAddr, fullId.pageId());
-
- try {
- assertTrue(mem.isDirty(fullId.cacheId(), fullId.pageId(), page));
- }
- finally {
- mem.writeUnlock(fullId.cacheId(), fullId.pageId(),page, null,true);
- }
-
- assertTrue(mem.isDirty(fullId.cacheId(), fullId.pageId(), page));
- }
- finally {
- mem.releasePage(fullId.cacheId(), fullId.pageId(), page);
- }
- }
- }
- finally {
- ig.context().cache().context().database().checkpointReadUnlock();
- }
-
- Collection<FullPageId> cpPages = mem.beginCheckpoint();
-
- ig.context().cache().context().database().checkpointReadLock();
-
- try {
- for (FullPageId fullId : pageIds) {
- assertTrue(cpPages.contains(fullId));
-
- ByteBuffer buf = ByteBuffer.allocate(mem.pageSize());
-
- long page = mem.acquirePage(fullId.cacheId(), fullId.pageId());
-
- try {
- assertTrue(mem.isDirty(fullId.cacheId(), fullId.pageId(), page));
-
- long pageAddr = mem.writeLock(fullId.cacheId(), fullId.pageId(), page);
-
- try {
- assertFalse(mem.isDirty(fullId.cacheId(), fullId.pageId(), page));
-
- for (int i = PageIO.COMMON_HEADER_END; i < mem.pageSize(); i++)
- PageUtils.putByte(pageAddr, i, (byte)1);
- }
- finally {
- mem.writeUnlock(fullId.cacheId(), fullId.pageId(), page, null, true);
- }
-
- assertTrue(mem.isDirty(fullId.cacheId(), fullId.pageId(), page));
-
- buf.rewind();
-
- mem.getForCheckpoint(fullId, buf, null);
-
- buf.position(PageIO.COMMON_HEADER_END);
-
- while (buf.hasRemaining())
- assertEquals((byte)0, buf.get());
- }
- finally {
- mem.releasePage(fullId.cacheId(), fullId.pageId(), page);
- }
- }
- }
- finally {
- ig.context().cache().context().database().checkpointReadUnlock();
- }
-
- mem.finishCheckpoint();
-
- for (FullPageId fullId : pageIds) {
- long page = mem.acquirePage(fullId.cacheId(), fullId.pageId());
- try {
- assertTrue(mem.isDirty(fullId.cacheId(), fullId.pageId(), page));
- }
- finally {
- mem.releasePage(fullId.cacheId(), fullId.pageId(), page);
- }
- }
- }
-
- /**
- * @throws Exception if failed.
- */
- private void writePageData(FullPageId fullId, PageMemory mem) throws Exception {
- long page = mem.acquirePage(fullId.cacheId(), fullId.pageId());
- try {
- long pageAddr = mem.writeLock(fullId.cacheId(), fullId.pageId(), page);
-
- try {
- DataPageIO.VERSIONS.latest().initNewPage(pageAddr, fullId.pageId(), mem.pageSize());
-
- ThreadLocalRandom rnd = ThreadLocalRandom.current();
-
- for (int i = PageIO.COMMON_HEADER_END; i < mem.pageSize(); i++)
- PageUtils.putByte(pageAddr, i, (byte)rnd.nextInt(255));
- }
- finally {
- mem.writeUnlock(fullId.cacheId(), fullId.pageId(), page, null, true);
- }
- }
- finally {
- mem.releasePage(fullId.cacheId(), fullId.pageId(), page);
- }
- }
-
- /**
- * @param res Result map to verify.
- * @param mem Memory.
- */
- private void verifyReads(
- Map<FullPageId, Integer> res,
- PageMemory mem,
- WALPointer start,
- IgniteWriteAheadLogManager wal
- ) throws Exception {
- Map<FullPageId, byte[]> replay = new HashMap<>();
-
- try (WALIterator it = wal.replay(start)) {
- IgniteBiTuple<WALPointer, WALRecord> tup = it.nextX();
-
- assertTrue("Invalid record: " + tup, tup.get2() instanceof CheckpointRecord);
-
- CheckpointRecord cpRec = (CheckpointRecord)tup.get2();
-
- while (it.hasNextX()) {
- tup = it.nextX();
-
- WALRecord rec = tup.get2();
-
- if (rec instanceof CheckpointRecord) {
- CheckpointRecord end = (CheckpointRecord)rec;
-
- // Found the finish mark.
- if (end.checkpointId().equals(cpRec.checkpointId()) && end.end())
- break;
- }
- else if (rec instanceof PageSnapshot) {
- PageSnapshot page = (PageSnapshot)rec;
-
- replay.put(page.fullPageId(), page.pageData());
- }
- }
- }
-
- // Check read-through from the file store.
- for (Map.Entry<FullPageId, Integer> entry : res.entrySet()) {
- FullPageId fullId = entry.getKey();
- int state = entry.getValue();
-
- if (state == -1) {
- info("Page was never written: " + fullId);
-
- continue;
- }
-
- byte[] walData = replay.get(fullId);
-
- assertNotNull("Missing WAL record for a written page: " + fullId, walData);
-
- long page = mem.acquirePage(fullId.cacheId(), fullId.pageId());
- try {
- long pageAddr = mem.readLock(fullId.cacheId(), fullId.pageId(), page);
-
- try {
- for (int i = PageIO.COMMON_HEADER_END; i < mem.pageSize(); i++) {
- assertEquals("Invalid state [pageId=" + fullId + ", pos=" + i + ']',
- state & 0xFF, PageUtils.getByte(pageAddr, i) & 0xFF);
-
- assertEquals("Invalid WAL state [pageId=" + fullId + ", pos=" + i + ']',
- state & 0xFF, walData[i] & 0xFF);
- }
- }
- finally {
- mem.readUnlock(fullId.cacheId(), fullId.pageId(), page);
- }
- }
- finally {
- mem.releasePage(fullId.cacheId(), fullId.pageId(), page);
- }
- }
- }
-
- /**
- * @param mem Memory to use.
- * @param storeMgr Store manager.
- * @param cacheId Cache ID.
- * @return Result map of random operations.
- * @throws Exception If failure occurred.
- */
- private IgniteBiTuple<Map<FullPageId, Integer>, WALPointer> runCheckpointing(
- final IgniteEx ig,
- final PageMemoryImpl mem,
- final IgnitePageStoreManager storeMgr,
- final IgniteWriteAheadLogManager wal,
- final int cacheId
- ) throws Exception {
- final ConcurrentMap<FullPageId, Integer> resMap = new ConcurrentHashMap<>();
-
- final FullPageId pages[] = new FullPageId[TOTAL_PAGES];
-
- Set<FullPageId> allocated = new HashSet<>();
-
- for (int i = 0; i < TOTAL_PAGES; i++) {
- FullPageId fullId = new FullPageId(mem.allocatePage(cacheId, 0, PageIdAllocator.FLAG_DATA), cacheId);
-
- resMap.put(fullId, -1);
-
- pages[i] = fullId;
-
- allocated.add(fullId);
- }
-
- final AtomicBoolean run = new AtomicBoolean(true);
-
- // Simulate transaction lock.
- final ReadWriteLock updLock = new ReentrantReadWriteLock();
-
- // Mark the start position.
- CheckpointRecord cpRec = new CheckpointRecord(null, false);
-
- WALPointer start = wal.log(cpRec);
-
- wal.fsync(start);
-
- IgniteInternalFuture<Long> updFut = GridTestUtils.runMultiThreadedAsync(new Callable<Object>() {
- @Override public Object call() throws Exception {
- while (true) {
- FullPageId fullId = pages[ThreadLocalRandom.current().nextInt(TOTAL_PAGES)];
-
- updLock.readLock().lock();
-
- try {
- if (!run.get())
- return null;
-
- ig.context().cache().context().database().checkpointReadLock();
-
- try {
- long page = mem.acquirePage(fullId.cacheId(), fullId.pageId());
-
- try {
- long pageAddr = mem.writeLock(fullId.cacheId(), fullId.pageId(), page);
-
- PageIO.setPageId(pageAddr, fullId.pageId());
-
- try {
- int state = resMap.get(fullId);
-
- if (state != -1) {
- if (VERBOSE)
- info("Verify page [fullId=" + fullId + ", state=" + state +
- ", buf=" + pageAddr +
- ", bhc=" + U.hexLong(System.identityHashCode(pageAddr)) +
- ", page=" + U.hexLong(System.identityHashCode(page)) + ']');
-
- for (int i = PageIO.COMMON_HEADER_END; i < mem.pageSize(); i++)
- assertEquals("Verify page failed [fullId=" + fullId +
- ", i=" + i +
- ", state=" + state +
- ", buf=" + pageAddr +
- ", bhc=" + U.hexLong(System.identityHashCode(pageAddr)) +
- ", page=" + U.hexLong(System.identityHashCode(page)) + ']',
- state & 0xFF, PageUtils.getByte(pageAddr, i) & 0xFF);
- }
-
- state = (state + 1) & 0xFF;
-
- if (VERBOSE)
- info("Write page [fullId=" + fullId + ", state=" + state +
- ", buf=" + pageAddr +
- ", bhc=" + U.hexLong(System.identityHashCode(pageAddr)) +
- ", page=" + U.hexLong(System.identityHashCode(page)) + ']');
-
- for (int i = PageIO.COMMON_HEADER_END; i < mem.pageSize(); i++)
- PageUtils.putByte(pageAddr, i, (byte)state);
-
- resMap.put(fullId, state);
- }
- finally {
- mem.writeUnlock(fullId.cacheId(), fullId.pageId(),page, null,true);
- }
- }
- finally {
- mem.releasePage(fullId.cacheId(), fullId.pageId(),page);}
- }
- finally {
- ig.context().cache().context().database().checkpointReadUnlock();
- }
- }
- finally {
- updLock.readLock().unlock();
- }
- }
- }
- }, 8, "update-thread");
-
- int checkpoints = 20;
-
- while (checkpoints > 0) {
- Map<FullPageId, Integer> snapshot = null;
-
- Collection<FullPageId> pageIds;
-
- updLock.writeLock().lock();
-
- try {
- snapshot = new HashMap<>(resMap);
-
- pageIds = mem.beginCheckpoint();
-
- checkpoints--;
-
- if (checkpoints == 0)
- // No more writes should be done at this point.
- run.set(false);
-
- info("Acquired pages for checkpoint: " + pageIds.size());
- }
- finally {
- updLock.writeLock().unlock();
- }
-
- boolean ok = false;
-
- try {
- ByteBuffer tmpBuf = ByteBuffer.allocate(mem.pageSize());
-
- tmpBuf.order(ByteOrder.nativeOrder());
-
- long begin = System.currentTimeMillis();
-
- long cp = 0;
-
- long write = 0;
-
- for (FullPageId fullId : pageIds) {
- long cpStart = System.nanoTime();
-
- Integer tag = mem.getForCheckpoint(fullId, tmpBuf, null);
-
- if (tag == null)
- continue;
-
- long cpEnd = System.nanoTime();
-
- cp += cpEnd - cpStart;
-
- Integer state = snapshot.get(fullId);
-
- if (allocated.contains(fullId) && state != -1) {
- tmpBuf.rewind();
-
- Integer first = null;
-
- for (int i = PageIO.COMMON_HEADER_END; i < mem.pageSize(); i++) {
- int val = tmpBuf.get(i) & 0xFF;
-
- if (first == null)
- first = val;
-
- // Avoid string concat.
- if (first != val)
- assertEquals("Corrupted buffer at position [pageId=" + fullId + ", pos=" + i + ']',
- (int)first, val);
-
- // Avoid string concat.
- if (state != val)
- assertEquals("Invalid value at position [pageId=" + fullId + ", pos=" + i + ']',
- (int)state, val);
- }
- }
-
- tmpBuf.rewind();
-
- long writeStart = System.nanoTime();
-
- storeMgr.write(cacheId, fullId.pageId(), tmpBuf, tag);
-
- long writeEnd = System.nanoTime();
-
- write += writeEnd - writeStart;
-
- tmpBuf.rewind();
- }
-
- long syncStart = System.currentTimeMillis();
-
- storeMgr.sync(cacheId, 0);
-
- long end = System.currentTimeMillis();
-
- info("Written pages in " + (end - begin) + "ms, copy took " + (cp / 1_000_000) + "ms, " +
- "write took " + (write / 1_000_000) + "ms, sync took " + (end - syncStart) + "ms");
-
- ok = true;
- }
- finally {
- info("Finishing checkpoint...");
-
- mem.finishCheckpoint();
-
- info("Finished checkpoint");
-
- if (!ok) {
- info("Cancelling updates...");
-
- run.set(false);
-
- updFut.get();
- }
- }
-
- if (checkpoints != 0)
- Thread.sleep(2_000);
- }
-
- info("checkpoints=" + checkpoints + ", done=" + updFut.isDone());
-
- updFut.get();
-
- // Mark the end.
- wal.fsync(wal.log(new CheckpointRecord(cpRec.checkpointId(), start, true)));
-
- assertEquals(0, mem.activePagesCount());
-
- for (FullPageId fullId : pages) {
-
- long page = mem.acquirePage(fullId.cacheId(), fullId.pageId());
-
- try {
- assertFalse("Page has a temp heap copy after the last checkpoint: [cacheId=" +
- fullId.cacheId() + ", pageId=" + fullId.pageId() + "]", mem.hasTempCopy(page));
-
- assertFalse("Page is dirty after the last checkpoint: [cacheId=" +
- fullId.cacheId() + ", pageId=" + fullId.pageId() + "]", mem.isDirty(fullId.cacheId(), fullId.pageId(), page));
- }
- finally {
- mem.releasePage(fullId.cacheId(), fullId.pageId(), page);
- }
- }
-
- return F.t((Map<FullPageId, Integer>)resMap, start);
- }
-
- /**
- *
- */
- private void deleteWorkFiles() throws IgniteCheckedException {
- deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/4c8cc089/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite.java
index dd0c3e4..68c6651 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite.java
@@ -22,7 +22,7 @@ import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsClientNe
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsDynamicCacheTest;
import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsSingleNodePutGetPersistenceTest;
import org.apache.ignite.internal.processors.cache.persistence.db.file.IgnitePdsEvictionTest;
-import org.apache.ignite.internal.processors.cache.persistence.db.file.ignitePdsCheckpointSimulationTest;
+import org.apache.ignite.internal.processors.cache.persistence.db.file.IgnitePdsCheckpointSimulationWithRealCpDisabledTest;
import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalDirectoriesConfigurationTest;
import org.apache.ignite.internal.processors.cache.persistence.pagemem.BPlusTreePageMemoryImplTest;
import org.apache.ignite.internal.processors.cache.persistence.pagemem.BPlusTreeReuseListPageMemoryImplTest;
@@ -54,7 +54,7 @@ public class IgnitePdsTestSuite extends TestSuite {
suite.addTestSuite(PageMemoryImplTest.class);
// Checkpointing smoke-test.
- suite.addTestSuite(ignitePdsCheckpointSimulationTest.class);
+ suite.addTestSuite(IgnitePdsCheckpointSimulationWithRealCpDisabledTest.class);
// BTree tests with store page memory.
suite.addTestSuite(BPlusTreePageMemoryImplTest.class);
[34/50] ignite git commit: Merge branch 'ignite-2.1.1' of
https://github.com/gridgain/apache-ignite into ignite-5519
Posted by sb...@apache.org.
Merge branch 'ignite-2.1.1' of https://github.com/gridgain/apache-ignite into ignite-5519
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/1c653cb2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/1c653cb2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/1c653cb2
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 1c653cb2d432bb6d629a654e02be0a17c0765b36
Parents: 993c021 1feca21
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Sat Jun 17 17:33:59 2017 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Sat Jun 17 17:33:59 2017 +0300
----------------------------------------------------------------------
.../datastructures/DataStructuresProcessor.java | 2 +-
.../datastructures/GridCacheInternalKeyImpl.java | 14 ++++++++++++--
.../ignite/internal/visor/util/VisorTaskUtils.java | 3 ++-
3 files changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
[09/50] ignite git commit: Merge problem fix: unused field removal
Posted by sb...@apache.org.
Merge problem fix: unused field removal
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f391196b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f391196b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f391196b
Branch: refs/heads/ignite-2.1.2-exchange
Commit: f391196b44bf2f7577e7c989785df38fa66e801b
Parents: be804b9
Author: dpavlov <dp...@gridgain.com>
Authored: Fri Jun 16 15:34:40 2017 +0300
Committer: dpavlov <dp...@gridgain.com>
Committed: Fri Jun 16 17:59:46 2017 +0300
----------------------------------------------------------------------
.../cache/persistence/GridCacheDatabaseSharedManager.java | 4 ----
1 file changed, 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f391196b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index 0e3aced..9bc56e7 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -2444,9 +2444,6 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
/** Number of deleted WAL files. */
private int walFilesDeleted;
- /** Number of deleted WAL files. */
- private int walHistorySize;
-
/** */
private final int pagesSize;
@@ -2713,7 +2710,6 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
}
chp.walFilesDeleted = deleted;
- chp.walHistorySize = histMap.size();
}
/**
[23/50] ignite git commit: ignite-5503 New compare topology versions
for dhtPartMap comparison
Posted by sb...@apache.org.
ignite-5503 New compare topology versions for dhtPartMap comparison
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7603b0cd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7603b0cd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7603b0cd
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 7603b0cd78b53b5c26c4e4f79eb8f0709681784d
Parents: 44c723c
Author: Pavel Kovalenko <jo...@gmail.com>
Authored: Sat Jun 17 09:09:58 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Sat Jun 17 09:09:58 2017 +0300
----------------------------------------------------------------------
.../dht/GridClientPartitionTopology.java | 20 +++++++++++++++++---
.../dht/GridDhtPartitionTopologyImpl.java | 20 +++++++++++++++++---
.../dht/preloader/GridDhtPartitionMap.java | 4 ++--
.../CacheLateAffinityAssignmentTest.java | 2 --
4 files changed, 36 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7603b0cd/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 7713caa..20b6296 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
@@ -688,6 +688,20 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
}
}
+ /**
+ * Method checks is new partition map more stale than current partition map
+ * New partition map is stale if topology version or update sequence are less than of current map
+ *
+ * @param currentMap Current partition map
+ * @param newMap New partition map
+ * @return True if new partition map is more stale than current partition map, false in other case
+ */
+ private boolean isStaleUpdate(GridDhtPartitionMap currentMap, GridDhtPartitionMap newMap) {
+ return currentMap != null &&
+ (newMap.topologyVersion().compareTo(currentMap.topologyVersion()) < 0 ||
+ newMap.topologyVersion().compareTo(currentMap.topologyVersion()) == 0 && newMap.updateSequence() <= currentMap.updateSequence());
+ }
+
/** {@inheritDoc} */
@SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
@Nullable @Override public GridDhtPartitionMap update(
@@ -728,10 +742,10 @@ public class GridClientPartitionTopology implements GridDhtPartitionTopology {
GridDhtPartitionMap cur = node2part.get(parts.nodeId());
- if (cur != null && cur.updateSequence() >= parts.updateSequence()) {
+ if (isStaleUpdate(cur, parts)) {
if (log.isDebugEnabled())
- log.debug("Stale update sequence for single partition map update (will ignore) [exchId=" + exchId +
- ", curSeq=" + cur.updateSequence() + ", newSeq=" + parts.updateSequence() + ']');
+ log.debug("Stale update for single partition map update (will ignore) [exchId=" + exchId +
+ ", curMap=" + cur + ", newMap=" + parts + ']');
return null;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7603b0cd/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 3c626f0..53f7523 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
@@ -1314,6 +1314,20 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
}
}
+ /**
+ * Method checks is new partition map more stale than current partition map
+ * New partition map is stale if topology version or update sequence are less than of current map
+ *
+ * @param currentMap Current partition map
+ * @param newMap New partition map
+ * @return True if new partition map is more stale than current partition map, false in other case
+ */
+ private boolean isStaleUpdate(GridDhtPartitionMap currentMap, GridDhtPartitionMap newMap) {
+ return currentMap != null &&
+ (newMap.topologyVersion().compareTo(currentMap.topologyVersion()) < 0 ||
+ newMap.topologyVersion().compareTo(currentMap.topologyVersion()) == 0 && newMap.updateSequence() <= currentMap.updateSequence());
+ }
+
/** {@inheritDoc} */
@SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
@Nullable @Override public GridDhtPartitionMap update(
@@ -1354,10 +1368,10 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
GridDhtPartitionMap cur = node2part.get(parts.nodeId());
- if (cur != null && cur.updateSequence() >= parts.updateSequence()) {
+ if (isStaleUpdate(cur, parts)) {
if (log.isDebugEnabled())
- log.debug("Stale update sequence for single partition map update (will ignore) [exchId=" + exchId +
- ", curSeq=" + cur.updateSequence() + ", newSeq=" + parts.updateSequence() + ']');
+ log.debug("Stale update for single partition map update (will ignore) [exchId=" + exchId +
+ ", curMap=" + cur + ", newMap=" + parts + ']');
return null;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7603b0cd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
index fa253fc..0b44d3c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionMap.java
@@ -313,11 +313,11 @@ public class GridDhtPartitionMap implements Comparable<GridDhtPartitionMap>, Ext
* @return Full string representation.
*/
public String toFullString() {
- return S.toString(GridDhtPartitionMap.class, this, "size", size(), "map", map.toString(), "top", top);
+ return S.toString(GridDhtPartitionMap.class, this, "top", top, "updateSeq", updateSeq, "size", size(), "map", map.toString());
}
/** {@inheritDoc} */
@Override public String toString() {
- return S.toString(GridDhtPartitionMap.class, this, "size", size());
+ return S.toString(GridDhtPartitionMap.class, this, "top", top, "updateSeq", updateSeq, "size", size());
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7603b0cd/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
index b1610d4..6fac920 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/CacheLateAffinityAssignmentTest.java
@@ -514,8 +514,6 @@ public class CacheLateAffinityAssignmentTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
private void cacheDestroyAndCreate(boolean cacheOnCrd) throws Exception {
- fail("IGNITE-5503");
-
if (!cacheOnCrd)
cacheNodeFilter = new CacheNodeFilter(Collections.singletonList(getTestIgniteInstanceName(0)));
[21/50] ignite git commit: Fixed incorrect handling of DS in cache
not present on local node.
Posted by sb...@apache.org.
Fixed incorrect handling of DS in cache not present on local node.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3a165859
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3a165859
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3a165859
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 3a1658590d028c42435f47fcccceedaa11c9d436
Parents: 636ddb0
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Sat Jun 17 00:03:54 2017 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Sat Jun 17 00:03:54 2017 +0300
----------------------------------------------------------------------
.../processors/datastructures/DataStructuresProcessor.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3a165859/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
index 441f4b4..52cc9e9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/DataStructuresProcessor.java
@@ -505,7 +505,7 @@ public final class DataStructuresProcessor extends GridProcessorAdapter implemen
IgniteInternalCache<GridCacheInternalKey, AtomicDataStructureValue> cache0 = ctx.cache().cache(cacheName);
if (cache0 == null) {
- if (!create)
+ if (!create && ctx.cache().cacheDescriptor(cacheName) == null)
return null;
ctx.cache().dynamicStartCache(cacheConfiguration(cfg, cacheName, grpName),
[50/50] ignite git commit: exchange time info
Posted by sb...@apache.org.
exchange time info
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e6bcaf5d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e6bcaf5d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e6bcaf5d
Branch: refs/heads/ignite-2.1.2-exchange
Commit: e6bcaf5dda92f49feb791d06c94748eef7a10695
Parents: b544678
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 20 08:59:36 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 20 08:59:36 2017 +0300
----------------------------------------------------------------------
.../GridDhtPartitionsExchangeFuture.java | 110 ++++++++++++++++++-
1 file changed, 109 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e6bcaf5d/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index 230a25c..0e05aea 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -18,9 +18,12 @@
package org.apache.ignite.internal.processors.cache.distributed.dht.preloader;
import java.io.IOException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -31,6 +34,7 @@ import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.ReadWriteLock;
import org.apache.ignite.IgniteCheckedException;
@@ -75,6 +79,7 @@ import org.apache.ignite.internal.processors.cache.transactions.IgniteTxKey;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersion;
import org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor;
import org.apache.ignite.internal.processors.timeout.GridTimeoutObjectAdapter;
+import org.apache.ignite.internal.util.GridAtomicLong;
import org.apache.ignite.internal.util.future.GridFutureAdapter;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.tostring.GridToStringInclude;
@@ -201,6 +206,20 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
/** */
private boolean clientOnlyExchange;
+ /** */
+ @GridToStringExclude
+ private long createTs;
+
+ /** */
+ @GridToStringExclude
+ private long initTime;
+
+ /** */
+ private long sndTs;
+
+ /** */
+ private long rcvTs;
+
/** Init timestamp. Used to track the amount of time spent to complete the future. */
private long initTs;
@@ -311,6 +330,8 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
assert exchId.topologyVersion() != null;
assert exchActions == null || !exchActions.empty();
+ createTs = U.currentTimeMillis();
+
dummy = false;
forcePreload = false;
reassign = false;
@@ -592,6 +613,8 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
updateTopologies(crdNode);
+ initTime = U.currentTimeMillis() - initTs;
+
switch (exchange) {
case ALL: {
distributedExchange();
@@ -889,8 +912,11 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
if (remaining.isEmpty())
onAllReceived();
}
- else
+ else {
+ sndTs = U.currentTimeMillis();
+
sendPartitions(crd);
+ }
initDone();
}
@@ -1177,6 +1203,8 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
assert !nodes.contains(cctx.localNode());
+ sndTs = U.currentTimeMillis();
+
if (log.isDebugEnabled())
log.debug("Sending full partition map [nodeIds=" + F.viewReadOnly(nodes, F.node2id()) +
", exchId=" + exchId + ", msg=" + m + ']');
@@ -1211,6 +1239,21 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
return discoEvt.type() != EVT_DISCOVERY_CUSTOM_EVT && !CU.clientNode(discoEvt.eventNode());
}
+ /** */
+ static ThreadLocal<DateFormat> format = new ThreadLocal<DateFormat>() {
+ @Override protected DateFormat initialValue() {
+ return new SimpleDateFormat("HH:mm:ss.SSS");
+ }
+ };
+
+ /**
+ * @param time Time.
+ * @return Time string.
+ */
+ private static String formatTime(long time) {
+ return format.get().format(new Date(time));
+ }
+
/** {@inheritDoc} */
@Override public boolean onDone(@Nullable AffinityTopologyVersion res, @Nullable Throwable err) {
boolean realExchange = !dummy && !forcePreload;
@@ -1306,6 +1349,50 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
}
if (super.onDone(res, err) && realExchange) {
+ boolean crd;
+
+ synchronized (this) {
+ crd = this.crd != null && this.crd.isLocal();
+ }
+
+ long curTime = U.currentTimeMillis();
+
+ if (!crd) {
+ exchLog.info("Completed exchange [topVer=" + topologyVersion() +
+ ", crd=false" +
+ ", futCreateTs=" + formatTime(createTs) +
+ ", futInitTs=" + formatTime(initTs) +
+ ", initWaitTime=" + (initTs - createTs) +
+ ", initDuration=" + initTime +
+ ", sndTs=" + formatTime(sndTs) +
+ ", rcvTs=" + formatTime(rcvTs) +
+ ", rcvWaitTime=" + (rcvTs - sndTs) +
+ ", endTs=" + formatTime(curTime) +
+ ", durationFromInit=" + (curTime - initTs) +
+ ", durationFromCreate=" + (curTime - createTs)
+ + ']');
+ }
+ else {
+ int rcvd = cnt.get();
+
+ exchLog.info("Completed exchange [topVer=" + topologyVersion() +
+ ", crd=true" +
+ ", futCreateTs=" + formatTime(createTs) +
+ ", futInitTs=" + formatTime(initTs) +
+ ", initWaitTime=" + (initTs - createTs) +
+ ", initDuration=" + initTime +
+ ", rcvdCnt=" + rcvd +
+ ", beforeInitCnt=" + beforeInitCnt.get() +
+ ", minProcTime=" + minTime.get() +
+ ", maxProcTime=" + maxTime.get() +
+ ", avgProcTime=" + (rcvd > 0 ? (totTime.get()/ (float)rcvd) : 0) +
+ ", sndTs=" + formatTime(sndTs) +
+ ", endTs=" + formatTime(curTime) +
+ ", durationFromInit=" + (curTime - initTs) +
+ ", durationFromCreate=" + (curTime - createTs)
+ + ']');
+ }
+
if (log.isDebugEnabled())
log.debug("Completed partition exchange [localNode=" + cctx.localNodeId() + ", exchange= " + this +
", durationFromInit=" + (U.currentTimeMillis() - initTs) + ']');
@@ -1397,6 +1484,9 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
sendAllPartitions(node.id(), cctx.gridConfig().getNetworkSendRetryCount());
}
else {
+ if (!initFut.isDone())
+ beforeInitCnt.incrementAndGet();
+
initFut.listen(new CI1<IgniteInternalFuture<Boolean>>() {
@Override public void apply(IgniteInternalFuture<Boolean> f) {
try {
@@ -1415,6 +1505,12 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
}
}
+ private AtomicInteger beforeInitCnt = new AtomicInteger();
+ private AtomicInteger cnt = new AtomicInteger();
+ private GridAtomicLong minTime = new GridAtomicLong(Long.MAX_VALUE);
+ private GridAtomicLong maxTime = new GridAtomicLong();
+ private GridAtomicLong totTime = new GridAtomicLong();
+
/**
* @param node Sender node.
* @param msg Message.
@@ -1444,7 +1540,17 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
if (updateSingleMap) {
try {
+ cnt.incrementAndGet();
+
+ long start = U.currentTimeMillis();
+
updatePartitionSingleMap(node, msg);
+
+ long time = U.currentTimeMillis() - start;
+
+ minTime.setIfLess(time);
+ maxTime.setIfGreater(time);
+ totTime.addAndGet(time);
}
finally {
synchronized (this) {
@@ -1903,6 +2009,8 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
}
}
+ rcvTs = U.currentTimeMillis();
+
updatePartitionFullMap(msg);
if (exchangeOnChangeGlobalState && !F.isEmpty(msg.getExceptionsMap()))
[41/50] ignite git commit: Fixed initialization of
PartitionCountersPage.
Posted by sb...@apache.org.
Fixed initialization of PartitionCountersPage.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6143bc96
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6143bc96
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6143bc96
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 6143bc96917409af9e267af789d802883945867a
Parents: 59ea90d
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Sun Jun 18 10:11:58 2017 +0300
Committer: devozerov <pp...@gmail.com>
Committed: Sun Jun 18 10:11:58 2017 +0300
----------------------------------------------------------------------
.../processors/cache/persistence/GridCacheOffheapManager.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6143bc96/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
index eb9f4df..5a35490 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheOffheapManager.java
@@ -242,7 +242,7 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
boolean init = cntrsPageId == 0;
- if (init) {
+ if (init && items > 0) {
cntrsPageId = pageMem.allocatePage(grpId, store.partId(), PageIdAllocator.FLAG_DATA);
io.setCountersPageId(pageAddr, cntrsPageId);
[12/50] ignite git commit: IGNITE-5524: Fixed IgniteComputeImpl
deserialization.
Posted by sb...@apache.org.
IGNITE-5524: Fixed IgniteComputeImpl deserialization.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5376f229
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5376f229
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5376f229
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 5376f22918627e53aeade5abd97726b710e53090
Parents: c99639c
Author: devozerov <vo...@gridgain.com>
Authored: Fri Jun 16 18:29:37 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Fri Jun 16 18:29:37 2017 +0300
----------------------------------------------------------------------
.../main/java/org/apache/ignite/internal/IgniteComputeImpl.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5376f229/modules/core/src/main/java/org/apache/ignite/internal/IgniteComputeImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteComputeImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteComputeImpl.java
index 034a26a..06619f9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteComputeImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteComputeImpl.java
@@ -1103,7 +1103,7 @@ public class IgniteComputeImpl extends AsyncSupportAdapter<IgniteCompute>
* @throws ObjectStreamException Thrown in case of unmarshalling error.
*/
protected Object readResolve() throws ObjectStreamException {
- return prj.compute().withExecutor(execName);
+ return execName == null ? prj.compute() : prj.compute().withExecutor(execName);
}
/** {@inheritDoc} */
[44/50] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-2.1.2
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-2.1.2
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/28d72d84
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/28d72d84
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/28d72d84
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 28d72d841d9df333b150937d61ee831207668e37
Parents: fefffc0 7d3c5d0
Author: sboikov <sb...@gridgain.com>
Authored: Mon Jun 19 20:12:33 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Jun 19 20:12:33 2017 +0300
----------------------------------------------------------------------
.../distributed/GridDistributedLockRequest.java | 20 +
.../GridDistributedTxPrepareRequest.java | 20 +
.../distributed/dht/GridDhtLockFuture.java | 1 +
.../distributed/dht/GridDhtLockRequest.java | 4 +
.../dht/GridDhtTransactionalCacheAdapter.java | 3 +-
.../distributed/dht/GridDhtTxPrepareFuture.java | 2 +
.../dht/GridDhtTxPrepareRequest.java | 5 +-
.../cache/distributed/dht/GridDhtTxRemote.java | 24 +-
.../cache/transactions/IgniteTxHandler.java | 3 +-
.../processors/odbc/odbc/OdbcMessageParser.java | 55 ++-
.../odbc/odbc/OdbcQueryExecuteBatchRequest.java | 95 +++++
.../odbc/odbc/OdbcQueryExecuteBatchResult.java | 75 ++++
.../odbc/odbc/OdbcQueryExecuteRequest.java | 6 +-
.../odbc/odbc/OdbcQueryExecuteResult.java | 2 +-
.../processors/odbc/odbc/OdbcRequest.java | 4 +-
.../odbc/odbc/OdbcRequestHandler.java | 108 ++++-
.../IgniteTxCachePrimarySyncTest.java | 34 +-
.../IgniteCachePutRetryAbstractSelfTest.java | 37 +-
.../dht/TxRecoveryStoreEnabledTest.java | 231 +++++++++++
.../IgniteCacheTxRecoverySelfTestSuite.java | 2 +
.../platforms/cpp/core-test/src/test_utils.cpp | 1 +
.../src/application_data_buffer_test.cpp | 176 +++-----
.../platforms/cpp/odbc-test/src/column_test.cpp | 21 +-
.../cpp/odbc-test/src/queries_test.cpp | 404 +++++++++++++++++-
.../platforms/cpp/odbc-test/src/row_test.cpp | 9 +-
.../platforms/cpp/odbc-test/src/test_utils.cpp | 1 +
modules/platforms/cpp/odbc/Makefile.am | 3 +
modules/platforms/cpp/odbc/include/Makefile.am | 2 +
.../ignite/odbc/app/application_data_buffer.h | 38 +-
.../odbc/include/ignite/odbc/app/parameter.h | 20 +-
.../include/ignite/odbc/app/parameter_set.h | 268 ++++++++++++
.../ignite/odbc/diagnostic/diagnosable.h | 4 +-
.../cpp/odbc/include/ignite/odbc/message.h | 411 +++++++------------
.../include/ignite/odbc/query/batch_query.h | 160 ++++++++
.../odbc/include/ignite/odbc/query/data_query.h | 12 +-
.../cpp/odbc/include/ignite/odbc/query/query.h | 3 +
.../include/ignite/odbc/query/type_info_query.h | 2 +-
.../cpp/odbc/include/ignite/odbc/statement.h | 50 +--
.../platforms/cpp/odbc/project/vs/odbc.vcxproj | 5 +
.../cpp/odbc/project/vs/odbc.vcxproj.filters | 15 +
.../odbc/src/app/application_data_buffer.cpp | 90 +++-
.../platforms/cpp/odbc/src/app/parameter.cpp | 11 +-
.../cpp/odbc/src/app/parameter_set.cpp | 242 +++++++++++
modules/platforms/cpp/odbc/src/column.cpp | 1 -
.../cpp/odbc/src/config/connection_info.cpp | 36 ++
modules/platforms/cpp/odbc/src/message.cpp | 373 +++++++++++++++++
.../cpp/odbc/src/query/batch_query.cpp | 198 +++++++++
.../platforms/cpp/odbc/src/query/data_query.cpp | 13 +-
modules/platforms/cpp/odbc/src/statement.cpp | 250 ++++++-----
49 files changed, 2893 insertions(+), 657 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/28d72d84/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtLockFuture.java
----------------------------------------------------------------------
[17/50] ignite git commit: ignite-gg-12301 fix assert message
Posted by sb...@apache.org.
ignite-gg-12301 fix assert message
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8c04df63
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8c04df63
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8c04df63
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 8c04df63f128f2c09ae57b0897deb65f94537202
Parents: 01e5cfb
Author: Dmitriy Govorukhin <dm...@gmail.com>
Authored: Fri Jun 16 21:28:13 2017 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Fri Jun 16 21:28:13 2017 +0300
----------------------------------------------------------------------
.../persistence/standbycluster/IgniteChangeGlobalStateTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8c04df63/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
index f8f73da..0df8fe0 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
@@ -495,7 +495,7 @@ public class IgniteChangeGlobalStateTest extends IgniteChangeGlobalStateAbstract
IgniteAtomicSequence seq = ig.atomicSequence("seq", 0, true);
return null;
}
- }, IgniteException.class, "can not perform operation, because cluster inactive");
+ }, IgniteException.class, "Can not perform the operation because the cluster is inactive.");
}
/**
[30/50] ignite git commit: ignite-2.1 Fixed
UnsupportedOperationException in case of single file.
Posted by sb...@apache.org.
ignite-2.1 Fixed UnsupportedOperationException in case of single file.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e7d0e790
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e7d0e790
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e7d0e790
Branch: refs/heads/ignite-2.1.2-exchange
Commit: e7d0e7908d3efbfd8e1d30dc404f3c1f8641fef5
Parents: 52626df
Author: Alexey Kuznetsov <ak...@gridgain.com>
Authored: Sat Jun 17 20:00:29 2017 +0700
Committer: Alexey Kuznetsov <ak...@gridgain.com>
Committed: Sat Jun 17 20:00:29 2017 +0700
----------------------------------------------------------------------
.../org/apache/ignite/internal/visor/util/VisorTaskUtils.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e7d0e790/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
index c9ed882..30cb499 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java
@@ -551,7 +551,8 @@ public class VisorTaskUtils {
return res;
}
- return F.asList(new VisorLogFile(file));
+ // Return ArrayList, because it could be sorted in matchedFiles() method.
+ return new ArrayList<>(F.asList(new VisorLogFile(file)));
}
/**
[10/50] ignite git commit: ignite-gg-12301 fix assert message
Posted by sb...@apache.org.
ignite-gg-12301 fix assert message
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6bd4db53
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6bd4db53
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6bd4db53
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 6bd4db53a64a82dedcfcc21d6abac5d1103cba56
Parents: be804b9
Author: Dmitriy Govorukhin <dm...@gmail.com>
Authored: Fri Jun 16 18:16:40 2017 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Fri Jun 16 18:16:40 2017 +0300
----------------------------------------------------------------------
.../persistence/standbycluster/IgniteChangeGlobalStateTest.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6bd4db53/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
index 667a7ac..f8f73da 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
@@ -454,7 +454,7 @@ public class IgniteChangeGlobalStateTest extends IgniteChangeGlobalStateAbstract
return null;
}
- }, IgniteException.class, "can not perform operation, because cluster inactive");
+ }, IgniteException.class, "Can not perform the operation because the cluster is inactive.");
}
/**
[26/50] ignite git commit: IGNITE-5301: Fixed invalid memcpy
parameter ordering leading to JVM crash in H2TreeIndex. This closes #2029.
This closes #2151.
Posted by sb...@apache.org.
IGNITE-5301: Fixed invalid memcpy parameter ordering leading to JVM crash in H2TreeIndex. This closes #2029. This closes #2151.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/df121b55
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/df121b55
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/df121b55
Branch: refs/heads/ignite-2.1.2-exchange
Commit: df121b553d3e9810d9931f76ddb42c32a75d6fc3
Parents: dde5506
Author: Eduard Shangareev <es...@gridgain.com>
Authored: Sat Jun 17 12:46:55 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Sat Jun 17 12:46:55 2017 +0300
----------------------------------------------------------------------
.../persistence/freelist/io/PagesListNodeIO.java | 2 +-
.../cache/persistence/tree/io/BPlusInnerIO.java | 4 ++--
.../cache/persistence/tree/io/BPlusLeafIO.java | 2 +-
.../cache/persistence/tree/io/DataPageIO.java | 2 +-
.../cache/persistence/tree/io/TrackingPageIO.java | 2 +-
.../cache/persistence/tree/util/PageHandler.java | 14 ++++++--------
.../persistence/IgnitePdsDynamicCacheTest.java | 17 +++++++++++++++++
.../processors/query/h2/database/H2TreeIndex.java | 2 +-
8 files changed, 30 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/df121b55/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/io/PagesListNodeIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/io/PagesListNodeIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/io/PagesListNodeIO.java
index 7db89eb..9197d56 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/io/PagesListNodeIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/freelist/io/PagesListNodeIO.java
@@ -210,7 +210,7 @@ public class PagesListNodeIO extends PageIO {
for (int i = 0; i < cnt; i++) {
if (getAt(pageAddr, i) == dataPageId) {
if (i != cnt - 1)
- copyMemory(pageAddr, pageAddr, offset(i + 1), offset(i), 8 * (cnt - i - 1));
+ copyMemory(pageAddr, offset(i + 1), pageAddr, offset(i), 8 * (cnt - i - 1));
setCount(pageAddr, cnt - 1);
http://git-wip-us.apache.org/repos/asf/ignite/blob/df121b55/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/BPlusInnerIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/BPlusInnerIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/BPlusInnerIO.java
index 88fc8c8..dabee7c 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/BPlusInnerIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/BPlusInnerIO.java
@@ -100,7 +100,7 @@ public abstract class BPlusInnerIO<L> extends BPlusIO<L> {
cnt *= getItemSize() + 8; // From items to bytes.
if (dstIdx > srcIdx) {
- PageHandler.copyMemory(srcPageAddr, dstPageAddr, offset(srcIdx), offset(dstIdx), cnt);
+ PageHandler.copyMemory(srcPageAddr, offset(srcIdx), dstPageAddr, offset(dstIdx), cnt);
if (cpLeft)
PageUtils.putLong(dstPageAddr, offset0(dstIdx, SHIFT_LEFT), PageUtils.getLong(srcPageAddr, (offset0(srcIdx, SHIFT_LEFT))));
@@ -109,7 +109,7 @@ public abstract class BPlusInnerIO<L> extends BPlusIO<L> {
if (cpLeft)
PageUtils.putLong(dstPageAddr, offset0(dstIdx, SHIFT_LEFT), PageUtils.getLong(srcPageAddr, (offset0(srcIdx, SHIFT_LEFT))));
- PageHandler.copyMemory(srcPageAddr, dstPageAddr, offset(srcIdx), offset(dstIdx), cnt);
+ PageHandler.copyMemory(srcPageAddr, offset(srcIdx), dstPageAddr, offset(dstIdx), cnt);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df121b55/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/BPlusLeafIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/BPlusLeafIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/BPlusLeafIO.java
index 931bf10..aadf67e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/BPlusLeafIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/BPlusLeafIO.java
@@ -43,7 +43,7 @@ public abstract class BPlusLeafIO<L> extends BPlusIO<L> {
boolean cpLeft) throws IgniteCheckedException {
assert srcIdx != dstIdx || srcPageAddr != dstPageAddr;
- PageHandler.copyMemory(srcPageAddr, dstPageAddr, offset(srcIdx), offset(dstIdx),
+ PageHandler.copyMemory(srcPageAddr, offset(srcIdx), dstPageAddr, offset(dstIdx),
cnt * getItemSize());
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df121b55/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/DataPageIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/DataPageIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/DataPageIO.java
index d8ed1a6..e177d83 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/DataPageIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/DataPageIO.java
@@ -1371,7 +1371,7 @@ public class DataPageIO extends PageIO {
assert off + step + cnt <= pageSize : "[off=" + off + ", step=" + step + ", cnt=" + cnt +
", cap=" + pageSize + ']';
- PageHandler.copyMemory(addr, addr, off, off + step, cnt);
+ PageHandler.copyMemory(addr, off, addr, off + step, cnt);
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/df121b55/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/TrackingPageIO.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/TrackingPageIO.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/TrackingPageIO.java
index aa6ba9a..bbf452d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/TrackingPageIO.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/io/TrackingPageIO.java
@@ -139,7 +139,7 @@ public class TrackingPageIO extends PageIO {
if (last - lastSuccessfulSnapshotId == 1) { //we should keep only data in last half
//new data will be written in the same half, we should move old data to another half
if ((nextSnapshotTag - last) % 2 == 0)
- PageHandler.copyMemory(buf, buf, sizeOff, sizeOff2, len + SIZE_FIELD_SIZE);
+ PageHandler.copyMemory(buf, sizeOff, buf, sizeOff2, len + SIZE_FIELD_SIZE);
} else { //last - lastSuccessfulSnapshotId > 1, e.g. we should merge two half in one
int newSize = 0;
int i = 0;
http://git-wip-us.apache.org/repos/asf/ignite/blob/df121b55/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/util/PageHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/util/PageHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/util/PageHandler.java
index b42258e..a87525a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/util/PageHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/tree/util/PageHandler.java
@@ -270,9 +270,8 @@ public abstract class PageHandler<X, R> {
doInitPage(pageMem, cacheId, pageId, page, pageAddr, init, wal);
walPlc = FALSE;
}
- else {
+ else
init = PageIO.getPageIO(pageAddr);
- }
R res = h.run(cacheId, pageId, page, pageAddr, init, walPlc, arg, intArg);
@@ -336,9 +335,8 @@ public abstract class PageHandler<X, R> {
doInitPage(pageMem, cacheId, pageId, page, pageAddr, init, wal);
walPlc = FALSE;
}
- else {
+ else
init = PageIO.getPageIO(pageAddr);
- }
R res = h.run(cacheId, pageId, page, pageAddr, init, walPlc, arg, intArg);
@@ -456,12 +454,12 @@ public abstract class PageHandler<X, R> {
/**
* @param src Source.
- * @param dst Destination.
* @param srcOff Source offset in bytes.
+ * @param dst Destination.
* @param dstOff Destination offset in bytes.
* @param cnt Bytes count to copy.
*/
- public static void copyMemory(ByteBuffer src, ByteBuffer dst, long srcOff, long dstOff, long cnt) {
+ public static void copyMemory(ByteBuffer src, long srcOff, ByteBuffer dst, long dstOff, long cnt) {
byte[] srcArr = src.hasArray() ? src.array() : null;
byte[] dstArr = dst.hasArray() ? dst.array() : null;
long srcArrOff = src.hasArray() ? src.arrayOffset() + GridUnsafe.BYTE_ARR_OFF : 0;
@@ -491,12 +489,12 @@ public abstract class PageHandler<X, R> {
/**
* @param srcAddr Source.
- * @param dstAddr Destination.
* @param srcOff Source offset in bytes.
+ * @param dstAddr Destination.
* @param dstOff Destination offset in bytes.
* @param cnt Bytes count to copy.
*/
- public static void copyMemory(long srcAddr, long dstAddr, long srcOff, long dstOff, long cnt) {
+ public static void copyMemory(long srcAddr, long srcOff, long dstAddr, long dstOff, long cnt) {
GridUnsafe.copyMemory(null, srcAddr + srcOff, null, dstAddr + dstOff, cnt);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df121b55/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java
index f30e785..ae4b850 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsDynamicCacheTest.java
@@ -17,12 +17,14 @@
package org.apache.ignite.internal.processors.cache.persistence;
+import java.io.Serializable;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.cache.CacheAtomicityMode;
import org.apache.ignite.cache.CacheRebalanceMode;
import org.apache.ignite.cache.CacheWriteSynchronizationMode;
import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.cache.query.annotations.QuerySqlField;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
import org.apache.ignite.configuration.MemoryConfiguration;
@@ -48,6 +50,7 @@ public class IgnitePdsDynamicCacheTest extends IgniteDbDynamicCacheSelfTest {
memPlcCfg.setInitialSize(200 * 1024 * 1024);
memPlcCfg.setMaxSize(200 * 1024 * 1024);
+ dbCfg.setPageSize(1024);
dbCfg.setMemoryPolicies(memPlcCfg);
dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
@@ -113,6 +116,7 @@ public class IgnitePdsDynamicCacheTest extends IgniteDbDynamicCacheSelfTest {
ccfg2.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
ccfg2.setRebalanceMode(CacheRebalanceMode.NONE);
ccfg2.setAffinity(new RendezvousAffinityFunction(false, 32));
+ ccfg2.setIndexedTypes(Integer.class, Value.class);
ignite.createCache(ccfg1);
ignite.createCache(ccfg2);
@@ -150,4 +154,17 @@ public class IgnitePdsDynamicCacheTest extends IgniteDbDynamicCacheSelfTest {
private void deleteWorkFiles() throws IgniteCheckedException {
deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
}
+
+ /**
+ *
+ */
+ static class Value implements Serializable {
+ /** */
+ @QuerySqlField(index = true, groups = "full_name")
+ String fName;
+
+ /** */
+ @QuerySqlField(index = true, groups = "full_name")
+ String lName;
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/df121b55/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
index 70d8632..e02510f 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/database/H2TreeIndex.java
@@ -94,7 +94,7 @@ public class H2TreeIndex extends GridH2IndexBase {
initBaseIndex(tbl, 0, name, cols,
pk ? IndexType.createPrimaryKey(false, false) : IndexType.createNonUnique(false, false, false));
- name = tbl.rowDescriptor() == null ? "_" + name : tbl.rowDescriptor().type().typeId() + "_" + name;
+ name = (tbl.rowDescriptor() == null ? "" : tbl.rowDescriptor().type().typeId() + "_") + name;
name = BPlusTree.treeName(name, "H2Tree");
[28/50] ignite git commit: Merge branch 'ignite-5519' of
https://github.com/gridgain/apache-ignite into ignite-5519
Posted by sb...@apache.org.
Merge branch 'ignite-5519' of https://github.com/gridgain/apache-ignite into ignite-5519
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6a8b9919
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6a8b9919
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6a8b9919
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 6a8b99193bb8fd989f96fe48da0ccef769643ba8
Parents: 6b6de99 5ec5df3
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Sat Jun 17 14:21:00 2017 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Sat Jun 17 14:21:00 2017 +0300
----------------------------------------------------------------------
----------------------------------------------------------------------
[49/50] ignite git commit: Merge remote-tracking branch
'community/ignite-2.1.2' into ignite-2.1.2
Posted by sb...@apache.org.
Merge remote-tracking branch 'community/ignite-2.1.2' into ignite-2.1.2
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b544678d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b544678d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b544678d
Branch: refs/heads/ignite-2.1.2-exchange
Commit: b544678d31c93517525c61dda4bb82ea0ad4190c
Parents: 9bf4ca4 4c8cc08
Author: sboikov <sb...@gridgain.com>
Authored: Tue Jun 20 07:48:36 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Jun 20 07:48:36 2017 +0300
----------------------------------------------------------------------
.../pagemem/wal/record/CheckpointRecord.java | 6 +-
.../wal/record/MemoryRecoveryRecord.java | 8 +-
.../internal/pagemem/wal/record/WALRecord.java | 2 +-
...ckpointSimulationWithRealCpDisabledTest.java | 1037 ++++++++++++++++++
.../file/ignitePdsCheckpointSimulationTest.java | 1018 -----------------
.../ignite/testsuites/IgnitePdsTestSuite.java | 4 +-
6 files changed, 1048 insertions(+), 1027 deletions(-)
----------------------------------------------------------------------
[31/50] ignite git commit: Fixed NPE inf GridCacheInternalKeyImpl.
Posted by sb...@apache.org.
Fixed NPE inf GridCacheInternalKeyImpl.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b172b4b2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b172b4b2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b172b4b2
Branch: refs/heads/ignite-2.1.2-exchange
Commit: b172b4b27b07d09e726faf0a3e41747d6158cdc8
Parents: 52626df
Author: devozerov <vo...@gridgain.com>
Authored: Sat Jun 17 17:31:35 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Sat Jun 17 17:31:35 2017 +0300
----------------------------------------------------------------------
.../datastructures/GridCacheInternalKeyImpl.java | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b172b4b2/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheInternalKeyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheInternalKeyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheInternalKeyImpl.java
index eaabef7..5cd3d85 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheInternalKeyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheInternalKeyImpl.java
@@ -74,14 +74,24 @@ public class GridCacheInternalKeyImpl implements GridCacheInternalKey, Externali
/** {@inheritDoc} */
@Override public int hashCode() {
int result = name != null ? name.hashCode() : 0;
+
result = 31 * result + (grpName != null ? grpName.hashCode() : 0);
+
return result;
}
/** {@inheritDoc} */
@Override public boolean equals(Object obj) {
- return this == obj || (obj instanceof GridCacheInternalKey && name.equals(((GridCacheInternalKey)obj).name())
- && grpName.equals(((GridCacheInternalKey)obj).groupName()));
+ if (this == obj)
+ return true;
+
+ if (obj instanceof GridCacheInternalKeyImpl) {
+ GridCacheInternalKeyImpl other = (GridCacheInternalKeyImpl)obj;
+
+ return F.eq(name, other.name) && F.eq(grpName, other.grpName);
+ }
+
+ return false;
}
/** {@inheritDoc} */
[37/50] ignite git commit: Merge branches 'ignite-2.1.1' and
'ignite-5519' of https://github.com/gridgain/apache-ignite into ignite-2.1.1
Posted by sb...@apache.org.
Merge branches 'ignite-2.1.1' and 'ignite-5519' of https://github.com/gridgain/apache-ignite into ignite-2.1.1
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/42e8ca63
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/42e8ca63
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/42e8ca63
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 42e8ca632c4e34c31c6c0d8f1aa899aef3e1ed43
Parents: 5a63664 1c653cb
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Sat Jun 17 17:49:08 2017 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Sat Jun 17 17:49:08 2017 +0300
----------------------------------------------------------------------
.../cache/distributed/dht/GridDhtPartitionTopologyImpl.java | 9 ++++++++-
.../near/GridCachePartitionedNodeRestartTest.java | 6 +++---
2 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
[04/50] ignite git commit: ignite-gg-12301 fix Activate/Deactivate
test fail
Posted by sb...@apache.org.
ignite-gg-12301 fix Activate/Deactivate test fail
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/57bfba76
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/57bfba76
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/57bfba76
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 57bfba76e2e1f914f4a00c9deb9a57a14ad2a6e4
Parents: d52aa80
Author: Dmitriy Govorukhin <dm...@gmail.com>
Authored: Fri Jun 16 17:16:16 2017 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Fri Jun 16 17:16:16 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheProcessor.java | 16 ++-
.../GridCacheDatabaseSharedManager.java | 140 ++++++++-----------
.../IgniteCacheDatabaseSharedManager.java | 13 +-
.../persistence/pagemem/PageMemoryImpl.java | 6 +-
.../cluster/GridClusterStateProcessor.java | 3 +-
.../service/GridServiceProcessor.java | 11 +-
.../IgniteChangeGlobalStateAbstractTest.java | 7 +-
.../IgniteChangeGlobalStateCacheTest.java | 5 -
...IgniteChangeGlobalStateDataStreamerTest.java | 2 +-
.../IgniteChangeGlobalStateFailOverTest.java | 2 +
.../IgniteChangeGlobalStateTest.java | 2 +-
.../IgniteStandByClusterTest.java | 23 +++
.../extended/GridActivateExtensionTest.java | 4 +-
...ctiveNodeToActiveClusterWithPersistence.java | 8 ++
.../testsuites/IgniteStandByClusterSuite.java | 3 +-
15 files changed, 137 insertions(+), 108 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/57bfba76/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
index 7130e0f..d65aa24 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
@@ -1268,8 +1268,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
ctx.kernalContext().continuous().onCacheStop(ctx);
- ctx.kernalContext().cache().context().database().onCacheStop(ctx);
-
ctx.kernalContext().cache().context().snapshot().onCacheStop(ctx);
ctx.group().stopCache(ctx, destroy);
@@ -2113,10 +2111,23 @@ public class GridCacheProcessor extends GridProcessorAdapter {
if (exchActions != null && err == null) {
Collection<IgniteBiTuple<CacheGroupContext, Boolean>> stoppedGrps = null;
+ boolean forceCheckpoint = false;
+
for (ExchangeActions.ActionData action : exchActions.cacheStopRequests()) {
GridCacheContext<?, ?> stopCtx;
boolean destroy;
+ if (!forceCheckpoint){
+ try {
+ sharedCtx.database().waitForCheckpoint("caches stop");
+ }
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to wait for checkpoint finish during cache stop.", e);
+ }
+
+ forceCheckpoint = true;
+ }
+
stopGateway(action.request());
sharedCtx.database().checkpointReadLock();
@@ -2783,7 +2794,6 @@ public class GridCacheProcessor extends GridProcessorAdapter {
return fut;
}
-
public CacheType cacheType(String cacheName ) {
if (CU.isUtilityCache(cacheName))
return CacheType.UTILITY;
http://git-wip-us.apache.org/repos/asf/ignite/blob/57bfba76/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index 4ce61e2..0e3aced 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -103,7 +103,6 @@ import org.apache.ignite.internal.processors.cache.CacheGroupContext;
import org.apache.ignite.internal.processors.cache.ClusterState;
import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheProcessor;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
import org.apache.ignite.internal.processors.cache.StoredCacheData;
import org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager;
@@ -219,6 +218,12 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
}
};
+ /** */
+ private static final String MBEAN_NAME = "PersistenceMetrics";
+
+ /** */
+ private static final String MBEAN_GROUP = "Persistent Store";
+
/** Checkpoint thread. Needs to be volatile because it is created in exchange worker. */
private volatile Checkpointer checkpointer;
@@ -366,18 +371,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
persStoreMetrics.wal(cctx.wal());
- try {
- persistenceMetricsMbeanName = U.registerMBean(
- cctx.kernalContext().config().getMBeanServer(),
- cctx.kernalContext().igniteInstanceName(),
- "Persistent Store",
- "PersistenceMetrics",
- persStoreMetrics,
- PersistenceMetricsMXBean.class);
- }
- catch (JMException e) {
- throw new IgniteCheckedException("Failed to register persistence metrics MBean", e);
- }
+ registrateMetricsMBean();
}
}
@@ -453,8 +447,13 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
initDataBase();
- GridCacheProcessor cachePrc = cctx.kernalContext().cache();
+ initCachesAndRestoreMemory();
+ }
+ /**
+ *
+ */
+ private void initCachesAndRestoreMemory() throws IgniteCheckedException {
Collection<String> cacheNames = new HashSet<>();
// TODO IGNITE-5075 group descriptors.
@@ -485,77 +484,83 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
for (StoredCacheData cacheData : cctx.pageStore().readCacheConfigurations().values()) {
if (!cacheNames.contains(cacheData.config().getName()))
storeMgr.initializeForCache(
- cctx.cache().cacheDescriptors().get(cacheData.config().getName()).groupDescriptor(), cacheData);
+ cctx.cache().cacheDescriptors().get(
+ cacheData.config().getName()).groupDescriptor(), cacheData);
}
readCheckpointAndRestoreMemory();
}
-
/** {@inheritDoc} */
@Override public void onActivate(GridKernalContext kctx) throws IgniteCheckedException {
- snapshotMgr = cctx.snapshot();
-
- if (cctx.localNode().isClient())
- return;
-
- initDataBase();
-
if (log.isDebugEnabled())
log.debug("Activate database manager [id=" + cctx.localNodeId() +
" topVer=" + cctx.discovery().topologyVersionEx() + " ]");
- GridCacheProcessor cachePrc = cctx.kernalContext().cache();
-
-
- Collection<String> cacheNames = new HashSet<>();
-
- // TODO IGNITE-5075 group descriptors.
- for (CacheConfiguration ccfg : cctx.kernalContext().config().getCacheConfiguration()) {
- if (CU.isSystemCache(ccfg.getName())) {
- storeMgr.initializeForCache(
- cctx.cache().cacheDescriptors().get(ccfg.getName()).groupDescriptor(), new StoredCacheData(ccfg));
-
- cacheNames.add(ccfg.getName());
- }
- }
-
- for (CacheConfiguration ccfg : cctx.kernalContext().config().getCacheConfiguration())
- if (!CU.isSystemCache(ccfg.getName())) {
- DynamicCacheDescriptor cacheDesc = cctx.cache().cacheDescriptors().get(ccfg.getName());
+ snapshotMgr = cctx.snapshot();
- if (cacheDesc != null)
- storeMgr.initializeForCache(cacheDesc.groupDescriptor(), new StoredCacheData(ccfg));
+ if (!cctx.localNode().isClient()) {
+ initDataBase();
- cacheNames.add(ccfg.getName());
- }
+ registrateMetricsMBean();
- for (StoredCacheData cacheData : cctx.pageStore().readCacheConfigurations().values()) {
- if (!cacheNames.contains(cacheData.config().getName()))
- storeMgr.initializeForCache(
- cctx.cache().cacheDescriptors().get(cacheData.config().getName()).groupDescriptor(), cacheData);
+ initCachesAndRestoreMemory();
}
- readCheckpointAndRestoreMemory();
-
if (log.isDebugEnabled())
log.debug("Restore state after activation [nodeId=" + cctx.localNodeId() + " ]");
}
/** {@inheritDoc} */
@Override public void onDeActivate(GridKernalContext kctx) throws IgniteCheckedException {
- stop0(false);
-
if (log.isDebugEnabled())
log.debug("DeActivate database manager [id=" + cctx.localNodeId() +
" topVer=" + cctx.discovery().topologyVersionEx() + " ]");
onKernalStop0(false);
+ stop0(false);
+
/* Must be here, because after deactivate we can invoke activate and file lock must be already configured */
stopping = false;
- fileLockHolder = new FileLockHolder(storeMgr.workDir().getPath(), cctx.kernalContext(), log);
+ if (!cctx.localNode().isClient())
+ fileLockHolder = new FileLockHolder(storeMgr.workDir().getPath(), cctx.kernalContext(), log);
+ }
+
+ /**
+ *
+ */
+ private void registrateMetricsMBean() throws IgniteCheckedException {
+ try {
+ persistenceMetricsMbeanName = U.registerMBean(
+ cctx.kernalContext().config().getMBeanServer(),
+ cctx.kernalContext().igniteInstanceName(),
+ MBEAN_GROUP,
+ MBEAN_NAME,
+ persStoreMetrics,
+ PersistenceMetricsMXBean.class);
+ }
+ catch (JMException e) {
+ throw new IgniteCheckedException("Failed to register " + MBEAN_NAME + " MBean.", e);
+ }
+ }
+
+ /**
+ *
+ */
+ private void unRegistrateMetricsMBean() {
+ if (persistenceMetricsMbeanName != null) {
+ try {
+ cctx.kernalContext().config().getMBeanServer().unregisterMBean(persistenceMetricsMbeanName);
+ }
+ catch (InstanceNotFoundException ignore) {
+ // No-op, nothing to unregister.
+ }
+ catch (MBeanRegistrationException e) {
+ U.error(log, "Failed to unregister " + MBEAN_NAME + " MBean.", e);
+ }
+ }
}
/**
@@ -602,11 +607,6 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
}
/** {@inheritDoc} */
- @Override public void onCacheStop(GridCacheContext cctx) {
- snapshotMgr.onCacheStop(cctx);
- }
-
- /** {@inheritDoc} */
@Override protected void onKernalStop0(boolean cancel) {
checkpointLock.writeLock().lock();
@@ -629,17 +629,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
fileLockHolder.close();
}
- if (persistenceMetricsMbeanName != null) {
- try {
- cctx.kernalContext().config().getMBeanServer().unregisterMBean(persistenceMetricsMbeanName);
- }
- catch (InstanceNotFoundException ignore) {
- // No-op, nothing to unregister.
- }
- catch (MBeanRegistrationException e) {
- U.error(log, "Failed to unregister persistence metrics MBean (will continue stop routine)", e);
- }
- }
+ unRegistrateMetricsMBean();
}
/** */
@@ -823,14 +813,8 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
/** {@inheritDoc} */
@Override public void onCacheGroupsStopped(
- Collection<IgniteBiTuple<CacheGroupContext, Boolean>> stoppedGrps) {
- try {
- waitForCheckpoint("caches stop");
- }
- catch (IgniteCheckedException e) {
- U.error(log, "Failed to wait for checkpoint finish during cache stop.", e);
- }
-
+ Collection<IgniteBiTuple<CacheGroupContext, Boolean>> stoppedGrps
+ ) {
Map<PageMemoryEx, Collection<Integer>> destroyed = new HashMap<>();
for (IgniteBiTuple<CacheGroupContext, Boolean> tup : stoppedGrps) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/57bfba76/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
index 2aba23d..456e7b4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
@@ -118,7 +118,7 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
initPageMemoryPolicies(memCfg);
- //registerMetricsMBeans();
+ registerMetricsMBeans();
startMemoryPolicies();
@@ -662,7 +662,7 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
IgniteConfiguration cfg = cctx.gridConfig();
- /* try {
+ try {
cfg.getMBeanServer().unregisterMBean(
U.makeMBeanName(
cfg.getIgniteInstanceName(),
@@ -672,7 +672,7 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
catch (JMException e) {
U.error(log, "Failed to unregister MBean for memory metrics: " +
memPlc.memoryMetrics().getName(), e);
- }*/
+ }
}
}
}
@@ -755,13 +755,6 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
}
/**
- * @param cctx Stopped cache context.
- */
- public void onCacheStop(GridCacheContext cctx) {
- // No-op
- }
-
- /**
* @return Future that will be completed when indexes for given cache are restored.
*/
@Nullable public IgniteInternalFuture indexRebuildFuture(int cacheId) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/57bfba76/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
index 423d572..fb9bd3e 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/pagemem/PageMemoryImpl.java
@@ -28,7 +28,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.ThreadPoolExecutor;
@@ -179,7 +179,7 @@ public class PageMemoryImpl implements PageMemoryEx {
private final CheckpointLockStateChecker stateChecker;
/** */
- private Executor asyncRunner = new ThreadPoolExecutor(
+ private ExecutorService asyncRunner = new ThreadPoolExecutor(
0,
Runtime.getRuntime().availableProcessors(),
30L,
@@ -324,6 +324,8 @@ public class PageMemoryImpl implements PageMemoryEx {
if (log.isDebugEnabled())
log.debug("Stopping page memory.");
+ U.shutdownNow(getClass(), asyncRunner, log);
+
directMemoryProvider.shutdown();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/57bfba76/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
index b4d329d..00c9799 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
@@ -248,7 +248,8 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
// First node started (coordinator).
if (nodes.isEmpty() || nodes.get(0).isLocal())
cacheData.putAll(localCacheData.caches());
- else if (globalState == INACTIVE) { // Accept inactivate state after join.
+
+ if (globalState == INACTIVE) { // Accept inactivate state after join.
if (log != null && log.isInfoEnabled())
log.info("Got inactivate state from cluster during node join.");
http://git-wip-us.apache.org/repos/asf/ignite/blob/57bfba76/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
index e2cf53b..12be63b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/service/GridServiceProcessor.java
@@ -215,6 +215,15 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
if (ctx.isDaemon() || !ctx.state().active())
return;
+ onKernalStart0();
+ }
+
+ /**
+ * Do kernal start.
+ *
+ * @throws IgniteCheckedException If failed.
+ */
+ private void onKernalStart0() throws IgniteCheckedException {
cache = ctx.cache().utilityCache();
if (!ctx.clientNode())
@@ -350,7 +359,7 @@ public class GridServiceProcessor extends GridProcessorAdapter implements Ignite
start();
- onKernalStart();
+ onKernalStart0();
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/57bfba76/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java
index 4ccc8ed..a06e0ce 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateAbstractTest.java
@@ -153,7 +153,8 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
for (int i = 0; i < cnt; i++)
startPrimary(i);
- grid("node0" + primarySuffix).active(true);
+ if (cnt > 0)
+ grid("node0" + primarySuffix).active(true);
}
/**
@@ -343,8 +344,8 @@ public abstract class IgniteChangeGlobalStateAbstractTest extends GridCommonAbst
memCfg.setConcurrencyLevel(64);
MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
- memPlcCfg.setInitialSize(20 * 1024 * 1024);
- memPlcCfg.setMaxSize(20 * 1024 * 1024);
+ memPlcCfg.setInitialSize(200 * 1024 * 1024);
+ memPlcCfg.setMaxSize(200 * 1024 * 1024);
memPlcCfg.setName("dfltMemPlc");
memCfg.setMemoryPolicies(memPlcCfg);
http://git-wip-us.apache.org/repos/asf/ignite/blob/57bfba76/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateCacheTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateCacheTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateCacheTest.java
index 1dc99f9..2f2385d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateCacheTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateCacheTest.java
@@ -17,7 +17,6 @@
package org.apache.ignite.internal.processors.cache.persistence.standbycluster;
-import javax.cache.configuration.Configuration;
import org.apache.ignite.Ignite;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.configuration.CacheConfiguration;
@@ -127,8 +126,6 @@ public class IgniteChangeGlobalStateCacheTest extends IgniteChangeGlobalStateAbs
IgniteCache<String, String> cacheExp = ig1.getOrCreateCache(chName);
- Configuration<String, String> cfgExp = cacheExp.getConfiguration(CacheConfiguration.class);
-
cacheExp.put("key", "value");
assertTrue(ig1.active());
@@ -161,8 +158,6 @@ public class IgniteChangeGlobalStateCacheTest extends IgniteChangeGlobalStateAbs
IgniteCache<String, String> cacheAct = ig2.cache(chName);
- Configuration<String, String> cfgAct = cacheAct.getConfiguration(CacheConfiguration.class);
-
assertEquals("value", cacheAct.get("key"));
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/57bfba76/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateDataStreamerTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateDataStreamerTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateDataStreamerTest.java
index f13ef97..d3e8298 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateDataStreamerTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateDataStreamerTest.java
@@ -83,7 +83,7 @@ public class IgniteChangeGlobalStateDataStreamerTest extends IgniteChangeGlobalS
catch (Exception e) {
fail = true;
- assertTrue(e.getMessage().contains("can not perform operation, because cluster inactive"));
+ assertTrue(e.getMessage().contains("Can not perform the operation because the cluster is inactive."));
}
if (!fail)
http://git-wip-us.apache.org/repos/asf/ignite/blob/57bfba76/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateFailOverTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateFailOverTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateFailOverTest.java
index bb05048..d0b2d56 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateFailOverTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateFailOverTest.java
@@ -143,6 +143,8 @@ public class IgniteChangeGlobalStateFailOverTest extends IgniteChangeGlobalState
*
*/
public void testActivateDeActivateOnJoiningNode() throws Exception {
+ fail("https://issues.apache.org/jira/browse/IGNITE-5520");
+
final Ignite igB1 = backUp(0);
final Ignite igB2 = backUp(1);
final Ignite igB3 = backUp(2);
http://git-wip-us.apache.org/repos/asf/ignite/blob/57bfba76/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
index bd5044b..667a7ac 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
@@ -412,7 +412,7 @@ public class IgniteChangeGlobalStateTest extends IgniteChangeGlobalStateAbstract
IgniteCache cache = ig.cache("cache");
return null;
}
- }, IgniteException.class, "can not perform operation, because cluster inactive");
+ }, IgniteException.class, "Can not perform the operation because the cluster is inactive.");
}
/**
http://git-wip-us.apache.org/repos/asf/ignite/blob/57bfba76/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
index 7a914f3..647511e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.cache.persistence.standbycluster;
import java.util.Arrays;
import java.util.Map;
+import org.apache.ignite.IgniteCache;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.CacheConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
@@ -186,6 +187,28 @@ public class IgniteStandByClusterTest extends GridCommonAbstractTest {
Assert.assertNotNull(caches3.get(cache3));
}
+ public void testSimple() throws Exception {
+ IgniteEx ig = startGrid(0);
+
+ ig.active(true);
+
+ IgniteCache<Integer, String> cache0 = ig.getOrCreateCache("cache");
+
+ cache0.put(1, "1");
+
+ assertEquals("1", cache0.get(1));
+
+ ig.active(false);
+
+ assertTrue(!ig.active());
+
+ ig.active(true);
+
+ IgniteCache<Integer, String> cache = ig.cache("cache");
+
+ assertEquals("1", cache.get(1));
+ }
+
private static class NodeFilterIgnoreByName implements IgnitePredicate<ClusterNode>{
private final String name;
http://git-wip-us.apache.org/repos/asf/ignite/blob/57bfba76/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivateExtensionTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivateExtensionTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivateExtensionTest.java
index 4f4d838..f70dd1e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivateExtensionTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/extended/GridActivateExtensionTest.java
@@ -73,8 +73,8 @@ public class GridActivateExtensionTest extends GridCacheAbstractFullApiSelfTest
MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
- memPlcCfg.setInitialSize(5 * 1024 * 1024);
- memPlcCfg.setMaxSize(5 * 1024 * 1024);
+ memPlcCfg.setInitialSize(200 * 1024 * 1024);
+ memPlcCfg.setMaxSize(200 * 1024 * 1024);
memPlcCfg.setName("dfltMemPlc");
http://git-wip-us.apache.org/repos/asf/ignite/blob/57bfba76/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/join/persistence/JoinActiveNodeToActiveClusterWithPersistence.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/join/persistence/JoinActiveNodeToActiveClusterWithPersistence.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/join/persistence/JoinActiveNodeToActiveClusterWithPersistence.java
index 54087ba..60388fa 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/join/persistence/JoinActiveNodeToActiveClusterWithPersistence.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/join/persistence/JoinActiveNodeToActiveClusterWithPersistence.java
@@ -68,6 +68,14 @@ public class JoinActiveNodeToActiveClusterWithPersistence extends JoinActiveNode
joinClientWithOutConfigurationTemplate().execute();
}
+ @Override public void testJoinClientStaticCacheConfigurationDifferentOnBoth() throws Exception {
+ staticCacheConfigurationDifferentOnBothTemplate().execute();
+ }
+
+ @Override public void testJoinClientStaticCacheConfigurationInCluster() throws Exception {
+ staticCacheConfigurationInClusterTemplate().execute();
+ }
+
@Override public AbstractNodeJoinTemplate.JoinNodeTestPlanBuilder staticCacheConfigurationOnJoinTemplate() throws Exception {
return persistent(super.staticCacheConfigurationOnJoinTemplate());
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/57bfba76/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStandByClusterSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStandByClusterSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStandByClusterSuite.java
index 6418eef..6fa158d 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStandByClusterSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteStandByClusterSuite.java
@@ -22,6 +22,7 @@ import org.apache.ignite.internal.processors.cache.persistence.standbycluster.Ig
import org.apache.ignite.internal.processors.cache.persistence.standbycluster.IgniteChangeGlobalStateDataStreamerTest;
import org.apache.ignite.internal.processors.cache.persistence.standbycluster.IgniteChangeGlobalStateDataStructureTest;
import org.apache.ignite.internal.processors.cache.persistence.standbycluster.IgniteChangeGlobalStateFailOverTest;
+import org.apache.ignite.internal.processors.cache.persistence.standbycluster.IgniteChangeGlobalStateServiceTest;
import org.apache.ignite.internal.processors.cache.persistence.standbycluster.IgniteChangeGlobalStateTest;
import org.apache.ignite.internal.processors.cache.persistence.standbycluster.IgniteStandByClusterTest;
import org.apache.ignite.internal.processors.cache.persistence.standbycluster.join.JoinActiveNodeToActiveCluster;
@@ -64,7 +65,7 @@ public class IgniteStandByClusterSuite extends TestSuite {
suite.addTestSuite(IgniteChangeGlobalStateDataStructureTest.class);
suite.addTestSuite(IgniteChangeGlobalStateDataStreamerTest.class);
suite.addTestSuite(IgniteChangeGlobalStateFailOverTest.class);
-// suite.addTestSuite(IgniteChangeGlobalStateServiceTest.class);
+ suite.addTestSuite(IgniteChangeGlobalStateServiceTest.class);
return suite;
}
[25/50] ignite git commit: cleanup memPlcMap on stop + add restart
test
Posted by sb...@apache.org.
cleanup memPlcMap on stop + add restart test
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/dde55064
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/dde55064
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/dde55064
Branch: refs/heads/ignite-2.1.2-exchange
Commit: dde55064d7c899eac50d035abeb1e60049d30f00
Parents: bf3643d
Author: Dmitriy Govorukhin <dm...@gmail.com>
Authored: Sat Jun 17 12:03:17 2017 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Sat Jun 17 12:03:17 2017 +0300
----------------------------------------------------------------------
.../IgniteCacheDatabaseSharedManager.java | 4 +++
.../IgniteStandByClusterTest.java | 38 ++++++++++++++++++--
2 files changed, 39 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/dde55064/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
index 456e7b4..e1f1c9a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/IgniteCacheDatabaseSharedManager.java
@@ -674,6 +674,10 @@ public class IgniteCacheDatabaseSharedManager extends GridCacheSharedManagerAdap
memPlc.memoryMetrics().getName(), e);
}
}
+
+ memPlcMap.clear();
+
+ memPlcMap = null;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/dde55064/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
index 647511e..5eebc94 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteStandByClusterTest.java
@@ -145,7 +145,7 @@ public class IgniteStandByClusterTest extends GridCommonAbstractTest {
assertTrue(!ig2.active());
assertTrue(!ig3.active());
- for (IgniteEx ig: Arrays.asList(ig1,ig2,ig3)){
+ for (IgniteEx ig : Arrays.asList(ig1, ig2, ig3)) {
Map<String, DynamicCacheDescriptor> desc = U.field(U.field(ig.context().cache(), "cachesInfo"), "registeredCaches");
assertEquals(0, desc.size());
@@ -157,7 +157,7 @@ public class IgniteStandByClusterTest extends GridCommonAbstractTest {
assertTrue(ig2.active());
assertTrue(ig3.active());
- for (IgniteEx ig: Arrays.asList(ig1,ig2,ig3)){
+ for (IgniteEx ig : Arrays.asList(ig1, ig2, ig3)) {
Map<String, DynamicCacheDescriptor> desc = U.field(
U.field(ig.context().cache(), "cachesInfo"), "registeredCaches");
@@ -209,7 +209,39 @@ public class IgniteStandByClusterTest extends GridCommonAbstractTest {
assertEquals("1", cache.get(1));
}
- private static class NodeFilterIgnoreByName implements IgnitePredicate<ClusterNode>{
+ public void testRestartCluster() throws Exception {
+ IgniteEx ig1 = startGrid(getConfiguration("node1"));
+ IgniteEx ig2 = startGrid(getConfiguration("node2"));
+ IgniteEx ig3 = startGrid(getConfiguration("node3"));
+
+ assertTrue(!ig1.active());
+ assertTrue(!ig2.active());
+ assertTrue(!ig3.active());
+
+ ig2.active(true);
+
+ IgniteCache<Integer, String> cache = ig2.getOrCreateCache("cache");
+
+ for (int i = 0; i < 2048; i++)
+ cache.put(i, String.valueOf(i));
+
+ ig3.active(false);
+
+ stopAllGrids();
+
+ ig1 = startGrid(getConfiguration("node1"));
+ ig2 = startGrid(getConfiguration("node2"));
+ ig3 = startGrid(getConfiguration("node3"));
+
+ ig1.active(true);
+
+ IgniteCache<Integer, String> cache2 = ig1.cache("cache");
+
+ for (int i = 0; i < 2048; i++)
+ assertEquals(String.valueOf(i), cache2.get(i));
+ }
+
+ private static class NodeFilterIgnoreByName implements IgnitePredicate<ClusterNode> {
private final String name;
private NodeFilterIgnoreByName(String name) {
[13/50] ignite git commit: IGNITE-5525: Fix for ODBC example
Posted by sb...@apache.org.
IGNITE-5525: Fix for ODBC example
(cherry picked from commit 7cfad49)
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/afa08106
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/afa08106
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/afa08106
Branch: refs/heads/ignite-2.1.2-exchange
Commit: afa0810639e92db2ba229a6a829109e399e34637
Parents: 5376f22
Author: Igor Sapego <is...@gridgain.com>
Authored: Fri Jun 16 18:34:31 2017 +0300
Committer: Igor Sapego <is...@gridgain.com>
Committed: Fri Jun 16 18:37:44 2017 +0300
----------------------------------------------------------------------
modules/platforms/cpp/examples/odbc-example/src/odbc_example.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/afa08106/modules/platforms/cpp/examples/odbc-example/src/odbc_example.cpp
----------------------------------------------------------------------
diff --git a/modules/platforms/cpp/examples/odbc-example/src/odbc_example.cpp b/modules/platforms/cpp/examples/odbc-example/src/odbc_example.cpp
index 38e7426..11ba56f 100644
--- a/modules/platforms/cpp/examples/odbc-example/src/odbc_example.cpp
+++ b/modules/platforms/cpp/examples/odbc-example/src/odbc_example.cpp
@@ -580,7 +580,7 @@ int main()
SQLAllocHandle(SQL_HANDLE_DBC, env, &dbc);
// Combining connect string
- std::string connectStr = "DRIVER={Apache Ignite};SERVER=localhost;PORT=10800;CACHE=Person;";
+ std::string connectStr = "DRIVER={Apache Ignite};SERVER=localhost;PORT=10800;SCHEMA=Person;";
SQLCHAR outstr[ODBC_BUFFER_SIZE];
SQLSMALLINT outstrlen;
[07/50] ignite git commit: Merge remote-tracking branch
'professional/ignite-2.1.1' into ignite-2.1.1
Posted by sb...@apache.org.
Merge remote-tracking branch 'professional/ignite-2.1.1' into ignite-2.1.1
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/be804b97
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/be804b97
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/be804b97
Branch: refs/heads/ignite-2.1.2-exchange
Commit: be804b974c4d05e91253684319fbd900e95f5799
Parents: 2888097 29c2693
Author: Dmitriy Govorukhin <dm...@gmail.com>
Authored: Fri Jun 16 17:33:28 2017 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Fri Jun 16 17:33:28 2017 +0300
----------------------------------------------------------------------
.../ignite/internal/visor/cache/VisorCache.java | 15 --
.../internal/visor/cache/VisorCacheMetrics.java | 13 ++
.../visor/cache/VisorMemoryMetrics.java | 175 +++++++++++++++++++
.../visor/node/VisorNodeDataCollectorJob.java | 41 ++++-
.../node/VisorNodeDataCollectorJobResult.java | 32 ++++
.../visor/node/VisorNodeDataCollectorTask.java | 6 +
.../node/VisorNodeDataCollectorTaskResult.java | 27 +++
7 files changed, 287 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
[42/50] ignite git commit: Do not need process missed handler error
on stopping node.
Posted by sb...@apache.org.
Do not need process missed handler error on stopping node.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f6f5e494
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f6f5e494
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f6f5e494
Branch: refs/heads/ignite-2.1.2-exchange
Commit: f6f5e49413072a74c3712f3fba03946807ff58c7
Parents: 6143bc9
Author: sboikov <sb...@gridgain.com>
Authored: Mon Jun 19 17:52:08 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Jun 19 17:52:08 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheIoManager.java | 20 +++++++++++---------
1 file changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f6f5e494/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
index 2be3df4..010723d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheIoManager.java
@@ -25,7 +25,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
@@ -355,18 +354,21 @@ public class GridCacheIoManager extends GridCacheSharedManagerAdapter {
if (log.isDebugEnabled())
log.debug(msg0.toString());
}
- else
+ else {
U.error(log, msg0.toString());
- try {
- cacheMsg.onClassError(new IgniteCheckedException("Failed to find message handler for message: " + cacheMsg));
+ try {
+ cacheMsg.onClassError(new IgniteCheckedException("Failed to find message handler for message: " + cacheMsg));
- processFailedMessage(nodeId, cacheMsg, c);
+ processFailedMessage(nodeId, cacheMsg, c);
+ }
+ catch (Exception e) {
+ U.error(log, "Failed to process failed message: " + e, e);
+ }
+ }
+
+ return;
}
- catch (Exception e) {
- U.error(log, "Failed to process failed message: " + e, e);
- }return;
- }
onMessage0(nodeId, cacheMsg, c);
}
[27/50] ignite git commit: ignite-5519 : Removed failing assertion.
Added assertions for safety of concurrent modifications.
Posted by sb...@apache.org.
ignite-5519 : Removed failing assertion. Added assertions for safety of concurrent modifications.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6b6de991
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6b6de991
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6b6de991
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 6b6de99153fa08d2d3be4a720d07d5dc4fced808
Parents: df121b5
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Sat Jun 17 14:19:01 2017 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Sat Jun 17 14:19:01 2017 +0300
----------------------------------------------------------------------
.../cache/distributed/dht/GridDhtPartitionTopologyImpl.java | 9 ++++++++-
.../near/GridCachePartitionedNodeRestartTest.java | 5 -----
2 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6b6de991/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 53f7523..2ea5336 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
@@ -914,7 +914,11 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
HashSet<UUID> affIds = affAssignment.getIds(p);
for (UUID nodeId : diffIds) {
- assert !affIds.contains(nodeId);
+ if (affIds.contains(nodeId)) {
+ U.warn(log, "Node from diff " + nodeId + " is affinity node. Skipping it.");
+
+ continue;
+ }
if (hasState(p, nodeId, OWNING, MOVING, RENTING)) {
ClusterNode n = ctx.discovery().node(nodeId);
@@ -1836,6 +1840,8 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
*/
@SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
private long updateLocal(int p, GridDhtPartitionState state, long updateSeq) {
+ assert lock.isWriteLockedByCurrentThread();
+
ClusterNode oldest = discoCache.oldestAliveServerNodeWithCache();
assert oldest != null || ctx.kernalContext().clientNode();
@@ -1908,6 +1914,7 @@ public class GridDhtPartitionTopologyImpl implements GridDhtPartitionTopology {
*/
private void removeNode(UUID nodeId) {
assert nodeId != null;
+ assert lock.isWriteLockedByCurrentThread();
ClusterNode oldest = discoCache.oldestAliveServerNode();
http://git-wip-us.apache.org/repos/asf/ignite/blob/6b6de991/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
index 4297d35..d7a0cdd 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/near/GridCachePartitionedNodeRestartTest.java
@@ -56,11 +56,6 @@ public class GridCachePartitionedNodeRestartTest extends GridCacheAbstractNodeRe
return cc;
}
- @Override
- protected void beforeTest() throws Exception {
- fail("https://issues.apache.org/jira/browse/IGNITE-5519");
- }
-
/** {@inheritDoc} */
@Override public void testRestart() throws Exception {
super.testRestart();
[45/50] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-2.1.2
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-2.1.2
# Conflicts:
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/96c37c6e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/96c37c6e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/96c37c6e
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 96c37c6e22d72417df63db0aeac2b6ccd8eb6eb7
Parents: 28d72d8 807cab2
Author: sboikov <sb...@gridgain.com>
Authored: Mon Jun 19 20:21:33 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Jun 19 20:21:33 2017 +0300
----------------------------------------------------------------------
.../cassandra/common/PropertyMappingHelper.java | 73 +++-----
.../persistence/KeyPersistenceSettings.java | 155 +++++-----------
.../persistence/PersistenceSettings.java | 81 +++++++-
.../store/cassandra/persistence/PojoField.java | 129 +++++++------
.../persistence/PojoFieldAccessor.java | 162 ++++++++++++++++
.../cassandra/persistence/PojoKeyField.java | 13 +-
.../cassandra/persistence/PojoValueField.java | 12 +-
.../persistence/ValuePersistenceSettings.java | 50 +----
.../store/cassandra/utils/DDLGenerator.java | 9 +-
.../tests/CassandraDirectPersistenceTest.java | 81 +++++++-
.../apache/ignite/tests/DDLGeneratorTest.java | 4 +
.../ignite/tests/IgnitePersistentStoreTest.java | 91 ++++++++-
.../apache/ignite/tests/pojos/SimplePerson.java | 186 +++++++++++++++++++
.../ignite/tests/pojos/SimplePersonId.java | 89 +++++++++
.../apache/ignite/tests/utils/TestsHelper.java | 103 +++++++++-
.../tests/persistence/pojo/ignite-config.xml | 36 ++++
.../persistence/pojo/persistence-settings-5.xml | 21 +++
.../persistence/pojo/persistence-settings-6.xml | 174 +++++++++++++++++
.../apache/ignite/IgniteSystemProperties.java | 3 +
.../GridCachePartitionExchangeManager.java | 12 +-
.../dht/GridClientPartitionTopology.java | 20 +-
.../dht/GridDhtPartitionTopology.java | 8 +-
.../dht/GridDhtPartitionTopologyImpl.java | 22 +--
...chePartitionExchangeManagerHistSizeTest.java | 76 ++++++++
.../distributed/IgniteCacheGetRestartTest.java | 4 +-
.../testsuites/IgniteCacheTestSuite5.java | 3 +
.../rocketmq/RocketMQStreamerTestSuite.java | 2 +-
parent/pom.xml | 2 +-
28 files changed, 1296 insertions(+), 325 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/96c37c6e/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/96c37c6e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
index fe1fd14,dea690e..f4c7fce
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
@@@ -1278,7 -1272,7 +1278,7 @@@ public class GridCachePartitionExchange
top = grp.topology();
if (top != null)
- updated |= top.update(null, entry.getValue(), null, msg.partsToReload(cctx.localNodeId(), grpId)) != null;
- updated |= top.update(null, entry.getValue(), null);
++ updated |= top.update(null, entry.getValue(), null, msg.partsToReload(cctx.localNodeId(), grpId));
}
if (!cctx.kernalContext().clientNode() && updated)
http://git-wip-us.apache.org/repos/asf/ignite/blob/96c37c6e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridClientPartitionTopology.java
index a17df36,9c769a9..2b16a98
--- 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
@@@ -573,12 -562,10 +573,12 @@@ public class GridClientPartitionTopolog
/** {@inheritDoc} */
@SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
- @Nullable @Override public GridDhtPartitionMap update(
+ @Override public boolean update(
@Nullable AffinityTopologyVersion exchVer,
GridDhtPartitionFullMap partMap,
- Map<Integer, T2<Long, Long>> cntrMap) {
+ Map<Integer, T2<Long, Long>> cntrMap,
+ Set<Integer> partsToReload
+ ) {
if (log.isDebugEnabled())
log.debug("Updating full partition map [exchVer=" + exchVer + ", parts=" + fullMapString() + ']');
@@@ -688,23 -674,9 +688,23 @@@
}
}
+ /**
+ * Method checks is new partition map more stale than current partition map
+ * New partition map is stale if topology version or update sequence are less than of current map
+ *
+ * @param currentMap Current partition map
+ * @param newMap New partition map
+ * @return True if new partition map is more stale than current partition map, false in other case
+ */
+ private boolean isStaleUpdate(GridDhtPartitionMap currentMap, GridDhtPartitionMap newMap) {
+ return currentMap != null &&
+ (newMap.topologyVersion().compareTo(currentMap.topologyVersion()) < 0 ||
+ newMap.topologyVersion().compareTo(currentMap.topologyVersion()) == 0 && newMap.updateSequence() <= currentMap.updateSequence());
+ }
+
/** {@inheritDoc} */
@SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
- @Nullable @Override public GridDhtPartitionMap update(
+ @Override public boolean update(
@Nullable GridDhtPartitionExchangeId exchId,
GridDhtPartitionMap parts
) {
@@@ -742,12 -714,12 +742,12 @@@
GridDhtPartitionMap cur = node2part.get(parts.nodeId());
- if (cur != null && cur.updateSequence() >= parts.updateSequence()) {
+ if (isStaleUpdate(cur, parts)) {
if (log.isDebugEnabled())
- log.debug("Stale update sequence for single partition map update (will ignore) [exchId=" + exchId +
- ", curSeq=" + cur.updateSequence() + ", newSeq=" + parts.updateSequence() + ']');
+ log.debug("Stale update for single partition map update (will ignore) [exchId=" + exchId +
+ ", curMap=" + cur + ", newMap=" + parts + ']');
- return null;
+ return false;
}
long updateSeq = this.updateSeq.incrementAndGet();
http://git-wip-us.apache.org/repos/asf/ignite/blob/96c37c6e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java
index 61ebbb1,3c38942..bf4e844
--- 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
@@@ -237,13 -225,12 +237,13 @@@ public interface GridDhtPartitionTopolo
* @param exchangeVer Exchange version.
* @param partMap Update partition map.
* @param cntrMap Partition update counters.
- * @return Local partition map if there were evictions or {@code null} otherwise.
+ * @return {@code True} if local state was changed.
*/
- public GridDhtPartitionMap update(
+ public boolean update(
@Nullable AffinityTopologyVersion exchangeVer,
GridDhtPartitionFullMap partMap,
- @Nullable Map<Integer, T2<Long, Long>> cntrMap);
+ @Nullable Map<Integer, T2<Long, Long>> cntrMap,
+ Set<Integer> partsToReload);
/**
* @param exchId Exchange ID.
http://git-wip-us.apache.org/repos/asf/ignite/blob/96c37c6e/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
----------------------------------------------------------------------
diff --cc modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopologyImpl.java
index 1620633,f3170fa..ce19c6b
--- 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
@@@ -1043,27 -1108,12 +1043,27 @@@ public class GridDhtPartitionTopologyIm
}
}
+ /**
+ * Checks should current partition map overwritten by new partition map
+ * Method returns true if topology version or update sequence of new map are greater than of current map
+ *
+ * @param currentMap Current partition map
+ * @param newMap New partition map
+ * @return True if current partition map should be overwritten by new partition map, false in other case
+ */
+ private boolean shouldOverridePartitionMap(GridDhtPartitionMap currentMap, GridDhtPartitionMap newMap) {
+ return newMap != null &&
+ (newMap.topologyVersion().compareTo(currentMap.topologyVersion()) > 0 ||
+ newMap.topologyVersion().compareTo(currentMap.topologyVersion()) == 0 && newMap.updateSequence() > currentMap.updateSequence());
+ }
+
/** {@inheritDoc} */
@SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
- @Override public GridDhtPartitionMap update(
+ @Override public boolean update(
@Nullable AffinityTopologyVersion exchangeVer,
GridDhtPartitionFullMap partMap,
- @Nullable Map<Integer, T2<Long, Long>> cntrMap
+ @Nullable Map<Integer, T2<Long, Long>> cntrMap,
+ Set<Integer> partsToReload
) {
if (log.isDebugEnabled())
log.debug("Updating full partition map [exchVer=" + exchangeVer + ", parts=" + fullMapString() + ']');
@@@ -1104,17 -1154,19 +1104,17 @@@
log.debug("Stale exchange id for full partition map update (will ignore) [lastExch=" +
lastExchangeVer + ", exch=" + exchangeVer + ']');
- return null;
+ return false;
}
- if (node2part != null && node2part.compareTo(partMap) >= 0) {
+ if (node2part != null && node2part.compareTo(partMap) > 0) {
if (log.isDebugEnabled())
log.debug("Stale partition map for full partition map update (will ignore) [lastExch=" +
lastExchangeVer + ", exch=" + exchangeVer + ", curMap=" + node2part + ", newMap=" + partMap + ']');
- return null;
+ return false;
}
- long updateSeq = this.updateSeq.incrementAndGet();
-
if (exchangeVer != null)
lastExchangeVer = exchangeVer;
@@@ -1320,23 -1311,9 +1320,23 @@@
}
}
+ /**
+ * Method checks is new partition map more stale than current partition map
+ * New partition map is stale if topology version or update sequence are less than of current map
+ *
+ * @param currentMap Current partition map
+ * @param newMap New partition map
+ * @return True if new partition map is more stale than current partition map, false in other case
+ */
+ private boolean isStaleUpdate(GridDhtPartitionMap currentMap, GridDhtPartitionMap newMap) {
+ return currentMap != null &&
+ (newMap.topologyVersion().compareTo(currentMap.topologyVersion()) < 0 ||
+ newMap.topologyVersion().compareTo(currentMap.topologyVersion()) == 0 && newMap.updateSequence() <= currentMap.updateSequence());
+ }
+
/** {@inheritDoc} */
@SuppressWarnings({"MismatchedQueryAndUpdateOfCollection"})
- @Nullable @Override public GridDhtPartitionMap update(
+ @Override public boolean update(
@Nullable GridDhtPartitionExchangeId exchId,
GridDhtPartitionMap parts
) {
@@@ -1374,12 -1351,12 +1374,12 @@@
GridDhtPartitionMap cur = node2part.get(parts.nodeId());
- if (cur != null && cur.updateSequence() >= parts.updateSequence()) {
+ if (isStaleUpdate(cur, parts)) {
if (log.isDebugEnabled())
- log.debug("Stale update sequence for single partition map update (will ignore) [exchId=" + exchId +
- ", curSeq=" + cur.updateSequence() + ", newSeq=" + parts.updateSequence() + ']');
+ log.debug("Stale update for single partition map update (will ignore) [exchId=" + exchId +
+ ", curMap=" + cur + ", newMap=" + parts + ']');
- return null;
+ return false;
}
long updateSeq = this.updateSeq.incrementAndGet();
http://git-wip-us.apache.org/repos/asf/ignite/blob/96c37c6e/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite5.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/96c37c6e/parent/pom.xml
----------------------------------------------------------------------
[05/50] ignite git commit: IGNITE-5461 Added collecting of memory
metrics.
Posted by sb...@apache.org.
IGNITE-5461 Added collecting of memory metrics.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/29c26936
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/29c26936
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/29c26936
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 29c26936872027cbf1256648b81ebdb796448fce
Parents: 57bfba7
Author: Alexey Kuznetsov <ak...@apache.org>
Authored: Fri Jun 16 21:23:34 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Fri Jun 16 21:23:34 2017 +0700
----------------------------------------------------------------------
.../ignite/internal/visor/cache/VisorCache.java | 15 --
.../internal/visor/cache/VisorCacheMetrics.java | 13 ++
.../visor/cache/VisorMemoryMetrics.java | 175 +++++++++++++++++++
.../visor/node/VisorNodeDataCollectorJob.java | 41 ++++-
.../node/VisorNodeDataCollectorJobResult.java | 32 ++++
.../visor/node/VisorNodeDataCollectorTask.java | 6 +
.../node/VisorNodeDataCollectorTaskResult.java | 27 +++
7 files changed, 287 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/29c26936/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
index e1d3a87..aa4f271 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCache.java
@@ -71,9 +71,6 @@ public class VisorCache extends VisorDataTransferObject {
/** Number of backup entries in cache. */
private long backupSize;
- /** Number of cache entries stored in heap memory. */
- private long onHeapEntriesCnt;
-
/** Number of partitions. */
private int partitions;
@@ -112,8 +109,6 @@ public class VisorCache extends VisorDataTransferObject {
partitions = ca.affinity().partitions();
near = cctx.isNear();
- onHeapEntriesCnt = 0; // TODO GG-11148 How to get this metric?
-
metrics = new VisorCacheMetrics(ignite, name);
}
@@ -131,7 +126,6 @@ public class VisorCache extends VisorDataTransferObject {
c.nearSize = nearSize;
c.backupSize = backupSize;
c.primarySize = primarySize;
- c.onHeapEntriesCnt = onHeapEntriesCnt;
c.partitions = partitions;
c.metrics = metrics;
c.near = near;
@@ -212,13 +206,6 @@ public class VisorCache extends VisorDataTransferObject {
}
/**
- * @return Number of cache entries stored in heap memory.
- */
- public long getOnHeapEntriesCount() {
- return onHeapEntriesCnt;
- }
-
- /**
* @return Number of partitions.
*/
public int getPartitions() {
@@ -250,7 +237,6 @@ public class VisorCache extends VisorDataTransferObject {
out.writeInt(nearSize);
out.writeLong(primarySize);
out.writeLong(backupSize);
- out.writeLong(onHeapEntriesCnt);
out.writeInt(partitions);
out.writeBoolean(near);
out.writeObject(metrics);
@@ -267,7 +253,6 @@ public class VisorCache extends VisorDataTransferObject {
nearSize = in.readInt();
primarySize = in.readLong();
backupSize = in.readLong();
- onHeapEntriesCnt = in.readLong();
partitions = in.readInt();
near = in.readBoolean();
metrics = (VisorCacheMetrics)in.readObject();
http://git-wip-us.apache.org/repos/asf/ignite/blob/29c26936/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
index 5c1dfcb..e67f5f8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheMetrics.java
@@ -157,6 +157,9 @@ public class VisorCacheMetrics extends VisorDataTransferObject {
/** Number of cached rolled back DHT transaction IDs. */
private int txDhtRolledbackVersionsSize;
+ /** Number of cache entries stored in heap memory. */
+ private long heapEntriesCnt;
+
/** Memory size allocated in off-heap. */
private long offHeapAllocatedSize;
@@ -259,6 +262,7 @@ public class VisorCacheMetrics extends VisorDataTransferObject {
txDhtCommittedVersionsSize = m.getTxDhtCommittedVersionsSize();
txDhtRolledbackVersionsSize = m.getTxDhtRolledbackVersionsSize();
+ heapEntriesCnt = m.getHeapEntriesCount();
offHeapAllocatedSize = m.getOffHeapAllocatedSize();
offHeapEntriesCnt = m.getOffHeapEntriesCount();
@@ -561,6 +565,13 @@ public class VisorCacheMetrics extends VisorDataTransferObject {
}
/**
+ * @return Number of entries in heap memory.
+ */
+ public long getHeapEntriesCount() {
+ return heapEntriesCnt;
+ }
+
+ /**
* @return Memory size allocated in off-heap.
*/
public long getOffHeapAllocatedSize() {
@@ -653,6 +664,7 @@ public class VisorCacheMetrics extends VisorDataTransferObject {
out.writeInt(txDhtCommittedVersionsSize);
out.writeInt(txDhtRolledbackVersionsSize);
+ out.writeLong(heapEntriesCnt);
out.writeLong(offHeapAllocatedSize);
out.writeLong(offHeapEntriesCnt);
@@ -708,6 +720,7 @@ public class VisorCacheMetrics extends VisorDataTransferObject {
txDhtCommittedVersionsSize = in.readInt();
txDhtRolledbackVersionsSize = in.readInt();
+ heapEntriesCnt = in.readLong();
offHeapAllocatedSize = in.readLong();
offHeapEntriesCnt = in.readLong();
http://git-wip-us.apache.org/repos/asf/ignite/blob/29c26936/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java
new file mode 100644
index 0000000..14eaba6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorMemoryMetrics.java
@@ -0,0 +1,175 @@
+/*
+ * 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.visor.cache;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.MemoryMetrics;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Data transfer object for {@link MemoryMetrics}
+ */
+public class VisorMemoryMetrics extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private String name;
+
+ /** */
+ private long totalAllocatedPages;
+
+ /** */
+ private float allocationRate;
+
+ /** */
+ private float evictionRate;
+
+ /** */
+ private float largeEntriesPagesPercentage;
+
+ /** */
+ private float pagesFillFactor;
+
+ /** */
+ private long dirtyPages;
+
+ /** */
+ private float pageReplaceRate;
+
+ /** */
+ private long physicalMemoryPages;
+
+ /**
+ * Default constructor.
+ */
+ public VisorMemoryMetrics() {
+ // No-op.
+ }
+
+ /**
+ * @param m Metrics instance to create DTO.
+ */
+ public VisorMemoryMetrics(MemoryMetrics m) {
+ name = m.getName();
+ totalAllocatedPages = m.getTotalAllocatedPages();
+ allocationRate = m.getAllocationRate();
+ evictionRate = m.getEvictionRate();
+ largeEntriesPagesPercentage = m.getLargeEntriesPagesPercentage();
+ pagesFillFactor = m.getPagesFillFactor();
+ dirtyPages = m.getDirtyPages();
+ pageReplaceRate = m.getPagesReplaceRate();
+ physicalMemoryPages = m.getPhysicalMemoryPages();
+ }
+
+ /**
+ * @return Name of the memory region.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @return Total number of allocated pages.
+ */
+ public long getTotalAllocatedPages() {
+ return totalAllocatedPages;
+ }
+
+ /**
+ * @return Number of allocated pages per second.
+ */
+ public float getAllocationRate() {
+ return allocationRate;
+ }
+
+ /** {@inheritDoc} */
+ public float getEvictionRate() {
+ return evictionRate;
+ }
+
+ /**
+ * @return Number of evicted pages per second.
+ */
+ public float getLargeEntriesPagesPercentage() {
+ return largeEntriesPagesPercentage;
+ }
+
+ /**
+ * @return Percentage of pages fully occupied by large entities.
+ */
+ public float getPagesFillFactor() {
+ return pagesFillFactor;
+ }
+
+ /**
+ * @return Current number of dirty pages.
+ */
+ public long getDirtyPages() {
+ return dirtyPages;
+ }
+
+ /**
+ * @return Pages per second replace rate.
+ */
+ public float getPagesReplaceRate() {
+ return pageReplaceRate;
+ }
+
+ /**
+ * @return Total number of pages loaded to RAM.
+ */
+ public long getPhysicalMemoryPages() {
+ return physicalMemoryPages;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, name);
+ out.writeLong(totalAllocatedPages);
+ out.writeFloat(allocationRate);
+ out.writeFloat(evictionRate);
+ out.writeFloat(largeEntriesPagesPercentage);
+ out.writeFloat(pagesFillFactor);
+ out.writeLong(dirtyPages);
+ out.writeFloat(pageReplaceRate);
+ out.writeLong(physicalMemoryPages);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ name = U.readString(in);
+ totalAllocatedPages = in.readLong();
+ allocationRate = in.readFloat();
+ evictionRate = in.readFloat();
+ largeEntriesPagesPercentage = in.readFloat();
+ pagesFillFactor = in.readFloat();
+ dirtyPages = in.readLong();
+ pageReplaceRate = in.readFloat();
+ physicalMemoryPages = in.readLong();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorMemoryMetrics.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/29c26936/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
index 02d3b65..f5ea567 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJob.java
@@ -18,8 +18,10 @@
package org.apache.ignite.internal.visor.node;
import java.util.Collection;
+import java.util.List;
import java.util.concurrent.ConcurrentMap;
import org.apache.ignite.IgniteFileSystem;
+import org.apache.ignite.MemoryMetrics;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.configuration.FileSystemConfiguration;
import org.apache.ignite.configuration.IgniteConfiguration;
@@ -33,6 +35,7 @@ import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.visor.VisorJob;
import org.apache.ignite.internal.visor.cache.VisorCache;
+import org.apache.ignite.internal.visor.cache.VisorMemoryMetrics;
import org.apache.ignite.internal.visor.compute.VisorComputeMonitoringHolder;
import org.apache.ignite.internal.visor.igfs.VisorIgfs;
import org.apache.ignite.internal.visor.igfs.VisorIgfsEndpoint;
@@ -115,8 +118,8 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
events0(res, arg.getEventsOrderKey(), arg.getEventsThrottleCounterKey(), arg.isTaskMonitoringEnabled());
}
- catch (Exception eventsEx) {
- res.setEventsEx(eventsEx);
+ catch (Exception e) {
+ res.setEventsEx(e);
}
}
@@ -145,6 +148,23 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
}
/**
+ * Collect memory metrics.
+ *
+ * @param res Job result.
+ */
+ protected void memoryMetrics(VisorNodeDataCollectorJobResult res) {
+ try {
+ List<VisorMemoryMetrics> memoryMetrics = res.getMemoryMetrics();
+
+ for (MemoryMetrics m : ignite.memoryMetrics())
+ memoryMetrics.add(new VisorMemoryMetrics(m));
+ }
+ catch (Exception e) {
+ res.setMemoryMetricsEx(e);
+ }
+}
+
+ /**
* Collect caches.
*
* @param res Job result.
@@ -156,6 +176,8 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
GridCacheProcessor cacheProc = ignite.context().cache();
+ List<VisorCache> resCaches = res.getCaches();
+
for (String cacheName : cacheProc.cacheNames()) {
if (proxyCache(cacheName))
continue;
@@ -169,7 +191,7 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
if (ca == null || !ca.context().started())
continue;
- res.getCaches().add(new VisorCache(ignite, ca));
+ resCaches.add(new VisorCache(ignite, ca));
}
catch(IllegalStateException | IllegalArgumentException e) {
if (debug && ignite.log() != null)
@@ -182,8 +204,8 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
}
}
}
- catch (Exception cachesEx) {
- res.setCachesEx(cachesEx);
+ catch (Exception e) {
+ res.setCachesEx(e);
}
}
@@ -222,8 +244,8 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
}
}
}
- catch (Exception igfssEx) {
- res.setIgfssEx(igfssEx);
+ catch (Exception e) {
+ res.setIgfssEx(e);
}
}
@@ -257,6 +279,11 @@ public class VisorNodeDataCollectorJob extends VisorJob<VisorNodeDataCollectorTa
if (debug)
start0 = log(ignite.log(), "Collected events", getClass(), start0);
+ memoryMetrics(res);
+
+ if (debug)
+ start0 = log(ignite.log(), "Collected memory metrics", getClass(), start0);
+
caches(res, arg);
if (debug)
http://git-wip-us.apache.org/repos/asf/ignite/blob/29c26936/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java
index 761d0ff..ce4f9fc 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorJobResult.java
@@ -26,6 +26,7 @@ import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.apache.ignite.internal.visor.cache.VisorCache;
+import org.apache.ignite.internal.visor.cache.VisorMemoryMetrics;
import org.apache.ignite.internal.visor.event.VisorGridEvent;
import org.apache.ignite.internal.visor.igfs.VisorIgfs;
import org.apache.ignite.internal.visor.igfs.VisorIgfsEndpoint;
@@ -52,6 +53,12 @@ public class VisorNodeDataCollectorJobResult extends VisorDataTransferObject {
/** Exception while collecting node events. */
private Throwable evtsEx;
+ /** Node memory metrics. */
+ private List<VisorMemoryMetrics> memoryMetrics = new ArrayList<>();
+
+ /** Exception while collecting memory metrics. */
+ private Throwable memoryMetricsEx;
+
/** Node caches. */
private List<VisorCache> caches = new ArrayList<>();
@@ -147,6 +154,27 @@ public class VisorNodeDataCollectorJobResult extends VisorDataTransferObject {
}
/**
+ * @return Collected memory metrics.
+ */
+ public List<VisorMemoryMetrics> getMemoryMetrics() {
+ return memoryMetrics;
+ }
+
+ /**
+ * @return Exception caught during collecting memory metrics.
+ */
+ public Throwable getMemoryMetricsEx() {
+ return memoryMetricsEx;
+ }
+
+ /**
+ * @param memoryMetricsEx Exception caught during collecting memory metrics.
+ */
+ public void setMemoryMetricsEx(Throwable memoryMetricsEx) {
+ this.memoryMetricsEx = memoryMetricsEx;
+ }
+
+ /**
* @return Collected cache metrics.
*/
public List<VisorCache> getCaches() {
@@ -244,6 +272,8 @@ public class VisorNodeDataCollectorJobResult extends VisorDataTransferObject {
out.writeBoolean(taskMonitoringEnabled);
U.writeCollection(out, evts);
out.writeObject(evtsEx);
+ U.writeCollection(out, memoryMetrics);
+ out.writeObject(memoryMetricsEx);
U.writeCollection(out, caches);
out.writeObject(cachesEx);
U.writeCollection(out, igfss);
@@ -261,6 +291,8 @@ public class VisorNodeDataCollectorJobResult extends VisorDataTransferObject {
taskMonitoringEnabled = in.readBoolean();
evts = U.readList(in);
evtsEx = (Throwable)in.readObject();
+ memoryMetrics = U.readList(in);
+ memoryMetricsEx = (Throwable)in.readObject();
caches = U.readList(in);
cachesEx = (Throwable)in.readObject();
igfss = U.readList(in);
http://git-wip-us.apache.org/repos/asf/ignite/blob/29c26936/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java
index 2790dec..56b3718 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTask.java
@@ -99,6 +99,12 @@ public class VisorNodeDataCollectorTask extends VisorMultiNodeTask<VisorNodeData
if (jobRes.getEventsEx() != null)
taskRes.getEventsEx().put(nid, new VisorExceptionWrapper(jobRes.getEventsEx()));
+ if (!jobRes.getMemoryMetrics().isEmpty())
+ taskRes.getMemoryMetrics().put(nid, jobRes.getMemoryMetrics());
+
+ if (jobRes.getMemoryMetricsEx() != null)
+ taskRes.getMemoryMetricsEx().put(nid, new VisorExceptionWrapper(jobRes.getMemoryMetricsEx()));
+
if (!jobRes.getCaches().isEmpty())
taskRes.getCaches().put(nid, jobRes.getCaches());
http://git-wip-us.apache.org/repos/asf/ignite/blob/29c26936/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
index 8d1fe8e..cef3a29 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/node/VisorNodeDataCollectorTaskResult.java
@@ -30,6 +30,7 @@ import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.visor.VisorDataTransferObject;
import org.apache.ignite.internal.visor.cache.VisorCache;
+import org.apache.ignite.internal.visor.cache.VisorMemoryMetrics;
import org.apache.ignite.internal.visor.event.VisorGridEvent;
import org.apache.ignite.internal.visor.igfs.VisorIgfs;
import org.apache.ignite.internal.visor.igfs.VisorIgfsEndpoint;
@@ -66,6 +67,12 @@ public class VisorNodeDataCollectorTaskResult extends VisorDataTransferObject {
/** Exceptions caught during collecting events from nodes. */
private Map<UUID, VisorExceptionWrapper> evtsEx = new HashMap<>();
+ /** All memory metrics collected from nodes. */
+ private Map<UUID, Collection<VisorMemoryMetrics>> memoryMetrics = new HashMap<>();
+
+ /** Exceptions caught during collecting memory metrics from nodes. */
+ private Map<UUID, VisorExceptionWrapper> memoryMetricsEx = new HashMap<>();
+
/** All caches collected from nodes. */
private Map<UUID, Collection<VisorCache>> caches = new HashMap<>();
@@ -105,6 +112,8 @@ public class VisorNodeDataCollectorTaskResult extends VisorDataTransferObject {
taskMonitoringEnabled.isEmpty() &&
evts.isEmpty() &&
evtsEx.isEmpty() &&
+ memoryMetrics.isEmpty() &&
+ memoryMetricsEx.isEmpty() &&
caches.isEmpty() &&
cachesEx.isEmpty() &&
igfss.isEmpty() &&
@@ -171,6 +180,20 @@ public class VisorNodeDataCollectorTaskResult extends VisorDataTransferObject {
}
/**
+ * @return All memory metrics collected from nodes.
+ */
+ public Map<UUID, Collection<VisorMemoryMetrics>> getMemoryMetrics() {
+ return memoryMetrics;
+ }
+
+ /**
+ * @return Exceptions caught during collecting memory metrics from nodes.
+ */
+ public Map<UUID, VisorExceptionWrapper> getMemoryMetricsEx() {
+ return memoryMetricsEx;
+ }
+
+ /**
* @return All caches collected from nodes.
*/
public Map<UUID, Collection<VisorCache>> getCaches() {
@@ -236,6 +259,8 @@ public class VisorNodeDataCollectorTaskResult extends VisorDataTransferObject {
U.writeMap(out, errCnts);
U.writeCollection(out, evts);
U.writeMap(out, evtsEx);
+ U.writeMap(out, memoryMetrics);
+ U.writeMap(out, memoryMetricsEx);
U.writeMap(out, caches);
U.writeMap(out, cachesEx);
U.writeMap(out, igfss);
@@ -255,6 +280,8 @@ public class VisorNodeDataCollectorTaskResult extends VisorDataTransferObject {
errCnts = U.readMap(in);
evts = U.readList(in);
evtsEx = U.readMap(in);
+ memoryMetrics = U.readMap(in);
+ memoryMetricsEx = U.readMap(in);
caches = U.readMap(in);
cachesEx = U.readMap(in);
igfss = U.readMap(in);
[38/50] ignite git commit: Merge branch 'ignite-gg-12335' into
ignite-2.1.1
Posted by sb...@apache.org.
Merge branch 'ignite-gg-12335' into ignite-2.1.1
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/599d1a8f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/599d1a8f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/599d1a8f
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 599d1a8f240718913aa77fd2a1c5997e8249f46f
Parents: 42e8ca6 369133a
Author: Dmitriy Govorukhin <dm...@gmail.com>
Authored: Sat Jun 17 22:18:26 2017 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Sat Jun 17 22:18:26 2017 +0300
----------------------------------------------------------------------
.../internal/managers/discovery/GridDiscoveryManager.java | 2 +-
.../ignite/internal/processors/cache/ClusterCachesInfo.java | 2 +-
.../dht/preloader/GridDhtPartitionsExchangeFuture.java | 8 ++++++--
.../processors/cluster/GridClusterStateProcessor.java | 2 ++
.../standbycluster/IgniteChangeGlobalStateTest.java | 4 ++--
5 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
[36/50] ignite git commit: ignite-gg-12335 fix fail activation after
fail get file lock
Posted by sb...@apache.org.
ignite-gg-12335 fix fail activation after fail get file lock
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/369133a0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/369133a0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/369133a0
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 369133a0405b857728bb9d157311edac21cfeba5
Parents: 52626df
Author: Dmitriy Govorukhin <dm...@gmail.com>
Authored: Sat Jun 17 17:41:16 2017 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Sat Jun 17 17:41:16 2017 +0300
----------------------------------------------------------------------
.../internal/managers/discovery/GridDiscoveryManager.java | 2 +-
.../ignite/internal/processors/cache/ClusterCachesInfo.java | 2 +-
.../dht/preloader/GridDhtPartitionsExchangeFuture.java | 8 ++++++--
.../processors/cluster/GridClusterStateProcessor.java | 2 ++
.../standbycluster/IgniteChangeGlobalStateTest.java | 4 ++--
5 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/369133a0/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
index 485e682..de8daa7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
@@ -332,7 +332,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
/**
*
*/
- public void onLocalNodeJoin() {
+ public void cleanCachesAndGroups() {
registeredCacheGrps.clear();
registeredCaches.clear();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/369133a0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
index 0f3b6b1..15345d9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/ClusterCachesInfo.java
@@ -860,7 +860,7 @@ class ClusterCachesInfo {
// Replace locally registered data with actual data received from cluster.
registeredCaches.clear();
registeredCacheGrps.clear();
- ctx.discovery().onLocalNodeJoin();
+ ctx.discovery().cleanCachesAndGroups();
for (CacheGroupData grpData : cachesData.cacheGroups().values()) {
CacheGroupDescriptor grpDesc = new CacheGroupDescriptor(
http://git-wip-us.apache.org/repos/asf/ignite/blob/369133a0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
index fe7527a..939fa80 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPartitionsExchangeFuture.java
@@ -717,8 +717,12 @@ public class GridDhtPartitionsExchangeFuture extends GridDhtTopologyFutureAdapte
if (exchangeOnChangeGlobalState = stateProc.changeGlobalState(exchActions, topologyVersion())) {
changeGlobalStateE = stateProc.onChangeGlobalState();
- if (crd && changeGlobalStateE != null)
- changeGlobalStateExceptions.put(cctx.localNodeId(), changeGlobalStateE);
+ if (changeGlobalStateE != null) {
+ if (crd)
+ changeGlobalStateExceptions.put(cctx.localNodeId(), changeGlobalStateE);
+
+ return cctx.kernalContext().clientNode() ? ExchangeType.CLIENT : ExchangeType.ALL;
+ }
}
assert !exchActions.clientOnlyExchange() : exchActions;
http://git-wip-us.apache.org/repos/asf/ignite/blob/369133a0/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
index 9bf0cfa..031c596 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
@@ -674,6 +674,8 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
sharedCtx.affinity().removeAllCacheInfo();
+ ctx.discovery().cleanCachesAndGroups();
+
if (!ctx.clientNode()) {
sharedCtx.database().onDeActivate(ctx);
http://git-wip-us.apache.org/repos/asf/ignite/blob/369133a0/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
index 0df8fe0..9151c24 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/standbycluster/IgniteChangeGlobalStateTest.java
@@ -501,7 +501,7 @@ public class IgniteChangeGlobalStateTest extends IgniteChangeGlobalStateAbstract
/**
*
*/
- public void _testFailGetLock() throws Exception {
+ public void testFailGetLock() throws Exception {
Ignite ig1P = primary(0);
Ignite ig2P = primary(1);
Ignite ig3P = primary(2);
@@ -558,7 +558,7 @@ public class IgniteChangeGlobalStateTest extends IgniteChangeGlobalStateAbstract
/**
*
*/
- public void _testActivateAfterFailGetLock() throws Exception {
+ public void testActivateAfterFailGetLock() throws Exception {
Ignite ig1P = primary(0);
Ignite ig2P = primary(1);
Ignite ig3P = primary(2);
[06/50] ignite git commit: ignite-2.1.1 add test dependency
Posted by sb...@apache.org.
ignite-2.1.1 add test dependency
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2888097e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2888097e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2888097e
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 2888097e118b98e935959338875d32341c1d1e57
Parents: 57bfba7
Author: Dmitriy Govorukhin <dm...@gmail.com>
Authored: Fri Jun 16 17:33:10 2017 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Fri Jun 16 17:33:10 2017 +0300
----------------------------------------------------------------------
modules/indexing/pom.xml | 7 +++++++
1 file changed, 7 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2888097e/modules/indexing/pom.xml
----------------------------------------------------------------------
diff --git a/modules/indexing/pom.xml b/modules/indexing/pom.xml
index 2a4cfd3..5c74f37 100644
--- a/modules/indexing/pom.xml
+++ b/modules/indexing/pom.xml
@@ -68,6 +68,13 @@
</dependency>
<dependency>
+ <groupId>com.thoughtworks.xstream</groupId>
+ <artifactId>xstream</artifactId>
+ <version>1.4.8</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
[15/50] ignite git commit: Merge remote-tracking branch
'professional/ignite-gg-12289' into ignite-2.1.1
Posted by sb...@apache.org.
Merge remote-tracking branch 'professional/ignite-gg-12289' into ignite-2.1.1
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d21e6a54
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d21e6a54
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d21e6a54
Branch: refs/heads/ignite-2.1.2-exchange
Commit: d21e6a5418e63ab3c282a5a12d1dbd5e02ddf91d
Parents: afa0810 848af36
Author: Dmitriy Govorukhin <dm...@gmail.com>
Authored: Fri Jun 16 21:11:06 2017 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Fri Jun 16 21:11:06 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheProcessor.java | 25 ++++++++++----------
.../GridDhtPartitionsExchangeFuture.java | 8 ++++++-
.../GridCacheDatabaseSharedManager.java | 17 +++++--------
.../persistence/tree/util/PageHandler.java | 2 +-
4 files changed, 27 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d21e6a54/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheProcessor.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d21e6a54/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
[22/50] ignite git commit: ignite-5226 Cleanup client topology on
cache group stop
Posted by sb...@apache.org.
ignite-5226 Cleanup client topology on cache group stop
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/44c723c3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/44c723c3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/44c723c3
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 44c723c35847cf6eb13dddd1111fa2ead3e8bae7
Parents: 636ddb0
Author: Ivan Rakov <ir...@gridgain.com>
Authored: Sat Jun 17 09:02:55 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Sat Jun 17 09:02:55 2017 +0300
----------------------------------------------------------------------
.../cache/CacheAffinitySharedManager.java | 3 +
...AffinityCoordinatorDynamicStartStopTest.java | 139 +++++++++++++++++++
.../testsuites/IgniteCacheTestSuite2.java | 3 +
3 files changed, 145 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/44c723c3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
index eada554..231c58e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/CacheAffinitySharedManager.java
@@ -758,6 +758,9 @@ public class CacheAffinitySharedManager<K, V> extends GridCacheSharedManagerAdap
for (ExchangeActions.ActionData action : exchActions.cacheStopRequests())
cctx.cache().blockGateway(action.request().cacheName(), true, action.request().restart());
+ for (CacheGroupDescriptor grpDesc : exchActions.cacheGroupsToStop())
+ cctx.exchange().clearClientTopology(grpDesc.groupId());
+
Set<Integer> stoppedGrps = null;
if (crd && lateAffAssign) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/44c723c3/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/NonAffinityCoordinatorDynamicStartStopTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/NonAffinityCoordinatorDynamicStartStopTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/NonAffinityCoordinatorDynamicStartStopTest.java
new file mode 100644
index 0000000..a4733d5
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/NonAffinityCoordinatorDynamicStartStopTest.java
@@ -0,0 +1,139 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.ignite.internal.processors.cache;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.MemoryConfiguration;
+import org.apache.ignite.configuration.MemoryPolicyConfiguration;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.lang.IgnitePredicate;
+import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder;
+import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+/**
+ *
+ */
+public class NonAffinityCoordinatorDynamicStartStopTest extends GridCommonAbstractTest {
+ /** Ip finder. */
+ private static final TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** */
+ private static final String TEST_ATTRIBUTE = "test-attribute";
+
+ /** Dummy grid name. */
+ private static final String DUMMY_GRID_NAME = "dummy";
+
+ /** Cache configuration. */
+ private static final CacheConfiguration<Integer, Integer> CCFG = new CacheConfiguration<Integer, Integer>("cache")
+ .setAffinity(new RendezvousAffinityFunction(false, 32))
+ .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC)
+ .setNodeFilter(new TestNodeFilter())
+ .setGroupName("Group");
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ TcpDiscoverySpi discoverySpi = (TcpDiscoverySpi)cfg.getDiscoverySpi();
+ discoverySpi.setIpFinder(ipFinder);
+
+ MemoryConfiguration dbCfg = new MemoryConfiguration();
+
+ MemoryPolicyConfiguration memPlcCfg = new MemoryPolicyConfiguration();
+ memPlcCfg.setMaxSize(200 * 1000 * 1000);
+
+ memPlcCfg.setName("dfltMemPlc");
+
+ dbCfg.setMemoryPolicies(memPlcCfg);
+ dbCfg.setDefaultMemoryPolicyName("dfltMemPlc");
+
+ if (gridName.contains(DUMMY_GRID_NAME))
+ cfg.setUserAttributes(F.asMap(TEST_ATTRIBUTE, false));
+ else
+ cfg.setUserAttributes(F.asMap(TEST_ATTRIBUTE, true));
+
+ cfg.setConsistentId(gridName);
+
+ if (gridName.contains("client"))
+ cfg.setClientMode(true);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ stopAllGrids();
+
+ final Ignite crd = startGrid(DUMMY_GRID_NAME);
+
+ crd.active(true);
+
+ startGrid("client");
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStartStop() throws Exception {
+ startGrids(2);
+
+ awaitPartitionMapExchange();
+
+ Ignite ig = ignite(0);
+
+ IgniteCache<Integer, Integer> cache = ig.getOrCreateCache(CCFG);
+
+ for (int i = 0; i < 1000; i++)
+ cache.put(i, i);
+
+ cache.destroy();
+
+ grid("dummy").createCache(CCFG);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected boolean checkTopology() {
+ // We start a dummy node in the beginning of the each test,
+ // so default startGrids(n) will fail on wait for .
+ return false;
+ }
+
+ /**
+ *
+ */
+ private static class TestNodeFilter implements IgnitePredicate<ClusterNode> {
+ /** {@inheritDoc} */
+ @Override public boolean apply(ClusterNode clusterNode) {
+ return Boolean.TRUE.equals(clusterNode.attribute(TEST_ATTRIBUTE));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/44c723c3/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
index b9a81c8..83b8df5 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite2.java
@@ -48,6 +48,7 @@ import org.apache.ignite.internal.processors.cache.IgniteNearClientCacheCloseTes
import org.apache.ignite.internal.processors.cache.IgniteOnePhaseCommitInvokeTest;
import org.apache.ignite.internal.processors.cache.IgniteOnePhaseCommitNearReadersTest;
import org.apache.ignite.internal.processors.cache.MemoryPolicyConfigValidationTest;
+import org.apache.ignite.internal.processors.cache.NonAffinityCoordinatorDynamicStartStopTest;
import org.apache.ignite.internal.processors.cache.persistence.MemoryPolicyInitializationTest;
import org.apache.ignite.internal.processors.cache.distributed.CacheLoadingConcurrentGridStartSelfTest;
import org.apache.ignite.internal.processors.cache.distributed.CacheLoadingConcurrentGridStartSelfTestAllowOverwrite;
@@ -277,6 +278,8 @@ public class IgniteCacheTestSuite2 extends TestSuite {
suite.addTest(new TestSuite(IgniteNearClientCacheCloseTest.class));
suite.addTest(new TestSuite(IgniteClientCacheStartFailoverTest.class));
+ suite.addTest(new TestSuite(NonAffinityCoordinatorDynamicStartStopTest.class));
+
return suite;
}
}
[11/50] ignite git commit: Merge remote-tracking branch
'professional/ignite-2.1.1' into ignite-2.1.1
Posted by sb...@apache.org.
Merge remote-tracking branch 'professional/ignite-2.1.1' into ignite-2.1.1
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c99639c5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c99639c5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c99639c5
Branch: refs/heads/ignite-2.1.2-exchange
Commit: c99639c551d135f181a84aab8c29988f227a562b
Parents: 6bd4db5 c8d572f
Author: Dmitriy Govorukhin <dm...@gmail.com>
Authored: Fri Jun 16 18:16:56 2017 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Fri Jun 16 18:16:56 2017 +0300
----------------------------------------------------------------------
.../PersistentStoreConfiguration.java | 8 ++++----
.../pagemem/wal/IgniteWriteAheadLogManager.java | 3 ++-
.../GridCacheDatabaseSharedManager.java | 14 ++++++-------
.../cache/persistence/wal/FileWALPointer.java | 4 ++--
.../wal/FileWriteAheadLogManager.java | 21 +++++++++++---------
5 files changed, 27 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
[29/50] ignite git commit: Merge branches 'ignite-2.1.1' and
'ignite-gg-12325' of https://github.com/gridgain/apache-ignite into
ignite-2.1.1
Posted by sb...@apache.org.
Merge branches 'ignite-2.1.1' and 'ignite-gg-12325' of https://github.com/gridgain/apache-ignite into ignite-2.1.1
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/52626df0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/52626df0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/52626df0
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 52626df05253afb520c5d96b25c9177ac38c61dc
Parents: df121b5 3a16585
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Sat Jun 17 14:23:21 2017 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Sat Jun 17 14:23:21 2017 +0300
----------------------------------------------------------------------
.../processors/datastructures/DataStructuresProcessor.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
[46/50] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-2.1.2
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-2.1.2
# Conflicts:
# modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCachePartitionExchangeManager.java
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2503f9ec
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2503f9ec
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2503f9ec
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 2503f9ec2c5ade34faa77e72670061f430da3ddc
Parents: 96c37c6
Author: sboikov <sb...@gridgain.com>
Authored: Mon Jun 19 20:24:09 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Jun 19 20:24:09 2017 +0300
----------------------------------------------------------------------
.../src/main/java/org/apache/ignite/IgniteSystemProperties.java | 3 ---
1 file changed, 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2503f9ec/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 e1c2b73..085712a 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteSystemProperties.java
@@ -617,9 +617,6 @@ public final class IgniteSystemProperties {
*/
public static final String IGNITE_PDS_SKIP_CRC = "IGNITE_PDS_SKIP_CRC";
- /** */
- public static final String IGNITE_EXCHANGE_HISTORY_SIZE = "IGNITE_EXCHANGE_HISTORY_SIZE";
-
/**
* WAL rebalance threshold.
*/
[08/50] ignite git commit: WAL history size: code commenting
Posted by sb...@apache.org.
WAL history size: code commenting
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c8d572fd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c8d572fd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c8d572fd
Branch: refs/heads/ignite-2.1.2-exchange
Commit: c8d572fdd724177b4e88c416bc21243a5ee4f733
Parents: f391196
Author: dpavlov <dp...@gridgain.com>
Authored: Fri Jun 16 17:58:45 2017 +0300
Committer: dpavlov <dp...@gridgain.com>
Committed: Fri Jun 16 17:59:46 2017 +0300
----------------------------------------------------------------------
.../PersistentStoreConfiguration.java | 8 ++++----
.../pagemem/wal/IgniteWriteAheadLogManager.java | 3 ++-
.../GridCacheDatabaseSharedManager.java | 10 +++++++---
.../cache/persistence/wal/FileWALPointer.java | 4 ++--
.../wal/FileWriteAheadLogManager.java | 21 +++++++++++---------
5 files changed, 27 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c8d572fd/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java
index 86f0bd7..1d41d41 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/PersistentStoreConfiguration.java
@@ -49,7 +49,7 @@ public class PersistentStoreConfiguration implements Serializable {
/** Default number of checkpointing threads. */
public static final int DFLT_CHECKPOINTING_THREADS = 1;
- /** */
+ /** Default number of checkpoints to be kept in WAL after checkpoint is finished */
public static final int DFLT_WAL_HISTORY_SIZE = 20;
/** */
@@ -97,7 +97,7 @@ public class PersistentStoreConfiguration implements Serializable {
/** */
private int checkpointingThreads = DFLT_CHECKPOINTING_THREADS;
- /** */
+ /** Number of checkpoints to keep */
private int walHistSize = DFLT_WAL_HISTORY_SIZE;
/** Number of work WAL segments. */
@@ -256,7 +256,7 @@ public class PersistentStoreConfiguration implements Serializable {
/**
* Gets a total number of checkpoints to keep in the WAL history.
*
- * @return Number of WAL segments to keep after a checkpoint is finished.
+ * @return Number of checkpoints to keep in WAL after a checkpoint is finished.
*/
public int getWalHistorySize() {
return walHistSize <= 0 ? DFLT_WAL_HISTORY_SIZE : walHistSize;
@@ -265,7 +265,7 @@ public class PersistentStoreConfiguration implements Serializable {
/**
* Sets a total number of checkpoints to keep in the WAL history.
*
- * @param walHistSize Number of WAL segments to keep after a checkpoint is finished.
+ * @param walHistSize Number of checkpoints to keep after a checkpoint is finished.
* @return {@code this} for chaining.
*/
public PersistentStoreConfiguration setWalHistorySize(int walHistSize) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/c8d572fd/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/IgniteWriteAheadLogManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/IgniteWriteAheadLogManager.java b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/IgniteWriteAheadLogManager.java
index 187df8d..ce28ff2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/IgniteWriteAheadLogManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/pagemem/wal/IgniteWriteAheadLogManager.java
@@ -107,7 +107,8 @@ public interface IgniteWriteAheadLogManager extends GridCacheSharedManager, Igni
public int walArchiveSegments();
/**
- * @param ptr Pointer.
+ * Checks if WAL segment is under lock or reserved
+ * @param ptr Pointer to check.
* @return True if given pointer is located in reserved segment.
*/
public boolean reserved(WALPointer ptr);
http://git-wip-us.apache.org/repos/asf/ignite/blob/c8d572fd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index 9bc56e7..1a7fc5b 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -1313,6 +1313,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
}
/**
+ * Loads WAL pointer from CP file
* @param cpMarkerFile Checkpoint mark file.
* @return WAL pointer.
* @throws IgniteCheckedException If failed to read mark file.
@@ -2587,7 +2588,10 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
*/
@SuppressWarnings("PublicInnerClass")
public class CheckpointHistory {
- /** */
+ /**
+ * Maps checkpoint's timestamp (from CP file name) to CP entry.
+ * Using TS provides historical order of CP entries in map ( first is oldest )
+ */
private final NavigableMap<Long, CheckpointEntry> histMap = new ConcurrentSkipListMap<>();
/**
@@ -2768,7 +2772,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
@SuppressWarnings("unused")
private volatile int initGuard;
- /** Checkpoint ID. Initalized lazily. */
+ /** Checkpoint ID. Initialized lazily. */
private UUID cpId;
/** Cache states. Initialized lazily. */
@@ -2781,7 +2785,7 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
* Lazy entry constructor.
*
* @param cpTs Checkpoint timestamp.
- * @param cpMark Checkpoint WAL mark.
+ * @param cpMark Checkpoint end mark (WAL pointer).
*/
private CheckpointEntry(long cpTs, WALPointer cpMark) {
assert cpMark != null;
http://git-wip-us.apache.org/repos/asf/ignite/blob/c8d572fd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWALPointer.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWALPointer.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWALPointer.java
index 033b1c4..b6ddfb8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWALPointer.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWALPointer.java
@@ -24,7 +24,7 @@ import org.apache.ignite.internal.util.typedef.internal.S;
* File WAL pointer.
*/
public class FileWALPointer implements WALPointer, Comparable<FileWALPointer> {
- /** */
+ /** Absolute WAL segment file index (incrementing counter) */
private final long idx;
/** */
@@ -37,7 +37,7 @@ public class FileWALPointer implements WALPointer, Comparable<FileWALPointer> {
private boolean forceFlush;
/**
- * @param idx File timestamp index.
+ * @param idx Absolute WAL segment file index (incremental counter)
* @param fileOffset Offset in file, from the beginning.
* @param len Record length.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/c8d572fd/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
index 4ec1efd..225776d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/wal/FileWriteAheadLogManager.java
@@ -69,6 +69,7 @@ import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.lang.IgniteBiTuple;
import org.apache.ignite.lang.IgnitePredicate;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
@@ -512,6 +513,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
assert ptr instanceof FileWALPointer : ptr;
+ // File pointer bound: older entries will be deleted from archive
FileWALPointer fPtr = (FileWALPointer)ptr;
FileDescriptor[] descs = scan(walArchiveDir.listFiles(WAL_SEGMENT_FILE_FILTER));
@@ -521,7 +523,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
FileArchiver archiver0 = archiver;
for (FileDescriptor desc : descs) {
- // Do not delete reserved segment and any segment after it.
+ // Do not delete reserved or locked segment and any segment after it.
if (archiver0 != null && archiver0.reserved(desc.idx))
return deleted;
@@ -738,7 +740,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
* Calling this method signals we are done with the segment and it can be archived.
* If we don't have prepared file yet and achiever is busy this method blocks
*
- * @param curIdx current segment released by WAL writer
+ * @param curIdx current absolute segment released by WAL writer
* @return Initialized file handle.
* @throws StorageException If IO exception occurred.
* @throws IgniteCheckedException If failed.
@@ -1014,7 +1016,8 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
}
/**
- * @param absIdx Index for reservation.
+ * Check if WAL segment locked or reserved
+ * @param absIdx Index for check reservation.
* @return {@code True} if index is reserved.
*/
private synchronized boolean reserved(long absIdx) {
@@ -1328,10 +1331,10 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
}
/**
- * @param file File.
- * @param idx Absolute WAL segment file index.
+ * @param file WAL segment file.
+ * @param idx Absolute WAL segment file index. For null value index is restored from file name
*/
- private FileDescriptor(File file, Long idx) {
+ private FileDescriptor(@NotNull File file, @Nullable Long idx) {
this.file = file;
String fileName = file.getName();
@@ -1411,7 +1414,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
/** */
protected FileChannel ch;
- /** */
+ /** Absolute WAL segment file index (incremental counter) */
protected final long idx;
/** */
@@ -1419,7 +1422,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
/**
* @param file File.
- * @param idx Index.
+ * @param idx Absolute WAL segment file index (incremental counter).
*/
private FileHandle(RandomAccessFile file, long idx, String gridName) {
this.file = file;
@@ -1447,7 +1450,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
/**
* @param file File to read.
- * @param idx File index.
+ * @param idx Absolute WAL segment file index (incremental counter).
* @param ser Entry serializer.
* @param in File input.
*/
[39/50] ignite git commit: IGNITE-5530 Fixed import indexes from
RDBMS. Added systemSchemas to MySQLMetadataDialect. Fixed POJO hashCode
generation for double.
Posted by sb...@apache.org.
IGNITE-5530 Fixed import indexes from RDBMS. Added systemSchemas to MySQLMetadataDialect. Fixed POJO hashCode generation for double.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2cc0b731
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2cc0b731
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2cc0b731
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 2cc0b7315d7d6b16e5795faf5b1874f05eff43b2
Parents: 599d1a8
Author: Alexey Kuznetsov <ak...@gridgain.com>
Authored: Sun Jun 18 11:44:53 2017 +0700
Committer: Alexey Kuznetsov <ak...@gridgain.com>
Committed: Sun Jun 18 11:44:53 2017 +0700
----------------------------------------------------------------------
.../generator/JavaTransformer.service.js | 2 +-
.../agent/db/dialect/JdbcMetadataDialect.java | 15 ++++++++++++++-
.../agent/db/dialect/MySQLMetadataDialect.java | 6 ++++++
3 files changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2cc0b731/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js b/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js
index fad61d6..01f118d 100644
--- a/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js
+++ b/modules/web-console/frontend/app/modules/configuration/generator/JavaTransformer.service.js
@@ -1239,7 +1239,7 @@ export default class IgniteJavaTransformer extends AbstractTransformer {
tempVar = true;
- fldHashCode = `${javaName} != +0.0f ? Float.floatToIntBits(${javaName}) : 0`;
+ fldHashCode = '(int) (ig_hash_temp ^ (ig_hash_temp >>> 32))';
break;
default:
http://git-wip-us.apache.org/repos/asf/ignite/blob/2cc0b731/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java
index 031e3a7..a5da7c1 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/JdbcMetadataDialect.java
@@ -140,7 +140,7 @@ public class JdbcMetadataDialect extends DatabaseMetadataDialect {
if (sys.contains(schema))
continue;
- Collection<String> pkCols = new LinkedHashSet<>();
+ Set<String> pkCols = new LinkedHashSet<>();
try (ResultSet pkRs = dbMeta.getPrimaryKeys(tblCatalog, tblSchema, tblName)) {
while (pkRs.next())
@@ -223,6 +223,19 @@ public class JdbcMetadataDialect extends DatabaseMetadataDialect {
}
}
+ // Remove index that is equals to primary key.
+ if (!pkCols.isEmpty()) {
+ for (Map.Entry<String, QueryIndex> entry : idxs.entrySet()) {
+ QueryIndex idx = entry.getValue();
+
+ if (pkCols.equals(idx.getFields().keySet())) {
+ idxs.remove(entry.getKey());
+
+ break;
+ }
+ }
+ }
+
tbls.add(table(schema, tblName, cols, idxs.values()));
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/2cc0b731/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/MySQLMetadataDialect.java
----------------------------------------------------------------------
diff --git a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/MySQLMetadataDialect.java b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/MySQLMetadataDialect.java
index 4adeeb3..f94c447 100644
--- a/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/MySQLMetadataDialect.java
+++ b/modules/web-console/web-agent/src/main/java/org/apache/ignite/console/agent/db/dialect/MySQLMetadataDialect.java
@@ -22,6 +22,7 @@ import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@@ -34,6 +35,11 @@ public class MySQLMetadataDialect extends JdbcMetadataDialect {
private static final int TYPE_NAME_IDX = 1;
/** {@inheritDoc} */
+ @Override public Set<String> systemSchemas() {
+ return new HashSet<>(Arrays.asList("information_schema", "mysql", "performance_schema", "sys"));
+ }
+
+ /** {@inheritDoc} */
@Override public Collection<String> schemas(Connection conn) throws SQLException {
Collection<String> schemas = new ArrayList<>();
[35/50] ignite git commit: GridCacheInternalKeyImpl - made groupName
not-nullable.
Posted by sb...@apache.org.
GridCacheInternalKeyImpl - made groupName not-nullable.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5a636646
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5a636646
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5a636646
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 5a636646137bdb829e0aa393acaa9b7043d0c465
Parents: 1feca21
Author: Ilya Lantukh <il...@gridgain.com>
Authored: Sat Jun 17 17:41:02 2017 +0300
Committer: Ilya Lantukh <il...@gridgain.com>
Committed: Sat Jun 17 17:41:02 2017 +0300
----------------------------------------------------------------------
.../processors/datastructures/GridCacheInternalKeyImpl.java | 2 +-
.../query/continuous/GridCacheContinuousQueryAbstractSelfTest.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5a636646/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheInternalKeyImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheInternalKeyImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheInternalKeyImpl.java
index 5cd3d85..558c375 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheInternalKeyImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/datastructures/GridCacheInternalKeyImpl.java
@@ -47,7 +47,7 @@ public class GridCacheInternalKeyImpl implements GridCacheInternalKey, Externali
* @param name Name of cache data structure.
* @param grpName Cache group name.
*/
- public GridCacheInternalKeyImpl(String name, @Nullable String grpName) {
+ public GridCacheInternalKeyImpl(String name, String grpName) {
assert !F.isEmpty(name) : name;
this.name = name;
http://git-wip-us.apache.org/repos/asf/ignite/blob/5a636646/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java
index fbee61c..119ed7e 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java
@@ -957,7 +957,7 @@ public abstract class GridCacheContinuousQueryAbstractSelfTest extends GridCommo
});
try (QueryCursor<Cache.Entry<Object, Object>> ignored = cache.query(qry)) {
- cache.put(new GridCacheInternalKeyImpl("test", null), 1);
+ cache.put(new GridCacheInternalKeyImpl("test", "test"), 1);
cache.put(1, 1);
cache.put(2, 2);
[16/50] ignite git commit: ignite-gg-12288 fix
SnapshotUtilityTestWithDaemonInTopologyTest,
send compute activate from daemon node
Posted by sb...@apache.org.
ignite-gg-12288 fix SnapshotUtilityTestWithDaemonInTopologyTest, send compute activate from daemon node
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/01e5cfb3
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/01e5cfb3
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/01e5cfb3
Branch: refs/heads/ignite-2.1.2-exchange
Commit: 01e5cfb31fb2c03b283123f0d110cf07ad5de9fe
Parents: d21e6a5
Author: Dmitriy Govorukhin <dm...@gmail.com>
Authored: Fri Jun 16 21:17:21 2017 +0300
Committer: Dmitriy Govorukhin <dm...@gmail.com>
Committed: Fri Jun 16 21:17:21 2017 +0300
----------------------------------------------------------------------
.../cluster/GridClusterStateProcessor.java | 62 ++++++++++++--------
1 file changed, 38 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/01e5cfb3/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
index 00c9799..9bf0cfa 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/GridClusterStateProcessor.java
@@ -289,6 +289,14 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
*
*/
public IgniteInternalFuture<?> changeGlobalState(final boolean activate) {
+ if (ctx.isDaemon()) {
+ GridFutureAdapter<Void> fut = new GridFutureAdapter<>();
+
+ sendCompute(activate, fut);
+
+ return fut;
+ }
+
if (cacheProc.transactions().tx() != null || sharedCtx.lockedTopologyVersion(null) != null)
throw new IgniteException("Failed to " + prettyStr(activate) + " cluster (must invoke the " +
"method outside of an active transaction).");
@@ -316,30 +324,8 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
"Failed to " + prettyStr(activate) + ", because snapshot operation in progress."));
}
- if (ctx.clientNode()) {
- AffinityTopologyVersion topVer = ctx.discovery().topologyVersionEx();
-
- IgniteCompute comp = ((ClusterGroupAdapter)ctx.cluster().get().forServers()).compute();
-
- if (log.isInfoEnabled())
- log.info("Sending " + prettyStr(activate) + " request from client node [id=" +
- ctx.localNodeId() + " topVer=" + topVer + " ]");
-
- IgniteFuture<Void> fut = comp.runAsync(new ClientChangeGlobalStateComputeRequest(activate));
-
- fut.listen(new CI1<IgniteFuture>() {
- @Override public void apply(IgniteFuture fut) {
- try {
- fut.get();
-
- cgsFut.onDone();
- }
- catch (Exception e) {
- cgsFut.onDone(e);
- }
- }
- });
- }
+ if (ctx.clientNode())
+ sendCompute(activate, cgsFut);
else {
try {
List<DynamicCacheChangeRequest> reqs = new ArrayList<>();
@@ -380,6 +366,34 @@ public class GridClusterStateProcessor extends GridProcessorAdapter {
}
/**
+ *
+ */
+ private void sendCompute(boolean activate, final GridFutureAdapter<Void> res) {
+ AffinityTopologyVersion topVer = ctx.discovery().topologyVersionEx();
+
+ IgniteCompute comp = ((ClusterGroupAdapter)ctx.cluster().get().forServers()).compute();
+
+ if (log.isInfoEnabled())
+ log.info("Sending " + prettyStr(activate) + " request from node [id=" +
+ ctx.localNodeId() + " topVer=" + topVer + " isClient=" + ctx.isDaemon() +
+ " isDaemon" + ctx.isDaemon() + "]");
+
+ IgniteFuture<Void> fut = comp.runAsync(new ClientChangeGlobalStateComputeRequest(activate));
+
+ fut.listen(new CI1<IgniteFuture>() {
+ @Override public void apply(IgniteFuture fut) {
+ try {
+ fut.get();
+
+ res.onDone();
+ }
+ catch (Exception e) {
+ res.onDone(e);
+ }
+ }
+ });
+ }
+ /**
* @param reqs Requests to print.
* @param active Active flag.
*/
[19/50] ignite git commit: Trying to fix compilation error.
Posted by sb...@apache.org.
Trying to fix compilation error.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ace39769
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ace39769
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ace39769
Branch: refs/heads/ignite-2.1.2-exchange
Commit: ace3976973ebab084fb626f8bb47606c0e0ec4b3
Parents: ba809d2
Author: devozerov <pp...@gmail.com>
Authored: Fri Jun 16 22:40:39 2017 +0300
Committer: devozerov <pp...@gmail.com>
Committed: Fri Jun 16 22:40:39 2017 +0300
----------------------------------------------------------------------
.../cache/persistence/GridCacheDatabaseSharedManager.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ace39769/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
index dd3809d..008bf9e 100755
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/GridCacheDatabaseSharedManager.java
@@ -2247,7 +2247,9 @@ public class GridCacheDatabaseSharedManager extends IgniteCacheDatabaseSharedMan
curr.reason));
}
- return new Checkpoint(null, new GridMultiCollectionWrapper<>(new Collection[0]), curr);
+ GridMultiCollectionWrapper<FullPageId> wrapper = new GridMultiCollectionWrapper<>(new Collection[0]);
+
+ return new Checkpoint(null, wrapper, curr);
}
}