tables: avoid delete the primary index when deleting clustered table row (#26459)

This commit is contained in:
lysu
2021-07-22 15:12:13 +08:00
committed by GitHub
parent 0f4dc9cb80
commit 39a4827fab

View File

@ -1194,6 +1194,9 @@ func (t *TableCommon) removeRowIndices(ctx sessionctx.Context, h kv.Handle, rec
return err
}
for _, v := range t.deletableIndices() {
if v.Meta().Primary && (t.Meta().IsCommonHandle || t.Meta().PKIsHandle) {
continue
}
vals, err := v.FetchValues(rec, nil)
if err != nil {
logutil.BgLogger().Info("remove row index failed", zap.Any("index", v.Meta()), zap.Uint64("txnStartTS", txn.StartTS()), zap.String("handle", h.String()), zap.Any("record", rec), zap.Error(err))