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/11/22 10:23:17 UTC
[01/15] ignite git commit: IGNITE-6931: SQL: simplify index rebuild.
Now both CREATE INDEX and "rebuild from hash" routines use the same iteration
and entry locking logic. This closes #3052.
Repository: ignite
Updated Branches:
refs/heads/ignite-zk 4090eb717 -> a6b452823
IGNITE-6931: SQL: simplify index rebuild. Now both CREATE INDEX and "rebuild from hash" routines use the same iteration and entry locking logic. This closes #3052.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/65080675
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/65080675
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/65080675
Branch: refs/heads/ignite-zk
Commit: 65080675dec8433c0968762c903905d1f65e5f29
Parents: db343b6
Author: Igor Seliverstov <gv...@gmail.com>
Authored: Tue Nov 21 12:26:23 2017 +0300
Committer: devozerov <vo...@gridgain.com>
Committed: Tue Nov 21 12:26:23 2017 +0300
----------------------------------------------------------------------
.../processors/cache/GridCacheEntryEx.java | 13 +--
.../processors/cache/GridCacheMapEntry.java | 17 +--
.../cache/IgniteCacheOffheapManager.java | 19 ----
.../cache/IgniteCacheOffheapManagerImpl.java | 21 ----
.../persistence/GridCacheOffheapManager.java | 7 --
.../processors/query/GridQueryProcessor.java | 51 ++++++++-
.../query/schema/SchemaIndexCacheFilter.java | 33 ++++++
.../schema/SchemaIndexCacheVisitorImpl.java | 108 +++++++++----------
.../processors/cache/GridCacheTestEntryEx.java | 10 +-
.../processors/query/h2/IgniteH2Indexing.java | 64 ++++-------
10 files changed, 166 insertions(+), 177 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/65080675/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
index 6da7bc7..313a0c7 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheEntryEx.java
@@ -34,6 +34,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.cache.version.GridCacheVersionedEntryEx;
import org.apache.ignite.internal.processors.dr.GridDrType;
+import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheFilter;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitorClosure;
import org.apache.ignite.internal.util.lang.GridTuple3;
import org.jetbrains.annotations.Nullable;
@@ -869,12 +870,13 @@ public interface GridCacheEntryEx {
/**
* Update index from within entry lock, passing key, value, and expiration time to provided closure.
*
+ * @param filter Row filter.
* @param clo Closure to apply to key, value, and expiration time.
* @throws IgniteCheckedException If failed.
* @throws GridCacheEntryRemovedException If entry was removed.
*/
- public void updateIndex(SchemaIndexCacheVisitorClosure clo) throws IgniteCheckedException,
- GridCacheEntryRemovedException;
+ public void updateIndex(SchemaIndexCacheFilter filter, SchemaIndexCacheVisitorClosure clo)
+ throws IgniteCheckedException, GridCacheEntryRemovedException;
/**
* @return Expire time, without accounting for transactions or removals.
@@ -919,13 +921,6 @@ public interface GridCacheEntryEx {
public void updateTtl(@Nullable GridCacheVersion ver, long ttl) throws GridCacheEntryRemovedException;
/**
- * Ensures that the value stored in the entry is also inserted in the indexing.
- *
- * @throws GridCacheEntryRemovedException If entry was removed.
- */
- public void ensureIndexed() throws GridCacheEntryRemovedException, IgniteCheckedException;
-
- /**
* @return Value.
* @throws IgniteCheckedException If failed to read from swap storage.
* @throws GridCacheEntryRemovedException If entry was removed.
http://git-wip-us.apache.org/repos/asf/ignite/blob/65080675/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index 778a46e..79390ed 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -60,6 +60,7 @@ import org.apache.ignite.internal.processors.cache.version.GridCacheVersionConfl
import org.apache.ignite.internal.processors.cache.version.GridCacheVersionEx;
import org.apache.ignite.internal.processors.cache.version.GridCacheVersionedEntryEx;
import org.apache.ignite.internal.processors.dr.GridDrType;
+import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheFilter;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitorClosure;
import org.apache.ignite.internal.util.IgniteTree;
import org.apache.ignite.internal.util.lang.GridClosureException;
@@ -3141,16 +3142,6 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
}
/** {@inheritDoc} */
- @Override public void ensureIndexed() throws GridCacheEntryRemovedException, IgniteCheckedException {
- synchronized (this) {
- checkObsolete();
-
- if (cctx.queries().enabled())
- cctx.offheap().updateIndexes(cctx, key, localPartition());
- }
- }
-
- /** {@inheritDoc} */
@Override public synchronized CacheObject valueBytes() throws GridCacheEntryRemovedException {
checkObsolete();
@@ -3300,8 +3291,8 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
}
/** {@inheritDoc} */
- @Override public void updateIndex(SchemaIndexCacheVisitorClosure clo) throws IgniteCheckedException,
- GridCacheEntryRemovedException {
+ @Override public void updateIndex(SchemaIndexCacheFilter filter, SchemaIndexCacheVisitorClosure clo)
+ throws IgniteCheckedException, GridCacheEntryRemovedException {
synchronized (this) {
if (isInternal())
return;
@@ -3310,7 +3301,7 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter impleme
CacheDataRow row = cctx.offheap().read(this);
- if (row != null)
+ if (row != null && (filter == null || filter.apply(row)))
clo.apply(row);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/65080675/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
index 761b787..84c69a9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheOffheapManager.java
@@ -186,18 +186,6 @@ public interface IgniteCacheOffheapManager {
/**
* @param cctx Cache context.
* @param key Key.
- * @param part Partition.
- * @throws IgniteCheckedException If failed.
- */
- public void updateIndexes(
- GridCacheContext cctx,
- KeyCacheObject key,
- GridDhtLocalPartition part
- ) throws IgniteCheckedException;
-
- /**
- * @param cctx Cache context.
- * @param key Key.
* @param partId Partition number.
* @param part Partition.
* @throws IgniteCheckedException If failed.
@@ -454,13 +442,6 @@ public interface IgniteCacheOffheapManager {
/**
* @param cctx Cache context.
* @param key Key.
- * @throws IgniteCheckedException If failed.
- */
- void updateIndexes(GridCacheContext cctx, KeyCacheObject key) throws IgniteCheckedException;
-
- /**
- * @param cctx Cache context.
- * @param key Key.
* @param c Closure.
* @throws IgniteCheckedException If failed.
*/
http://git-wip-us.apache.org/repos/asf/ignite/blob/65080675/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 c85ba1d..370a92e 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
@@ -359,12 +359,6 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager
}
/** {@inheritDoc} */
- @Override public void updateIndexes(GridCacheContext cctx, KeyCacheObject key, GridDhtLocalPartition part)
- throws IgniteCheckedException {
- dataStore(part).updateIndexes(cctx, key);
- }
-
- /** {@inheritDoc} */
@Override public void remove(
GridCacheContext cctx,
KeyCacheObject key,
@@ -1362,21 +1356,6 @@ public class IgniteCacheOffheapManagerImpl implements IgniteCacheOffheapManager
}
/** {@inheritDoc} */
- @Override public void updateIndexes(GridCacheContext cctx, KeyCacheObject key) throws IgniteCheckedException {
- int cacheId = grp.sharedGroup() ? cctx.cacheId() : CU.UNDEFINED_CACHE_ID;
-
- CacheDataRow row = dataTree.findOne(new SearchRow(cacheId, key), CacheDataRowAdapter.RowData.NO_KEY);
-
- if (row != null) {
- row.key(key);
-
- GridCacheQueryManager qryMgr = cctx.queries();
-
- qryMgr.store(row, null, false);
- }
- }
-
- /** {@inheritDoc} */
@Override public void remove(GridCacheContext cctx, KeyCacheObject key, int partId) throws IgniteCheckedException {
if (!busyLock.enterBusy())
throw new NodeStoppingException("Operation has been cancelled (node is stopping).");
http://git-wip-us.apache.org/repos/asf/ignite/blob/65080675/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 6ed62f8..cfa1829 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
@@ -1236,13 +1236,6 @@ public class GridCacheOffheapManager extends IgniteCacheOffheapManagerImpl imple
}
/** {@inheritDoc} */
- @Override public void updateIndexes(GridCacheContext cctx, KeyCacheObject key) throws IgniteCheckedException {
- CacheDataStore delegate = init0(false);
-
- delegate.updateIndexes(cctx, key);
- }
-
- /** {@inheritDoc} */
@Override public CacheDataRow createRow(
GridCacheContext cctx,
KeyCacheObject key,
http://git-wip-us.apache.org/repos/asf/ignite/blob/65080675/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
index ed5fdd9..471888a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryProcessor.java
@@ -73,6 +73,7 @@ import org.apache.ignite.internal.processors.cache.query.CacheQueryType;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryType;
import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
import org.apache.ignite.internal.processors.query.property.QueryBinaryProperty;
+import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheFilter;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitor;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitorImpl;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexOperationCancellationToken;
@@ -96,10 +97,12 @@ import org.apache.ignite.internal.util.future.GridFinishedFuture;
import org.apache.ignite.internal.util.lang.GridCloseableIterator;
import org.apache.ignite.internal.util.lang.GridClosureException;
import org.apache.ignite.internal.util.lang.IgniteOutClosureX;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.T2;
import org.apache.ignite.internal.util.typedef.T3;
import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.util.worker.GridWorker;
import org.apache.ignite.internal.util.worker.GridWorkerFuture;
@@ -1319,12 +1322,15 @@ public class GridQueryProcessor extends GridProcessorAdapter {
try {
if (op instanceof SchemaIndexCreateOperation) {
- SchemaIndexCreateOperation op0 = (SchemaIndexCreateOperation)op;
+ final SchemaIndexCreateOperation op0 = (SchemaIndexCreateOperation)op;
QueryIndexDescriptorImpl idxDesc = QueryUtils.createIndexDescriptor(type, op0.index());
- SchemaIndexCacheVisitor visitor =
- new SchemaIndexCacheVisitorImpl(this, cache.context(), cacheName, op0.tableName(), cancelTok);
+ GridCacheContext cctx = cache.context();
+
+ SchemaIndexCacheFilter filter = new TableCacheFilter(cctx, op0.tableName());
+
+ SchemaIndexCacheVisitor visitor = new SchemaIndexCacheVisitorImpl(cctx, filter, cancelTok);
idx.dynamicIndexCreate(op0.schemaName(), op0.tableName(), idxDesc, op0.ifNotExists(), visitor);
}
@@ -2869,4 +2875,43 @@ public class GridQueryProcessor extends GridProcessorAdapter {
this.mgr = mgr;
}
}
+
+ /** */
+ private static class TableCacheFilter implements SchemaIndexCacheFilter {
+ /** */
+ @GridToStringExclude
+ private final GridCacheContext cctx;
+
+ /** */
+ @GridToStringExclude
+ private final GridQueryProcessor query;
+
+ /** */
+ private final String cacheName;
+
+ /** */
+ private final String tableName;
+
+ /**
+ * @param cctx Cache context.
+ * @param tableName Target table name.
+ */
+ TableCacheFilter(GridCacheContext cctx, String tableName) {
+ this.cctx = cctx;
+ this.tableName = tableName;
+
+ cacheName = cctx.name();
+ query = cctx.kernalContext().query();
+ }
+
+ /** {@inheritDoc} */
+ @Override public boolean apply(CacheDataRow row) throws IgniteCheckedException {
+ return query.belongsToTable(cctx, cacheName, tableName, row.key(), row.value());
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(TableCacheFilter.class, this);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/65080675/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheFilter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheFilter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheFilter.java
new file mode 100644
index 0000000..32600c6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheFilter.java
@@ -0,0 +1,33 @@
+/*
+ * 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.query.schema;
+
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
+
+/**
+ * Index row filter accepting current entry.
+ */
+public interface SchemaIndexCacheFilter {
+ /**
+ * @param row Cache data row.
+ * @return {@code True} if row passes the filter.
+ * @throws IgniteCheckedException If failed.
+ */
+ boolean apply(CacheDataRow row) throws IgniteCheckedException;
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/65080675/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
index fda7d1d..c11c614 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/query/schema/SchemaIndexCacheVisitorImpl.java
@@ -17,7 +17,7 @@
package org.apache.ignite.internal.processors.query.schema;
-import java.util.Collection;
+import java.util.List;
import org.apache.ignite.IgniteCheckedException;
import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
@@ -29,7 +29,6 @@ import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalP
import org.apache.ignite.internal.processors.cache.distributed.near.GridNearCacheAdapter;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter;
-import org.apache.ignite.internal.processors.query.GridQueryProcessor;
import org.apache.ignite.internal.util.lang.GridCursor;
import org.apache.ignite.internal.util.typedef.internal.S;
@@ -40,35 +39,36 @@ import static org.apache.ignite.internal.processors.cache.distributed.dht.GridDh
/**
* Traversor operating all primary and backup partitions of given cache.
*/
+@SuppressWarnings("ForLoopReplaceableByForEach")
public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor {
- /** Query procssor. */
- private final GridQueryProcessor qryProc;
+ /** Count of rows, being processed within a single checkpoint lock. */
+ private static final int BATCH_SIZE = 1000;
/** Cache context. */
private final GridCacheContext cctx;
- /** Cache name. */
- private final String cacheName;
-
- /** Table name. */
- private final String tblName;
+ /** Row filter. */
+ private final SchemaIndexCacheFilter rowFilter;
/** Cancellation token. */
private final SchemaIndexOperationCancellationToken cancel;
/**
* Constructor.
- *
- * @param cctx Cache context.
- * @param cacheName Cache name.
- * @param tblName Table name.
+ * @param cctx Cache context.
+ */
+ public SchemaIndexCacheVisitorImpl(GridCacheContext cctx) {
+ this(cctx, null, null);
+ }
+
+ /**
+ * Constructor.
+ * @param cctx Cache context.
* @param cancel Cancellation token.
*/
- public SchemaIndexCacheVisitorImpl(GridQueryProcessor qryProc, GridCacheContext cctx, String cacheName,
- String tblName, SchemaIndexOperationCancellationToken cancel) {
- this.qryProc = qryProc;
- this.cacheName = cacheName;
- this.tblName = tblName;
+ public SchemaIndexCacheVisitorImpl(GridCacheContext cctx, SchemaIndexCacheFilter rowFilter,
+ SchemaIndexOperationCancellationToken cancel) {
+ this.rowFilter = rowFilter;
this.cancel = cancel;
if (cctx.isNear())
@@ -81,12 +81,10 @@ public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor {
@Override public void visit(SchemaIndexCacheVisitorClosure clo) throws IgniteCheckedException {
assert clo != null;
- FilteringVisitorClosure filterClo = new FilteringVisitorClosure(clo);
-
- Collection<GridDhtLocalPartition> parts = cctx.topology().localPartitions();
+ List<GridDhtLocalPartition> parts = cctx.topology().localPartitions();
- for (GridDhtLocalPartition part : parts)
- processPartition(part, filterClo);
+ for (int i = 0, size = parts.size(); i < size; i++)
+ processPartition(parts.get(i), clo);
}
/**
@@ -96,7 +94,7 @@ public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor {
* @param clo Index closure.
* @throws IgniteCheckedException If failed.
*/
- private void processPartition(GridDhtLocalPartition part, FilteringVisitorClosure clo)
+ private void processPartition(GridDhtLocalPartition part, SchemaIndexCacheVisitorClosure clo)
throws IgniteCheckedException {
checkCancelled();
@@ -114,15 +112,35 @@ public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor {
null,
CacheDataRowAdapter.RowData.KEY_ONLY);
- while (cursor.next()) {
- CacheDataRow row = cursor.get();
+ boolean locked = false;
+
+ try {
+ int cntr = 0;
+
+ while (cursor.next()) {
+ KeyCacheObject key = cursor.get().key();
+
+ if (!locked) {
+ cctx.shared().database().checkpointReadLock();
- KeyCacheObject key = row.key();
+ locked = true;
+ }
- processKey(key, clo);
+ processKey(key, clo);
- if (part.state() == RENTING)
- break;
+ if (++cntr % BATCH_SIZE == 0) {
+ cctx.shared().database().checkpointReadUnlock();
+
+ locked = false;
+ }
+
+ if (part.state() == RENTING)
+ break;
+ }
+ }
+ finally {
+ if (locked)
+ cctx.shared().database().checkpointReadUnlock();
}
}
finally {
@@ -137,7 +155,7 @@ public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor {
* @param clo Closure.
* @throws IgniteCheckedException If failed.
*/
- private void processKey(KeyCacheObject key, FilteringVisitorClosure clo) throws IgniteCheckedException {
+ private void processKey(KeyCacheObject key, SchemaIndexCacheVisitorClosure clo) throws IgniteCheckedException {
while (true) {
try {
checkCancelled();
@@ -145,7 +163,7 @@ public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor {
GridCacheEntryEx entry = cctx.cache().entryEx(key);
try {
- entry.updateIndex(clo);
+ entry.updateIndex(rowFilter, clo);
}
finally {
cctx.evicts().touch(entry, AffinityTopologyVersion.NONE);
@@ -168,7 +186,7 @@ public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor {
* @throws IgniteCheckedException If cancelled.
*/
private void checkCancelled() throws IgniteCheckedException {
- if (cancel.isCancelled())
+ if (cancel != null && cancel.isCancelled())
throw new IgniteCheckedException("Index creation was cancelled.");
}
@@ -176,28 +194,4 @@ public class SchemaIndexCacheVisitorImpl implements SchemaIndexCacheVisitor {
@Override public String toString() {
return S.toString(SchemaIndexCacheVisitorImpl.class, this);
}
-
- /**
- * Filtering visitor closure.
- */
- private class FilteringVisitorClosure implements SchemaIndexCacheVisitorClosure {
-
- /** Target closure. */
- private final SchemaIndexCacheVisitorClosure target;
-
- /**
- * Constructor.
- *
- * @param target Target.
- */
- FilteringVisitorClosure(SchemaIndexCacheVisitorClosure target) {
- this.target = target;
- }
-
- /** {@inheritDoc} */
- @Override public void apply(CacheDataRow row) throws IgniteCheckedException {
- if (qryProc.belongsToTable(cctx, cacheName, tblName, row.key(), row.value()))
- target.apply(row);
- }
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/65080675/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
index 2ba8fd8..3d7edac 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheTestEntryEx.java
@@ -33,6 +33,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.cache.version.GridCacheVersionedEntryEx;
import org.apache.ignite.internal.processors.dr.GridDrType;
+import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheFilter;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitorClosure;
import org.apache.ignite.internal.util.lang.GridMetadataAwareAdapter;
import org.apache.ignite.internal.util.lang.GridTuple3;
@@ -817,11 +818,6 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
}
/** {@inheritDoc} */
- @Override public void ensureIndexed() throws GridCacheEntryRemovedException, IgniteCheckedException {
- // No-op.
- }
-
- /** {@inheritDoc} */
@Override public CacheObject unswap() throws IgniteCheckedException {
return null;
}
@@ -842,8 +838,8 @@ public class GridCacheTestEntryEx extends GridMetadataAwareAdapter implements Gr
}
/** {@inheritDoc} */
- @Override public void updateIndex(SchemaIndexCacheVisitorClosure clo) throws IgniteCheckedException,
- GridCacheEntryRemovedException {
+ @Override public void updateIndex(SchemaIndexCacheFilter filter, SchemaIndexCacheVisitorClosure clo)
+ throws IgniteCheckedException, GridCacheEntryRemovedException {
// No-op.
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/65080675/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
index c37e5f0..f3a95a5 100644
--- a/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/processors/query/h2/IgniteH2Indexing.java
@@ -65,17 +65,13 @@ import org.apache.ignite.internal.processors.cache.CacheEntryImpl;
import org.apache.ignite.internal.processors.cache.CacheObjectUtils;
import org.apache.ignite.internal.processors.cache.CacheObjectValueContext;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
-import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
-import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
import org.apache.ignite.internal.processors.cache.GridCacheSharedContext;
-import org.apache.ignite.internal.processors.cache.IgniteCacheOffheapManager;
-import org.apache.ignite.internal.processors.cache.KeyCacheObject;
import org.apache.ignite.internal.processors.cache.QueryCursorImpl;
-import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtInvalidPartitionException;
import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
import org.apache.ignite.internal.processors.cache.persistence.tree.io.PageIO;
import org.apache.ignite.internal.processors.cache.query.CacheQueryPartitionInfo;
+import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager;
import org.apache.ignite.internal.processors.cache.query.GridCacheQueryMarshallable;
import org.apache.ignite.internal.processors.cache.query.GridCacheTwoStepQuery;
import org.apache.ignite.internal.processors.cache.query.IgniteQueryErrorCode;
@@ -116,6 +112,7 @@ import org.apache.ignite.internal.processors.query.h2.twostep.GridReduceQueryExe
import org.apache.ignite.internal.processors.query.h2.twostep.MapQueryLazyWorker;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitor;
import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitorClosure;
+import org.apache.ignite.internal.processors.query.schema.SchemaIndexCacheVisitorImpl;
import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
import org.apache.ignite.internal.sql.SqlParseException;
import org.apache.ignite.internal.sql.SqlParser;
@@ -2021,44 +2018,11 @@ public class IgniteH2Indexing implements GridQueryIndexing {
GridCacheContext cctx = ctx.cache().context().cacheContext(cacheId);
- IgniteCacheOffheapManager offheapMgr = cctx.isNear() ? cctx.near().dht().context().offheap() : cctx.offheap();
+ final GridCacheQueryManager qryMgr = cctx.queries();
- for (int p = 0; p < cctx.affinity().partitions(); p++) {
- try (GridCloseableIterator<KeyCacheObject> keyIter = offheapMgr.cacheKeysIterator(cctx.cacheId(), p)) {
- while (keyIter.hasNext()) {
- cctx.shared().database().checkpointReadLock();
+ SchemaIndexCacheVisitor visitor = new SchemaIndexCacheVisitorImpl(cctx);
- try {
- KeyCacheObject key = keyIter.next();
-
- while (true) {
- GridCacheEntryEx entry = null;
-
- try {
- entry = cctx.isNear() ?
- cctx.near().dht().entryEx(key) : cctx.cache().entryEx(key);
-
- entry.ensureIndexed();
-
- break;
- }
- catch (GridCacheEntryRemovedException ignore) {
- // Retry.
- }
- catch (GridDhtInvalidPartitionException ignore) {
- break;
- }
- finally {
- entry.context().evicts().touch(entry, AffinityTopologyVersion.NONE);
- }
- }
- }
- finally {
- cctx.shared().database().checkpointReadUnlock();
- }
- }
- }
- }
+ visitor.visit(new RebuldIndexFromHashClosure(qryMgr));
for (H2TableDescriptor tblDesc : tables(cacheName))
tblDesc.table().markRebuildFromHashInProgress(false);
@@ -2653,4 +2617,22 @@ public class IgniteH2Indexing implements GridQueryIndexing {
private interface ClIter<X> extends AutoCloseable, Iterator<X> {
// No-op.
}
+
+ /** */
+ private static class RebuldIndexFromHashClosure implements SchemaIndexCacheVisitorClosure {
+ /** */
+ private final GridCacheQueryManager qryMgr;
+
+ /**
+ * @param qryMgr Query manager.
+ */
+ RebuldIndexFromHashClosure(GridCacheQueryManager qryMgr) {
+ this.qryMgr = qryMgr;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void apply(CacheDataRow row) throws IgniteCheckedException {
+ qryMgr.store(row, null, false);
+ }
+ }
}
[09/15] ignite git commit: IGNITE-4394 Web Console: Fixed memory leak
in Messages.service.
Posted by sb...@apache.org.
IGNITE-4394 Web Console: Fixed memory leak in Messages.service.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/df48356d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/df48356d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/df48356d
Branch: refs/heads/ignite-zk
Commit: df48356de7bb8bb9d4360b8b0b8ef4497b83383c
Parents: 152104e
Author: alexdel <ve...@yandex.ru>
Authored: Tue Nov 21 22:08:25 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Tue Nov 21 22:08:25 2017 +0700
----------------------------------------------------------------------
modules/web-console/frontend/app/services/Messages.service.js | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/df48356d/modules/web-console/frontend/app/services/Messages.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/services/Messages.service.js b/modules/web-console/frontend/app/services/Messages.service.js
index 854cf0b..523adae 100644
--- a/modules/web-console/frontend/app/services/Messages.service.js
+++ b/modules/web-console/frontend/app/services/Messages.service.js
@@ -44,8 +44,11 @@ export default ['IgniteMessages', ['$alert', ($alert) => {
};
const hideAlert = () => {
- if (msgModal)
+ if (msgModal) {
msgModal.hide();
+ msgModal.destroy();
+ msgModal = null;
+ }
};
const _showMessage = (message, err, type, duration) => {
[15/15] ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-zk
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-zk
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a6b45282
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a6b45282
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a6b45282
Branch: refs/heads/ignite-zk
Commit: a6b452823422290e19238238e119f5aaad87b6af
Parents: e0aba81 39cc9b7
Author: sboikov <sb...@gridgain.com>
Authored: Wed Nov 22 13:22:14 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Nov 22 13:22:14 2017 +0300
----------------------------------------------------------------------
.../apache/ignite/cluster/ClusterMetrics.java | 12 +-
.../ClusterLocalNodeMetricsMXBeanImpl.java | 11 +-
.../internal/ClusterMetricsMXBeanImpl.java | 360 +++++++++++++++++++
.../ignite/internal/ClusterMetricsSnapshot.java | 37 +-
.../apache/ignite/internal/IgniteKernal.java | 40 ++-
.../GridDeploymentPerVersionStore.java | 36 +-
.../discovery/GridDiscoveryManager.java | 1 +
.../processors/cache/ClusterCachesInfo.java | 4 +-
.../processors/cache/GridCacheEntryEx.java | 13 +-
.../processors/cache/GridCacheMapEntry.java | 17 +-
.../cache/IgniteCacheOffheapManager.java | 19 -
.../cache/IgniteCacheOffheapManagerImpl.java | 21 --
.../persistence/DataRegionMetricsImpl.java | 5 +-
.../persistence/GridCacheOffheapManager.java | 7 -
.../wal/FileWriteAheadLogManager.java | 4 +-
.../datastructures/DataStructuresProcessor.java | 18 +-
.../processors/jobmetrics/GridJobMetrics.java | 21 +-
.../jobmetrics/GridJobMetricsProcessor.java | 9 +-
.../processors/query/GridQueryProcessor.java | 51 ++-
.../query/schema/SchemaIndexCacheFilter.java | 33 ++
.../schema/SchemaIndexCacheVisitorImpl.java | 108 +++---
.../visor/cache/VisorCacheModifyTask.java | 113 ++++++
.../visor/cache/VisorCacheModifyTaskArg.java | 114 ++++++
.../visor/cache/VisorCacheModifyTaskResult.java | 101 ++++++
.../visor/cache/VisorModifyCacheMode.java | 47 +++
.../internal/visor/query/VisorQueryTask.java | 3 -
.../internal/visor/query/VisorQueryUtils.java | 25 +-
.../mxbean/ClusterLocalNodeMetricsMXBean.java | 253 -------------
.../ignite/mxbean/ClusterMetricsMXBean.java | 257 +++++++++++++
.../tcp/TcpCommunicationMetricsListener.java | 225 ++++++++++++
.../communication/tcp/TcpCommunicationSpi.java | 101 ++++--
.../tcp/TcpCommunicationSpiMBean.java | 33 ++
.../resources/META-INF/classnames.properties | 77 ++--
modules/core/src/test/config/tests.properties | 1 +
.../internal/ClusterNodeMetricsSelfTest.java | 4 +-
.../IgniteClientReconnectCollectionsTest.java | 131 +++----
.../processors/cache/GridCacheTestEntryEx.java | 10 +-
...gnitePdsCacheAssignmentNodeRestartsTest.java | 257 +++++++++++++
.../wal/IgniteWalFlushBackgroundSelfTest.java | 35 ++
.../db/wal/IgniteWalFlushDefaultSelfTest.java | 35 ++
.../db/wal/IgniteWalFlushLogOnlySelfTest.java | 35 ++
...lFlushMultiNodeFailoverAbstractSelfTest.java | 246 +++++++++++++
.../apache/ignite/p2p/SharedDeploymentTest.java | 128 +++++++
.../tcp/TcpCommunicationStatisticsTest.java | 201 +++++++++++
...ClusterMetricsSnapshotSerializeSelfTest.java | 8 +-
.../testsuites/IgniteCacheTestSuite6.java | 3 +-
.../testsuites/IgniteP2PSelfTestSuite.java | 2 +
.../ignite/testsuites/IgnitePdsTestSuite2.java | 9 +
.../IgniteSpiCommunicationSelfTestSuite.java | 3 +
.../tests/p2p/compute/ExternalCallable.java | 10 +-
.../tests/p2p/compute/ExternalCallable1.java | 11 +-
.../tests/p2p/compute/ExternalCallable2.java | 11 +-
.../tests/p2p/compute/ExternalCallable.java | 59 +++
.../tests/p2p/compute/ExternalCallable1.java | 59 +++
.../tests/p2p/compute/ExternalCallable2.java | 59 +++
.../processors/query/h2/IgniteH2Indexing.java | 64 ++--
modules/web-console/frontend/app/app.js | 18 +-
.../frontend/app/modules/sql/sql.controller.js | 24 +-
.../app/services/LegacyUtils.service.js | 18 +-
.../frontend/app/services/Messages.service.js | 5 +-
modules/web-console/frontend/package.json | 2 +-
.../web-console/frontend/views/sql/sql.tpl.pug | 32 +-
.../frontend/views/templates/message.tpl.pug | 1 +
63 files changed, 2973 insertions(+), 684 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b45282/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b45282/modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a6b45282/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
[11/15] ignite git commit: IGNITE-6922 Class cannot undeploy from
grid in some specific cases - Fixes #3045.
Posted by sb...@apache.org.
IGNITE-6922 Class cannot undeploy from grid in some specific cases - Fixes #3045.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d2050237
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d2050237
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d2050237
Branch: refs/heads/ignite-zk
Commit: d2050237ee2b760d1c9cbc906b281790fd0976b4
Parents: 08371f5
Author: vd-pyatkov <vp...@gridgain.com>
Authored: Wed Nov 22 10:39:58 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Nov 22 10:39:58 2017 +0300
----------------------------------------------------------------------
.../GridDeploymentPerVersionStore.java | 36 +++---
modules/core/src/test/config/tests.properties | 1 +
.../apache/ignite/p2p/SharedDeploymentTest.java | 128 +++++++++++++++++++
.../testsuites/IgniteP2PSelfTestSuite.java | 2 +
.../tests/p2p/compute/ExternalCallable.java | 10 +-
.../tests/p2p/compute/ExternalCallable1.java | 11 +-
.../tests/p2p/compute/ExternalCallable2.java | 11 +-
.../tests/p2p/compute/ExternalCallable.java | 59 +++++++++
.../tests/p2p/compute/ExternalCallable1.java | 59 +++++++++
.../tests/p2p/compute/ExternalCallable2.java | 59 +++++++++
10 files changed, 348 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/d2050237/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentPerVersionStore.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentPerVersionStore.java b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentPerVersionStore.java
index 070b390..8447c97 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentPerVersionStore.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/managers/deployment/GridDeploymentPerVersionStore.java
@@ -376,31 +376,33 @@ public class GridDeploymentPerVersionStore extends GridDeploymentStoreAdapter {
// Find existing deployments that need to be checked
// whether they should be reused for this request.
- for (SharedDeployment d : deps) {
- if (!d.pendingUndeploy() && !d.undeployed()) {
- Map<UUID, IgniteUuid> parties = d.participants();
+ if (ctx.config().getDeploymentMode() == CONTINUOUS) {
+ for (SharedDeployment d : deps) {
+ if (!d.pendingUndeploy() && !d.undeployed()) {
+ Map<UUID, IgniteUuid> parties = d.participants();
- if (parties != null) {
- IgniteUuid ldrId = parties.get(meta.senderNodeId());
+ if (parties != null) {
+ IgniteUuid ldrId = parties.get(meta.senderNodeId());
- if (ldrId != null) {
- assert !ldrId.equals(meta.classLoaderId());
+ if (ldrId != null) {
+ assert !ldrId.equals(meta.classLoaderId());
- if (log.isDebugEnabled())
- log.debug("Skipping deployment (loaders on remote node are different) " +
- "[dep=" + d + ", meta=" + meta + ']');
+ if (log.isDebugEnabled())
+ log.debug("Skipping deployment (loaders on remote node are different) " +
+ "[dep=" + d + ", meta=" + meta + ']');
- continue;
+ continue;
+ }
}
- }
- if (depsToCheck == null)
- depsToCheck = new LinkedList<>();
+ if (depsToCheck == null)
+ depsToCheck = new LinkedList<>();
- if (log.isDebugEnabled())
- log.debug("Adding deployment to check: " + d);
+ if (log.isDebugEnabled())
+ log.debug("Adding deployment to check: " + d);
- depsToCheck.add(d);
+ depsToCheck.add(d);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d2050237/modules/core/src/test/config/tests.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/test/config/tests.properties b/modules/core/src/test/config/tests.properties
index 1ea5b3d..718d661 100644
--- a/modules/core/src/test/config/tests.properties
+++ b/modules/core/src/test/config/tests.properties
@@ -88,6 +88,7 @@ grid.comm.selftest.timeout=10000
#P2P tests
#Overwrite this property. It should point to P2P module compilation directory.
p2p.uri.cls=file://localhost/@{IGNITE_HOME}/modules/extdata/p2p/target/classes/
+p2p.uri.cls.second=file://localhost/@{IGNITE_HOME}/modules/extdata/uri/target/classes/
# AOP tests.
# Connector port for RMI.
http://git-wip-us.apache.org/repos/asf/ignite/blob/d2050237/modules/core/src/test/java/org/apache/ignite/p2p/SharedDeploymentTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/p2p/SharedDeploymentTest.java b/modules/core/src/test/java/org/apache/ignite/p2p/SharedDeploymentTest.java
new file mode 100644
index 0000000..cc0340e
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/p2p/SharedDeploymentTest.java
@@ -0,0 +1,128 @@
+/*
+ * 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.p2p;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.configuration.DeploymentMode;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.testframework.GridTestExternalClassLoader;
+import org.apache.ignite.testframework.config.GridTestProperties;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import java.lang.reflect.Constructor;
+import java.net.URL;
+import java.util.Collection;
+
+/**
+ */
+public class SharedDeploymentTest extends GridCommonAbstractTest {
+ /** */
+ private static final String RUN_CLS = "org.apache.ignite.tests.p2p.compute.ExternalCallable";
+
+ /** */
+ private static final String RUN_CLS1 = "org.apache.ignite.tests.p2p.compute.ExternalCallable1";
+
+ /** */
+ private static final String RUN_CLS2 = "org.apache.ignite.tests.p2p.compute.ExternalCallable2";
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ return super.getConfiguration(igniteInstanceName)
+ .setPeerClassLoadingEnabled(true)
+ .setDeploymentMode(DeploymentMode.SHARED);
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
+ public void testDeploymentFromSecondAndThird() throws Exception {
+ try {
+ startGrid(1);
+
+ final Ignite ignite2 = startGrid(2);
+ Ignite ignite3 = startGrid(3);
+
+ Collection<Object> res = runJob0(new GridTestExternalClassLoader(new URL[] {
+ new URL(GridTestProperties.getProperty("p2p.uri.cls"))}, RUN_CLS1/*, RUN_CLS2*/), ignite2, 10_000, 1);
+
+ for (Object o: res)
+ assertEquals(o, 42);
+
+ res = runJob1(new GridTestExternalClassLoader(new URL[] {
+ new URL(GridTestProperties.getProperty("p2p.uri.cls"))}, RUN_CLS, RUN_CLS2), ignite3, 10_000, 2);
+
+ for (Object o: res)
+ assertEquals(o, 42);
+
+ res = runJob2(new GridTestExternalClassLoader(new URL[] {
+ new URL(GridTestProperties.getProperty("p2p.uri.cls"))}, RUN_CLS, RUN_CLS1), ignite3, 10_000, 3);
+
+ for (Object o: res)
+ assertEquals(o, 42);
+
+ ignite3.close();
+
+ ignite3 = startGrid(3);
+
+ res = runJob2(new GridTestExternalClassLoader(new URL[] {
+ new URL(GridTestProperties.getProperty("p2p.uri.cls.second"))}, RUN_CLS, RUN_CLS1), ignite3, 10_000, 4);
+
+ for (Object o: res)
+ assertEquals(o, 43);
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+
+ /**
+ * @param ignite Ignite instance.
+ * @param timeout Timeout.
+ * @param param Parameter.
+ * @throws Exception If failed.
+ */
+ private Collection<Object> runJob1(ClassLoader testClassLoader, Ignite ignite, long timeout, int param) throws Exception {
+ Constructor ctor = testClassLoader.loadClass(RUN_CLS1).getConstructor(int.class);
+
+ return ignite.compute().withTimeout(timeout).broadcast((IgniteCallable<Object>)ctor.newInstance(param));
+ }
+
+ /**
+ * @param ignite Ignite instance.
+ * @param timeout Timeout.
+ * @param param Parameter.
+ * @throws Exception If failed.
+ */
+ private Collection<Object> runJob0(ClassLoader testClassLoader, Ignite ignite, long timeout, int param) throws Exception {
+ Constructor ctor = testClassLoader.loadClass(RUN_CLS).getConstructor(int.class);
+
+ return ignite.compute().withTimeout(timeout).broadcast((IgniteCallable<Object>)ctor.newInstance(param));
+ }
+
+ /**
+ * @param ignite Ignite instance.
+ * @param timeout Timeout.
+ * @param param Parameter.
+ * @throws Exception If failed.
+ */
+ private Collection<Object> runJob2(ClassLoader testClassLoader, Ignite ignite, long timeout, int param) throws Exception {
+ Constructor ctor = testClassLoader.loadClass(RUN_CLS2).getConstructor(int.class);
+
+ return ignite.compute().withTimeout(timeout).broadcast((IgniteCallable<Object>)ctor.newInstance(param));
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d2050237/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteP2PSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteP2PSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteP2PSelfTestSuite.java
index abd9967..3c50baf 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteP2PSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteP2PSelfTestSuite.java
@@ -35,6 +35,7 @@ import org.apache.ignite.p2p.GridP2PRemoteClassLoadersSelfTest;
import org.apache.ignite.p2p.GridP2PSameClassLoaderSelfTest;
import org.apache.ignite.p2p.GridP2PTimeoutSelfTest;
import org.apache.ignite.p2p.GridP2PUndeploySelfTest;
+import org.apache.ignite.p2p.SharedDeploymentTest;
import org.apache.ignite.testframework.GridTestUtils;
/**
@@ -72,6 +73,7 @@ public class IgniteP2PSelfTestSuite extends TestSuite {
suite.addTest(new TestSuite(GridP2PMissedResourceCacheSizeSelfTest.class));
suite.addTest(new TestSuite(GridP2PContinuousDeploymentSelfTest.class));
suite.addTest(new TestSuite(DeploymentClassLoaderCallableTest.class));
+ suite.addTest(new TestSuite(SharedDeploymentTest.class));
GridTestUtils.addTestIfNeeded(suite, GridDeploymentMessageCountSelfTest.class, ignoredTests);
return suite;
http://git-wip-us.apache.org/repos/asf/ignite/blob/d2050237/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable.java
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable.java b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable.java
index 25f1f3e..d24895c 100644
--- a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable.java
+++ b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable.java
@@ -18,8 +18,10 @@
package org.apache.ignite.tests.p2p.compute;
import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteLogger;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.resources.LoggerResource;
/**
*/
@@ -28,6 +30,10 @@ public class ExternalCallable implements IgniteCallable {
@IgniteInstanceResource
Ignite ignite;
+ /** Logger. */
+ @LoggerResource
+ private IgniteLogger log;
+
/** */
private int param;
@@ -46,10 +52,8 @@ public class ExternalCallable implements IgniteCallable {
/** {@inheritDoc} */
@Override public Object call() {
- System.err.println("!!!!! I am job " + param + " on " + ignite.name());
+ log.info("!!!!! I am job " + param + " on " + ignite.name());
return 42;
}
}
-
-
http://git-wip-us.apache.org/repos/asf/ignite/blob/d2050237/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable1.java
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable1.java b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable1.java
index 6a6befc..b20f3b9 100644
--- a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable1.java
+++ b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable1.java
@@ -18,8 +18,10 @@
package org.apache.ignite.tests.p2p.compute;
import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteLogger;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.resources.LoggerResource;
/**
*/
@@ -28,11 +30,14 @@ public class ExternalCallable1 implements IgniteCallable {
@IgniteInstanceResource
Ignite ignite;
+ /** Logger. */
+ @LoggerResource
+ private IgniteLogger log;
+
/** */
private int param;
/**
- *
*/
public ExternalCallable1() {
// No-op.
@@ -47,10 +52,8 @@ public class ExternalCallable1 implements IgniteCallable {
/** {@inheritDoc} */
@Override public Object call() {
- System.err.println("!!!!! I am job_1 " + param + " on " + ignite.name());
+ log.info("!!!!! I am job_1 " + param + " on " + ignite.name());
return 42;
}
}
-
-
http://git-wip-us.apache.org/repos/asf/ignite/blob/d2050237/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable2.java
----------------------------------------------------------------------
diff --git a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable2.java b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable2.java
index 7d1d0f7..48d51ba 100644
--- a/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable2.java
+++ b/modules/extdata/p2p/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable2.java
@@ -18,8 +18,10 @@
package org.apache.ignite.tests.p2p.compute;
import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteLogger;
import org.apache.ignite.lang.IgniteCallable;
import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.resources.LoggerResource;
/**
*/
@@ -28,11 +30,14 @@ public class ExternalCallable2 implements IgniteCallable {
@IgniteInstanceResource
Ignite ignite;
+ /** Logger. */
+ @LoggerResource
+ private IgniteLogger log;
+
/** */
private int param;
/**
- *
*/
public ExternalCallable2() {
// No-op.
@@ -47,10 +52,8 @@ public class ExternalCallable2 implements IgniteCallable {
/** {@inheritDoc} */
@Override public Object call() {
- System.err.println("!!!!! I am job_2 " + param + " on " + ignite.name());
+ log.info("!!!!! I am job_2 " + param + " on " + ignite.name());
return 42;
}
}
-
-
http://git-wip-us.apache.org/repos/asf/ignite/blob/d2050237/modules/extdata/uri/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable.java
----------------------------------------------------------------------
diff --git a/modules/extdata/uri/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable.java b/modules/extdata/uri/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable.java
new file mode 100644
index 0000000..0920199
--- /dev/null
+++ b/modules/extdata/uri/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable.java
@@ -0,0 +1,59 @@
+/*
+ * 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.tests.p2p.compute;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.resources.LoggerResource;
+
+/**
+ */
+public class ExternalCallable implements IgniteCallable {
+ /** */
+ @IgniteInstanceResource
+ Ignite ignite;
+
+ /** Logger. */
+ @LoggerResource
+ private IgniteLogger log;
+
+ /** */
+ private int param;
+
+ /**
+ */
+ public ExternalCallable() {
+ // No-op.
+ }
+
+ /**
+ * @param param Param.
+ */
+ public ExternalCallable(int param) {
+ this.param = param;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Object call() {
+ log.info("!!!!! I am modified job " + param + " on " + ignite.name());
+
+ return 43;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d2050237/modules/extdata/uri/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable1.java
----------------------------------------------------------------------
diff --git a/modules/extdata/uri/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable1.java b/modules/extdata/uri/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable1.java
new file mode 100644
index 0000000..fa48f0f
--- /dev/null
+++ b/modules/extdata/uri/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable1.java
@@ -0,0 +1,59 @@
+/*
+ * 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.tests.p2p.compute;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.resources.LoggerResource;
+
+/**
+ */
+public class ExternalCallable1 implements IgniteCallable {
+ /** */
+ @IgniteInstanceResource
+ Ignite ignite;
+
+ /** Logger. */
+ @LoggerResource
+ private IgniteLogger log;
+
+ /** */
+ private int param;
+
+ /**
+ */
+ public ExternalCallable1() {
+ // No-op.
+ }
+
+ /**
+ * @param param Param.
+ */
+ public ExternalCallable1(int param) {
+ this.param = param;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Object call() {
+ log.info("!!!!! I am modified job_1 " + param + " on " + ignite.name());
+
+ return 43;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/d2050237/modules/extdata/uri/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable2.java
----------------------------------------------------------------------
diff --git a/modules/extdata/uri/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable2.java b/modules/extdata/uri/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable2.java
new file mode 100644
index 0000000..a1ab9c1
--- /dev/null
+++ b/modules/extdata/uri/src/main/java/org/apache/ignite/tests/p2p/compute/ExternalCallable2.java
@@ -0,0 +1,59 @@
+/*
+ * 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.tests.p2p.compute;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.resources.LoggerResource;
+
+/**
+ */
+public class ExternalCallable2 implements IgniteCallable {
+ /** */
+ @IgniteInstanceResource
+ Ignite ignite;
+
+ /** Logger. */
+ @LoggerResource
+ private IgniteLogger log;
+
+ /** */
+ private int param;
+
+ /**
+ */
+ public ExternalCallable2() {
+ // No-op.
+ }
+
+ /**
+ * @param param Param.
+ */
+ public ExternalCallable2(int param) {
+ this.param = param;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Object call() {
+ log.info("!!!!! I am modified job_2 " + param + " on " + ignite.name());
+
+ return 43;
+ }
+}
[06/15] ignite git commit: IGNITE-6914. Web Console: Exporting large
CSV files via file-saver library.
Posted by sb...@apache.org.
IGNITE-6914. Web Console: Exporting large CSV files via file-saver library.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fe6bbab9
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fe6bbab9
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fe6bbab9
Branch: refs/heads/ignite-zk
Commit: fe6bbab9aae4efaae84ed9ea0dd908f36c74f9c5
Parents: 58b5041
Author: alexdel <ve...@yandex.ru>
Authored: Tue Nov 21 20:15:32 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Tue Nov 21 20:15:32 2017 +0700
----------------------------------------------------------------------
modules/web-console/frontend/app/app.js | 18 +++++++++---------
.../frontend/app/modules/sql/sql.controller.js | 4 ++--
.../frontend/app/services/LegacyUtils.service.js | 18 +++++-------------
modules/web-console/frontend/package.json | 2 +-
.../web-console/frontend/views/sql/sql.tpl.pug | 4 ++--
5 files changed, 19 insertions(+), 27 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fe6bbab9/modules/web-console/frontend/app/app.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/app.js b/modules/web-console/frontend/app/app.js
index 44454f6..ca678fc 100644
--- a/modules/web-console/frontend/app/app.js
+++ b/modules/web-console/frontend/app/app.js
@@ -142,23 +142,23 @@ angular.module('ignite-console', [
'ngAnimate',
'ngSanitize',
// Third party libs.
- 'ngRetina',
'btford.socket-io',
- 'mgcrea.ngStrap',
- 'ui.router',
- 'ui.router.state.events',
- 'gridster',
'dndLists',
+ 'gridster',
+ 'mgcrea.ngStrap',
+ 'ngRetina',
'nvd3',
+ 'pascalprecht.translate',
'smart-table',
'treeControl',
- 'pascalprecht.translate',
'ui.grid',
- 'ui.grid.saveState',
- 'ui.grid.selection',
- 'ui.grid.resizeColumns',
'ui.grid.autoResize',
'ui.grid.exporter',
+ 'ui.grid.resizeColumns',
+ 'ui.grid.saveState',
+ 'ui.grid.selection',
+ 'ui.router',
+ 'ui.router.state.events',
// Base modules.
'ignite-console.core',
'ignite-console.ace',
http://git-wip-us.apache.org/repos/asf/ignite/blob/fe6bbab9/modules/web-console/frontend/app/modules/sql/sql.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/sql.controller.js b/modules/web-console/frontend/app/modules/sql/sql.controller.js
index e97825c..ea0a06d 100644
--- a/modules/web-console/frontend/app/modules/sql/sql.controller.js
+++ b/modules/web-console/frontend/app/modules/sql/sql.controller.js
@@ -1652,7 +1652,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
csvContent += cols.join(';') + '\n';
});
- LegacyUtils.download('application/octet-stream;charset=utf-8', fileName, escape(csvContent));
+ LegacyUtils.download('text/csv', fileName, csvContent);
};
/**
@@ -1767,7 +1767,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
};
$scope.scanAvailable = function(paragraph) {
- return $scope.caches.length && !paragraph.loading;
+ return $scope.caches.length && !(paragraph.loading || paragraph.csvIsPreparing);
};
$scope.scanTooltip = function(paragraph) {
http://git-wip-us.apache.org/repos/asf/ignite/blob/fe6bbab9/modules/web-console/frontend/app/services/LegacyUtils.service.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/services/LegacyUtils.service.js b/modules/web-console/frontend/app/services/LegacyUtils.service.js
index be593b0..b19bde3 100644
--- a/modules/web-console/frontend/app/services/LegacyUtils.service.js
+++ b/modules/web-console/frontend/app/services/LegacyUtils.service.js
@@ -15,6 +15,8 @@
* limitations under the License.
*/
+import saver from 'file-saver';
+
// TODO: Refactor this service for legacy tables with more than one input field.
export default ['IgniteLegacyUtils', ['IgniteErrorPopover', (ErrorPopover) => {
function isDefined(v) {
@@ -351,20 +353,10 @@ export default ['IgniteLegacyUtils', ['IgniteErrorPopover', (ErrorPopover) => {
return !isEmpty;
},
domainForStoreConfigured,
- download(type, name, data) {
- const file = document.createElement('a');
-
- file.setAttribute('href', 'data:' + type + ';charset=utf-8,' + data);
- file.setAttribute('download', name);
- file.setAttribute('target', '_self');
-
- file.style.display = 'none';
-
- document.body.appendChild(file);
-
- file.click();
+ download(type = 'application/octet-stream', name = 'file.txt', data = '') {
+ const file = new Blob([data], { type: `${type};charset=utf-8`});
- document.body.removeChild(file);
+ saver.saveAs(file, name, false);
},
getQueryVariable(name) {
const attrs = window.location.search.substring(1).split('&');
http://git-wip-us.apache.org/repos/asf/ignite/blob/fe6bbab9/modules/web-console/frontend/package.json
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/package.json b/modules/web-console/frontend/package.json
index 49e69b4..18635f7 100644
--- a/modules/web-console/frontend/package.json
+++ b/modules/web-console/frontend/package.json
@@ -76,8 +76,8 @@
"html-loader": "0.4.5",
"html-webpack-plugin": "2.29.0",
"jquery": "3.2.1",
- "json-loader": "0.5.7",
"json-bigint": "0.2.3",
+ "json-loader": "0.5.7",
"jszip": "3.1.4",
"lodash": "4.17.4",
"node-sass": "4.6.0",
http://git-wip-us.apache.org/repos/asf/ignite/blob/fe6bbab9/modules/web-console/frontend/views/sql/sql.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/sql/sql.tpl.pug b/modules/web-console/frontend/views/sql/sql.tpl.pug
index 44989e8..a53a082 100644
--- a/modules/web-console/frontend/views/sql/sql.tpl.pug
+++ b/modules/web-console/frontend/views/sql/sql.tpl.pug
@@ -204,7 +204,7 @@ mixin table-result-heading-scan
button.btn.btn-primary.btn--with-icon(
ng-click='exportCsv(paragraph)'
- ng-disabled='paragraph.loading'
+ ng-disabled='paragraph.loading || paragraph.csvIsPreparing'
bs-tooltip=''
ng-attr-title='{{ scanTooltip(paragraph) }}'
@@ -218,7 +218,7 @@ mixin table-result-heading-scan
-var options = [{ text: "Export", click: 'exportCsv(paragraph)' }, { text: 'Export all', click: 'exportCsvAll(paragraph)' }]
button.btn.dropdown-toggle.btn-primary(
- ng-disabled='paragraph.loading'
+ ng-disabled='paragraph.loading || paragraph.csvIsPreparing'
bs-dropdown=`${JSON.stringify(options)}`
[07/15] ignite git commit: IGNITE-6963 TotalAllocatedPages metric
does not match PhysicalMemoryPages when persistence is disabled
Posted by sb...@apache.org.
IGNITE-6963 TotalAllocatedPages metric does not match PhysicalMemoryPages when persistence is disabled
Signed-off-by: Anton Vinogradov <av...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7ae798af
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7ae798af
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7ae798af
Branch: refs/heads/ignite-zk
Commit: 7ae798afe6eda53e720b7164094ad7679b00e97a
Parents: fe6bbab
Author: Andrey Kuznetsov <st...@gmail.com>
Authored: Tue Nov 21 16:59:22 2017 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Tue Nov 21 16:59:22 2017 +0300
----------------------------------------------------------------------
.../processors/cache/persistence/DataRegionMetricsImpl.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7ae798af/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsImpl.java
index 471ac94..ef148ba 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/persistence/DataRegionMetricsImpl.java
@@ -160,7 +160,10 @@ public class DataRegionMetricsImpl implements DataRegionMetrics {
/** {@inheritDoc} */
@Override public long getPhysicalMemoryPages() {
- if (!metricsEnabled || !persistenceEnabled)
+ if (!persistenceEnabled)
+ return getTotalAllocatedPages();
+
+ if (!metricsEnabled)
return 0;
assert pageMem != null;
[12/15] ignite git commit: IGNITE-6916: node joining with enabled pds
and empty disc space causes exchange to hang - Fixes #3036.
Posted by sb...@apache.org.
IGNITE-6916: node joining with enabled pds and empty disc space causes exchange to hang - Fixes #3036.
Signed-off-by: Alexey Goncharuk <al...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/99bbb53a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/99bbb53a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/99bbb53a
Branch: refs/heads/ignite-zk
Commit: 99bbb53aded605e7729df59dac1ee04916cee31b
Parents: d205023
Author: Evgeny Stanilovskiy <es...@gridgain.com>
Authored: Wed Nov 22 10:53:15 2017 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Wed Nov 22 10:53:15 2017 +0300
----------------------------------------------------------------------
.../wal/FileWriteAheadLogManager.java | 4 +-
.../wal/IgniteWalFlushBackgroundSelfTest.java | 35 +++
.../db/wal/IgniteWalFlushDefaultSelfTest.java | 35 +++
.../db/wal/IgniteWalFlushLogOnlySelfTest.java | 35 +++
...lFlushMultiNodeFailoverAbstractSelfTest.java | 246 +++++++++++++++++++
.../ignite/testsuites/IgnitePdsTestSuite2.java | 9 +
6 files changed, 362 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/99bbb53a/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 b4fc192..3d8d78f 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
@@ -50,6 +50,7 @@ import org.apache.ignite.events.EventType;
import org.apache.ignite.events.WalSegmentArchivedEvent;
import org.apache.ignite.internal.GridKernalContext;
import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.IgnitionEx;
import org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager;
import org.apache.ignite.internal.pagemem.wal.IgniteWriteAheadLogManager;
import org.apache.ignite.internal.pagemem.wal.StorageException;
@@ -75,7 +76,6 @@ import org.apache.ignite.internal.processors.timeout.GridTimeoutObject;
import org.apache.ignite.internal.processors.timeout.GridTimeoutProcessor;
import org.apache.ignite.internal.util.GridUnsafe;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.SB;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -2399,7 +2399,7 @@ public class FileWriteAheadLogManager extends GridCacheSharedManagerAdapter impl
new Thread() {
@Override public void run() {
- G.stop(gridName, true);
+ IgnitionEx.stop(gridName, true, true);
}
}.start();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/99bbb53a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushBackgroundSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushBackgroundSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushBackgroundSelfTest.java
new file mode 100644
index 0000000..d359a5c
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushBackgroundSelfTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.wal;
+
+import org.apache.ignite.configuration.WALMode;
+
+/**
+ *
+ */
+public class IgniteWalFlushBackgroundSelfTest extends IgniteWalFlushMultiNodeFailoverAbstractSelfTest {
+ /** {@inheritDoc} */
+ @Override protected int gridCount() {
+ return 1;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected WALMode walMode() {
+ return WALMode.BACKGROUND;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/99bbb53a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushDefaultSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushDefaultSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushDefaultSelfTest.java
new file mode 100644
index 0000000..d60241e
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushDefaultSelfTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.wal;
+
+import org.apache.ignite.configuration.WALMode;
+
+/**
+ *
+ */
+public class IgniteWalFlushDefaultSelfTest extends IgniteWalFlushMultiNodeFailoverAbstractSelfTest {
+ /** {@inheritDoc} */
+ @Override protected int gridCount() {
+ return 1;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected WALMode walMode() {
+ return WALMode.DEFAULT;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/99bbb53a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushLogOnlySelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushLogOnlySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushLogOnlySelfTest.java
new file mode 100644
index 0000000..95ffa02
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushLogOnlySelfTest.java
@@ -0,0 +1,35 @@
+/*
+ * 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.wal;
+
+import org.apache.ignite.configuration.WALMode;
+
+/**
+ *
+ */
+public class IgniteWalFlushLogOnlySelfTest extends IgniteWalFlushMultiNodeFailoverAbstractSelfTest {
+ /** {@inheritDoc} */
+ @Override protected int gridCount() {
+ return 1;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected WALMode walMode() {
+ return WALMode.LOG_ONLY;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/99bbb53a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java
new file mode 100644
index 0000000..057e082
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/db/wal/IgniteWalFlushMultiNodeFailoverAbstractSelfTest.java
@@ -0,0 +1,246 @@
+/*
+ * 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.wal;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.configuration.DataRegionConfiguration;
+import org.apache.ignite.configuration.DataStorageConfiguration;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.configuration.WALMode;
+import org.apache.ignite.internal.processors.cache.persistence.file.FileIO;
+import org.apache.ignite.internal.processors.cache.persistence.file.FileIODecorator;
+import org.apache.ignite.internal.processors.cache.persistence.file.FileIOFactory;
+import org.apache.ignite.internal.processors.cache.persistence.file.RandomAccessFileIOFactory;
+import org.apache.ignite.internal.util.lang.GridAbsPredicate;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.testframework.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+import org.apache.ignite.transactions.Transaction;
+import org.apache.ignite.transactions.TransactionConcurrency;
+import org.apache.ignite.transactions.TransactionIsolation;
+
+import java.nio.file.OpenOption;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import static java.nio.file.StandardOpenOption.CREATE;
+import static java.nio.file.StandardOpenOption.READ;
+import static java.nio.file.StandardOpenOption.WRITE;
+import static org.apache.ignite.internal.processors.cache.persistence.file.FilePageStoreManager.DFLT_STORE_DIR;
+
+/**
+ * Tests error recovery while node flushing
+ */
+public abstract class IgniteWalFlushMultiNodeFailoverAbstractSelfTest extends GridCommonAbstractTest {
+ /** */
+ private static final String TEST_CACHE = "testCache";
+
+ /** */
+ private static final int ITRS = 1000;
+
+ /** */
+ private AtomicBoolean canFail = new AtomicBoolean();
+
+ /**
+ * @return Node count.
+ */
+ protected abstract int gridCount();
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ stopAllGrids();
+
+ deleteWorkFiles();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ deleteWorkFiles();
+ }
+
+ /** {@inheritDoc} */
+ @Override protected long getTestTimeout() {
+ return 30_000;
+ }
+
+ /** {@inheritDoc} */
+ protected abstract WALMode walMode();
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(gridName);
+
+ CacheConfiguration cacheCfg = new CacheConfiguration(TEST_CACHE)
+ .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)
+ .setBackups(1);
+
+ cfg.setCacheConfiguration(cacheCfg);
+
+ DataStorageConfiguration memCfg = new DataStorageConfiguration()
+ .setDefaultDataRegionConfiguration(
+ new DataRegionConfiguration().setMaxSize(2048L * 1024 * 1024).setPersistenceEnabled(true))
+ .setWalMode(this.walMode())
+ .setWalSegmentSize(50_000);
+
+ if (gridName.endsWith(String.valueOf(gridCount())))
+ memCfg.setFileIOFactory(new FailingFileIOFactory(canFail));
+
+ cfg.setDataStorageConfiguration(memCfg);
+
+ return cfg;
+ }
+
+ /**
+ * Test flushing error recovery when flush is triggered while node starting
+ *
+ * @throws Exception In case of fail
+ */
+ public void testFailWhileStart() throws Exception {
+ failWhilePut(true);
+ }
+
+ /**
+ * Test flushing error recovery when flush is triggered after node started
+ *
+ * @throws Exception In case of fail
+ */
+ public void testFailAfterStart() throws Exception {
+ failWhilePut(false);
+ }
+
+ /**
+ * @throws Exception if failed.
+ */
+ public void failWhilePut(boolean failWhileStart) throws Exception {
+
+ final Ignite grid = startGridsMultiThreaded(gridCount());
+
+ grid.active(true);
+
+ IgniteCache<Object, Object> cache = grid.cache(TEST_CACHE);
+
+ for (int i = 0; i < ITRS; i++) {
+ while (true) {
+ try (Transaction tx = grid.transactions().txStart(
+ TransactionConcurrency.PESSIMISTIC, TransactionIsolation.READ_COMMITTED)) {
+ cache.put(i, "testValue" + i);
+
+ tx.commit();
+
+ break;
+ } catch (Exception expected) {
+ // Expected exception.
+ }
+ }
+
+ if (i == ITRS / 4) {
+ try {
+ if (failWhileStart)
+ canFail.set(true);
+
+ startGrid(gridCount());
+
+ waitForRebalancing();
+ } catch (Exception expected) {
+ // There can be any exception. Do nothing.
+ }
+ }
+
+ if (i == ITRS / 2)
+ canFail.set(true);
+ }
+
+
+ // We should await successful stop of node.
+ GridTestUtils.waitForCondition(new GridAbsPredicate() {
+ @Override
+ public boolean apply() {
+ return grid.cluster().nodes().size() == gridCount();
+ }
+ }, getTestTimeout());
+
+ stopAllGrids();
+
+ Ignite grid0 = startGrids(gridCount() + 1);
+
+ grid0.active(true);
+
+ cache = grid0.cache(TEST_CACHE);
+
+ for (int i = 0; i < ITRS; i++)
+ assertEquals(cache.get(i), "testValue" + i);
+ }
+
+
+ /**
+ * @throws IgniteCheckedException
+ */
+ private void deleteWorkFiles() throws IgniteCheckedException {
+ deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), DFLT_STORE_DIR, false));
+ }
+
+ /**
+ * Create File I/O which fails after second attempt to write to File
+ */
+ private static class FailingFileIOFactory implements FileIOFactory {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private AtomicBoolean fail;
+
+ /** */
+ private final FileIOFactory delegateFactory = new RandomAccessFileIOFactory();
+
+ /** */
+ FailingFileIOFactory(AtomicBoolean fail) {
+ this.fail = fail;
+ }
+
+ /** {@inheritDoc} */
+ @Override public FileIO create(File file) throws IOException {
+ return create(file, CREATE, READ, WRITE);
+ }
+
+ /** {@inheritDoc} */
+ @Override public FileIO create(File file, OpenOption... modes) throws IOException {
+ FileIO delegate = delegateFactory.create(file, modes);
+
+ return new FileIODecorator(delegate) {
+ int writeAttempts = 2;
+
+ @Override public int write(ByteBuffer sourceBuffer) throws IOException {
+
+ if (--writeAttempts == 0 && fail!= null && fail.get())
+ throw new IOException("No space left on device");
+
+ return super.write(sourceBuffer);
+ }
+ };
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/99bbb53a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
index b1e80ea..adfdb2c 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgnitePdsTestSuite2.java
@@ -30,7 +30,10 @@ import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsRebal
import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsTransactionsHangTest;
import org.apache.ignite.internal.processors.cache.persistence.db.IgnitePdsWholeClusterRestartTest;
import org.apache.ignite.internal.processors.cache.persistence.db.filename.IgniteUidAsConsistentIdMigrationTest;
+import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalFlushBackgroundSelfTest;
+import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalFlushDefaultSelfTest;
import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalFlushFailoverTest;
+import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalFlushLogOnlySelfTest;
import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalHistoryReservationsTest;
import org.apache.ignite.internal.processors.cache.persistence.db.wal.IgniteWalSerializerVersionTest;
import org.apache.ignite.internal.processors.cache.persistence.db.wal.crc.IgniteDataIntegrityTests;
@@ -75,6 +78,12 @@ public class IgnitePdsTestSuite2 extends TestSuite {
// Failover test
suite.addTestSuite(IgniteWalFlushFailoverTest.class);
+ suite.addTestSuite(IgniteWalFlushDefaultSelfTest.class);
+
+ suite.addTestSuite(IgniteWalFlushBackgroundSelfTest.class);
+
+ suite.addTestSuite(IgniteWalFlushLogOnlySelfTest.class);
+
suite.addTestSuite(IgniteWalReaderTest.class);
suite.addTestSuite(IgnitePdsExchangeDuringCheckpointTest.class);
[05/15] ignite git commit: IGNITE-6868 Implement new JMX metrics for
TcpCommunicationSpi monitoring
Posted by sb...@apache.org.
IGNITE-6868 Implement new JMX metrics for TcpCommunicationSpi monitoring
Signed-off-by: Anton Vinogradov <av...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/58b50413
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/58b50413
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/58b50413
Branch: refs/heads/ignite-zk
Commit: 58b50413622e0059f889f5df062a0d0169d0456f
Parents: 0295518
Author: Aleksey Plekhanov <Pl...@gmail.com>
Authored: Tue Nov 21 13:56:34 2017 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Tue Nov 21 13:56:34 2017 +0300
----------------------------------------------------------------------
.../tcp/TcpCommunicationMetricsListener.java | 225 +++++++++++++++++++
.../communication/tcp/TcpCommunicationSpi.java | 101 ++++++---
.../tcp/TcpCommunicationSpiMBean.java | 33 +++
.../tcp/TcpCommunicationStatisticsTest.java | 201 +++++++++++++++++
.../IgniteSpiCommunicationSelfTestSuite.java | 3 +
5 files changed, 527 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b50413/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationMetricsListener.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationMetricsListener.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationMetricsListener.java
new file mode 100644
index 0000000..8981e17
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationMetricsListener.java
@@ -0,0 +1,225 @@
+/*
+ * 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.spi.communication.tcp;
+
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+import org.apache.ignite.internal.managers.communication.GridIoMessage;
+import org.apache.ignite.internal.util.nio.GridNioMetricsListener;
+import org.apache.ignite.internal.util.typedef.F;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.jsr166.LongAdder8;
+
+/**
+ * Statistics for {@link org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi}.
+ */
+public class TcpCommunicationMetricsListener implements GridNioMetricsListener{
+ /** Received messages count. */
+ private final LongAdder8 rcvdMsgsCnt = new LongAdder8();
+
+ /** Sent messages count.*/
+ private final LongAdder8 sentMsgsCnt = new LongAdder8();
+
+ /** Received bytes count. */
+ private final LongAdder8 rcvdBytesCnt = new LongAdder8();
+
+ /** Sent bytes count.*/
+ private final LongAdder8 sentBytesCnt = new LongAdder8();
+
+ /** Counter factory. */
+ private static final Callable<LongAdder8> LONG_ADDER_FACTORY = new Callable<LongAdder8>() {
+ @Override public LongAdder8 call() {
+ return new LongAdder8();
+ }
+ };
+
+ /** Received messages count grouped by message type. */
+ private final ConcurrentMap<String, LongAdder8> rcvdMsgsCntByType = new ConcurrentHashMap<>();
+
+ /** Received messages count grouped by sender. */
+ private final ConcurrentMap<String, LongAdder8> rcvdMsgsCntByNode = new ConcurrentHashMap<>();
+
+ /** Sent messages count grouped by message type. */
+ private final ConcurrentMap<String, LongAdder8> sentMsgsCntByType = new ConcurrentHashMap<>();
+
+ /** Sent messages count grouped by receiver. */
+ private final ConcurrentMap<String, LongAdder8> sentMsgsCntByNode = new ConcurrentHashMap<>();
+
+ /** {@inheritDoc} */
+ @Override public void onBytesSent(int bytesCnt) {
+ sentBytesCnt.add(bytesCnt);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void onBytesReceived(int bytesCnt) {
+ rcvdBytesCnt.add(bytesCnt);
+ }
+
+ /**
+ * Collects statistics for message sent by SPI.
+ *
+ * @param msg Sent message.
+ * @param nodeId Receiver node id.
+ */
+ public void onMessageSent(Message msg, UUID nodeId) {
+ assert msg != null;
+ assert nodeId != null;
+
+ sentMsgsCnt.increment();
+
+ if (msg instanceof GridIoMessage)
+ msg = ((GridIoMessage)msg).message();
+
+ LongAdder8 cntByType = F.addIfAbsent(sentMsgsCntByType, msg.getClass().getSimpleName(), LONG_ADDER_FACTORY);
+ LongAdder8 cntByNode = F.addIfAbsent(sentMsgsCntByNode, nodeId.toString(), LONG_ADDER_FACTORY);
+
+ cntByType.increment();
+ cntByNode.increment();
+ }
+
+ /**
+ * Collects statistics for message received by SPI.
+ *
+ * @param msg Received message.
+ * @param nodeId Sender node id.
+ */
+ public void onMessageReceived(Message msg, UUID nodeId) {
+ assert msg != null;
+ assert nodeId != null;
+
+ rcvdMsgsCnt.increment();
+
+ if (msg instanceof GridIoMessage)
+ msg = ((GridIoMessage)msg).message();
+
+ LongAdder8 cntByType = F.addIfAbsent(rcvdMsgsCntByType, msg.getClass().getSimpleName(), LONG_ADDER_FACTORY);
+ LongAdder8 cntByNode = F.addIfAbsent(rcvdMsgsCntByNode, nodeId.toString(), LONG_ADDER_FACTORY);
+
+ cntByType.increment();
+ cntByNode.increment();
+ }
+
+ /**
+ * Gets sent messages count.
+ *
+ * @return Sent messages count.
+ */
+ public int sentMessagesCount() {
+ return sentMsgsCnt.intValue();
+ }
+
+ /**
+ * Gets sent bytes count.
+ *
+ * @return Sent bytes count.
+ */
+ public long sentBytesCount() {
+ return sentBytesCnt.longValue();
+ }
+
+ /**
+ * Gets received messages count.
+ *
+ * @return Received messages count.
+ */
+ public int receivedMessagesCount() {
+ return rcvdMsgsCnt.intValue();
+ }
+
+ /**
+ * Gets received bytes count.
+ *
+ * @return Received bytes count.
+ */
+ public long receivedBytesCount() {
+ return rcvdBytesCnt.longValue();
+ }
+
+ /**
+ * Converts statistics from internal representation to JMX-readable format.
+ *
+ * @param srcStat Internal statistics representation.
+ * @return Result map.
+ */
+ private Map<String, Long> convertStatistics(Map<String, LongAdder8> srcStat) {
+ Map<String, Long> destStat = U.newHashMap(srcStat.size());
+
+ for (Map.Entry<String, LongAdder8> entry : srcStat.entrySet()) {
+ destStat.put(entry.getKey(), entry.getValue().longValue());
+ }
+
+ return destStat;
+ }
+
+ /**
+ * Gets received messages counts (grouped by type).
+ *
+ * @return Map containing message types and respective counts.
+ */
+ public Map<String, Long> receivedMessagesByType() {
+ return convertStatistics(rcvdMsgsCntByType);
+ }
+
+ /**
+ * Gets received messages counts (grouped by node).
+ *
+ * @return Map containing sender nodes and respective counts.
+ */
+ public Map<String, Long> receivedMessagesByNode() {
+ return convertStatistics(rcvdMsgsCntByNode);
+ }
+
+ /**
+ * Gets sent messages counts (grouped by type).
+ *
+ * @return Map containing message types and respective counts.
+ */
+ public Map<String, Long> sentMessagesByType() {
+ return convertStatistics(sentMsgsCntByType);
+ }
+
+ /**
+ * Gets sent messages counts (grouped by node).
+ *
+ * @return Map containing receiver nodes and respective counts.
+ */
+ public Map<String, Long> sentMessagesByNode() {
+ return convertStatistics(sentMsgsCntByNode);
+ }
+
+ /**
+ * Resets metrics for this instance.
+ */
+ public void resetMetrics() {
+ // Can't use 'reset' method because it is not thread-safe
+ // according to javadoc.
+ sentMsgsCnt.add(-sentMsgsCnt.sum());
+ rcvdMsgsCnt.add(-rcvdMsgsCnt.sum());
+ sentBytesCnt.add(-sentBytesCnt.sum());
+ rcvdBytesCnt.add(-rcvdBytesCnt.sum());
+
+ sentMsgsCntByType.clear();
+ rcvdMsgsCntByType.clear();
+ sentMsgsCntByNode.clear();
+ rcvdMsgsCntByNode.clear();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b50413/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
index 49425ce..e68797e 100755
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java
@@ -83,7 +83,6 @@ import org.apache.ignite.internal.util.nio.GridNioFilter;
import org.apache.ignite.internal.util.nio.GridNioMessageReaderFactory;
import org.apache.ignite.internal.util.nio.GridNioMessageTracker;
import org.apache.ignite.internal.util.nio.GridNioMessageWriterFactory;
-import org.apache.ignite.internal.util.nio.GridNioMetricsListener;
import org.apache.ignite.internal.util.nio.GridNioRecoveryDescriptor;
import org.apache.ignite.internal.util.nio.GridNioServer;
import org.apache.ignite.internal.util.nio.GridNioServerListener;
@@ -138,7 +137,6 @@ import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi;
import org.apache.ignite.thread.IgniteThread;
import org.jetbrains.annotations.Nullable;
import org.jsr166.ConcurrentLinkedDeque8;
-import org.jsr166.LongAdder8;
import static org.apache.ignite.events.EventType.EVT_NODE_FAILED;
import static org.apache.ignite.events.EventType.EVT_NODE_LEFT;
@@ -696,7 +694,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
}
}
else {
- rcvdMsgsCnt.increment();
+ metricsLsnr.onMessageReceived(msg, connKey.nodeId());
if (msg instanceof RecoveryLastReceivedMessage) {
GridNioRecoveryDescriptor recovery = ses.outRecoveryDescriptor();
@@ -1111,34 +1109,14 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
/** Address resolver. */
private AddressResolver addrRslvr;
- /** Received messages count. */
- private final LongAdder8 rcvdMsgsCnt = new LongAdder8();
-
- /** Sent messages count.*/
- private final LongAdder8 sentMsgsCnt = new LongAdder8();
-
- /** Received bytes count. */
- private final LongAdder8 rcvdBytesCnt = new LongAdder8();
-
- /** Sent bytes count.*/
- private final LongAdder8 sentBytesCnt = new LongAdder8();
-
/** Context initialization latch. */
private final CountDownLatch ctxInitLatch = new CountDownLatch(1);
/** Stopping flag (set to {@code true} when SPI gets stopping signal). */
private volatile boolean stopping;
- /** metrics listener. */
- private final GridNioMetricsListener metricsLsnr = new GridNioMetricsListener() {
- @Override public void onBytesSent(int bytesCnt) {
- sentBytesCnt.add(bytesCnt);
- }
-
- @Override public void onBytesReceived(int bytesCnt) {
- rcvdBytesCnt.add(bytesCnt);
- }
- };
+ /** Statistics. */
+ private final TcpCommunicationMetricsListener metricsLsnr = new TcpCommunicationMetricsListener();
/** Client connect futures. */
private final ConcurrentMap<ConnectionKey, GridFutureAdapter<GridCommunicationClient>> clientFuts =
@@ -1821,22 +1799,58 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
/** {@inheritDoc} */
@Override public int getSentMessagesCount() {
- return sentMsgsCnt.intValue();
+ return metricsLsnr.sentMessagesCount();
}
/** {@inheritDoc} */
@Override public long getSentBytesCount() {
- return sentBytesCnt.longValue();
+ return metricsLsnr.sentBytesCount();
}
/** {@inheritDoc} */
@Override public int getReceivedMessagesCount() {
- return rcvdMsgsCnt.intValue();
+ return metricsLsnr.receivedMessagesCount();
}
/** {@inheritDoc} */
@Override public long getReceivedBytesCount() {
- return rcvdBytesCnt.longValue();
+ return metricsLsnr.receivedBytesCount();
+ }
+
+ /**
+ * Gets received messages counts (grouped by type).
+ *
+ * @return Map containing message types and respective counts.
+ */
+ public Map<String, Long> getReceivedMessagesByType() {
+ return metricsLsnr.receivedMessagesByType();
+ }
+
+ /**
+ * Gets received messages counts (grouped by node).
+ *
+ * @return Map containing sender nodes and respective counts.
+ */
+ public Map<String, Long> getReceivedMessagesByNode() {
+ return metricsLsnr.receivedMessagesByNode();
+ }
+
+ /**
+ * Gets sent messages counts (grouped by type).
+ *
+ * @return Map containing message types and respective counts.
+ */
+ public Map<String, Long> getSentMessagesByType() {
+ return metricsLsnr.sentMessagesByType();
+ }
+
+ /**
+ * Gets sent messages counts (grouped by node).
+ *
+ * @return Map containing receiver nodes and respective counts.
+ */
+ public Map<String, Long> getSentMessagesByNode() {
+ return metricsLsnr.receivedMessagesByNode();
}
/** {@inheritDoc} */
@@ -1848,12 +1862,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
/** {@inheritDoc} */
@Override public void resetMetrics() {
- // Can't use 'reset' method because it is not thread-safe
- // according to javadoc.
- sentMsgsCnt.add(-sentMsgsCnt.sum());
- rcvdMsgsCnt.add(-rcvdMsgsCnt.sum());
- sentBytesCnt.add(-sentBytesCnt.sum());
- rcvdBytesCnt.add(-rcvdBytesCnt.sum());
+ metricsLsnr.resetMetrics();
}
/**
@@ -2607,7 +2616,7 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
client.release();
if (!retry)
- sentMsgsCnt.increment();
+ metricsLsnr.onMessageSent(msg, node.id());
else {
removeNodeClient(node.id(), client);
@@ -5146,6 +5155,26 @@ public class TcpCommunicationSpi extends IgniteSpiAdapter implements Communicati
}
/** {@inheritDoc} */
+ @Override public Map<String, Long> getReceivedMessagesByType() {
+ return TcpCommunicationSpi.this.metricsLsnr.receivedMessagesByType();
+ }
+
+ /** {@inheritDoc} */
+ @Override public Map<String, Long> getReceivedMessagesByNode() {
+ return TcpCommunicationSpi.this.metricsLsnr.receivedMessagesByNode();
+ }
+
+ /** {@inheritDoc} */
+ @Override public Map<String, Long> getSentMessagesByType() {
+ return TcpCommunicationSpi.this.metricsLsnr.sentMessagesByType();
+ }
+
+ /** {@inheritDoc} */
+ @Override public Map<String, Long> getSentMessagesByNode() {
+ return TcpCommunicationSpi.this.metricsLsnr.sentMessagesByNode();
+ }
+
+ /** {@inheritDoc} */
@Override public int getOutboundMessagesQueueSize() {
return TcpCommunicationSpi.this.getOutboundMessagesQueueSize();
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b50413/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java
index 953245a..f4aba01 100644
--- a/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java
+++ b/modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpiMBean.java
@@ -17,6 +17,7 @@
package org.apache.ignite.spi.communication.tcp;
+import java.util.Map;
import org.apache.ignite.mxbean.MXBeanDescription;
import org.apache.ignite.spi.IgniteSpiManagementMBean;
@@ -147,6 +148,38 @@ public interface TcpCommunicationSpiMBean extends IgniteSpiManagementMBean {
public long getReceivedBytesCount();
/**
+ * Gets received messages counts (grouped by type).
+ *
+ * @return Map containing message types and respective counts.
+ */
+ @MXBeanDescription("Received messages count grouped by message type.")
+ public Map<String, Long> getReceivedMessagesByType();
+
+ /**
+ * Gets received messages counts (grouped by node).
+ *
+ * @return Map containing sender nodes and respective counts.
+ */
+ @MXBeanDescription("Received messages count grouped by sender node.")
+ public Map<String, Long> getReceivedMessagesByNode();
+
+ /**
+ * Gets sent messages counts (grouped by type).
+ *
+ * @return Map containing message types and respective counts.
+ */
+ @MXBeanDescription("Sent messages count grouped by message type.")
+ public Map<String, Long> getSentMessagesByType();
+
+ /**
+ * Gets sent messages counts (grouped by node).
+ *
+ * @return Map containing receiver nodes and respective counts.
+ */
+ @MXBeanDescription("Sent messages count grouped by receiver node.")
+ public Map<String, Long> getSentMessagesByNode();
+
+ /**
* Gets outbound messages queue size.
*
* @return Outbound messages queue size.
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b50413/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationStatisticsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationStatisticsTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationStatisticsTest.java
new file mode 100644
index 0000000..f0a8d71
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationStatisticsTest.java
@@ -0,0 +1,201 @@
+/*
+ * 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.spi.communication.tcp;
+
+import java.lang.management.ManagementFactory;
+import java.util.Map;
+import java.util.UUID;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerInvocationHandler;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.cluster.ClusterGroup;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.configuration.IgniteConfiguration;
+import org.apache.ignite.internal.managers.communication.GridIoMessageFactory;
+import org.apache.ignite.internal.util.typedef.CO;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.lang.IgniteRunnable;
+import org.apache.ignite.plugin.extensions.communication.Message;
+import org.apache.ignite.spi.IgniteSpiException;
+import org.apache.ignite.spi.communication.GridTestMessage;
+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;
+
+/**
+ * Test for TcpCommunicationSpi statistics.
+ */
+public class TcpCommunicationStatisticsTest extends GridCommonAbstractTest {
+ /** IP finder. */
+ private static final TcpDiscoveryIpFinder IP_FINDER = new TcpDiscoveryVmIpFinder(true);
+
+ /** Mutex. */
+ final private Object mux = new Object();
+
+ /** */
+ final private CountDownLatch latch = new CountDownLatch(1);
+
+ static {
+ GridIoMessageFactory.registerCustom(GridTestMessage.DIRECT_TYPE, new CO<Message>() {
+ @Override public Message apply() {
+ return new GridTestMessage();
+ }
+ });
+ }
+
+ /**
+ * CommunicationSPI synchronized by {@code mux}.
+ */
+ private class SynchronizedCommunicationSpi extends TcpCommunicationSpi {
+ /** {@inheritDoc} */
+ @Override public void sendMessage(ClusterNode node, Message msg) throws IgniteSpiException {
+ synchronized (mux) {
+ super.sendMessage(node, msg);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public void sendMessage(ClusterNode node, Message msg,
+ IgniteInClosure<IgniteException> ackC) throws IgniteSpiException {
+ synchronized (mux) {
+ super.sendMessage(node, msg, ackC);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void notifyListener(UUID sndId, Message msg, IgniteRunnable msgC) {
+ super.notifyListener(sndId, msg, msgC);
+
+ if (msg instanceof GridTestMessage)
+ latch.countDown();
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+ cfg.setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(IP_FINDER).setForceServerMode(true));
+
+ TcpCommunicationSpi spi = new SynchronizedCommunicationSpi();
+
+ cfg.setCommunicationSpi(spi);
+
+ return cfg;
+ }
+
+ /**
+ * Gets TcpCommunicationSpiMBean for given node.
+ *
+ * @param nodeIdx Node index.
+ * @return MBean instance.
+ */
+ private TcpCommunicationSpiMBean mbean(int nodeIdx) throws MalformedObjectNameException {
+ ObjectName mbeanName = U.makeMBeanName(getTestIgniteInstanceName(nodeIdx), "SPIs",
+ SynchronizedCommunicationSpi.class.getSimpleName());
+
+ MBeanServer mbeanServer = ManagementFactory.getPlatformMBeanServer();
+
+ if (mbeanServer.isRegistered(mbeanName))
+ return MBeanServerInvocationHandler.newProxyInstance(mbeanServer, mbeanName, TcpCommunicationSpiMBean.class,
+ true);
+ else
+ fail("MBean is not registered: " + mbeanName.getCanonicalName());
+
+ return null;
+ }
+
+ /**
+ * Compares two maps for equality.
+ */
+ private static <K, V> boolean mapsEquals(Map<K, V> map1, Map<K, V> map2) {
+ assert map1 != null;
+ assert map2 != null;
+
+ return map1.size() == map2.size() && map1.entrySet().containsAll(map2.entrySet());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testStatistics() throws Exception {
+ startGrids(2);
+
+ try {
+ // Send custom message from node0 to node1.
+ grid(0).configuration().getCommunicationSpi().sendMessage(grid(1).cluster().localNode(),
+ new GridTestMessage());
+
+ latch.await(10, TimeUnit.SECONDS);
+
+ ClusterGroup clusterGroupNode1 = grid(0).cluster().forNodeId(grid(1).localNode().id());
+
+ // Send job from node0 to node1.
+ grid(0).compute(clusterGroupNode1).call(new IgniteCallable<Boolean>() {
+ @Override public Boolean call() throws Exception {
+ return Boolean.TRUE;
+ }
+ });
+
+ synchronized (mux) {
+ TcpCommunicationSpiMBean mbean0 = mbean(0);
+ TcpCommunicationSpiMBean mbean1 = mbean(1);
+
+ Map<String, Long> msgsSentByNode0 = mbean0.getSentMessagesByNode();
+ Map<String, Long> msgsSentByNode1 = mbean1.getSentMessagesByNode();
+ Map<String, Long> msgsReceivedByNode0 = mbean0.getReceivedMessagesByNode();
+ Map<String, Long> msgsReceivedByNode1 = mbean1.getReceivedMessagesByNode();
+
+ String nodeId0 = grid(0).localNode().id().toString();
+ String nodeId1 = grid(1).localNode().id().toString();
+
+ assertEquals(msgsReceivedByNode0.get(nodeId1).longValue(), mbean0.getReceivedMessagesCount());
+ assertEquals(msgsReceivedByNode1.get(nodeId0).longValue(), mbean1.getReceivedMessagesCount());
+ assertEquals(msgsSentByNode0.get(nodeId1).longValue(), mbean0.getSentMessagesCount());
+ assertEquals(msgsSentByNode1.get(nodeId0).longValue(), mbean1.getSentMessagesCount());
+
+ assertEquals(mbean0.getSentMessagesCount(), mbean1.getReceivedMessagesCount());
+ assertEquals(mbean1.getSentMessagesCount(), mbean0.getReceivedMessagesCount());
+
+ Map<String, Long> msgsSentByType0 = mbean0.getSentMessagesByType();
+ Map<String, Long> msgsSentByType1 = mbean1.getSentMessagesByType();
+ Map<String, Long> msgsReceivedByType0 = mbean0.getReceivedMessagesByType();
+ Map<String, Long> msgsReceivedByType1 = mbean1.getReceivedMessagesByType();
+
+ // Node0 sent exactly the same types and count of messages as node1 received.
+ assertTrue(mapsEquals(msgsSentByType0, msgsReceivedByType1));
+
+ // Node1 sent exactly the same types and count of messages as node0 received.
+ assertTrue(mapsEquals(msgsSentByType1, msgsReceivedByType0));
+
+ assertEquals(1, msgsSentByType0.get(GridTestMessage.class.getSimpleName()).longValue());
+ assertEquals(1, msgsReceivedByType1.get(GridTestMessage.class.getSimpleName()).longValue());
+ }
+ }
+ finally {
+ stopAllGrids();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/58b50413/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiCommunicationSelfTestSuite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiCommunicationSelfTestSuite.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiCommunicationSelfTestSuite.java
index 8e96a3f..7a4de1b 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiCommunicationSelfTestSuite.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteSpiCommunicationSelfTestSuite.java
@@ -39,6 +39,7 @@ import org.apache.ignite.spi.communication.tcp.IgniteTcpCommunicationRecoveryAck
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpiDropNodesTest;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpiFaultyClientTest;
import org.apache.ignite.spi.communication.tcp.TcpCommunicationSpiHalfOpenedConnectionTest;
+import org.apache.ignite.spi.communication.tcp.TcpCommunicationStatisticsTest;
/**
* Test suite for all communication SPIs.
@@ -81,6 +82,8 @@ public class IgniteSpiCommunicationSelfTestSuite extends TestSuite {
suite.addTest(new TestSuite(TcpCommunicationSpiDropNodesTest.class));
suite.addTest(new TestSuite(TcpCommunicationSpiHalfOpenedConnectionTest.class));
+ suite.addTest(new TestSuite(TcpCommunicationStatisticsTest.class));
+
return suite;
}
}
[10/15] ignite git commit: IGNITE-5641 Web Console: Added "Copy to
clipboard" action on Queries screen.
Posted by sb...@apache.org.
IGNITE-5641 Web Console: Added "Copy to clipboard" action on Queries screen.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/08371f59
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/08371f59
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/08371f59
Branch: refs/heads/ignite-zk
Commit: 08371f5989730438b6dca2ddc6971c9b137fcdd2
Parents: df48356
Author: alexdel <ve...@yandex.ru>
Authored: Tue Nov 21 22:25:47 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Tue Nov 21 22:25:47 2017 +0700
----------------------------------------------------------------------
.../frontend/app/modules/sql/sql.controller.js | 15 +++++++++++----
modules/web-console/frontend/views/sql/sql.tpl.pug | 6 ++++--
2 files changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/08371f59/modules/web-console/frontend/app/modules/sql/sql.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/sql.controller.js b/modules/web-console/frontend/app/modules/sql/sql.controller.js
index ea0a06d..a2ad912 100644
--- a/modules/web-console/frontend/app/modules/sql/sql.controller.js
+++ b/modules/web-console/frontend/app/modules/sql/sql.controller.js
@@ -214,8 +214,8 @@ class Paragraph {
}
// Controller for SQL notebook screen.
-export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval', '$animate', '$location', '$anchorScroll', '$state', '$filter', '$modal', '$popover', 'IgniteLoading', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'AgentManager', 'IgniteChartColors', 'IgniteNotebook', 'IgniteNodes', 'uiGridExporterConstants', 'IgniteVersion', 'IgniteActivitiesData', 'JavaTypes',
- function($root, $scope, $http, $q, $timeout, $interval, $animate, $location, $anchorScroll, $state, $filter, $modal, $popover, Loading, LegacyUtils, Messages, Confirm, agentMgr, IgniteChartColors, Notebook, Nodes, uiGridExporterConstants, Version, ActivitiesData, JavaTypes) {
+export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval', '$animate', '$location', '$anchorScroll', '$state', '$filter', '$modal', '$popover', 'IgniteLoading', 'IgniteLegacyUtils', 'IgniteMessages', 'IgniteConfirm', 'AgentManager', 'IgniteChartColors', 'IgniteNotebook', 'IgniteNodes', 'uiGridExporterConstants', 'IgniteVersion', 'IgniteActivitiesData', 'JavaTypes', 'IgniteCopyToClipboard',
+ function($root, $scope, $http, $q, $timeout, $interval, $animate, $location, $anchorScroll, $state, $filter, $modal, $popover, Loading, LegacyUtils, Messages, Confirm, agentMgr, IgniteChartColors, Notebook, Nodes, uiGridExporterConstants, Version, ActivitiesData, JavaTypes, IgniteCopyToClipboard) {
const $ctrl = this;
// Define template urls.
@@ -1613,7 +1613,7 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
.then(() => paragraph.ace && paragraph.ace.focus());
};
- const _export = (fileName, columnDefs, meta, rows) => {
+ const _export = (fileName, columnDefs, meta, rows, toClipBoard = false) => {
let csvContent = '';
const cols = [];
@@ -1652,7 +1652,10 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
csvContent += cols.join(';') + '\n';
});
- LegacyUtils.download('text/csv', fileName, csvContent);
+ if (toClipBoard)
+ IgniteCopyToClipboard.copy(csvContent);
+ else
+ LegacyUtils.download('text/csv', fileName, csvContent);
};
/**
@@ -1671,6 +1674,10 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
return `export-query-${paragraph.name}${all ? '-all' : ''}.csv`;
};
+ $scope.exportCsvToClipBoard = (paragraph) => {
+ _export(exportFileName(paragraph, false), paragraph.gridOptions.columnDefs, paragraph.meta, paragraph.rows, true);
+ };
+
$scope.exportCsv = function(paragraph) {
_export(exportFileName(paragraph, false), paragraph.gridOptions.columnDefs, paragraph.meta, paragraph.rows);
http://git-wip-us.apache.org/repos/asf/ignite/blob/08371f59/modules/web-console/frontend/views/sql/sql.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/sql/sql.tpl.pug b/modules/web-console/frontend/views/sql/sql.tpl.pug
index a53a082..7714235 100644
--- a/modules/web-console/frontend/views/sql/sql.tpl.pug
+++ b/modules/web-console/frontend/views/sql/sql.tpl.pug
@@ -171,7 +171,7 @@ mixin table-result-heading-query
i.fa.fa-fw.fa-refresh.fa-spin(ng-if='paragraph.csvIsPreparing')
span Export
- -var options = [{ text: "Export", click: 'exportCsv(paragraph)' }, { text: 'Export all', click: 'exportCsvAll(paragraph)' }]
+ -var options = [{ text: 'Export', click: 'exportCsv(paragraph)' }, { text: 'Export all', click: 'exportCsvAll(paragraph)' }, { divider: true }, { text: '<span title="Copy current result page to clipboard">Copy to clipboard</span>', click: 'exportCsvToClipBoard(paragraph)' }]
button.btn.dropdown-toggle.btn-primary(
ng-disabled='paragraph.loading'
@@ -180,6 +180,7 @@ mixin table-result-heading-query
data-toggle='dropdown'
data-container='body'
data-placement='bottom-right'
+ data-html='true'
)
span.caret
@@ -216,7 +217,7 @@ mixin table-result-heading-scan
i.fa.fa-fw.fa-refresh.fa-spin(ng-if='paragraph.csvIsPreparing')
span Export
- -var options = [{ text: "Export", click: 'exportCsv(paragraph)' }, { text: 'Export all', click: 'exportCsvAll(paragraph)' }]
+ -var options = [{ text: "Export", click: 'exportCsv(paragraph)' }, { text: 'Export all', click: 'exportCsvAll(paragraph)' }, { divider: true }, { text: '<span title="Copy current result page to clipboard">Copy to clipboard</span>', click: 'exportCsvToClipBoard(paragraph)' }]
button.btn.dropdown-toggle.btn-primary(
ng-disabled='paragraph.loading || paragraph.csvIsPreparing'
@@ -225,6 +226,7 @@ mixin table-result-heading-scan
data-toggle='dropdown'
data-container='body'
data-placement='bottom-right'
+ data-html='true'
)
span.caret
[08/15] ignite git commit: IGNITE-6976 Visor CMD: Task to
put/get/remove data to/from caches.
Posted by sb...@apache.org.
IGNITE-6976 Visor CMD: Task to put/get/remove data to/from caches.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/152104e4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/152104e4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/152104e4
Branch: refs/heads/ignite-zk
Commit: 152104e42b31671ab5ee64ba92f6a31a0dc39b42
Parents: 7ae798a
Author: vsisko <vs...@gridgain.com>
Authored: Tue Nov 21 21:30:03 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Tue Nov 21 21:30:03 2017 +0700
----------------------------------------------------------------------
.../visor/cache/VisorCacheModifyTask.java | 113 ++++++++++++++++++
.../visor/cache/VisorCacheModifyTaskArg.java | 114 +++++++++++++++++++
.../visor/cache/VisorCacheModifyTaskResult.java | 101 ++++++++++++++++
.../visor/cache/VisorModifyCacheMode.java | 47 ++++++++
.../internal/visor/query/VisorQueryTask.java | 3 -
.../internal/visor/query/VisorQueryUtils.java | 25 ++--
.../resources/META-INF/classnames.properties | 77 +++++++++----
7 files changed, 445 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/152104e4/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTask.java
new file mode 100644
index 0000000..d6b1ff7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTask.java
@@ -0,0 +1,113 @@
+/*
+ * 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.util.UUID;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.processors.task.GridInternal;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.visor.VisorJob;
+import org.apache.ignite.internal.visor.VisorOneNodeTask;
+import org.apache.ignite.internal.visor.query.VisorQueryUtils;
+import org.apache.ignite.internal.visor.util.VisorTaskUtils;
+
+/**
+ * Task that modify value in specified cache.
+ */
+@GridInternal
+public class VisorCacheModifyTask extends VisorOneNodeTask<VisorCacheModifyTaskArg, VisorCacheModifyTaskResult> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override protected VisorCacheModifyJob job(VisorCacheModifyTaskArg arg) {
+ return new VisorCacheModifyJob(arg, debug);
+ }
+
+ /**
+ * Job that clear specified caches.
+ */
+ private static class VisorCacheModifyJob extends VisorJob<VisorCacheModifyTaskArg, VisorCacheModifyTaskResult> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * Create job.
+ *
+ * @param arg Task argument.
+ * @param debug Debug flag.
+ */
+ private VisorCacheModifyJob(VisorCacheModifyTaskArg arg, boolean debug) {
+ super(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected VisorCacheModifyTaskResult run(final VisorCacheModifyTaskArg arg) {
+ assert arg != null;
+
+ VisorModifyCacheMode mode = arg.getMode();
+ String cacheName = arg.getCacheName();
+ Object key = arg.getKey();
+
+ assert mode != null;
+ assert cacheName != null;
+ assert key != null;
+
+ IgniteCache<Object, Object> cache = ignite.cache(cacheName);
+
+ if (cache == null)
+ throw new IllegalArgumentException("Failed to find cache with specified name [cacheName=" + arg.getCacheName() + "]");
+
+ ClusterNode node = ignite.affinity(cacheName).mapKeyToNode(key);
+
+ UUID nid = node != null ? node.id() : null;
+
+ switch (mode) {
+ case PUT:
+ Object old = cache.get(key);
+
+ cache.put(key, arg.getValue());
+
+ return new VisorCacheModifyTaskResult(nid, VisorTaskUtils.compactClass(old),
+ VisorQueryUtils.convertValue(old));
+
+ case GET:
+ Object value = cache.get(key);
+
+ return new VisorCacheModifyTaskResult(nid, VisorTaskUtils.compactClass(value),
+ VisorQueryUtils.convertValue(value));
+
+ case REMOVE:
+ Object removed = cache.get(key);
+
+ cache.remove(key);
+
+ return new VisorCacheModifyTaskResult(nid, VisorTaskUtils.compactClass(removed),
+ VisorQueryUtils.convertValue(removed));
+ }
+
+ return new VisorCacheModifyTaskResult(nid, null, null);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheModifyJob.class, this);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/152104e4/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTaskArg.java
new file mode 100644
index 0000000..706aab7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTaskArg.java
@@ -0,0 +1,114 @@
+/*
+ * 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.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+
+/**
+ * Argument for {@link VisorCacheModifyTask}.
+ */
+public class VisorCacheModifyTaskArg extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Cache name. */
+ private String cacheName;
+
+ /** Modification mode. */
+ private VisorModifyCacheMode mode;
+
+ /** Specified key. */
+ private Object key;
+
+ /** Specified value. */
+ private Object value;
+
+ /**
+ * Default constructor.
+ */
+ public VisorCacheModifyTaskArg() {
+ // No-op.
+ }
+
+ /**
+ * @param cacheName Cache name.
+ * @param mode Modification mode.
+ * @param key Specified key.
+ * @param value Specified value.
+ */
+ public VisorCacheModifyTaskArg(String cacheName, VisorModifyCacheMode mode, Object key, Object value) {
+ this.cacheName = cacheName;
+ this.mode = mode;
+ this.key = key;
+ this.value = value;
+ }
+
+ /**
+ * @return Cache name.
+ */
+ public String getCacheName() {
+ return cacheName;
+ }
+
+ /**
+ * @return Modification mode.
+ */
+ public VisorModifyCacheMode getMode() {
+ return mode;
+ }
+
+ /**
+ * @return Specified key.
+ */
+ public Object getKey() {
+ return key;
+ }
+
+ /**
+ * @return Specified value.
+ */
+ public Object getValue() {
+ return value;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, cacheName);
+ U.writeEnum(out, mode);
+ out.writeObject(key);
+ out.writeObject(value);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ cacheName = U.readString(in);
+ mode = VisorModifyCacheMode.fromOrdinal(in.readByte());
+ key = in.readObject();
+ value = in.readObject();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheModifyTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/152104e4/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTaskResult.java
new file mode 100644
index 0000000..ce09bb2
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorCacheModifyTaskResult.java
@@ -0,0 +1,101 @@
+/*
+ * 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 java.util.UUID;
+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;
+
+/**
+ * Result for {@link VisorCacheModifyTask}.
+ */
+public class VisorCacheModifyTaskResult extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Node ID where modified data contained. */
+ private UUID affinityNode;
+
+ /** Result type name. */
+ private String resultType;
+
+ /** Value for specified key or number of modified rows. */
+ private Object result;
+
+ /**
+ * Default constructor.
+ */
+ public VisorCacheModifyTaskResult() {
+ // No-op.
+ }
+
+ /**
+ * @param affinityNode Node ID where modified data contained.
+ * @param resultType Result type name.
+ * @param result Value for specified key or number of modified rows.
+ */
+ public VisorCacheModifyTaskResult(UUID affinityNode, String resultType, Object result) {
+ this.affinityNode = affinityNode;
+ this.resultType = resultType;
+ this.result = result;
+ }
+
+ /**
+ * @return Node ID where modified data contained.
+ */
+ public UUID getAffinityNode() {
+ return affinityNode;
+ }
+
+ /**
+ * @return Result type name.
+ */
+ public String getResultType() {
+ return resultType;
+ }
+
+ /**
+ * @return Value for specified key or number of modified rows..
+ */
+ public Object getResult() {
+ return result;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeUuid(out, affinityNode);
+ U.writeString(out, resultType);
+ out.writeObject(result);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ affinityNode = U.readUuid(in);
+ resultType = U.readString(in);
+ result = in.readObject();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorCacheModifyTaskResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/152104e4/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorModifyCacheMode.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorModifyCacheMode.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorModifyCacheMode.java
new file mode 100644
index 0000000..4e28439
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/cache/VisorModifyCacheMode.java
@@ -0,0 +1,47 @@
+/*
+ * 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 org.jetbrains.annotations.Nullable;
+
+/**
+ * Enumeration of all supported cache modify modes.
+ */
+public enum VisorModifyCacheMode {
+ /** Put new value into cache. */
+ PUT,
+
+ /** Get value from cache. */
+ GET,
+
+ /** Remove value from cache. */
+ REMOVE;
+
+ /** Enumerated values. */
+ private static final VisorModifyCacheMode[] VALS = values();
+
+ /**
+ * Efficiently gets enumerated value from its ordinal.
+ *
+ * @param ord Ordinal value.
+ * @return Enumerated value or {@code null} if ordinal out of range.
+ */
+ @Nullable public static VisorModifyCacheMode fromOrdinal(int ord) {
+ return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/152104e4/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java
index 933bacc..51bf7d6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryTask.java
@@ -22,15 +22,12 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.UUID;
-import javax.cache.CacheException;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.cache.query.FieldsQueryCursor;
import org.apache.ignite.cache.query.SqlFieldsQuery;
import org.apache.ignite.internal.processors.query.GridQueryFieldMetadata;
-import org.apache.ignite.internal.processors.query.IgniteSQLException;
import org.apache.ignite.internal.processors.task.GridInternal;
import org.apache.ignite.internal.util.typedef.F;
-import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.S;
import org.apache.ignite.internal.util.typedef.internal.U;
import org.apache.ignite.internal.visor.VisorEither;
http://git-wip-us.apache.org/repos/asf/ignite/blob/152104e4/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java
index 9a0262d..aa4cb48 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/query/VisorQueryUtils.java
@@ -218,6 +218,17 @@ public class VisorQueryUtils {
"typeId", obj.type().typeId(), true);
}
+ public static Object convertValue(Object original) {
+ if (original == null)
+ return null;
+ else if (isKnownType(original))
+ return original;
+ else if (original instanceof BinaryObject)
+ return binaryToString((BinaryObject)original);
+ else
+ return original.getClass().isArray() ? "binary" : original.toString();
+ }
+
/**
* Collects rows from sql query future, first time creates meta and column names arrays.
*
@@ -237,18 +248,8 @@ public class VisorQueryUtils {
Object[] row = new Object[sz];
- for (int i = 0; i < sz; i++) {
- Object o = next.get(i);
-
- if (o == null)
- row[i] = null;
- else if (isKnownType(o))
- row[i] = o;
- else if (o instanceof BinaryObject)
- row[i] = binaryToString((BinaryObject)o);
- else
- row[i] = o.getClass().isArray() ? "binary" : o.toString();
- }
+ for (int i = 0; i < sz; i++)
+ row[i] = convertValue(next.get(i));
rows.add(row);
http://git-wip-us.apache.org/repos/asf/ignite/blob/152104e4/modules/core/src/main/resources/META-INF/classnames.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/main/resources/META-INF/classnames.properties b/modules/core/src/main/resources/META-INF/classnames.properties
index f3fc074..c27681e 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -54,15 +54,19 @@ org.apache.ignite.cache.affinity.AffinityUuid
org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction
org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction$HashComparator
org.apache.ignite.cache.eviction.AbstractEvictionPolicy
+org.apache.ignite.cache.eviction.AbstractEvictionPolicyFactory
org.apache.ignite.cache.eviction.EvictionFilter
org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicy
+org.apache.ignite.cache.eviction.fifo.FifoEvictionPolicyFactory
org.apache.ignite.cache.eviction.igfs.IgfsEvictionFilter
org.apache.ignite.cache.eviction.igfs.IgfsPerBlockLruEvictionPolicy
org.apache.ignite.cache.eviction.lru.LruEvictionPolicy
+org.apache.ignite.cache.eviction.lru.LruEvictionPolicyFactory
org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy
org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy$DefaultHolderComparator
org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy$GridConcurrentSkipListSetEx
org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicy$HolderComparator
+org.apache.ignite.cache.eviction.sorted.SortedEvictionPolicyFactory
org.apache.ignite.cache.query.CacheQueryEntryEvent
org.apache.ignite.cache.query.ContinuousQuery
org.apache.ignite.cache.query.Query
@@ -135,12 +139,14 @@ org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate
org.apache.ignite.configuration.CheckpointWriteOrder
org.apache.ignite.configuration.CollectionConfiguration
org.apache.ignite.configuration.DataPageEvictionMode
+org.apache.ignite.configuration.DataRegionConfiguration
+org.apache.ignite.configuration.DataStorageConfiguration
org.apache.ignite.configuration.DeploymentMode
org.apache.ignite.configuration.IgniteReflectionFactory
-org.apache.ignite.configuration.DataStorageConfiguration
-org.apache.ignite.configuration.DataRegionConfiguration
+org.apache.ignite.configuration.MemoryConfiguration
+org.apache.ignite.configuration.MemoryPolicyConfiguration
org.apache.ignite.configuration.NearCacheConfiguration
-org.apache.ignite.configuration.DataStorageConfiguration
+org.apache.ignite.configuration.PersistentStoreConfiguration
org.apache.ignite.configuration.TopologyValidator
org.apache.ignite.configuration.TransactionConfiguration
org.apache.ignite.configuration.WALMode
@@ -183,6 +189,7 @@ org.apache.ignite.igfs.mapreduce.records.IgfsByteDelimiterRecordResolver
org.apache.ignite.igfs.mapreduce.records.IgfsFixedLengthRecordResolver
org.apache.ignite.igfs.mapreduce.records.IgfsNewLineRecordResolver
org.apache.ignite.igfs.mapreduce.records.IgfsStringDelimiterRecordResolver
+org.apache.ignite.internal.DuplicateTypeIdException
org.apache.ignite.internal.ExecutorAwareMessage
org.apache.ignite.internal.GridClosureCallMode
org.apache.ignite.internal.GridComponent$DiscoveryDataExchangeType
@@ -307,10 +314,12 @@ org.apache.ignite.internal.igfs.common.IgfsIpcCommand
org.apache.ignite.internal.jdbc2.JdbcBatchUpdateTask
org.apache.ignite.internal.jdbc2.JdbcConnection$JdbcConnectionValidationTask
org.apache.ignite.internal.jdbc2.JdbcDatabaseMetadata$UpdateMetadataTask
+org.apache.ignite.internal.jdbc2.JdbcQueryMultipleStatementsTask
org.apache.ignite.internal.jdbc2.JdbcQueryTask
org.apache.ignite.internal.jdbc2.JdbcQueryTask$1
-org.apache.ignite.internal.jdbc2.JdbcQueryTask$QueryResult
-org.apache.ignite.internal.processors.cache.query.SqlFieldsQueryEx
+org.apache.ignite.internal.jdbc2.JdbcQueryTaskResult
+org.apache.ignite.internal.jdbc2.JdbcQueryTaskV2
+org.apache.ignite.internal.jdbc2.JdbcQueryTaskV3
org.apache.ignite.internal.managers.GridManagerAdapter$1$1
org.apache.ignite.internal.managers.checkpoint.GridCheckpointManager$CheckpointSet
org.apache.ignite.internal.managers.checkpoint.GridCheckpointRequest
@@ -341,7 +350,7 @@ org.apache.ignite.internal.mem.IgniteOutOfMemoryException
org.apache.ignite.internal.pagemem.impl.PageMemoryNoStoreImpl$Segment
org.apache.ignite.internal.pagemem.wal.StorageException
org.apache.ignite.internal.pagemem.wal.WALIterator
-org.apache.ignite.internal.pagemem.wal.record.TxRecord$TxAction
+org.apache.ignite.internal.pagemem.wal.WALPointer
org.apache.ignite.internal.pagemem.wal.record.WALRecord$RecordType
org.apache.ignite.internal.pagemem.wal.record.delta.DeltaApplicationException
org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion
@@ -426,29 +435,29 @@ org.apache.ignite.internal.processors.cache.GridCacheAdapter$11
org.apache.ignite.internal.processors.cache.GridCacheAdapter$12
org.apache.ignite.internal.processors.cache.GridCacheAdapter$13
org.apache.ignite.internal.processors.cache.GridCacheAdapter$14
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$15$1
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$16
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$15
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$16$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$17
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$18
org.apache.ignite.internal.processors.cache.GridCacheAdapter$2
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$25$1
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$27
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$28$1
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$29
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$26$1
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$28
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$29$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$3
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$31
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$30
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$32
org.apache.ignite.internal.processors.cache.GridCacheAdapter$4
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$47
org.apache.ignite.internal.processors.cache.GridCacheAdapter$48
org.apache.ignite.internal.processors.cache.GridCacheAdapter$49
org.apache.ignite.internal.processors.cache.GridCacheAdapter$50
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$52
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$51
org.apache.ignite.internal.processors.cache.GridCacheAdapter$53
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$53$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$54
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$54$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$55
+org.apache.ignite.internal.processors.cache.GridCacheAdapter$56
org.apache.ignite.internal.processors.cache.GridCacheAdapter$6
org.apache.ignite.internal.processors.cache.GridCacheAdapter$8
-org.apache.ignite.internal.processors.cache.GridCacheAdapter$9
org.apache.ignite.internal.processors.cache.GridCacheAdapter$AsyncOp$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$AsyncOp$1$1
org.apache.ignite.internal.processors.cache.GridCacheAdapter$AsyncOpRetryFuture$1
@@ -584,6 +593,7 @@ org.apache.ignite.internal.processors.cache.StoredCacheData
org.apache.ignite.internal.processors.cache.affinity.GridCacheAffinityProxy
org.apache.ignite.internal.processors.cache.binary.BinaryMetadataHolder
org.apache.ignite.internal.processors.cache.binary.BinaryMetadataKey
+org.apache.ignite.internal.processors.cache.binary.BinaryMetadataTransport$2
org.apache.ignite.internal.processors.cache.binary.CacheObjectBinaryProcessorImpl$3
org.apache.ignite.internal.processors.cache.binary.MetadataRequestMessage
org.apache.ignite.internal.processors.cache.binary.MetadataResponseMessage
@@ -757,6 +767,7 @@ org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtCol
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture$2
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture$3
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture$4
+org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture$5
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture$LockTimeoutObject$1
org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture$MiniFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.CacheGroupAffinityMessage
@@ -817,6 +828,7 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$2
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$3
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$4
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$5
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$LockTimeoutObject$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockFuture$MiniFuture$1
org.apache.ignite.internal.processors.cache.distributed.near.GridNearLockRequest
@@ -861,6 +873,8 @@ org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$19
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$2
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$20
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$21
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$22
+org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$23
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$3
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$4
org.apache.ignite.internal.processors.cache.distributed.near.GridNearTxLocal$5
@@ -900,9 +914,11 @@ org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$DestroyBa
org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$Result
org.apache.ignite.internal.processors.cache.persistence.tree.io.DataPageIO$EntryPart
org.apache.ignite.internal.processors.cache.persistence.wal.AbstractWalRecordsIterator
+org.apache.ignite.internal.processors.cache.persistence.wal.FileWALPointer
org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager$FileArchiver$1
org.apache.ignite.internal.processors.cache.persistence.wal.FileWriteAheadLogManager$RecordsIterator
org.apache.ignite.internal.processors.cache.persistence.wal.SegmentEofException
+org.apache.ignite.internal.processors.cache.persistence.wal.WalSegmentTailReachedException
org.apache.ignite.internal.processors.cache.persistence.wal.crc.IgniteDataIntegrityViolationException
org.apache.ignite.internal.processors.cache.persistence.wal.reader.StandaloneWalRecordsIterator
org.apache.ignite.internal.processors.cache.query.CacheQueryEntry
@@ -919,8 +935,6 @@ org.apache.ignite.internal.processors.cache.query.GridCacheQueryDetailMetricsAda
org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter$2
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$10
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$11
-org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$12$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$4$1
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$4$2
org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager$5
@@ -943,10 +957,16 @@ org.apache.ignite.internal.processors.cache.query.GridCacheQueryMetricsKey
org.apache.ignite.internal.processors.cache.query.GridCacheQueryRequest
org.apache.ignite.internal.processors.cache.query.GridCacheQueryResponse
org.apache.ignite.internal.processors.cache.query.GridCacheQueryResponseEntry
+org.apache.ignite.internal.processors.cache.query.GridCacheQuerySqlMetadataJobV2
+org.apache.ignite.internal.processors.cache.query.GridCacheQuerySqlMetadataJobV2$1
+org.apache.ignite.internal.processors.cache.query.GridCacheQuerySqlMetadataJobV2$2
+org.apache.ignite.internal.processors.cache.query.GridCacheQuerySqlMetadataJobV2$3
+org.apache.ignite.internal.processors.cache.query.GridCacheQuerySqlMetadataV2
org.apache.ignite.internal.processors.cache.query.GridCacheQueryType
org.apache.ignite.internal.processors.cache.query.GridCacheSqlIndexMetadata
org.apache.ignite.internal.processors.cache.query.GridCacheSqlMetadata
org.apache.ignite.internal.processors.cache.query.GridCacheSqlQuery
+org.apache.ignite.internal.processors.cache.query.SqlFieldsQueryEx
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryBatchAck
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryDeployableObject
org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryEntry
@@ -973,6 +993,7 @@ org.apache.ignite.internal.processors.cache.ratemetrics.HitRateMetricsSandbox
org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$1
org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$2
org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$3
+org.apache.ignite.internal.processors.cache.store.GridCacheStoreManagerAdapter$StoreOperation
org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$BatchingResult
org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$StatefulValue
org.apache.ignite.internal.processors.cache.store.GridCacheWriteBehindStore$StoreOperation
@@ -1264,6 +1285,7 @@ org.apache.ignite.internal.processors.marshaller.MappingProposedMessage$Proposal
org.apache.ignite.internal.processors.marshaller.MarshallerMappingItem
org.apache.ignite.internal.processors.marshaller.MissingMappingRequestMessage
org.apache.ignite.internal.processors.marshaller.MissingMappingResponseMessage
+org.apache.ignite.internal.processors.odbc.jdbc.JdbcStatementType
org.apache.ignite.internal.processors.odbc.odbc.escape.OdbcEscapeType
org.apache.ignite.internal.processors.platform.PlatformAbstractConfigurationClosure
org.apache.ignite.internal.processors.platform.PlatformAbstractPredicate
@@ -1287,6 +1309,7 @@ org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQue
org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQueryFilter
org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQueryImpl
org.apache.ignite.internal.processors.platform.cache.query.PlatformContinuousQueryRemoteFilter
+org.apache.ignite.internal.processors.platform.client.IgniteClientException
org.apache.ignite.internal.processors.platform.cluster.PlatformClusterNodeFilter
org.apache.ignite.internal.processors.platform.cluster.PlatformClusterNodeFilterImpl
org.apache.ignite.internal.processors.platform.compute.PlatformAbstractJob
@@ -1323,6 +1346,7 @@ org.apache.ignite.internal.processors.platform.entityframework.PlatformDotNetEnt
org.apache.ignite.internal.processors.platform.entityframework.PlatformDotNetEntityFrameworkCacheExtension$RemoveOldEntriesRunnable
org.apache.ignite.internal.processors.platform.entityframework.PlatformDotNetEntityFrameworkIncreaseVersionProcessor
org.apache.ignite.internal.processors.platform.events.PlatformEventFilterListenerImpl
+org.apache.ignite.internal.processors.platform.events.PlatformLocalEventListener
org.apache.ignite.internal.processors.platform.message.PlatformMessageFilter
org.apache.ignite.internal.processors.platform.messaging.PlatformMessageFilterImpl
org.apache.ignite.internal.processors.platform.messaging.PlatformMessageLocalFilter
@@ -1361,7 +1385,9 @@ org.apache.ignite.internal.processors.query.schema.message.SchemaAbstractDiscove
org.apache.ignite.internal.processors.query.schema.message.SchemaFinishDiscoveryMessage
org.apache.ignite.internal.processors.query.schema.message.SchemaOperationStatusMessage
org.apache.ignite.internal.processors.query.schema.message.SchemaProposeDiscoveryMessage
+org.apache.ignite.internal.processors.query.schema.operation.SchemaAbstractAlterTableOperation
org.apache.ignite.internal.processors.query.schema.operation.SchemaAbstractOperation
+org.apache.ignite.internal.processors.query.schema.operation.SchemaAlterTableAddColumnOperation
org.apache.ignite.internal.processors.query.schema.operation.SchemaIndexAbstractOperation
org.apache.ignite.internal.processors.query.schema.operation.SchemaIndexCreateOperation
org.apache.ignite.internal.processors.query.schema.operation.SchemaIndexDropOperation
@@ -1465,6 +1491,8 @@ org.apache.ignite.internal.processors.task.GridTaskThreadContextKey
org.apache.ignite.internal.processors.task.GridTaskWorker$3
org.apache.ignite.internal.processors.task.GridTaskWorker$5
org.apache.ignite.internal.processors.task.GridTaskWorker$State
+org.apache.ignite.internal.sql.SqlLexerTokenType
+org.apache.ignite.internal.sql.SqlParseException
org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException
org.apache.ignite.internal.transactions.IgniteTxOptimisticCheckedException
org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException
@@ -1557,6 +1585,7 @@ org.apache.ignite.internal.util.IgniteUtils$7
org.apache.ignite.internal.util.IgniteUtils$8
org.apache.ignite.internal.util.IgniteUtils$9
org.apache.ignite.internal.util.StripedCompositeReadWriteLock$ReadLock
+org.apache.ignite.internal.util.StripedExecutor$StealingStripe$1
org.apache.ignite.internal.util.UUIDCollectionMessage
org.apache.ignite.internal.util.future.AsyncFutureListener
org.apache.ignite.internal.util.future.GridCompoundFuture$1
@@ -1772,6 +1801,10 @@ org.apache.ignite.internal.visor.cache.VisorCacheMetrics
org.apache.ignite.internal.visor.cache.VisorCacheMetricsCollectorTask
org.apache.ignite.internal.visor.cache.VisorCacheMetricsCollectorTask$VisorCacheMetricsCollectorJob
org.apache.ignite.internal.visor.cache.VisorCacheMetricsCollectorTaskArg
+org.apache.ignite.internal.visor.cache.VisorCacheModifyTask
+org.apache.ignite.internal.visor.cache.VisorCacheModifyTask$VisorCacheClearJob
+org.apache.ignite.internal.visor.cache.VisorCacheModifyTaskArg
+org.apache.ignite.internal.visor.cache.VisorCacheModifyTaskResult
org.apache.ignite.internal.visor.cache.VisorCacheNearConfiguration
org.apache.ignite.internal.visor.cache.VisorCacheNodesTask
org.apache.ignite.internal.visor.cache.VisorCacheNodesTask$VisorCacheNodesJob
@@ -1797,6 +1830,7 @@ org.apache.ignite.internal.visor.cache.VisorCacheStopTask$VisorCacheStopJob
org.apache.ignite.internal.visor.cache.VisorCacheStopTaskArg
org.apache.ignite.internal.visor.cache.VisorCacheStoreConfiguration
org.apache.ignite.internal.visor.cache.VisorMemoryMetrics
+org.apache.ignite.internal.visor.cache.VisorModifyCacheMode
org.apache.ignite.internal.visor.cache.VisorPartitionMap
org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionsTask
org.apache.ignite.internal.visor.compute.VisorComputeCancelSessionsTask$VisorComputeCancelSessionsJob
@@ -1874,6 +1908,9 @@ org.apache.ignite.internal.visor.node.VisorBasicConfiguration
org.apache.ignite.internal.visor.node.VisorBinaryConfiguration
org.apache.ignite.internal.visor.node.VisorBinaryTypeConfiguration
org.apache.ignite.internal.visor.node.VisorCacheKeyConfiguration
+org.apache.ignite.internal.visor.node.VisorClientConnectorConfiguration
+org.apache.ignite.internal.visor.node.VisorDataRegionConfiguration
+org.apache.ignite.internal.visor.node.VisorDataStorageConfiguration
org.apache.ignite.internal.visor.node.VisorExecutorConfiguration
org.apache.ignite.internal.visor.node.VisorExecutorServiceConfiguration
org.apache.ignite.internal.visor.node.VisorGridConfiguration
@@ -2008,6 +2045,7 @@ org.apache.ignite.plugin.segmentation.SegmentationResolver
org.apache.ignite.services.Service
org.apache.ignite.services.ServiceConfiguration
org.apache.ignite.services.ServiceContext
+org.apache.ignite.services.ServiceDeploymentException
org.apache.ignite.services.ServiceDescriptor
org.apache.ignite.spi.IgnitePortProtocol
org.apache.ignite.spi.IgniteSpiCloseableIterator
@@ -2094,4 +2132,3 @@ org.apache.ignite.transactions.TransactionRollbackException
org.apache.ignite.transactions.TransactionState
org.apache.ignite.transactions.TransactionTimeoutException
org.apache.ignite.util.AttributeNodeFilter
-org.apache.ignite.internal.processors.cache.persistence.file.AsyncFileIO
[14/15] ignite git commit: zk
Posted by sb...@apache.org.
zk
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/e0aba812
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/e0aba812
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/e0aba812
Branch: refs/heads/ignite-zk
Commit: e0aba812643c0d773359a95b514daead9730ee6e
Parents: 4090eb7
Author: sboikov <sb...@gridgain.com>
Authored: Wed Nov 22 11:47:55 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Nov 22 13:21:21 2017 +0300
----------------------------------------------------------------------
.../zk/internal/ZkDiscoveryCustomEventData.java | 12 +-
.../zk/internal/ZkDiscoveryEventData.java | 7 +
.../discovery/zk/internal/ZkIgnitePaths.java | 11 +-
.../zk/internal/ZookeeperDiscoveryImpl.java | 226 ++++++++++++-------
.../zk/ZookeeperDiscoverySpiBasicTest.java | 4 +-
5 files changed, 177 insertions(+), 83 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/e0aba812/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkDiscoveryCustomEventData.java
----------------------------------------------------------------------
diff --git a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkDiscoveryCustomEventData.java b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkDiscoveryCustomEventData.java
index 1346c24..5668428 100644
--- a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkDiscoveryCustomEventData.java
+++ b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkDiscoveryCustomEventData.java
@@ -27,6 +27,9 @@ import org.apache.ignite.spi.discovery.DiscoverySpiCustomMessage;
*/
class ZkDiscoveryCustomEventData extends ZkDiscoveryEventData {
/** */
+ private static final int CUSTOM_MSG_ACK_FLAG = 1;
+
+ /** */
final UUID sndNodeId;
/** */
@@ -41,7 +44,7 @@ class ZkDiscoveryCustomEventData extends ZkDiscoveryEventData {
* @param sndNodeId Sender node ID.
* @param evtPath Event path.
*/
- ZkDiscoveryCustomEventData(long evtId, long topVer, UUID sndNodeId, String evtPath) {
+ ZkDiscoveryCustomEventData(long evtId, long topVer, UUID sndNodeId, String evtPath, boolean ack) {
super(evtId, DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT, topVer);
assert sndNodeId != null;
@@ -49,6 +52,13 @@ class ZkDiscoveryCustomEventData extends ZkDiscoveryEventData {
this.sndNodeId = sndNodeId;
this.evtPath = evtPath;
+
+ if (ack)
+ flags |= CUSTOM_MSG_ACK_FLAG;
+ }
+
+ boolean ackEvent() {
+ return flagSet(CUSTOM_MSG_ACK_FLAG);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/e0aba812/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkDiscoveryEventData.java
----------------------------------------------------------------------
diff --git a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkDiscoveryEventData.java b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkDiscoveryEventData.java
index 9f18f4f..00330e4 100644
--- a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkDiscoveryEventData.java
+++ b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkDiscoveryEventData.java
@@ -45,6 +45,9 @@ abstract class ZkDiscoveryEventData implements Serializable {
/** */
private transient Set<Integer> remainingAcks;
+ /** */
+ int flags;
+
/**
* @param evtType Event type.
* @param topVer Topology version.
@@ -89,6 +92,10 @@ abstract class ZkDiscoveryEventData implements Serializable {
return remainingAcks.isEmpty();
}
+ boolean flagSet(int flag) {
+ return (flags & flag) == flag;
+ }
+
long eventId() {
return evtId;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e0aba812/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkIgnitePaths.java
----------------------------------------------------------------------
diff --git a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkIgnitePaths.java b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkIgnitePaths.java
index ad35c05..591f18d 100644
--- a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkIgnitePaths.java
+++ b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZkIgnitePaths.java
@@ -33,6 +33,9 @@ class ZkIgnitePaths {
private static final String CUSTOM_EVTS_DIR = "customEvts";
/** */
+ private static final String CUSTOM_EVTS_ACKS_DIR = "customEvtsAcks";
+
+ /** */
private static final String ALIVE_NODES_DIR = "alive";
/** */
@@ -59,6 +62,9 @@ class ZkIgnitePaths {
/** */
final String customEvtsDir;
+ /** */
+ final String customEvtsAcksDir;
+
/**
* @param basePath Base directory.
* @param clusterName Cluster name.
@@ -73,6 +79,7 @@ class ZkIgnitePaths {
joinDataDir = zkPath(JOIN_DATA_DIR);
evtsPath = zkPath(DISCO_EVENTS_PATH);
customEvtsDir = zkPath(CUSTOM_EVTS_DIR);
+ customEvtsAcksDir = zkPath(CUSTOM_EVTS_ACKS_DIR);
}
/**
@@ -122,7 +129,7 @@ class ZkIgnitePaths {
return evtsPath + "/joined-" + evtId;
}
- String customEventDataPath(String child) {
- return customEvtsDir + "/" + child;
+ String customEventDataPath(boolean ack, String child) {
+ return ack ? customEvtsAcksDir : customEvtsDir + "/" + child;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e0aba812/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java
----------------------------------------------------------------------
diff --git a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java
index 8246e19..5e9c5a3 100644
--- a/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java
+++ b/modules/zookeeper/src/main/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoveryImpl.java
@@ -232,6 +232,7 @@ public class ZookeeperDiscoveryImpl {
}
try {
+ // TODO ZK: handle retries.
zkClient.createIfNeeded(zkPaths.customEvtsDir + "/" + locNode.id() + '|', msgBytes, CreateMode.PERSISTENT_SEQUENTIAL);
}
catch (ZookeeperClientFailedException e) {
@@ -347,6 +348,7 @@ public class ZookeeperDiscoveryImpl {
private void startJoin(byte[] joinDataBytes) throws InterruptedException {
try {
// TODO ZK: handle max size.
+ // TODO ZK: handle retries.
String path = zkClient.createIfNeeded(zkPaths.joinDataDir + "/" + locNode.id() + "|",
joinDataBytes,
EPHEMERAL_SEQUENTIAL);
@@ -494,7 +496,7 @@ public class ZookeeperDiscoveryImpl {
byte[] evtsData = zkClient.getData(zkPaths.evtsPath);
if (evtsData.length > 0)
- onEventsUpdate(evtsData);
+ processNewEvents(evtsData);
crd = true;
@@ -511,13 +513,9 @@ public class ZookeeperDiscoveryImpl {
ZkDiscoveryEventData evtData = it.next();
evtData.remainingAcks(top.nodesByOrder.values());
-
- if (evtData.allAcksReceived()) {
- processNodesAckEvent(evtData);
-
- it.remove();
- }
}
+
+ handleProcessedEvents();
}
else {
if (log.isInfoEnabled())
@@ -586,15 +584,17 @@ public class ZookeeperDiscoveryImpl {
Iterator<ZkDiscoveryEventData> it = evtsData.evts.values().iterator();
+ boolean processed = false;
+
while (it.hasNext()) {
ZkDiscoveryEventData evtData = it.next();
- if (evtData.onAckReceived(nodeInternalId, nodeData.lastProcEvt)) {
- processNodesAckEvent(evtData);
-
- it.remove();
- }
+ if (evtData.onAckReceived(nodeInternalId, nodeData.lastProcEvt))
+ processed = true;
}
+
+ if (processed)
+ handleProcessedEvents();
}
}
catch (Throwable e) {
@@ -647,18 +647,24 @@ public class ZookeeperDiscoveryImpl {
}
}
- if (newEvts) {
- long start = System.currentTimeMillis();
+ if (newEvts)
+ saveAndProcessNewEvents();
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ private void saveAndProcessNewEvents() throws Exception {
+ long start = System.currentTimeMillis();
- zkClient.setData(zkPaths.evtsPath, marsh.marshal(evtsData), -1);
+ zkClient.setData(zkPaths.evtsPath, marsh.marshal(evtsData), -1);
- long time = System.currentTimeMillis() - start;
+ long time = System.currentTimeMillis() - start;
- if (log.isInfoEnabled())
- log.info("Discovery coordinator saved new topology events [topVer=" + evtsData.topVer + ", saveTime=" + time + ']');
+ if (log.isInfoEnabled())
+ log.info("Discovery coordinator saved new topology events [topVer=" + evtsData.topVer + ", saveTime=" + time + ']');
- onEventsUpdate(evtsData);
- }
+ processNewEvents(evtsData);
}
/**
@@ -877,7 +883,8 @@ public class ZookeeperDiscoveryImpl {
evtsData.evtIdGen,
evtsData.topVer,
sndNodeId,
- evtE.getValue());
+ evtE.getValue(),
+ false);
evtData.msg = msg;
@@ -899,16 +906,7 @@ public class ZookeeperDiscoveryImpl {
evtsData.procCustEvt = evtE.getKey();
}
- long start = System.currentTimeMillis();
-
- zkClient.setData(zkPaths.evtsPath, marsh.marshal(evtsData), -1);
-
- long time = System.currentTimeMillis() - start;
-
- if (log.isInfoEnabled())
- log.info("Discovery coordinator saved new topology events [topVer=" + evtsData.topVer + ", saveTime=" + time + ']');
-
- onEventsUpdate(evtsData);
+ saveAndProcessNewEvents();
}
}
@@ -916,7 +914,7 @@ public class ZookeeperDiscoveryImpl {
* @param data Marshalled events.
* @throws Exception If failed.
*/
- private void onEventsUpdate(byte[] data) throws Exception {
+ private void processNewEvents(byte[] data) throws Exception {
if (data.length == 0)
return;
@@ -924,7 +922,7 @@ public class ZookeeperDiscoveryImpl {
ZkDiscoveryEventsData evtsData = unmarshal(data);
- onEventsUpdate(evtsData);
+ processNewEvents(evtsData);
this.evtsData = evtsData;
}
@@ -937,7 +935,7 @@ public class ZookeeperDiscoveryImpl {
* @throws Exception If failed.
*/
@SuppressWarnings("unchecked")
- private void onEventsUpdate(ZkDiscoveryEventsData evtsData) throws Exception {
+ private void processNewEvents(ZkDiscoveryEventsData evtsData) throws Exception {
TreeMap<Long, ZkDiscoveryEventData> evts = evtsData.evts;
boolean updateNodeInfo = false;
@@ -1002,6 +1000,9 @@ public class ZookeeperDiscoveryImpl {
case DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT: {
ZkDiscoveryCustomEventData evtData0 = (ZkDiscoveryCustomEventData)evtData;
+ if (evtData0.ackEvent() && evtData0.topologyVersion() < locNode.order())
+ break;
+
DiscoverySpiCustomMessage msg;
if (crd) {
@@ -1010,27 +1011,25 @@ public class ZookeeperDiscoveryImpl {
msg = evtData0.msg;
}
else {
- String path = zkPaths.customEventDataPath(evtData0.evtPath);
+ String path = zkPaths.customEventDataPath(evtData0.ackEvent(),
+ evtData0.evtPath);
msg = unmarshal(zkClient.getData(path));
+
+ evtData0.msg = msg;
}
notifyCustomEvent(evtData0, msg);
+ if (!evtData0.ackEvent())
+ updateNodeInfo = true;
+
break;
}
default:
assert false : "Invalid event: " + evtData;
}
-
- if (crd) {
- if (evtData.allAcksReceived()) {
- processNodesAckEvent(evtData);
-
- it.remove();
- }
- }
}
if (joined) {
@@ -1043,13 +1042,93 @@ public class ZookeeperDiscoveryImpl {
}
}
- if (!crd && updateNodeInfo) {
+ if (crd) {
+ handleProcessedEvents();
+ }
+ else if (updateNodeInfo) {
assert locNodeZkPath != null;
zkClient.setData(locNodeZkPath, marshal(locNodeInfo), -1);
}
}
+ /**
+ * @throws Exception If failed.
+ */
+ private void handleProcessedEvents() throws Exception {
+ Iterator<ZkDiscoveryEventData> it = this.evtsData.evts.values().iterator();
+
+ List<ZkDiscoveryCustomEventData> newEvts = null;
+
+ while (it.hasNext()) {
+ ZkDiscoveryEventData evtData = it.next();
+
+ if (evtData.allAcksReceived()) {
+ switch (evtData.eventType()) {
+ case EventType.EVT_NODE_JOINED: {
+ processNodesAckJoinEvent((ZkDiscoveryNodeJoinEventData)evtData);
+
+ break;
+ }
+
+ case DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT: {
+ DiscoverySpiCustomMessage ack = handleProcessedCustomEvent((ZkDiscoveryCustomEventData)evtData);
+
+ if (ack != null) {
+ evtsData.evtIdGen++;
+
+ long evtId = evtsData.evtIdGen;
+
+ byte[] ackBytes = marshal(ack);
+
+ String evtChildPath = String.valueOf(evtId);
+
+ zkClient.createIfNeeded(
+ zkPaths.customEventDataPath(true, evtChildPath),
+ ackBytes,
+ CreateMode.PERSISTENT);
+
+ ZkDiscoveryCustomEventData ackEvtData = new ZkDiscoveryCustomEventData(
+ evtId,
+ evtData.topologyVersion(), // Use topology version from original event.
+ locNode.id(),
+ evtChildPath,
+ true);
+
+ ackEvtData.msg = ack;
+
+ if (newEvts == null)
+ newEvts = new ArrayList<>();
+
+ newEvts.add(ackEvtData);
+
+ if (log.isInfoEnabled())
+ log.info("Generated CUSTOM event [topVer=" + evtData.topologyVersion() + ", evt=" + ack + ']');
+ }
+
+ break;
+ }
+
+ case EventType.EVT_NODE_FAILED: {
+ log.info("All nodes processed node fail [evtId=" + evtData.eventId() + ']');
+
+ // Do not need cleanup.
+ break;
+ }
+ }
+
+ it.remove();
+ }
+ }
+
+ if (newEvts != null) {
+ for (int i = 0; i < newEvts.size(); i++)
+ evtsData.addEvent(top.nodesByOrder.values(), newEvts.get(i));
+
+ saveAndProcessNewEvents();
+ }
+ }
+
private void processLocalJoin(ZkDiscoveryEventsData evtsData, ZkDiscoveryNodeJoinEventData evtData)
throws Exception
{
@@ -1161,47 +1240,22 @@ public class ZookeeperDiscoveryImpl {
}
/**
- * @param evtData
- * @throws Exception
- */
- private void processNodesAckEvent(ZkDiscoveryEventData evtData) throws Exception {
- switch (evtData.eventType()) {
- case EventType.EVT_NODE_JOINED: {
- processNodesAckJoinEvent((ZkDiscoveryNodeJoinEventData)evtData);
-
- break;
- }
-
- case DiscoveryCustomEvent.EVT_DISCOVERY_CUSTOM_EVT: {
- processNodesAckCustomEvent((ZkDiscoveryCustomEventData)evtData);
-
- break;
- }
-
- case EventType.EVT_NODE_FAILED: {
- log.info("All nodes processed node fail [evtId=" + evtData.eventId() + ']');
-
- // Do not need cleanup.
- break;
- }
- }
- }
-
- /**
* @param failedNode Failed node.
*/
private void processEventAcksOnNodeFail(ZookeeperClusterNode failedNode) throws Exception {
+ boolean processed = false;
+
for (Iterator<Map.Entry<Long, ZkDiscoveryEventData>> it = evtsData.evts.entrySet().iterator(); it.hasNext();) {
Map.Entry<Long, ZkDiscoveryEventData> e = it.next();
ZkDiscoveryEventData evtData = e.getValue();
- if (evtData.onNodeFail(failedNode)) {
- processNodesAckEvent(evtData);
-
- it.remove();
- }
+ if (evtData.onNodeFail(failedNode))
+ processed = true;
}
+
+ if (processed)
+ handleProcessedEvents();
}
/**
@@ -1218,11 +1272,25 @@ public class ZookeeperDiscoveryImpl {
/**
* @param evtData Event data.
* @throws Exception If failed.
+ * @return Ack message.
*/
- private void processNodesAckCustomEvent(ZkDiscoveryCustomEventData evtData) throws Exception {
+ @Nullable private DiscoverySpiCustomMessage handleProcessedCustomEvent(ZkDiscoveryCustomEventData evtData)
+ throws Exception
+ {
log.info("All nodes processed custom event [evtId=" + evtData.eventId() + ']');
- zkClient.deleteIfExists(zkPaths.customEventDataPath(evtData.evtPath), -1);
+ if (!evtData.ackEvent()) {
+ zkClient.deleteIfExists(zkPaths.customEventDataPath(false, evtData.evtPath), -1);
+
+ assert evtData.msg != null || locNode.order() > evtData.topologyVersion() : evtData;
+
+ if (evtData.msg != null)
+ return evtData.msg.ackMessage();
+ }
+ else
+ zkClient.deleteIfExists(zkPaths.customEventDataPath(true, evtData.evtPath), -1);
+
+ return null;
}
/**
@@ -1352,7 +1420,7 @@ public class ZookeeperDiscoveryImpl {
if (path.equals(zkPaths.evtsPath)) {
if (!crd)
- onEventsUpdate(data);
+ processNewEvents(data);
}
else
U.warn(log, "Data callback for unknown path: " + path);
http://git-wip-us.apache.org/repos/asf/ignite/blob/e0aba812/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/ZookeeperDiscoverySpiBasicTest.java
----------------------------------------------------------------------
diff --git a/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/ZookeeperDiscoverySpiBasicTest.java b/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/ZookeeperDiscoverySpiBasicTest.java
index aa1f836..d579c08 100644
--- a/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/ZookeeperDiscoverySpiBasicTest.java
+++ b/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/ZookeeperDiscoverySpiBasicTest.java
@@ -121,7 +121,7 @@ public class ZookeeperDiscoverySpiBasicTest extends GridCommonAbstractTest {
cfg.setCacheConfiguration(ccfg);
- cfg.setMarshaller(new JdkMarshaller());
+ // cfg.setMarshaller(new JdkMarshaller());
cfg.setClientMode(client);
@@ -609,6 +609,8 @@ public class ZookeeperDiscoverySpiBasicTest extends GridCommonAbstractTest {
node.compute().broadcast(new DummyCallable(null));
awaitPartitionMapExchange();
+
+ waitForEventsAcks(ignite(0));
}
/**
[04/15] ignite git commit: IGNITE-6869 Implement new JMX metric for
jobs monitoring
Posted by sb...@apache.org.
IGNITE-6869 Implement new JMX metric for jobs monitoring
Signed-off-by: Anton Vinogradov <av...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0295518b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0295518b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0295518b
Branch: refs/heads/ignite-zk
Commit: 0295518bac9f9431351f8f7e7b9d2148ee70417d
Parents: 31055f2
Author: Aleksey Plekhanov <Pl...@gmail.com>
Authored: Tue Nov 21 13:39:20 2017 +0300
Committer: Anton Vinogradov <av...@apache.org>
Committed: Tue Nov 21 13:39:20 2017 +0300
----------------------------------------------------------------------
.../apache/ignite/cluster/ClusterMetrics.java | 12 +-
.../ClusterLocalNodeMetricsMXBeanImpl.java | 11 +-
.../internal/ClusterMetricsMXBeanImpl.java | 360 +++++++++++++++++++
.../ignite/internal/ClusterMetricsSnapshot.java | 37 +-
.../apache/ignite/internal/IgniteKernal.java | 40 ++-
.../discovery/GridDiscoveryManager.java | 1 +
.../processors/jobmetrics/GridJobMetrics.java | 21 +-
.../jobmetrics/GridJobMetricsProcessor.java | 9 +-
.../mxbean/ClusterLocalNodeMetricsMXBean.java | 253 -------------
.../ignite/mxbean/ClusterMetricsMXBean.java | 257 +++++++++++++
.../internal/ClusterNodeMetricsSelfTest.java | 4 +-
...ClusterMetricsSnapshotSerializeSelfTest.java | 8 +-
12 files changed, 734 insertions(+), 279 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0295518b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java
index 7dd4707..74e98b8 100644
--- a/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/cluster/ClusterMetrics.java
@@ -225,6 +225,16 @@ public interface ClusterMetrics {
public int getTotalExecutedJobs();
/**
+ * Gets total time all finished jobs takes to execute on the node since node startup.
+ * <p>
+ * <b>Note:</b> Unlike most of other aggregation metrics this metric is not calculated over history
+ * but over the entire node life.
+ *
+ * @return Total jobs execution time.
+ */
+ public long getTotalJobsExecutionTime();
+
+ /**
* Gets maximum time a job ever spent waiting in a queue to be executed.
* <p>
* <b>Note:</b> all aggregated metrics like average, minimum, maximum, total, count are
@@ -684,4 +694,4 @@ public interface ClusterMetrics {
* @return Total number of nodes.
*/
public int getTotalNodes();
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0295518b/modules/core/src/main/java/org/apache/ignite/internal/ClusterLocalNodeMetricsMXBeanImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/ClusterLocalNodeMetricsMXBeanImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/ClusterLocalNodeMetricsMXBeanImpl.java
index ef81c6a..263c20a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/ClusterLocalNodeMetricsMXBeanImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/ClusterLocalNodeMetricsMXBeanImpl.java
@@ -19,12 +19,12 @@ package org.apache.ignite.internal;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.util.typedef.internal.S;
-import org.apache.ignite.mxbean.ClusterLocalNodeMetricsMXBean;
+import org.apache.ignite.mxbean.ClusterMetricsMXBean;
/**
* Local node metrics MBean.
*/
-public class ClusterLocalNodeMetricsMXBeanImpl implements ClusterLocalNodeMetricsMXBean {
+public class ClusterLocalNodeMetricsMXBeanImpl implements ClusterMetricsMXBean {
/** Grid node. */
private final ClusterNode node;
@@ -263,6 +263,11 @@ public class ClusterLocalNodeMetricsMXBeanImpl implements ClusterLocalNodeMetric
}
/** {@inheritDoc} */
+ @Override public long getTotalJobsExecutionTime() {
+ return node.metrics().getTotalJobsExecutionTime();
+ }
+
+ /** {@inheritDoc} */
@Override public long getTotalIdleTime() {
return node.metrics().getTotalIdleTime();
}
@@ -321,4 +326,4 @@ public class ClusterLocalNodeMetricsMXBeanImpl implements ClusterLocalNodeMetric
@Override public String toString() {
return S.toString(ClusterLocalNodeMetricsMXBeanImpl.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0295518b/modules/core/src/main/java/org/apache/ignite/internal/ClusterMetricsMXBeanImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/ClusterMetricsMXBeanImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/ClusterMetricsMXBeanImpl.java
new file mode 100644
index 0000000..de4e405
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/ClusterMetricsMXBeanImpl.java
@@ -0,0 +1,360 @@
+/*
+ * 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;
+
+import org.apache.ignite.cluster.ClusterGroup;
+import org.apache.ignite.cluster.ClusterMetrics;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.mxbean.ClusterMetricsMXBean;
+
+/**
+ * Cluster metrics MBean.
+ */
+public class ClusterMetricsMXBeanImpl implements ClusterMetricsMXBean {
+ /** Grid cluster. */
+ private final ClusterGroup cluster;
+
+ /** Cached value of cluster metrics. */
+ private volatile ClusterMetrics clusterMetricsSnapshot;
+
+ /** Cluster metrics expire time. */
+ private volatile long clusterMetricsExpireTime;
+
+ /** Cluster metrics update mutex. */
+ private final Object clusterMetricsMux = new Object();
+
+ /**
+ * @param cluster Cluster group to manage.
+ */
+ public ClusterMetricsMXBeanImpl(ClusterGroup cluster) {
+ assert cluster != null;
+
+ this.cluster = cluster;
+ }
+
+ /**
+ * Gets a metrics snapshot for this cluster group.
+ *
+ * @return Metrics snapshot.
+ */
+ private ClusterMetrics metrics() {
+ if (clusterMetricsExpireTime < System.currentTimeMillis()) {
+ synchronized (clusterMetricsMux) {
+ if (clusterMetricsExpireTime < System.currentTimeMillis()) {
+ clusterMetricsSnapshot = cluster.metrics();
+
+ clusterMetricsExpireTime = System.currentTimeMillis()
+ + cluster.ignite().configuration().getMetricsUpdateFrequency();
+ }
+ }
+ }
+
+ return clusterMetricsSnapshot;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getTotalCpus() {
+ return metrics().getTotalCpus();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getAverageActiveJobs() {
+ return metrics().getAverageActiveJobs();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getAverageCancelledJobs() {
+ return metrics().getAverageCancelledJobs();
+ }
+
+ /** {@inheritDoc} */
+ @Override public double getAverageJobExecuteTime() {
+ return metrics().getAverageJobExecuteTime();
+ }
+
+ /** {@inheritDoc} */
+ @Override public double getAverageJobWaitTime() {
+ return metrics().getAverageJobWaitTime();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getAverageRejectedJobs() {
+ return metrics().getAverageRejectedJobs();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getAverageWaitingJobs() {
+ return metrics().getAverageWaitingJobs();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getBusyTimePercentage() {
+ return metrics().getBusyTimePercentage() * 100;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getCurrentActiveJobs() {
+ return metrics().getCurrentActiveJobs();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getCurrentCancelledJobs() {
+ return metrics().getCurrentCancelledJobs();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getCurrentIdleTime() {
+ return metrics().getCurrentIdleTime();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getCurrentJobExecuteTime() {
+ return metrics().getCurrentJobExecuteTime();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getCurrentJobWaitTime() {
+ return metrics().getCurrentJobWaitTime();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getCurrentRejectedJobs() {
+ return metrics().getCurrentRejectedJobs();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getCurrentWaitingJobs() {
+ return metrics().getCurrentWaitingJobs();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getTotalExecutedTasks() {
+ return metrics().getTotalExecutedTasks();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getCurrentDaemonThreadCount() {
+ return metrics().getCurrentDaemonThreadCount();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getHeapMemoryCommitted() {
+ return metrics().getHeapMemoryCommitted();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getHeapMemoryInitialized() {
+ return metrics().getHeapMemoryInitialized();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getHeapMemoryMaximum() {
+ return metrics().getHeapMemoryMaximum();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getHeapMemoryTotal() {
+ return metrics().getHeapMemoryTotal();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getHeapMemoryUsed() {
+ return metrics().getHeapMemoryUsed();
+ }
+
+ /** {@inheritDoc} */
+ @Override public float getIdleTimePercentage() {
+ return metrics().getIdleTimePercentage() * 100;
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastUpdateTime() {
+ return metrics().getLastUpdateTime();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getMaximumActiveJobs() {
+ return metrics().getMaximumActiveJobs();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getMaximumCancelledJobs() {
+ return metrics().getMaximumCancelledJobs();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getMaximumJobExecuteTime() {
+ return metrics().getMaximumJobExecuteTime();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getMaximumJobWaitTime() {
+ return metrics().getMaximumJobWaitTime();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getMaximumRejectedJobs() {
+ return metrics().getMaximumRejectedJobs();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getMaximumWaitingJobs() {
+ return metrics().getMaximumWaitingJobs();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getNonHeapMemoryCommitted() {
+ return metrics().getNonHeapMemoryCommitted();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getNonHeapMemoryInitialized() {
+ return metrics().getNonHeapMemoryInitialized();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getNonHeapMemoryMaximum() {
+ return metrics().getNonHeapMemoryMaximum();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getNonHeapMemoryTotal() {
+ return metrics().getNonHeapMemoryTotal();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getNonHeapMemoryUsed() {
+ return metrics().getNonHeapMemoryUsed();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getMaximumThreadCount() {
+ return metrics().getMaximumThreadCount();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getStartTime() {
+ return metrics().getStartTime();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getNodeStartTime() {
+ return metrics().getNodeStartTime();
+ }
+
+ /** {@inheritDoc} */
+ @Override public double getCurrentCpuLoad() {
+ return metrics().getCurrentCpuLoad() * 100;
+ }
+
+ /** {@inheritDoc} */
+ @Override public double getAverageCpuLoad() {
+ return metrics().getAverageCpuLoad() * 100;
+ }
+
+ /** {@inheritDoc} */
+ @Override public double getCurrentGcCpuLoad() {
+ return metrics().getCurrentGcCpuLoad() * 100;
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getCurrentThreadCount() {
+ return metrics().getCurrentThreadCount();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getTotalBusyTime() {
+ return metrics().getTotalBusyTime();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getTotalCancelledJobs() {
+ return metrics().getTotalCancelledJobs();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getTotalExecutedJobs() {
+ return metrics().getTotalExecutedJobs();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getTotalJobsExecutionTime() {
+ return metrics().getTotalJobsExecutionTime();
+ }
+
+
+ /** {@inheritDoc} */
+ @Override public long getTotalIdleTime() {
+ return metrics().getTotalIdleTime();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getTotalRejectedJobs() {
+ return metrics().getTotalRejectedJobs();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getTotalStartedThreadCount() {
+ return metrics().getTotalStartedThreadCount();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getUpTime() {
+ return metrics().getUpTime();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getLastDataVersion() {
+ return metrics().getLastDataVersion();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getSentMessagesCount() {
+ return metrics().getSentMessagesCount();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getSentBytesCount() {
+ return metrics().getSentBytesCount();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getReceivedMessagesCount() {
+ return metrics().getReceivedMessagesCount();
+ }
+
+ /** {@inheritDoc} */
+ @Override public long getReceivedBytesCount() {
+ return metrics().getReceivedBytesCount();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getOutboundMessagesQueueSize() {
+ return metrics().getOutboundMessagesQueueSize();
+ }
+
+ /** {@inheritDoc} */
+ @Override public int getTotalNodes() {
+ return metrics().getTotalNodes();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(ClusterMetricsMXBeanImpl.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0295518b/modules/core/src/main/java/org/apache/ignite/internal/ClusterMetricsSnapshot.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/ClusterMetricsSnapshot.java b/modules/core/src/main/java/org/apache/ignite/internal/ClusterMetricsSnapshot.java
index 8a0bc5e..5f29167 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/ClusterMetricsSnapshot.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/ClusterMetricsSnapshot.java
@@ -90,8 +90,9 @@ public class ClusterMetricsSnapshot implements ClusterMetrics {
8/*sent bytes count*/ +
4/*received messages count*/ +
8/*received bytes count*/ +
- 4/*outbound messages queue size*/ +
- 4/*total nodes*/;
+ 4/*outbound messages queue size*/ +
+ 4/*total nodes*/ +
+ 8/*total jobs execution time*/;
/** */
private long lastUpdateTime = -1;
@@ -252,6 +253,9 @@ public class ClusterMetricsSnapshot implements ClusterMetrics {
/** */
private int totalNodes = -1;
+ /** */
+ private long totalJobsExecTime = -1;
+
/**
* Create empty snapshot.
*/
@@ -288,6 +292,7 @@ public class ClusterMetricsSnapshot implements ClusterMetrics {
totalRejectedJobs = 0;
totalCancelledJobs = 0;
totalExecutedJobs = 0;
+ totalJobsExecTime = 0;
maxJobWaitTime = 0;
avgJobWaitTime = 0;
maxJobExecTime = 0;
@@ -334,6 +339,7 @@ public class ClusterMetricsSnapshot implements ClusterMetrics {
maxActiveJobs = max(maxActiveJobs, m.getCurrentActiveJobs());
avgActiveJobs += m.getCurrentActiveJobs();
totalExecutedJobs += m.getTotalExecutedJobs();
+ totalJobsExecTime += m.getTotalJobsExecutionTime();
totalExecTasks += m.getTotalExecutedTasks();
@@ -651,6 +657,20 @@ public class ClusterMetricsSnapshot implements ClusterMetrics {
}
/** {@inheritDoc} */
+ @Override public long getTotalJobsExecutionTime() {
+ return totalJobsExecTime;
+ }
+
+ /**
+ * Sets total jobs execution time.
+ *
+ * @param totalJobsExecTime Total jobs execution time.
+ */
+ public void setTotalJobsExecutionTime(long totalJobsExecTime) {
+ this.totalJobsExecTime = totalJobsExecTime;
+ }
+
+ /** {@inheritDoc} */
@Override public int getTotalCancelledJobs() {
return totalCancelledJobs;
}
@@ -1325,6 +1345,7 @@ public class ClusterMetricsSnapshot implements ClusterMetrics {
buf.putLong(metrics.getReceivedBytesCount());
buf.putInt(metrics.getOutboundMessagesQueueSize());
buf.putInt(metrics.getTotalNodes());
+ buf.putLong(metrics.getTotalJobsExecutionTime());
assert !buf.hasRemaining() : "Invalid metrics size [expected=" + METRICS_SIZE + ", actual="
+ (buf.position() - off) + ']';
@@ -1342,7 +1363,9 @@ public class ClusterMetricsSnapshot implements ClusterMetrics {
public static ClusterMetrics deserialize(byte[] data, int off) {
ClusterMetricsSnapshot metrics = new ClusterMetricsSnapshot();
- ByteBuffer buf = ByteBuffer.wrap(data, off, METRICS_SIZE);
+ int bufSize = min(METRICS_SIZE, data.length - off);
+
+ ByteBuffer buf = ByteBuffer.wrap(data, off, bufSize);
metrics.setLastUpdateTime(U.currentTimeMillis());
@@ -1399,6 +1422,12 @@ public class ClusterMetricsSnapshot implements ClusterMetrics {
metrics.setOutboundMessagesQueueSize(buf.getInt());
metrics.setTotalNodes(buf.getInt());
+ // For compatibility with metrics serialized by old ignite versions.
+ if (buf.remaining() >= 8)
+ metrics.setTotalJobsExecutionTime(buf.getLong());
+ else
+ metrics.setTotalJobsExecutionTime(0);
+
return metrics;
}
@@ -1406,4 +1435,4 @@ public class ClusterMetricsSnapshot implements ClusterMetrics {
@Override public String toString() {
return S.toString(ClusterMetricsSnapshot.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0295518b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index bde7be2..d3793ae 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -182,7 +182,7 @@ import org.apache.ignite.lifecycle.LifecycleBean;
import org.apache.ignite.lifecycle.LifecycleEventType;
import org.apache.ignite.marshaller.MarshallerExclusions;
import org.apache.ignite.marshaller.jdk.JdkMarshaller;
-import org.apache.ignite.mxbean.ClusterLocalNodeMetricsMXBean;
+import org.apache.ignite.mxbean.ClusterMetricsMXBean;
import org.apache.ignite.mxbean.IgniteMXBean;
import org.apache.ignite.mxbean.StripedExecutorMXBean;
import org.apache.ignite.mxbean.ThreadPoolMXBean;
@@ -303,6 +303,10 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
/** */
@GridToStringExclude
+ private ObjectName allNodesMBean;
+
+ /** */
+ @GridToStringExclude
private ObjectName pubExecSvcMBean;
/** */
@@ -1079,7 +1083,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
// Register MBeans.
registerKernalMBean();
- registerLocalNodeMBean();
+ registerClusterMetricsMBeans();
registerExecutorMBeans(execSvc, sysExecSvc, p2pExecSvc, mgmtExecSvc, restExecSvc, qryExecSvc,
schemaExecSvc);
@@ -1696,32 +1700,43 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
}
}
- /** @throws IgniteCheckedException If registration failed. */
- private void registerLocalNodeMBean() throws IgniteCheckedException {
+ /**
+ * Register instance of ClusterMetricsMBean.
+ *
+ * @param mbean MBean instance to register.
+ * @throws IgniteCheckedException If registration failed.
+ */
+ private ObjectName registerClusterMetricsMBean(ClusterMetricsMXBean mbean) throws IgniteCheckedException {
if(U.IGNITE_MBEANS_DISABLED)
- return;
+ return null;
- ClusterLocalNodeMetricsMXBean mbean = new ClusterLocalNodeMetricsMXBeanImpl(ctx.discovery().localNode());
+ ObjectName objectName;
try {
- locNodeMBean = U.registerMBean(
+ objectName = U.registerMBean(
cfg.getMBeanServer(),
cfg.getIgniteInstanceName(),
"Kernal",
mbean.getClass().getSimpleName(),
mbean,
- ClusterLocalNodeMetricsMXBean.class);
+ ClusterMetricsMXBean.class);
if (log.isDebugEnabled())
- log.debug("Registered local node MBean: " + locNodeMBean);
+ log.debug("Registered MBean: " + objectName);
+
+ return objectName;
}
catch (JMException e) {
- locNodeMBean = null;
-
- throw new IgniteCheckedException("Failed to register local node MBean.", e);
+ throw new IgniteCheckedException("Failed to register MBean: " + mbean.getClass().getSimpleName(), e);
}
}
+ /** @throws IgniteCheckedException If registration failed. */
+ private void registerClusterMetricsMBeans() throws IgniteCheckedException {
+ locNodeMBean = registerClusterMetricsMBean(new ClusterLocalNodeMetricsMXBeanImpl(ctx.discovery().localNode()));
+ allNodesMBean = registerClusterMetricsMBean(new ClusterMetricsMXBeanImpl(cluster()));
+ }
+
/**
* @param execSvc Public executor service.
* @param sysExecSvc System executor service.
@@ -2271,6 +2286,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
unregisterMBean(p2PExecSvcMBean) &
unregisterMBean(kernalMBean) &
unregisterMBean(locNodeMBean) &
+ unregisterMBean(allNodesMBean) &
unregisterMBean(restExecSvcMBean) &
unregisterMBean(qryExecSvcMBean) &
unregisterMBean(schemaExecSvcMBean) &
http://git-wip-us.apache.org/repos/asf/ignite/blob/0295518b/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 a6737dc..3c7df92 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
@@ -1065,6 +1065,7 @@ public class GridDiscoveryManager extends GridManagerAdapter<DiscoverySpi> {
nm.setTotalRejectedJobs(jm.getTotalRejectedJobs());
nm.setTotalCancelledJobs(jm.getTotalCancelledJobs());
nm.setTotalExecutedJobs(jm.getTotalExecutedJobs());
+ nm.setTotalJobsExecutionTime(jm.getTotalJobsExecutionTime());
nm.setMaximumJobWaitTime(jm.getMaximumJobWaitTime());
nm.setCurrentJobWaitTime(jm.getCurrentJobWaitTime());
nm.setAverageJobWaitTime(jm.getAverageJobWaitTime());
http://git-wip-us.apache.org/repos/asf/ignite/blob/0295518b/modules/core/src/main/java/org/apache/ignite/internal/processors/jobmetrics/GridJobMetrics.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/jobmetrics/GridJobMetrics.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/jobmetrics/GridJobMetrics.java
index 2ad8ca7..1700ad9 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/jobmetrics/GridJobMetrics.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/jobmetrics/GridJobMetrics.java
@@ -87,6 +87,9 @@ public class GridJobMetrics {
private double avgJobExecTime;
/** */
+ private long totalJobExecTime;
+
+ /** */
private long totalIdleTime;
/** */
@@ -247,6 +250,15 @@ public class GridJobMetrics {
}
/**
+ * Gets total jobs execution time.
+ *
+ * @return Total jobs execution time.
+ */
+ public long getTotalJobsExecutionTime() {
+ return totalJobExecTime;
+ }
+
+ /**
* Gets total idle time.
*
* @return Total idle time.
@@ -421,6 +433,13 @@ public class GridJobMetrics {
}
/**
+ * @param totalJobExecTime The totalJobExecTime to set.
+ */
+ public void setTotalJobsExecutionTime(long totalJobExecTime) {
+ this.totalJobExecTime = totalJobExecTime;
+ }
+
+ /**
* @param totalIdleTime The totalIdleTime to set.
*/
void setTotalIdleTime(long totalIdleTime) {
@@ -445,4 +464,4 @@ public class GridJobMetrics {
@Override public String toString() {
return S.toString(GridJobMetrics.class, this);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0295518b/modules/core/src/main/java/org/apache/ignite/internal/processors/jobmetrics/GridJobMetricsProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/jobmetrics/GridJobMetricsProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/jobmetrics/GridJobMetricsProcessor.java
index c40cfda..5422310 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/jobmetrics/GridJobMetricsProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/jobmetrics/GridJobMetricsProcessor.java
@@ -238,6 +238,9 @@ public class GridJobMetricsProcessor extends GridProcessorAdapter {
/** */
private int totalRejectedJobs;
+ /** */
+ private long totalExecTime;
+
/**
* @param size Size (should be power of 2).
*/
@@ -258,6 +261,7 @@ public class GridJobMetricsProcessor extends GridProcessorAdapter {
totalFinishedJobs += s.getFinishedJobs();
totalCancelledJobs += s.getCancelJobs();
totalRejectedJobs += s.getRejectJobs();
+ totalExecTime += s.getExecutionTime();
}
/**
@@ -277,7 +281,7 @@ public class GridJobMetricsProcessor extends GridProcessorAdapter {
rdc.collect(s);
}
- rdc.collectTotals(totalFinishedJobs, totalCancelledJobs, totalRejectedJobs);
+ rdc.collectTotals(totalFinishedJobs, totalCancelledJobs, totalRejectedJobs, totalExecTime);
}
}
@@ -371,11 +375,12 @@ public class GridJobMetricsProcessor extends GridProcessorAdapter {
* @param totalCancelledJobs Cancelled jobs.
* @param totalRejectedJobs Rejected jobs.
*/
- void collectTotals(int totalFinishedJobs, int totalCancelledJobs, int totalRejectedJobs) {
+ void collectTotals(int totalFinishedJobs, int totalCancelledJobs, int totalRejectedJobs, long totalExecTime) {
// Totals.
m.setTotalExecutedJobs(m.getTotalExecutedJobs() + totalFinishedJobs);
m.setTotalCancelledJobs(m.getTotalCancelledJobs() + totalCancelledJobs);
m.setTotalRejectedJobs(m.getTotalRejectedJobs() + totalRejectedJobs);
+ m.setTotalJobsExecutionTime(m.getTotalJobsExecutionTime() + totalExecTime);
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/0295518b/modules/core/src/main/java/org/apache/ignite/mxbean/ClusterLocalNodeMetricsMXBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/mxbean/ClusterLocalNodeMetricsMXBean.java b/modules/core/src/main/java/org/apache/ignite/mxbean/ClusterLocalNodeMetricsMXBean.java
deleted file mode 100644
index ea3a57a..0000000
--- a/modules/core/src/main/java/org/apache/ignite/mxbean/ClusterLocalNodeMetricsMXBean.java
+++ /dev/null
@@ -1,253 +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.mxbean;
-
-import org.apache.ignite.cluster.ClusterMetrics;
-
-/**
- * MBean for local node metrics.
- */
-@MXBeanDescription("MBean that provides access to all local node metrics.")
-public interface ClusterLocalNodeMetricsMXBean extends ClusterMetrics {
- /** {@inheritDoc} */
- @MXBeanDescription("Last update time of this node metrics.")
- public long getLastUpdateTime();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Maximum number of jobs that ever ran concurrently on this node.")
- public int getMaximumActiveJobs();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Number of currently active jobs concurrently executing on the node.")
- public int getCurrentActiveJobs();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Average number of active jobs concurrently executing on the node.")
- public float getAverageActiveJobs();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Maximum number of waiting jobs this node had.")
- public int getMaximumWaitingJobs();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Number of queued jobs currently waiting to be executed.")
- public int getCurrentWaitingJobs();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Average number of waiting jobs this node had queued.")
- public float getAverageWaitingJobs();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Maximum number of jobs rejected at once during a single collision resolution operation.")
- public int getMaximumRejectedJobs();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Number of jobs rejected after more recent collision resolution operation.")
- public int getCurrentRejectedJobs();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Average number of jobs this node rejects during collision resolution operations.")
- public float getAverageRejectedJobs();
-
- /** {@inheritDoc} */
- @MXBeanDescription(
- "Total number of jobs this node rejects during collision resolution operations since node startup.")
- public int getTotalRejectedJobs();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Maximum number of cancelled jobs this node ever had running concurrently.")
- public int getMaximumCancelledJobs();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Number of cancelled jobs that are still running.")
- public int getCurrentCancelledJobs();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Average number of cancelled jobs this node ever had running concurrently.")
- public float getAverageCancelledJobs();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Total number of cancelled jobs since node startup.")
- public int getTotalCancelledJobs();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Total number of jobs handled by the node.")
- public int getTotalExecutedJobs();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Maximum time a job ever spent waiting in a queue to be executed.")
- public long getMaximumJobWaitTime();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Current wait time of oldest job.")
- public long getCurrentJobWaitTime();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Average time jobs spend waiting in the queue to be executed.")
- public double getAverageJobWaitTime();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Time it took to execute the longest job on the node.")
- public long getMaximumJobExecuteTime();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Longest time a current job has been executing for.")
- public long getCurrentJobExecuteTime();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Average time a job takes to execute on the node.")
- public double getAverageJobExecuteTime();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Total number of tasks handled by the node.")
- public int getTotalExecutedTasks();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Total time this node spent executing jobs.")
- public long getTotalBusyTime();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Total time this node spent idling (not executing any jobs).")
- public long getTotalIdleTime();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Time this node spend idling since executing last job.")
- public long getCurrentIdleTime();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Percentage of time this node is busy executing jobs vs. idling.")
- public float getBusyTimePercentage();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Percentage of time this node is idling vs. executing jobs.")
- public float getIdleTimePercentage();
-
- /** {@inheritDoc} */
- @MXBeanDescription("The number of CPUs available to the Java Virtual Machine.")
- public int getTotalCpus();
-
- /** {@inheritDoc} */
- @MXBeanDescription("The system load average; or a negative value if not available.")
- public double getCurrentCpuLoad();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Average of CPU load values over all metrics kept in the history.")
- public double getAverageCpuLoad();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Average time spent in CG since the last update.")
- public double getCurrentGcCpuLoad();
-
- /** {@inheritDoc} */
- @MXBeanDescription("The initial size of memory in bytes; -1 if undefined.")
- public long getHeapMemoryInitialized();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Current heap size that is used for object allocation.")
- public long getHeapMemoryUsed();
-
- /** {@inheritDoc} */
- @MXBeanDescription("The amount of committed memory in bytes.")
- public long getHeapMemoryCommitted();
-
- /** {@inheritDoc} */
- @MXBeanDescription("The maximum amount of memory in bytes; -1 if undefined.")
- public long getHeapMemoryMaximum();
-
- /** {@inheritDoc} */
- @MXBeanDescription("The total amount of memory in bytes; -1 if undefined.")
- public long getHeapMemoryTotal();
-
- /** {@inheritDoc} */
- @MXBeanDescription("The initial size of memory in bytes; -1 if undefined.")
- public long getNonHeapMemoryInitialized();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Current non-heap memory size that is used by Java VM.")
- public long getNonHeapMemoryUsed();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Amount of non-heap memory in bytes that is committed for the JVM to use.")
- public long getNonHeapMemoryCommitted();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Maximum amount of non-heap memory in bytes that can " +
- "be used for memory management. -1 if undefined.")
- public long getNonHeapMemoryMaximum();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Total amount of non-heap memory in bytes that can " +
- "be used for memory management. -1 if undefined.")
- public long getNonHeapMemoryTotal();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Uptime of the JVM in milliseconds.")
- public long getUpTime();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Start time of the JVM in milliseconds.")
- public long getStartTime();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Current number of live threads.")
- public int getCurrentThreadCount();
-
- /** {@inheritDoc} */
- @MXBeanDescription("The peak live thread count.")
- public int getMaximumThreadCount();
-
- /** {@inheritDoc} */
- @MXBeanDescription("The total number of threads started.")
- public long getTotalStartedThreadCount();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Current number of live daemon threads.")
- public int getCurrentDaemonThreadCount();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Last data version.")
- public long getLastDataVersion();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Sent messages count.")
- public int getSentMessagesCount();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Sent bytes count.")
- public long getSentBytesCount();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Received messages count.")
- public int getReceivedMessagesCount();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Received bytes count.")
- public long getReceivedBytesCount();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Outbound messages queue size.")
- public int getOutboundMessagesQueueSize();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Start time of the grid node in milliseconds.")
- public long getNodeStartTime();
-
- /** {@inheritDoc} */
- @MXBeanDescription("Total number of nodes.")
- public int getTotalNodes();
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/0295518b/modules/core/src/main/java/org/apache/ignite/mxbean/ClusterMetricsMXBean.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/mxbean/ClusterMetricsMXBean.java b/modules/core/src/main/java/org/apache/ignite/mxbean/ClusterMetricsMXBean.java
new file mode 100644
index 0000000..21c05db
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/mxbean/ClusterMetricsMXBean.java
@@ -0,0 +1,257 @@
+/*
+ * 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.mxbean;
+
+import org.apache.ignite.cluster.ClusterMetrics;
+
+/**
+ * MBean for local node metrics.
+ */
+@MXBeanDescription("MBean that provides access to all local node metrics.")
+public interface ClusterMetricsMXBean extends ClusterMetrics {
+ /** {@inheritDoc} */
+ @MXBeanDescription("Last update time of this node metrics.")
+ public long getLastUpdateTime();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Maximum number of jobs that ever ran concurrently on this node.")
+ public int getMaximumActiveJobs();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Number of currently active jobs concurrently executing on the node.")
+ public int getCurrentActiveJobs();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Average number of active jobs concurrently executing on the node.")
+ public float getAverageActiveJobs();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Maximum number of waiting jobs this node had.")
+ public int getMaximumWaitingJobs();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Number of queued jobs currently waiting to be executed.")
+ public int getCurrentWaitingJobs();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Average number of waiting jobs this node had queued.")
+ public float getAverageWaitingJobs();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Maximum number of jobs rejected at once during a single collision resolution operation.")
+ public int getMaximumRejectedJobs();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Number of jobs rejected after more recent collision resolution operation.")
+ public int getCurrentRejectedJobs();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Average number of jobs this node rejects during collision resolution operations.")
+ public float getAverageRejectedJobs();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription(
+ "Total number of jobs this node rejects during collision resolution operations since node startup.")
+ public int getTotalRejectedJobs();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Maximum number of cancelled jobs this node ever had running concurrently.")
+ public int getMaximumCancelledJobs();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Number of cancelled jobs that are still running.")
+ public int getCurrentCancelledJobs();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Average number of cancelled jobs this node ever had running concurrently.")
+ public float getAverageCancelledJobs();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Total number of cancelled jobs since node startup.")
+ public int getTotalCancelledJobs();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Total number of jobs handled by the node.")
+ public int getTotalExecutedJobs();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Total time all finished jobs takes to execute on the node.")
+ public long getTotalJobsExecutionTime();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Maximum time a job ever spent waiting in a queue to be executed.")
+ public long getMaximumJobWaitTime();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Current wait time of oldest job.")
+ public long getCurrentJobWaitTime();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Average time jobs spend waiting in the queue to be executed.")
+ public double getAverageJobWaitTime();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Time it took to execute the longest job on the node.")
+ public long getMaximumJobExecuteTime();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Longest time a current job has been executing for.")
+ public long getCurrentJobExecuteTime();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Average time a job takes to execute on the node.")
+ public double getAverageJobExecuteTime();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Total number of tasks handled by the node.")
+ public int getTotalExecutedTasks();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Total time this node spent executing jobs.")
+ public long getTotalBusyTime();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Total time this node spent idling (not executing any jobs).")
+ public long getTotalIdleTime();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Time this node spend idling since executing last job.")
+ public long getCurrentIdleTime();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Percentage of time this node is busy executing jobs vs. idling.")
+ public float getBusyTimePercentage();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Percentage of time this node is idling vs. executing jobs.")
+ public float getIdleTimePercentage();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("The number of CPUs available to the Java Virtual Machine.")
+ public int getTotalCpus();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("The system load average; or a negative value if not available.")
+ public double getCurrentCpuLoad();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Average of CPU load values over all metrics kept in the history.")
+ public double getAverageCpuLoad();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Average time spent in CG since the last update.")
+ public double getCurrentGcCpuLoad();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("The initial size of memory in bytes; -1 if undefined.")
+ public long getHeapMemoryInitialized();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Current heap size that is used for object allocation.")
+ public long getHeapMemoryUsed();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("The amount of committed memory in bytes.")
+ public long getHeapMemoryCommitted();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("The maximum amount of memory in bytes; -1 if undefined.")
+ public long getHeapMemoryMaximum();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("The total amount of memory in bytes; -1 if undefined.")
+ public long getHeapMemoryTotal();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("The initial size of memory in bytes; -1 if undefined.")
+ public long getNonHeapMemoryInitialized();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Current non-heap memory size that is used by Java VM.")
+ public long getNonHeapMemoryUsed();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Amount of non-heap memory in bytes that is committed for the JVM to use.")
+ public long getNonHeapMemoryCommitted();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Maximum amount of non-heap memory in bytes that can " +
+ "be used for memory management. -1 if undefined.")
+ public long getNonHeapMemoryMaximum();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Total amount of non-heap memory in bytes that can " +
+ "be used for memory management. -1 if undefined.")
+ public long getNonHeapMemoryTotal();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Uptime of the JVM in milliseconds.")
+ public long getUpTime();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Start time of the JVM in milliseconds.")
+ public long getStartTime();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Current number of live threads.")
+ public int getCurrentThreadCount();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("The peak live thread count.")
+ public int getMaximumThreadCount();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("The total number of threads started.")
+ public long getTotalStartedThreadCount();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Current number of live daemon threads.")
+ public int getCurrentDaemonThreadCount();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Last data version.")
+ public long getLastDataVersion();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Sent messages count.")
+ public int getSentMessagesCount();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Sent bytes count.")
+ public long getSentBytesCount();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Received messages count.")
+ public int getReceivedMessagesCount();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Received bytes count.")
+ public long getReceivedBytesCount();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Outbound messages queue size.")
+ public int getOutboundMessagesQueueSize();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Start time of the grid node in milliseconds.")
+ public long getNodeStartTime();
+
+ /** {@inheritDoc} */
+ @MXBeanDescription("Total number of nodes.")
+ public int getTotalNodes();
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0295518b/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java
index 1352c37..2e4f248 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/ClusterNodeMetricsSelfTest.java
@@ -218,6 +218,7 @@ public class ClusterNodeMetricsSelfTest extends GridCommonAbstractTest {
assert metrics.getTotalExecutedJobs() == 1;
assert metrics.getTotalRejectedJobs() == 0;
assert metrics.getTotalExecutedTasks() == 1;
+ assert metrics.getTotalJobsExecutionTime() > 0;
assertTrue("MaximumJobExecuteTime=" + metrics.getMaximumJobExecuteTime() +
" is less than AverageJobExecuteTime=" + metrics.getAverageJobExecuteTime(),
@@ -274,6 +275,7 @@ public class ClusterNodeMetricsSelfTest extends GridCommonAbstractTest {
assert metrics.getTotalExecutedJobs() == 0;
assert metrics.getTotalRejectedJobs() == 0;
assert metrics.getTotalExecutedTasks() == 0;
+ assert metrics.getTotalJobsExecutionTime() == 0;
assertTrue("MaximumJobExecuteTime=" + metrics.getMaximumJobExecuteTime() +
" is less than AverageJobExecuteTime=" + metrics.getAverageJobExecuteTime(),
@@ -375,4 +377,4 @@ public class ClusterNodeMetricsSelfTest extends GridCommonAbstractTest {
private static class TestInternalTask extends GridTestTask {
// No-op.
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/0295518b/modules/core/src/test/java/org/apache/ignite/spi/discovery/ClusterMetricsSnapshotSerializeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/discovery/ClusterMetricsSnapshotSerializeSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/discovery/ClusterMetricsSnapshotSerializeSelfTest.java
index a1e36a3..25de2c7 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/discovery/ClusterMetricsSnapshotSerializeSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/discovery/ClusterMetricsSnapshotSerializeSelfTest.java
@@ -143,6 +143,8 @@ public class ClusterMetricsSnapshotSerializeSelfTest extends GridCommonAbstractT
metrics.setOutboundMessagesQueueSize(46);
metrics.setNonHeapMemoryTotal(47);
metrics.setHeapMemoryTotal(48);
+ metrics.setTotalNodes(49);
+ metrics.setTotalJobsExecutionTime(50);
return metrics;
}
@@ -198,6 +200,8 @@ public class ClusterMetricsSnapshotSerializeSelfTest extends GridCommonAbstractT
obj.getReceivedBytesCount() == obj1.getReceivedBytesCount() &&
obj.getOutboundMessagesQueueSize() == obj1.getOutboundMessagesQueueSize() &&
obj.getNonHeapMemoryTotal() == obj1.getNonHeapMemoryTotal() &&
- obj.getHeapMemoryTotal() == obj1.getHeapMemoryTotal();
+ obj.getHeapMemoryTotal() == obj1.getHeapMemoryTotal() &&
+ obj.getTotalNodes() == obj1.getTotalNodes() &&
+ obj.getTotalJobsExecutionTime() == obj1.getTotalJobsExecutionTime();
}
-}
\ No newline at end of file
+}
[13/15] ignite git commit: ignite-6973 Fixed cache deploymentId
generation for cache started on activation
Posted by sb...@apache.org.
ignite-6973 Fixed cache deploymentId generation for cache started on activation
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/39cc9b7d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/39cc9b7d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/39cc9b7d
Branch: refs/heads/ignite-zk
Commit: 39cc9b7d469d20151d1f3e97b9212993eba61894
Parents: 99bbb53
Author: sboikov <sb...@gridgain.com>
Authored: Wed Nov 22 13:18:31 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Wed Nov 22 13:18:31 2017 +0300
----------------------------------------------------------------------
.../processors/cache/ClusterCachesInfo.java | 4 +-
...gnitePdsCacheAssignmentNodeRestartsTest.java | 257 +++++++++++++++++++
.../testsuites/IgniteCacheTestSuite6.java | 3 +-
3 files changed, 261 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/39cc9b7d/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 69f1a27..2b5ebf9 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
@@ -1214,7 +1214,7 @@ class ClusterCachesInfo {
if (storedCfgs != null) {
List<DynamicCacheChangeRequest> reqs = new ArrayList<>();
- IgniteUuid deplymentId = IgniteUuid.fromUuid(msg.requestId());
+ IgniteUuid deploymentId = msg.id();
for (StoredCacheData storedCfg : storedCfgs) {
CacheConfiguration ccfg = storedCfg.config();
@@ -1224,7 +1224,7 @@ class ClusterCachesInfo {
ccfg.getName(),
msg.initiatorNodeId());
- req.deploymentId(deplymentId);
+ req.deploymentId(deploymentId);
req.startCacheConfiguration(ccfg);
req.cacheType(ctx.cache().cacheType(ccfg.getName()));
req.schema(new QuerySchema(storedCfg.queryEntities()));
http://git-wip-us.apache.org/repos/asf/ignite/blob/39cc9b7d/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheAssignmentNodeRestartsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheAssignmentNodeRestartsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheAssignmentNodeRestartsTest.java
new file mode 100644
index 0000000..807f532
--- /dev/null
+++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/persistence/IgnitePdsCacheAssignmentNodeRestartsTest.java
@@ -0,0 +1,257 @@
+/*
+ * 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;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.Callable;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheMode;
+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.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.IgniteKernal;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.processors.cache.CacheGroupDescriptor;
+import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
+import org.apache.ignite.internal.util.typedef.G;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteUuid;
+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.GridTestUtils;
+import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
+
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheMode.PARTITIONED;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
+import static org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager.IGNITE_PDS_CHECKPOINT_TEST_SKIP_SYNC;
+
+/**
+ * The test validates assignment after nodes restart with enabled persistence.
+ */
+public class IgnitePdsCacheAssignmentNodeRestartsTest extends GridCommonAbstractTest {
+ /** */
+ private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
+
+ /** {@inheritDoc} */
+ @Override protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
+ IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
+
+ cfg.setMemoryConfiguration(new MemoryConfiguration().setDefaultMemoryPolicyName("d").
+ setPageSize(1024).setMemoryPolicies(new MemoryPolicyConfiguration().setName("d").
+ setInitialSize(50 * 1024 * 1024L).setMaxSize(50 * 1024 * 1024)));
+
+ cfg.setPersistentStoreConfiguration(new PersistentStoreConfiguration().setWalMode(WALMode.LOG_ONLY));
+
+ ((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(ipFinder);
+
+ return cfg;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void beforeTest() throws Exception {
+ super.beforeTest();
+
+ deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void afterTest() throws Exception {
+ stopAllGrids();
+
+ deleteRecursively(U.resolveWorkDirectory(U.defaultWorkDirectory(), "db", false));
+
+ super.afterTest();
+ }
+
+ /**
+ * @param name Name.
+ * @param atomicityMode Atomicity mode.
+ * @param cacheMode Cache mode.
+ * @param backups Backups.
+ * @param grp Group.
+ * @return Cache configuration.
+ */
+ private CacheConfiguration cacheConfiguration(String name,
+ CacheAtomicityMode atomicityMode,
+ CacheMode cacheMode,
+ int backups,
+ String grp) {
+ CacheConfiguration ccfg = new CacheConfiguration(name);
+
+ ccfg.setAtomicityMode(atomicityMode);
+ ccfg.setWriteSynchronizationMode(FULL_SYNC);
+ ccfg.setCacheMode(cacheMode);
+ ccfg.setGroupName(grp);
+
+ ccfg.setAffinity(new RendezvousAffinityFunction(false, 128));
+
+ if (cacheMode == PARTITIONED)
+ ccfg.setBackups(backups);
+
+ return ccfg;
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testAssignmentAfterRestarts() throws Exception {
+ try {
+ System.setProperty(IGNITE_PDS_CHECKPOINT_TEST_SKIP_SYNC, "true");
+
+ final int gridsCnt = 5;
+
+ final int groupsCnt = 2;
+
+ final IgniteEx node = (IgniteEx) startGridsMultiThreaded(gridsCnt);
+
+ final List<CacheConfiguration> cfgs = Arrays.asList(
+ cacheConfiguration("g1c1", TRANSACTIONAL, PARTITIONED, gridsCnt, "testGrp1"),
+ cacheConfiguration("g1c2", TRANSACTIONAL, PARTITIONED, gridsCnt, "testGrp1"),
+ cacheConfiguration("g2c1", TRANSACTIONAL, PARTITIONED, gridsCnt, "testGrp2"),
+ cacheConfiguration("g2c2", TRANSACTIONAL, PARTITIONED, gridsCnt, "testGrp2"));
+
+ node.getOrCreateCaches(cfgs);
+
+ validateDepIds(groupsCnt);
+
+ stopAllGrids();
+
+ IgniteEx node2 = (IgniteEx) startGridsMultiThreaded(gridsCnt);
+
+ validateDepIds(groupsCnt); // Deployment ids must be the same on all nodes.
+
+ final int restartIdxFrom = 2;
+
+ final AtomicInteger idx = new AtomicInteger(restartIdxFrom);
+
+ IgniteInternalFuture fut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ int nodeIdx = idx.getAndIncrement();
+
+ stopGrid(nodeIdx);
+
+ return null;
+ }
+ }, gridsCnt - restartIdxFrom, "stop-node");
+
+ fut.get();
+
+ awaitPartitionMapExchange();
+
+ checkAffinity();
+
+ idx.set(restartIdxFrom);
+
+ fut = GridTestUtils.runMultiThreadedAsync(new Callable<Void>() {
+ @Override public Void call() throws Exception {
+ int nodeIdx = idx.getAndIncrement();
+
+ startGrid(nodeIdx);
+
+ return null;
+ }
+ }, gridsCnt - restartIdxFrom, "start-node");
+
+ fut.get();
+
+ awaitPartitionMapExchange();
+
+ AffinityTopologyVersion topVer = node2.context().cache().context().exchange().readyAffinityVersion();
+
+ log.info("Using version: " + topVer);
+
+ checkAffinity();
+ }
+ finally {
+ System.clearProperty(IGNITE_PDS_CHECKPOINT_TEST_SKIP_SYNC);
+ }
+ }
+
+ /**
+ * @param grpCnt Group count.
+ */
+ private void validateDepIds(int grpCnt) {
+ Map<Integer, IgniteUuid> depIds = new HashMap<>();
+
+ for (Ignite ignite : G.allGrids()) {
+ final Map<Integer, CacheGroupDescriptor> descMap = ((IgniteEx) ignite).context().cache().cacheGroupDescriptors();
+
+ for (Map.Entry<Integer, CacheGroupDescriptor> entry : descMap.entrySet()) {
+ final IgniteUuid u = entry.getValue().deploymentId();
+
+ final IgniteUuid u0 = depIds.get(entry.getKey());
+
+ if (u0 == null)
+ depIds.put(entry.getKey(), u);
+ else
+ assertEquals("Descriptors do not match", u0, u);
+ }
+ }
+
+ assertEquals(grpCnt + 1, depIds.size());
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ private void checkAffinity() throws Exception {
+ List<Ignite> nodes = G.allGrids();
+
+ ClusterNode crdNode = null;
+
+ for (Ignite node : nodes) {
+ ClusterNode locNode = node.cluster().localNode();
+
+ if (crdNode == null || locNode.order() < crdNode.order())
+ crdNode = locNode;
+ }
+
+ AffinityTopologyVersion topVer = ((IgniteKernal) grid(crdNode)).
+ context().cache().context().exchange().readyAffinityVersion();
+
+ Map<String, List<List<ClusterNode>>> affMap = new HashMap<>();
+
+ for (Ignite node : nodes) {
+ IgniteKernal node0 = (IgniteKernal) node;
+
+ for (IgniteInternalCache cache : node0.context().cache().caches()) {
+ List<List<ClusterNode>> aff = affMap.get(cache.name());
+ List<List<ClusterNode>> aff0 = cache.context().affinity().assignments(topVer);
+
+ if (aff != null)
+ assertEquals(aff, aff0);
+ else
+ affMap.put(cache.name(), aff0);
+ }
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/39cc9b7d/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite6.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite6.java b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite6.java
index 8a2d6a0..8ad2e38 100644
--- a/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite6.java
+++ b/modules/core/src/test/java/org/apache/ignite/testsuites/IgniteCacheTestSuite6.java
@@ -18,7 +18,6 @@
package org.apache.ignite.testsuites;
import junit.framework.TestSuite;
-import org.apache.ignite.internal.processors.cache.IgniteOutOfMemoryPropagationTest;
import org.apache.ignite.internal.processors.cache.distributed.CacheExchangeMergeTest;
import org.apache.ignite.internal.processors.cache.distributed.CachePartitionStateTest;
import org.apache.ignite.internal.processors.cache.distributed.GridCachePartitionEvictionDuringReadThroughSelfTest;
@@ -26,6 +25,7 @@ import org.apache.ignite.internal.processors.cache.distributed.IgniteCacheThread
import org.apache.ignite.internal.processors.cache.distributed.IgniteOptimisticTxSuspendResumeMultiServerTest;
import org.apache.ignite.internal.processors.cache.distributed.IgniteOptimisticTxSuspendResumeTest;
import org.apache.ignite.internal.processors.cache.distributed.IgnitePessimisticTxSuspendResumeTest;
+import org.apache.ignite.internal.processors.cache.persistence.IgnitePdsCacheAssignmentNodeRestartsTest;
import org.apache.ignite.internal.processors.cache.transactions.TxRollbackOnTimeoutNearCacheTest;
import org.apache.ignite.internal.processors.cache.transactions.TxRollbackOnTimeoutNoDeadlockDetectionTest;
import org.apache.ignite.internal.processors.cache.transactions.TxRollbackOnTimeoutTest;
@@ -55,6 +55,7 @@ public class IgniteCacheTestSuite6 extends TestSuite {
suite.addTestSuite(TxRollbackOnTimeoutNearCacheTest.class);
suite.addTestSuite(IgniteCacheThreadLocalTxTest.class);
+ suite.addTestSuite(IgnitePdsCacheAssignmentNodeRestartsTest.class);
// TODO enable this test after IGNITE-6753, now it takes too long
// suite.addTestSuite(IgniteOutOfMemoryPropagationTest.class);
[02/15] ignite git commit: IGNITE-6437: DataStructure can not be
obtained on client if it is created on server node
Posted by sb...@apache.org.
IGNITE-6437: DataStructure can not be obtained on client if it is created on server node
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ed4616e2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ed4616e2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ed4616e2
Branch: refs/heads/ignite-zk
Commit: ed4616e2d39b21c3ba5899a8eb112496dcd28ef5
Parents: 6508067
Author: Evgeny Stanilovskiy <es...@gridgain.com>
Authored: Tue Nov 21 13:12:21 2017 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Tue Nov 21 13:12:21 2017 +0300
----------------------------------------------------------------------
.../datastructures/DataStructuresProcessor.java | 18 ++-
.../IgniteClientReconnectCollectionsTest.java | 131 ++++++++-----------
2 files changed, 69 insertions(+), 80 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ed4616e2/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 33a2fd2..b26acdd 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
@@ -55,6 +55,7 @@ import org.apache.ignite.internal.cluster.ClusterTopologyServerNotFoundException
import org.apache.ignite.internal.managers.eventstorage.GridLocalEventListener;
import org.apache.ignite.internal.processors.GridProcessorAdapter;
import org.apache.ignite.internal.processors.cache.CacheType;
+import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
import org.apache.ignite.internal.processors.cache.GridCacheAdapter;
import org.apache.ignite.internal.processors.cache.GridCacheContext;
import org.apache.ignite.internal.processors.cache.GridCacheInternal;
@@ -952,6 +953,7 @@ public final class DataStructuresProcessor extends GridProcessorAdapter implemen
assert name != null;
assert type.isCollection() : type;
+ assert !create || cfg != null;
if (grpName == null) {
if (cfg != null && cfg.getGroupName() != null)
@@ -960,17 +962,23 @@ public final class DataStructuresProcessor extends GridProcessorAdapter implemen
grpName = DEFAULT_DS_GROUP_NAME;
}
- assert !create || cfg != null;
-
final String metaCacheName = ATOMICS_CACHE_NAME + "@" + grpName;
IgniteInternalCache<GridCacheInternalKey, AtomicDataStructureValue> metaCache0 = ctx.cache().cache(metaCacheName);
if (metaCache0 == null) {
- if (!create)
- return null;
+ CacheConfiguration ccfg = null;
+
+ if (!create) {
+ DynamicCacheDescriptor desc = ctx.cache().cacheDescriptor(metaCacheName);
+
+ if (desc == null)
+ return null;
+ }
+ else
+ ccfg = metaCacheConfiguration(cfg, metaCacheName, grpName);
- ctx.cache().dynamicStartCache(metaCacheConfiguration(cfg, metaCacheName, grpName),
+ ctx.cache().dynamicStartCache(ccfg,
metaCacheName,
null,
CacheType.DATA_STRUCTURES,
http://git-wip-us.apache.org/repos/asf/ignite/blob/ed4616e2/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
index 8ee669c..3f0e33d 100644
--- a/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/internal/IgniteClientReconnectCollectionsTest.java
@@ -38,6 +38,20 @@ import static org.apache.ignite.cache.CacheMode.PARTITIONED;
*
*/
public class IgniteClientReconnectCollectionsTest extends IgniteClientReconnectAbstractTest {
+ /** */
+ private static final CollectionConfiguration TX_CFGS = new CollectionConfiguration();
+
+ /** */
+ private static final CollectionConfiguration ATOMIC_CONF = new CollectionConfiguration();
+
+ static {
+ TX_CFGS.setCacheMode(PARTITIONED);
+ TX_CFGS.setAtomicityMode(TRANSACTIONAL);
+
+ ATOMIC_CONF.setCacheMode(PARTITIONED);
+ ATOMIC_CONF.setAtomicityMode(ATOMIC);
+ }
+
/** {@inheritDoc} */
@Override protected int serverCount() {
return 1;
@@ -52,17 +66,12 @@ public class IgniteClientReconnectCollectionsTest extends IgniteClientReconnectA
* @throws Exception If failed.
*/
public void testCollectionsReconnectClusterRestart() throws Exception {
- CollectionConfiguration colCfg = new CollectionConfiguration();
-
- colCfg.setCacheMode(PARTITIONED);
- colCfg.setAtomicityMode(TRANSACTIONAL);
-
Ignite client = grid(serverCount());
assertTrue(client.cluster().localNode().isClient());
- final IgniteQueue<Object> queue = client.queue("q", 0, colCfg);
- final IgniteSet<Object> set = client.set("s", colCfg);
+ final IgniteQueue<Object> queue = client.queue("q", 0, TX_CFGS);
+ final IgniteSet<Object> set = client.set("s", TX_CFGS);
Ignite srv = grid(0);
@@ -88,12 +97,16 @@ public class IgniteClientReconnectCollectionsTest extends IgniteClientReconnectA
}
}, IllegalStateException.class, null);
- try (IgniteQueue<Object> queue2 = client.queue("q", 0, colCfg)) {
+ try (IgniteQueue<Object> queue2 = client.queue("q", 0, TX_CFGS)) {
queue2.add(1);
+
+ assert queue2.size() == 1 : queue2.size();
}
- try (IgniteSet<Object> set2 = client.set("s", colCfg)) {
+ try (IgniteSet<Object> set2 = client.set("s", TX_CFGS)) {
set2.add(1);
+
+ assert set2.size() == 1 : set2.size();
}
}
@@ -101,114 +114,82 @@ public class IgniteClientReconnectCollectionsTest extends IgniteClientReconnectA
* @throws Exception If failed.
*/
public void testQueueReconnect() throws Exception {
- CollectionConfiguration colCfg = new CollectionConfiguration();
-
- colCfg.setCacheMode(PARTITIONED);
- colCfg.setAtomicityMode(TRANSACTIONAL);
+ queueReconnect(TX_CFGS);
- queueReconnect(colCfg);
-
- colCfg = new CollectionConfiguration();
-
- colCfg.setCacheMode(PARTITIONED);
- colCfg.setAtomicityMode(ATOMIC);
-
- queueReconnect(colCfg);
+ queueReconnect(ATOMIC_CONF);
}
/**
* @throws Exception If failed.
*/
public void testQueueReconnectRemoved() throws Exception {
- CollectionConfiguration colCfg = new CollectionConfiguration();
-
- colCfg.setCacheMode(PARTITIONED);
- colCfg.setAtomicityMode(TRANSACTIONAL);
-
- queueReconnectRemoved(colCfg);
+ queueReconnectRemoved(TX_CFGS);
- colCfg = new CollectionConfiguration();
-
- colCfg.setCacheMode(PARTITIONED);
- colCfg.setAtomicityMode(ATOMIC);
-
- queueReconnectRemoved(colCfg);
+ queueReconnectRemoved(ATOMIC_CONF);
}
/**
* @throws Exception If failed.
*/
public void testQueueReconnectInProgress() throws Exception {
- CollectionConfiguration colCfg = new CollectionConfiguration();
-
- colCfg.setCacheMode(PARTITIONED);
- colCfg.setAtomicityMode(TRANSACTIONAL);
-
- queueReconnectInProgress(colCfg);
+ queueReconnectInProgress(TX_CFGS);
- colCfg = new CollectionConfiguration();
-
- colCfg.setCacheMode(PARTITIONED);
- colCfg.setAtomicityMode(ATOMIC);
-
- queueReconnectInProgress(colCfg);
+ queueReconnectInProgress(ATOMIC_CONF);
}
/**
* @throws Exception If failed.
*/
public void testSetReconnect() throws Exception {
- CollectionConfiguration colCfg = new CollectionConfiguration();
-
- colCfg.setCacheMode(PARTITIONED);
- colCfg.setAtomicityMode(TRANSACTIONAL);
-
- setReconnect(colCfg);
-
- colCfg = new CollectionConfiguration();
+ setReconnect(TX_CFGS);
- colCfg.setCacheMode(PARTITIONED);
- colCfg.setAtomicityMode(ATOMIC);
-
- setReconnect(colCfg);
+ setReconnect(ATOMIC_CONF);
}
/**
* @throws Exception If failed.
*/
public void testSetReconnectRemoved() throws Exception {
- CollectionConfiguration colCfg = new CollectionConfiguration();
+ setReconnectRemove(TX_CFGS);
- colCfg.setCacheMode(PARTITIONED);
- colCfg.setAtomicityMode(ATOMIC);
+ setReconnectRemove(ATOMIC_CONF);
+ }
- setReconnectRemove(colCfg);
+ /**
+ * @throws Exception If failed.
+ */
+ public void testSetReconnectInProgress() throws Exception {
+ setReconnectInProgress(TX_CFGS);
- colCfg = new CollectionConfiguration();
+ setReconnectInProgress(ATOMIC_CONF);
+ }
- colCfg.setCacheMode(PARTITIONED);
- colCfg.setAtomicityMode(TRANSACTIONAL);
+ /**
+ * @throws Exception If failed.
+ */
+ public void testServerReconnect() throws Exception {
+ serverNodeReconnect(TX_CFGS);
- setReconnectRemove(colCfg);
+ serverNodeReconnect(ATOMIC_CONF);
}
/**
+ * @param colCfg Collection configuration.
* @throws Exception If failed.
*/
- public void testSetReconnectInProgress() throws Exception {
- CollectionConfiguration colCfg = new CollectionConfiguration();
+ private void serverNodeReconnect(CollectionConfiguration colCfg) throws Exception {
+ final Ignite client = grid(serverCount());
- colCfg.setCacheMode(PARTITIONED);
- colCfg.setAtomicityMode(ATOMIC);
+ final Ignite srv = clientRouter(client);
- setReconnectInProgress(colCfg);
+ assertNotNull(srv.queue("q", 0, colCfg));
+ assertNotNull(srv.set("s", colCfg));
- colCfg = new CollectionConfiguration();
+ reconnectClientNode(client, srv, null);
- colCfg.setCacheMode(PARTITIONED);
- colCfg.setAtomicityMode(TRANSACTIONAL);
+ IgniteQueue<Object> q = client.queue("q", 0, null);
- setReconnectInProgress(colCfg);
+ assertNotNull(q);
}
/**
@@ -495,4 +476,4 @@ public class IgniteClientReconnectCollectionsTest extends IgniteClientReconnectA
assertEquals("1", clientQueue.poll());
}
-}
\ No newline at end of file
+}
[03/15] ignite git commit: IGNITE-4454. Added duration and node ID in
results header and 'Show query' modal.
Posted by sb...@apache.org.
IGNITE-4454. Added duration and node ID in results header and 'Show query' modal.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/31055f21
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/31055f21
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/31055f21
Branch: refs/heads/ignite-zk
Commit: 31055f21753ddc60aa656da131b83d8c29a5e71e
Parents: ed4616e
Author: alexdel <ve...@yandex.ru>
Authored: Tue Nov 21 17:20:11 2017 +0700
Committer: Alexey Kuznetsov <ak...@apache.org>
Committed: Tue Nov 21 17:20:11 2017 +0700
----------------------------------------------------------------------
.../frontend/app/modules/sql/sql.controller.js | 7 +++++--
.../web-console/frontend/views/sql/sql.tpl.pug | 22 +++++++++++++-------
.../frontend/views/templates/message.tpl.pug | 1 +
3 files changed, 20 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/31055f21/modules/web-console/frontend/app/modules/sql/sql.controller.js
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/modules/sql/sql.controller.js b/modules/web-console/frontend/app/modules/sql/sql.controller.js
index f5edb04..e97825c 100644
--- a/modules/web-console/frontend/app/modules/sql/sql.controller.js
+++ b/modules/web-console/frontend/app/modules/sql/sql.controller.js
@@ -1421,13 +1421,12 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
const enforceJoinOrder = !!paragraph.enforceJoinOrder;
const lazy = !!paragraph.lazy;
- paragraph.localQueryMode = local;
-
$scope.queryAvailable(paragraph) && _chooseNode(paragraph.cacheName, local)
.then((nid) => {
Notebook.save($scope.notebook)
.catch(Messages.showError);
+ paragraph.localQueryMode = local;
paragraph.prevQuery = paragraph.queryArgs ? paragraph.queryArgs.query : paragraph.query;
_showLoading(paragraph, true);
@@ -1841,6 +1840,10 @@ export default ['$rootScope', '$scope', '$http', '$q', '$timeout', '$interval',
scope.content = paragraph.queryArgs.query.split(/\r?\n/);
}
+ // Attach duration and selected node info
+ scope.meta = `Duration: ${$filter('duration')(paragraph.duration)}.`;
+ scope.meta += paragraph.localQueryMode ? ` Node ID8: ${_.id8(paragraph.resNodeId)}` : '';
+
// Show a basic modal from a controller
$modal({scope, templateUrl: messageTemplateUrl, show: true});
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/31055f21/modules/web-console/frontend/views/sql/sql.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/sql/sql.tpl.pug b/modules/web-console/frontend/views/sql/sql.tpl.pug
index b324622..44989e8 100644
--- a/modules/web-console/frontend/views/sql/sql.tpl.pug
+++ b/modules/web-console/frontend/views/sql/sql.tpl.pug
@@ -32,7 +32,7 @@ mixin result-toolbar
mixin chart-settings
.total.row
- .col-xs-4
+ .col-xs-5
.chart-settings-link(ng-show='paragraph.chart && paragraph.chartColumns.length > 0')
a(title='Click to show chart settings dialog' ng-click='$event.stopPropagation()' bs-popover data-template-url='{{ $ctrl.chartSettingsTemplateUrl }}' data-placement='bottom' data-auto-close='1' data-trigger='click')
i.fa.fa-bars
@@ -41,7 +41,11 @@ mixin chart-settings
label Show
button.select-manual-caret.btn.btn-default(ng-model='paragraph.timeLineSpan' ng-change='applyChartSettings(paragraph)' bs-options='item for item in timeLineSpans' bs-select data-caret-html='<span class="caret"></span>')
label min
- .col-xs-4
+
+ div
+ label Duration: #[b {{paragraph.duration | duration}}]
+ label.margin-left-dflt(ng-show='paragraph.localQueryMode') NodeID8: #[b {{paragraph.resNodeId | id8}}]
+ .col-xs-2
+result-toolbar
mixin notebook-rename
@@ -139,16 +143,17 @@ mixin query-actions
mixin table-result-heading-query
.total.row
- .col-xs-4
+ .col-xs-5
grid-column-selector(grid-api='paragraph.gridOptions.api')
.fa.fa-bars.icon
label Page: #[b {{paragraph.page}}]
label.margin-left-dflt Results so far: #[b {{paragraph.rows.length + paragraph.total}}]
label.margin-left-dflt Duration: #[b {{paragraph.duration | duration}}]
- .col-xs-4
+ label.margin-left-dflt(ng-show='paragraph.localQueryMode') NodeID8: #[b {{paragraph.resNodeId | id8}}]
+ .col-xs-2
div(ng-if='paragraph.qryType === "query"')
+result-toolbar
- .col-xs-4
+ .col-xs-5
.pull-right
.btn-group.panel-tip-container
button.btn.btn-primary.btn--with-icon(
@@ -182,16 +187,17 @@ mixin table-result-heading-query
mixin table-result-heading-scan
.total.row
- .col-xs-4
+ .col-xs-5
grid-column-selector(grid-api='paragraph.gridOptions.api')
.fa.fa-bars.icon
label Page: #[b {{paragraph.page}}]
label.margin-left-dflt Results so far: #[b {{paragraph.rows.length + paragraph.total}}]
label.margin-left-dflt Duration: #[b {{paragraph.duration | duration}}]
- .col-xs-4
+ label.margin-left-dflt(ng-show='paragraph.localQueryMode') NodeID8: #[b {{paragraph.resNodeId | id8}}]
+ .col-xs-2
div(ng-if='paragraph.qryType === "query"')
+result-toolbar
- .col-xs-4
+ .col-xs-5
.pull-right
.btn-group.panel-tip-container
// TODO: replace this logic for exporting under one component
http://git-wip-us.apache.org/repos/asf/ignite/blob/31055f21/modules/web-console/frontend/views/templates/message.tpl.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/views/templates/message.tpl.pug b/modules/web-console/frontend/views/templates/message.tpl.pug
index aa3615f..3cdb3c8 100644
--- a/modules/web-console/frontend/views/templates/message.tpl.pug
+++ b/modules/web-console/frontend/views/templates/message.tpl.pug
@@ -25,4 +25,5 @@
.modal-body(ng-show='content' style='overflow: auto; max-height: 300px;')
p(ng-bind-html='content.join("<br/>")' style='text-align: left; white-space: nowrap;')
.modal-footer
+ .pull-left(ng-show='meta') {{meta}}
button.btn.btn-primary(id='confirm-btn-confirm' ng-click='$hide()') Ok