Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into fix-15531-2
Browse files Browse the repository at this point in the history
  • Loading branch information
YangKeao committed Sep 20, 2023
2 parents 815763b + 3f3b07e commit 8bcc10a
Show file tree
Hide file tree
Showing 268 changed files with 17,444 additions and 14,203 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@
# Declare files that will always have LF line endings on checkout.
*.y text eol=lf

*.result diff

util/collate/unicode_0*_ci.go linguist-generated=true
util/collate/ucadata/unicode_*_data.go linguist-generated=true
4 changes: 3 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ Tests <!-- At least one of them must be included. -->
- [ ] Unit test
- [ ] Integration test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No code
- [ ] No need to test
> - [ ] I checked and no code files have been changed.
> <!-- Or your custom "No need to test" reasons -->
Side effects

Expand Down
72 changes: 36 additions & 36 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4363,13 +4363,13 @@ def go_deps():
name = "com_github_klauspost_compress",
build_file_proto_mode = "disable_global",
importpath = "github.com/klauspost/compress",
sha256 = "7e004bb6b71535508bfa9c57256cfb2ca23f09ea281dbecafea217796b712fcd",
strip_prefix = "github.com/klauspost/compress@v1.16.5",
sha256 = "fa94794543608ad4f600c67994a317173b4e72c1159b8a84ab46a846c7643587",
strip_prefix = "github.com/klauspost/compress@v1.17.0",
urls = [
"http://bazel-cache.pingcap.net:8080/gomod/github.com/klauspost/compress/com_github_klauspost_compress-v1.16.5.zip",
"http://ats.apps.svc/gomod/github.com/klauspost/compress/com_github_klauspost_compress-v1.16.5.zip",
"https://cache.hawkingrei.com/gomod/github.com/klauspost/compress/com_github_klauspost_compress-v1.16.5.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/github.com/klauspost/compress/com_github_klauspost_compress-v1.16.5.zip",
"http://bazel-cache.pingcap.net:8080/gomod/github.com/klauspost/compress/com_github_klauspost_compress-v1.17.0.zip",
"http://ats.apps.svc/gomod/github.com/klauspost/compress/com_github_klauspost_compress-v1.17.0.zip",
"https://cache.hawkingrei.com/gomod/github.com/klauspost/compress/com_github_klauspost_compress-v1.17.0.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/github.com/klauspost/compress/com_github_klauspost_compress-v1.17.0.zip",
],
)
go_repository(
Expand Down Expand Up @@ -10074,13 +10074,13 @@ def go_deps():
name = "org_golang_x_crypto",
build_file_proto_mode = "disable_global",
importpath = "golang.org/x/crypto",
sha256 = "29b788bd8f1229214af831bf99412a09d19096dea3c62bc3281656b64093d12d",
strip_prefix = "golang.org/x/crypto@v0.12.0",
sha256 = "b58d902f48a7f595a28589b6ed4be8b5e2ee1a3496eca477039e80eb6e7eba57",
strip_prefix = "golang.org/x/crypto@v0.13.0",
urls = [
"http://bazel-cache.pingcap.net:8080/gomod/golang.org/x/crypto/org_golang_x_crypto-v0.12.0.zip",
"http://ats.apps.svc/gomod/golang.org/x/crypto/org_golang_x_crypto-v0.12.0.zip",
"https://cache.hawkingrei.com/gomod/golang.org/x/crypto/org_golang_x_crypto-v0.12.0.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/golang.org/x/crypto/org_golang_x_crypto-v0.12.0.zip",
"http://bazel-cache.pingcap.net:8080/gomod/golang.org/x/crypto/org_golang_x_crypto-v0.13.0.zip",
"http://ats.apps.svc/gomod/golang.org/x/crypto/org_golang_x_crypto-v0.13.0.zip",
"https://cache.hawkingrei.com/gomod/golang.org/x/crypto/org_golang_x_crypto-v0.13.0.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/golang.org/x/crypto/org_golang_x_crypto-v0.13.0.zip",
],
)
go_repository(
Expand Down Expand Up @@ -10165,13 +10165,13 @@ def go_deps():
name = "org_golang_x_net",
build_file_proto_mode = "disable_global",
importpath = "golang.org/x/net",
sha256 = "fdd5ca5653644b65d9062705ecae70b156660547f96d4606659960fe0c053871",
strip_prefix = "golang.org/x/net@v0.14.0",
sha256 = "e891941f0a83dfc85f82990e29cbf1939dca5952d04241666c8a227d419fded3",
strip_prefix = "golang.org/x/net@v0.15.0",
urls = [
"http://bazel-cache.pingcap.net:8080/gomod/golang.org/x/net/org_golang_x_net-v0.14.0.zip",
"http://ats.apps.svc/gomod/golang.org/x/net/org_golang_x_net-v0.14.0.zip",
"https://cache.hawkingrei.com/gomod/golang.org/x/net/org_golang_x_net-v0.14.0.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/golang.org/x/net/org_golang_x_net-v0.14.0.zip",
"http://bazel-cache.pingcap.net:8080/gomod/golang.org/x/net/org_golang_x_net-v0.15.0.zip",
"http://ats.apps.svc/gomod/golang.org/x/net/org_golang_x_net-v0.15.0.zip",
"https://cache.hawkingrei.com/gomod/golang.org/x/net/org_golang_x_net-v0.15.0.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/golang.org/x/net/org_golang_x_net-v0.15.0.zip",
],
)
go_repository(
Expand Down Expand Up @@ -10204,39 +10204,39 @@ def go_deps():
name = "org_golang_x_sys",
build_file_proto_mode = "disable_global",
importpath = "golang.org/x/sys",
sha256 = "0d03f4d1aa3b28ec80e2005ec8301004e2153e3154911baebf57b9cfa900f993",
strip_prefix = "golang.org/x/sys@v0.11.0",
sha256 = "89225d9e6603c090ffd93286b7ca124849fadfe4320c3b18a6bdccc4ac08672c",
strip_prefix = "golang.org/x/sys@v0.12.0",
urls = [
"http://bazel-cache.pingcap.net:8080/gomod/golang.org/x/sys/org_golang_x_sys-v0.11.0.zip",
"http://ats.apps.svc/gomod/golang.org/x/sys/org_golang_x_sys-v0.11.0.zip",
"https://cache.hawkingrei.com/gomod/golang.org/x/sys/org_golang_x_sys-v0.11.0.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/golang.org/x/sys/org_golang_x_sys-v0.11.0.zip",
"http://bazel-cache.pingcap.net:8080/gomod/golang.org/x/sys/org_golang_x_sys-v0.12.0.zip",
"http://ats.apps.svc/gomod/golang.org/x/sys/org_golang_x_sys-v0.12.0.zip",
"https://cache.hawkingrei.com/gomod/golang.org/x/sys/org_golang_x_sys-v0.12.0.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/golang.org/x/sys/org_golang_x_sys-v0.12.0.zip",
],
)
go_repository(
name = "org_golang_x_term",
build_file_proto_mode = "disable_global",
importpath = "golang.org/x/term",
sha256 = "d9a79ecfb908333f03d7f3f4b597551a6916462c6c5d040528c9887df956600e",
strip_prefix = "golang.org/x/term@v0.11.0",
sha256 = "f4bbc4baa0c9b053f7d252b06e4e8baabd686a9a87d82025b341796e29f39c60",
strip_prefix = "golang.org/x/term@v0.12.0",
urls = [
"http://bazel-cache.pingcap.net:8080/gomod/golang.org/x/term/org_golang_x_term-v0.11.0.zip",
"http://ats.apps.svc/gomod/golang.org/x/term/org_golang_x_term-v0.11.0.zip",
"https://cache.hawkingrei.com/gomod/golang.org/x/term/org_golang_x_term-v0.11.0.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/golang.org/x/term/org_golang_x_term-v0.11.0.zip",
"http://bazel-cache.pingcap.net:8080/gomod/golang.org/x/term/org_golang_x_term-v0.12.0.zip",
"http://ats.apps.svc/gomod/golang.org/x/term/org_golang_x_term-v0.12.0.zip",
"https://cache.hawkingrei.com/gomod/golang.org/x/term/org_golang_x_term-v0.12.0.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/golang.org/x/term/org_golang_x_term-v0.12.0.zip",
],
)
go_repository(
name = "org_golang_x_text",
build_file_proto_mode = "disable_global",
importpath = "golang.org/x/text",
sha256 = "437a787c7f92bcb8b2f2ab97fcd74ce88b5e7a5b21aa299e90f5c5dd28a7b66f",
strip_prefix = "golang.org/x/text@v0.12.0",
sha256 = "ed544fb017e967c053892df7b068612fce707ba32b57f35824cb041e31c6ae0f",
strip_prefix = "golang.org/x/text@v0.13.0",
urls = [
"http://bazel-cache.pingcap.net:8080/gomod/golang.org/x/text/org_golang_x_text-v0.12.0.zip",
"http://ats.apps.svc/gomod/golang.org/x/text/org_golang_x_text-v0.12.0.zip",
"https://cache.hawkingrei.com/gomod/golang.org/x/text/org_golang_x_text-v0.12.0.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/golang.org/x/text/org_golang_x_text-v0.12.0.zip",
"http://bazel-cache.pingcap.net:8080/gomod/golang.org/x/text/org_golang_x_text-v0.13.0.zip",
"http://ats.apps.svc/gomod/golang.org/x/text/org_golang_x_text-v0.13.0.zip",
"https://cache.hawkingrei.com/gomod/golang.org/x/text/org_golang_x_text-v0.13.0.zip",
"https://storage.googleapis.com/pingcapmirror/gomod/golang.org/x/text/org_golang_x_text-v0.13.0.zip",
],
)
go_repository(
Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ mock_lightning: tools/bin/mockgen

gen_mock: tools/bin/mockgen
tools/bin/mockgen -package mock github.com/pingcap/tidb/disttask/framework/scheduler TaskTable,Pool,Scheduler,Extension > disttask/framework/mock/scheduler_mock.go
tools/bin/mockgen -package mock github.com/pingcap/tidb/disttask/framework/dispatcher Dispatcher > disttask/framework/mock/dispatcher_mock.go
tools/bin/mockgen -package execute github.com/pingcap/tidb/disttask/framework/scheduler/execute SubtaskExecutor > disttask/framework/mock/execute/execute_mock.go
tools/bin/mockgen -package mock github.com/pingcap/tidb/disttask/importinto MiniTaskExecutor > disttask/importinto/mock/import_mock.go
tools/bin/mockgen -package mock github.com/pingcap/tidb/disttask/framework/planner LogicalPlan,PipelineSpec > disttask/framework/mock/plan_mock.go
Expand Down
1 change: 1 addition & 0 deletions OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ reviewers:
- Benjamin2037
- bobotu
- BornChanger
- CabinfeverB
- charleszheng44
- ChenPeng2013
- dhysum
Expand Down
12 changes: 12 additions & 0 deletions OWNERS_ALIASES
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,15 @@ aliases:
sig-approvers-autoid-service: # approvers for auto-id service
- bb7133
- tiancaiamao
sig-approvers-distsql: # approvers for distsql pkg
- windtalker
- XuHuaiyu
- zanmato1984
sig-approvers-executor: # approvers for executor pkg
- windtalker
- XuHuaiyu
- zanmato1984
sig-approvers-expression: # approvers for expression pkg
- windtalker
- XuHuaiyu
- zanmato1984
1 change: 0 additions & 1 deletion bindinfo/capture_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,6 @@ func TestCaptureHints(t *testing.T) {
// runtime hints
{"select /*+ memory_quota(1024 MB) */ * from t", "memory_quota(1024 mb)"},
{"select /*+ max_execution_time(1000) */ * from t", "max_execution_time(1000)"},
{"select /*+ tidb_kv_read_timeout(1000) */ * from t", "tidb_kv_read_timeout(1000)"},
// storage hints
{"select /*+ read_from_storage(tikv[t]) */ * from t", "read_from_storage(tikv[`t`])"},
// others
Expand Down
22 changes: 11 additions & 11 deletions bindinfo/session_handle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,45 +43,45 @@ func TestGlobalAndSessionBindingBothExist(t *testing.T) {
tk.MustExec("drop table if exists t2")
tk.MustExec("create table t1(id int)")
tk.MustExec("create table t2(id int)")
require.True(t, tk.HasPlan("SELECT * from t1,t2 where t1.id = t2.id", "HashJoin"))
require.True(t, tk.HasPlan("SELECT /*+ TIDB_SMJ(t1, t2) */ * from t1,t2 where t1.id = t2.id", "MergeJoin"))
tk.MustHavePlan("SELECT * from t1,t2 where t1.id = t2.id", "HashJoin")
tk.MustHavePlan("SELECT /*+ TIDB_SMJ(t1, t2) */ * from t1,t2 where t1.id = t2.id", "MergeJoin")

tk.MustExec("create global binding for SELECT * from t1,t2 where t1.id = t2.id using SELECT /*+ TIDB_SMJ(t1, t2) */ * from t1,t2 where t1.id = t2.id")

// Test bindingUsage, which indicates how many times the binding is used.
metrics.BindUsageCounter.Reset()
require.True(t, tk.HasPlan("SELECT * from t1,t2 where t1.id = t2.id", "MergeJoin"))
tk.MustHavePlan("SELECT * from t1,t2 where t1.id = t2.id", "MergeJoin")
pb := &dto.Metric{}
err := metrics.BindUsageCounter.WithLabelValues(metrics.ScopeGlobal).Write(pb)
require.NoError(t, err)
require.Equal(t, float64(1), pb.GetCounter().GetValue())

// Test 'tidb_use_plan_baselines'
tk.MustExec("set @@tidb_use_plan_baselines = 0")
require.True(t, tk.HasPlan("SELECT * from t1,t2 where t1.id = t2.id", "HashJoin"))
tk.MustHavePlan("SELECT * from t1,t2 where t1.id = t2.id", "HashJoin")
tk.MustExec("set @@tidb_use_plan_baselines = 1")

// Test 'drop global binding'
require.True(t, tk.HasPlan("SELECT * from t1,t2 where t1.id = t2.id", "MergeJoin"))
tk.MustHavePlan("SELECT * from t1,t2 where t1.id = t2.id", "MergeJoin")
tk.MustExec("drop global binding for SELECT * from t1,t2 where t1.id = t2.id")
require.True(t, tk.HasPlan("SELECT * from t1,t2 where t1.id = t2.id", "HashJoin"))
tk.MustHavePlan("SELECT * from t1,t2 where t1.id = t2.id", "HashJoin")

// Test the case when global and session binding both exist
// PART1 : session binding should totally cover global binding
// use merge join as session binding here since the optimizer will choose hash join for this stmt in default
tk.MustExec("create global binding for SELECT * from t1,t2 where t1.id = t2.id using SELECT /*+ TIDB_HJ(t1, t2) */ * from t1,t2 where t1.id = t2.id")
require.True(t, tk.HasPlan("SELECT * from t1,t2 where t1.id = t2.id", "HashJoin"))
tk.MustHavePlan("SELECT * from t1,t2 where t1.id = t2.id", "HashJoin")
tk.MustExec("create binding for SELECT * from t1,t2 where t1.id = t2.id using SELECT /*+ TIDB_SMJ(t1, t2) */ * from t1,t2 where t1.id = t2.id")
require.True(t, tk.HasPlan("SELECT * from t1,t2 where t1.id = t2.id", "MergeJoin"))
tk.MustHavePlan("SELECT * from t1,t2 where t1.id = t2.id", "MergeJoin")
tk.MustExec("drop global binding for SELECT * from t1,t2 where t1.id = t2.id")
require.True(t, tk.HasPlan("SELECT * from t1,t2 where t1.id = t2.id", "MergeJoin"))
tk.MustHavePlan("SELECT * from t1,t2 where t1.id = t2.id", "MergeJoin")

// PART2 : the dropped session binding should continue to block the effect of global binding
tk.MustExec("create global binding for SELECT * from t1,t2 where t1.id = t2.id using SELECT /*+ TIDB_SMJ(t1, t2) */ * from t1,t2 where t1.id = t2.id")
tk.MustExec("drop binding for SELECT * from t1,t2 where t1.id = t2.id")
require.True(t, tk.HasPlan("SELECT * from t1,t2 where t1.id = t2.id", "HashJoin"))
tk.MustHavePlan("SELECT * from t1,t2 where t1.id = t2.id", "HashJoin")
tk.MustExec("drop global binding for SELECT * from t1,t2 where t1.id = t2.id")
require.True(t, tk.HasPlan("SELECT * from t1,t2 where t1.id = t2.id", "HashJoin"))
tk.MustHavePlan("SELECT * from t1,t2 where t1.id = t2.id", "HashJoin")
}

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

0 comments on commit 8bcc10a

Please sign in to comment.