Skip to content

Commit aa4f4da

Browse files
authored
variable: fix setting tidb_enable_tso_follower_proxy with TSO service (pingcap#51216)
close pingcap#51194
1 parent fc81182 commit aa4f4da

File tree

6 files changed

+19
-21
lines changed

6 files changed

+19
-21
lines changed

DEPS.bzl

+6-6
Original file line numberDiff line numberDiff line change
@@ -7067,13 +7067,13 @@ def go_deps():
70677067
name = "com_github_tikv_pd_client",
70687068
build_file_proto_mode = "disable_global",
70697069
importpath = "github.com/tikv/pd/client",
7070-
sha256 = "d77235e2ea8b98a9d2d5877f90b4e6f67bc2d108db5d00873ae3c803ed4b7d23",
7071-
strip_prefix = "github.com/tikv/pd/client@v0.0.0-20240126020320-567c7d43a008",
7070+
sha256 = "33907bc71805bd41f7b9002f773365640cf78cf9253c3ab9658631374dd634fb",
7071+
strip_prefix = "github.com/tikv/pd/client@v0.0.0-20240221051526-d6d9feab3e2a",
70727072
urls = [
7073-
"http://bazel-cache.pingcap.net:8080/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20240126020320-567c7d43a008.zip",
7074-
"http://ats.apps.svc/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20240126020320-567c7d43a008.zip",
7075-
"https://cache.hawkingrei.com/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20240126020320-567c7d43a008.zip",
7076-
"https://storage.googleapis.com/pingcapmirror/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20240126020320-567c7d43a008.zip",
7073+
"http://bazel-cache.pingcap.net:8080/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20240221051526-d6d9feab3e2a.zip",
7074+
"http://ats.apps.svc/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20240221051526-d6d9feab3e2a.zip",
7075+
"https://cache.hawkingrei.com/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20240221051526-d6d9feab3e2a.zip",
7076+
"https://storage.googleapis.com/pingcapmirror/gomod/github.com/tikv/pd/client/com_github_tikv_pd_client-v0.0.0-20240221051526-d6d9feab3e2a.zip",
70777077
],
70787078
)
70797079
go_repository(

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ require (
108108
github.com/tdakkota/asciicheck v0.2.0
109109
github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2
110110
github.com/tikv/client-go/v2 v2.0.8-0.20240205071126-11cb7985f0ec
111-
github.com/tikv/pd/client v0.0.0-20240126020320-567c7d43a008
111+
github.com/tikv/pd/client v0.0.0-20240221051526-d6d9feab3e2a
112112
github.com/timakin/bodyclose v0.0.0-20240125160201-f835fa56326a
113113
github.com/twmb/murmur3 v1.1.6
114114
github.com/uber/jaeger-client-go v2.22.1+incompatible

go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -866,8 +866,8 @@ github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a h1:J/YdBZ46WKpXsxsW
866866
github.com/tiancaiamao/gp v0.0.0-20221230034425-4025bc8a4d4a/go.mod h1:h4xBhSNtOeEosLJ4P7JyKXX7Cabg7AVkWCK5gV2vOrM=
867867
github.com/tikv/client-go/v2 v2.0.8-0.20240205071126-11cb7985f0ec h1:j/1OKeXulUHDlfm7uHb6PTlNdagwrHzoHZGPQNK0y68=
868868
github.com/tikv/client-go/v2 v2.0.8-0.20240205071126-11cb7985f0ec/go.mod h1:jZLZhtui1Po+x616K7jxVAMe+aQfAuWqUZluRdO75Kc=
869-
github.com/tikv/pd/client v0.0.0-20240126020320-567c7d43a008 h1:McTV/45piKWPinw0m7gFospPEGBW8AfK5J0RB/G9DP4=
870-
github.com/tikv/pd/client v0.0.0-20240126020320-567c7d43a008/go.mod h1:Z/QAgOt29zvwBTd0H6pdx45VO6KRNc/O/DzGkVmSyZg=
869+
github.com/tikv/pd/client v0.0.0-20240221051526-d6d9feab3e2a h1:V2lmRIYeGGIr28YoSvqXVkrvCFqqNfUNhbZqMCFa+tQ=
870+
github.com/tikv/pd/client v0.0.0-20240221051526-d6d9feab3e2a/go.mod h1:Z/QAgOt29zvwBTd0H6pdx45VO6KRNc/O/DzGkVmSyZg=
871871
github.com/timakin/bodyclose v0.0.0-20240125160201-f835fa56326a h1:A6uKudFIfAEpoPdaal3aSqGxBzLyU8TqyXImLwo6dIo=
872872
github.com/timakin/bodyclose v0.0.0-20240125160201-f835fa56326a/go.mod h1:mkjARE7Yr8qU23YcGMSALbIxTQ9r9QBVahQOBRfU460=
873873
github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs=

pkg/domain/domain_sysvars.go

+6-5
Original file line numberDiff line numberDiff line change
@@ -50,23 +50,23 @@ func (do *Domain) setStatsCacheCapacity(c int64) {
5050
do.StatsHandle().SetStatsCacheCapacity(c)
5151
}
5252

53-
func (do *Domain) setPDClientDynamicOption(name, sVal string) {
53+
func (do *Domain) setPDClientDynamicOption(name, sVal string) error {
5454
switch name {
5555
case variable.TiDBTSOClientBatchMaxWaitTime:
5656
val, err := strconv.ParseFloat(sVal, 64)
5757
if err != nil {
58-
break
58+
return err
5959
}
6060
err = do.updatePDClient(pd.MaxTSOBatchWaitInterval, time.Duration(float64(time.Millisecond)*val))
6161
if err != nil {
62-
break
62+
return err
6363
}
6464
variable.MaxTSOBatchWaitInterval.Store(val)
6565
case variable.TiDBEnableTSOFollowerProxy:
6666
val := variable.TiDBOptOn(sVal)
6767
err := do.updatePDClient(pd.EnableTSOFollowerProxy, val)
6868
if err != nil {
69-
break
69+
return err
7070
}
7171
variable.EnableTSOFollowerProxy.Store(val)
7272
case variable.PDEnableFollowerHandleRegion:
@@ -75,10 +75,11 @@ func (do *Domain) setPDClientDynamicOption(name, sVal string) {
7575
// If pd support more APIs in follower, the pd option may be changed.
7676
err := do.updatePDClient(pd.EnableFollowerHandle, val)
7777
if err != nil {
78-
break
78+
return err
7979
}
8080
variable.EnablePDFollowerHandleRegion.Store(val)
8181
}
82+
return nil
8283
}
8384

8485
func (*Domain) setGlobalResourceControl(enable bool) {

pkg/sessionctx/variable/sysvar.go

+3-6
Original file line numberDiff line numberDiff line change
@@ -699,20 +699,17 @@ var defaultSysVars = []*SysVar{
699699
return strconv.FormatFloat(MaxTSOBatchWaitInterval.Load(), 'f', -1, 64), nil
700700
},
701701
SetGlobal: func(_ context.Context, s *SessionVars, val string) error {
702-
(*SetPDClientDynamicOption.Load())(TiDBTSOClientBatchMaxWaitTime, val)
703-
return nil
702+
return (*SetPDClientDynamicOption.Load())(TiDBTSOClientBatchMaxWaitTime, val)
704703
}},
705704
{Scope: ScopeGlobal, Name: TiDBEnableTSOFollowerProxy, Value: BoolToOnOff(DefTiDBEnableTSOFollowerProxy), Type: TypeBool, GetGlobal: func(_ context.Context, sv *SessionVars) (string, error) {
706705
return BoolToOnOff(EnableTSOFollowerProxy.Load()), nil
707706
}, SetGlobal: func(_ context.Context, s *SessionVars, val string) error {
708-
(*SetPDClientDynamicOption.Load())(TiDBEnableTSOFollowerProxy, val)
709-
return nil
707+
return (*SetPDClientDynamicOption.Load())(TiDBEnableTSOFollowerProxy, val)
710708
}},
711709
{Scope: ScopeGlobal, Name: PDEnableFollowerHandleRegion, Value: BoolToOnOff(DefPDEnableFollowerHandleRegion), Type: TypeBool, GetGlobal: func(_ context.Context, sv *SessionVars) (string, error) {
712710
return BoolToOnOff(EnablePDFollowerHandleRegion.Load()), nil
713711
}, SetGlobal: func(_ context.Context, s *SessionVars, val string) error {
714-
(*SetPDClientDynamicOption.Load())(PDEnableFollowerHandleRegion, val)
715-
return nil
712+
return (*SetPDClientDynamicOption.Load())(PDEnableFollowerHandleRegion, val)
716713
}},
717714
{Scope: ScopeGlobal, Name: TiDBEnableLocalTxn, Value: BoolToOnOff(DefTiDBEnableLocalTxn), Hidden: true, Type: TypeBool, Depended: true, GetGlobal: func(_ context.Context, sv *SessionVars) (string, error) {
718715
return BoolToOnOff(EnableLocalTxn.Load()), nil

pkg/sessionctx/variable/tidb_vars.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1579,7 +1579,7 @@ var (
15791579
// SetStatsCacheCapacity is the func registered by domain to set statsCache memory quota.
15801580
SetStatsCacheCapacity atomic.Pointer[func(int64)]
15811581
// SetPDClientDynamicOption is the func registered by domain
1582-
SetPDClientDynamicOption atomic.Pointer[func(string, string)]
1582+
SetPDClientDynamicOption atomic.Pointer[func(string, string) error]
15831583
// SwitchMDL is the func registered by DDL to switch MDL.
15841584
SwitchMDL func(bool2 bool) error = nil
15851585
// EnableDDL is the func registered by ddl to enable running ddl in this instance.

0 commit comments

Comments
 (0)