From b2d1267806ae0c32a16904fca72a032c224435a1 Mon Sep 17 00:00:00 2001 From: Raphael 'kena' Poss Date: Mon, 30 Jan 2023 16:51:14 +0100 Subject: [PATCH 1/2] spanconfig: rename setting to `spanconfig.storage_coalesce_adjacent.enabled` Our terminology is "tenant" vs "storage cluster". The word "host" is not used anywhere in CockroachDB (it is a term specific to CC Serverless) and so should not be included in setting names. There is no release note because the functionality is not yet visible to end-users. Release note: None --- pkg/settings/registry.go | 2 ++ pkg/spanconfig/spanconfigstore/span_store.go | 22 ++++++++++---------- pkg/sql/generate_objects_test.go | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/pkg/settings/registry.go b/pkg/settings/registry.go index 23679af657a5..efbbb3e4e4fd 100644 --- a/pkg/settings/registry.go +++ b/pkg/settings/registry.go @@ -159,6 +159,8 @@ var retiredSettings = map[string]struct{}{ "sql.distsql.drain.cancel_after_wait.enabled": {}, "changefeed.active_protected_timestamps.enabled": {}, "jobs.scheduler.single_node_scheduler.enabled": {}, + // renamed. + "spanconfig.host_coalesce_adjacent.enabled": {}, } // sqlDefaultSettings is the list of "grandfathered" existing sql.defaults diff --git a/pkg/spanconfig/spanconfigstore/span_store.go b/pkg/spanconfig/spanconfigstore/span_store.go index fe5b6eb3e0a2..269da4e8379f 100644 --- a/pkg/spanconfig/spanconfigstore/span_store.go +++ b/pkg/spanconfig/spanconfigstore/span_store.go @@ -24,23 +24,23 @@ import ( "github.com/cockroachdb/errors" ) -// tenantCoalesceAdjacentSetting is a hidden cluster setting that controls -// whether we coalesce adjacent ranges in the tenant keyspace if they have the -// same span config. +// tenantCoalesceAdjacentSetting is a hidden cluster setting that +// controls whether we coalesce adjacent ranges across all secondary +// tenant keyspaces if they have the same span config. var tenantCoalesceAdjacentSetting = settings.RegisterBoolSetting( settings.SystemOnly, "spanconfig.tenant_coalesce_adjacent.enabled", - `collapse adjacent ranges with the same span configs`, + `collapse adjacent ranges with the same span configs across all secondary tenant keyspaces`, true, ) -// hostCoalesceAdjacentSetting is a hidden cluster setting that controls -// whether we coalesce adjacent ranges in the host tenant keyspace if they have -// the same span config. -var hostCoalesceAdjacentSetting = settings.RegisterBoolSetting( +// storageCoalesceAdjacentSetting is a hidden cluster setting that +// controls whether we coalesce adjacent ranges outside of the +// secondary tenant keyspaces if they have the same span config. +var storageCoalesceAdjacentSetting = settings.RegisterBoolSetting( settings.SystemOnly, - "spanconfig.host_coalesce_adjacent.enabled", - `collapse adjacent ranges with the same span configs`, + "spanconfig.storage_coalesce_adjacent.enabled", + `collapse adjacent ranges with the same span configs for the ranges specific to the system tenant`, false, ) @@ -152,7 +152,7 @@ func (s *spanConfigStore) computeSplitKey(start, end roachpb.RKey) (roachpb.RKey // ranges. systemTableUpperBound := keys.SystemSQLCodec.TablePrefix(keys.MaxReservedDescID + 1) if roachpb.Key(rem).Compare(systemTableUpperBound) < 0 || - !hostCoalesceAdjacentSetting.Get(&s.settings.SV) { + !storageCoalesceAdjacentSetting.Get(&s.settings.SV) { return roachpb.RKey(match.span.Key), nil } } else { diff --git a/pkg/sql/generate_objects_test.go b/pkg/sql/generate_objects_test.go index 2bbac07973b7..9903629b83bf 100644 --- a/pkg/sql/generate_objects_test.go +++ b/pkg/sql/generate_objects_test.go @@ -46,7 +46,7 @@ func BenchmarkGenerateObjects(b *testing.B) { // Disable auto stats and range splits, which introduce noise. db.Exec(b, `SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false`) - db.Exec(b, `SET CLUSTER SETTING spanconfig.host_coalesce_adjacent.enabled = true`) + db.Exec(b, `SET CLUSTER SETTING spanconfig.storage_coalesce_adjacent.enabled = true`) for _, bench := range benches { b.Run(bench.name, func(b *testing.B) { From 5205e67fd1238cf698c2c74e1610609d565a8679 Mon Sep 17 00:00:00 2001 From: Erik Grinaker Date: Sat, 28 Jan 2023 12:40:28 +0000 Subject: [PATCH 2/2] cli/cliflags: update `max-offset` help text The max offset was recently allowed to differ between nodes to allow changing it via a rolling restart. This patch updates the `--max-offset` help text to reflect this. Epic: none Release note: None --- pkg/cli/cliflags/flags.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/cli/cliflags/flags.go b/pkg/cli/cliflags/flags.go index 779a1e95090b..e8be1bd6208c 100644 --- a/pkg/cli/cliflags/flags.go +++ b/pkg/cli/cliflags/flags.go @@ -901,9 +901,11 @@ failures as well as the frequency of uncertainty-based read restarts.
 
 
-Note that this value must be the same on all nodes in the cluster. In order to -change it, all nodes in the cluster must be stopped simultaneously and restarted -with the new value.`, +This value should be the same on all nodes in the cluster. It is allowed to +differ such that the max-offset value can be changed via a rolling restart of +the cluster, in which case the real clock offset between nodes must be below the +smallest max-offset value of any node. +`, } Store = FlagInfo{