Skip to content

Commit

Permalink
Remove backup racs as that configuration is not used in practice and …
Browse files Browse the repository at this point in the history
…is not relevant to whether a restore should be attempted.
  • Loading branch information
mattl-netflix committed Mar 10, 2024
1 parent 0882e68 commit 4ceec36
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 20 deletions.
Expand Up @@ -121,11 +121,6 @@ default int getBackupRetentionDays() {
return 0;
}

/** @return Get list of racs to backup. Backup all racs if empty */
default List<String> getBackupRacs() {
return Collections.EMPTY_LIST;
}

/**
* Backup location i.e. remote file system to upload backups. e.g. for S3 it will be s3 bucket
* name
Expand Down
Expand Up @@ -92,11 +92,6 @@ public int getBackupRetentionDays() {
return config.get(PRIAM_PRE + ".backup.retention", 0);
}

@Override
public List<String> getBackupRacs() {
return config.getList(PRIAM_PRE + ".backup.racs");
}

@Override
public String getRestorePrefix() {
return config.get(PRIAM_PRE + ".restore.prefix");
Expand Down
Expand Up @@ -25,7 +25,6 @@
import com.netflix.priam.defaultimpl.ICassandraProcess;
import com.netflix.priam.health.InstanceState;
import com.netflix.priam.identity.InstanceIdentity;
import com.netflix.priam.identity.config.InstanceInfo;
import com.netflix.priam.scheduler.Task;
import com.netflix.priam.utils.DateUtil;
import com.netflix.priam.utils.RetryableCallable;
Expand All @@ -41,7 +40,6 @@
import javax.inject.Inject;
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;
Expand Down Expand Up @@ -93,12 +91,8 @@ public AbstractRestore(
this.postRestoreHook = postRestoreHook;
}

public static boolean isRestoreEnabled(IConfiguration conf, InstanceInfo instanceInfo) {
boolean isRestoreMode = StringUtils.isNotBlank(conf.getRestoreSnapshot());
boolean isBackedupRac =
(CollectionUtils.isEmpty(conf.getBackupRacs())
|| conf.getBackupRacs().contains(instanceInfo.getRac()));
return (isRestoreMode && isBackedupRac);
public static boolean isRestoreEnabled(IConfiguration conf) {
return StringUtils.isNotBlank(conf.getRestoreSnapshot());
}

private List<Future<Path>> download(Iterator<AbstractBackupPath> fsIterator) throws Exception {
Expand All @@ -123,7 +117,7 @@ private void stopCassProcess() throws IOException {

@Override
public void execute() throws Exception {
if (!isRestoreEnabled(config, instanceIdentity.getInstanceInfo())) return;
if (!isRestoreEnabled(config)) return;

logger.info("Starting restore for {}", config.getRestoreSnapshot());
final DateUtil.DateRange dateRange = new DateUtil.DateRange(config.getRestoreSnapshot());
Expand Down
Expand Up @@ -67,7 +67,7 @@ public void writeAllProperties(String yamlLocation, String hostname, String seed
map.put("listen_address", hostname);
map.put("rpc_address", hostname);
// Dont bootstrap in restore mode
if (!Restore.isRestoreEnabled(config, instanceInfo)) {
if (!Restore.isRestoreEnabled(config)) {
map.put("auto_bootstrap", config.getAutoBoostrap());
} else {
map.put("auto_bootstrap", false);
Expand Down

0 comments on commit 4ceec36

Please sign in to comment.