Search in sources :

Example 1 with VisorIdleVerifyTaskV2

use of org.apache.ignite.internal.visor.verify.VisorIdleVerifyTaskV2 in project ignite by apache.

the class GridCommonAbstractTest method idleVerify.

/**
 * Compares checksums between primary and backup partitions of specified caches.
 * Works properly only on idle cluster - there may be false positive conflict reports if data in cluster is being
 * concurrently updated.
 *
 * @param ig Ignite instance.
 * @param caches Cache names (if null, all user caches will be verified).
 * @return Conflicts result.
 * @throws IgniteException If none caches or node found.
 */
protected IdleVerifyResultV2 idleVerify(Ignite ig, @Nullable String... caches) {
    log.info("Starting idleVerify ...");
    IgniteEx ig0 = (IgniteEx) ig;
    Set<String> cacheNames = new HashSet<>();
    if (F.isEmpty(caches))
        cacheNames.addAll(ig0.cacheNames());
    else
        Collections.addAll(cacheNames, caches);
    if (cacheNames.isEmpty())
        throw new IgniteException("None cache for checking.");
    ClusterNode node = !ig0.localNode().isClient() ? ig0.localNode() : ig0.cluster().forServers().forRandom().node();
    if (node == null)
        throw new IgniteException("None server node for verification.");
    VisorIdleVerifyTaskArg taskArg = new VisorIdleVerifyTaskArg(cacheNames);
    return ig.compute().execute(VisorIdleVerifyTaskV2.class.getName(), new VisorTaskArgument<>(node.id(), taskArg, false));
}
Also used : ClusterNode(org.apache.ignite.cluster.ClusterNode) IgniteException(org.apache.ignite.IgniteException) IgniteEx(org.apache.ignite.internal.IgniteEx) VisorIdleVerifyTaskArg(org.apache.ignite.internal.visor.verify.VisorIdleVerifyTaskArg) VisorIdleVerifyTaskV2(org.apache.ignite.internal.visor.verify.VisorIdleVerifyTaskV2) HashSet(java.util.HashSet)

Aggregations

HashSet (java.util.HashSet)1 IgniteException (org.apache.ignite.IgniteException)1 ClusterNode (org.apache.ignite.cluster.ClusterNode)1 IgniteEx (org.apache.ignite.internal.IgniteEx)1 VisorIdleVerifyTaskArg (org.apache.ignite.internal.visor.verify.VisorIdleVerifyTaskArg)1 VisorIdleVerifyTaskV2 (org.apache.ignite.internal.visor.verify.VisorIdleVerifyTaskV2)1