Skip to content

Commit

Permalink
add follower retry option (pingcap#75)
Browse files Browse the repository at this point in the history
Co-authored-by: artem_danilov <artem_danilov@airbnb.com>
  • Loading branch information
2 people authored and GitHub Enterprise committed May 7, 2024
1 parent 7fc6448 commit 13fd7c9
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 4 deletions.
6 changes: 4 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ require (
github.com/stretchr/testify v1.8.0
github.com/tdakkota/asciicheck v0.1.1
github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2
github.com/tikv/client-go/v2 v2.0.4-0.20231020030327-4ecf7c282e37
github.com/tikv/pd/client v0.0.0-20230904040343-947701a32c05
github.com/tikv/client-go/v2 v2.0.4-0.20231020030327-4ecf7c282e37
github.com/tikv/pd/client v0.0.0-20230904040343-947701a32c05
github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144
github.com/twmb/murmur3 v1.1.3
github.com/uber/jaeger-client-go v2.22.1+incompatible
Expand Down Expand Up @@ -275,3 +275,5 @@ replace (
sourcegraph.com/sourcegraph/appdash => github.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0
sourcegraph.com/sourcegraph/appdash-data => github.com/sourcegraph/appdash-data v0.0.0-20151005221446-73f23eafcf67
)

replace github.com/tikv/client-go/v2 => github.com/zyguan/client-go/v2 v2.0.0-alpha.0.20240110111729-6e9a19b9e654
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -940,8 +940,6 @@ github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3 h1:f+jULpR
github.com/tenntenn/text/transform v0.0.0-20200319021203-7eef512accb3/go.mod h1:ON8b8w4BN/kE1EOhwT0o+d62W65a6aPw1nouo9LMgyY=
github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2 h1:mbAskLJ0oJfDRtkanvQPiooDH8HvJ2FBh+iKT/OmiQQ=
github.com/tiancaiamao/appdash v0.0.0-20181126055449-889f96f722a2/go.mod h1:2PfKggNGDuadAa0LElHrByyrz4JPZ9fFx6Gs7nx7ZZU=
github.com/tikv/client-go/v2 v2.0.4-0.20231020030327-4ecf7c282e37 h1:x4x8yO7tHtxOepMGpPnnLMVw2geDsrYbbbB7k+0zusY=
github.com/tikv/client-go/v2 v2.0.4-0.20231020030327-4ecf7c282e37/go.mod h1:mmVCLP2OqWvQJPOIevQPZvGphzh/oq9vv8J5LDfpadQ=
github.com/tikv/pd/client v0.0.0-20230904040343-947701a32c05 h1:e4hLUKfgfPeJPZwOfU+/I/03G0sn6IZqVcbX/5o+hvM=
github.com/tikv/pd/client v0.0.0-20230904040343-947701a32c05/go.mod h1:MLIl+d2WbOF4A3U88WKtyXrQQW417wZDDvBcq2IW9bQ=
github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144 h1:kl4KhGNsJIbDHS9/4U9yQo1UcPQM0kOMJHn29EoH/Ro=
Expand Down Expand Up @@ -999,6 +997,8 @@ github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yusufpapurcu/wmi v1.2.2 h1:KBNDSne4vP5mbSWnJbO+51IMOXJB67QiYCSBrubbPRg=
github.com/yusufpapurcu/wmi v1.2.2/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
github.com/zyguan/client-go/v2 v2.0.0-alpha.0.20240110111729-6e9a19b9e654 h1:Fyu8ZooUlfrRXUJP3hYpcm6wVjZoZ3vW6D8KU1hLnVk=
github.com/zyguan/client-go/v2 v2.0.0-alpha.0.20240110111729-6e9a19b9e654/go.mod h1:mmVCLP2OqWvQJPOIevQPZvGphzh/oq9vv8J5LDfpadQ=
go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU=
go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4=
Expand Down
21 changes: 21 additions & 0 deletions sessionctx/variable/sysvar.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import (
"github.com/pingcap/tidb/util/versioninfo"
tikvcfg "github.com/tikv/client-go/v2/config"
tikvstore "github.com/tikv/client-go/v2/kv"
"github.com/tikv/client-go/v2/tikv"
atomic2 "go.uber.org/atomic"
)

Expand Down Expand Up @@ -489,6 +490,24 @@ var defaultSysVars = []*SysVar{
}, GetGlobal: func(_ context.Context, s *SessionVars) (string, error) {
return BoolToOnOff(EnableRCReadCheckTS.Load()), nil
}},
{Scope: ScopeInstance, Name: TiKVClientReplicaSelectorExperimentalOptions, Value: "", Type: TypeStr, SetGlobal: func(_ context.Context, s *SessionVars, val string) error {
var opts tikv.ReplicaSelectorExperimentalOptions
if len(val) > 0 {
err := json.Unmarshal([]byte(val), &opts)
if err != nil {
return errors.Errorf("invalid json value %q: %v", val, err)
}
tikv.SetReplicaSelectorExperimentalOptions(opts)
}
return nil
}, GetGlobal: func(ctx context.Context, sv *SessionVars) (string, error) {
opts := tikv.GetReplicaSelectorExperimentalOptions()
raw, err := json.Marshal(opts)
if err != nil {
return "", errors.Trace(err)
}
return string(raw), nil
}},

/* The system variables below have GLOBAL scope */
{Scope: ScopeGlobal, Name: MaxPreparedStmtCount, Value: strconv.FormatInt(DefMaxPreparedStmtCount, 10), Type: TypeInt, MinValue: -1, MaxValue: 1048576,
Expand Down Expand Up @@ -2608,6 +2627,8 @@ const (
MaxExecutionTime = "max_execution_time"
// TiKVClientReadTimeout is the name of the 'tikv_client_read_timeout' system variable.
TiKVClientReadTimeout = "tikv_client_read_timeout"
// TiKVClientReplicaSelectorExperimentalOptions is the name of the 'tikv_client_replica_selector_experimental_options' system variable.
TiKVClientReplicaSelectorExperimentalOptions = "tikv_client_replica_selector_experimental_options"
// ReadOnly is the name of the 'read_only' system variable.
ReadOnly = "read_only"
// DefaultAuthPlugin is the name of 'default_authentication_plugin' system variable.
Expand Down

0 comments on commit 13fd7c9

Please sign in to comment.