*: rename tidb_back_off_weight (#11655)
This commit is contained in:
@ -370,16 +370,16 @@ func (s *testSuite2) TestSetVar(c *C) {
|
||||
c.Assert(err.Error(), Equals, "tidb_wait_split_region_timeout(0) cannot be smaller than 1")
|
||||
tk.MustQuery(`select @@session.tidb_wait_split_region_timeout;`).Check(testkit.Rows("1"))
|
||||
|
||||
tk.MustExec("set session tidb_back_off_weight = 3")
|
||||
tk.MustQuery("select @@session.tidb_back_off_weight;").Check(testkit.Rows("3"))
|
||||
tk.MustExec("set session tidb_back_off_weight = 20")
|
||||
tk.MustQuery("select @@session.tidb_back_off_weight;").Check(testkit.Rows("20"))
|
||||
_, err = tk.Exec("set session tidb_back_off_weight = -1")
|
||||
tk.MustExec("set session tidb_backoff_weight = 3")
|
||||
tk.MustQuery("select @@session.tidb_backoff_weight;").Check(testkit.Rows("3"))
|
||||
tk.MustExec("set session tidb_backoff_weight = 20")
|
||||
tk.MustQuery("select @@session.tidb_backoff_weight;").Check(testkit.Rows("20"))
|
||||
_, err = tk.Exec("set session tidb_backoff_weight = -1")
|
||||
c.Assert(err, NotNil)
|
||||
_, err = tk.Exec("set global tidb_back_off_weight = 0")
|
||||
_, err = tk.Exec("set global tidb_backoff_weight = 0")
|
||||
c.Assert(err, NotNil)
|
||||
tk.MustExec("set global tidb_back_off_weight = 10")
|
||||
tk.MustQuery("select @@global.tidb_back_off_weight;").Check(testkit.Rows("10"))
|
||||
tk.MustExec("set global tidb_backoff_weight = 10")
|
||||
tk.MustQuery("select @@global.tidb_backoff_weight;").Check(testkit.Rows("10"))
|
||||
|
||||
tk.MustExec("set @@tidb_expensive_query_time_threshold=70")
|
||||
tk.MustQuery("select @@tidb_expensive_query_time_threshold;").Check(testkit.Rows("70"))
|
||||
|
||||
@ -348,6 +348,7 @@ const (
|
||||
version32 = 32
|
||||
version33 = 33
|
||||
version34 = 34
|
||||
version35 = 35
|
||||
)
|
||||
|
||||
func checkBootstrapped(s Session) (bool, error) {
|
||||
@ -543,6 +544,10 @@ func upgrade(s Session) {
|
||||
upgradeToVer34(s)
|
||||
}
|
||||
|
||||
if ver < version35 {
|
||||
upgradeToVer35(s)
|
||||
}
|
||||
|
||||
updateBootstrapVer(s)
|
||||
_, err = s.Execute(context.Background(), "COMMIT")
|
||||
|
||||
@ -853,6 +858,12 @@ func upgradeToVer34(s Session) {
|
||||
doReentrantDDL(s, CreateOptRuleBlacklist)
|
||||
}
|
||||
|
||||
func upgradeToVer35(s Session) {
|
||||
sql := fmt.Sprintf("UPDATE HIGH_PRIORITY %s.%s SET VARIABLE_NAME = '%s' WHERE VARIABLE_NAME = 'tidb_back_off_weight'",
|
||||
mysql.SystemDB, mysql.GlobalVariablesTable, variable.TiDBBackOffWeight)
|
||||
mustExecute(s, sql)
|
||||
}
|
||||
|
||||
// updateBootstrapVer updates bootstrap version variable in mysql.TiDB table.
|
||||
func updateBootstrapVer(s Session) {
|
||||
// Update bootstrap version.
|
||||
|
||||
@ -1641,7 +1641,7 @@ func createSessionWithDomain(store kv.Storage, dom *domain.Domain) (*session, er
|
||||
|
||||
const (
|
||||
notBootstrapped = 0
|
||||
currentBootstrapVersion = 34
|
||||
currentBootstrapVersion = 35
|
||||
)
|
||||
|
||||
func getStoreBootstrapVersion(store kv.Storage) int64 {
|
||||
|
||||
@ -2419,7 +2419,7 @@ func (s *testSessionSuite) TestKVVars(c *C) {
|
||||
tk.MustExec("insert kvvars values (1, 1)")
|
||||
tk2 := testkit.NewTestKitWithInit(c, s.store)
|
||||
tk2.MustExec("set @@tidb_backoff_lock_fast = 1")
|
||||
tk2.MustExec("set @@tidb_back_off_weight = 100")
|
||||
tk2.MustExec("set @@tidb_backoff_weight = 100")
|
||||
backoffVal := new(int64)
|
||||
backOffWeightVal := new(int32)
|
||||
tk2.Se.GetSessionVars().KVVars.Hook = func(name string, vars *kv.Variables) {
|
||||
|
||||
@ -225,11 +225,11 @@ const (
|
||||
// tidb_backoff_lock_fast is used for tikv backoff base time in milliseconds.
|
||||
TiDBBackoffLockFast = "tidb_backoff_lock_fast"
|
||||
|
||||
// tidb_back_off_weight is used to control the max back off time in TiDB.
|
||||
// tidb_backoff_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"
|
||||
TiDBBackOffWeight = "tidb_backoff_weight"
|
||||
|
||||
// tidb_ddl_reorg_worker_cnt defines the count of ddl reorg workers.
|
||||
TiDBDDLReorgWorkerCount = "tidb_ddl_reorg_worker_cnt"
|
||||
|
||||
Reference in New Issue
Block a user