use of com.palantir.atlasdb.schema.KeyValueServiceValidator in project atlasdb by palantir.
the class KvsMigrationCommand method execute.
public int execute(AtlasDbServices fromServices, AtlasDbServices toServices) {
if (!setup && !migrate && !validate) {
printer.error("At least one of --setup, --migrate, or --validate should be specified.");
return 1;
}
KeyValueServiceMigrator migrator;
try {
migrator = getMigrator(fromServices, toServices);
} catch (IOException e) {
throw Throwables.rewrapAndThrowUncheckedException(e);
}
if (setup) {
migrator.setup();
}
if (migrate) {
migrator.migrate();
migrator.cleanup();
}
if (validate) {
KeyValueServiceValidator validator = new KeyValueServiceValidator(fromServices.getTransactionManager(), toServices.getTransactionManager(), fromServices.getKeyValueService(), threads, batchSize, ImmutableMap.of(), (String message, KeyValueServiceMigrator.KvsMigrationMessageLevel level) -> printer.info(level.toString() + ": " + message), ImmutableSet.of());
validator.validate(true);
}
return 0;
}
Aggregations