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

*: Reorg part update table #40714

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
946 commits
Select commit Hold shift + click to select a range
806fcbf
sessionctx: disable gc aware memory track (#40019)
chrysan Dec 20, 2022
fdf335e
*: make auto-analyze killable by global memory limit (#39978)
chrysan Dec 20, 2022
5a60f7e
Linting
mjonss Dec 20, 2022
85257f3
Updated after make bazel_prepare
mjonss Dec 21, 2022
ae2d551
cpu: fix ticker to avoid close early (#40036)
hawkingrei Dec 21, 2022
a2fa187
build(deps): bump golang.org/x/time from 0.2.0 to 0.3.0 (#39912)
dependabot[bot] Dec 21, 2022
51cce45
ddl: use latest ts to read record for adding index (#40081)
tangenta Dec 21, 2022
2150c6b
executor: close recordset again (#40073)
hawkingrei Dec 21, 2022
785f515
planner: add more test cases for MPP hints (#39933)
Reminiscent Dec 21, 2022
08f23ef
planner: support set binding status by sql digest (#39517)
fzzf678 Dec 21, 2022
b4f500e
ddl: check the limitation when creating multi-valued index (#39818)
xiongjiwei Dec 21, 2022
13e2120
sysvar: allow modifying 'tidb_allow_remove_auto_inc' when SEM is ON (…
CbcWestwolf Dec 21, 2022
ad0c202
*: fix issue of multi-schema change with foreign key (#40042)
crazycs520 Dec 21, 2022
9e8a21c
planner: check the `ignore-plan-cache` hint in insert-stmt (#40080)
qw4990 Dec 21, 2022
fc3f04b
parser: support keep_order and no_keep_order hint (#39965)
Reminiscent Dec 21, 2022
47ace08
*: filter particularly errors when `truncateAsWarning` is true (#40078)
xiongjiwei Dec 21, 2022
273e7e8
Removed CI debug log
mjonss Dec 21, 2022
b086421
Cleaned PR to only have the core of the data copying parts
mjonss Dec 21, 2022
74fa4c4
Merge branch 'reorg-part-data-reorg' into reorg-part-rollback
mjonss Dec 21, 2022
b0c16cd
More cleanup of PR to only focus on reorg data copy
mjonss Dec 21, 2022
73dcf5a
Merge branch 'reorg-part-data-reorg' into reorg-part-rollback
mjonss Dec 21, 2022
0accdd8
Added check to avoid null-pointer dereferencing
mjonss Dec 21, 2022
8c914b0
Fixed nil session context
mjonss Dec 21, 2022
0678894
Cleanup
mjonss Dec 21, 2022
3a1adcd
Added Info logs for debugging in CI
mjonss Dec 21, 2022
f23a27a
more CI debug info logs + cleared a TODO
mjonss Dec 22, 2022
ecb7f50
Added one more CI debug line
mjonss Dec 22, 2022
4e43b14
metrics: add metrics for ema cpu metrics and GOGC (#40049)
hawkingrei Dec 22, 2022
0f4bd73
server: avoid reusing cached stmt ctx on cursor read (#40023)
zyguan Dec 22, 2022
aeccf77
*: optimize mpp probe (#39932)
hackersean Dec 22, 2022
985b5ec
Update ddl/partition.go
mjonss Dec 22, 2022
4adce4c
statistics: fix the sync load sql did'nt running internally (#40087)
Yisaer Dec 22, 2022
5fdd3bd
server: support download plan replayer continues capture file (#40085)
Yisaer Dec 22, 2022
5c04d78
*: support foreign key check/cascade when execute replace into statem…
crazycs520 Dec 22, 2022
bfd5e66
More cleanup of PR to only focus on reorg data copy
mjonss Dec 22, 2022
0b0c7ec
Removed checkReorgParition, it will be back in part 3.
mjonss Dec 22, 2022
b7e590c
Merge branch 'reorg-part-data-reorg' into reorg-part-rollback
mjonss Dec 22, 2022
1e0d902
Moved code to only run once instead of for every fetchRowColVal
mjonss Dec 22, 2022
60a956b
Merge branch 'reorg-part-data-reorg' into reorg-part-rollback
mjonss Dec 22, 2022
eb6fec9
Return directly on error instead of retrying workerCnt times
mjonss Dec 22, 2022
3438e00
Merge branch 'reorg-part-data-reorg' into reorg-part-rollback
mjonss Dec 22, 2022
1305687
ddl: fix issue of add foreign key too slow in big table (#40112)
crazycs520 Dec 22, 2022
251a69a
Merge remote-tracking branch 'pingcap/feature/reorganize-partition' i…
mjonss Dec 22, 2022
0a275d6
Merge branch 'reorg-part-merge-dec22' into reorg-part-data-reorg-merg…
mjonss Dec 22, 2022
2e5b311
Added reverted code needed for reorganize partition
mjonss Dec 22, 2022
53edd89
ddl: fix issue of partition table with foreign key and add more test …
crazycs520 Dec 23, 2022
18c71f4
parser: fix cast function restore (#40129)
xiongjiwei Dec 23, 2022
d2be278
ddl: set context correctly in the setDDLLabelForDiagnosis (#40090)
you06 Dec 23, 2022
0eab90d
Merge remote-tracking branch 'pingcap/feature/reorganize-partition' i…
mjonss Dec 23, 2022
14879a7
planner: move code of generating IndexMergePath to a separated file (…
qw4990 Dec 23, 2022
060f189
Merge remote-tracking branch 'pingcap/feature/reorganize-partition' i…
mjonss Dec 23, 2022
5632e4a
post merge fix, removed test
mjonss Dec 23, 2022
7c093a2
Merge branch 'reorg-part-data-reorg' into reorg-part-rollback
mjonss Dec 23, 2022
c27499e
Merge branch 'reorg-partition-double-write' into reorg-part-rollback
mjonss Dec 23, 2022
014159d
statistics: fix incorrect datetime value when loading stats (#40084)
xuyifangreeneyes Dec 23, 2022
c61ef1d
ttl: escape parameters for finish job sql (#40118)
YangKeao Dec 23, 2022
4702033
Merge fix
mjonss Dec 23, 2022
3112178
Merge branch 'reorg-partition-double-write' into reorg-part-rollback
mjonss Dec 23, 2022
dfd9dae
Removed applyTableUpdate from applyReorgPart + CI debug
mjonss Dec 23, 2022
a9c528c
Linting
mjonss Dec 23, 2022
c30a9ff
ddl: prohibit change name of partitioning column (#40147)
mjonss Dec 24, 2022
6ad990a
updateTable CI testing
mjonss Dec 24, 2022
658f9a6
More CI debugging
mjonss Dec 24, 2022
9d55834
Even more CI debugs...
mjonss Dec 25, 2022
40edc9e
More CI testing skipping oom tests
mjonss Dec 25, 2022
34c03ad
more CI debugging
mjonss Dec 25, 2022
bcf8ef1
Linting
mjonss Dec 25, 2022
ff8bd3c
more CI debug
mjonss Dec 25, 2022
1ace970
lightning: disable foreign key checks (#40032)
sleepymole Dec 26, 2022
388364d
br: recursive split batch create table when restore failure on batch …
fengou1 Dec 26, 2022
8a4b31a
store/copr: don't reset concurrency of analyze req to 2 (#40168)
xuyifangreeneyes Dec 26, 2022
3e2ca84
Removed cleaning of tidb_ddl_reorg when ddl is completed (CI testing)
mjonss Dec 26, 2022
2f6401a
build(deps): bump golang.org/x/oauth2 from 0.2.0 to 0.3.0 (#40140)
dependabot[bot] Dec 26, 2022
fc241b2
domain: revise plan replayer process log (#40126)
Yisaer Dec 26, 2022
f9d4a54
expression: impl cast as array function (#40076)
xiongjiwei Dec 26, 2022
fc714e2
session: fix tidb_enable_gc_aware_memory_track after upgrade (#40173)
chrysan Dec 26, 2022
79ab2b9
restore: Fix prealloc (#40176)
YuJuncen Dec 26, 2022
cf56bf9
More CI debug...
mjonss Dec 27, 2022
ab01065
metrics: remove Keep Alive OPM metric (#40142)
CbcWestwolf Dec 27, 2022
3c8f11d
util: fix data race in the cpu test (#40154)
hawkingrei Dec 27, 2022
20bb046
executor: move some test into writetest (#40097)
hawkingrei Dec 27, 2022
22261a0
More CI debug
mjonss Dec 27, 2022
a94cde3
planner: fix an unstable explain test case (#40199)
qw4990 Dec 27, 2022
83d275c
ddl: Refine the error message to compatible with MySQL when drop a pa…
jiyfhust Dec 27, 2022
afbef28
executor: TiFlash supports stale read (#40048)
Dec 27, 2022
32f9604
ddl: ignore internal http client goroutine in leak tests (#40190)
tangenta Dec 27, 2022
bddfc62
ddl: add more foreign key test case (#40052)
crazycs520 Dec 28, 2022
11f5c17
*: add support for -initialize-sql-file on first bootstrap (#35625)
morgo Dec 28, 2022
b268c65
*: fix PointGet will return an stale value when `tidb_enable_plan_rep…
lcwangchao Dec 28, 2022
f9af75f
planner: support converting `json_member_of` to IndexMerge to access …
qw4990 Dec 28, 2022
b196756
planner: record reasons when skipping Plan Cache (#40210)
qw4990 Dec 28, 2022
869b21d
session: Do not run telemetry loops when it's disabled in config (#40…
sunxiaoguang Dec 28, 2022
667bc4c
docs/design: REORGANIZE PARTITION design (#38246)
mjonss Dec 28, 2022
c8124a0
ddl: Disable RENAME COLUMN for partitioning columns | tidb-test=pr/20…
mjonss Dec 29, 2022
92a936e
dumpling: add foreign key e2e test (#40133)
crazycs520 Dec 29, 2022
cf34941
ttl: make the TTL compatible with dumpling, lightning and BR (#40216)
lcwangchao Dec 29, 2022
1a7b395
ttl, domain: setup a customized session pool with stats collector (#4…
YangKeao Dec 29, 2022
6dff69f
ddl: Support flashback cluster with ddl history (#40209)
Defined2014 Dec 29, 2022
875c002
lightning: add foreign key test (#40103)
crazycs520 Dec 29, 2022
b94042c
planner: refine planner code for disaggregated tiflash mode (#39813)
guo-shaoge Dec 29, 2022
ea29db5
docs: update tidb roadmap based on v6.5 (#40170)
ran-huang Dec 29, 2022
ffaf2ac
planner: remove the unnecessary skip-plan-cache flag in StmtCtx (#40235)
qw4990 Dec 30, 2022
25dd54f
ttl: fix change status sql argument (#40234)
YangKeao Dec 30, 2022
72f52f3
planner: update the plan cache strategy when expressions with paramet…
qw4990 Dec 30, 2022
0134d0b
go.mod: upgrade badger to 20221229114011 (#40236)
YangKeao Dec 30, 2022
d3b952a
executor: write multi-valued index (#40172)
xiongjiwei Dec 30, 2022
8e80e7c
expression: implement `unhex` function pushdown to tiflash (#39898)
b41sh Dec 30, 2022
b97f60d
planner: remove the unnecessary skip-plan-cache flag in StmtCtx (#40246)
qw4990 Dec 30, 2022
1b8a233
restore: set config value to default when failed to get config from t…
YuJuncen Dec 30, 2022
6131e3f
ddl: check default value again in updateColumnDefaultValue (#40230)
wjhuang2016 Dec 30, 2022
91adaaf
docs: update roadmap (#40244)
ran-huang Dec 30, 2022
f7de8be
*: remove the support of the old ddl framework (#39684)
wjhuang2016 Dec 30, 2022
94b65bd
Merge remote-tracking branch 'pingcap/master' into feature-reorganize…
mjonss Dec 30, 2022
47080d9
lightning: check peers write stall when switch-mode is disabled (#40228)
lance6716 Dec 30, 2022
702a559
ddl, parser: make generated column and expression index same as MySQL…
Defined2014 Dec 30, 2022
7ef86c3
Post merge fixes
mjonss Dec 30, 2022
7e2fa6c
Merge branch 'feature-reorganize-partition-merge-dec30' into reorg-pa…
mjonss Dec 30, 2022
ca03f9c
Changes from tidb#38738 to fix tidb_ddl_reorg conflicts
mjonss Dec 31, 2022
9ac5dff
Removed debug logs
mjonss Dec 31, 2022
25a2479
session: make plan replayer capture support prepared stmt (#40167)
Yisaer Jan 3, 2023
67a952a
expression: implement `regexp_replace` function pushdown (#40267)
xzhangxian1008 Jan 3, 2023
1bf230a
planner: supply more test for binding from history (#40242)
fzzf678 Jan 3, 2023
be8caa6
ttl: disable ttl job when recover/flashback table/database/cluster (#…
lcwangchao Jan 3, 2023
494672c
admin: impl admin check index for mv index (#40270)
xiongjiwei Jan 3, 2023
1e99fa4
Merge remote-tracking branch 'pingcap/feature/reorganize-partition' i…
mjonss Jan 3, 2023
5327d07
planner: refactor plan-cache UseCache flag (#40256)
qw4990 Jan 3, 2023
9aaa93e
test: fix data race in cast as array (#40277)
xiongjiwei Jan 3, 2023
4f1adb9
planner: support converting `json_overlaps/contains` to IndexMerge to…
qw4990 Jan 3, 2023
1f344ba
autoid_service: add unit test for the package (#40193)
tiancaiamao Jan 3, 2023
3ccff46
executor: special handling is required when an "auto id out of range"…
Dousir9 Jan 3, 2023
3e65e9b
util: gorotinue pool (#39872)
hawkingrei Jan 4, 2023
f483b39
metrics: add metrics for plan replayer and historical stats (#40271)
Yisaer Jan 4, 2023
3e6499b
sysvar: fix circular dependency in rebuildSysVarCache leading to dead…
CbcWestwolf Jan 4, 2023
e95881f
ddl: fix flaky test TestGlobalVariablesOnFlashback (#40291)
Defined2014 Jan 4, 2023
62a7133
server, tidb-server: kill auto analyze when gracefully shutting down …
xuyifangreeneyes Jan 4, 2023
7fafb6d
planner: better coordination between the ignore_plan_cache() binding …
qw4990 Jan 4, 2023
ccee532
store/copr: fix build batchCop in disaggregated tiflash mode (#40008)
guo-shaoge Jan 4, 2023
73c8cc7
ddl: persist index info after changing backfill state (#40229)
tangenta Jan 4, 2023
e7e7935
doc: update flashback doc (#40031)
Defined2014 Jan 4, 2023
cb5affb
ddl, parser: Implement the write-reorg state split task related funct…
zimulala Jan 4, 2023
95f0dc5
planner: support pushing down predicates to memory tables in prepared…
djshow832 Jan 4, 2023
6ae151a
planner: open the partial order prop push down for LIST PARTITION (#4…
winoros Jan 4, 2023
00604eb
br: fix bootstrap domain (#40307)
wjhuang2016 Jan 4, 2023
bf2cc45
br: add errch buf for checkpoint (#40166)
Leavrth Jan 4, 2023
be112dc
planner: skip plan-cache for prepared queries with `INT in (Decimals.…
qw4990 Jan 5, 2023
d027270
statistics: support historical stats dump partition table (#40310)
Yisaer Jan 5, 2023
37f045c
*: update badger (#40331)
xiongjiwei Jan 5, 2023
508b601
expression: enlarge timeout for test (#40332)
hawkingrei Jan 5, 2023
4a5a447
resourcemanger: add cpu scheduler (#39886)
hawkingrei Jan 5, 2023
5eea731
util: use go-deadlock to find deadlock (#40288)
hawkingrei Jan 5, 2023
affe126
*: support `curdate()` as column's default value | tidb-test=pr/2057…
CbcWestwolf Jan 5, 2023
7e64d04
ttl: don't schedule ttl job when EnableTTLJob is off (#40336)
YangKeao Jan 5, 2023
669ba5c
*: add warnings to slow log and slow query table (#39884)
time-and-fate Jan 5, 2023
331f69f
planner,infoschema,executor: Add tiflash fine grained shuffle support…
yibin87 Jan 6, 2023
e1a2b58
ddl: fill in original default for extra writable columns in batch ins…
YangKeao Jan 6, 2023
88842fa
ddltest: update goleak and enable race (#40357)
hawkingrei Jan 6, 2023
852fdc6
planner: let the planner can select IndexMerge on MVIndex without hin…
qw4990 Jan 6, 2023
3291b6d
makefile: enable deadlock in the with-real-tikv (#40359)
hawkingrei Jan 6, 2023
99100d4
planner: support more types to use IndexMerge to access MVIndex (#40343)
qw4990 Jan 6, 2023
6477d2b
log-backup: should set default value `gc.ratio-threshold` after pitr …
joccau Jan 6, 2023
b8490bc
domain: let plan replayer dump support recording stats mem status (#4…
Yisaer Jan 6, 2023
af968f2
docs: add TiDB Forum link and adjust link order (#39868)
luzizhuo Jan 6, 2023
43ebc64
ddl: support online create multi-valued index (#40304)
xiongjiwei Jan 6, 2023
b226dfc
ttl: add `ttl_job_interval` attribute and remove `tidb_ttl_job_interv…
YangKeao Jan 6, 2023
005c8d8
*: remove the support of the `amending transaction` (#39714)
wjhuang2016 Jan 6, 2023
f600fc6
executor: reset the related session vars for both INSERT and REPLACE …
winoros Jan 6, 2023
f9f7268
*: fix static pruning partition table in disaggregated tiflash mode (…
guo-shaoge Jan 6, 2023
b906bf9
planner: fix typo (#40367)
Dousir9 Jan 6, 2023
a9d8bfe
session: fix data race in the LazyTxn.LockKeys (#40350)
hawkingrei Jan 6, 2023
f7c87c8
build(deps): bump golang.org/x/crypto from 0.1.0 to 0.5.0 (#40379)
dependabot[bot] Jan 7, 2023
2d755a8
executor: fix data race at the ShowExec (#39817)
hawkingrei Jan 9, 2023
4a8006c
planner: fix panic during starting tidb-server if creating global bin…
Yisaer Jan 9, 2023
b477b1c
*: Supports create/alter/drop resource group (#40188)
nolouch Jan 9, 2023
408a466
session: fix deadlock when init domain failed (#40409)
Defined2014 Jan 9, 2023
83ec4b0
executor: support insert ignore/duplicate replace into with unique mu…
xiongjiwei Jan 9, 2023
199bb38
br: support reset_tiflash after ebs restoration (#40124)
3pointer Jan 9, 2023
7dbf1a5
ttl: add ttl goroutine exit log (#40416)
YangKeao Jan 9, 2023
0f838d9
planner, executor: split the range for unsigned pk of partition table…
winoros Jan 9, 2023
362defb
planner: add nil check when handling empty charset in `setUnionFlen` …
time-and-fate Jan 9, 2023
b912237
planner: support keep_order and no_keep_order hint (#40089)
Reminiscent Jan 9, 2023
e2a14ce
planner: unify the behavior of prepare/execute limit to mysql (#40360)
fzzf678 Jan 10, 2023
f5362f9
gpool: register gpool into resource manager (#40410)
hawkingrei Jan 10, 2023
9826913
ttl: Add `CommandClient` to trigger TTL job manually (#40346)
lcwangchao Jan 10, 2023
3f223b3
ttl: make ttl's group in granfana collapse by default (#40444)
lcwangchao Jan 10, 2023
be31b6c
br: reset cloud_admin and root after ebs restoration (#39986)
3pointer Jan 10, 2023
45d71af
ddl: support displaying sub-job reorg type in admin show ddl (#40387)
tangenta Jan 10, 2023
f771c67
planner: support use IndexMerge to access composite MVIndex (#40426)
qw4990 Jan 10, 2023
c4d8ed1
planner: add test cases for keep_order and no_keep_order hints (#40321)
Reminiscent Jan 10, 2023
3cb091b
statistics: change the upper bound of the out-of-range estimation to …
time-and-fate Jan 10, 2023
bb314af
docs: update CI build badages (#40324)
wuhuizuo Jan 10, 2023
46e67d2
planner: update the non-prep cacheable checker (#40446)
qw4990 Jan 10, 2023
02332b2
expression, planner: exclude concat_ws from aggresive folding constan…
YangKeao Jan 10, 2023
10f0093
keyspace: introduce keyspace conf and etcd path (#40269)
ystaticy Jan 10, 2023
ef7c8bd
Main Reorganize Partition DDL logic (moved from part 3)
mjonss Jan 10, 2023
eb033f8
Skipping two tests, to be fixed in separate PR
mjonss Jan 10, 2023
8a14d11
Update after `make bazel_prepare`
mjonss Jan 10, 2023
1c8007d
ddl: skip deleting the unmatched index key on merge (#40465)
tangenta Jan 10, 2023
cf8f683
Merge pingcap/master and pingcap/feature/reorganize-partition
mjonss Jan 10, 2023
4ae9e6d
Updated CODEOWNERS for the feature branch
mjonss Jan 10, 2023
34d9352
Merge remote-tracking branch 'pingcap/feature/reorganize-partition' i…
mjonss Jan 10, 2023
eb3df8b
Main Reorganize Partition DDL logic (moved from part 3)
mjonss Jan 10, 2023
ac6f869
Skipping two tests, to be fixed in separate PR
mjonss Jan 10, 2023
d3444e6
Update after `make bazel_prepare`
mjonss Jan 10, 2023
805553a
Merge remote-tracking branch 'origin/reorg-part-ddl-states' into reor…
mjonss Jan 10, 2023
46d4bf0
ci: add document about some task that will be triggered manually (#40…
hawkingrei Jan 11, 2023
db53a42
errno, store: fix ErrPDServerTimeout arguments (#40468)
dveeden Jan 11, 2023
eff7462
ttl: fix the TTL job reports error when primary key contains a column…
lcwangchao Jan 11, 2023
d2d33df
planner: support using DNF to construct IndexMerge to access MVIndex …
qw4990 Jan 11, 2023
668881f
executor: add partition table testcase for historical stats (#40453)
Yisaer Jan 11, 2023
caffd8d
ttl: forbid creating/altering a table with TTL options when pk contai…
lcwangchao Jan 11, 2023
e864d83
planner: make MVIndex be compatible with the `use/force index` hint (…
qw4990 Jan 11, 2023
e3f8d98
lightning: fix codecPDClient (#40496)
AmoebaProtozoa Jan 11, 2023
2cf328b
ddl: let concurrent truncate on the same table depend on the previous…
wjhuang2016 Jan 11, 2023
2f13578
statistics: fix estimation error when ranges are too many and modify …
time-and-fate Jan 11, 2023
6e220cf
Renamed the receiver of *partitionedTable to be consistently 't'
mjonss Jan 11, 2023
cefb261
executor: fix issue of KEY_COLUMN_USAGE table return wrong result abo…
crazycs520 Jan 11, 2023
7beec04
sysvar: add switch for plan replayer capture using historical stats (…
Yisaer Jan 11, 2023
defd80a
*: upgrade go1.19.5 (#40483)
hawkingrei Jan 11, 2023
f88714d
br: need init MDL variable when GetDomain (#40512)
joccau Jan 11, 2023
eb35c77
ddl: avoid commit conflicts when updating/delete from mysql.tidb_ddl_…
mjonss Jan 11, 2023
2b32037
Merge remote-tracking branch 'pingcap/master' into reorg-part-merge-j…
mjonss Jan 11, 2023
4b6f0ca
Post merge fix
mjonss Jan 11, 2023
d041912
Merge branch 'reorg-part-merge-jan10' into reorg-part-ddl-states
mjonss Jan 11, 2023
88f5ff8
Merge branch 'reorg-part-merge-jan10' into reorg-part-rollback-merge-…
mjonss Jan 11, 2023
bd7c905
Post merge fix
mjonss Jan 11, 2023
8bc3503
Post merge fix
mjonss Jan 11, 2023
5c71c3d
Renamed receiver of partitionedTable from p to t
mjonss Jan 11, 2023
8a97633
Removed TestTiflashReorgPartition test (since support will come later)
mjonss Jan 11, 2023
a3b77df
Removed non needed cast
mjonss Jan 11, 2023
e2b4ca5
bazel_prepare update
mjonss Jan 11, 2023
a0229ea
Merge branch 'reorg-part-ddl-states' into reorg-part-rollback-merge-j…
mjonss Jan 12, 2023
2578e7b
Merge remote-tracking branch 'pingcap/feature/reorganize-partition' i…
mjonss Jan 12, 2023
9cd2d19
Merge branch 'reorg-part-ddl-states' into reorg-part-rollback-merge-j…
mjonss Jan 12, 2023
6ae6ecd
Removed skipped tests (to be added back in next PR)
mjonss Jan 12, 2023
038a4e5
Explicitly add label on panic tests
mjonss Jan 12, 2023
d87a516
Added back code that does not need to be touched
mjonss Jan 12, 2023
5e94a2d
Removed non used test function
mjonss Jan 12, 2023
9f0a0c3
make bazel_prepare
mjonss Jan 12, 2023
1b09e1a
Cleanup
mjonss Jan 12, 2023
599f5dc
Implemented delete range cleanup for Reorganize Partition
mjonss Jan 12, 2023
11b62c7
update after make bazel_prepare
mjonss Jan 12, 2023
aa3bf0b
Merge branch 'reorg-part-rollback' into reorg-part-tiflash-and-update…
mjonss Jan 16, 2023
b8b5194
Fixed an index issue in StateDeleteReorg after adding test.
mjonss Jan 16, 2023
5a31388
Merge remote-tracking branch 'pingcap/feature/reorganize-partition' i…
mjonss Jan 18, 2023
1af113a
Fixed test for TiFlash and reorg partition
mjonss Jan 18, 2023
1cceb71
Removed changes that belongs to splitted PR
mjonss Jan 18, 2023
ccbacc8
Merge branch 'feature/reorganize-partition' into reorg-part-update-table
mjonss Jan 18, 2023
a642b7c
Merge remote-tracking branch 'pingcap/feature/reorganize-partition' i…
mjonss Jan 19, 2023
b5a74c3
Code cleanup
mjonss Jan 19, 2023
0cb356f
Reverted non related log changes
mjonss Jan 20, 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
7 changes: 2 additions & 5 deletions ddl/backfilling.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,6 @@ func (dc *ddlCtx) sendTasksAndWait(scheduler *backfillScheduler, totalAddedCount
return errors.Trace(err)
}

// nextHandle will be updated periodically in runReorgJob, so no need to update it here.
mjonss marked this conversation as resolved.
Show resolved Hide resolved
dc.getReorgCtx(reorgInfo.Job.ID).setNextKey(nextKey)
metrics.BatchAddIdxHistogram.WithLabelValues(metrics.LblOK).Observe(elapsedTime.Seconds())
logutil.BgLogger().Info("[ddl] backfill workers successfully processed batch",
Expand All @@ -624,7 +623,7 @@ func (dc *ddlCtx) sendTasksAndWait(scheduler *backfillScheduler, totalAddedCount
return nil
}

func getBatchTasks(t table.Table, reorgInfo *reorgInfo, kvRanges []kv.KeyRange, batch int) []*reorgBackfillTask {
func getBatchTasks(t table.PhysicalTable, reorgInfo *reorgInfo, kvRanges []kv.KeyRange, batch int) []*reorgBackfillTask {
batchTasks := make([]*reorgBackfillTask, 0, batch)
physicalTableID := reorgInfo.PhysicalTableID
var prefix kv.Key
Expand Down Expand Up @@ -654,13 +653,11 @@ func getBatchTasks(t table.Table, reorgInfo *reorgInfo, kvRanges []kv.KeyRange,
endKey = prefix.PrefixNext()
}

//nolint:forcetypeassert
phyTbl := t.(table.PhysicalTable)
task := &reorgBackfillTask{
id: i,
jobID: reorgInfo.Job.ID,
physicalTableID: physicalTableID,
physicalTable: phyTbl,
physicalTable: t,
priority: reorgInfo.Priority,
startKey: startKey,
endKey: endKey,
Expand Down
24 changes: 24 additions & 0 deletions ddl/db_partition_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4626,6 +4626,7 @@ func TestReorganizeRangePartition(t *testing.T) {
"12 12 21",
"23 23 32"))
tk.MustExec(`alter table t reorganize partition pMax into (partition p2 values less than (30), partition pMax values less than (MAXVALUE))`)
tk.MustExec(`admin check table t`)
tk.MustQuery(`show create table t`).Check(testkit.Rows("" +
"t CREATE TABLE `t` (\n" +
" `a` int(10) unsigned NOT NULL,\n" +
Expand Down Expand Up @@ -4668,6 +4669,7 @@ func TestReorganizeRangePartition(t *testing.T) {
"12 12 21",
"23 23 32"))
tk.MustExec(`alter table t reorganize partition p2,pMax into (partition p2 values less than (35),partition p3 values less than (47), partition pMax values less than (MAXVALUE))`)
tk.MustExec(`admin check table t`)
tk.MustQuery(`select * from t`).Sort().Check(testkit.Rows(""+
"1 1 1",
"12 12 21",
Expand Down Expand Up @@ -4702,6 +4704,7 @@ func TestReorganizeRangePartition(t *testing.T) {
tk.MustQuery(`select * from t partition (pMax)`).Sort().Check(testkit.Rows("" +
"56 56 65"))
tk.MustExec(`alter table t reorganize partition p0,p1 into (partition p1 values less than (20))`)
tk.MustExec(`admin check table t`)
tk.MustQuery(`show create table t`).Check(testkit.Rows("" +
"t CREATE TABLE `t` (\n" +
" `a` int(10) unsigned NOT NULL,\n" +
Expand All @@ -4725,6 +4728,7 @@ func TestReorganizeRangePartition(t *testing.T) {
"56 56 65"))
tk.MustExec(`alter table t drop index b`)
tk.MustExec(`alter table t drop index c`)
tk.MustExec(`admin check table t`)
tk.MustQuery(`show create table t`).Check(testkit.Rows("" +
"t CREATE TABLE `t` (\n" +
" `a` int(10) unsigned NOT NULL,\n" +
Expand Down Expand Up @@ -4766,6 +4770,7 @@ func TestReorganizeRangePartition(t *testing.T) {
" PARTITION `pMax` VALUES LESS THAN (MAXVALUE))"))
// But allowed to change from MAXVALUE if no existing values is outside the new range!
tk.MustExec(`alter table t2 reorganize partition pMax into (partition p4 values less than (90))`)
tk.MustExec(`admin check table t2`)
tk.MustQuery(`show create table t2`).Check(testkit.Rows("" +
"t2 CREATE TABLE `t2` (\n" +
" `a` int(10) unsigned NOT NULL,\n" +
Expand All @@ -4790,6 +4795,7 @@ func TestReorganizeListPartition(t *testing.T) {
` (partition p1 values in (12,23,51,14), partition p2 values in (24,63), partition p3 values in (45))`)
tk.MustExec(`insert into t values (12,"12",21), (24,"24",42),(51,"51",15),(23,"23",32),(63,"63",36),(45,"45",54)`)
tk.MustExec(`alter table t reorganize partition p1 into (partition p0 values in (12,51,13), partition p1 values in (23))`)
tk.MustExec(`admin check table t`)
tk.MustQuery(`show create table t`).Check(testkit.Rows("" +
"t CREATE TABLE `t` (\n" +
" `a` int(11) DEFAULT NULL,\n" +
Expand All @@ -4806,6 +4812,7 @@ func TestReorganizeListPartition(t *testing.T) {
// Note: MySQL cannot reorganize two non-consecutive list partitions :)
// ERROR 1519 (HY000): When reorganizing a set of partitions they must be in consecutive order
tk.MustExec(`alter table t reorganize partition p1, p3 into (partition pa values in (45,23,15))`)
tk.MustExec(`admin check table t`)
tk.MustQuery(`show create table t`).Check(testkit.Rows("" +
"t CREATE TABLE `t` (\n" +
" `a` int(11) NOT NULL,\n" +
Expand Down Expand Up @@ -4839,6 +4846,7 @@ func TestAlterModifyPartitionColTruncateWarning(t *testing.T) {
tk.MustQuery(`show warnings`).Check(testkit.Rows(""+
"Warning 1265 Data truncated for column 'a', value is ' 654321'",
"Warning 1265 Data truncated for column 'a', value is ' 654321'"))
tk.MustExec(`admin check table t`)
}

func TestAlterModifyColumnOnPartitionedTableRename(t *testing.T) {
Expand Down Expand Up @@ -4955,6 +4963,7 @@ func TestReorgPartitionConcurrent(t *testing.T) {
// StateWriteOnly
wait <- true
tk.MustExec(`insert into t values (11, "11", 11),(12,"12",21)`)
tk.MustExec(`admin check table t`)
writeOnlyInfoSchema := sessiontxn.GetTxnManager(tk.Session()).GetTxnInfoSchema()
require.Equal(t, int64(1), writeOnlyInfoSchema.SchemaMetaVersion()-deleteOnlyInfoSchema.SchemaMetaVersion())
deleteOnlyTbl, err := deleteOnlyInfoSchema.TableByName(model.NewCIStr(schemaName), model.NewCIStr("t"))
Expand All @@ -4966,7 +4975,9 @@ func TestReorgPartitionConcurrent(t *testing.T) {
// If not DeleteOnly is working, then this would show up when reorg is done
tk.MustExec(`delete from t where a = 11`)
tk.MustExec(`update t set b = "12b", c = 12 where a = 12`)
tk.MustExec(`admin check table t`)
writeOnlyTbl.Meta().Partition = writeOnlyParts
tk.MustExec(`admin check table t`)
wait <- true

// StateWriteReorganization
Expand Down Expand Up @@ -5009,6 +5020,7 @@ func TestReorgPartitionConcurrent(t *testing.T) {
currPart := currTbl.Meta().Partition
currTbl.Meta().Partition = oldTbl.Meta().Partition
tk.MustQuery(`select * from t where b = "16"`).Sort().Check(testkit.Rows("16 16 16"))
tk.MustExec(`admin check table t`)
tk.MustQuery(`show create table t`).Check(testkit.Rows("" +
"t CREATE TABLE `t` (\n" +
" `a` int(10) unsigned NOT NULL,\n" +
Expand Down Expand Up @@ -5038,6 +5050,7 @@ func TestReorgPartitionConcurrent(t *testing.T) {
"14 14 14",
"15 15 15",
"16 16 16"))
tk.MustExec(`admin check table t`)
newInfoSchema := sessiontxn.GetTxnManager(tk.Session()).GetTxnInfoSchema()
require.Equal(t, int64(1), newInfoSchema.SchemaMetaVersion()-deleteReorgInfoSchema.SchemaMetaVersion())
oldTbl, err = deleteReorgInfoSchema.TableByName(model.NewCIStr(schemaName), model.NewCIStr("t"))
Expand Down Expand Up @@ -5076,6 +5089,7 @@ func TestReorgPartitionConcurrent(t *testing.T) {
" PARTITION `p1a` VALUES LESS THAN (15),\n" +
" PARTITION `p1b` VALUES LESS THAN (20),\n" +
" PARTITION `pMax` VALUES LESS THAN (MAXVALUE))"))
tk.MustExec(`admin check table t`)
newTbl.Meta().Partition = newPart
syncOnChanged <- true
require.NoError(t, <-alterErr)
Expand Down Expand Up @@ -5116,12 +5130,14 @@ func TestReorgPartitionFailConcurrent(t *testing.T) {
wait <- true
tk.MustExec(`insert into t values (14, "14", 14),(15, "15",15)`)
tk.MustGetErrCode(`insert into t values (11, "11", 11),(12,"duplicate PK 💥", 13)`, mysql.ErrDupEntry)
tk.MustExec(`admin check table t`)
wait <- true
require.NoError(t, <-alterErr)
tk.MustQuery(`select * from t where c between 10 and 22`).Sort().Check(testkit.Rows(""+
"12 12 21",
"14 14 14",
"15 15 15"))
tk.MustExec(`admin check table t`)
tk.MustQuery(`show create table t`).Check(testkit.Rows("" +
"t CREATE TABLE `t` (\n" +
" `a` int(10) unsigned NOT NULL,\n" +
Expand Down Expand Up @@ -5164,16 +5180,19 @@ func TestReorgPartitionFailConcurrent(t *testing.T) {
require.Equal(t, 0, getNumRowsFromPartitionDefs(t, tk, tbl, tbl.Meta().Partition.AddingDefinitions))
tk.MustExec(`delete from t where a = 14`)
tk.MustExec(`insert into t values (13, "13", 31),(14,"14b",14),(16, "16",16)`)
tk.MustExec(`admin check table t`)
wait <- true
wait <- true
tbl, err = infoSchema.TableByName(model.NewCIStr(schemaName), model.NewCIStr("t"))
require.NoError(t, err)
require.Equal(t, 5, getNumRowsFromPartitionDefs(t, tk, tbl, tbl.Meta().Partition.AddingDefinitions))
tk.MustExec(`delete from t where a = 15`)
tk.MustExec(`insert into t values (11, "11", 11),(15,"15b",15),(17, "17",17)`)
tk.MustExec(`admin check table t`)
wait <- true
require.NoError(t, <-alterErr)

tk.MustExec(`admin check table t`)
tk.MustQuery(`select * from t where a between 10 and 22`).Sort().Check(testkit.Rows(""+
"11 11 11",
"12 12 21",
Expand Down Expand Up @@ -5252,8 +5271,10 @@ func TestReorgPartitionFailInject(t *testing.T) {
wait <- true
tk.MustExec(`insert into t values (14, "14", 14),(15, "15",15)`)
tk.MustGetErrCode(`insert into t values (11, "11", 11),(12,"duplicate PK 💥", 13)`, mysql.ErrDupEntry)
tk.MustExec(`admin check table t`)
wait <- true
require.NoError(t, <-alterErr)
tk.MustExec(`admin check table t`)
tk.MustQuery(`select * from t where c between 10 and 22`).Sort().Check(testkit.Rows(""+
"12 12 21",
"14 14 14",
Expand Down Expand Up @@ -5291,6 +5312,7 @@ func TestReorgPartitionRollback(t *testing.T) {
// (partitions used during reorg, but was dropped)
require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/ddl/mockUpdateVersionAndTableInfoErr", `return(true)`))
tk.MustExecToErr("alter table t reorganize partition p1 into (partition p1a values less than (15), partition p1b values less than (20))")
tk.MustExec(`admin check table t`)
require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/ddl/mockUpdateVersionAndTableInfoErr"))
ctx := tk.Session()
is := domain.GetDomain(ctx).InfoSchema()
Expand All @@ -5303,6 +5325,7 @@ func TestReorgPartitionRollback(t *testing.T) {
require.NoError(t, err)
}()
tk.MustExecToErr("alter table t reorganize partition p1 into (partition p1a values less than (15), partition p1b values less than (20))")
tk.MustExec(`admin check table t`)
tk.MustQuery(`show create table t`).Check(testkit.Rows("" +
"t CREATE TABLE `t` (\n" +
" `a` int(10) unsigned NOT NULL,\n" +
Expand Down Expand Up @@ -5343,6 +5366,7 @@ func TestReorgPartitionData(t *testing.T) {
tk.MustExec(`SET @@session.sql_mode = default`)
tk.MustExec(`alter table t reorganize partition p1M into (partition p0 values less than (1), partition p2M values less than (2000000))`)
tk.MustQuery(`select * from t`).Sort().Check(testkit.Rows("0 Zero value! 0 2022-02-30 00:00:00"))
tk.MustExec(`admin check table t`)
}

// TODO Test with/without PK, indexes, UK, virtual, virtual stored columns
Expand Down
3 changes: 2 additions & 1 deletion ddl/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,8 @@ func getIntervalFromPolicy(policy []time.Duration, i int) (time.Duration, bool)

func getJobCheckInterval(job *model.Job, i int) (time.Duration, bool) {
switch job.Type {
case model.ActionAddIndex, model.ActionAddPrimaryKey, model.ActionModifyColumn:
case model.ActionAddIndex, model.ActionAddPrimaryKey, model.ActionModifyColumn,
model.ActionReorganizePartition:
return getIntervalFromPolicy(slowDDLIntervalPolicy, i)
case model.ActionCreateTable, model.ActionCreateSchema:
return getIntervalFromPolicy(fastDDLIntervalPolicy, i)
Expand Down
17 changes: 17 additions & 0 deletions ddl/ddl_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import (
tidbutil "github.com/pingcap/tidb/util"
"github.com/pingcap/tidb/util/dbterror"
"github.com/pingcap/tidb/util/logutil"
"github.com/pingcap/tidb/util/mathutil"
"github.com/pingcap/tidb/util/resourcegrouptag"
"github.com/pingcap/tidb/util/topsql"
topsqlstate "github.com/pingcap/tidb/util/topsql/state"
Expand Down Expand Up @@ -1360,6 +1361,22 @@ func updateSchemaVersion(d *ddlCtx, t *meta.Meta, job *model.Job, multiInfos ...
diff.AffectedOpts = buildPlacementAffects(oldIDs, oldIDs)
}
}
case model.ActionReorganizePartition:
diff.TableID = job.TableID
if len(job.CtxVars) > 0 {
if droppedIDs, ok := job.CtxVars[0].([]int64); ok {
if addedIDs, ok := job.CtxVars[1].([]int64); ok {
// to use AffectedOpts we need both new and old to have the same length
maxParts := mathutil.Max[int](len(droppedIDs), len(addedIDs))
// Also initialize them to 0!
oldIDs := make([]int64, maxParts)
copy(oldIDs, droppedIDs)
newIDs := make([]int64, maxParts)
copy(newIDs, addedIDs)
diff.AffectedOpts = buildPlacementAffects(oldIDs, newIDs)
}
}
}
case model.ActionCreateTable:
diff.TableID = job.TableID
if len(job.Args) > 0 {
Expand Down
22 changes: 19 additions & 3 deletions ddl/reorg.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"encoding/hex"
"fmt"
"strconv"
"strings"
"sync"
"sync/atomic"
"time"
Expand Down Expand Up @@ -300,6 +301,10 @@ func updateBackfillProgress(w *worker, reorgInfo *reorgInfo, tblInfo *model.Tabl
if progress > 1 {
progress = 1
}
logutil.BgLogger().Debug("[ddl] update progress",
zap.Float64("progress", progress),
zap.Int64("addedRowCount", addedRowCount),
zap.Int64("totalCount", totalCount))
}
switch reorgInfo.Type {
case model.ActionAddIndex, model.ActionAddPrimaryKey:
Expand Down Expand Up @@ -330,9 +335,20 @@ func getTableTotalCount(w *worker, tblInfo *model.TableInfo) int64 {
if !ok {
return statistics.PseudoRowCount
}
// TODO: if Reorganize Partition, only select number of rows from the selected partitions!
sql := "select table_rows from information_schema.tables where tidb_table_id=%?;"
rows, _, err := executor.ExecRestrictedSQL(w.ctx, nil, sql, tblInfo.ID)
var rows []chunk.Row
if tblInfo.Partition != nil && len(tblInfo.Partition.DroppingDefinitions) > 0 {
// if Reorganize Partition, only select number of rows from the selected partitions!
defs := tblInfo.Partition.DroppingDefinitions
partIDs := make([]string, 0, len(defs))
for _, def := range defs {
partIDs = append(partIDs, strconv.FormatInt(def.ID, 10))
}
sql := "select sum(table_rows) from information_schema.partitions where tidb_partition_id in (%?);"
rows, _, err = executor.ExecRestrictedSQL(w.ctx, nil, sql, strings.Join(partIDs, ","))
} else {
sql := "select table_rows from information_schema.tables where tidb_table_id=%?;"
rows, _, err = executor.ExecRestrictedSQL(w.ctx, nil, sql, tblInfo.ID)
}
if err != nil {
return statistics.PseudoRowCount
}
Expand Down
27 changes: 25 additions & 2 deletions infoschema/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,14 @@ func (b *Builder) ApplyDiff(m *meta.Meta, diff *model.SchemaDiff) ([]int64, erro
case model.ActionTruncateTablePartition, model.ActionTruncateTable:
return b.applyTruncateTableOrPartition(m, diff)
case model.ActionDropTable, model.ActionDropTablePartition:
return b.applyDropTableOrParition(m, diff)
return b.applyDropTableOrPartition(m, diff)
case model.ActionRecoverTable:
return b.applyRecoverTable(m, diff)
case model.ActionCreateTables:
return b.applyCreateTables(m, diff)
case model.ActionReorganizePartition:
// TODO: How to test?
return b.applyReorganizePartition(m, diff)
case model.ActionFlashbackCluster:
return []int64{-1}, nil
default:
Expand Down Expand Up @@ -275,7 +278,7 @@ func (b *Builder) applyTruncateTableOrPartition(m *meta.Meta, diff *model.Schema
return tblIDs, nil
}

func (b *Builder) applyDropTableOrParition(m *meta.Meta, diff *model.SchemaDiff) ([]int64, error) {
func (b *Builder) applyDropTableOrPartition(m *meta.Meta, diff *model.SchemaDiff) ([]int64, error) {
tblIDs, err := b.applyTableUpdate(m, diff)
if err != nil {
return nil, errors.Trace(err)
Expand All @@ -287,6 +290,24 @@ func (b *Builder) applyDropTableOrParition(m *meta.Meta, diff *model.SchemaDiff)
return tblIDs, nil
}

// TODO: How to test this?
func (b *Builder) applyReorganizePartition(m *meta.Meta, diff *model.SchemaDiff) ([]int64, error) {
// Is this needed? Since there should be no difference more than partition changes?
tblIDs, err := b.applyTableUpdate(m, diff)
if err != nil {
return nil, errors.Trace(err)
}
for _, opt := range diff.AffectedOpts {
if opt.OldTableID != 0 {
b.deleteBundle(b.is, opt.OldTableID)
}
if opt.TableID != 0 {
b.markTableBundleShouldUpdate(opt.TableID)
}
}
return tblIDs, nil
}

func (b *Builder) applyRecoverTable(m *meta.Meta, diff *model.SchemaDiff) ([]int64, error) {
tblIDs, err := b.applyTableUpdate(m, diff)
if err != nil {
Expand Down Expand Up @@ -696,6 +717,8 @@ func (b *Builder) applyCreateTable(m *meta.Meta, dbInfo *model.DBInfo, tableID i
switch tp {
case model.ActionDropTablePartition:
case model.ActionTruncateTablePartition:
// ReorganizePartition handle the bundles in applyReorganizePartition
case model.ActionReorganizePartition:
default:
pi := tblInfo.GetPartitionInfo()
if pi != nil {
Expand Down
15 changes: 15 additions & 0 deletions statistics/handle/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,21 @@ func (h *Handle) HandleDDLEvent(t *util.Event) error {
return err
}
}
case model.ActionReorganizePartition:
for _, def := range t.PartInfo.Definitions {
// TODO: Should we trigger analyze instead of adding 0s?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does 'adding 0s' mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this will just write stats as all zeros / empty table/indexes. Preferably I think it should trigger stats on the new partitions, including their indexes as well as update the global stats. And also wait for all this during the DeleteReorganization phase, so stats are up-to-date when going to StatePublic where the stats will be needed.

if err := h.insertTableStats2KV(t.TableInfo, def.ID); err != nil {
return err
}
}
// Update global stats, even though it should not have changed,
// the updated statistics from the newly reorganized partitions may be better
pruneMode := h.CurrentPruneMode()
if pruneMode == variable.Dynamic && t.PartInfo != nil {
if err := h.updateGlobalStats(t.TableInfo); err != nil {
return err
}
}
case model.ActionFlashbackCluster:
return h.updateStatsVersion()
}
Expand Down