use of org.apache.ignite.internal.visor.cache.VisorFindAndDeleteGarbageInPersistenceTaskArg in project ignite by apache.
the class IgniteCacheGroupsWithRestartsTest method executeTask.
/**
* @param ignite Ignite to execute task on.
* @param deleteFoundGarbage If clearing mode should be used.
* @return Result of task run.
*/
private VisorFindAndDeleteGarbageInPersistenceTaskResult executeTask(IgniteEx ignite, boolean deleteFoundGarbage) {
VisorFindAndDeleteGarbageInPersistenceTaskArg group = new VisorFindAndDeleteGarbageInPersistenceTaskArg(Collections.singleton(GROUP), deleteFoundGarbage, null);
UUID id = ignite.localNode().id();
VisorTaskArgument arg = new VisorTaskArgument(id, group, true);
VisorFindAndDeleteGarbageInPersistenceTaskResult result = ignite.compute().execute(VisorFindAndDeleteGarbageInPersistenceTask.class, arg);
return result;
}
use of org.apache.ignite.internal.visor.cache.VisorFindAndDeleteGarbageInPersistenceTaskArg in project ignite by apache.
the class FindAndDeleteGarbage method execute.
/**
* {@inheritDoc}
*/
@Override
public Object execute(GridClientConfiguration clientCfg, Logger logger) throws Exception {
VisorFindAndDeleteGarbageInPersistenceTaskArg taskArg = new VisorFindAndDeleteGarbageInPersistenceTaskArg(args.groups(), args.delete(), args.nodeId() != null ? Collections.singleton(args.nodeId()) : null);
try (GridClient client = Command.startClient(clientCfg)) {
VisorFindAndDeleteGarbageInPersistenceTaskResult taskRes = executeTask(client, VisorFindAndDeleteGarbageInPersistenceTask.class, taskArg, clientCfg);
CommandLogger.printErrors(taskRes.exceptions(), "Scanning for garbage failed on nodes:", logger);
for (Map.Entry<UUID, VisorFindAndDeleteGarbageInPersistenceJobResult> nodeEntry : taskRes.result().entrySet()) {
if (!nodeEntry.getValue().hasGarbage()) {
logger.info("Node " + nodeEntry.getKey() + " - garbage not found.");
continue;
}
logger.info("Garbage found on node " + nodeEntry.getKey() + ":");
VisorFindAndDeleteGarbageInPersistenceJobResult value = nodeEntry.getValue();
Map<Integer, Map<Integer, Long>> grpPartErrorsCount = value.checkResult();
if (!grpPartErrorsCount.isEmpty()) {
for (Map.Entry<Integer, Map<Integer, Long>> entry : grpPartErrorsCount.entrySet()) {
for (Map.Entry<Integer, Long> e : entry.getValue().entrySet()) {
logger.info(INDENT + "Group=" + entry.getKey() + ", partition=" + e.getKey() + ", count of keys=" + e.getValue());
}
}
}
logger.info("");
}
return taskRes;
}
}
Aggregations