You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ag...@apache.org on 2018/04/26 16:51:32 UTC
[1/4] ignite git commit: IGNITE-8404 Fixed NPE in
MappedFileMemoryProvider
Repository: ignite
Updated Branches:
refs/heads/master 1840f756d -> a7651b2f0
IGNITE-8404 Fixed NPE in MappedFileMemoryProvider
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a7651b2f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a7651b2f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a7651b2f
Branch: refs/heads/master
Commit: a7651b2f0f27f9af750bd482a42c1813f870e6f0
Parents: b7fd021
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Thu Apr 26 19:38:03 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Apr 26 19:47:40 2018 +0300
----------------------------------------------------------------------
.../mem/file/MappedFileMemoryProvider.java | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a7651b2f/modules/core/src/main/java/org/apache/ignite/internal/mem/file/MappedFileMemoryProvider.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/mem/file/MappedFileMemoryProvider.java b/modules/core/src/main/java/org/apache/ignite/internal/mem/file/MappedFileMemoryProvider.java
index 3800214..7186b27 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/mem/file/MappedFileMemoryProvider.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/mem/file/MappedFileMemoryProvider.java
@@ -94,14 +94,18 @@ public class MappedFileMemoryProvider implements DirectMemoryProvider {
/** {@inheritDoc} */
@Override public void shutdown() {
- for (MappedFile file : mappedFiles) {
- try {
- file.close();
- }
- catch (IOException e) {
- log.error("Failed to close memory-mapped file upon stop (will ignore) [file=" +
- file.file() + ", err=" + e.getMessage() + ']');
+ if (mappedFiles != null) {
+ for (MappedFile file : mappedFiles) {
+ try {
+ file.close();
+ }
+ catch (IOException e) {
+ log.error("Failed to close memory-mapped file upon stop (will ignore) [file=" +
+ file.file() + ", err=" + e.getMessage() + ']');
+ }
}
+
+ mappedFiles = null;
}
}
[3/4] ignite git commit: IGNITE-8277 Added utilities to check and
display cache info
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTask.java
new file mode 100644
index 0000000..2d86a42
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTask.java
@@ -0,0 +1,124 @@
+/*
+ * 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.verify;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.compute.ComputeJobContext;
+import org.apache.ignite.compute.ComputeTaskFuture;
+import org.apache.ignite.internal.processors.cache.verify.CollectConflictPartitionKeysTask;
+import org.apache.ignite.internal.processors.cache.verify.PartitionEntryHashRecord;
+import org.apache.ignite.internal.processors.cache.verify.PartitionHashRecord;
+import org.apache.ignite.internal.processors.cache.verify.RetrieveConflictPartitionValuesTask;
+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.lang.IgniteFuture;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.resources.JobContextResource;
+
+/**
+ * Task to find diverged keys of conflict partition.
+ */
+@GridInternal
+public class VisorIdleAnalyzeTask extends VisorOneNodeTask<VisorIdleAnalyzeTaskArg, VisorIdleAnalyzeTaskResult> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override protected VisorJob<VisorIdleAnalyzeTaskArg, VisorIdleAnalyzeTaskResult> job(VisorIdleAnalyzeTaskArg arg) {
+ return new VisorIdleVerifyJob(arg, debug);
+ }
+
+ /**
+ *
+ */
+ private static class VisorIdleVerifyJob extends VisorJob<VisorIdleAnalyzeTaskArg, VisorIdleAnalyzeTaskResult> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private ComputeTaskFuture<Map<PartitionHashRecord, List<PartitionEntryHashRecord>>> conflictKeysFut;
+
+ /** */
+ private ComputeTaskFuture<Map<PartitionHashRecord, List<PartitionEntryHashRecord>>> conflictValsFut;
+
+ /** Auto-inject job context. */
+ @JobContextResource
+ protected transient ComputeJobContext jobCtx;
+
+ /**
+ * @param arg Argument.
+ * @param debug Debug.
+ */
+ private VisorIdleVerifyJob(VisorIdleAnalyzeTaskArg arg, boolean debug) {
+ super(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected VisorIdleAnalyzeTaskResult run(VisorIdleAnalyzeTaskArg arg) throws IgniteException {
+ if (conflictKeysFut == null) {
+ conflictKeysFut = ignite.compute()
+ .executeAsync(CollectConflictPartitionKeysTask.class, arg.getPartitionKey());
+
+ if (!conflictKeysFut.isDone()) {
+ jobCtx.holdcc();
+
+ conflictKeysFut.listen(new IgniteInClosure<IgniteFuture<Map<PartitionHashRecord, List<PartitionEntryHashRecord>>>>() {
+ @Override public void apply(IgniteFuture<Map<PartitionHashRecord, List<PartitionEntryHashRecord>>> f) {
+ jobCtx.callcc();
+ }
+ });
+
+ return null;
+ }
+ }
+
+ Map<PartitionHashRecord, List<PartitionEntryHashRecord>> conflictKeys = conflictKeysFut.get();
+
+ if (conflictKeys.isEmpty())
+ return new VisorIdleAnalyzeTaskResult(Collections.emptyMap());
+
+ if (conflictValsFut == null) {
+ conflictValsFut = ignite.compute().executeAsync(RetrieveConflictPartitionValuesTask.class, conflictKeys);
+
+ if (!conflictValsFut.isDone()) {
+ jobCtx.holdcc();
+
+ conflictKeysFut.listen(new IgniteInClosure<IgniteFuture<Map<PartitionHashRecord, List<PartitionEntryHashRecord>>>>() {
+ @Override public void apply(IgniteFuture<Map<PartitionHashRecord, List<PartitionEntryHashRecord>>> f) {
+ jobCtx.callcc();
+ }
+ });
+
+ return null;
+ }
+ }
+
+ return new VisorIdleAnalyzeTaskResult(conflictValsFut.get());
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorIdleVerifyJob.class, this);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTaskArg.java
new file mode 100644
index 0000000..884f961
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTaskArg.java
@@ -0,0 +1,88 @@
+/*
+ * 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.verify;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.processors.cache.verify.PartitionKey;
+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;
+
+/**
+ * Arguments for task {@link VisorIdleAnalyzeTask}
+ */
+public class VisorIdleAnalyzeTaskArg extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Partition key. */
+ private PartitionKey partKey;
+
+ /**
+ * Default constructor.
+ */
+ public VisorIdleAnalyzeTaskArg() {
+ // No-op.
+ }
+
+ /**
+ * @param partKey Partition key.
+ */
+ public VisorIdleAnalyzeTaskArg(PartitionKey partKey) {
+ this.partKey = partKey;
+ }
+
+ /**
+ * @param grpId Group id.
+ * @param partId Partition id.
+ * @param grpName Group name.
+ */
+ public VisorIdleAnalyzeTaskArg(int grpId, int partId, String grpName) {
+ this(new PartitionKey(grpId, partId, grpName));
+ }
+
+ /**
+ * @return Partition key.
+ */
+ public PartitionKey getPartitionKey() {
+ return partKey;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeInt(partKey.groupId());
+ out.writeInt(partKey.partitionId());
+ U.writeString(out, partKey.groupName());
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException {
+ int grpId = in.readInt();
+ int partId = in.readInt();
+ String grpName = U.readString(in);
+
+ partKey = new PartitionKey(grpId, partId, grpName);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorIdleAnalyzeTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTaskResult.java
new file mode 100644
index 0000000..e8c1290
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleAnalyzeTaskResult.java
@@ -0,0 +1,76 @@
+/*
+ * 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.verify;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.List;
+import java.util.Map;
+import org.apache.ignite.internal.processors.cache.verify.PartitionEntryHashRecord;
+import org.apache.ignite.internal.processors.cache.verify.PartitionHashRecord;
+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 task {@link VisorIdleAnalyzeTask}
+ */
+public class VisorIdleAnalyzeTaskResult extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Results. */
+ private Map<PartitionHashRecord, List<PartitionEntryHashRecord>> divergedEntries;
+
+ /**
+ * Default constructor.
+ */
+ public VisorIdleAnalyzeTaskResult() {
+ // No-op.
+ }
+
+ /**
+ * @param divergedEntries Result.
+ */
+ public VisorIdleAnalyzeTaskResult(Map<PartitionHashRecord, List<PartitionEntryHashRecord>> divergedEntries) {
+ this.divergedEntries = divergedEntries;
+ }
+
+ /**
+ * @return Results.
+ */
+ public Map<PartitionHashRecord, List<PartitionEntryHashRecord>> getDivergedEntries() {
+ return divergedEntries;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeMap(out, divergedEntries);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ divergedEntries = U.readMap(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorIdleAnalyzeTaskResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleVerifyTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleVerifyTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleVerifyTask.java
new file mode 100644
index 0000000..05f2621
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleVerifyTask.java
@@ -0,0 +1,97 @@
+/*
+ * 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.verify;
+
+import java.util.List;
+import java.util.Map;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.compute.ComputeJobContext;
+import org.apache.ignite.compute.ComputeTaskFuture;
+import org.apache.ignite.internal.processors.cache.verify.PartitionHashRecord;
+import org.apache.ignite.internal.processors.cache.verify.PartitionKey;
+import org.apache.ignite.internal.processors.cache.verify.VerifyBackupPartitionsTask;
+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.lang.IgniteFuture;
+import org.apache.ignite.lang.IgniteInClosure;
+import org.apache.ignite.resources.JobContextResource;
+
+/**
+ * Task to verify checksums of backup partitions.
+ */
+@GridInternal
+public class VisorIdleVerifyTask extends VisorOneNodeTask<VisorIdleVerifyTaskArg, VisorIdleVerifyTaskResult> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override protected VisorJob<VisorIdleVerifyTaskArg, VisorIdleVerifyTaskResult> job(VisorIdleVerifyTaskArg arg) {
+ return new VisorIdleVerifyJob(arg, debug);
+ }
+
+ /**
+ *
+ */
+ private static class VisorIdleVerifyJob extends VisorJob<VisorIdleVerifyTaskArg, VisorIdleVerifyTaskResult> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private ComputeTaskFuture<Map<PartitionKey, List<PartitionHashRecord>>> fut;
+
+ /** Auto-inject job context. */
+ @JobContextResource
+ protected transient ComputeJobContext jobCtx;
+
+ /**
+ * @param arg Argument.
+ * @param debug Debug.
+ */
+ private VisorIdleVerifyJob(VisorIdleVerifyTaskArg arg, boolean debug) {
+ super(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected VisorIdleVerifyTaskResult run(VisorIdleVerifyTaskArg arg) throws IgniteException {
+ if (fut == null) {
+ fut = ignite.compute().executeAsync(VerifyBackupPartitionsTask.class, arg.getCaches());
+
+ if (!fut.isDone()) {
+ jobCtx.holdcc();
+
+ fut.listen(new IgniteInClosure<IgniteFuture<Map<PartitionKey, List<PartitionHashRecord>>>>() {
+ @Override public void apply(IgniteFuture<Map<PartitionKey, List<PartitionHashRecord>>> f) {
+ jobCtx.callcc();
+ }
+ });
+
+ return null;
+ }
+ }
+
+ return new VisorIdleVerifyTaskResult(fut.get());
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorIdleVerifyJob.class, this);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleVerifyTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleVerifyTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleVerifyTaskArg.java
new file mode 100644
index 0000000..c82af58
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleVerifyTaskArg.java
@@ -0,0 +1,74 @@
+/*
+ * 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.verify;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Set;
+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;
+
+/**
+ * Arguments for task {@link VisorIdleVerifyTask}
+ */
+public class VisorIdleVerifyTaskArg extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Caches. */
+ private Set<String> caches;
+
+ /**
+ * Default constructor.
+ */
+ public VisorIdleVerifyTaskArg() {
+ // No-op.
+ }
+
+ /**
+ * @param caches Caches.
+ */
+ public VisorIdleVerifyTaskArg(Set<String> caches) {
+ this.caches = caches;
+ }
+
+
+ /**
+ * @return Caches.
+ */
+ public Set<String> getCaches() {
+ return caches;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeCollection(out, caches);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ caches = U.readSet(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorIdleVerifyTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleVerifyTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleVerifyTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleVerifyTaskResult.java
new file mode 100644
index 0000000..7ef542f
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorIdleVerifyTaskResult.java
@@ -0,0 +1,76 @@
+/*
+ * 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.verify;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.List;
+import java.util.Map;
+import org.apache.ignite.internal.processors.cache.verify.PartitionHashRecord;
+import org.apache.ignite.internal.processors.cache.verify.PartitionKey;
+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 task {@link VisorIdleVerifyTask}
+ */
+public class VisorIdleVerifyTaskResult extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Results. */
+ private Map<PartitionKey, List<PartitionHashRecord>> conflicts;
+
+ /**
+ * Default constructor.
+ */
+ public VisorIdleVerifyTaskResult() {
+ // No-op.
+ }
+
+ /**
+ * @param conflicts Result.
+ */
+ public VisorIdleVerifyTaskResult(Map<PartitionKey, List<PartitionHashRecord>> conflicts) {
+ this.conflicts = conflicts;
+ }
+
+ /**
+ * @return Results.
+ */
+ public Map<PartitionKey, List<PartitionHashRecord>> getConflicts() {
+ return conflicts;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeMap(out, conflicts);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ conflicts = U.readMap(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorIdleVerifyTaskResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesJobResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesJobResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesJobResult.java
new file mode 100644
index 0000000..25c97b6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesJobResult.java
@@ -0,0 +1,73 @@
+/*
+* 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.verify;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Map;
+import org.apache.ignite.internal.processors.cache.verify.PartitionKey;
+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;
+
+/**
+ *
+ */
+public class VisorValidateIndexesJobResult extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Results of indexes validation from node. */
+ private Map<PartitionKey, ValidateIndexesPartitionResult> res;
+
+ /**
+ * @param res Results of indexes validation from node.
+ */
+ public VisorValidateIndexesJobResult(Map<PartitionKey, ValidateIndexesPartitionResult> res) {
+ this.res = res;
+ }
+
+ /**
+ * For externalization only.
+ */
+ public VisorValidateIndexesJobResult() {
+ }
+
+ /**
+ * @return Results of indexes validation from node.
+ */
+ public Map<PartitionKey, ValidateIndexesPartitionResult> response() {
+ return res;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeMap(out, res);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ res = U.readMap(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorValidateIndexesJobResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesTaskArg.java
new file mode 100644
index 0000000..cf9aff5
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesTaskArg.java
@@ -0,0 +1,74 @@
+/*
+ * 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.verify;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Set;
+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;
+
+/**
+ * Arguments for task {@link VisorIdleVerifyTask}
+ */
+public class VisorValidateIndexesTaskArg extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Caches. */
+ private Set<String> caches;
+
+ /**
+ * Default constructor.
+ */
+ public VisorValidateIndexesTaskArg() {
+ // No-op.
+ }
+
+ /**
+ * @param caches Caches.
+ */
+ public VisorValidateIndexesTaskArg(Set<String> caches) {
+ this.caches = caches;
+ }
+
+
+ /**
+ * @return Caches.
+ */
+ public Set<String> getCaches() {
+ return caches;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeCollection(out, caches);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ caches = U.readSet(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorValidateIndexesTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesTaskResult.java
new file mode 100644
index 0000000..e206448
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesTaskResult.java
@@ -0,0 +1,88 @@
+/*
+ * 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.verify;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Map;
+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;
+
+/**
+ *
+ */
+public class VisorValidateIndexesTaskResult extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Exceptions. */
+ private Map<UUID, Exception> exceptions;
+
+ /** Results from cluster. */
+ private Map<UUID, VisorValidateIndexesJobResult> results;
+
+ /**
+ * @param results Results.
+ * @param exceptions Exceptions.
+ */
+ public VisorValidateIndexesTaskResult(Map<UUID, VisorValidateIndexesJobResult> results,
+ Map<UUID, Exception> exceptions) {
+ this.exceptions = exceptions;
+ this.results = results;
+ }
+
+ /**
+ * For externalization only.
+ */
+ public VisorValidateIndexesTaskResult() {
+ }
+
+ /**
+ * @return Exceptions.
+ */
+ public Map<UUID, Exception> exceptions() {
+ return exceptions;
+ }
+
+ /**
+ * @return Results from cluster.
+ */
+ public Map<UUID, VisorValidateIndexesJobResult> results() {
+ return results;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeMap(out, exceptions);
+ U.writeMap(out, results);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ exceptions = U.readMap(in);
+ results = U.readMap(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorValidateIndexesTaskResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorViewCacheCmd.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorViewCacheCmd.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorViewCacheCmd.java
new file mode 100644
index 0000000..0d9ce3a
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorViewCacheCmd.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.verify;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ *
+ */
+public enum VisorViewCacheCmd {
+ /** Caches. */
+ CACHES,
+
+ /** Groups. */
+ GROUPS,
+
+ /** Sequence. */
+ SEQ;
+
+ /** Enumerated values. */
+ private static final VisorViewCacheCmd[] 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 VisorViewCacheCmd fromOrdinal(int ord) {
+ return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorViewCacheTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorViewCacheTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorViewCacheTask.java
new file mode 100644
index 0000000..86931e6
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorViewCacheTask.java
@@ -0,0 +1,75 @@
+/*
+ * 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.verify;
+
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.internal.processors.cache.verify.ViewCacheClosure;
+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.jetbrains.annotations.Nullable;
+
+/**
+ *
+ */
+@GridInternal
+public class VisorViewCacheTask extends VisorOneNodeTask<VisorViewCacheTaskArg, VisorViewCacheTaskResult> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Override protected VisorJob<VisorViewCacheTaskArg, VisorViewCacheTaskResult> job(VisorViewCacheTaskArg arg) {
+ return new VisorViewCacheJob(arg, debug);
+ }
+
+ /**
+ *
+ */
+ private static class VisorViewCacheJob extends VisorJob<VisorViewCacheTaskArg, VisorViewCacheTaskResult> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * @param arg Argument.
+ * @param debug Debug.
+ */
+ protected VisorViewCacheJob(@Nullable VisorViewCacheTaskArg arg, boolean debug) {
+ super(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected VisorViewCacheTaskResult run(@Nullable VisorViewCacheTaskArg arg) throws IgniteException {
+ try {
+ ViewCacheClosure clo = new ViewCacheClosure(arg.regex(), arg.command());
+
+ ignite.context().resource().injectGeneric(clo);
+
+ return new VisorViewCacheTaskResult(clo.call());
+ }
+ catch (Exception e) {
+ throw new IgniteException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorViewCacheJob.class, this);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorViewCacheTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorViewCacheTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorViewCacheTaskArg.java
new file mode 100644
index 0000000..5fcd66d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorViewCacheTaskArg.java
@@ -0,0 +1,86 @@
+/*
+* 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.verify;
+
+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;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ *
+ */
+public class VisorViewCacheTaskArg extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Regex. */
+ private String regex;
+
+ /** Type. */
+ private @Nullable VisorViewCacheCmd cmd;
+
+ /**
+ * @param regex Regex.
+ * @param cmd Command.
+ */
+ public VisorViewCacheTaskArg(String regex, @Nullable VisorViewCacheCmd cmd) {
+ this.regex = regex;
+ this.cmd = cmd;
+ }
+
+ /**
+ * For externalization only.
+ */
+ public VisorViewCacheTaskArg() {
+ }
+
+ /**
+ * @return Regex.
+ */
+ public String regex() {
+ return regex;
+ }
+
+ /**
+ * @return Command.
+ */
+ public VisorViewCacheCmd command() {
+ return cmd;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, regex);
+ U.writeEnum(out, cmd);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ regex = U.readString(in);
+ cmd = VisorViewCacheCmd.fromOrdinal(in.readByte());
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorViewCacheTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorViewCacheTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorViewCacheTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorViewCacheTaskResult.java
new file mode 100644
index 0000000..138bf06
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorViewCacheTaskResult.java
@@ -0,0 +1,74 @@
+/*
+ * 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.verify;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Collection;
+import java.util.List;
+import org.apache.ignite.internal.processors.cache.verify.CacheInfo;
+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;
+
+/**
+ *
+ */
+public class VisorViewCacheTaskResult extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Cache infos. */
+ private List<CacheInfo> cacheInfos;
+
+ /**
+ * @param cacheInfos Cache infos.
+ */
+ public VisorViewCacheTaskResult(List<CacheInfo> cacheInfos) {
+ this.cacheInfos = cacheInfos;
+ }
+
+ /**
+ * For externalization only.
+ */
+ public VisorViewCacheTaskResult() {
+ }
+
+ /**
+ * @return Cache infos.
+ */
+ public Collection<CacheInfo> cacheInfos() {
+ return cacheInfos;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeCollection(out, cacheInfos);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ cacheInfos = U.readList(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorViewCacheTaskResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/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 d939b02..8ca47c8 100644
--- a/modules/core/src/main/resources/META-INF/classnames.properties
+++ b/modules/core/src/main/resources/META-INF/classnames.properties
@@ -28,6 +28,7 @@ org.apache.ignite.IgniteState
org.apache.ignite.binary.BinaryInvalidTypeException
org.apache.ignite.binary.BinaryObject
org.apache.ignite.binary.BinaryObjectException
+org.apache.ignite.binary.BinaryTypeConfiguration
org.apache.ignite.cache.CacheAtomicUpdateTimeoutException
org.apache.ignite.cache.CacheAtomicityMode
org.apache.ignite.cache.CacheEntryEventSerializableFilter
@@ -112,6 +113,13 @@ org.apache.ignite.cache.store.jdbc.dialect.SQLServerDialect
org.apache.ignite.cache.store.jdbc.dialect.SQLServerDialect$1
org.apache.ignite.cache.store.jdbc.dialect.SQLServerDialect$2
org.apache.ignite.cache.store.jdbc.dialect.SQLServerDialect$3
+org.apache.ignite.client.ClientAuthenticationException
+org.apache.ignite.client.ClientAuthorizationException
+org.apache.ignite.client.ClientCacheConfiguration
+org.apache.ignite.client.ClientConnectionException
+org.apache.ignite.client.ClientException
+org.apache.ignite.client.SslMode
+org.apache.ignite.client.SslProtocol
org.apache.ignite.cluster.ClusterGroupEmptyException
org.apache.ignite.cluster.ClusterTopologyException
org.apache.ignite.compute.ComputeExecutionRejectedException
@@ -135,9 +143,11 @@ org.apache.ignite.compute.gridify.GridifyTaskSplitAdapter
org.apache.ignite.compute.gridify.aop.GridifyArgumentAdapter
org.apache.ignite.compute.gridify.aop.GridifyDefaultRangeTask
org.apache.ignite.compute.gridify.aop.GridifyDefaultTask
+org.apache.ignite.configuration.BinaryConfiguration
org.apache.ignite.configuration.CacheConfiguration
org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate
org.apache.ignite.configuration.CheckpointWriteOrder
+org.apache.ignite.configuration.ClientConfiguration
org.apache.ignite.configuration.CollectionConfiguration
org.apache.ignite.configuration.DataPageEvictionMode
org.apache.ignite.configuration.DataRegionConfiguration
@@ -164,6 +174,7 @@ org.apache.ignite.events.IgfsEvent
org.apache.ignite.events.JobEvent
org.apache.ignite.events.TaskEvent
org.apache.ignite.events.WalSegmentArchivedEvent
+org.apache.ignite.failure.FailureType
org.apache.ignite.hadoop.HadoopInputSplit
org.apache.ignite.hadoop.HadoopMapReducePlan
org.apache.ignite.igfs.IgfsConcurrentModificationException
@@ -247,7 +258,7 @@ org.apache.ignite.internal.IgniteMessagingImpl
org.apache.ignite.internal.IgniteNeedReconnectException
org.apache.ignite.internal.IgniteSchedulerImpl
org.apache.ignite.internal.IgniteServicesImpl
-org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance$1
+org.apache.ignite.internal.IgnitionEx$IgniteNamedInstance$4
org.apache.ignite.internal.NodeStoppingException
org.apache.ignite.internal.binary.BinaryEnumObjectImpl
org.apache.ignite.internal.binary.BinaryFieldMetadata
@@ -286,6 +297,11 @@ org.apache.ignite.internal.client.impl.connection.GridClientNioTcpConnection$6
org.apache.ignite.internal.client.impl.connection.GridClientNioTcpConnection$7
org.apache.ignite.internal.client.impl.connection.GridClientTopology$1
org.apache.ignite.internal.client.impl.connection.GridConnectionIdleClosedException
+org.apache.ignite.internal.client.thin.ClientError
+org.apache.ignite.internal.client.thin.ClientOperation
+org.apache.ignite.internal.client.thin.ClientProtocolError
+org.apache.ignite.internal.client.thin.ClientServerError
+org.apache.ignite.internal.client.thin.ClientUtils$CfgItem
org.apache.ignite.internal.cluster.ClusterGroupAdapter
org.apache.ignite.internal.cluster.ClusterGroupAdapter$AgeClusterGroup
org.apache.ignite.internal.cluster.ClusterGroupAdapter$AttributeFilter
@@ -305,6 +321,8 @@ org.apache.ignite.internal.cluster.IgniteKillTask
org.apache.ignite.internal.cluster.IgniteKillTask$IgniteKillJob
org.apache.ignite.internal.cluster.NodeOrderComparator
org.apache.ignite.internal.cluster.NodeOrderLegacyComparator
+org.apache.ignite.internal.commandline.Command
+org.apache.ignite.internal.commandline.cache.CacheCommand
org.apache.ignite.internal.compute.ComputeTaskCancelledCheckedException
org.apache.ignite.internal.compute.ComputeTaskTimeoutCheckedException
org.apache.ignite.internal.direct.DirectMessageReader$1
@@ -317,7 +335,6 @@ org.apache.ignite.internal.igfs.common.IgfsIpcCommand
org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl
org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl$BooleanProperty
org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl$ConnectionProperty
-org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl$EmptyStringValidator
org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl$IntegerProperty
org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl$NumberProperty
org.apache.ignite.internal.jdbc.thin.ConnectionPropertiesImpl$PropertyValidator
@@ -348,6 +365,7 @@ org.apache.ignite.internal.managers.discovery.DiscoCache$1
org.apache.ignite.internal.managers.discovery.DiscoCache$2
org.apache.ignite.internal.managers.discovery.DiscoCache$3
org.apache.ignite.internal.managers.discovery.DiscoveryCustomMessage
+org.apache.ignite.internal.managers.discovery.DiscoveryServerOnlyCustomMessage
org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$1
org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$2
org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$4$1
@@ -372,6 +390,19 @@ org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion
org.apache.ignite.internal.processors.affinity.GridAffinityAssignment
org.apache.ignite.internal.processors.affinity.GridAffinityMessage
org.apache.ignite.internal.processors.affinity.GridAffinityUtils$AffinityJob
+org.apache.ignite.internal.processors.authentication.IgniteAccessControlException
+org.apache.ignite.internal.processors.authentication.IgniteAuthenticationProcessor$3
+org.apache.ignite.internal.processors.authentication.IgniteAuthenticationProcessor$InitialUsersData
+org.apache.ignite.internal.processors.authentication.IgniteAuthenticationProcessor$RefreshUsersStorageWorker$1
+org.apache.ignite.internal.processors.authentication.User
+org.apache.ignite.internal.processors.authentication.UserAcceptedMessage
+org.apache.ignite.internal.processors.authentication.UserAuthenticateRequestMessage
+org.apache.ignite.internal.processors.authentication.UserAuthenticateResponseMessage
+org.apache.ignite.internal.processors.authentication.UserManagementException
+org.apache.ignite.internal.processors.authentication.UserManagementOperation
+org.apache.ignite.internal.processors.authentication.UserManagementOperation$OperationType
+org.apache.ignite.internal.processors.authentication.UserManagementOperationFinishedMessage
+org.apache.ignite.internal.processors.authentication.UserProposedMessage
org.apache.ignite.internal.processors.bulkload.BulkLoadCacheWriter
org.apache.ignite.internal.processors.bulkload.BulkLoadStreamerWriter
org.apache.ignite.internal.processors.cache.CacheAffinityChangeMessage
@@ -528,6 +559,7 @@ org.apache.ignite.internal.processors.cache.GridCacheLoaderWriterStore
org.apache.ignite.internal.processors.cache.GridCacheLoaderWriterStoreFactory
org.apache.ignite.internal.processors.cache.GridCacheLockTimeoutException
org.apache.ignite.internal.processors.cache.GridCacheLogger
+org.apache.ignite.internal.processors.cache.GridCacheMapEntry$1
org.apache.ignite.internal.processors.cache.GridCacheMessage
org.apache.ignite.internal.processors.cache.GridCacheMultiTxFuture$1
org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate
@@ -616,6 +648,7 @@ org.apache.ignite.internal.processors.cache.WalStateAbstractMessage
org.apache.ignite.internal.processors.cache.WalStateAckMessage
org.apache.ignite.internal.processors.cache.WalStateFinishMessage
org.apache.ignite.internal.processors.cache.WalStateManager$2
+org.apache.ignite.internal.processors.cache.WalStateManager$3
org.apache.ignite.internal.processors.cache.WalStateProposeMessage
org.apache.ignite.internal.processors.cache.affinity.GridCacheAffinityProxy
org.apache.ignite.internal.processors.cache.binary.BinaryMetadataHolder
@@ -803,17 +836,15 @@ org.apache.ignite.internal.processors.cache.distributed.dht.preloader.CacheParti
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysFuture$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysRequest
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtForceKeysResponse
+org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandLegacyMessage
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemandMessage
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$1$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$2
-org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$3
-org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$4$1
-org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$5$1
+org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionDemander$3$1
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionExchangeId
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionFullMap
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionMap
-org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplier$SupplyContextPhase
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionSupplyMessage
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsAbstractMessage
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture$2
@@ -837,6 +868,9 @@ org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtP
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionCountersMap2
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionHistorySuppliersMap
org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteDhtPartitionsToReloadMap
+org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteHistoricalIterator
+org.apache.ignite.internal.processors.cache.distributed.dht.preloader.IgniteRebalanceIteratorImpl
+org.apache.ignite.internal.processors.cache.distributed.dht.preloader.latch.LatchAckMessage
org.apache.ignite.internal.processors.cache.distributed.near.CacheVersionedValue
org.apache.ignite.internal.processors.cache.distributed.near.GridNearAtomicCache
org.apache.ignite.internal.processors.cache.distributed.near.GridNearAtomicCache$1
@@ -903,6 +937,7 @@ 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$24
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
@@ -926,11 +961,11 @@ org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache$5
org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache$8
org.apache.ignite.internal.processors.cache.local.atomic.GridLocalAtomicCache$9
org.apache.ignite.internal.processors.cache.persistence.CacheDataRowAdapter$RowData
-org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager$11
+org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager$12
org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager$6
-org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager$8
+org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager$9
org.apache.ignite.internal.processors.cache.persistence.GridCacheDatabaseSharedManager$CheckpointEntryType
-org.apache.ignite.internal.processors.cache.persistence.GridCacheOffheapManager$RebalanceIteratorAdapter
+org.apache.ignite.internal.processors.cache.persistence.GridCacheOffheapManager$WALHistoricalIterator
org.apache.ignite.internal.processors.cache.persistence.IgniteCacheDatabaseSharedManager$1
org.apache.ignite.internal.processors.cache.persistence.file.AsyncFileIOFactory
org.apache.ignite.internal.processors.cache.persistence.file.FileDownloader$1
@@ -942,6 +977,7 @@ org.apache.ignite.internal.processors.cache.persistence.pagemem.PageMemoryImpl$T
org.apache.ignite.internal.processors.cache.persistence.pagemem.PagesWriteSpeedBasedThrottle$ThrottleMode
org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotDiscoveryMessage
org.apache.ignite.internal.processors.cache.persistence.snapshot.SnapshotOperation
+org.apache.ignite.internal.processors.cache.persistence.snapshot.TrackingPageIsCorruptedException
org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$Bool
org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$DestroyBag
org.apache.ignite.internal.processors.cache.persistence.tree.BPlusTree$Result
@@ -1095,8 +1131,13 @@ org.apache.ignite.internal.processors.cache.transactions.TxLock
org.apache.ignite.internal.processors.cache.transactions.TxLockList
org.apache.ignite.internal.processors.cache.transactions.TxLocksRequest
org.apache.ignite.internal.processors.cache.transactions.TxLocksResponse
+org.apache.ignite.internal.processors.cache.verify.CacheInfo
+org.apache.ignite.internal.processors.cache.verify.CacheInfo$1
+org.apache.ignite.internal.processors.cache.verify.CacheInfo$2
org.apache.ignite.internal.processors.cache.verify.CollectConflictPartitionKeysTask
org.apache.ignite.internal.processors.cache.verify.CollectConflictPartitionKeysTask$CollectPartitionEntryHashesJob
+org.apache.ignite.internal.processors.cache.verify.ContentionClosure
+org.apache.ignite.internal.processors.cache.verify.ContentionInfo
org.apache.ignite.internal.processors.cache.verify.PartitionEntryHashRecord
org.apache.ignite.internal.processors.cache.verify.PartitionHashRecord
org.apache.ignite.internal.processors.cache.verify.PartitionKey
@@ -1104,6 +1145,8 @@ org.apache.ignite.internal.processors.cache.verify.RetrieveConflictPartitionValu
org.apache.ignite.internal.processors.cache.verify.RetrieveConflictPartitionValuesTask$RetrieveConflictValuesJob
org.apache.ignite.internal.processors.cache.verify.VerifyBackupPartitionsTask
org.apache.ignite.internal.processors.cache.verify.VerifyBackupPartitionsTask$VerifyBackupPartitionsJob
+org.apache.ignite.internal.processors.cache.verify.ViewCacheClosure
+org.apache.ignite.internal.processors.cache.verify.ViewCacheClosure$1
org.apache.ignite.internal.processors.cache.version.GridCacheRawVersionedEntry
org.apache.ignite.internal.processors.cache.version.GridCacheVersion
org.apache.ignite.internal.processors.cache.version.GridCacheVersionConflictContext$State
@@ -1130,15 +1173,16 @@ org.apache.ignite.internal.processors.closure.GridClosureProcessor$T8
org.apache.ignite.internal.processors.closure.GridClosureProcessor$T9
org.apache.ignite.internal.processors.closure.GridClosureProcessor$TaskNoReduceAdapter
org.apache.ignite.internal.processors.closure.GridPeerDeployAwareTaskAdapter
-org.apache.ignite.internal.processors.cluster.ClusterNodeMetrics
org.apache.ignite.internal.processors.cluster.BaselineTopology
org.apache.ignite.internal.processors.cluster.BaselineTopologyHistory
org.apache.ignite.internal.processors.cluster.BaselineTopologyHistoryItem
org.apache.ignite.internal.processors.cluster.BranchingPointType
org.apache.ignite.internal.processors.cluster.ChangeGlobalStateFinishMessage
org.apache.ignite.internal.processors.cluster.ChangeGlobalStateMessage
-org.apache.ignite.internal.processors.cluster.ClusterProcessor$3
-org.apache.ignite.internal.processors.cluster.ClusterProcessor$3$1
+org.apache.ignite.internal.processors.cluster.ClusterMetricsUpdateMessage
+org.apache.ignite.internal.processors.cluster.ClusterNodeMetrics
+org.apache.ignite.internal.processors.cluster.ClusterProcessor$4
+org.apache.ignite.internal.processors.cluster.ClusterProcessor$4$1
org.apache.ignite.internal.processors.cluster.DiscoveryDataClusterState
org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor$1$1
org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor$2
@@ -1150,18 +1194,24 @@ org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor$Baseline
org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor$CheckGlobalStateComputeRequest
org.apache.ignite.internal.processors.cluster.GridClusterStateProcessor$ClientChangeGlobalStateComputeRequest
org.apache.ignite.internal.processors.continuous.AbstractContinuousMessage
+org.apache.ignite.internal.processors.continuous.ContinuousRoutineInfo
+org.apache.ignite.internal.processors.continuous.ContinuousRoutineStartResultMessage
+org.apache.ignite.internal.processors.continuous.ContinuousRoutinesCommonDiscoveryData
+org.apache.ignite.internal.processors.continuous.ContinuousRoutinesJoiningNodeDiscoveryData
org.apache.ignite.internal.processors.continuous.GridContinuousHandler
org.apache.ignite.internal.processors.continuous.GridContinuousHandler$RegisterStatus
org.apache.ignite.internal.processors.continuous.GridContinuousMessage
org.apache.ignite.internal.processors.continuous.GridContinuousMessageType
-org.apache.ignite.internal.processors.continuous.GridContinuousProcessor$8
-org.apache.ignite.internal.processors.continuous.GridContinuousProcessor$9$1
+org.apache.ignite.internal.processors.continuous.GridContinuousProcessor$11$1
+org.apache.ignite.internal.processors.continuous.GridContinuousProcessor$9
org.apache.ignite.internal.processors.continuous.GridContinuousProcessor$DiscoveryData
org.apache.ignite.internal.processors.continuous.GridContinuousProcessor$DiscoveryDataItem
org.apache.ignite.internal.processors.continuous.GridContinuousProcessor$LocalRoutineInfo
org.apache.ignite.internal.processors.continuous.StartRequestData
+org.apache.ignite.internal.processors.continuous.StartRequestDataV2
org.apache.ignite.internal.processors.continuous.StartRoutineAckDiscoveryMessage
org.apache.ignite.internal.processors.continuous.StartRoutineDiscoveryMessage
+org.apache.ignite.internal.processors.continuous.StartRoutineDiscoveryMessageV2
org.apache.ignite.internal.processors.continuous.StopRoutineAckDiscoveryMessage
org.apache.ignite.internal.processors.continuous.StopRoutineDiscoveryMessage
org.apache.ignite.internal.processors.datastreamer.DataStreamProcessor$3
@@ -1427,6 +1477,7 @@ org.apache.ignite.internal.processors.query.GridQueryProcessor$5
org.apache.ignite.internal.processors.query.GridQueryProcessor$6
org.apache.ignite.internal.processors.query.GridQueryProcessor$7
org.apache.ignite.internal.processors.query.GridQueryProcessor$8
+org.apache.ignite.internal.processors.query.GridQueryProcessor$9
org.apache.ignite.internal.processors.query.GridQueryProcessor$SchemaOperation$1
org.apache.ignite.internal.processors.query.IgniteSQLException
org.apache.ignite.internal.processors.query.QueryEntityEx
@@ -1543,6 +1594,7 @@ org.apache.ignite.internal.processors.service.GridServiceProcessor$ServiceDeploy
org.apache.ignite.internal.processors.service.GridServiceProcessor$ServiceTopologyCallable
org.apache.ignite.internal.processors.service.GridServiceProxy
org.apache.ignite.internal.processors.service.GridServiceProxy$ServiceProxyCallable
+org.apache.ignite.internal.processors.service.GridServiceProxy$ServiceProxyException
org.apache.ignite.internal.processors.service.LazyServiceConfiguration
org.apache.ignite.internal.processors.service.ServiceContextImpl
org.apache.ignite.internal.processors.service.ServiceDescriptorImpl
@@ -1622,6 +1674,7 @@ org.apache.ignite.internal.util.GridSnapshotLock$Sync
org.apache.ignite.internal.util.GridSpiCloseableIteratorWrapper
org.apache.ignite.internal.util.GridStringBuilder
org.apache.ignite.internal.util.GridSynchronizedMap
+org.apache.ignite.internal.util.HostAndPortRange
org.apache.ignite.internal.util.IgniteExceptionRegistry$ExceptionInfo
org.apache.ignite.internal.util.IgniteTree$OperationType
org.apache.ignite.internal.util.IgniteUtils$10
@@ -1860,6 +1913,10 @@ org.apache.ignite.internal.visor.cache.VisorCacheJdbcTypeField
org.apache.ignite.internal.visor.cache.VisorCacheLoadTask
org.apache.ignite.internal.visor.cache.VisorCacheLoadTask$VisorCachesLoadJob
org.apache.ignite.internal.visor.cache.VisorCacheLoadTaskArg
+org.apache.ignite.internal.visor.cache.VisorCacheLostPartitionsTask
+org.apache.ignite.internal.visor.cache.VisorCacheLostPartitionsTask$VisorCacheLostPartitionsJob
+org.apache.ignite.internal.visor.cache.VisorCacheLostPartitionsTaskArg
+org.apache.ignite.internal.visor.cache.VisorCacheLostPartitionsTaskResult
org.apache.ignite.internal.visor.cache.VisorCacheMetadataTask
org.apache.ignite.internal.visor.cache.VisorCacheMetadataTask$VisorCacheMetadataJob
org.apache.ignite.internal.visor.cache.VisorCacheMetadataTaskArg
@@ -1883,6 +1940,9 @@ org.apache.ignite.internal.visor.cache.VisorCacheRebalanceConfiguration
org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTask
org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTask$VisorCachesRebalanceJob
org.apache.ignite.internal.visor.cache.VisorCacheRebalanceTaskArg
+org.apache.ignite.internal.visor.cache.VisorCacheResetLostPartitionsTask
+org.apache.ignite.internal.visor.cache.VisorCacheResetLostPartitionsTask$VisorCacheResetLostPartitionsJob
+org.apache.ignite.internal.visor.cache.VisorCacheResetLostPartitionsTaskArg
org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTask
org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTask$VisorCacheResetMetricsJob
org.apache.ignite.internal.visor.cache.VisorCacheResetMetricsTaskArg
@@ -2076,6 +2136,31 @@ org.apache.ignite.internal.visor.tx.VisorTxSortOrder
org.apache.ignite.internal.visor.tx.VisorTxTask
org.apache.ignite.internal.visor.tx.VisorTxTaskArg
org.apache.ignite.internal.visor.tx.VisorTxTaskResult
+org.apache.ignite.internal.visor.verify.VisorViewCacheCmd
+org.apache.ignite.internal.visor.verify.ValidateIndexesPartitionResult
+org.apache.ignite.internal.visor.verify.VisorContentionJobResult
+org.apache.ignite.internal.visor.verify.VisorContentionTask
+org.apache.ignite.internal.visor.verify.VisorContentionTask$VisorContentionJob
+org.apache.ignite.internal.visor.verify.VisorContentionTaskArg
+org.apache.ignite.internal.visor.verify.VisorContentionTaskResult
+org.apache.ignite.internal.visor.verify.VisorIdleAnalyzeTask
+org.apache.ignite.internal.visor.verify.VisorIdleAnalyzeTask$VisorIdleVerifyJob
+org.apache.ignite.internal.visor.verify.VisorIdleAnalyzeTask$VisorIdleVerifyJob$1
+org.apache.ignite.internal.visor.verify.VisorIdleAnalyzeTask$VisorIdleVerifyJob$2
+org.apache.ignite.internal.visor.verify.VisorIdleAnalyzeTaskArg
+org.apache.ignite.internal.visor.verify.VisorIdleAnalyzeTaskResult
+org.apache.ignite.internal.visor.verify.VisorIdleVerifyTask
+org.apache.ignite.internal.visor.verify.VisorIdleVerifyTask$VisorIdleVerifyJob
+org.apache.ignite.internal.visor.verify.VisorIdleVerifyTask$VisorIdleVerifyJob$1
+org.apache.ignite.internal.visor.verify.VisorIdleVerifyTaskArg
+org.apache.ignite.internal.visor.verify.VisorIdleVerifyTaskResult
+org.apache.ignite.internal.visor.verify.VisorValidateIndexesJobResult
+org.apache.ignite.internal.visor.verify.VisorValidateIndexesTaskArg
+org.apache.ignite.internal.visor.verify.VisorValidateIndexesTaskResult
+org.apache.ignite.internal.visor.verify.VisorViewCacheTask
+org.apache.ignite.internal.visor.verify.VisorViewCacheTask$VisorViewCacheJob
+org.apache.ignite.internal.visor.verify.VisorViewCacheTaskArg
+org.apache.ignite.internal.visor.verify.VisorViewCacheTaskResult
org.apache.ignite.internal.websession.WebSessionAttributeProcessor
org.apache.ignite.internal.websession.WebSessionEntity
org.apache.ignite.lang.IgniteBiClosure
@@ -2143,6 +2228,7 @@ org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$4
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$HandshakeClosure
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$HandshakeException
org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi$HandshakeTimeoutException
+org.apache.ignite.spi.communication.tcp.internal.TcpCommunicationConnectionCheckFuture$SingleAddressConnectFuture$1
org.apache.ignite.spi.communication.tcp.messages.HandshakeMessage
org.apache.ignite.spi.communication.tcp.messages.HandshakeMessage2
org.apache.ignite.spi.communication.tcp.messages.NodeIdMessage
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java b/modules/core/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java
index c2d9eec..dbd6107 100644
--- a/modules/core/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/util/GridCommandHandlerTest.java
@@ -22,13 +22,19 @@ import java.io.File;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.HashSet;
import java.util.Map;
import java.util.TreeMap;
import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteAtomicSequence;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
+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.ConnectorConfiguration;
@@ -36,8 +42,10 @@ 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.IgniteEx;
import org.apache.ignite.internal.IgniteInternalFuture;
import org.apache.ignite.internal.commandline.CommandHandler;
+import org.apache.ignite.internal.commandline.cache.CacheCommand;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.G;
import org.apache.ignite.internal.util.typedef.X;
@@ -49,8 +57,8 @@ import org.apache.ignite.testframework.junits.common.GridCommonAbstractTest;
import org.apache.ignite.transactions.Transaction;
import org.apache.ignite.transactions.TransactionRollbackException;
-import static org.apache.ignite.cache.CacheAtomicityMode.*;
-import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*;
+import static org.apache.ignite.cache.CacheAtomicityMode.TRANSACTIONAL;
+import static org.apache.ignite.cache.CacheWriteSynchronizationMode.FULL_SYNC;
import static org.apache.ignite.internal.commandline.CommandHandler.EXIT_CODE_OK;
import static org.apache.ignite.internal.commandline.CommandHandler.EXIT_CODE_UNEXPECTED_ERROR;
import static org.apache.ignite.transactions.TransactionConcurrency.OPTIMISTIC;
@@ -61,6 +69,12 @@ import static org.apache.ignite.transactions.TransactionIsolation.READ_COMMITTED
* Command line handler test.
*/
public class GridCommandHandlerTest extends GridCommonAbstractTest {
+ /** System out. */
+ protected PrintStream sysOut;
+
+ /** Test out - can be injected via {@link #injectTestSystemOut()} instead of System.out and analyzed in test. */
+ protected ByteArrayOutputStream testOut;
+
/**
* @return Folder in work directory.
* @throws IgniteCheckedException If failed to resolve folder name.
@@ -74,6 +88,10 @@ public class GridCommandHandlerTest extends GridCommonAbstractTest {
cleanPersistenceDir();
stopAllGrids();
+
+ sysOut = System.out;
+
+ testOut = new ByteArrayOutputStream(128 * 1024);
}
/** {@inheritDoc} */
@@ -81,6 +99,18 @@ public class GridCommandHandlerTest extends GridCommonAbstractTest {
stopAllGrids();
cleanPersistenceDir();
+
+ System.setOut(sysOut);
+
+ if (testOut != null)
+ System.out.println(testOut.toString());
+ }
+
+ /**
+ *
+ */
+ protected void injectTestSystemOut() {
+ System.setOut(new PrintStream(testOut));
}
/** {@inheritDoc} */
@@ -263,40 +293,6 @@ public class GridCommandHandlerTest extends GridCommonAbstractTest {
}
/**
- * Test baseline add items works via control.sh
- *
- * @throws Exception If failed.
- */
- public void testBaselineAddOnNotActiveCluster() throws Exception {
- try {
- Ignite ignite = startGrid(1);
-
- assertFalse(ignite.cluster().active());
-
- String consistentIDs = getTestIgniteInstanceName(1);
-
- ByteArrayOutputStream out = new ByteArrayOutputStream(4096);
- System.setOut(new PrintStream(out));
-
- assertEquals(EXIT_CODE_UNEXPECTED_ERROR, execute("--baseline", "add", consistentIDs));
-
- assertTrue(out.toString().contains("Changing BaselineTopology on inactive cluster is not allowed."));
-
- consistentIDs =
- getTestIgniteInstanceName(1) + ", " +
- getTestIgniteInstanceName(2) + "," +
- getTestIgniteInstanceName(3);
-
- assertEquals(EXIT_CODE_UNEXPECTED_ERROR, execute("--baseline", "add", consistentIDs));
-
- assertTrue(out.toString().contains("Node not found for consistent ID: bltTest2"));
- }
- finally {
- System.setOut(System.out);
- }
- }
-
- /**
* Test baseline remove works via control.sh
*
* @throws Exception If failed.
@@ -373,7 +369,7 @@ public class GridCommandHandlerTest extends GridCommonAbstractTest {
Ignite client = startGrid("client");
- IgniteCache<Object, Object> cache = client.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME)
+ client.getOrCreateCache(new CacheConfiguration<>(DEFAULT_CACHE_NAME)
.setAtomicityMode(TRANSACTIONAL).setWriteSynchronizationMode(FULL_SYNC));
for (Ignite ig : G.allGrids())
@@ -401,9 +397,9 @@ public class GridCommandHandlerTest extends GridCommonAbstractTest {
fail("Commit must fail");
}
- catch (Exception ignored) {
+ catch (Exception e) {
// No-op.
- assertTrue(X.hasCause(ignored, TransactionRollbackException.class));
+ assertTrue(X.hasCause(e, TransactionRollbackException.class));
}
break;
@@ -535,13 +531,245 @@ public class GridCommandHandlerTest extends GridCommonAbstractTest {
}
/**
+ * Test baseline add items works via control.sh
+ *
+ * @throws Exception If failed.
+ */
+ public void testBaselineAddOnNotActiveCluster() throws Exception {
+ Ignite ignite = startGrid(1);
+
+ assertFalse(ignite.cluster().active());
+
+ String consistentIDs = getTestIgniteInstanceName(1);
+
+ injectTestSystemOut();
+
+ assertEquals(EXIT_CODE_UNEXPECTED_ERROR, execute("--baseline", "add", consistentIDs));
+
+ assertTrue(testOut.toString().contains("Changing BaselineTopology on inactive cluster is not allowed."));
+
+ consistentIDs =
+ getTestIgniteInstanceName(1) + ", " +
+ getTestIgniteInstanceName(2) + "," +
+ getTestIgniteInstanceName(3);
+
+ assertEquals(EXIT_CODE_UNEXPECTED_ERROR, execute("--baseline", "add", consistentIDs));
+
+ assertTrue(testOut.toString().contains("Node not found for consistent ID: bltTest2"));
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testCacheHelp() throws Exception {
+ Ignite ignite = startGrids(1);
+
+ ignite.cluster().active(true);
+
+ injectTestSystemOut();
+
+ assertEquals(EXIT_CODE_OK, execute("--cache", "help"));
+
+ for (CacheCommand cmd : CacheCommand.values()) {
+ if (cmd != CacheCommand.HELP)
+ assertTrue(cmd.text(), testOut.toString().contains(cmd.text()));
+ }
+ }
+
+ /**
+ * @throws Exception If failed.
+ */
+ public void testCacheIdleVerify() throws Exception {
+ Ignite ignite = startGrids(2);
+
+ ignite.cluster().active(true);
+
+ IgniteCache<Object, Object> cache = ignite.createCache(new CacheConfiguration<>()
+ .setAffinity(new RendezvousAffinityFunction(false, 32))
+ .setBackups(1)
+ .setName("cacheIV"));
+
+ for (int i = 0; i < 100; i++)
+ cache.put(i, i);
+
+ injectTestSystemOut();
+
+ assertEquals(EXIT_CODE_OK, execute("--cache", "idle_verify"));
+
+ assertTrue(testOut.toString().contains("no conflicts have been found"));
+
+ HashSet<Integer> clearKeys = new HashSet<>(Arrays.asList(1, 2, 3, 4, 5, 6));
+
+ ((IgniteEx)ignite).context().cache().cache("cacheIV").clearLocallyAll(clearKeys, true, true, true);
+
+ assertEquals(EXIT_CODE_OK, execute("--cache", "idle_verify"));
+
+ assertTrue(testOut.toString().contains("conflict partitions"));
+ }
+
+ /**
+ *
+ */
+ public void testCacheContention() throws Exception {
+ int cnt = 10;
+
+ final ExecutorService svc = Executors.newFixedThreadPool(cnt);
+
+ try {
+ Ignite ignite = startGrids(2);
+
+ ignite.cluster().active(true);
+
+ final IgniteCache<Object, Object> cache = ignite.createCache(new CacheConfiguration<>()
+ .setAffinity(new RendezvousAffinityFunction(false, 32))
+ .setAtomicityMode(TRANSACTIONAL)
+ .setBackups(1)
+ .setName("cacheCont"));
+
+ final CountDownLatch l = new CountDownLatch(1);
+
+ final CountDownLatch l2 = new CountDownLatch(1);
+
+ svc.submit(new Runnable() {
+ @Override public void run() {
+ try (final Transaction tx = ignite.transactions().txStart()) {
+ cache.put(0, 0);
+
+ l.countDown();
+
+ U.awaitQuiet(l2);
+
+ tx.commit();
+ }
+ }
+ });
+
+ for (int i = 0; i < cnt - 1; i++) {
+ svc.submit(new Runnable() {
+ @Override public void run() {
+ U.awaitQuiet(l);
+
+ try (final Transaction tx = ignite.transactions().txStart()) {
+ cache.get(0);
+
+ tx.commit();
+ }
+ }
+ });
+ }
+
+ U.awaitQuiet(l);
+
+ Thread.sleep(300);
+
+ injectTestSystemOut();
+
+ assertEquals(EXIT_CODE_OK, execute("--cache", "contention", "5"));
+
+ l2.countDown();
+
+ assertTrue(testOut.toString().contains("TxEntry"));
+ assertTrue(testOut.toString().contains("op=READ"));
+ assertTrue(testOut.toString().contains("op=CREATE"));
+ assertTrue(testOut.toString().contains("id=" + ignite(0).cluster().localNode().id()));
+ assertTrue(testOut.toString().contains("id=" + ignite(1).cluster().localNode().id()));
+ }
+ finally {
+ svc.shutdown();
+ svc.awaitTermination(100, TimeUnit.DAYS);
+ }
+ }
+
+ /**
+ *
+ */
+ public void testCacheSequence() throws Exception {
+ Ignite ignite = startGrid();
+
+ ignite.cluster().active(true);
+
+ Ignite client = startGrid("client");
+
+ final IgniteAtomicSequence seq1 = client.atomicSequence("testSeq", 1, true);
+ seq1.get();
+
+ final IgniteAtomicSequence seq2 = client.atomicSequence("testSeq2", 10, true);
+ seq2.get();
+
+ injectTestSystemOut();
+
+ assertEquals(EXIT_CODE_OK, execute("--cache", "list", "testSeq.*", "seq"));
+
+ assertTrue(testOut.toString().contains("testSeq"));
+ assertTrue(testOut.toString().contains("testSeq2"));
+ }
+
+ /**
+ *
+ */
+ public void testCacheGroups() throws Exception {
+ Ignite ignite = startGrid();
+
+ ignite.cluster().active(true);
+
+ IgniteCache<Object, Object> cache1 = ignite.createCache(new CacheConfiguration<>()
+ .setAffinity(new RendezvousAffinityFunction(false, 32))
+ .setBackups(1)
+ .setGroupName("G100")
+ .setName("cacheG1"));
+
+ IgniteCache<Object, Object> cache2 = ignite.createCache(new CacheConfiguration<>()
+ .setAffinity(new RendezvousAffinityFunction(false, 32))
+ .setBackups(1)
+ .setGroupName("G100")
+ .setName("cacheG2"));
+
+ for (int i = 0; i < 100; i++) {
+ cache1.put(i, i);
+
+ cache2.put(i, i);
+ }
+
+ injectTestSystemOut();
+
+ assertEquals(EXIT_CODE_OK, execute("--cache", "list", ".*", "groups"));
+
+ assertTrue(testOut.toString().contains("G100"));
+ }
+
+ /**
+ *
+ */
+ public void testCacheAffinity() throws Exception {
+ Ignite ignite = startGrid();
+
+ ignite.cluster().active(true);
+
+ IgniteCache<Object, Object> cache1 = ignite.createCache(new CacheConfiguration<>()
+ .setAffinity(new RendezvousAffinityFunction(false, 32))
+ .setBackups(1)
+ .setName("cacheAf"));
+
+ for (int i = 0; i < 100; i++)
+ cache1.put(i, i);
+
+ injectTestSystemOut();
+
+ assertEquals(EXIT_CODE_OK, execute("--cache", "list", ".*"));
+
+ assertTrue(testOut.toString().contains("cacheName=cacheAf"));
+ assertTrue(testOut.toString().contains("prim=32"));
+ assertTrue(testOut.toString().contains("mapped=32"));
+ assertTrue(testOut.toString().contains("affCls=RendezvousAffinityFunction"));
+ }
+
+ /**
* @param h Handler.
* @param validateClo Validate clo.
* @param args Args.
*/
- private void validate(
- CommandHandler h, IgniteInClosure<Map<ClusterNode, VisorTxTaskResult>> validateClo, String... args)
- throws IgniteCheckedException {
+ private void validate(CommandHandler h, IgniteInClosure<Map<ClusterNode, VisorTxTaskResult>> validateClo,
+ String... args) {
assertEquals(EXIT_CODE_OK, execute(h, args));
validateClo.apply(h.getLastOperationResult());
[2/4] ignite git commit: IGNITE-8277 Added utilities to check and
display cache info
Posted by ag...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/indexing/src/main/java/org/apache/ignite/internal/visor/verify/ValidateIndexesClosure.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/visor/verify/ValidateIndexesClosure.java b/modules/indexing/src/main/java/org/apache/ignite/internal/visor/verify/ValidateIndexesClosure.java
new file mode 100644
index 0000000..373bd15
--- /dev/null
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/visor/verify/ValidateIndexesClosure.java
@@ -0,0 +1,356 @@
+/*
+* 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.verify;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.IgniteInterruptedException;
+import org.apache.ignite.IgniteLogger;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.cache.CacheGroupContext;
+import org.apache.ignite.internal.processors.cache.CacheObject;
+import org.apache.ignite.internal.processors.cache.CacheObjectContext;
+import org.apache.ignite.internal.processors.cache.CacheObjectUtils;
+import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
+import org.apache.ignite.internal.processors.cache.GridCacheContext;
+import org.apache.ignite.internal.processors.cache.KeyCacheObject;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
+import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtPartitionState;
+import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow;
+import org.apache.ignite.internal.processors.cache.verify.PartitionKey;
+import org.apache.ignite.internal.processors.query.GridQueryProcessor;
+import org.apache.ignite.internal.processors.query.QueryTypeDescriptorImpl;
+import org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing;
+import org.apache.ignite.internal.processors.query.h2.opt.GridH2Row;
+import org.apache.ignite.internal.processors.query.h2.opt.GridH2RowDescriptor;
+import org.apache.ignite.internal.processors.query.h2.opt.GridH2Table;
+import org.apache.ignite.internal.util.lang.GridIterator;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.resources.IgniteInstanceResource;
+import org.apache.ignite.resources.LoggerResource;
+import org.h2.engine.Session;
+import org.h2.index.Cursor;
+import org.h2.index.Index;
+
+/**
+ *
+ */
+public class ValidateIndexesClosure implements IgniteCallable<Map<PartitionKey, ValidateIndexesPartitionResult>> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Ignite. */
+ @IgniteInstanceResource
+ private transient IgniteEx ignite;
+
+ /** Injected logger. */
+ @LoggerResource
+ private IgniteLogger log;
+
+ /** Cache names. */
+ private Set<String> cacheNames;
+
+ /** Counter of processed partitions. */
+ private final AtomicInteger completionCntr = new AtomicInteger(0);
+
+ /** Calculation executor. */
+ private volatile ExecutorService calcExecutor;
+
+ /**
+ * @param cacheNames Cache names.
+ */
+ public ValidateIndexesClosure(Set<String> cacheNames) {
+ this.cacheNames = cacheNames;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Map<PartitionKey, ValidateIndexesPartitionResult> call() throws Exception {
+ calcExecutor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
+
+ try {
+ return call0();
+ }
+ finally {
+ calcExecutor.shutdown();
+ }
+ }
+
+ /**
+ *
+ */
+ private Map<PartitionKey, ValidateIndexesPartitionResult> call0() throws Exception {
+ Set<Integer> grpIds = new HashSet<>();
+
+ Set<String> missingCaches = new HashSet<>();
+
+ if (cacheNames != null) {
+ for (String cacheName : cacheNames) {
+ DynamicCacheDescriptor desc = ignite.context().cache().cacheDescriptor(cacheName);
+
+ if (desc == null) {
+ missingCaches.add(cacheName);
+
+ continue;
+ }
+
+ grpIds.add(desc.groupId());
+ }
+
+ if (!missingCaches.isEmpty()) {
+ StringBuilder strBuilder = new StringBuilder("The following caches do not exist: ");
+
+ for (String name : missingCaches)
+ strBuilder.append(name).append(", ");
+
+ strBuilder.delete(strBuilder.length() - 2, strBuilder.length());
+
+ throw new IgniteException(strBuilder.toString());
+ }
+ }
+ else {
+ Collection<CacheGroupContext> groups = ignite.context().cache().cacheGroups();
+
+ for (CacheGroupContext grp : groups) {
+ if (!grp.systemCache() && !grp.isLocal())
+ grpIds.add(grp.groupId());
+ }
+ }
+
+ List<Future<Map<PartitionKey, ValidateIndexesPartitionResult>>> procPartFutures = new ArrayList<>();
+
+ completionCntr.set(0);
+
+ for (Integer grpId : grpIds) {
+ CacheGroupContext grpCtx = ignite.context().cache().cacheGroup(grpId);
+
+ if (grpCtx == null)
+ continue;
+
+ List<GridDhtLocalPartition> parts = grpCtx.topology().localPartitions();
+
+ for (GridDhtLocalPartition part : parts)
+ procPartFutures.add(processPartitionAsync(grpCtx, part));
+ }
+
+ Map<PartitionKey, ValidateIndexesPartitionResult> res = new HashMap<>();
+
+ long lastProgressLogTs = U.currentTimeMillis();
+
+ for (int i = 0; i < procPartFutures.size(); ) {
+ Future<Map<PartitionKey, ValidateIndexesPartitionResult>> fut = procPartFutures.get(i);
+
+ try {
+ Map<PartitionKey, ValidateIndexesPartitionResult> partRes = fut.get(1, TimeUnit.SECONDS);
+
+ res.putAll(partRes);
+
+ i++;
+ }
+ catch (InterruptedException | ExecutionException e) {
+ for (int j = i + 1; j < procPartFutures.size(); j++)
+ procPartFutures.get(j).cancel(false);
+
+ if (e instanceof InterruptedException)
+ throw new IgniteInterruptedException((InterruptedException)e);
+ else if (e.getCause() instanceof IgniteException)
+ throw (IgniteException)e.getCause();
+ else
+ throw new IgniteException(e.getCause());
+ }
+ catch (TimeoutException ignored) {
+ if (U.currentTimeMillis() - lastProgressLogTs > 60 * 1000L) {
+ lastProgressLogTs = U.currentTimeMillis();
+
+ log.warning("ValidateIndexesClosure is still running, processed " + completionCntr.get() + " of " +
+ procPartFutures.size() + " local partitions");
+ }
+ }
+ }
+
+ return res;
+ }
+
+ /**
+ * @param grpCtx Group context.
+ * @param part Local partition.
+ */
+ private Future<Map<PartitionKey, ValidateIndexesPartitionResult>> processPartitionAsync(
+ final CacheGroupContext grpCtx,
+ final GridDhtLocalPartition part
+ ) {
+ return calcExecutor.submit(new Callable<Map<PartitionKey, ValidateIndexesPartitionResult>>() {
+ @Override public Map<PartitionKey, ValidateIndexesPartitionResult> call() throws Exception {
+ return processPartition(grpCtx, part);
+ }
+ });
+ }
+
+ /**
+ * @param grpCtx Group context.
+ * @param part Local partition.
+ */
+ private Map<PartitionKey, ValidateIndexesPartitionResult> processPartition(
+ CacheGroupContext grpCtx,
+ GridDhtLocalPartition part
+ ) {
+ if (!part.reserve())
+ return Collections.emptyMap();
+
+ ValidateIndexesPartitionResult partRes;
+
+ try {
+ if (part.state() != GridDhtPartitionState.OWNING)
+ return Collections.emptyMap();
+
+ long updateCntrBefore = part.updateCounter();
+
+ long partSize = part.dataStore().fullSize();
+
+ GridIterator<CacheDataRow> it = grpCtx.offheap().partitionIterator(part.id());
+
+ Object consId = ignite.context().discovery().localNode().consistentId();
+
+ boolean isPrimary = part.primary(grpCtx.topology().readyTopologyVersion());
+
+ partRes = new ValidateIndexesPartitionResult(updateCntrBefore, partSize, isPrimary, consId);
+
+ boolean enoughIssues = false;
+
+ long keysProcessed = 0;
+ long lastProgressLog = U.currentTimeMillis();
+
+ while (it.hasNextX()) {
+ if (enoughIssues)
+ break;
+
+ CacheDataRow row = it.nextX();
+
+ int cacheId = row.cacheId() == 0 ? grpCtx.groupId() : row.cacheId();
+
+ GridCacheContext cacheCtx = row.cacheId() == 0 ?
+ grpCtx.singleCacheContext() : grpCtx.shared().cacheContext(row.cacheId());
+
+ if (cacheCtx == null)
+ throw new IgniteException("Unknown cacheId of CacheDataRow: " + cacheId);
+
+ GridQueryProcessor qryProcessor = ignite.context().query();
+
+ try {
+ Method m = GridQueryProcessor.class.getDeclaredMethod("typeByValue", String.class,
+ CacheObjectContext.class, KeyCacheObject.class, CacheObject.class, boolean.class);
+
+ m.setAccessible(true);
+
+ QueryTypeDescriptorImpl res = (QueryTypeDescriptorImpl)m.invoke(
+ qryProcessor, cacheCtx.name(), cacheCtx.cacheObjectContext(), row.key(), row.value(), true);
+
+ if (res == null)
+ continue; // Tolerate - (k, v) is just not indexed.
+
+ IgniteH2Indexing indexing = (IgniteH2Indexing)qryProcessor.getIndexing();
+
+ GridH2Table gridH2Tbl = indexing.dataTable(cacheCtx.name(), res.tableName());
+
+ if (gridH2Tbl == null)
+ continue; // Tolerate - (k, v) is just not indexed.
+
+ GridH2RowDescriptor gridH2RowDesc = gridH2Tbl.rowDescriptor();
+
+ GridH2Row h2Row = gridH2RowDesc.createRow(row);
+
+ ArrayList<Index> indexes = gridH2Tbl.getIndexes();
+
+ for (Index idx : indexes) {
+ try {
+ Cursor cursor = idx.find((Session) null, h2Row, h2Row);
+
+ if (cursor == null || !cursor.next())
+ throw new IgniteCheckedException("Key not found.");
+ }
+ catch (Throwable t) {
+ Object o = CacheObjectUtils.unwrapBinaryIfNeeded(
+ grpCtx.cacheObjectContext(), row.key(), true, true);
+
+ IndexValidationIssue is = new IndexValidationIssue(
+ o.toString(), cacheCtx.name(), idx.getName(), t);
+
+ log.error("Failed to lookup key: " + is.toString());
+
+ enoughIssues |= partRes.reportIssue(is);
+ }
+ }
+ }
+ catch (IllegalAccessException | NoSuchMethodException e) {
+ log.error("Failed to invoke typeByValue", e);
+
+ throw new IgniteException(e);
+ }
+ catch (InvocationTargetException e) {
+ Throwable target = e.getTargetException();
+
+ log.error("Failed to invoke typeByValue", target);
+
+ throw new IgniteException(target);
+ }
+ finally {
+ keysProcessed++;
+
+ if (U.currentTimeMillis() - lastProgressLog >= 60_000 && partSize > 0) {
+ log.warning("Processing partition " + part.id() + " (" + (keysProcessed * 100 / partSize) +
+ "% " + keysProcessed + "/" + partSize + ")");
+
+ lastProgressLog = U.currentTimeMillis();
+ }
+ }
+ }
+ }
+ catch (IgniteCheckedException e) {
+ U.error(log, "Failed to process partition [grpId=" + grpCtx.groupId() +
+ ", partId=" + part.id() + "]", e);
+
+ return Collections.emptyMap();
+ }
+ finally {
+ part.release();
+ }
+
+ PartitionKey partKey = new PartitionKey(grpCtx.groupId(), part.id(), grpCtx.cacheOrGroupName());
+
+ completionCntr.incrementAndGet();
+
+ return Collections.singletonMap(partKey, partRes);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/indexing/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesTask.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesTask.java b/modules/indexing/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesTask.java
new file mode 100644
index 0000000..1a89c2c
--- /dev/null
+++ b/modules/indexing/src/main/java/org/apache/ignite/internal/visor/verify/VisorValidateIndexesTask.java
@@ -0,0 +1,99 @@
+/*
+* 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.verify;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.internal.processors.cache.verify.PartitionKey;
+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.VisorMultiNodeTask;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ *
+ */
+@GridInternal
+public class VisorValidateIndexesTask extends VisorMultiNodeTask<VisorValidateIndexesTaskArg,
+ VisorValidateIndexesTaskResult, VisorValidateIndexesJobResult> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Nullable @Override protected VisorValidateIndexesTaskResult reduce0(List<ComputeJobResult> list) throws IgniteException {
+ Map<UUID, Exception> exceptions = new HashMap<>();
+ Map<UUID, VisorValidateIndexesJobResult> jobResults = new HashMap<>();
+
+ for (ComputeJobResult res : list) {
+ if (res.getException() != null)
+ exceptions.put(res.getNode().id(), res.getException());
+ else
+ jobResults.put(res.getNode().id(), res.getData());
+ }
+
+ return new VisorValidateIndexesTaskResult(jobResults, exceptions);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected VisorJob<VisorValidateIndexesTaskArg, VisorValidateIndexesJobResult> job(VisorValidateIndexesTaskArg arg) {
+ return new VisorValidateIndexesJob(arg, debug);
+ }
+
+ /**
+ *
+ */
+ private static class VisorValidateIndexesJob extends VisorJob<VisorValidateIndexesTaskArg, VisorValidateIndexesJobResult> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * @param arg Argument.
+ * @param debug Debug.
+ */
+ protected VisorValidateIndexesJob(@Nullable VisorValidateIndexesTaskArg arg, boolean debug) {
+ super(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected VisorValidateIndexesJobResult run(@Nullable VisorValidateIndexesTaskArg arg) throws IgniteException {
+ try {
+ ValidateIndexesClosure clo = new ValidateIndexesClosure(arg.getCaches());
+
+ ignite.context().resource().injectGeneric(clo);
+
+ Map<PartitionKey, ValidateIndexesPartitionResult> res = clo.call();
+
+ return new VisorValidateIndexesJobResult(res);
+
+ }
+ catch (Exception e) {
+ throw new IgniteException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorValidateIndexesJob.class, this);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/indexing/src/test/java/org/apache/ignite/util/GridCommandHandlerIndexingTest.java
----------------------------------------------------------------------
diff --git a/modules/indexing/src/test/java/org/apache/ignite/util/GridCommandHandlerIndexingTest.java b/modules/indexing/src/test/java/org/apache/ignite/util/GridCommandHandlerIndexingTest.java
new file mode 100644
index 0000000..9e9c777
--- /dev/null
+++ b/modules/indexing/src/test/java/org/apache/ignite/util/GridCommandHandlerIndexingTest.java
@@ -0,0 +1,121 @@
+/*
+* 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.util;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ThreadLocalRandom;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.cache.CacheAtomicityMode;
+import org.apache.ignite.cache.CacheWriteSynchronizationMode;
+import org.apache.ignite.cache.QueryEntity;
+import org.apache.ignite.cache.QueryIndex;
+import org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction;
+import org.apache.ignite.configuration.CacheConfiguration;
+import org.apache.ignite.internal.util.typedef.F;
+
+import static org.apache.ignite.internal.commandline.CommandHandler.EXIT_CODE_OK;
+
+/**
+ *
+ */
+public class GridCommandHandlerIndexingTest extends GridCommandHandlerTest {
+ /**
+ *
+ */
+ public void testValidateIndexes() throws Exception {
+ Ignite ignite = startGrids(2);
+
+ ignite.cluster().active(true);
+
+ Ignite client = startGrid("client");
+
+ IgniteCache<Integer, Person> personCache = client.getOrCreateCache(new CacheConfiguration<Integer, Person>()
+ .setName("persons-cache-vi")
+ .setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC)
+ .setAtomicityMode(CacheAtomicityMode.ATOMIC)
+ .setBackups(1)
+ .setQueryEntities(F.asList(personEntity(true, true)))
+ .setAffinity(new RendezvousAffinityFunction(false, 32)));
+
+ ThreadLocalRandom rand = ThreadLocalRandom.current();
+
+ for (int i = 0; i < 1000; i++)
+ personCache.put(i, new Person(rand.nextInt(), String.valueOf(rand.nextLong())));
+
+ injectTestSystemOut();
+
+ assertEquals(EXIT_CODE_OK, execute("--cache", "validate_indexes", "persons-cache-vi"));
+
+ assertTrue(testOut.toString().contains("validate_indexes has finished, no issues found"));
+ }
+
+ /**
+ * @param idxName Index name.
+ * @param idxOrgId Index org id.
+ */
+ private QueryEntity personEntity(boolean idxName, boolean idxOrgId) {
+ QueryEntity entity = new QueryEntity();
+
+ entity.setKeyType(Integer.class.getName());
+ entity.setValueType(Person.class.getName());
+
+ entity.addQueryField("orgId", Integer.class.getName(), null);
+ entity.addQueryField("name", String.class.getName(), null);
+
+ List<QueryIndex> idxs = new ArrayList<>();
+
+ if (idxName) {
+ QueryIndex idx = new QueryIndex("name");
+
+ idxs.add(idx);
+ }
+
+ if (idxOrgId) {
+ QueryIndex idx = new QueryIndex("orgId");
+
+ idxs.add(idx);
+ }
+
+ entity.setIndexes(idxs);
+
+ return entity;
+ }
+
+ /**
+ *
+ */
+ private static class Person implements Serializable {
+ /** */
+ int orgId;
+
+ /** */
+ String name;
+
+ /**
+ * @param orgId Organization ID.
+ * @param name Name.
+ */
+ public Person(int orgId, String name) {
+ this.orgId = orgId;
+ this.name = name;
+ }
+ }
+}
[4/4] ignite git commit: IGNITE-8277 Added utilities to check and
display cache info
Posted by ag...@apache.org.
IGNITE-8277 Added utilities to check and display cache info
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b7fd0218
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b7fd0218
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b7fd0218
Branch: refs/heads/master
Commit: b7fd0218e617596b52bcfec2673dabd92dc07135
Parents: 1840f75
Author: Ivan Rakov <iv...@gmail.com>
Authored: Thu Apr 26 18:57:38 2018 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Thu Apr 26 19:47:40 2018 +0300
----------------------------------------------------------------------
.../ignite/internal/commandline/Arguments.java | 21 +-
.../ignite/internal/commandline/Command.java | 5 +-
.../internal/commandline/CommandHandler.java | 433 ++++++++++++++++++-
.../commandline/cache/CacheArguments.java | 163 +++++++
.../commandline/cache/CacheCommand.java | 93 ++++
.../processors/cache/verify/CacheInfo.java | 322 ++++++++++++++
.../cache/verify/ContentionClosure.java | 162 +++++++
.../processors/cache/verify/ContentionInfo.java | 72 +++
.../cache/verify/ViewCacheClosure.java | 185 ++++++++
.../visor/verify/IndexValidationIssue.java | 88 ++++
.../verify/ValidateIndexesPartitionResult.java | 145 +++++++
.../visor/verify/VisorContentionJobResult.java | 80 ++++
.../visor/verify/VisorContentionTask.java | 100 +++++
.../visor/verify/VisorContentionTaskArg.java | 84 ++++
.../visor/verify/VisorContentionTaskResult.java | 100 +++++
.../visor/verify/VisorIdleAnalyzeTask.java | 124 ++++++
.../visor/verify/VisorIdleAnalyzeTaskArg.java | 88 ++++
.../verify/VisorIdleAnalyzeTaskResult.java | 76 ++++
.../visor/verify/VisorIdleVerifyTask.java | 97 +++++
.../visor/verify/VisorIdleVerifyTaskArg.java | 74 ++++
.../visor/verify/VisorIdleVerifyTaskResult.java | 76 ++++
.../verify/VisorValidateIndexesJobResult.java | 73 ++++
.../verify/VisorValidateIndexesTaskArg.java | 74 ++++
.../verify/VisorValidateIndexesTaskResult.java | 88 ++++
.../visor/verify/VisorViewCacheCmd.java | 47 ++
.../visor/verify/VisorViewCacheTask.java | 75 ++++
.../visor/verify/VisorViewCacheTaskArg.java | 86 ++++
.../visor/verify/VisorViewCacheTaskResult.java | 74 ++++
.../resources/META-INF/classnames.properties | 114 ++++-
.../ignite/util/GridCommandHandlerTest.java | 312 +++++++++++--
.../visor/verify/ValidateIndexesClosure.java | 356 +++++++++++++++
.../visor/verify/VisorValidateIndexesTask.java | 99 +++++
.../util/GridCommandHandlerIndexingTest.java | 121 ++++++
33 files changed, 4026 insertions(+), 81 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/commandline/Arguments.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/commandline/Arguments.java b/modules/core/src/main/java/org/apache/ignite/internal/commandline/Arguments.java
index 83a272b..ce72693 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/commandline/Arguments.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/commandline/Arguments.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.commandline;
import org.apache.ignite.internal.client.GridClientConfiguration;
+import org.apache.ignite.internal.commandline.cache.CacheArguments;
import org.apache.ignite.internal.visor.tx.VisorTxTaskArg;
/**
@@ -62,6 +63,11 @@ public class Arguments {
private final VisorTxTaskArg txArg;
/**
+ * Arguments for --cache subcommand.
+ */
+ private CacheArguments cacheArgs;
+
+ /**
* @param cmd Command.
* @param host Host.
* @param port Port.
@@ -73,10 +79,11 @@ public class Arguments {
* @param force Force flag.
* @param pingTimeout Ping timeout. See {@link GridClientConfiguration#pingTimeout}.
* @param pingInterval Ping interval. See {@link GridClientConfiguration#pingInterval}.
+ * @param cacheArgs --cache subcommand arguments.
*/
- public Arguments(Command cmd, String host, String port, String user, String pwd,
- String baselineAct, String baselineArgs, long pingTimeout,
- long pingInterval, VisorTxTaskArg txArg, boolean force) {
+ public Arguments(Command cmd, String host, String port, String user, String pwd, String baselineAct,
+ String baselineArgs, long pingTimeout, long pingInterval, VisorTxTaskArg txArg, boolean force,
+ CacheArguments cacheArgs) {
this.cmd = cmd;
this.host = host;
this.port = port;
@@ -88,6 +95,7 @@ public class Arguments {
this.pingInterval = pingInterval;
this.force = force;
this.txArg = txArg;
+ this.cacheArgs = cacheArgs;
}
/**
@@ -170,4 +178,11 @@ public class Arguments {
public boolean force() {
return force;
}
+
+ /**
+ * @return Arguments for --cache subcommand.
+ */
+ public CacheArguments cacheArgs() {
+ return cacheArgs;
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/commandline/Command.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/commandline/Command.java b/modules/core/src/main/java/org/apache/ignite/internal/commandline/Command.java
index c8c7db5..52098d6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/commandline/Command.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/commandline/Command.java
@@ -34,7 +34,10 @@ public enum Command {
BASELINE("--baseline"),
/** */
- TX("--tx");
+ TX("--tx"),
+
+ /** */
+ CACHE("--cache");
/** */
private final String text;
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/commandline/CommandHandler.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/commandline/CommandHandler.java b/modules/core/src/main/java/org/apache/ignite/internal/commandline/CommandHandler.java
index 08488ea..ff05684 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/commandline/CommandHandler.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/commandline/CommandHandler.java
@@ -19,15 +19,19 @@ package org.apache.ignite.internal.commandline;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Collections;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
+import java.util.Set;
import java.util.UUID;
import java.util.logging.Logger;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
+import java.util.stream.Collectors;
import org.apache.ignite.cluster.ClusterNode;
import org.apache.ignite.internal.client.GridClient;
import org.apache.ignite.internal.client.GridClientAuthenticationException;
@@ -42,6 +46,12 @@ import org.apache.ignite.internal.client.GridClientHandshakeException;
import org.apache.ignite.internal.client.GridClientNode;
import org.apache.ignite.internal.client.GridServerUnreachableException;
import org.apache.ignite.internal.client.impl.connection.GridClientConnectionResetException;
+import org.apache.ignite.internal.commandline.cache.CacheArguments;
+import org.apache.ignite.internal.commandline.cache.CacheCommand;
+import org.apache.ignite.internal.processors.cache.verify.CacheInfo;
+import org.apache.ignite.internal.processors.cache.verify.ContentionInfo;
+import org.apache.ignite.internal.processors.cache.verify.PartitionHashRecord;
+import org.apache.ignite.internal.processors.cache.verify.PartitionKey;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.X;
import org.apache.ignite.internal.util.typedef.internal.U;
@@ -58,6 +68,20 @@ import org.apache.ignite.internal.visor.tx.VisorTxSortOrder;
import org.apache.ignite.internal.visor.tx.VisorTxTask;
import org.apache.ignite.internal.visor.tx.VisorTxTaskArg;
import org.apache.ignite.internal.visor.tx.VisorTxTaskResult;
+import org.apache.ignite.internal.visor.verify.IndexValidationIssue;
+import org.apache.ignite.internal.visor.verify.ValidateIndexesPartitionResult;
+import org.apache.ignite.internal.visor.verify.VisorContentionTask;
+import org.apache.ignite.internal.visor.verify.VisorContentionTaskArg;
+import org.apache.ignite.internal.visor.verify.VisorContentionTaskResult;
+import org.apache.ignite.internal.visor.verify.VisorIdleVerifyTask;
+import org.apache.ignite.internal.visor.verify.VisorIdleVerifyTaskArg;
+import org.apache.ignite.internal.visor.verify.VisorIdleVerifyTaskResult;
+import org.apache.ignite.internal.visor.verify.VisorValidateIndexesJobResult;
+import org.apache.ignite.internal.visor.verify.VisorValidateIndexesTaskArg;
+import org.apache.ignite.internal.visor.verify.VisorValidateIndexesTaskResult;
+import org.apache.ignite.internal.visor.verify.VisorViewCacheTask;
+import org.apache.ignite.internal.visor.verify.VisorViewCacheTaskArg;
+import org.apache.ignite.internal.visor.verify.VisorViewCacheTaskResult;
import org.apache.ignite.lang.IgniteClosure;
import org.apache.ignite.plugin.security.SecurityCredentials;
import org.apache.ignite.plugin.security.SecurityCredentialsBasicProvider;
@@ -66,6 +90,7 @@ import static org.apache.ignite.internal.IgniteVersionUtils.ACK_VER_STR;
import static org.apache.ignite.internal.IgniteVersionUtils.COPYRIGHT;
import static org.apache.ignite.internal.commandline.Command.ACTIVATE;
import static org.apache.ignite.internal.commandline.Command.BASELINE;
+import static org.apache.ignite.internal.commandline.Command.CACHE;
import static org.apache.ignite.internal.commandline.Command.DEACTIVATE;
import static org.apache.ignite.internal.commandline.Command.STATE;
import static org.apache.ignite.internal.commandline.Command.TX;
@@ -74,6 +99,8 @@ import static org.apache.ignite.internal.visor.baseline.VisorBaselineOperation.C
import static org.apache.ignite.internal.visor.baseline.VisorBaselineOperation.REMOVE;
import static org.apache.ignite.internal.visor.baseline.VisorBaselineOperation.SET;
import static org.apache.ignite.internal.visor.baseline.VisorBaselineOperation.VERSION;
+import static org.apache.ignite.internal.visor.verify.VisorViewCacheCmd.GROUPS;
+import static org.apache.ignite.internal.visor.verify.VisorViewCacheCmd.SEQ;
/**
* Class that execute several commands passed via command line.
@@ -103,6 +130,23 @@ public class CommandHandler {
/** */
private static final String CMD_USER = "--user";
+ /** Force option is used for auto confirmation. */
+ private static final String CMD_FORCE = "--force";
+
+ /** List of optional auxiliary commands. */
+ private static final Set<String> AUX_COMMANDS = new HashSet<>();
+ static {
+ AUX_COMMANDS.add(CMD_HELP);
+ AUX_COMMANDS.add(CMD_HOST);
+ AUX_COMMANDS.add(CMD_PORT);
+ AUX_COMMANDS.add(CMD_PASSWORD);
+ AUX_COMMANDS.add(CMD_USER);
+ AUX_COMMANDS.add(CMD_FORCE);
+ }
+
+ /** Broadcast uuid. */
+ private static final UUID BROADCAST_UUID = UUID.randomUUID();
+
/** */
protected static final String CMD_PING_INTERVAL = "--ping-interval";
@@ -130,9 +174,6 @@ public class CommandHandler {
/** */
private static final String DELIM = "--------------------------------------------------------------------------------";
- /** Force option is used for auto confirmation. */
- private static final String CMD_FORCE = "--force";
-
/** */
public static final int EXIT_CODE_OK = 0;
@@ -157,6 +198,9 @@ public class CommandHandler {
/** */
private static final Scanner IN = new Scanner(System.in);
+ /** Validate indexes task name. */
+ private static final String VALIDATE_INDEXES_TASK = "org.apache.ignite.internal.visor.verify.VisorValidateIndexesTask";
+
/** */
private static final String TX_LIMIT = "limit";
@@ -194,7 +238,7 @@ public class CommandHandler {
private String peekedArg;
/** */
- private Object lastOperationResult;
+ private Object lastOperationRes;
/**
* Output specified string to console.
@@ -279,16 +323,22 @@ public class CommandHandler {
switch (args.command()) {
case DEACTIVATE:
str = "Warning: the command will deactivate a cluster.";
+
break;
case BASELINE:
if (!BASELINE_COLLECT.equals(args.baselineAction()))
str = "Warning: the command will perform changes in baseline.";
+
break;
case TX:
if (args.transactionArguments().getOperation() == VisorTxOperation.KILL)
str = "Warning: the command will kill some transactions.";
+
+ break;
+
+ default:
break;
}
@@ -392,12 +442,52 @@ public class CommandHandler {
* @throws GridClientException If failed to execute task.
*/
private <R> R executeTask(GridClient client, Class<?> taskCls, Object taskArgs) throws GridClientException {
+ return executeTaskByNameOnNode(client, taskCls.getName(), taskArgs, null);
+ }
+
+ /**
+ * @param client Client
+ * @param taskClsName Task class name.
+ * @param taskArgs Task args.
+ * @param nodeId Node ID to execute task at (if null, random node will be chosen by balancer).
+ * @return Task result.
+ * @throws GridClientException If failed to execute task.
+ */
+ private <R> R executeTaskByNameOnNode(GridClient client, String taskClsName, Object taskArgs, UUID nodeId
+ ) throws GridClientException {
GridClientCompute compute = client.compute();
- GridClientNode node = getBalancedNode(compute);
+ if (nodeId == BROADCAST_UUID) {
+ Collection<GridClientNode> nodes = compute.nodes(GridClientNode::connectable);
+
+ if (F.isEmpty(nodes))
+ throw new GridClientDisconnectedException("Connectable nodes not found", null);
+
+ List<UUID> nodeIds = nodes.stream()
+ .map(GridClientNode::nodeId)
+ .collect(Collectors.toList());
+
+ return client.compute().execute(taskClsName, new VisorTaskArgument<>(nodeIds, taskArgs, false));
+ }
+
+ GridClientNode node = null;
+
+ if (nodeId == null)
+ node = getBalancedNode(compute);
+ else {
+ for (GridClientNode n : compute.nodes()) {
+ if (n.connectable() && nodeId.equals(n.nodeId())) {
+ node = n;
- return compute.execute(taskCls.getName(),
- new VisorTaskArgument<>(node.nodeId(), taskArgs, false));
+ break;
+ }
+ }
+
+ if (node == null)
+ throw new IllegalArgumentException("Node with id=" + nodeId + " not found");
+ }
+
+ return compute.projection(node).execute(taskClsName, new VisorTaskArgument<>(node.nodeId(), taskArgs, false));
}
/**
@@ -405,11 +495,7 @@ public class CommandHandler {
* @return balanced node
*/
private GridClientNode getBalancedNode(GridClientCompute compute) throws GridClientException {
- List<GridClientNode> nodes = new ArrayList<>();
-
- for (GridClientNode node : compute.nodes())
- if (node.connectable())
- nodes.add(node);
+ Collection<GridClientNode> nodes = compute.nodes(GridClientNode::connectable);
if (F.isEmpty(nodes))
throw new GridClientDisconnectedException("Connectable node not found", null);
@@ -418,6 +504,175 @@ public class CommandHandler {
}
/**
+ * Executes --cache subcommand.
+ *
+ * @param client Client.
+ * @param cacheArgs Cache args.
+ */
+ private void cache(GridClient client, CacheArguments cacheArgs) throws Throwable {
+ switch (cacheArgs.command()) {
+ case HELP:
+ printCacheHelp();
+
+ break;
+
+ case IDLE_VERIFY:
+ cacheIdleVerify(client, cacheArgs);
+
+ break;
+
+ case VALIDATE_INDEXES:
+ cacheValidateIndexes(client, cacheArgs);
+
+ break;
+
+ case CONTENTION:
+ cacheContention(client, cacheArgs);
+
+ break;
+
+ default:
+ cacheView(client, cacheArgs);
+
+ break;
+ }
+ }
+
+ /**
+ *
+ */
+ private void printCacheHelp() {
+ log("--cache subcommand allows to do the following operations:");
+
+ usage(" Show information about caches, groups or sequences that match a regex:", CACHE, " list regexPattern [groups|seq] [nodeId]");
+ usage(" Show hot keys that are point of contention for multiple transactions:", CACHE, " contention minQueueSize [nodeId] [maxPrint]");
+ usage(" Verify partition counters and hashes between primary and backups on idle cluster:", CACHE, " idle_verify [cache1,...,cacheN]");
+ usage(" Validate custom indexes on idle cluster:", CACHE, " validate_indexes [cache1,...,cacheN] [nodeId]");
+
+ log(" If [nodeId] is not specified, cont and validate_indexes commands will be broadcasted to all server nodes.");
+ log(" Another commands where [nodeId] is optional will run on a random server node.");
+ nl();
+ }
+
+ /**
+ * @param client Client.
+ * @param cacheArgs Cache args.
+ */
+ private void cacheContention(GridClient client, CacheArguments cacheArgs) throws GridClientException {
+ VisorContentionTaskArg taskArg = new VisorContentionTaskArg(
+ cacheArgs.minQueueSize(), cacheArgs.maxPrint());
+
+ UUID nodeId = cacheArgs.nodeId() == null ? BROADCAST_UUID : cacheArgs.nodeId();
+
+ VisorContentionTaskResult res = executeTaskByNameOnNode(
+ client, VisorContentionTask.class.getName(), taskArg, nodeId);
+
+ if (!F.isEmpty(res.exceptions())) {
+ log("Contention check failed on nodes:");
+
+ for (Map.Entry<UUID, Exception> e : res.exceptions().entrySet()) {
+ log("Node ID = " + e.getKey());
+
+ log("Exception message:");
+ log(e.getValue().getMessage());
+ nl();
+ }
+ }
+
+ for (ContentionInfo info : res.getInfos())
+ info.print();
+ }
+
+ /**
+ * @param client Client.
+ * @param cacheArgs Cache args.
+ */
+ private void cacheValidateIndexes(GridClient client, CacheArguments cacheArgs) throws GridClientException {
+ VisorValidateIndexesTaskArg taskArg = new VisorValidateIndexesTaskArg(cacheArgs.caches());
+
+ UUID nodeId = cacheArgs.nodeId() == null ? BROADCAST_UUID : cacheArgs.nodeId();
+
+ VisorValidateIndexesTaskResult taskRes = executeTaskByNameOnNode(
+ client, VALIDATE_INDEXES_TASK, taskArg, nodeId);
+
+ if (!F.isEmpty(taskRes.exceptions())) {
+ log("Index validation failed on nodes:");
+
+ for (Map.Entry<UUID, Exception> e : taskRes.exceptions().entrySet()) {
+ log("Node ID = " + e.getKey());
+
+ log("Exception message:");
+ log(e.getValue().getMessage());
+ nl();
+ }
+ }
+
+ boolean errors = false;
+
+ for (Map.Entry<UUID, VisorValidateIndexesJobResult> nodeEntry : taskRes.results().entrySet()) {
+ Map<PartitionKey, ValidateIndexesPartitionResult> map = nodeEntry.getValue().response();
+
+ for (Map.Entry<PartitionKey, ValidateIndexesPartitionResult> e : map.entrySet()) {
+ ValidateIndexesPartitionResult res = e.getValue();
+
+ if (!res.issues().isEmpty()) {
+ errors = true;
+
+ log(e.getKey().toString() + " " + e.getValue().toString());
+
+ for (IndexValidationIssue is : res.issues())
+ log(is.toString());
+ }
+ }
+ }
+
+ if (!errors)
+ log("validate_indexes has finished, no issues found.");
+ else
+ log("validate_indexes has finished with errors (listed above).");
+ }
+
+ /**
+ * @param client Client.
+ * @param cacheArgs Cache args.
+ */
+ private void cacheView(GridClient client, CacheArguments cacheArgs) throws GridClientException {
+ VisorViewCacheTaskArg taskArg = new VisorViewCacheTaskArg(cacheArgs.regex(), cacheArgs.cacheCommand());
+
+ VisorViewCacheTaskResult res = executeTaskByNameOnNode(
+ client, VisorViewCacheTask.class.getName(), taskArg, cacheArgs.nodeId());
+
+ for (CacheInfo info : res.cacheInfos())
+ info.print(cacheArgs.cacheCommand());
+ }
+
+ /**
+ * @param client Client.
+ * @param cacheArgs Cache args.
+ */
+ private void cacheIdleVerify(GridClient client, CacheArguments cacheArgs) throws GridClientException {
+ VisorIdleVerifyTaskResult res = executeTask(
+ client, VisorIdleVerifyTask.class, new VisorIdleVerifyTaskArg(cacheArgs.caches()));
+
+ Map<PartitionKey, List<PartitionHashRecord>> conflicts = res.getConflicts();
+
+ if (conflicts.isEmpty()) {
+ log("idle_verify check has finished, no conflicts have been found.");
+ nl();
+ }
+ else {
+ log ("idle_verify check has finished, found " + conflicts.size() + " conflict partitions.");
+ nl();
+
+ for (Map.Entry<PartitionKey, List<PartitionHashRecord>> entry : conflicts.entrySet()) {
+ log("Conflict partition: " + entry.getKey());
+
+ log("Partition instances: " + entry.getValue());
+ }
+ }
+ }
+
+ /**
* Change baseline.
*
* @param client Client.
@@ -508,7 +763,7 @@ public class CommandHandler {
Map<String, VisorBaselineNode> baseline = res.getBaseline();
- Map<String, VisorBaselineNode> servers = res.getServers();
+ Map<String, VisorBaselineNode> srvs = res.getServers();
if (F.isEmpty(baseline))
log("Baseline nodes not found.");
@@ -517,7 +772,7 @@ public class CommandHandler {
for(VisorBaselineNode node : baseline.values()) {
log(" ConsistentID=" + node.getConsistentId() + ", STATE=" +
- (servers.containsKey(node.getConsistentId()) ? "ONLINE" : "OFFLINE"));
+ (srvs.containsKey(node.getConsistentId()) ? "ONLINE" : "OFFLINE"));
}
log(DELIM);
@@ -527,7 +782,7 @@ public class CommandHandler {
List<VisorBaselineNode> others = new ArrayList<>();
- for (VisorBaselineNode node : servers.values()) {
+ for (VisorBaselineNode node : srvs.values()) {
if (!baseline.containsKey(node.getConsistentId()))
others.add(node);
}
@@ -645,7 +900,7 @@ public class CommandHandler {
try {
Map<ClusterNode, VisorTxTaskResult> res = executeTask(client, VisorTxTask.class, arg);
- lastOperationResult = res;
+ lastOperationRes = res;
if (res.isEmpty())
log("Nothing found.");
@@ -778,6 +1033,8 @@ public class CommandHandler {
boolean force = false;
+ CacheArguments cacheArgs = null;
+
List<Command> commands = new ArrayList<>();
initArgIterator(rawArgs);
@@ -824,6 +1081,13 @@ public class CommandHandler {
break;
+ case CACHE:
+ commands.add(CACHE);
+
+ cacheArgs = parseAndValidateCacheArgs();
+
+ break;
+
default:
throw new IllegalArgumentException("Unexpected command: " + str);
}
@@ -862,14 +1126,17 @@ public class CommandHandler {
case CMD_USER:
user = nextArg("Expected user name");
+
break;
case CMD_PASSWORD:
pwd = nextArg("Expected password");
+
break;
case CMD_FORCE:
force = true;
+
break;
default:
@@ -895,7 +1162,118 @@ public class CommandHandler {
throw new IllegalArgumentException("Both user and password should be specified");
return new Arguments(cmd, host, port, user, pwd, baselineAct, baselineArgs,
- pingTimeout, pingInterval, txArgs, force);
+ pingTimeout, pingInterval, txArgs, force, cacheArgs);
+ }
+
+ /**
+ * Parses and validates cache arguments.
+ *
+ * @return --cache subcommand arguments in case validation is successful.
+ */
+ private CacheArguments parseAndValidateCacheArgs() {
+ if (!hasNextCacheArg()) {
+ throw new IllegalArgumentException("Arguments are expected for --cache subcommand, " +
+ "run --cache help for more info.");
+ }
+
+ CacheArguments cacheArgs = new CacheArguments();
+
+ String str = nextArg("").toLowerCase();
+
+ CacheCommand cmd = CacheCommand.of(str);
+
+ if (cmd == null)
+ cmd = CacheCommand.HELP;
+
+ cacheArgs.command(cmd);
+
+ switch (cmd) {
+ case HELP:
+ break;
+
+ case IDLE_VERIFY:
+ parseCacheNamesIfPresent(cacheArgs);
+
+ break;
+
+ case CONTENTION:
+ cacheArgs.minQueueSize(Integer.parseInt(nextArg("Min queue size expected")));
+
+ if (hasNextCacheArg())
+ cacheArgs.nodeId(UUID.fromString(nextArg("")));
+
+ if (hasNextCacheArg())
+ cacheArgs.maxPrint(Integer.parseInt(nextArg("")));
+ else
+ cacheArgs.maxPrint(10);
+
+ break;
+
+ case VALIDATE_INDEXES:
+ parseCacheNamesIfPresent(cacheArgs);
+
+ if (hasNextCacheArg())
+ cacheArgs.nodeId(UUID.fromString(nextArg("")));
+
+ break;
+
+ default:
+ cacheArgs.regex(nextArg("Regex is expected"));
+
+ if (hasNextCacheArg()) {
+ String tmp = nextArg("");
+
+ switch (tmp) {
+ case "groups":
+ cacheArgs.cacheCommand(GROUPS);
+
+ break;
+
+ case "seq":
+ cacheArgs.cacheCommand(SEQ);
+
+ break;
+
+ default:
+ cacheArgs.nodeId(UUID.fromString(tmp));
+ }
+ }
+
+ break;
+ }
+
+ if (hasNextCacheArg())
+ throw new IllegalArgumentException("Unexpected argument of --cache subcommand: " + peekNextArg());
+
+ return cacheArgs;
+ }
+
+ /**
+ * @return <code>true</code> if there's next argument for --cache subcommand.
+ */
+ private boolean hasNextCacheArg() {
+ return hasNextArg() && Command.of(peekNextArg()) == null && !AUX_COMMANDS.contains(peekNextArg());
+ }
+
+ /**
+ * @param cacheArgs Cache args.
+ */
+ private void parseCacheNamesIfPresent(CacheArguments cacheArgs) {
+ if (hasNextCacheArg()) {
+ String cacheNames = nextArg("");
+
+ String[] cacheNamesArr = cacheNames.split(",");
+ Set<String> cacheNamesSet = new HashSet<>();
+
+ for (String cacheName : cacheNamesArr) {
+ if (F.isEmpty(cacheName))
+ throw new IllegalArgumentException("Non-empty cache names expected.");
+
+ cacheNamesSet.add(cacheName.trim());
+ }
+
+ cacheArgs.caches(cacheNamesSet);
+ }
}
/**
@@ -1002,7 +1380,7 @@ public class CommandHandler {
try {
Pattern.compile(lbRegex);
}
- catch (PatternSyntaxException e) {
+ catch (PatternSyntaxException ignored) {
throw new IllegalArgumentException("Illegal regex syntax");
}
@@ -1046,7 +1424,7 @@ public class CommandHandler {
return val;
}
- catch (NumberFormatException e) {
+ catch (NumberFormatException ignored) {
throw new IllegalArgumentException("Invalid value for " + lb + ": " + str);
}
}
@@ -1079,6 +1457,10 @@ public class CommandHandler {
"[minSize SIZE] [label PATTERN_REGEX] [servers|clients] " +
"[nodes consistentId1[,consistentId2,....,consistentIdN] [limit NUMBER] [order DURATION|SIZE] [kill] [--force]");
+ log("The utility has --cache subcommand to view and control state of caches in cluster.");
+ log(" More info: control.sh --cache help");
+ nl();
+
log("By default commands affecting the cluster require interactive confirmation. ");
log(" --force option can be used to execute commands without prompting for confirmation.");
nl();
@@ -1122,26 +1504,35 @@ public class CommandHandler {
}
try (GridClient client = GridClientFactory.start(cfg)) {
-
switch (args.command()) {
case ACTIVATE:
activate(client);
+
break;
case DEACTIVATE:
deactivate(client);
+
break;
case STATE:
state(client);
+
break;
case BASELINE:
baseline(client, args.baselineAction(), args.baselineArguments());
+
break;
case TX:
transactions(client, args.transactionArguments());
+
+ break;
+
+ case CACHE:
+ cache(client, args.cacheArgs());
+
break;
}
}
@@ -1177,7 +1568,7 @@ public class CommandHandler {
*/
@SuppressWarnings("unchecked")
public <T> T getLastOperationResult() {
- return (T)lastOperationResult;
+ return (T)lastOperationRes;
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/commandline/cache/CacheArguments.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/commandline/cache/CacheArguments.java b/modules/core/src/main/java/org/apache/ignite/internal/commandline/cache/CacheArguments.java
new file mode 100644
index 0000000..6f315ef
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/commandline/cache/CacheArguments.java
@@ -0,0 +1,163 @@
+/*
+* 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.commandline.cache;
+
+import java.util.Set;
+import java.util.UUID;
+import org.apache.ignite.internal.visor.verify.VisorViewCacheCmd;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ *
+ */
+public class CacheArguments {
+ /** Command. */
+ private CacheCommand cmd;
+
+ /** Caches. */
+ private Set<String> caches;
+
+ /** Partition id. */
+ private int partId;
+
+ /** Regex. */
+ private String regex;
+
+ /** Node id. */
+ private UUID nodeId;
+
+ /** Min queue size. */
+ private int minQueueSize;
+
+ /** Max print. */
+ private int maxPrint;
+
+ /** Cache view command. */
+ private @Nullable VisorViewCacheCmd cacheCmd;
+
+ /**
+ * @return Command.
+ */
+ public CacheCommand command() {
+ return cmd;
+ }
+
+ /**
+ * @return Cache view command.
+ */
+ @Nullable public VisorViewCacheCmd cacheCommand() {
+ return cacheCmd;
+ }
+
+ /**
+ * @param cmd Cache view command.
+ */
+ public void cacheCommand(VisorViewCacheCmd cmd) {
+ this.cacheCmd = cmd;
+ }
+
+ /**
+ * @param cmd New command.
+ */
+ public void command(CacheCommand cmd) {
+ this.cmd = cmd;
+ }
+
+ /**
+ * @return Caches.
+ */
+ public Set<String> caches() {
+ return caches;
+ }
+
+ /**
+ * @param caches New caches.
+ */
+ public void caches(Set<String> caches) {
+ this.caches = caches;
+ }
+
+ /**
+ * @return Partition id.
+ */
+ public int partitionId() {
+ return partId;
+ }
+
+ /**
+ * @param partId New partition id.
+ */
+ public void partitionId(int partId) {
+ this.partId = partId;
+ }
+
+ /**
+ * @return Regex.
+ */
+ public String regex() {
+ return regex;
+ }
+
+ /**
+ * @param regex New regex.
+ */
+ public void regex(String regex) {
+ this.regex = regex;
+ }
+
+ /**
+ * @return Node id.
+ */
+ public UUID nodeId() {
+ return nodeId;
+ }
+
+ /**
+ * @param nodeId New node id.
+ */
+ public void nodeId(UUID nodeId) {
+ this.nodeId = nodeId;
+ }
+
+ /**
+ * @return Min queue size.
+ */
+ public int minQueueSize() {
+ return minQueueSize;
+ }
+
+ /**
+ * @param minQueueSize New min queue size.
+ */
+ public void minQueueSize(int minQueueSize) {
+ this.minQueueSize = minQueueSize;
+ }
+
+ /**
+ * @return Max print.
+ */
+ public int maxPrint() {
+ return maxPrint;
+ }
+
+ /**
+ * @param maxPrint New max print.
+ */
+ public void maxPrint(int maxPrint) {
+ this.maxPrint = maxPrint;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/commandline/cache/CacheCommand.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/commandline/cache/CacheCommand.java b/modules/core/src/main/java/org/apache/ignite/internal/commandline/cache/CacheCommand.java
new file mode 100644
index 0000000..6aec6d7
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/commandline/cache/CacheCommand.java
@@ -0,0 +1,93 @@
+/*
+* 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.commandline.cache;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ *
+ */
+public enum CacheCommand {
+ /**
+ * Prints out help for the cache command.
+ */
+ HELP("help"),
+
+ /**
+ * Checks consistency of primary and backup partitions assuming no concurrent updates are happening in the cluster.
+ */
+ IDLE_VERIFY("idle_verify"),
+
+ /**
+ * Prints info regarding caches, groups or sequences.
+ */
+ LIST("list"),
+
+ /**
+ * Validates indexes attempting to read each indexed entry.
+ */
+ VALIDATE_INDEXES("validate_indexes"),
+
+ /**
+ * Prints info about contended keys (the keys concurrently locked from multiple transactions).
+ */
+ CONTENTION("contention");
+
+ /** Enumerated values. */
+ private static final CacheCommand[] VALS = values();
+
+ /** Name. */
+ private final String name;
+
+ /**
+ * @param name Name.
+ */
+ CacheCommand(String name) {
+ this.name = name;
+ }
+
+ /**
+ * @param text Command text.
+ * @return Command for the text.
+ */
+ public static CacheCommand of(String text) {
+ for (CacheCommand cmd : CacheCommand.values()) {
+ if (cmd.text().equalsIgnoreCase(text))
+ return cmd;
+ }
+
+ return null;
+ }
+
+ /**
+ * @return Name.
+ */
+ public String text() {
+ return name;
+ }
+
+ /**
+ * 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 CacheCommand fromOrdinal(int ord) {
+ return ord >= 0 && ord < VALS.length ? VALS[ord] : null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/CacheInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/CacheInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/CacheInfo.java
new file mode 100644
index 0000000..9a090a0
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/CacheInfo.java
@@ -0,0 +1,322 @@
+/*
+ * 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.verify;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.cache.CacheMode;
+import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion;
+import org.apache.ignite.internal.util.typedef.internal.S;
+import org.apache.ignite.internal.util.typedef.internal.U;
+import org.apache.ignite.internal.visor.VisorDataTransferObject;
+import org.apache.ignite.internal.visor.verify.VisorViewCacheCmd;
+
+/**
+ * Cache info DTO.
+ */
+public class CacheInfo extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Sequence name. */
+ private String seqName;
+
+ /** Sequence value. */
+ private long seqVal;
+
+ /** Cache name. */
+ private String cacheName;
+
+ /** Cache id. */
+ private int cacheId;
+
+ /** Group name. */
+ private String grpName;
+
+ /** Group id. */
+ private int grpId;
+
+ /** Caches count. */
+ private int cachesCnt;
+
+ /** Partitions. */
+ private int partitions;
+
+ /** Mapped. */
+ private int mapped;
+
+ /** Topology version. */
+ public AffinityTopologyVersion topVer;
+
+ /** Mode. */
+ private CacheMode mode;
+
+ /** Backups count. */
+ private int backupsCnt;
+
+ /** Affinity class name. */
+ private String affinityClsName;
+
+ /** */
+ public String getSeqName() {
+ return seqName;
+ }
+
+ /**
+ * @param seqName Sequence name.
+ */
+ public void setSeqName(String seqName) {
+ this.seqName = seqName;
+ }
+
+ /**
+ *
+ */
+ public String getCacheName() {
+ return cacheName;
+ }
+
+ /**
+ * @param cacheName Cache name.
+ */
+ public void setCacheName(String cacheName) {
+ this.cacheName = cacheName;
+ }
+
+ /**
+ *
+ */
+ public int getCacheId() {
+ return cacheId;
+ }
+
+ /**
+ * @param cacheId Cache id.
+ */
+ public void setCacheId(int cacheId) {
+ this.cacheId = cacheId;
+ }
+
+ /**
+ *
+ */
+ public String getGrpName() {
+ return grpName;
+ }
+
+ /**
+ * @param grpName Group name.
+ */
+ public void setGrpName(String grpName) {
+ this.grpName = grpName;
+ }
+
+ /**
+ *
+ */
+ public int getGrpId() {
+ return grpId;
+ }
+
+ /**
+ * @param grpId Group id.
+ */
+ public void setGrpId(int grpId) {
+ this.grpId = grpId;
+ }
+
+ /**
+ *
+ */
+ public int getCachesCnt() {
+ return cachesCnt;
+ }
+
+ /**
+ * @param cachesCnt Caches count.
+ */
+ public void setCachesCnt(int cachesCnt) {
+ this.cachesCnt = cachesCnt;
+ }
+
+ /**
+ *
+ */
+ public int getPartitions() {
+ return partitions;
+ }
+
+ /**
+ * @param partitions Partitions.
+ */
+ public void setPartitions(int partitions) {
+ this.partitions = partitions;
+ }
+
+ /**
+ *
+ */
+ public int getMapped() {
+ return mapped;
+ }
+
+ /**
+ * @param mapped Mapped.
+ */
+ public void setMapped(int mapped) {
+ this.mapped = mapped;
+ }
+
+ /**
+ *
+ */
+ public AffinityTopologyVersion getTopologyVersion() {
+ return topVer;
+ }
+
+ /**
+ * @param topologyVersion Topology version.
+ */
+ public void setTopologyVersion(AffinityTopologyVersion topologyVersion) {
+ this.topVer = topologyVersion;
+ }
+
+ /**
+ * @param seqVal Sequence value.
+ */
+ public void setSeqVal(long seqVal) {
+ this.seqVal = seqVal;
+ }
+
+ /**
+ *
+ */
+ public long getSeqVal() {
+ return seqVal;
+ }
+
+ /**
+ *
+ */
+ public CacheMode getMode() {
+ return mode;
+ }
+
+ /**
+ * @param mode Mode.
+ */
+ public void setMode(CacheMode mode) {
+ this.mode = mode;
+ }
+
+ /**
+ *
+ */
+ public int getBackupsCnt() {
+ return backupsCnt;
+ }
+
+ /**
+ * @param backupsCnt Backups count.
+ */
+ public void setBackupsCnt(int backupsCnt) {
+ this.backupsCnt = backupsCnt;
+ }
+
+ /**
+ *
+ */
+ public String getAffinityClsName() {
+ return affinityClsName;
+ }
+
+ /**
+ * @param affinityClsName Affinity class name.
+ */
+ public void setAffinityClsName(String affinityClsName) {
+ this.affinityClsName = affinityClsName;
+ }
+
+ /**
+ * @param cmd Command.
+ */
+ public void print(VisorViewCacheCmd cmd) {
+ if (cmd == null)
+ cmd = VisorViewCacheCmd.CACHES;
+
+ switch (cmd) {
+ case SEQ:
+ System.out.println("[seqName=" + getSeqName() + ", curVal=" + seqVal + ']');
+
+ break;
+
+ case GROUPS:
+ System.out.println("[grpName=" + getGrpName() + ", grpId=" + getGrpId() + ", cachesCnt=" + getCachesCnt() +
+ ", prim=" + getPartitions() + ", mapped=" + getMapped() + ", mode=" + getMode() +
+ ", backups=" + getBackupsCnt() + ", affCls=" + getAffinityClsName() + ']');
+
+ break;
+
+ default:
+ System.out.println("[cacheName=" + getCacheName() + ", cacheId=" + getCacheId() +
+ ", grpName=" + getGrpName() + ", grpId=" + getGrpId() + ", prim=" + getPartitions() +
+ ", mapped=" + getMapped() + ", mode=" + getMode() +
+ ", backups=" + getBackupsCnt() + ", affCls=" + getAffinityClsName() + ']');
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, seqName);
+ out.writeLong(seqVal);
+ U.writeString(out, cacheName);
+ out.writeInt(cacheId);
+ U.writeString(out, grpName);
+ out.writeInt(grpId);
+ out.writeInt(partitions);
+ out.writeInt(mapped);
+ out.writeObject(topVer);
+ U.writeEnum(out, mode);
+ out.writeInt(backupsCnt);
+ U.writeString(out, affinityClsName);
+ out.writeInt(cachesCnt);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ seqName = U.readString(in);
+ seqVal = in.readLong();
+ cacheName = U.readString(in);
+ cacheId = in.readInt();
+ grpName = U.readString(in);
+ grpId = in.readInt();
+ partitions = in.readInt();
+ mapped = in.readInt();
+ topVer = (AffinityTopologyVersion)in.readObject();
+ mode = CacheMode.fromOrdinal(in.readByte());
+ backupsCnt = in.readInt();
+ affinityClsName = U.readString(in);
+ cachesCnt = in.readInt();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(CacheInfo.class, this);
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/ContentionClosure.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/ContentionClosure.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/ContentionClosure.java
new file mode 100644
index 0000000..e97378e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/ContentionClosure.java
@@ -0,0 +1,162 @@
+/*
+ * 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.verify;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import org.apache.ignite.internal.IgniteEx;
+import org.apache.ignite.internal.processors.cache.GridCacheEntryEx;
+import org.apache.ignite.internal.processors.cache.GridCacheEntryRemovedException;
+import org.apache.ignite.internal.processors.cache.GridCacheMvccCandidate;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteInternalTx;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteTxEntry;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalState;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteTxState;
+import org.apache.ignite.internal.processors.cache.transactions.IgniteTxStateImpl;
+import org.apache.ignite.internal.util.typedef.internal.CU;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.resources.IgniteInstanceResource;
+
+/**
+ */
+public class ContentionClosure implements IgniteCallable<ContentionInfo> {
+ /** Serial version uid. */
+ private static final long serialVersionUID = 0L;
+
+ /** Ignite. */
+ @IgniteInstanceResource
+ protected transient IgniteEx ignite;
+
+ /** */
+ private int minQueueSize;
+
+ /** */
+ private int maxPrint;
+
+ /**
+ * @param minQueueSize Min candidate queue size to account.
+ * @param maxPrint Max entries to print.
+ */
+ public ContentionClosure(int minQueueSize, int maxPrint) {
+ this.minQueueSize = minQueueSize;
+ this.maxPrint = maxPrint;
+ }
+
+ /** {@inheritDoc} */
+ @Override public ContentionInfo call() throws Exception {
+ final IgniteTxManager tm = ignite.context().cache().context().tm();
+
+ final Collection<IgniteInternalTx> activeTxs = tm.activeTransactions();
+
+ ContentionInfo ci = new ContentionInfo();
+
+ ci.setNode(ignite.localNode());
+ ci.setEntries(new ArrayList<>());
+
+ for (IgniteInternalTx tx : activeTxs) {
+ if (ci.getEntries().size() == maxPrint)
+ break;
+
+ // Show only primary txs.
+ if (tx.local()) {
+ IgniteTxLocalAdapter tx0 = (IgniteTxLocalAdapter)tx;
+
+ final IgniteTxLocalState state0 = tx0.txState();
+
+ if (!(state0 instanceof IgniteTxStateImpl))
+ continue;
+
+ final IgniteTxStateImpl state = (IgniteTxStateImpl)state0;
+
+ final Collection<IgniteTxEntry> entries = state.allEntriesCopy();
+
+ IgniteTxEntry bad = null;
+
+ int qSize = 0;
+
+ for (IgniteTxEntry entry : entries) {
+ Collection<GridCacheMvccCandidate> locs;
+
+ GridCacheEntryEx cached = entry.cached();
+
+ while(true) {
+ try {
+ locs = cached.localCandidates();
+
+ break;
+ }
+ catch (GridCacheEntryRemovedException ignored) {
+ cached = entry.context().cache().entryEx(entry.key());
+ }
+ }
+
+ if (locs != null)
+ qSize += locs.size();
+
+ final Collection<GridCacheMvccCandidate> rmts = cached.remoteMvccSnapshot();
+
+ if (rmts != null)
+ qSize += rmts.size();
+
+ if (qSize >= minQueueSize) {
+ bad = entry;
+
+ break;
+ }
+ else
+ qSize = 0;
+ }
+
+ if (bad != null) {
+ StringBuilder b = new StringBuilder();
+
+ b.append("TxEntry [cacheId=").append(bad.cacheId()).
+ append(", key=").append(bad.key()).
+ append(", queue=").append(qSize).
+ append(", op=").append(bad.op()).
+ append(", val=").append(bad.value()).
+ append(", tx=").append(CU.txString(tx)).
+ append(", other=[");
+
+ final IgniteTxState st = tx.txState();
+
+ if (st instanceof IgniteTxStateImpl) {
+ IgniteTxStateImpl st0 = (IgniteTxStateImpl)st;
+
+ final Collection<IgniteTxEntry> cp = st0.allEntriesCopy();
+
+ for (IgniteTxEntry entry : cp) {
+ if (entry == bad)
+ continue;
+
+ b.append(entry.toString()).append('\n');
+ }
+ }
+
+ b.append("]]");
+
+ ci.getEntries().add(b.toString());
+ }
+ }
+ }
+
+ return ci;
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/ContentionInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/ContentionInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/ContentionInfo.java
new file mode 100644
index 0000000..c7bfbeb
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/ContentionInfo.java
@@ -0,0 +1,72 @@
+/*
+ * 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.verify;
+
+import java.io.Serializable;
+import java.util.List;
+import org.apache.ignite.cluster.ClusterNode;
+
+/**
+ */
+public class ContentionInfo implements Serializable {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** */
+ private ClusterNode node;
+
+ /** */
+ private List<String> entries;
+
+ /**
+ * @return Node.
+ */
+ public ClusterNode getNode() {
+ return node;
+ }
+
+ /**
+ * @param node Node.
+ */
+ public void setNode(ClusterNode node) {
+ this.node = node;
+ }
+
+ /**
+ * @return Entries.
+ */
+ public List<String> getEntries() {
+ return entries;
+ }
+
+ /**
+ * @param entries Entries.
+ */
+ public void setEntries(List<String> entries) {
+ this.entries = entries;
+ }
+
+ /** */
+ public void print() {
+ System.out.println("[node=" + node + ']');
+
+ for (String entry : entries)
+ System.out.println(" " + entry);
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/ViewCacheClosure.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/ViewCacheClosure.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/ViewCacheClosure.java
new file mode 100644
index 0000000..1f363f3
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/verify/ViewCacheClosure.java
@@ -0,0 +1,185 @@
+/*
+ * 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.verify;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+import javax.cache.Cache;
+import org.apache.ignite.Ignite;
+import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.cluster.ClusterGroup;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.GridKernalContext;
+import org.apache.ignite.internal.IgniteKernal;
+import org.apache.ignite.internal.processors.cache.CacheGroupContext;
+import org.apache.ignite.internal.processors.cache.DynamicCacheDescriptor;
+import org.apache.ignite.internal.processors.cache.IgniteInternalCache;
+import org.apache.ignite.internal.processors.datastructures.AtomicDataStructureValue;
+import org.apache.ignite.internal.processors.datastructures.DataStructureType;
+import org.apache.ignite.internal.processors.datastructures.DataStructuresProcessor;
+import org.apache.ignite.internal.processors.datastructures.GridCacheAtomicSequenceValue;
+import org.apache.ignite.internal.processors.datastructures.GridCacheInternalKey;
+import org.apache.ignite.internal.visor.verify.VisorViewCacheCmd;
+import org.apache.ignite.lang.IgniteCallable;
+import org.apache.ignite.resources.IgniteInstanceResource;
+
+/**
+ * View cache closure.
+ */
+public class ViewCacheClosure implements IgniteCallable<List<CacheInfo>> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Regex. */
+ private String regex;
+
+ /** {@code true} to skip cache destroying. */
+ private VisorViewCacheCmd cmd;
+
+ @IgniteInstanceResource
+ private Ignite ignite;
+
+ /**
+ * @param regex Regex name for stopping caches.
+ * @param cmd Command.
+ */
+ public ViewCacheClosure(String regex, VisorViewCacheCmd cmd) {
+ this.regex = regex;
+ this.cmd = cmd;
+ }
+
+ /** {@inheritDoc} */
+ @Override public List<CacheInfo> call() throws Exception {
+ Pattern compiled = Pattern.compile(regex);
+
+ List<CacheInfo> cacheInfo = new ArrayList<>();
+
+ IgniteKernal k = (IgniteKernal)ignite;
+
+ if (cmd == null)
+ cmd = VisorViewCacheCmd.CACHES;
+
+ switch (cmd) {
+ case SEQ:
+ collectSequences(k.context(), compiled, cacheInfo);
+
+ return cacheInfo;
+
+ case GROUPS:
+ Collection<CacheGroupContext> contexts = k.context().cache().cacheGroups();
+
+ for (CacheGroupContext context : contexts) {
+ if (!compiled.matcher(context.cacheOrGroupName()).find())
+ continue;
+
+ CacheInfo ci = new CacheInfo();
+ ci.setGrpName(context.cacheOrGroupName());
+ ci.setGrpId(context.groupId());
+ ci.setCachesCnt(context.caches().size());
+ ci.setPartitions(context.config().getAffinity().partitions());
+ ci.setBackupsCnt(context.config().getBackups());
+ ci.setAffinityClsName(context.config().getAffinity().getClass().getSimpleName());
+ ci.setMode(context.config().getCacheMode());
+ ci.setMapped(mapped(context.caches().iterator().next().name()));
+
+ cacheInfo.add(ci);
+ }
+
+ return cacheInfo;
+
+ default:
+ Map<String, DynamicCacheDescriptor> descMap = k.context().cache().cacheDescriptors();
+
+ for (Map.Entry<String, DynamicCacheDescriptor> entry : descMap.entrySet()) {
+
+ DynamicCacheDescriptor desc = entry.getValue();
+
+ if (!compiled.matcher(desc.cacheName()).find())
+ continue;
+
+ CacheInfo ci = new CacheInfo();
+
+ ci.setCacheName(desc.cacheName());
+ ci.setCacheId(desc.cacheId());
+ ci.setGrpName(desc.groupDescriptor().groupName());
+ ci.setGrpId(desc.groupDescriptor().groupId());
+ ci.setPartitions(desc.cacheConfiguration().getAffinity().partitions());
+ ci.setBackupsCnt(desc.cacheConfiguration().getBackups());
+ ci.setAffinityClsName(desc.cacheConfiguration().getAffinity().getClass().getSimpleName());
+ ci.setMode(desc.cacheConfiguration().getCacheMode());
+ ci.setMapped(mapped(desc.cacheName()));
+
+ cacheInfo.add(ci);
+ }
+
+ return cacheInfo;
+ }
+ }
+
+ /**
+ * @param cacheName Cache name.
+ */
+ private int mapped(String cacheName) {
+ int mapped = 0;
+
+ ClusterGroup srvs = ignite.cluster().forServers();
+
+ Collection<ClusterNode> nodes = srvs.forDataNodes(cacheName).nodes();
+
+ for (ClusterNode node : nodes)
+ mapped += ignite.affinity(cacheName).primaryPartitions(node).length;
+
+ return mapped;
+ }
+
+ /**
+ * @param ctx Context.
+ * @param compiled Compiled pattern.
+ * @param cacheInfo Cache info.
+ */
+ private void collectSequences(GridKernalContext ctx, Pattern compiled, List<CacheInfo> cacheInfo) throws IgniteCheckedException {
+ String dsCacheName = DataStructuresProcessor.ATOMICS_CACHE_NAME + "@default-ds-group";
+
+ IgniteInternalCache<GridCacheInternalKey, AtomicDataStructureValue> cache0 = ctx.cache().cache(dsCacheName);
+
+ final Iterator<Cache.Entry<GridCacheInternalKey, AtomicDataStructureValue>> iter = cache0.scanIterator(false, null);
+
+ while (iter.hasNext()) {
+ Cache.Entry<GridCacheInternalKey, AtomicDataStructureValue> entry = iter.next();
+
+ final AtomicDataStructureValue val = entry.getValue();
+
+ if (val.type() == DataStructureType.ATOMIC_SEQ) {
+ final String name = entry.getKey().name();
+
+ if (compiled.matcher(name).find()) {
+ CacheInfo ci = new CacheInfo();
+ ci.setSeqName(name);
+ ci.setSeqVal(((GridCacheAtomicSequenceValue)val).get());
+
+ cacheInfo.add(ci);
+ }
+
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/IndexValidationIssue.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/IndexValidationIssue.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/IndexValidationIssue.java
new file mode 100644
index 0000000..37f9360
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/IndexValidationIssue.java
@@ -0,0 +1,88 @@
+/*
+ * 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.verify;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+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;
+
+/**
+ *
+ */
+public class IndexValidationIssue extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Key. */
+ private String key;
+
+ /** Cache name. */
+ private String cacheName;
+
+ /** Index name. */
+ private String idxName;
+
+ /** T. */
+ @GridToStringExclude
+ private Throwable t;
+
+ /**
+ *
+ */
+ public IndexValidationIssue() {
+ // Default constructor required for Externalizable.
+ }
+
+ /**
+ * @param key Key.
+ * @param cacheName Cache name.
+ * @param idxName Index name.
+ * @param t T.
+ */
+ public IndexValidationIssue(String key, String cacheName, String idxName, Throwable t) {
+ this.key = key;
+ this.cacheName = cacheName;
+ this.idxName = idxName;
+ this.t = t;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeString(out, key);
+ U.writeString(out, cacheName);
+ U.writeString(out, idxName);
+ out.writeObject(t);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ key = U.readString(in);
+ cacheName = U.readString(in);
+ idxName = U.readString(in);
+ t = (Throwable)in.readObject();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(IndexValidationIssue.class, this) + ", " + t.getClass() + ": " + t.getMessage();
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/ValidateIndexesPartitionResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/ValidateIndexesPartitionResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/ValidateIndexesPartitionResult.java
new file mode 100644
index 0000000..1889960
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/ValidateIndexesPartitionResult.java
@@ -0,0 +1,145 @@
+/*
+* 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.verify;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.tostring.GridToStringInclude;
+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;
+
+/**
+ *
+ */
+public class ValidateIndexesPartitionResult extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Update counter. */
+ private long updateCntr;
+
+ /** Size. */
+ private long size;
+
+ /** Is primary. */
+ private boolean isPrimary;
+
+ /** Consistent id. */
+ @GridToStringInclude
+ private Object consistentId;
+
+ /** Issues. */
+ @GridToStringExclude
+ private List<IndexValidationIssue> issues = new ArrayList<>(10);
+
+ /**
+ *
+ */
+ public ValidateIndexesPartitionResult() {
+ // Empty constructor required for Externalizable.
+ }
+
+ /**
+ * @param updateCntr Update counter.
+ * @param size Size.
+ * @param isPrimary Is primary.
+ * @param consistentId Consistent id.
+ */
+ public ValidateIndexesPartitionResult(long updateCntr, long size, boolean isPrimary, Object consistentId) {
+ this.updateCntr = updateCntr;
+ this.size = size;
+ this.isPrimary = isPrimary;
+ this.consistentId = consistentId;
+ }
+
+ /**
+ *
+ */
+ public long updateCntr() {
+ return updateCntr;
+ }
+
+ /**
+ *
+ */
+ public long size() {
+ return size;
+ }
+
+ /**
+ *
+ */
+ public boolean primary() {
+ return isPrimary;
+ }
+
+ /**
+ *
+ */
+ public Object consistentId() {
+ return consistentId;
+ }
+
+ /**
+ *
+ */
+ public List<IndexValidationIssue> issues() {
+ return issues;
+ }
+
+ /**
+ * @param t Issue.
+ * @return True if there are already enough issues.
+ */
+ public boolean reportIssue(IndexValidationIssue t) {
+ if (issues.size() >= 10)
+ return true;
+
+ issues.add(t);
+
+ return false;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeLong(updateCntr);
+ out.writeLong(size);
+ out.writeBoolean(isPrimary);
+ out.writeObject(consistentId);
+ U.writeCollection(out, issues);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ updateCntr = in.readLong();
+ size = in.readLong();
+ isPrimary = in.readBoolean();
+ consistentId = in.readObject();
+ issues = U.readList(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(ValidateIndexesPartitionResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorContentionJobResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorContentionJobResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorContentionJobResult.java
new file mode 100644
index 0000000..4272244
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorContentionJobResult.java
@@ -0,0 +1,80 @@
+/*
+* 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.verify;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.List;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.processors.cache.verify.ContentionInfo;
+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;
+
+/**
+ *
+ */
+public class VisorContentionJobResult extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Info. */
+ private ContentionInfo info;
+
+ /**
+ * @param info Info.
+ */
+ public VisorContentionJobResult(ContentionInfo info) {
+ this.info = info;
+ }
+
+ /**
+ * For externalization only.
+ */
+ public VisorContentionJobResult() {
+ }
+
+ /**
+ * @return Contention info.
+ */
+ public ContentionInfo info() {
+ return info;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeObject(info.getNode());
+ U.writeCollection(out, info.getEntries());
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ Object node = in.readObject();
+ List<String> entries = U.readList(in);
+
+ info = new ContentionInfo();
+ info.setNode((ClusterNode)node);
+ info.setEntries(entries);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorContentionJobResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorContentionTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorContentionTask.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorContentionTask.java
new file mode 100644
index 0000000..4e7e12c
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorContentionTask.java
@@ -0,0 +1,100 @@
+/*
+* 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.verify;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import org.apache.ignite.IgniteException;
+import org.apache.ignite.compute.ComputeJobResult;
+import org.apache.ignite.internal.processors.cache.verify.ContentionClosure;
+import org.apache.ignite.internal.processors.cache.verify.ContentionInfo;
+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.VisorMultiNodeTask;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ *
+ */
+@GridInternal
+public class VisorContentionTask extends VisorMultiNodeTask<VisorContentionTaskArg,
+ VisorContentionTaskResult, VisorContentionJobResult> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** {@inheritDoc} */
+ @Nullable @Override protected VisorContentionTaskResult reduce0(List<ComputeJobResult> list) throws IgniteException {
+ Map<UUID, Exception> exceptions = new HashMap<>();
+ List<VisorContentionJobResult> infos = new ArrayList<>();
+
+ for (ComputeJobResult res : list) {
+ if (res.getException() != null)
+ exceptions.put(res.getNode().id(), res.getException());
+ else
+ infos.add(res.getData());
+ }
+
+ return new VisorContentionTaskResult(infos, exceptions);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected VisorJob<VisorContentionTaskArg, VisorContentionJobResult> job(VisorContentionTaskArg arg) {
+ return new VisorContentionJob(arg, debug);
+ }
+
+ /**
+ *
+ */
+ private static class VisorContentionJob extends VisorJob<VisorContentionTaskArg, VisorContentionJobResult> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * @param arg Argument.
+ * @param debug Debug.
+ */
+ protected VisorContentionJob(@Nullable VisorContentionTaskArg arg, boolean debug) {
+ super(arg, debug);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected VisorContentionJobResult run(@Nullable VisorContentionTaskArg arg) throws IgniteException {
+ try {
+ ContentionClosure clo = new ContentionClosure(arg.minQueueSize(), arg.maxPrint());
+
+ ignite.context().resource().injectGeneric(clo);
+
+ ContentionInfo info = clo.call();
+
+ return new VisorContentionJobResult(info);
+ }
+ catch (Exception e) {
+ throw new IgniteException(e);
+ }
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorContentionJob.class, this);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorContentionTaskArg.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorContentionTaskArg.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorContentionTaskArg.java
new file mode 100644
index 0000000..ecfc9d8
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorContentionTaskArg.java
@@ -0,0 +1,84 @@
+/*
+* 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.verify;
+
+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.visor.VisorDataTransferObject;
+
+/**
+ *
+ */
+public class VisorContentionTaskArg extends VisorDataTransferObject {
+ /** */
+ private static final long serialVersionUID = 0L;
+
+ /** Min queue size. */
+ private int minQueueSize;
+
+ /** Max print size. */
+ private int maxPrint;
+
+ /**
+ * @param minQueueSize Min queue size.
+ * @param maxPrint Max print.
+ */
+ public VisorContentionTaskArg(int minQueueSize, int maxPrint) {
+ this.minQueueSize = minQueueSize;
+ this.maxPrint = maxPrint;
+ }
+
+ /**
+ * For externalization only.
+ */
+ public VisorContentionTaskArg() {
+ }
+
+ /**
+ * @return Min queue size.
+ */
+ public int minQueueSize() {
+ return minQueueSize;
+ }
+
+ /**
+ * @return Max print size.
+ */
+ public int maxPrint() {
+ return maxPrint;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ out.writeInt(minQueueSize);
+ out.writeInt(maxPrint);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in) throws IOException, ClassNotFoundException {
+ minQueueSize = in.readInt();
+ maxPrint = in.readInt();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorContentionTaskArg.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b7fd0218/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorContentionTaskResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorContentionTaskResult.java b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorContentionTaskResult.java
new file mode 100644
index 0000000..5c452ca
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/visor/verify/VisorContentionTaskResult.java
@@ -0,0 +1,100 @@
+/*
+* 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.verify;
+
+import java.io.IOException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.stream.Collectors;
+import org.apache.ignite.internal.processors.cache.verify.ContentionInfo;
+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;
+
+/**
+ *
+ */
+public class VisorContentionTaskResult extends VisorDataTransferObject {
+ /** Serial version uid. */
+ private static final long serialVersionUID = 0L;
+
+ /** Cluster infos. */
+ private List<VisorContentionJobResult> clusterInfos;
+
+ /** Exceptions. */
+ private Map<UUID, Exception> exceptions;
+
+ /**
+ * @param clusterInfos Cluster infos.
+ * @param exceptions Exceptions.
+ */
+ public VisorContentionTaskResult(List<VisorContentionJobResult> clusterInfos,
+ Map<UUID, Exception> exceptions) {
+ this.clusterInfos = clusterInfos;
+ this.exceptions = exceptions;
+ }
+
+ /**
+ * For externalization only.
+ */
+ public VisorContentionTaskResult() {
+ }
+
+ /**
+ * @return Cluster infos.
+ */
+ public Collection<VisorContentionJobResult> jobResults() {
+ return clusterInfos;
+ }
+
+ /**
+ * @return Collection of {@link ContentionInfo} collected during task execution.
+ */
+ public Collection<ContentionInfo> getInfos() {
+ return clusterInfos.stream().map(VisorContentionJobResult::info).collect(Collectors.toList());
+ }
+
+ /**
+ * @return Exceptions.
+ */
+ public Map<UUID, Exception> exceptions() {
+ return exceptions;
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void writeExternalData(ObjectOutput out) throws IOException {
+ U.writeCollection(out, clusterInfos);
+ U.writeMap(out, exceptions);
+ }
+
+ /** {@inheritDoc} */
+ @Override protected void readExternalData(byte protoVer, ObjectInput in
+ ) throws IOException, ClassNotFoundException {
+ clusterInfos = U.readList(in);
+ exceptions = U.readMap(in);
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(VisorContentionTaskResult.class, this);
+ }
+}