diff --git a/pkg/base/constants.go b/pkg/base/constants.go index aee0ff8b6763..26295ba6190a 100644 --- a/pkg/base/constants.go +++ b/pkg/base/constants.go @@ -51,5 +51,5 @@ const ( InflightTraceDir = "inflight_trace_dump" // MinRangeMaxBytes is the minimum value for range max bytes. - MinRangeMaxBytes = 64 << 10 // 64 KB + MinRangeMaxBytes = 64 << 20 // 64 MiB, half of the default range_min_bytes ) diff --git a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_configs b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_configs index 22b34483342f..bf117702fb9e 100644 --- a/pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_configs +++ b/pkg/ccl/logictestccl/testdata/logic_test/multi_region_zone_configs @@ -123,14 +123,14 @@ statement ok ALTER DATABASE "mr-zone-configs" CONFIGURE ZONE USING gc.ttlseconds = 5 statement ok -ALTER DATABASE "mr-zone-configs" CONFIGURE ZONE USING range_min_bytes = 1000, range_max_bytes = 100000 +ALTER DATABASE "mr-zone-configs" CONFIGURE ZONE USING range_min_bytes = 1000, range_max_bytes = 100000000 query TT SHOW ZONE CONFIGURATION FOR DATABASE "mr-zone-configs" ---- DATABASE "mr-zone-configs" ALTER DATABASE "mr-zone-configs" CONFIGURE ZONE USING range_min_bytes = 1000, - range_max_bytes = 100000, + range_max_bytes = 100000000, gc.ttlseconds = 5, num_replicas = 5, num_voters = 3, @@ -149,7 +149,7 @@ SHOW ZONE CONFIGURATION FOR DATABASE "mr-zone-configs" ---- DATABASE "mr-zone-configs" ALTER DATABASE "mr-zone-configs" CONFIGURE ZONE USING range_min_bytes = 1000, - range_max_bytes = 100000, + range_max_bytes = 100000000, gc.ttlseconds = 5, num_replicas = 5, num_voters = 3, @@ -170,7 +170,7 @@ SHOW ZONE CONFIGURATION FOR DATABASE "mr-zone-configs" ---- DATABASE "mr-zone-configs" ALTER DATABASE "mr-zone-configs" CONFIGURE ZONE USING range_min_bytes = 1000, - range_max_bytes = 100000, + range_max_bytes = 100000000, gc.ttlseconds = 5, num_replicas = 5, num_voters = 5, @@ -243,7 +243,7 @@ SHOW ZONE CONFIGURATION FOR DATABASE "mr-zone-configs" ---- DATABASE "mr-zone-configs" ALTER DATABASE "mr-zone-configs" CONFIGURE ZONE USING range_min_bytes = 1000, - range_max_bytes = 100000, + range_max_bytes = 100000000, gc.ttlseconds = 5, num_replicas = 5, num_voters = 3, @@ -302,7 +302,7 @@ SHOW ZONE CONFIGURATION FOR DATABASE "mr-zone-configs" ---- DATABASE "mr-zone-configs" ALTER DATABASE "mr-zone-configs" CONFIGURE ZONE USING range_min_bytes = 1000, - range_max_bytes = 100000, + range_max_bytes = 100000000, gc.ttlseconds = 100000, num_replicas = 4, num_voters = 3, @@ -323,7 +323,7 @@ SHOW ZONE CONFIGURATION FOR DATABASE "mr-zone-configs" ---- DATABASE "mr-zone-configs" ALTER DATABASE "mr-zone-configs" CONFIGURE ZONE USING range_min_bytes = 1000, - range_max_bytes = 100000, + range_max_bytes = 100000000, gc.ttlseconds = 100000, num_replicas = 3, num_voters = 3, @@ -344,7 +344,7 @@ SHOW ZONE CONFIGURATION FOR DATABASE "mr-zone-configs" ---- DATABASE "mr-zone-configs" ALTER DATABASE "mr-zone-configs" CONFIGURE ZONE USING range_min_bytes = 1000, - range_max_bytes = 100000, + range_max_bytes = 100000000, gc.ttlseconds = 100000, num_replicas = 3, num_voters = 3, @@ -365,7 +365,7 @@ SHOW ZONE CONFIGURATION FOR DATABASE "mr-zone-configs" ---- DATABASE "mr-zone-configs" ALTER DATABASE "mr-zone-configs" CONFIGURE ZONE USING range_min_bytes = 1000, - range_max_bytes = 100000, + range_max_bytes = 100000000, gc.ttlseconds = 100000, num_replicas = 3, constraints = '[]', @@ -443,7 +443,7 @@ SHOW ZONE CONFIGURATION FOR TABLE regional_by_row ---- TABLE regional_by_row ALTER TABLE regional_by_row CONFIGURE ZONE USING range_min_bytes = 1000, - range_max_bytes = 100000, + range_max_bytes = 100000000, gc.ttlseconds = 10, num_replicas = 10, num_voters = 3, @@ -504,7 +504,7 @@ SHOW ZONE CONFIGURATION FOR INDEX regional_by_row@regional_by_row_pkey ---- TABLE regional_by_row ALTER TABLE regional_by_row CONFIGURE ZONE USING range_min_bytes = 1000, - range_max_bytes = 100000, + range_max_bytes = 100000000, gc.ttlseconds = 10, num_replicas = 5, num_voters = 3, @@ -517,7 +517,7 @@ SHOW ZONE CONFIGURATION FOR INDEX regional_by_row@regional_by_row_i_idx ---- TABLE regional_by_row ALTER TABLE regional_by_row CONFIGURE ZONE USING range_min_bytes = 1000, - range_max_bytes = 100000, + range_max_bytes = 100000000, gc.ttlseconds = 10, num_replicas = 5, num_voters = 3, @@ -530,7 +530,7 @@ SHOW ZONE CONFIGURATION FOR TABLE regional_by_row ---- TABLE regional_by_row ALTER TABLE regional_by_row CONFIGURE ZONE USING range_min_bytes = 1000, - range_max_bytes = 100000, + range_max_bytes = 100000000, gc.ttlseconds = 10, num_replicas = 5, num_voters = 3, @@ -598,7 +598,7 @@ SHOW ZONE CONFIGURATION FOR TABLE regional_by_row ---- TABLE regional_by_row ALTER TABLE regional_by_row CONFIGURE ZONE USING range_min_bytes = 1000, - range_max_bytes = 100000, + range_max_bytes = 100000000, gc.ttlseconds = 100000, global_reads = false, num_replicas = 5, @@ -617,7 +617,7 @@ SHOW ZONE CONFIGURATION FOR TABLE regional_by_row ---- TABLE regional_by_row ALTER TABLE regional_by_row CONFIGURE ZONE USING range_min_bytes = 1000, - range_max_bytes = 100000, + range_max_bytes = 100000000, gc.ttlseconds = 100000, global_reads = true, num_replicas = 5, @@ -667,7 +667,7 @@ SHOW ZONE CONFIGURATION FOR INDEX regional_by_row_as@regional_by_row_as_pkey ---- INDEX regional_by_row_as@regional_by_row_as_pkey ALTER INDEX regional_by_row_as@regional_by_row_as_pkey CONFIGURE ZONE USING range_min_bytes = 1000, - range_max_bytes = 100000, + range_max_bytes = 100000000, gc.ttlseconds = 100000, num_replicas = 10, num_voters = 3, @@ -688,7 +688,7 @@ SHOW ZONE CONFIGURATION FOR INDEX regional_by_row_as@regional_by_row_as_pkey ---- DATABASE "mr-zone-configs" ALTER DATABASE "mr-zone-configs" CONFIGURE ZONE USING range_min_bytes = 1000, - range_max_bytes = 100000, + range_max_bytes = 100000000, gc.ttlseconds = 100000, num_replicas = 5, num_voters = 3, @@ -737,7 +737,7 @@ SHOW ZONE CONFIGURATION FOR DATABASE "mr-zone-configs" ---- DATABASE "mr-zone-configs" ALTER DATABASE "mr-zone-configs" CONFIGURE ZONE USING range_min_bytes = 1000, - range_max_bytes = 100000, + range_max_bytes = 100000000, gc.ttlseconds = 100000, num_replicas = 5, num_voters = 3, diff --git a/pkg/config/zonepb/zone_test.go b/pkg/config/zonepb/zone_test.go index 3e59516d8654..9ce80265955a 100644 --- a/pkg/config/zonepb/zone_test.go +++ b/pkg/config/zonepb/zone_test.go @@ -61,6 +61,13 @@ func TestZoneConfigValidate(t *testing.T) { }, "RangeMaxBytes 0 less than minimum allowed", }, + { + ZoneConfig{ + NumReplicas: proto.Int32(1), + RangeMaxBytes: proto.Int64(60 << 20), + }, + "RangeMaxBytes 62914560 less than minimum allowed", + }, { ZoneConfig{ NumReplicas: proto.Int32(1), diff --git a/pkg/sql/logictest/testdata/logic_test/zone_config b/pkg/sql/logictest/testdata/logic_test/zone_config index 6e185ce456ee..5f3dce3673ad 100644 --- a/pkg/sql/logictest/testdata/logic_test/zone_config +++ b/pkg/sql/logictest/testdata/logic_test/zone_config @@ -75,7 +75,7 @@ SELECT zone_id, raw_config_sql FROM [SHOW ZONE CONFIGURATION FOR TABLE a] statement ok ALTER TABLE a CONFIGURE ZONE USING range_min_bytes = 200000 + 1, - range_max_bytes = 300000 + 1, + range_max_bytes = 100000000 + 1, gc.ttlseconds = 3000 + 600, num_replicas = floor(1.2)::int, constraints = '[+region=test]', @@ -103,7 +103,7 @@ SELECT zone_id, raw_config_sql FROM [SHOW ZONE CONFIGURATION FOR TABLE a] ---- 106 ALTER TABLE a CONFIGURE ZONE USING range_min_bytes = 200001, - range_max_bytes = 300001, + range_max_bytes = 100000001, gc.ttlseconds = 3600, num_replicas = 1, constraints = '[+region=test]', @@ -111,14 +111,14 @@ SELECT zone_id, raw_config_sql FROM [SHOW ZONE CONFIGURATION FOR TABLE a] # Check that we can set just one value without altering the others. statement ok -ALTER TABLE a CONFIGURE ZONE USING range_max_bytes = 400000 +ALTER TABLE a CONFIGURE ZONE USING range_max_bytes = 400000000 query IT SELECT zone_id, raw_config_sql FROM [SHOW ZONE CONFIGURATION FOR TABLE a] ---- 106 ALTER TABLE a CONFIGURE ZONE USING range_min_bytes = 200001, - range_max_bytes = 400000, + range_max_bytes = 400000000, gc.ttlseconds = 3600, num_replicas = 1, constraints = '[+region=test]', @@ -154,7 +154,7 @@ SELECT zone_id, raw_config_sql FROM [SHOW ZONE CONFIGURATION FOR TABLE a] ---- 106 ALTER TABLE a CONFIGURE ZONE USING range_min_bytes = 200001, - range_max_bytes = 400000, + range_max_bytes = 400000000, gc.ttlseconds = 3600, num_replicas = 1, constraints = '[+region=test]', @@ -170,7 +170,7 @@ a CREATE TABLE public.a ( ); ALTER TABLE test.public.a CONFIGURE ZONE USING range_min_bytes = 200001, - range_max_bytes = 400000, + range_max_bytes = 400000000, gc.ttlseconds = 3600, num_replicas = 1, constraints = '[+region=test]', diff --git a/pkg/sql/logictest/testdata/logic_test/zone_config_system_tenant b/pkg/sql/logictest/testdata/logic_test/zone_config_system_tenant index 75727a94bcec..7d09026e5155 100644 --- a/pkg/sql/logictest/testdata/logic_test/zone_config_system_tenant +++ b/pkg/sql/logictest/testdata/logic_test/zone_config_system_tenant @@ -95,7 +95,7 @@ SELECT 'db2.t'::REGCLASS::INT # in either of these tables for id = $t_id. statement ok BEGIN; -ALTER TABLE db2.t CONFIGURE ZONE USING range_max_bytes = 1<<24, range_min_bytes = 1<<20; +ALTER TABLE db2.t CONFIGURE ZONE USING range_max_bytes = 64<<20, range_min_bytes = 1<<20; DROP TABLE db2.t; COMMIT; @@ -105,6 +105,7 @@ SELECT crdb_internal.pb_to_json('cockroach.roachpb.SpanConfig', config) FROM system.span_configurations WHERE end_key > (SELECT crdb_internal.table_span($t_id)[1]) ---- +{"gcPolicy": {"ttlSeconds": 14400}, "numReplicas": 3, "rangeMaxBytes": "67108864", "rangeMinBytes": "1048576"} statement ok CREATE TABLE db2.t2 (i INT PRIMARY KEY); @@ -122,7 +123,7 @@ SELECT crdb_internal.pb_to_json('cockroach.roachpb.SpanConfig', config) FROM system.span_configurations WHERE end_key > (SELECT crdb_internal.table_span($t_id)[1]) ---- -{"gcPolicy": {"ttlSeconds": 90001}, "numReplicas": 3, "rangeMaxBytes": "16777216", "rangeMinBytes": "1048576"} +{"gcPolicy": {"ttlSeconds": 90001}, "numReplicas": 3, "rangeMaxBytes": "67108864", "rangeMinBytes": "1048576"} {"gcPolicy": {"ttlSeconds": 90001}, "numReplicas": 3, "rangeMaxBytes": "1073741824", "rangeMinBytes": "67108864"} # Check that dropped relations can have their GC TTLs altered.