Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
Signed-off-by: Shuaipeng Yu <[email protected]>
  • Loading branch information
jackysp committed May 6, 2019
1 parent 4128691 commit c88a0c5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sessionctx/variable/tidb_vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ const (
TiDBBackoffLockFast = "tidb_backoff_lock_fast"

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

// tidb_ddl_reorg_worker_cnt defines the count of ddl reorg workers.
Expand Down
2 changes: 2 additions & 0 deletions store/tikv/backoff.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ func (b *Backoffer) WithVars(vars *kv.Variables) *Backoffer {
if vars != nil {
b.vars = vars
}
// maxSleep is the max sleep time in millisecond.
// When it is multiplied by BackOffWeight, it should not be greater than MaxInt32.
if math.MaxInt32/b.vars.BackOffWeight >= b.maxSleep {
b.maxSleep *= b.vars.BackOffWeight
}
Expand Down

0 comments on commit c88a0c5

Please sign in to comment.