From 4ceec361eb04a776650aa4774c9297a47ac27040 Mon Sep 17 00:00:00 2001 From: Matt Lehman Date: Sat, 9 Mar 2024 21:45:29 -0800 Subject: [PATCH] Remove backup racs as that configuration is not used in practice and is not relevant to whether a restore should be attempted. --- .../com/netflix/priam/config/IConfiguration.java | 5 ----- .../com/netflix/priam/config/PriamConfiguration.java | 5 ----- .../com/netflix/priam/restore/AbstractRestore.java | 12 +++--------- .../java/com/netflix/priam/tuner/StandardTuner.java | 2 +- 4 files changed, 4 insertions(+), 20 deletions(-) diff --git a/priam/src/main/java/com/netflix/priam/config/IConfiguration.java b/priam/src/main/java/com/netflix/priam/config/IConfiguration.java index 3ed23359d..343cbd6e8 100644 --- a/priam/src/main/java/com/netflix/priam/config/IConfiguration.java +++ b/priam/src/main/java/com/netflix/priam/config/IConfiguration.java @@ -121,11 +121,6 @@ default int getBackupRetentionDays() { return 0; } - /** @return Get list of racs to backup. Backup all racs if empty */ - default List 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 diff --git a/priam/src/main/java/com/netflix/priam/config/PriamConfiguration.java b/priam/src/main/java/com/netflix/priam/config/PriamConfiguration.java index e708e56b1..f9466f75e 100644 --- a/priam/src/main/java/com/netflix/priam/config/PriamConfiguration.java +++ b/priam/src/main/java/com/netflix/priam/config/PriamConfiguration.java @@ -92,11 +92,6 @@ public int getBackupRetentionDays() { return config.get(PRIAM_PRE + ".backup.retention", 0); } - @Override - public List getBackupRacs() { - return config.getList(PRIAM_PRE + ".backup.racs"); - } - @Override public String getRestorePrefix() { return config.get(PRIAM_PRE + ".restore.prefix"); diff --git a/priam/src/main/java/com/netflix/priam/restore/AbstractRestore.java b/priam/src/main/java/com/netflix/priam/restore/AbstractRestore.java index 5fe7d72dc..0b8213ba1 100644 --- a/priam/src/main/java/com/netflix/priam/restore/AbstractRestore.java +++ b/priam/src/main/java/com/netflix/priam/restore/AbstractRestore.java @@ -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; @@ -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; @@ -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> download(Iterator fsIterator) throws Exception { @@ -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()); diff --git a/priam/src/main/java/com/netflix/priam/tuner/StandardTuner.java b/priam/src/main/java/com/netflix/priam/tuner/StandardTuner.java index dc4500ac9..777331fc7 100644 --- a/priam/src/main/java/com/netflix/priam/tuner/StandardTuner.java +++ b/priam/src/main/java/com/netflix/priam/tuner/StandardTuner.java @@ -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);