Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
96166: cli/cliflags: update `max-offset` help text r=erikgrinaker a=erikgrinaker

Extracted from cockroachdb#96141.

---

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

96188: spanconfig: rename setting to `spanconfig.storage_coalesce_adjacent.enabled` r=irfansharif,arulajmani a=knz

Fixes cockroachdb#96187. 
Epic: CRDB-23559

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

Co-authored-by: Erik Grinaker <[email protected]>
Co-authored-by: Raphael 'kena' Poss <[email protected]>
  • Loading branch information
3 people committed Jan 31, 2023
3 parents c410d8d + 5205e67 + b2d1267 commit 2fd74fc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
8 changes: 5 additions & 3 deletions pkg/cli/cliflags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -901,9 +901,11 @@ failures as well as the frequency of uncertainty-based read restarts.
<PRE>
</PRE>
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{
Expand Down
2 changes: 2 additions & 0 deletions pkg/settings/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 11 additions & 11 deletions pkg/spanconfig/spanconfigstore/span_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/generate_objects_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 2fd74fc

Please sign in to comment.