Skip to content

Commit

Permalink
skip for the deleted temp key
Browse files Browse the repository at this point in the history
  • Loading branch information
tangenta committed Dec 14, 2022
1 parent ba41383 commit 9ee3303
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions executor/insert.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ func prefetchConflictedOldRows(ctx context.Context, txn kv.Transaction, rows []t
for _, uk := range r.uniqueKeys {
if val, found := values[string(uk.newKey)]; found {
if tablecodec.IsTempIndexKey(uk.newKey) {
if tablecodec.CheckTempIndexValueIsDelete(val) {
continue
}
val = tablecodec.DecodeTempIndexOriginValue(val)
}
handle, err := tablecodec.DecodeHandleInUniqueIndexValue(val, uk.commonHandle)
Expand Down
3 changes: 3 additions & 0 deletions executor/replace.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ func (e *ReplaceExec) removeIndexRow(ctx context.Context, txn kv.Transaction, r
return false, false, err
}
if tablecodec.IsTempIndexKey(uk.newKey) {
if tablecodec.CheckTempIndexValueIsDelete(val) {
continue
}
val = tablecodec.DecodeTempIndexOriginValue(val)
}
handle, err := tablecodec.DecodeHandleInUniqueIndexValue(val, uk.commonHandle)
Expand Down
2 changes: 1 addition & 1 deletion table/tables/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func (c *index) Create(sctx sessionctx.Context, txn kv.Transaction, indexedValue
if err != nil && !kv.IsErrNotFound(err) {
return nil, err
}
if err != nil || len(value) == 0 {
if err != nil || len(value) == 0 || (keyIsTempIdxKey && tablecodec.CheckTempIndexValueIsDelete(value)) {
lazyCheck := sctx.GetSessionVars().LazyCheckKeyNotExists() && err != nil
var needPresumeKey TempIndexKeyState
if keyIsTempIdxKey {
Expand Down

0 comments on commit 9ee3303

Please sign in to comment.