tidb
tidb copied to clipboard
ddl: skip adding index reorg work for empty tables
What problem does this PR solve?
Issue Number: close #54230, close #51421
Problem Summary:
We can reduce the overhead of data reorganization or distributed framework scheduling if the target table is empty.
What changed and how does it work?
See code changes.
Check List
Tests
- [ ] Unit test
- [ ] Integration test
- [x] Manual test (add detailed scripts or steps below)
Before this PR (empty tables):
After this PR (empty tables):mysql> create index idx_listid on tt1(id,listid); Query OK, 0 rows affected (2.52 sec) mysql> create index idx_listid on tt2(listid); Query OK, 0 rows affected (1.52 sec)
Before this PR (non-empty tables):mysql> create index idx_listid on tt1(id,listid); Query OK, 0 rows affected (0.34 sec) mysql> create index idx_listid on tt2(listid); Query OK, 0 rows affected (0.29 sec)
After this PR (non-empty tables):mysql> create index idx_listid on tt1(id,listid); Query OK, 0 rows affected (2.49 sec) mysql> create index idx_listid on tt2(listid); Query OK, 0 rows affected (2.16 sec)mysql> create index idx_listid on tt1(id,listid); Query OK, 0 rows affected (2.57 sec) mysql> create index idx_listid on tt2(listid); Query OK, 0 rows affected (2.20 sec) - [ ] No need to test
- [ ] I checked and no code files have been changed.
Side effects
- [ ] Performance regression: Consumes more CPU
- [ ] Performance regression: Consumes more Memory
- [ ] Breaking backward compatibility
Documentation
- [ ] Affects user behaviors
- [ ] Contains syntax changes
- [ ] Contains variable changes
- [ ] Contains experimental features
- [ ] Changes MySQL compatibility
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.
None
Hi @tangenta. Thanks for your PR.
PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.
I understand the commands that are listed here.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
Codecov Report
Attention: Patch coverage is 90.85366% with 15 lines in your changes missing coverage. Please review.
Project coverage is 57.3725%. Comparing base (
ed9a909) to head (da86bd9). Report is 8 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #56406 +/- ##
=================================================
- Coverage 73.2825% 57.3725% -15.9100%
=================================================
Files 1636 1786 +150
Lines 453340 643316 +189976
=================================================
+ Hits 332219 369087 +36868
- Misses 100768 248976 +148208
- Partials 20353 25253 +4900
| Flag | Coverage Δ | |
|---|---|---|
| integration | 39.5413% <85.9756%> (?) |
|
| unit | 72.6393% <90.8536%> (+0.1537%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Components | Coverage Δ | |
|---|---|---|
| dumpling | 52.9478% <ø> (ø) |
|
| parser | ∅ <ø> (∅) |
|
| br | 63.1443% <ø> (+17.1531%) |
:arrow_up: |
[LGTM Timeline notifier]
Timeline:
/hold
please pass ctx in bootstrapSessionImpl to rebuildAllPartitionValueMapAndSorted. you can unhold youself after that
/hold
please pass ctx in bootstrapSessionImpl to rebuildAllPartitionValueMapAndSorted. you can unhold youself after that
Done.
/retest
@tangenta: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.
In response to this:
/retest
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.
/ok-to-test
/retest
/retest
/retest
go: downloading github.com/pingcap/failpoint v0.0.0-20240527053858-9b3b6e34194a
go: downloading github.com/sergi/go-diff v1.1.0
bazel --output_user_root=/home/jenkins/.tidb/tmp run --config=ci --repository_cache=/share/.cache/bazel-repository-cache //:gazelle
make: execvp: bazel: Permission denied
make: *** [Makefile:591: bazel_ci_simple_prepare] Error 127
./build/jenkins_unit_test.sh: line 26: bazel_collect: command not found
mv: cannot stat 'bazel.xml': No such file or directory
script returned exit code 2
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: Benjamin2037, D3Hunter, lance6716, yudongusa
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [Benjamin2037,D3Hunter,lance6716]
- ~~pkg/ddl/OWNERS~~ [Benjamin2037,D3Hunter,lance6716]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
/unhold
/retest
plan_test.go:40:
Error Trace: pkg/planner/core/casetest/plan_test.go:40
pkg/planner/core/casetest/tiflash_selection_late_materialization_test.go:76
Error: Not equal:
expected: 4
actual : 3
Test: TestTiFlashLateMaterialization
plan_stats_test.go:81:
Error Trace: pkg/planner/core/casetest/planstats/plan_stats_test.go:81
pkg/planner/core/casetest/planstats/plan_stats_test.go:210
Error: Not equal:
expected: 0
actual : -1
Test: TestPlanStatsLoad
/retest
testkit.go:161:
Error Trace: pkg/testkit/testkit.go:161
pkg/testkit/testkit.go:154
pkg/planner/core/casetest/instanceplancache/concurrency_test.go:84
src/runtime/asm_amd64.s:1700
Error: Received unexpected error:
[executor:1213]Deadlock found when trying to get lock; try restarting transaction
github.com/pingcap/errors.AddStack
external/com_github_pingcap_errors/errors.go:178
github.com/pingcap/errors.Trace
external/com_github_pingcap_errors/juju_adaptor.go:15
github.com/pingcap/tidb/pkg/testkit.(*TestKit).ExecWithContext
pkg/testkit/testkit.go:443
github.com/pingcap/tidb/pkg/testkit.(*TestKit).MustExecWithContext
pkg/testkit/testkit.go:159
github.com/pingcap/tidb/pkg/testkit.(*TestKit).MustExec
pkg/testkit/testkit.go:154
pkg/planner/core/casetest/instanceplancache/instanceplancache_test.(*worker).run
pkg/planner/core/casetest/instanceplancache/concurrency_test.go:84
runtime.goexit
src/runtime/asm_amd64.s:1700
Test: TestInstancePlanCacheConcurrencySysbench
Messages: sql:update normal.sbtest set c='4639' where id=157, [], error stack [executor:1213]Deadlock found when trying to get lock; try restarting transaction
github.com/pingcap/errors.AddStack
external/com_github_pingcap_errors/errors.go:178
github.com/pingcap/errors.Trace
external/com_github_pingcap_errors/juju_adaptor.go:15
github.com/pingcap/tidb/pkg/testkit.(*TestKit).ExecWithContext
pkg/testkit/testkit.go:443
github.com/pingcap/tidb/pkg/testkit.(*TestKit).MustExecWithContext
pkg/testkit/testkit.go:159
github.com/pingcap/tidb/pkg/testkit.(*TestKit).MustExec
pkg/testkit/testkit.go:154
pkg/planner/core/casetest/instanceplancache/instanceplancache_test.(*worker).run
pkg/planner/core/casetest/instanceplancache/concurrency_test.go:84
runtime.goexit
src/runtime/asm_amd64.s:1700
/retest
queue_v2_ddl_handler_test.go:437:
Error Trace: pkg/statistics/handle/autoanalyze/priorityqueue/queue_v2_ddl_handler_test.go:437
Error: Not equal:
expected: 114
actual : 110
Test: TestExchangeTablePartition
https://do.pingcap.net/jenkins/blue/rest/organizations/jenkins/pipelines/pingcap/pipelines/tidb/pipelines/pull_unit_test_ddlv1/runs/256/nodes/63/steps/69/log/?start=0
distsql_test.go:346:
Error Trace: pkg/executor/distsql_test.go:346
Error: "1" is not greater than "2"
Test: TestCoprocessorPagingSize
https://do.pingcap.net/jenkins/blue/rest/organizations/jenkins/pipelines/pingcap/pipelines/tidb/pipelines/ghpr_unit_test/runs/20924/nodes/63/steps/69/log/?start=0
/retest
https://github.com/pingcap/tidb/issues/56797
split_table_test.go:64:
Error Trace: pkg/executor/test/splittest/split_table_test.go:64
Error: Expect "t_112_5f7203800000000000000183800000000000" to match "t_115_"
Test: TestClusterIndexShowTableRegion
https://do.pingcap.net/jenkins/blue/rest/organizations/jenkins/pipelines/pingcap/pipelines/tidb/pipelines/ghpr_unit_test/runs/20982/nodes/63/steps/69/log/?start=0