From 03e77f6f652e9c9fd56d71540daf24cfc056c3b2 Mon Sep 17 00:00:00 2001 From: Zach Musgrave Date: Mon, 9 Dec 2024 11:25:21 -0800 Subject: [PATCH 1/3] Removed query parallelism param --- .../commands/sqlserver/command_line_config.go | 17 ----------------- go/libraries/doltcore/servercfg/serverconfig.go | 5 +---- .../servercfg/testdata/minver_validation.txt | 2 +- go/libraries/doltcore/servercfg/yaml_config.go | 16 +++------------- 4 files changed, 5 insertions(+), 35 deletions(-) diff --git a/go/cmd/dolt/commands/sqlserver/command_line_config.go b/go/cmd/dolt/commands/sqlserver/command_line_config.go index 55ba982cd4a..6c05e48744e 100755 --- a/go/cmd/dolt/commands/sqlserver/command_line_config.go +++ b/go/cmd/dolt/commands/sqlserver/command_line_config.go @@ -41,7 +41,6 @@ type commandLineServerConfig struct { autoCommit bool doltTransactionCommit bool maxConnections uint64 - queryParallelism int tlsKey string tlsCert string requireSecureTransport bool @@ -71,7 +70,6 @@ func DefaultCommandLineServerConfig() *commandLineServerConfig { logLevel: servercfg.DefaultLogLevel, autoCommit: servercfg.DefaultAutoCommit, maxConnections: servercfg.DefaultMaxConnections, - queryParallelism: servercfg.DefaultQueryParallelism, dataDir: servercfg.DefaultDataDir, cfgDir: filepath.Join(servercfg.DefaultDataDir, servercfg.DefaultCfgDir), privilegeFilePath: filepath.Join(servercfg.DefaultDataDir, servercfg.DefaultCfgDir, servercfg.DefaultPrivilegeFilePath), @@ -150,10 +148,6 @@ func NewCommandLineConfig(creds *cli.UserPassword, apr *argparser.ArgParseResult config.withDataDir(dataDir) } - if queryParallelism, ok := apr.GetInt(queryParallelismFlag); ok { - config.withQueryParallelism(queryParallelism) - } - if maxConnections, ok := apr.GetInt(maxConnectionsFlag); ok { config.withMaxConnections(uint64(maxConnections)) } @@ -230,11 +224,6 @@ func (cfg *commandLineServerConfig) MaxConnections() uint64 { return cfg.maxConnections } -// QueryParallelism returns the parallelism that should be used by the go-mysql-server analyzer -func (cfg *commandLineServerConfig) QueryParallelism() int { - return cfg.queryParallelism -} - // TLSKey returns a path to the servers PEM-encoded private TLS key. "" if there is none. func (cfg *commandLineServerConfig) TLSKey() string { return cfg.tlsKey @@ -391,12 +380,6 @@ func (cfg *commandLineServerConfig) withMaxConnections(maxConnections uint64) *c return cfg } -// withQueryParallelism updates the query parallelism and returns the called `*commandLineServerConfig`, which is useful for chaining calls. -func (cfg *commandLineServerConfig) withQueryParallelism(queryParallelism int) *commandLineServerConfig { - cfg.queryParallelism = queryParallelism - return cfg -} - // withDataDir updates the path to a directory to use as the data dir. func (cfg *commandLineServerConfig) withDataDir(dataDir string) *commandLineServerConfig { cfg.dataDir = dataDir diff --git a/go/libraries/doltcore/servercfg/serverconfig.go b/go/libraries/doltcore/servercfg/serverconfig.go index e5fab15a1b3..9435db5126a 100644 --- a/go/libraries/doltcore/servercfg/serverconfig.go +++ b/go/libraries/doltcore/servercfg/serverconfig.go @@ -50,7 +50,6 @@ const ( DefaultAutoCommit = true DefaultDoltTransactionCommit = false DefaultMaxConnections = 100 - DefaultQueryParallelism = 0 DefaultDataDir = "." DefaultCfgDir = ".doltcfg" DefaultPrivilegeFilePath = "privileges.db" @@ -147,8 +146,6 @@ type ServerConfig interface { CfgDir() string // MaxConnections returns the maximum number of simultaneous connections the server will allow. The default is 1 MaxConnections() uint64 - // QueryParallelism returns the parallelism that should be used by the go-mysql-server analyzer - QueryParallelism() int // TLSKey returns a path to the servers PEM-encoded private TLS key. "" if there is none. TLSKey() string // TLSCert returns a path to the servers PEM-encoded TLS certificate chain. "" if there is none. @@ -224,7 +221,7 @@ func DefaultServerConfig() ServerConfig { WriteTimeoutMillis: ptr(uint64(DefaultTimeout)), AllowCleartextPasswords: ptr(DefaultAllowCleartextPasswords), }, - PerformanceConfig: PerformanceYAMLConfig{QueryParallelism: ptr(DefaultQueryParallelism)}, + PerformanceConfig: PerformanceYAMLConfig{}, DataDirStr: ptr(DefaultDataDir), CfgDirStr: ptr(filepath.Join(DefaultDataDir, DefaultCfgDir)), PrivilegeFile: ptr(filepath.Join(DefaultDataDir, DefaultCfgDir, DefaultPrivilegeFilePath)), diff --git a/go/libraries/doltcore/servercfg/testdata/minver_validation.txt b/go/libraries/doltcore/servercfg/testdata/minver_validation.txt index d55ffc3931c..3dfcbe381dc 100644 --- a/go/libraries/doltcore/servercfg/testdata/minver_validation.txt +++ b/go/libraries/doltcore/servercfg/testdata/minver_validation.txt @@ -26,7 +26,7 @@ ListenerConfig servercfg.ListenerYAMLConfig 0.0.0 listener -AllowCleartextPasswords *bool 0.0.0 allow_cleartext_passwords -Socket *string 0.0.0 socket,omitempty PerformanceConfig servercfg.PerformanceYAMLConfig 0.0.0 performance --QueryParallelism *int 0.0.0 query_parallelism +-QueryParallelism *int 0.0.0 query_parallelism,omitempty DataDirStr *string 0.0.0 data_dir,omitempty CfgDirStr *string 0.0.0 cfg_dir,omitempty MetricsConfig servercfg.MetricsYAMLConfig 0.0.0 metrics diff --git a/go/libraries/doltcore/servercfg/yaml_config.go b/go/libraries/doltcore/servercfg/yaml_config.go index 48c6a0c54fe..91942c92c4a 100644 --- a/go/libraries/doltcore/servercfg/yaml_config.go +++ b/go/libraries/doltcore/servercfg/yaml_config.go @@ -94,7 +94,8 @@ type ListenerYAMLConfig struct { // PerformanceYAMLConfig contains configuration parameters for performance tweaking type PerformanceYAMLConfig struct { - QueryParallelism *int `yaml:"query_parallelism"` + // QueryParallelism is deprecated but still present to prevent breaking YAML config that still uses it + QueryParallelism *int `yaml:"query_parallelism,omitempty"` } type MetricsYAMLConfig struct { @@ -202,9 +203,7 @@ func ServerConfigAsYAMLConfig(cfg ServerConfig) *YAMLConfig { AllowCleartextPasswords: nillableBoolPtr(cfg.AllowCleartextPasswords()), Socket: nillableStrPtr(cfg.Socket()), }, - PerformanceConfig: PerformanceYAMLConfig{ - QueryParallelism: nillableIntPtr(cfg.QueryParallelism()), - }, + PerformanceConfig: PerformanceYAMLConfig{}, DataDirStr: ptr(cfg.DataDir()), CfgDirStr: ptr(cfg.CfgDir()), MetricsConfig: MetricsYAMLConfig{ @@ -475,15 +474,6 @@ func (cfg YAMLConfig) AllowCleartextPasswords() bool { return *cfg.ListenerConfig.AllowCleartextPasswords } -// QueryParallelism returns the parallelism that should be used by the go-mysql-server analyzer -func (cfg YAMLConfig) QueryParallelism() int { - if cfg.PerformanceConfig.QueryParallelism == nil { - return DefaultQueryParallelism - } - - return *cfg.PerformanceConfig.QueryParallelism -} - // TLSKey returns a path to the servers PEM-encoded private TLS key. "" if there is none. func (cfg YAMLConfig) TLSKey() string { if cfg.ListenerConfig.TLSKey == nil { From eefe350ef7570a0b7fa28682eafd6d99279945cc Mon Sep 17 00:00:00 2001 From: Zach Musgrave Date: Mon, 9 Dec 2024 11:31:46 -0800 Subject: [PATCH 2/3] Made the entire performance block nillable --- go/libraries/doltcore/servercfg/serverconfig.go | 1 - go/libraries/doltcore/servercfg/testdata/minver_validation.txt | 2 +- go/libraries/doltcore/servercfg/yaml_config.go | 3 +-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/go/libraries/doltcore/servercfg/serverconfig.go b/go/libraries/doltcore/servercfg/serverconfig.go index 9435db5126a..725abfd14b3 100644 --- a/go/libraries/doltcore/servercfg/serverconfig.go +++ b/go/libraries/doltcore/servercfg/serverconfig.go @@ -221,7 +221,6 @@ func DefaultServerConfig() ServerConfig { WriteTimeoutMillis: ptr(uint64(DefaultTimeout)), AllowCleartextPasswords: ptr(DefaultAllowCleartextPasswords), }, - PerformanceConfig: PerformanceYAMLConfig{}, DataDirStr: ptr(DefaultDataDir), CfgDirStr: ptr(filepath.Join(DefaultDataDir, DefaultCfgDir)), PrivilegeFile: ptr(filepath.Join(DefaultDataDir, DefaultCfgDir, DefaultPrivilegeFilePath)), diff --git a/go/libraries/doltcore/servercfg/testdata/minver_validation.txt b/go/libraries/doltcore/servercfg/testdata/minver_validation.txt index 3dfcbe381dc..dcf4d8d1202 100644 --- a/go/libraries/doltcore/servercfg/testdata/minver_validation.txt +++ b/go/libraries/doltcore/servercfg/testdata/minver_validation.txt @@ -25,7 +25,7 @@ ListenerConfig servercfg.ListenerYAMLConfig 0.0.0 listener -RequireSecureTransport *bool 0.0.0 require_secure_transport -AllowCleartextPasswords *bool 0.0.0 allow_cleartext_passwords -Socket *string 0.0.0 socket,omitempty -PerformanceConfig servercfg.PerformanceYAMLConfig 0.0.0 performance +PerformanceConfig *servercfg.PerformanceYAMLConfig 0.0.0 performance,omitempty -QueryParallelism *int 0.0.0 query_parallelism,omitempty DataDirStr *string 0.0.0 data_dir,omitempty CfgDirStr *string 0.0.0 cfg_dir,omitempty diff --git a/go/libraries/doltcore/servercfg/yaml_config.go b/go/libraries/doltcore/servercfg/yaml_config.go index 91942c92c4a..ccf31909601 100644 --- a/go/libraries/doltcore/servercfg/yaml_config.go +++ b/go/libraries/doltcore/servercfg/yaml_config.go @@ -130,7 +130,7 @@ type YAMLConfig struct { BehaviorConfig BehaviorYAMLConfig `yaml:"behavior"` UserConfig UserYAMLConfig `yaml:"user"` ListenerConfig ListenerYAMLConfig `yaml:"listener"` - PerformanceConfig PerformanceYAMLConfig `yaml:"performance"` + PerformanceConfig *PerformanceYAMLConfig `yaml:"performance,omitempty"` DataDirStr *string `yaml:"data_dir,omitempty"` CfgDirStr *string `yaml:"cfg_dir,omitempty"` MetricsConfig MetricsYAMLConfig `yaml:"metrics"` @@ -203,7 +203,6 @@ func ServerConfigAsYAMLConfig(cfg ServerConfig) *YAMLConfig { AllowCleartextPasswords: nillableBoolPtr(cfg.AllowCleartextPasswords()), Socket: nillableStrPtr(cfg.Socket()), }, - PerformanceConfig: PerformanceYAMLConfig{}, DataDirStr: ptr(cfg.DataDir()), CfgDirStr: ptr(cfg.CfgDir()), MetricsConfig: MetricsYAMLConfig{ From 7db8a4bc8d06f96b8477ec5da5decd797733895f Mon Sep 17 00:00:00 2001 From: zachmu Date: Mon, 9 Dec 2024 19:40:20 +0000 Subject: [PATCH 3/3] [ga-format-pr] Run go/utils/repofmt/format_repo.sh and go/Godeps/update.sh --- .../doltcore/servercfg/yaml_config.go | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/go/libraries/doltcore/servercfg/yaml_config.go b/go/libraries/doltcore/servercfg/yaml_config.go index ccf31909601..1eeae402155 100644 --- a/go/libraries/doltcore/servercfg/yaml_config.go +++ b/go/libraries/doltcore/servercfg/yaml_config.go @@ -124,20 +124,20 @@ type UserSessionVars struct { // YAMLConfig is a ServerConfig implementation which is read from a yaml file type YAMLConfig struct { - LogLevelStr *string `yaml:"log_level,omitempty"` - MaxQueryLenInLogs *int `yaml:"max_logged_query_len,omitempty"` - EncodeLoggedQuery *bool `yaml:"encode_logged_query,omitempty"` - BehaviorConfig BehaviorYAMLConfig `yaml:"behavior"` - UserConfig UserYAMLConfig `yaml:"user"` - ListenerConfig ListenerYAMLConfig `yaml:"listener"` + LogLevelStr *string `yaml:"log_level,omitempty"` + MaxQueryLenInLogs *int `yaml:"max_logged_query_len,omitempty"` + EncodeLoggedQuery *bool `yaml:"encode_logged_query,omitempty"` + BehaviorConfig BehaviorYAMLConfig `yaml:"behavior"` + UserConfig UserYAMLConfig `yaml:"user"` + ListenerConfig ListenerYAMLConfig `yaml:"listener"` PerformanceConfig *PerformanceYAMLConfig `yaml:"performance,omitempty"` - DataDirStr *string `yaml:"data_dir,omitempty"` - CfgDirStr *string `yaml:"cfg_dir,omitempty"` - MetricsConfig MetricsYAMLConfig `yaml:"metrics"` - RemotesapiConfig RemotesapiYAMLConfig `yaml:"remotesapi"` - ClusterCfg *ClusterYAMLConfig `yaml:"cluster,omitempty"` - PrivilegeFile *string `yaml:"privilege_file,omitempty"` - BranchControlFile *string `yaml:"branch_control_file,omitempty"` + DataDirStr *string `yaml:"data_dir,omitempty"` + CfgDirStr *string `yaml:"cfg_dir,omitempty"` + MetricsConfig MetricsYAMLConfig `yaml:"metrics"` + RemotesapiConfig RemotesapiYAMLConfig `yaml:"remotesapi"` + ClusterCfg *ClusterYAMLConfig `yaml:"cluster,omitempty"` + PrivilegeFile *string `yaml:"privilege_file,omitempty"` + BranchControlFile *string `yaml:"branch_control_file,omitempty"` // TODO: Rename to UserVars_ Vars []UserSessionVars `yaml:"user_session_vars"` SystemVars_ map[string]interface{} `yaml:"system_variables,omitempty" minver:"1.11.1"`