Search in sources :

Example 6 with VisorValidateIndexesJobResult

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

the class CacheValidateIndexes method execute.

/**
 * {@inheritDoc}
 */
@Override
public Object execute(GridClientConfiguration clientCfg, Logger logger) throws Exception {
    VisorValidateIndexesTaskArg taskArg = new VisorValidateIndexesTaskArg(args.caches(), args.nodeId() != null ? Collections.singleton(args.nodeId()) : null, args.checkFirst(), args.checkThrough(), args.checkCrc(), args.checkSizes());
    try (GridClient client = Command.startClient(clientCfg)) {
        VisorValidateIndexesTaskResult taskRes = executeTaskByNameOnNode(client, "org.apache.ignite.internal.visor.verify.VisorValidateIndexesTask", taskArg, null, clientCfg);
        boolean errors = CommandLogger.printErrors(taskRes.exceptions(), "Index validation failed on nodes:", logger);
        for (Entry<UUID, VisorValidateIndexesJobResult> nodeEntry : taskRes.results().entrySet()) {
            VisorValidateIndexesJobResult jobRes = nodeEntry.getValue();
            if (!jobRes.hasIssues())
                continue;
            errors = true;
            logger.info("Index issues found on node " + nodeEntry.getKey() + ":");
            for (IndexIntegrityCheckIssue is : jobRes.integrityCheckFailures()) logger.info(INDENT + is);
            for (Entry<PartitionKey, ValidateIndexesPartitionResult> e : jobRes.partitionResult().entrySet()) {
                ValidateIndexesPartitionResult res = e.getValue();
                if (!res.issues().isEmpty()) {
                    logger.info(INDENT + join(" ", e.getKey(), e.getValue()));
                    for (IndexValidationIssue is : res.issues()) logger.info(DOUBLE_INDENT + is);
                }
            }
            for (Entry<String, ValidateIndexesPartitionResult> e : jobRes.indexResult().entrySet()) {
                ValidateIndexesPartitionResult res = e.getValue();
                if (!res.issues().isEmpty()) {
                    logger.info(INDENT + join(" ", "SQL Index", e.getKey(), e.getValue()));
                    for (IndexValidationIssue is : res.issues()) logger.info(DOUBLE_INDENT + is);
                }
            }
            for (Entry<String, ValidateIndexesCheckSizeResult> e : jobRes.checkSizeResult().entrySet()) {
                ValidateIndexesCheckSizeResult res = e.getValue();
                Collection<ValidateIndexesCheckSizeIssue> issues = res.issues();
                if (issues.isEmpty())
                    continue;
                logger.info(INDENT + join(" ", "Size check", e.getKey(), res));
                for (ValidateIndexesCheckSizeIssue issue : issues) logger.info(DOUBLE_INDENT + issue);
            }
        }
        if (!errors)
            logger.info("no issues found.");
        else
            logger.severe("issues found (listed above).");
        logger.info("");
        return taskRes;
    }
}
Also used : IndexValidationIssue(org.apache.ignite.internal.visor.verify.IndexValidationIssue) GridClient(org.apache.ignite.internal.client.GridClient) ValidateIndexesCheckSizeIssue(org.apache.ignite.internal.visor.verify.ValidateIndexesCheckSizeIssue) VisorValidateIndexesJobResult(org.apache.ignite.internal.visor.verify.VisorValidateIndexesJobResult) IndexIntegrityCheckIssue(org.apache.ignite.internal.visor.verify.IndexIntegrityCheckIssue) PartitionKey(org.apache.ignite.internal.processors.cache.verify.PartitionKey) VisorValidateIndexesTaskResult(org.apache.ignite.internal.visor.verify.VisorValidateIndexesTaskResult) UUID(java.util.UUID) VisorValidateIndexesTaskArg(org.apache.ignite.internal.visor.verify.VisorValidateIndexesTaskArg) ValidateIndexesCheckSizeResult(org.apache.ignite.internal.visor.verify.ValidateIndexesCheckSizeResult) ValidateIndexesPartitionResult(org.apache.ignite.internal.visor.verify.ValidateIndexesPartitionResult)

Example 7 with VisorValidateIndexesJobResult

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

the class RebuildIndexWithHistoricalRebalanceTest method shouldRebuldIndexForMovingPartitionWithHistoricalRebalance.

/**
 */
@Test
// Use only historical rebalance
@WithSystemProperty(key = IGNITE_PDS_WAL_REBALANCE_THRESHOLD, value = "0")
public void shouldRebuldIndexForMovingPartitionWithHistoricalRebalance() throws Exception {
    IgniteEx node1 = startGrid(0);
    startGrid(1);
    node1.cluster().active(true);
    IgniteCache<UserKey, UserValue> cache = node1.getOrCreateCache(CACHE_NAME);
    cache.put(new UserKey(1), new UserValue(333));
    stopGrid(1);
    cache.put(new UserKey(2), new UserValue(555));
    SUPPLY_MESSAGE_LATCH.set(new CountDownLatch(1));
    removeIndexBin(1);
    LogListener rebuildLsnr = finishIndexRebuildLsnr(CACHE_NAME);
    IgniteEx node2 = startGrid(1);
    assertTrue(GridTestUtils.waitForCondition(rebuildLsnr::check, 10_000));
    SUPPLY_MESSAGE_LATCH.get().countDown();
    awaitPartitionMapExchange();
    ValidateIndexesClosure clo = new ValidateIndexesClosure(() -> false, Collections.singleton(CACHE_NAME), 0, 0, false, true);
    node2.context().resource().injectGeneric(clo);
    VisorValidateIndexesJobResult res = clo.call();
    assertFalse(res.hasIssues());
}
Also used : LogListener(org.apache.ignite.testframework.LogListener) IgniteEx(org.apache.ignite.internal.IgniteEx) VisorValidateIndexesJobResult(org.apache.ignite.internal.visor.verify.VisorValidateIndexesJobResult) ValidateIndexesClosure(org.apache.ignite.internal.visor.verify.ValidateIndexesClosure) CountDownLatch(java.util.concurrent.CountDownLatch) GridCommonAbstractTest(org.apache.ignite.testframework.junits.common.GridCommonAbstractTest) Test(org.junit.Test) WithSystemProperty(org.apache.ignite.testframework.junits.WithSystemProperty)

Aggregations

VisorValidateIndexesJobResult (org.apache.ignite.internal.visor.verify.VisorValidateIndexesJobResult)7 UUID (java.util.UUID)4 IgniteEx (org.apache.ignite.internal.IgniteEx)4 VisorValidateIndexesTaskArg (org.apache.ignite.internal.visor.verify.VisorValidateIndexesTaskArg)4 VisorValidateIndexesTaskResult (org.apache.ignite.internal.visor.verify.VisorValidateIndexesTaskResult)4 GridCommonAbstractTest (org.apache.ignite.testframework.junits.common.GridCommonAbstractTest)4 Test (org.junit.Test)4 ValidateIndexesClosure (org.apache.ignite.internal.visor.verify.ValidateIndexesClosure)3 VisorValidateIndexesTask (org.apache.ignite.internal.visor.verify.VisorValidateIndexesTask)3 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 IgniteDataStreamer (org.apache.ignite.IgniteDataStreamer)2 VisorTaskArgument (org.apache.ignite.internal.visor.VisorTaskArgument)2 LogListener (org.apache.ignite.testframework.LogListener)2 File (java.io.File)1 HashSet (java.util.HashSet)1 Map (java.util.Map)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 ThreadLocalRandom (java.util.concurrent.ThreadLocalRandom)1 IgniteCache (org.apache.ignite.IgniteCache)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1