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

*: fix wrong replace or insert-on-dup behavior on prefixed clustered index #23091

Merged
merged 7 commits into from
Mar 9, 2021
Merged
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
address comments
Signed-off-by: lysu <sulifx@gmail.com>
  • Loading branch information
lysu committed Mar 9, 2021
commit 3c7a2dff10d58756a69232b5f821af63c634f83a
6 changes: 3 additions & 3 deletions table/tables/tables.go
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ func RowWithCols(t table.Table, ctx sessionctx.Context, h kv.Handle, cols []*tab
return v, nil
}

func supportReadColumnFromHandle(meta *model.TableInfo, col *table.Column) (containFullCol bool, idxInHandle int) {
func containFullColInHandle(meta *model.TableInfo, col *table.Column) (containFullCol bool, idxInHandle int) {
pkIdx := FindPrimaryIndex(meta)
for i, idxCol := range pkIdx.Columns {
if meta.Columns[idxCol.Offset].ID == col.ID {
Expand All @@ -887,7 +887,7 @@ func supportReadColumnFromHandle(meta *model.TableInfo, col *table.Column) (cont
return
}
}
panic("unreachable")
return
}

// DecodeRawRowData decodes raw row data into a datum slice and a (columnID:columnValue) map.
Expand All @@ -909,7 +909,7 @@ func DecodeRawRowData(ctx sessionctx.Context, meta *model.TableInfo, h kv.Handle
continue
}
if col.IsCommonHandleColumn(meta) && !types.CommonHandleNeedRestoredData(&col.FieldType) {
if containFullCol, idxInHandle := supportReadColumnFromHandle(meta, col); containFullCol {
if containFullCol, idxInHandle := containFullColInHandle(meta, col); containFullCol {
dtBytes := h.EncodedCol(idxInHandle)
_, dt, err := codec.DecodeOne(dtBytes)
if err != nil {
Expand Down