Skip to content

Commit

Permalink
var: enable pd_enable_follower_handle_region as default (#58385)
Browse files Browse the repository at this point in the history
close #58384
  • Loading branch information
okJiang authored Jan 8, 2025
1 parent 67249cb commit 6c9ee36
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pkg/executor/set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -655,11 +655,11 @@ func TestSetVar(t *testing.T) {
tk.MustExec("set global tidb_enable_tso_follower_proxy = 0")
tk.MustQuery("select @@tidb_enable_tso_follower_proxy").Check(testkit.Rows("0"))
require.Error(t, tk.ExecToErr("set tidb_enable_tso_follower_proxy = 1"))
tk.MustQuery("select @@pd_enable_follower_handle_region").Check(testkit.Rows("0"))
tk.MustExec("set global pd_enable_follower_handle_region = 1")
tk.MustQuery("select @@pd_enable_follower_handle_region").Check(testkit.Rows("1"))
tk.MustExec("set global pd_enable_follower_handle_region = 0")
tk.MustQuery("select @@pd_enable_follower_handle_region").Check(testkit.Rows("0"))
tk.MustExec("set global pd_enable_follower_handle_region = 1")
tk.MustQuery("select @@pd_enable_follower_handle_region").Check(testkit.Rows("1"))
require.Error(t, tk.ExecToErr("set pd_enable_follower_handle_region = 1"))

tk.MustQuery("select @@tidb_enable_historical_stats").Check(testkit.Rows("0"))
Expand Down
105 changes: 105 additions & 0 deletions pkg/metrics/grafana/tidb.json
Original file line number Diff line number Diff line change
Expand Up @@ -13336,6 +13336,111 @@
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
"dashLength": 10,
"dashes": false,
"datasource": "${DS_TEST-CLUSTER}",
"description": "The stale regions from PD per second.",
"editable": true,
"error": false,
"fieldConfig": {
"defaults": {},
"overrides": []
},
"fill": 0,
"fillGradient": 0,
"grid": {},
"gridPos": {
"h": 7,
"w": 8,
"x": 8,
"y": 37
},
"hiddenSeries": false,
"id": 339,
"legend": {
"alignAsTable": true,
"avg": false,
"current": false,
"max": false,
"min": false,
"rightSide": true,
"show": true,
"total": false,
"values": false
},
"lines": true,
"linewidth": 2,
"links": [],
"nullPointMode": "null as zero",
"options": {
"alertThreshold": true
},
"percentage": false,
"pluginVersion": "7.5.11",
"pointradius": 5,
"points": false,
"renderer": "flot",
"seriesOverrides": [],
"spaceLength": 10,
"stack": false,
"steppedLine": false,
"targets": [
{
"exemplar": true,
"expr": "sum(rate(tidb_tikvclient_stale_region_from_pd{k8s_cluster=\"$k8s_cluster\", tidb_cluster=\"$tidb_cluster\", instance=~\"$instance\"}[30s]))",
"format": "time_series",
"interval": "",
"intervalFactor": 2,
"legendFormat": "all",
"refId": "A",
"step": 10
}
],
"thresholds": [],
"timeFrom": null,
"timeRegions": [],
"timeShift": null,
"title": "Stale Region From PD",
"tooltip": {
"msResolution": false,
"shared": true,
"sort": 0,
"value_type": "cumulative"
},
"type": "graph",
"xaxis": {
"buckets": null,
"mode": "time",
"name": null,
"show": true,
"values": []
},
"yaxes": [
{
"format": "ops",
"label": null,
"logBase": 1,
"max": null,
"min": "0",
"show": true
},
{
"format": "short",
"label": null,
"logBase": 1,
"max": null,
"min": null,
"show": true
}
],
"yaxis": {
"align": false,
"alignLevel": null
}
},
{
"aliasColors": {},
"bars": false,
Expand Down
2 changes: 1 addition & 1 deletion pkg/sessionctx/variable/tidb_vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -1388,7 +1388,7 @@ const (
DefTiDBEnableLocalTxn = false
DefTiDBTSOClientBatchMaxWaitTime = 0.0 // 0ms
DefTiDBEnableTSOFollowerProxy = false
DefPDEnableFollowerHandleRegion = false
DefPDEnableFollowerHandleRegion = true
DefTiDBEnableOrderedResultMode = false
DefTiDBEnablePseudoForOutdatedStats = false
DefTiDBRegardNULLAsPoint = true
Expand Down
8 changes: 4 additions & 4 deletions tests/integrationtest/r/session/vars.result
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ select @@tidb_enable_tso_follower_proxy;
0
select @@pd_enable_follower_handle_region;
@@pd_enable_follower_handle_region
0
set global pd_enable_follower_handle_region = on;
select @@pd_enable_follower_handle_region;
@@pd_enable_follower_handle_region
1
set global pd_enable_follower_handle_region = off;
select @@pd_enable_follower_handle_region;
@@pd_enable_follower_handle_region
0
set global pd_enable_follower_handle_region = on;
select @@pd_enable_follower_handle_region;
@@pd_enable_follower_handle_region
1
set tidb_tso_client_batch_max_wait_time = 0;
Error 1229 (HY000): Variable 'tidb_tso_client_batch_max_wait_time' is a GLOBAL variable and should be set with SET GLOBAL
set global tidb_enable_tso_follower_proxy = default;
Expand Down
4 changes: 2 additions & 2 deletions tests/integrationtest/t/session/vars.test
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ select @@tidb_enable_tso_follower_proxy;
set global tidb_enable_tso_follower_proxy = off;
select @@tidb_enable_tso_follower_proxy;
select @@pd_enable_follower_handle_region;
set global pd_enable_follower_handle_region = on;
select @@pd_enable_follower_handle_region;
set global pd_enable_follower_handle_region = off;
select @@pd_enable_follower_handle_region;
set global pd_enable_follower_handle_region = on;
select @@pd_enable_follower_handle_region;
-- error 1229
set tidb_tso_client_batch_max_wait_time = 0;
set global tidb_enable_tso_follower_proxy = default;
Expand Down

0 comments on commit 6c9ee36

Please sign in to comment.