diff --git a/Makefile b/Makefile index 971b5fe1c6..66b3ba0686 100644 --- a/Makefile +++ b/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 diff --git a/sessionctx/variable/sysvar.go b/sessionctx/variable/sysvar.go index 9b75a0c685..9ee4fea857 100644 --- a/sessionctx/variable/sysvar.go +++ b/sessionctx/variable/sysvar.go @@ -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 }, },