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());
