Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

store/tikv: remove unused function and private the variable shuttingDown #25194

Merged
merged 2 commits into from
Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion store/tikv/backoff.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ type BackoffConfig = retry.Config
// Maximum total sleep time(in ms) for kv/cop commands.
const (
gcResolveLockMaxBackoff = 100000
pdRPCMaxBackoff = 20000
// CommitSecondaryMaxBackoff is max sleep time of the 'commit' command
CommitSecondaryMaxBackoff = 41000
)
Expand Down
9 changes: 4 additions & 5 deletions store/tikv/region_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,20 +43,19 @@ import (
"github.com/pingcap/tidb/store/tikv/util"
)

// ShuttingDown is a flag to indicate tidb-server is exiting (Ctrl+C signal
// shuttingDown is a flag to indicate tidb-server is exiting (Ctrl+C signal
// receved for example). If this flag is set, tikv client should not retry on
// network error because tidb-server expect tikv client to exit as soon as possible.
// TODO: make it private when br is ready.
var ShuttingDown uint32
var shuttingDown uint32

// StoreShuttingDown atomically stores ShuttingDown into v.
func StoreShuttingDown(v uint32) {
atomic.StoreUint32(&ShuttingDown, v)
atomic.StoreUint32(&shuttingDown, v)
}

// LoadShuttingDown atomically loads ShuttingDown.
func LoadShuttingDown() uint32 {
return atomic.LoadUint32(&ShuttingDown)
return atomic.LoadUint32(&shuttingDown)
}

// RegionRequestSender sends KV/Cop requests to tikv server. It handles network
Expand Down
45 changes: 0 additions & 45 deletions store/tikv/retry/backoff.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
tikverr "github.com/pingcap/tidb/store/tikv/error"
"github.com/pingcap/tidb/store/tikv/kv"
"github.com/pingcap/tidb/store/tikv/logutil"
"github.com/pingcap/tidb/store/tikv/metrics"
"github.com/pingcap/tidb/store/tikv/util"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
Expand Down Expand Up @@ -105,50 +104,6 @@ func (b *Backoffer) BackoffWithMaxSleepTxnLockFast(maxSleepMs int, err error) er
return b.BackoffWithCfgAndMaxSleep(cfg, maxSleepMs, err)
}

// BackoffWithMaxSleep is deprecated, please use BackoffWithCfgAndMaxSleep instead. TODO: remove it when br is ready.
func (b *Backoffer) BackoffWithMaxSleep(typ int, maxSleepMs int, err error) error {
// Back off types.
const (
boTiKVRPC int = iota
boTiFlashRPC
boTxnLock
boTxnLockFast
boPDRPC
boRegionMiss
boTiKVServerBusy
boTiFlashServerBusy
boTxnNotFound
boStaleCmd
boMaxTsNotSynced
)
switch typ {
case boTiKVRPC:
return b.BackoffWithCfgAndMaxSleep(BoTiKVRPC, maxSleepMs, err)
case boTiFlashRPC:
return b.BackoffWithCfgAndMaxSleep(BoTiFlashRPC, maxSleepMs, err)
case boTxnLock:
return b.BackoffWithCfgAndMaxSleep(BoTxnLock, maxSleepMs, err)
case boTxnLockFast:
return b.BackoffWithCfgAndMaxSleep(BoTxnLockFast, maxSleepMs, err)
case boPDRPC:
return b.BackoffWithCfgAndMaxSleep(BoPDRPC, maxSleepMs, err)
case boRegionMiss:
return b.BackoffWithCfgAndMaxSleep(BoRegionMiss, maxSleepMs, err)
case boTiKVServerBusy:
return b.BackoffWithCfgAndMaxSleep(BoTiKVServerBusy, maxSleepMs, err)
case boTiFlashServerBusy:
return b.BackoffWithCfgAndMaxSleep(BoTiFlashServerBusy, maxSleepMs, err)
case boTxnNotFound:
return b.BackoffWithCfgAndMaxSleep(BoTxnNotFound, maxSleepMs, err)
case boStaleCmd:
return b.BackoffWithCfgAndMaxSleep(BoStaleCmd, maxSleepMs, err)
case boMaxTsNotSynced:
return b.BackoffWithCfgAndMaxSleep(BoMaxTsNotSynced, maxSleepMs, err)
}
cfg := NewConfig("", &metrics.BackoffHistogramEmpty, nil, tikverr.ErrUnknown)
return b.BackoffWithCfgAndMaxSleep(cfg, maxSleepMs, err)
}

// BackoffWithCfgAndMaxSleep sleeps a while base on the Config and records the error message
// and never sleep more than maxSleepMs for each sleep.
func (b *Backoffer) BackoffWithCfgAndMaxSleep(cfg *Config, maxSleepMs int, err error) error {
Expand Down