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

coprocessor: skip empty tidb nodes #36548

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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: 1 addition & 0 deletions infoschema/cluster_tables_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ func TestSelectClusterTable(t *testing.T) {
tk.MustExec("use information_schema")
tk.MustExec("set @@global.tidb_enable_stmt_summary=1")
tk.MustExec("set time_zone = '+08:00';")
// TODO
tk.MustQuery("select count(*) from `CLUSTER_SLOW_QUERY`").Check(testkit.Rows("2"))
tk.MustQuery("select time from `CLUSTER_SLOW_QUERY` where time='2019-02-12 19:33:56.571953'").Check(testkit.RowsWithSep("|", "2019-02-12 19:33:56.571953"))
tk.MustQuery("select count(*) from `CLUSTER_PROCESSLIST`").Check(testkit.Rows("1"))
Expand Down
7 changes: 7 additions & 0 deletions store/copr/coprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,13 @@ func buildTiDBMemCopTasks(ranges *KeyRanges, req *kv.Request) ([]*copTask, error
continue
}

// Some components (like BR) will register tidb nodes with empty IP
// addresses in etcd, which will cause cop requests to time out. We
// avoid this problem when building cop tasks.
if ser.IP == "" {
continue
}

addr := ser.IP + ":" + strconv.FormatUint(uint64(ser.StatusPort), 10)
tasks = append(tasks, &copTask{
ranges: ranges,
Expand Down
5 changes: 3 additions & 2 deletions tests/realtikvtest/sessiontest/session_fail_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ func TestClusterTableSendError(t *testing.T) {
require.NoError(t, failpoint.Enable("tikvclient/tikvStoreSendReqResult", `return("requestTiDBStoreError")`))
defer func() { require.NoError(t, failpoint.Disable("tikvclient/tikvStoreSendReqResult")) }()
tk.MustQuery("select * from information_schema.cluster_slow_query")
require.Equal(t, tk.Session().GetSessionVars().StmtCtx.WarningCount(), uint16(1))
require.Regexp(t, ".*TiDB server timeout, address is.*", tk.Session().GetSessionVars().StmtCtx.GetWarnings()[0].Err.Error())
// Since we avoid making requests to empty addresses, there will be no warnings here.
// See: https://github.com/pingcap/tidb/pull/36548
require.Equal(t, tk.Session().GetSessionVars().StmtCtx.WarningCount(), uint16(0))
}

func TestAutoCommitNeedNotLinearizability(t *testing.T) {
Expand Down