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

Optimizer: Add partition by support for derived TopN(filter on row_number) #41362

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
a10b52c
Optimizer: Add partition by support for derived TopN(filter on row_nu…
ghazalfamilyusa Feb 13, 2023
749852b
Delete diff
ghazalfamilyusa Feb 15, 2023
ca25b82
keyspace: add keyspace util func and ut (#41353)
ystaticy Feb 14, 2023
61498d1
planner: stabilize tests in `binary_plan_test.go` (#41356)
time-and-fate Feb 14, 2023
5dd6f12
planner: small refactor about plan cache checker (#41357)
qw4990 Feb 14, 2023
aa28289
*: update bazel (#41369)
hawkingrei Feb 14, 2023
c99c44c
telemetry: set switch default to false (#41336)
AstroProfundis Feb 14, 2023
30037c0
etcd_test: remove unnecessary sleep, make ci more stable (#41378)
Defined2014 Feb 14, 2023
eda4480
br: security update br image:1.18.1-alpine to 1.18.9-alpine (#40863)
xiabee Feb 14, 2023
d649179
domain, tidb-server: stop launching new auto analyze job when shuttin…
xuyifangreeneyes Feb 14, 2023
e7a302f
planner: add missing `CanExprsPushDown` checks when generating IndexM…
time-and-fate Feb 14, 2023
1022586
keyspace: fix keyspace ut (#41375)
ystaticy Feb 14, 2023
c5fe1eb
*: improve makefile (#41399)
hawkingrei Feb 14, 2023
0231621
br: reused table id is disabled when restore a brand-new cluster (#41…
fengou1 Feb 14, 2023
2a43ad6
ddl: set request source for cop requests that are used in adding inde…
tangenta Feb 14, 2023
27136fe
stmtv2: ignore corrupted line when scan (#41374)
zhongzc Feb 14, 2023
ad3c1b9
*: upgrade golangci-linter (#41317)
hawkingrei Feb 14, 2023
2067b5d
statistics: improve test to make test more fast (#41403)
hawkingrei Feb 14, 2023
b290b0b
planner: add more test cases for non-prepared plan cache (#41398)
qw4990 Feb 14, 2023
d9dc46c
ddl: fix cleanup subtasks after cancel add index with dist-reorg (#41…
zimulala Feb 15, 2023
652641d
*: bazel upgrade shard_count (#41417)
hawkingrei Feb 15, 2023
663478d
executor: fix race when collecting telemetry info of batch copr (#41413)
you06 Feb 15, 2023
87f8b3b
expression: improve expression to make test faster (#41426)
hawkingrei Feb 15, 2023
e87e9ee
ddl: make `reorgCtx` safer to use (#41421)
zimulala Feb 15, 2023
4c0107f
ddl: ignore reorg elem error when the job is cancelling (#41383)
tangenta Feb 15, 2023
33251f4
*: improve bazel config (#41430)
hawkingrei Feb 15, 2023
c2a7146
session: enable `foreign_key_checks`/`tidb_enable_foreign_key` by def…
crazycs520 Feb 15, 2023
f7b036d
parser: add NULL DEFINED BY and FORMAT to LOAD DATA (#41332)
lance6716 Feb 15, 2023
a7ca870
planner: add more test cases for non-prepared plan cache (#41451)
qw4990 Feb 15, 2023
f7bb8b2
br: open parallel test for storage_test (#41450)
WangLe1321 Feb 15, 2023
1f9f8c0
*: improve executor to make test faster (#41442)
hawkingrei Feb 15, 2023
5eed62c
docs: add a proposal for distributed DDL reorg (#41256)
zimulala Feb 15, 2023
2de1d17
expression: implement is_ipv4 and is_ipv6 function pushdown (#41173)
AntiTopQuark Feb 15, 2023
2f9e7b2
*: improve planner/core to make test faster (#41416)
hawkingrei Feb 15, 2023
68a61de
planner: add more checks when pushing TopN down (#41370)
Dousir9 Feb 15, 2023
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
40 changes: 20 additions & 20 deletions DEPS.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1385,8 +1385,8 @@ def go_deps():
name = "com_github_go_toolsmith_astcopy",
build_file_proto_mode = "disable",
importpath = "github.com/go-toolsmith/astcopy",
sum = "h1:YnWf5Rnh1hUudj11kei53kI57quN/VH6Hp1n+erozn0=",
version = "v1.0.2",
sum = "h1:r0bgSRlMOAgO+BdQnVAcpMSMkrQCnV6ZJmIkrJgcJj0=",
version = "v1.0.3",
)
go_repository(
name = "com_github_go_toolsmith_astequal",
Expand Down Expand Up @@ -1606,8 +1606,8 @@ def go_deps():
name = "com_github_golangci_golangci_lint",
build_file_proto_mode = "disable",
importpath = "github.com/golangci/golangci-lint",
sum = "h1:M1bpDymgdaPKNzPwQdebCGki/nzvVkr2f/eUfk9C9oU=",
version = "v1.51.0",
sum = "h1:N5HD/x0ZrhJYsgKWyz7yJxxQ8JKR0Acc+FOP7QtGSAA=",
version = "v1.51.1",
)
go_repository(
name = "com_github_golangci_gosec",
Expand Down Expand Up @@ -1812,8 +1812,8 @@ def go_deps():
name = "com_github_gordonklaus_ineffassign",
build_file_proto_mode = "disable",
importpath = "github.com/gordonklaus/ineffassign",
sum = "h1:PVRE9d4AQKmbelZ7emNig1+NT27DUmKZn5qXxfio54U=",
version = "v0.0.0-20210914165742-4cc7213b9bc8",
sum = "h1:9alfqbrhuD+9fLZ4iaAVwhlp5PEhmnBt7yvK2Oy5C1U=",
version = "v0.0.0-20230107090616-13ace0543b28",
)
go_repository(
name = "com_github_gorilla_context",
Expand Down Expand Up @@ -2432,8 +2432,8 @@ def go_deps():
name = "com_github_junk1tm_musttag",
build_file_proto_mode = "disable",
importpath = "github.com/junk1tm/musttag",
sum = "h1:I8UHQkDj2u/MClcGU8PbMoYwhykiSQFEbXKKMjixPyk=",
version = "v0.4.3",
sum = "h1:VK4L7v7lvWAhKDDx0cUJgbb0UBNipYinv8pPeHJzH9Q=",
version = "v0.4.4",
)

go_repository(
Expand Down Expand Up @@ -3110,8 +3110,8 @@ def go_deps():
name = "com_github_nunnatsa_ginkgolinter",
build_file_proto_mode = "disable",
importpath = "github.com/nunnatsa/ginkgolinter",
sum = "h1:j4mzqx1hkE75mXHs3AUlWghZBi59c3GDWXp6zzcI+kE=",
version = "v0.7.1",
sum = "h1:/y4o/0hV+ruUHj4xXh89xlFjoaitnI4LnkpuYs02q1c=",
version = "v0.8.1",
)

go_repository(
Expand Down Expand Up @@ -3633,8 +3633,8 @@ def go_deps():
name = "com_github_ryanrolds_sqlclosecheck",
build_file_proto_mode = "disable",
importpath = "github.com/ryanrolds/sqlclosecheck",
sum = "h1:AZx+Bixh8zdUBxUA1NxbxVAS78vTPq4rCb8OUZI9xFw=",
version = "v0.3.0",
sum = "h1:i8SX60Rppc1wRuyQjMciLqIzV3xnoHB7/tXbr6RGYNI=",
version = "v0.4.0",
)

go_repository(
Expand All @@ -3656,8 +3656,8 @@ def go_deps():
name = "com_github_sanposhiho_wastedassign_v2",
build_file_proto_mode = "disable",
importpath = "github.com/sanposhiho/wastedassign/v2",
sum = "h1:+6/hQIHKNJAUixEj6EmOngGIisyeI+T3335lYTyxRoA=",
version = "v2.0.6",
sum = "h1:J+6nrY4VW+gC9xFzUc+XjPD3g3wF3je/NsJFwFK7Uxc=",
version = "v2.0.7",
)
go_repository(
name = "com_github_sasha_s_go_deadlock",
Expand Down Expand Up @@ -3737,8 +3737,8 @@ def go_deps():
name = "com_github_shirou_gopsutil_v3",
build_file_proto_mode = "disable_global",
importpath = "github.com/shirou/gopsutil/v3",
sum = "h1:oG0ns6poeUSxf78JtOsfygNWuEHYYz8hnnNg7P04TJs=",
version = "v3.22.12",
sum = "h1:a9KKO+kGLKEvcPIs4W62v0nu3sciVDOOOPUD0Hz7z/4=",
version = "v3.23.1",
)
go_repository(
name = "com_github_shopify_goreferrer",
Expand Down Expand Up @@ -3866,8 +3866,8 @@ def go_deps():
name = "com_github_sourcegraph_go_diff",
build_file_proto_mode = "disable",
importpath = "github.com/sourcegraph/go-diff",
sum = "h1:FEIBISvqa2IsyC4KQQBQ1Ef2QvweGUgEIjCdE3gz+zs=",
version = "v0.6.2-0.20221031073116-7ef5f68ebea1",
sum = "h1:9uLlrd5T46OXs5qpp8L/MTltk0zikUGi0sNNyCpA8G0=",
version = "v0.7.0",
)

go_repository(
Expand Down Expand Up @@ -4151,8 +4151,8 @@ def go_deps():
name = "com_github_tomarrell_wrapcheck_v2",
build_file_proto_mode = "disable",
importpath = "github.com/tomarrell/wrapcheck/v2",
sum = "h1:J/F8DbSKJC83bAvC6FoZaRjZiZ/iKoueSdrEkmGeacA=",
version = "v2.7.0",
sum = "h1:qDzbir0xmoE+aNxGCPrn+rUSxAX+nG6vREgbbXAR81I=",
version = "v2.8.0",
)
go_repository(
name = "com_github_tommy_muehle_go_mnd_v2",
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ dev: checklist check explaintest gogenerate br_unit_test test_part_parser_dev ut
# Install the check tools.
check-setup:tools/bin/revive

check: parser_yacc check-parallel lint tidy testSuite errdoc license check-bazel-prepare
check: check-bazel-prepare parser_yacc check-parallel lint tidy testSuite errdoc license

fmt:
@echo "gofmt (simplify)"
Expand Down Expand Up @@ -409,7 +409,7 @@ bazel_test: failpoint-enable bazel_ci_prepare
-//tests/globalkilltest/... -//tests/readonlytest/... -//br/pkg/task:task_test


bazel_coverage_test: failpoint-enable bazel_ci_prepare
bazel_coverage_test: check-bazel-prepare failpoint-enable bazel_ci_prepare
bazel $(BAZEL_GLOBAL_CONFIG) coverage $(BAZEL_CMD_CONFIG) --test_keep_going=false \
--@io_bazel_rules_go//go/config:cover_format=go_cover --define gotags=deadlock,intest \
-- //... -//cmd/... -//tests/graceshutdown/... \
Expand Down
4 changes: 2 additions & 2 deletions br/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# For loading data to TiDB
FROM golang:1.18.1-alpine as go-ycsb-builder
FROM golang:1.18.9-alpine as go-ycsb-builder
WORKDIR /go/src/github.com/pingcap/

RUN apk add --no-cache \
Expand All @@ -17,7 +17,7 @@ RUN git clone https://github.com/pingcap/go-ycsb.git --depth=1 && \
# For operating minio S3 compatible storage
FROM minio/mc as mc-builder

FROM golang:1.18.1-alpine
FROM golang:1.18.9-alpine

WORKDIR /go/src/github.com/pingcap/br
COPY . .
Expand Down
20 changes: 19 additions & 1 deletion br/pkg/gluetidb/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "gluetidb",
Expand All @@ -25,3 +25,21 @@ go_library(
"@org_uber_go_zap//:zap",
],
)

go_test(
name = "gluetidb_test",
timeout = "short",
srcs = ["glue_test.go"],
embed = [":gluetidb"],
flaky = True,
deps = [
"//ddl",
"//kv",
"//meta",
"//parser/model",
"//sessionctx",
"//testkit",
"@com_github_pingcap_failpoint//:failpoint",
"@com_github_stretchr_testify//require",
],
)
16 changes: 9 additions & 7 deletions br/pkg/gluetidb/glue.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,19 +218,21 @@ func (gs *tidbSession) CreatePlacementPolicy(ctx context.Context, policy *model.
// SplitBatchCreateTable provide a way to split batch into small batch when batch size is large than 6 MB.
// The raft entry has limit size of 6 MB, a batch of CreateTables may hit this limitation
// TODO: shall query string be set for each split batch create, it looks does not matter if we set once for all.
func (gs *tidbSession) SplitBatchCreateTable(schema model.CIStr, info []*model.TableInfo, cs ...ddl.CreateTableWithInfoConfigurier) error {
func (gs *tidbSession) SplitBatchCreateTable(schema model.CIStr, infos []*model.TableInfo, cs ...ddl.CreateTableWithInfoConfigurier) error {
var err error
d := domain.GetDomain(gs.se).DDL()
if err = d.BatchCreateTableWithInfo(gs.se, schema, info, append(cs, ddl.OnExistIgnore)...); kv.ErrEntryTooLarge.Equal(err) {
if len(info) == 1 {

if err = d.BatchCreateTableWithInfo(gs.se, schema, infos, append(cs, ddl.OnExistIgnore)...); kv.ErrEntryTooLarge.Equal(err) {
log.Info("entry too large, split batch create table", zap.Int("num table", len(infos)))
if len(infos) == 1 {
return err
}
mid := len(info) / 2
err = gs.SplitBatchCreateTable(schema, info[:mid])
mid := len(infos) / 2
err = gs.SplitBatchCreateTable(schema, infos[:mid], cs...)
if err != nil {
return err
}
err = gs.SplitBatchCreateTable(schema, info[mid:])
err = gs.SplitBatchCreateTable(schema, infos[mid:], cs...)
if err != nil {
return err
}
Expand Down Expand Up @@ -268,7 +270,7 @@ func (gs *tidbSession) CreateTables(ctx context.Context, tables map[string][]*mo
cloneTables = append(cloneTables, table)
}
gs.se.SetValue(sessionctx.QueryString, queryBuilder.String())
if err := gs.SplitBatchCreateTable(dbName, cloneTables); err != nil {
if err := gs.SplitBatchCreateTable(dbName, cloneTables, cs...); err != nil {
//It is possible to failure when TiDB does not support model.ActionCreateTables.
//In this circumstance, BatchCreateTableWithInfo returns errno.ErrInvalidDDLJob,
//we fall back to old way that creating table one by one
Expand Down
Loading