You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
multiregion: allow zone config extensions to remove read replicas
Previously, zone config extensions validated that num_replicas could
not be set lower than the total number of replicas required for the
database's survival goal (which includes both voters and non-voting
read replicas). This prevented users from removing read replicas to
reduce storage costs while maintaining the required number of voters
for the survival goal.
The survival goal only depends on the number of voting replicas
(num_voters), not the total number of replicas. Non-voting replicas
are used for follower reads and do not participate in Raft consensus
or affect availability guarantees.
This commit changes the validation in ExtendZoneConfigWithGlobal() and
ExtendZoneConfigWithRegionalIn() to check that num_replicas is not set
lower than num_voters instead of the total numReplicas. This allows
users to set num_replicas equal to num_voters, effectively removing
read replicas while maintaining the required voter count for their
survival goal.
For example, in a SURVIVE ZONE FAILURE database with 3 regions, users
can now reduce num_replicas from 5 (default: 3 voters + 2 read replicas)
to 3 (just the required voters), saving storage while maintaining zone
failure tolerance.
Also fixes a typo in the error message ("num_replica" -> "num_replicas").
Resolves: #105210
Release note (bug fix): Fixed a bug where zone config extensions
incorrectly prevented users from removing non-voting read replicas
from multi-region databases. Users can now set num_replicas equal to
num_voters to remove read replicas while maintaining the required
number of voting replicas for their database's survival goal. This
allows reducing storage costs without compromising availability
guarantees.
Copy file name to clipboardExpand all lines: pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_config_extensions
+92-2Lines changed: 92 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -290,10 +290,100 @@ statement error pq: zone config extension cannot unset the home region \(ca-cent
290
290
ALTER DATABASE "mr-zone-configs" ALTER LOCALITY REGIONAL IN "ca-central-1" CONFIGURE ZONE USING
291
291
lease_preferences = '[[+region=ap-southeast-2]]'
292
292
293
-
statement error pq: zone config extension cannot set num_replicas 4 that is lower than the one required for the survival goal: 5 with goal REGION_FAILURE
293
+
statement error pq: cannot set num_replicas below 5 \(num_voters required for survival goal REGION_FAILURE\), got 4
294
294
ALTER DATABASE "mr-zone-configs" ALTER LOCALITY GLOBAL CONFIGURE ZONE USING
295
295
num_replicas = 4
296
296
297
-
statement error pq: zone config extension cannot set num_voters 4 that is lower than the one required for the survival goal: 5 with goal REGION_FAILURE
297
+
statement error pq: cannot set num_voters below 5 \(num_voters required for survival goal REGION_FAILURE\), got 4
298
298
ALTER DATABASE "mr-zone-configs" ALTER LOCALITY GLOBAL CONFIGURE ZONE USING
299
299
num_voters = 4
300
+
301
+
# Test that num_replicas can be set to num_voters (removing read replicas).
302
+
# This is allowed because survival goals depend on num_voters, not total replicas.
303
+
304
+
# SURVIVE REGION FAILURE with num_voters=5 should allow num_replicas=5 (removing read replicas).
305
+
statement ok
306
+
ALTER DATABASE "mr-zone-configs" ALTER LOCALITY GLOBAL CONFIGURE ZONE USING
307
+
num_replicas = 5
308
+
309
+
query TT
310
+
SHOW ZONE CONFIGURATION FOR DATABASE "mr-zone-configs"
311
+
----
312
+
DATABASE "mr-zone-configs" ALTER DATABASE "mr-zone-configs" CONFIGURE ZONE USING
0 commit comments