Skip to content

Commit 3c8e9ff

Browse files
authored
Merge pull request redpanda-data#16077 from dotnwat/default-sm-enable
storage: don't enable non-strict retention by default
2 parents f698281 + a35990f commit 3c8e9ff

File tree

3 files changed

+15
-21
lines changed

3 files changed

+15
-21
lines changed

src/v/config/configuration.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,15 +2061,16 @@ configuration::configuration()
20612061
"past the local retention limit, and will be trimmed automatically as "
20622062
"storage reaches the configured target size.",
20632063
{.needs_restart = needs_restart::no, .visibility = visibility::user},
2064-
false)
2064+
false,
2065+
property<bool>::noop_validator,
2066+
legacy_default<bool>(true, legacy_version{9}))
20652067
, retention_local_strict_override(
20662068
*this,
20672069
"retention_local_strict_override",
20682070
"Trim log data when a cloud topic reaches its local retention limit. "
20692071
"When this option is disabled Redpanda will allow partitions to grow "
20702072
"past the local retention limit, and will be trimmed automatically as "
2071-
"storage reaches the configured target size. This option is ignored and "
2072-
"deprecated in versions >= v23.3.",
2073+
"storage reaches the configured target size.",
20732074
{.needs_restart = needs_restart::no, .visibility = visibility::user},
20742075
true)
20752076
, retention_local_target_capacity_bytes(

src/v/storage/disk_log_impl.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,9 @@ gc_config disk_log_impl::maybe_override_retention_config(gc_config cfg) const {
10091009
* don't override with local retention settings--let partition data expand
10101010
* up to standard retention settings.
10111011
*/
1012-
if (!config::shard_local_cfg().retention_local_strict()) {
1012+
if (
1013+
!config::shard_local_cfg().retention_local_strict()
1014+
|| !config::shard_local_cfg().retention_local_strict_override()) {
10131015
vlog(
10141016
gclog.trace,
10151017
"[{}] Skipped retention override for topic with remote write "

tests/rptest/tests/cluster_config_test.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,24 +1941,20 @@ def test_removal_of_legacy_default_defaulted(self, wipe_cache: bool):
19411941
# upgraded clusters.
19421942
self._upgrade(wipe_cache, self.intermediate_version)
19431943
self._check_value_everywhere("space_management_enable", False)
1944-
self._check_value_everywhere("retention_local_strict", True)
19451944

1946-
# in >=23.3 (using upstream build) space management should be enabled by
1947-
# default provided that it wasn't explicitly disabled in 23.2. in this
1948-
# case no configs were changed so it should be enabled now.
1945+
# in >=23.3 space management should be enabled by default provided that
1946+
# it wasn't explicitly disabled in 23.2.
19491947
self._upgrade(wipe_cache)
19501948
self._check_value_everywhere("space_management_enable", True)
1951-
self._check_value_everywhere("retention_local_strict", False)
19521949

19531950
# survives a restart
19541951
self.redpanda.restart_nodes(self.redpanda.nodes)
19551952
self._check_value_everywhere("space_management_enable", True)
1956-
self._check_value_everywhere("retention_local_strict", False)
19571953

19581954
@cluster(num_nodes=3)
19591955
@parametrize(wipe_cache=True)
19601956
@parametrize(wipe_cache=False)
1961-
def test_removal_of_legacy_default_disabled(self, wipe_cache: bool):
1957+
def test_removal_of_legacy_default_overriden(self, wipe_cache: bool):
19621958
# in 23.1 space management feature does not exist
19631959
old_version, _ = self.installer.latest_for_line(self.legacy_version)
19641960
self.installer.install(self.redpanda.nodes, old_version)
@@ -1968,26 +1964,21 @@ def test_removal_of_legacy_default_disabled(self, wipe_cache: bool):
19681964
# upgraded clusters.
19691965
self._upgrade(wipe_cache, self.intermediate_version)
19701966
self._check_value_everywhere("space_management_enable", False)
1971-
self._check_value_everywhere("retention_local_strict", True)
19721967

1973-
# the interface seems to ignore setting a value to its current value. so
1974-
# we enable then disable to make sure it gets through.
1968+
# we need to toggle it to get it to stick since the api seems to not
1969+
# change the underlying value explicitly if its default is that value.
1970+
# the legacy default bits here are to blame for the weirdness i presume
19751971
self.redpanda.set_cluster_config({"space_management_enable": True})
19761972
self.redpanda.set_cluster_config({"space_management_enable": False})
1977-
self.redpanda.set_cluster_config({"retention_local_strict": False})
1978-
self.redpanda.set_cluster_config({"retention_local_strict": True})
19791973

1980-
# in >=23.3 (using upstream build) space management should be enabled by
1981-
# default provided that it wasn't explicitly disabled in 23.2. in this
1982-
# case we disabled it in 23.2 state so it should still be disabled here.
1974+
# in >=23.3 space management should be enabled by default provided that
1975+
# it wasn't explicitly disabled in 23.2.
19831976
self._upgrade(wipe_cache)
19841977
self._check_value_everywhere("space_management_enable", False)
1985-
self._check_value_everywhere("retention_local_strict", True)
19861978

19871979
# survives a restart
19881980
self.redpanda.restart_nodes(self.redpanda.nodes)
19891981
self._check_value_everywhere("space_management_enable", False)
1990-
self._check_value_everywhere("retention_local_strict", True)
19911982

19921983

19931984
class ClusterConfigUnknownTest(RedpandaTest):

0 commit comments

Comments
 (0)