use of com.instaclustr.esop.backup.embedded.TestEntity.KEYSPACE in project esop by instaclustr.
the class AbstractBackupTest method inPlaceBackupRestoreTest.
public void inPlaceBackupRestoreTest(final String[][] arguments) throws Exception {
Cassandra cassandra = null;
try {
cassandra = getCassandra(cassandraDir, CASSANDRA_VERSION);
cassandra.start();
List<Long> insertionTimes;
try (CqlSession session = CqlSession.builder().build()) {
insertionTimes = populateDatabaseWithBackup(session, arguments);
assertEquals(insertionTimes.size(), NUMBER_OF_INSERTED_ROWS);
}
logger.info("Executing backup of commit logs {}", asList(arguments[3]));
Esop.mainWithoutExit(arguments[3]);
cassandra.stop();
// RESTORE VERIFICATION
cassandra = getCassandra(cassandraRestoredDir, CASSANDRA_VERSION, (workingDirectory, version) -> {
try {
FileUtils.createDirectory(workingDirectory.resolve("data").resolve("data"));
FileUtils.createDirectory(workingDirectory.resolve("data").resolve("data2"));
FileUtils.createDirectory(workingDirectory.resolve("data").resolve("data3"));
} catch (final Exception ex) {
// ignore
}
restoreOnStoppedNode(insertionTimes, arguments);
});
cassandra.start();
waitForCql();
try (CqlSession session = CqlSession.builder().build()) {
dumpTableAndAssertRowCount(session, KEYSPACE, TABLE, NUMBER_OF_ROWS_AFTER_RESTORATION);
}
} finally {
if (cassandra != null) {
cassandra.stop();
}
deleteDirectory(Paths.get(target("commitlog_download_dir")));
FileUtils.deleteDirectory(cassandraDir);
FileUtils.deleteDirectory(cassandraRestoredDir);
}
}
Aggregations