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

*: global index support admin check table | index #53156

Merged
merged 14 commits into from
May 13, 2024
Prev Previous commit
Next Next commit
update
Defined2014 committed May 10, 2024

Verified

This commit was signed with the committer’s verified signature.
axelboc Axel Bocciarelli
commit d2321f6e394d96fb3110fe08afaa5f77bdfcf663
7 changes: 3 additions & 4 deletions pkg/executor/distsql.go
Original file line number Diff line number Diff line change
@@ -594,17 +594,16 @@ func (e *IndexLookUpExecutor) needPartitionHandle(tp getHandleType) (bool, error
outputOffsets := e.tableRequest.OutputOffsets
col = cols[outputOffsets[len(outputOffsets)-1]]

// For TableScan, need partitionHandle in `indexOrder` when e.keepOrder == true or execute `admin check [table|index]`
needPartitionHandle = ((e.index.Global || e.partitionTableMode) && e.keepOrder) || e.checkIndexValue != nil
// For TableScan, need partitionHandle in `indexOrder` when e.keepOrder == true or execute `admin check [table|index]` with global index
needPartitionHandle = ((e.index.Global || e.partitionTableMode) && e.keepOrder) || (e.index.Global && e.checkIndexValue != nil)
// no ExtraPidColID here, because TableScan shouldn't contain them.
hasExtraCol = col.ID == model.ExtraPhysTblID
}

// TODO: fix global index related bugs later
// There will be two needPartitionHandle != hasExtraCol situations.
// Only `needPartitionHandle` == true and `hasExtraCol` == false are not allowed.
// `ExtraPhysTblID` will be used in `SelectLock` when `needPartitionHandle` == false and `hasExtraCol` == true.
if needPartitionHandle && !hasExtraCol && !e.index.Global {
if needPartitionHandle && !hasExtraCol {
return needPartitionHandle, errors.Errorf("Internal error, needPartitionHandle != ret, tp(%d)", tp)
}
return needPartitionHandle, nil