sessionctx: fix tidb_gogc_tuner_threshold (#38851)
This commit is contained in:
2
Makefile
2
Makefile
@ -415,7 +415,7 @@ bazel_coverage_test: failpoint-enable bazel_ci_prepare
|
||||
|
||||
bazel_build: bazel_ci_prepare
|
||||
mkdir -p bin
|
||||
bazel $(BAZEL_GLOBAL_CONFIG) build --remote_download_minimal $(BAZEL_CMD_CONFIG) \
|
||||
bazel $(BAZEL_GLOBAL_CONFIG) build $(BAZEL_CMD_CONFIG) \
|
||||
//... --//build:with_nogo_flag=true
|
||||
bazel $(BAZEL_GLOBAL_CONFIG) build $(BAZEL_CMD_CONFIG) \
|
||||
//cmd/importer:importer //tidb-server:tidb-server //tidb-server:tidb-server-check --//build:with_nogo_flag=true
|
||||
|
||||
@ -748,12 +748,20 @@ var defaultSysVars = []*SysVar{
|
||||
}
|
||||
return strconv.FormatFloat(floatValue, 'f', -1, 64), nil
|
||||
},
|
||||
SetGlobal: func(_ context.Context, s *SessionVars, val string) error {
|
||||
SetGlobal: func(_ context.Context, s *SessionVars, val string) (err error) {
|
||||
factor := tidbOptFloat64(val, DefTiDBGOGCTunerThreshold)
|
||||
GOGCTunerThreshold.Store(factor)
|
||||
memTotal := memory.ServerMemoryLimit.Load()
|
||||
threshold := float64(memTotal) * factor
|
||||
gctuner.Tuning(uint64(threshold))
|
||||
if memTotal == 0 {
|
||||
memTotal, err = memory.MemTotal()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if factor > 0 {
|
||||
threshold := float64(memTotal) * factor
|
||||
gctuner.Tuning(uint64(threshold))
|
||||
}
|
||||
return nil
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user