Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore without deleting data, post-restore hooks or starting cassandra. #1080

Merged
merged 1 commit into from
Mar 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions priam/src/main/java/com/netflix/priam/restore/AbstractRestore.java
Original file line number Diff line number Diff line change
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
Loading