@@ -1401,16 +1401,41 @@ func TestGlobalIndexInsertInDropPartition(t *testing.T) {
1401
1401
partition p2 values less than (20),
1402
1402
partition p3 values less than (30)
1403
1403
);` )
1404
+ << << << < HEAD
1404
1405
tk .MustExec ("alter table test_global add unique index idx_b (b);" )
1405
1406
tk .MustExec ("insert into test_global values (1, 1, 1), (8, 8, 8), (11, 11, 11), (12, 12, 12);" )
1406
1407
1407
1408
hook := & callback.TestDDLCallback {Do : dom }
1408
1409
hook .OnJobRunBeforeExported = func (job * model.Job ) {
1410
+ == == == =
1411
+ tk .MustExec ("alter table test_global add unique index idx_b (b) global" )
1412
+ tk .MustExec ("insert into test_global values (1, 1, 1), (2, 2, 2), (11, 11, 11), (12, 12, 12)" )
1413
+
1414
+ doneMap := make (map [model.SchemaState ]struct {})
1415
+ testfailpoint .EnableCall (t , "github.com/pingcap/tidb/pkg/ddl/onJobRunBefore" , func (job * model.Job ) {
1416
+ >> >> >> > b6025b97877 (* : Reorg partition fix delete ranges and handling non - clustered tables with concurrent DML (#57114 ))
1409
1417
assert .Equal (t , model .ActionDropTablePartition , job .Type )
1410
- if job .SchemaState == model .StateDeleteOnly {
1411
- tk2 := testkit .NewTestKit (t , store )
1412
- tk2 .MustExec ("use test" )
1413
- tk2 .MustExec ("insert into test_global values (9, 9, 9)" )
1418
+ if _ , ok := doneMap [job .SchemaState ]; ok {
1419
+ return
1420
+ }
1421
+ doneMap [job .SchemaState ] = struct {}{}
1422
+ tk2 := testkit .NewTestKit (t , store )
1423
+ tk2 .MustExec ("use test" )
1424
+ switch job .SchemaState {
1425
+ case model .StatePublic :
1426
+ tk2 .MustExec ("insert into test_global values (3, 3, 3)" )
1427
+ tk2 .MustExec ("insert into test_global values (13, 13, 13)" )
1428
+ case model .StateWriteOnly :
1429
+ tk2 .MustContainErrMsg ("insert into test_global values (4, 4, 4)" , "[table:1526]Table has no partition for value matching a partition being dropped, 'p1'" )
1430
+ tk2 .MustExec ("insert into test_global values (14, 14, 14)" )
1431
+ case model .StateDeleteOnly :
1432
+ tk2 .MustExec ("insert into test_global values (5, 5, 5)" )
1433
+ tk2 .MustExec ("insert into test_global values (15, 15, 15)" )
1434
+ case model .StateDeleteReorganization :
1435
+ tk2 .MustExec ("insert into test_global values (6, 6, 6)" )
1436
+ tk2 .MustExec ("insert into test_global values (16, 16, 16)" )
1437
+ default :
1438
+ require .Fail (t , "invalid schema state '%s'" , job .SchemaState .String ())
1414
1439
}
1415
1440
}
1416
1441
dom .DDL ().SetHook (hook )
@@ -1420,7 +1445,7 @@ func TestGlobalIndexInsertInDropPartition(t *testing.T) {
1420
1445
tk1 .MustExec ("alter table test_global drop partition p1" )
1421
1446
1422
1447
tk .MustExec ("analyze table test_global" )
1423
- tk .MustQuery ("select * from test_global use index(idx_b) order by a" ).Check (testkit .Rows ("9 9 9 " , "11 11 11" , "12 12 12" ))
1448
+ tk .MustQuery ("select * from test_global use index(idx_b) order by a" ).Check (testkit .Rows ("5 5 5 " , "6 6 6" , " 11 11 11" , "12 12 12" , "13 13 13" , "14 14 14" , "15 15 15" , "16 16 16 " ))
1424
1449
}
1425
1450
1426
1451
func TestUpdateGlobalIndex (t * testing.T ) {
@@ -3608,10 +3633,10 @@ func TestRemovePartitioningAutoIDs(t *testing.T) {
3608
3633
tk3 .MustExec (`COMMIT` )
3609
3634
tk3 .MustQuery (`select _tidb_rowid, a, b from t` ).Sort ().Check (testkit .Rows (
3610
3635
"13 11 11" , "14 2 2" , "15 12 12" , "17 16 18" ,
3611
- "19 18 4" , "21 20 5" , "23 22 6" , "25 24 7" , "30 29 9" ))
3636
+ "19 18 4" , "21 20 5" , "23 22 6" , "25 24 7" , "29 28 9" ))
3612
3637
tk2 .MustQuery (`select _tidb_rowid, a, b from t` ).Sort ().Check (testkit .Rows (
3613
3638
"13 11 11" , "14 2 2" , "15 12 12" , "17 16 18" ,
3614
- "19 18 4" , "23 22 6" , "27 26 8" , "32 31 10" ))
3639
+ "19 18 4" , "23 22 6" , "27 26 8" , "31 30 10" ))
3615
3640
3616
3641
waitFor (4 , "t" , "write reorganization" )
3617
3642
tk3 .MustExec (`BEGIN` )
@@ -3621,28 +3646,73 @@ func TestRemovePartitioningAutoIDs(t *testing.T) {
3621
3646
tk3 .MustExec (`insert into t values (null, 23)` )
3622
3647
tk2 .MustExec (`COMMIT` )
3623
3648
3649
+ << << << < HEAD
3624
3650
/ *
3625
3651
waitFor (4 , "t" , "delete reorganization" )
3626
3652
tk2 .MustExec (`BEGIN` )
3627
3653
tk2 .MustExec (`insert into t values (null, 24)` )
3654
+ == == == =
3655
+ waitFor (4 , "t" , "delete reorganization" )
3656
+ tk2 .MustExec (`BEGIN` )
3657
+ tk2 .MustExec (`insert into t values (null, 24)` )
3658
+ >> >> >> > b6025b97877 (* : Reorg partition fix delete ranges and handling non - clustered tables with concurrent DML (#57114 ))
3628
3659
3629
- tk3.MustExec(`insert into t values (null, 25)`)
3630
- tk2.MustExec(`insert into t values (null, 26)`)
3631
- */
3660
+ tk3 .MustExec (`insert into t values (null, 25)` )
3661
+ tk2 .MustExec (`insert into t values (null, 26)` )
3632
3662
tk3 .MustExec (`COMMIT` )
3663
+ tk2 .MustQuery (`select _tidb_rowid, a, b from t` ).Sort ().Check (testkit .Rows (
3664
+ "27 26 8" ,
3665
+ "30012 12 12" ,
3666
+ "30013 18 4" ,
3667
+ "30014 24 7" ,
3668
+ "30015 16 18" ,
3669
+ "30016 22 6" ,
3670
+ "30017 28 9" ,
3671
+ "30018 11 11" ,
3672
+ "30019 2 2" ,
3673
+ "30020 20 5" ,
3674
+ "31 30 10" ,
3675
+ "35 34 22" ,
3676
+ "39 38 24" ,
3677
+ "43 42 26" ))
3633
3678
tk3 .MustQuery (`select _tidb_rowid, a, b from t` ).Sort ().Check (testkit .Rows (
3634
- "13 11 11" , "14 2 2" , "15 12 12" , "17 16 18" ,
3635
- "19 18 4" , "21 20 5" , "23 22 6" , "25 24 7" , "27 26 8" , "30 29 9" ,
3636
- "32 31 10" , "35 34 21" , "38 37 22" , "41 40 23" ))
3637
-
3638
- //waitFor(4, "t", "public")
3639
- //tk2.MustExec(`commit`)
3640
- // TODO: Investigate and fix, but it is also related to https://github.com/pingcap/tidb/issues/46904
3641
- require .ErrorContains (t , <- alterChan , "[kv:1062]Duplicate entry '31' for key 't.PRIMARY'" )
3679
+ "27 26 8" ,
3680
+ "30012 12 12" ,
3681
+ "30013 18 4" ,
3682
+ "30014 24 7" ,
3683
+ "30015 16 18" ,
3684
+ "30016 22 6" ,
3685
+ "30017 28 9" ,
3686
+ "30018 11 11" ,
3687
+ "30019 2 2" ,
3688
+ "30020 20 5" ,
3689
+ "31 30 10" ,
3690
+ "33 32 21" ,
3691
+ "35 34 22" ,
3692
+ "37 36 23" ,
3693
+ "41 40 25" ))
3694
+
3695
+ waitFor (4 , "t" , "public" )
3696
+ tk2 .MustExec (`commit` )
3642
3697
tk3 .MustQuery (`select _tidb_rowid, a, b from t` ).Sort ().Check (testkit .Rows (
3643
- "13 11 11" , "14 2 2" , "15 12 12" , "17 16 18" ,
3644
- "19 18 4" , "21 20 5" , "23 22 6" , "25 24 7" , "27 26 8" , "30 29 9" ,
3645
- "32 31 10" , "35 34 21" , "38 37 22" , "41 40 23" ))
3698
+ "27 26 8" ,
3699
+ "30012 12 12" ,
3700
+ "30013 18 4" ,
3701
+ "30014 24 7" ,
3702
+ "30015 16 18" ,
3703
+ "30016 22 6" ,
3704
+ "30017 28 9" ,
3705
+ "30018 11 11" ,
3706
+ "30019 2 2" ,
3707
+ "30020 20 5" ,
3708
+ "31 30 10" ,
3709
+ "33 32 21" ,
3710
+ "35 34 22" ,
3711
+ "37 36 23" ,
3712
+ "39 38 24" ,
3713
+ "41 40 25" ,
3714
+ "43 42 26" ))
3715
+ require .NoError (t , <- alterChan )
3646
3716
}
3647
3717
3648
3718
func TestAlterLastIntervalPartition (t * testing.T ) {
0 commit comments