Skip to content

Commit

Permalink
Merge pull request #8655 from dolthub/zachmu/qp
Browse files Browse the repository at this point in the history
Removed the `performance` server config block
  • Loading branch information
zachmu authored Dec 9, 2024
2 parents 58d4626 + 7db8a4b commit ffd5bde
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 50 deletions.
17 changes: 0 additions & 17 deletions go/cmd/dolt/commands/sqlserver/command_line_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ type commandLineServerConfig struct {
autoCommit bool
doltTransactionCommit bool
maxConnections uint64
queryParallelism int
tlsKey string
tlsCert string
requireSecureTransport bool
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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))
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions go/libraries/doltcore/servercfg/serverconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const (
DefaultAutoCommit = true
DefaultDoltTransactionCommit = false
DefaultMaxConnections = 100
DefaultQueryParallelism = 0
DefaultDataDir = "."
DefaultCfgDir = ".doltcfg"
DefaultPrivilegeFilePath = "privileges.db"
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -224,7 +221,6 @@ func DefaultServerConfig() ServerConfig {
WriteTimeoutMillis: ptr(uint64(DefaultTimeout)),
AllowCleartextPasswords: ptr(DefaultAllowCleartextPasswords),
},
PerformanceConfig: PerformanceYAMLConfig{QueryParallelism: ptr(DefaultQueryParallelism)},
DataDirStr: ptr(DefaultDataDir),
CfgDirStr: ptr(filepath.Join(DefaultDataDir, DefaultCfgDir)),
PrivilegeFile: ptr(filepath.Join(DefaultDataDir, DefaultCfgDir, DefaultPrivilegeFilePath)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ 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
-QueryParallelism *int 0.0.0 query_parallelism
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
MetricsConfig servercfg.MetricsYAMLConfig 0.0.0 metrics
Expand Down
43 changes: 16 additions & 27 deletions go/libraries/doltcore/servercfg/yaml_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -123,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"`
PerformanceConfig PerformanceYAMLConfig `yaml:"performance"`
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"`
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"`
// TODO: Rename to UserVars_
Vars []UserSessionVars `yaml:"user_session_vars"`
SystemVars_ map[string]interface{} `yaml:"system_variables,omitempty" minver:"1.11.1"`
Expand Down Expand Up @@ -202,9 +203,6 @@ func ServerConfigAsYAMLConfig(cfg ServerConfig) *YAMLConfig {
AllowCleartextPasswords: nillableBoolPtr(cfg.AllowCleartextPasswords()),
Socket: nillableStrPtr(cfg.Socket()),
},
PerformanceConfig: PerformanceYAMLConfig{
QueryParallelism: nillableIntPtr(cfg.QueryParallelism()),
},
DataDirStr: ptr(cfg.DataDir()),
CfgDirStr: ptr(cfg.CfgDir()),
MetricsConfig: MetricsYAMLConfig{
Expand Down Expand Up @@ -475,15 +473,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 {
Expand Down

0 comments on commit ffd5bde

Please sign in to comment.