Skip to content

Commit

Permalink
Reveal property to enable auto_snapshot. (#1031)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattl-netflix committed Mar 25, 2023
1 parent bf69a1d commit d8c5cf7
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 0 deletions.
Expand Up @@ -1175,6 +1175,9 @@ default long getCompressionTransitionEpochMillis() {
return 0L;
}

/** @return whether to enable auto_snapshot */
boolean getAutoSnapshot();

/**
* Escape hatch for getting any arbitrary property by key This is useful so we don't have to
* keep adding methods to this interface for every single configuration option ever. Also
Expand Down
Expand Up @@ -799,4 +799,9 @@ public int getTargetMinutesToCompleteSnaphotUpload() {
public double getRateLimitChangeThreshold() {
return config.get(PRIAM_PRE + ".rateLimitChangeThreshold", 0.1);
}

@Override
public boolean getAutoSnapshot() {
return config.get(PRIAM_PRE + ".autoSnapshot", false);
}
}
Expand Up @@ -129,6 +129,7 @@ public void writeAllProperties(String yamlLocation, String hostname, String seed
"compaction_large_partition_warning_threshold_mb",
config.getCompactionLargePartitionWarnThresholdInMB());
map.put("disk_access_mode", config.getDiskAccessMode());
map.put("auto_snapshot", config.getAutoSnapshot());

List<?> seedp = (List) map.get("seed_provider");
Map<String, String> m = (Map<String, String>) seedp.get(0);
Expand Down
Expand Up @@ -41,6 +41,7 @@ public class FakeConfiguration implements IConfiguration {
private boolean skipUpdatingOthersIngressRules;
private boolean skipIngressUnlessIPIsPublic;
private long compressionTransitionEpochMillis;
private boolean autoSnapshot;

public Map<String, String> fakeProperties = new HashMap<>();

Expand Down Expand Up @@ -302,4 +303,14 @@ public void setCompressionTransitionEpochMillis(long transitionTime) {
public long getCompressionTransitionEpochMillis() {
return compressionTransitionEpochMillis;
}

public FakeConfiguration setAutoSnapshot(boolean autoSnapshot) {
this.autoSnapshot = autoSnapshot;
return this;
}

@Override
public boolean getAutoSnapshot() {
return autoSnapshot;
}
}
Expand Up @@ -159,6 +159,13 @@ public void testDiskAccessMode() throws Exception {
Assert.assertEquals(diskAccessMode, map.get("disk_access_mode"));
}

@Test
public void testAutoSnapshot() throws Exception {
boolean autoSnapshot = true;
Map map = applyFakeConfiguration(new FakeConfiguration().setAutoSnapshot(autoSnapshot));
Assert.assertEquals(autoSnapshot, map.get("auto_snapshot"));
}

@Test
public void testRoleManagerOverride() throws Exception {
String roleManagerOverride = "org.apache.cassandra.auth.CustomRoleManager";
Expand Down

0 comments on commit d8c5cf7

Please sign in to comment.