Skip to content

Commit

Permalink
Restore without deleting data, post-restore hooks or starting cassand…
Browse files Browse the repository at this point in the history
…ra. (#1080)
  • Loading branch information
mattl-netflix committed Mar 2, 2024
1 parent ec2ef37 commit af69e3b
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions priam/src/main/java/com/netflix/priam/restore/AbstractRestore.java
Expand Up @@ -42,7 +42,6 @@
import javax.inject.Named;
import javax.inject.Provider;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -218,13 +217,6 @@ public void restore(DateUtil.DateRange dateRange) throws Exception {
instanceIdentity.getInstance().setToken(restoreToken.toString());
}

// Stop cassandra if its running
stopCassProcess();

// Cleanup local data
File dataDir = new File(config.getDataFileLocation());
if (dataDir.exists() && dataDir.isDirectory()) FileUtils.cleanDirectory(dataDir);

// Find latest valid meta file.
Optional<AbstractBackupPath> latestValidMetaFile =
BackupRestoreUtil.getLatestValidMetaPath(metaProxy, dateRange);
Expand Down Expand Up @@ -255,7 +247,6 @@ public void restore(DateUtil.DateRange dateRange) throws Exception {
List<Future<Path>> futureList = new ArrayList<>();
futureList.addAll(download(allFiles.iterator(), false));

// Downloading CommitLogs
// Note for Backup V2.0 we do not backup commit logs, as saving them is cost-expensive.
if (config.isBackingUpCommitLogs()) {
logger.info(
Expand All @@ -276,20 +267,9 @@ public void restore(DateUtil.DateRange dateRange) throws Exception {
// Wait for all the futures to finish.
waitForCompletion(futureList);

// Given that files are restored now, kick off post restore hook
logger.info("Starting post restore hook");
postRestoreHook.execute();
logger.info("Completed executing post restore hook");

// Declare restore as finished.
instanceState.getRestoreStatus().setExecutionEndTime(LocalDateTime.now());
instanceState.setRestoreStatus(Status.FINISHED);

// Start cassandra if restore is successful.
if (!config.doesCassandraStartManually()) cassProcess.start(true);
else
logger.info(
"config.doesCassandraStartManually() is set to True, hence Cassandra needs to be started manually ...");
} catch (Exception e) {
instanceState.setRestoreStatus(Status.FAILED);
instanceState.getRestoreStatus().setExecutionEndTime(LocalDateTime.now());
Expand Down

0 comments on commit af69e3b

Please sign in to comment.