Skip to content

Commit c88a0c5

Browse files
committed
add comments
Signed-off-by: Shuaipeng Yu <jackysp@gmail.com>
1 parent 4128691 commit c88a0c5

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

sessionctx/variable/tidb_vars.go

+3
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ const (
220220
TiDBBackoffLockFast = "tidb_backoff_lock_fast"
221221

222222
// tidb_back_off_weight is used to control the max back off time in TiDB.
223+
// The default maximum back off time is a small value.
224+
// BackOffWeight could multiply it to let the user adjust the maximum time for retrying.
225+
// Only positive integers can be accepted, which means that the maximum back off time can only grow.
223226
TiDBBackOffWeight = "tidb_back_off_weight"
224227

225228
// tidb_ddl_reorg_worker_cnt defines the count of ddl reorg workers.

store/tikv/backoff.go

+2
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ func (b *Backoffer) WithVars(vars *kv.Variables) *Backoffer {
241241
if vars != nil {
242242
b.vars = vars
243243
}
244+
// maxSleep is the max sleep time in millisecond.
245+
// When it is multiplied by BackOffWeight, it should not be greater than MaxInt32.
244246
if math.MaxInt32/b.vars.BackOffWeight >= b.maxSleep {
245247
b.maxSleep *= b.vars.BackOffWeight
246248
}

0 commit comments

Comments
 (0)