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