Skip to content

Commit

Permalink
ddl: Reorganize Partition failure/rollback tests and fixes (pingcap#5…
Browse files Browse the repository at this point in the history
  • Loading branch information
mjonss authored Sep 26, 2024
1 parent 401c898 commit f2ed822
Show file tree
Hide file tree
Showing 7 changed files with 616 additions and 115 deletions.
2 changes: 0 additions & 2 deletions pkg/ddl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ go_test(
"placement_policy_test.go",
"placement_sql_test.go",
"primary_key_handle_test.go",
"reorg_partition_test.go",
"repair_table_test.go",
"restart_test.go",
"rollingback_test.go",
Expand Down Expand Up @@ -343,7 +342,6 @@ go_test(
"//pkg/util/domainutil",
"//pkg/util/gcutil",
"//pkg/util/generic",
"//pkg/util/mathutil",
"//pkg/util/mock",
"//pkg/util/sem",
"//pkg/util/sqlexec",
Expand Down
8 changes: 8 additions & 0 deletions pkg/ddl/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -1560,6 +1560,14 @@ func (w *addIndexTxnWorker) checkHandleExists(idxInfo *model.IndexInfo, key kv.K
if hasBeenBackFilled {
return nil
}
if idxInfo.Global {
// 'handle' comes from reading directly from a partition, without partition id,
// so we can only compare the handle part of the key.
if ph, ok := h.(kv.PartitionHandle); ok && ph.Handle.Equal(handle) {
// table row has been back-filled already, OK to add the index entry
return nil
}
}
return ddlutil.GenKeyExistsErr(key, value, idxInfo, tblInfo)
}

Expand Down
Loading

0 comments on commit f2ed822

Please sign in to comment.