Skip to content

Commit

Permalink
Merge pull request #85683 from cockroachdb/blathers/backport-release-…
Browse files Browse the repository at this point in the history
…22.1-85646

release-22.1: sql: disallow distsql_workmem of less than 2B
  • Loading branch information
yuzefovich authored Aug 6, 2022
2 parents 033c911 + 0999b14 commit 2d8002a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions pkg/sql/exec_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,12 @@ var settingWorkMemBytes = settings.RegisterByteSizeSetting(
"sql.distsql.temp_storage.workmem",
"maximum amount of memory in bytes a processor can use before falling back to temp storage",
execinfra.DefaultMemoryLimit, /* 64MiB */
func(v int64) error {
if v <= 1 {
return errors.Errorf("can only be set to a value greater than 1: %d", v)
}
return nil
},
).WithPublic()

// ExperimentalDistSQLPlanningClusterSettingName is the name for the cluster
Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -567,8 +567,8 @@ var varGen = map[string]sessionVar{
if err != nil {
return err
}
if limit <= 0 {
return errors.New("distsql_workmem can only be set to a positive value")
if limit <= 1 {
return errors.New("distsql_workmem can only be set to a value greater than 1")
}
m.SetDistSQLWorkMem(limit)
return nil
Expand Down

0 comments on commit 2d8002a

Please sign in to comment.