MCPcopy
hub / github.com/pingcap/tidb / DecodeHandleInIndexValue

Function DecodeHandleInIndexValue

pkg/tablecodec/tablecodec.go:1075–1097  ·  view source on GitHub ↗

DecodeHandleInIndexValue decodes handle in unqiue index value.

(value []byte)

Source from the content-addressed store, hash-verified

1073
1074// DecodeHandleInIndexValue decodes handle in unqiue index value.
1075func DecodeHandleInIndexValue(value []byte) (handle kv.Handle, err error) {
1076 if len(value) <= MaxOldEncodeValueLen {
1077 return DecodeIntHandleInIndexValue(value), nil
1078 }
1079 seg := SplitIndexValue(value)
1080 if len(seg.IntHandle) != 0 {
1081 handle = DecodeIntHandleInIndexValue(seg.IntHandle)
1082 }
1083 if len(seg.CommonHandle) != 0 {
1084 handle, err = kv.NewCommonHandle(seg.CommonHandle)
1085 if err != nil {
1086 return nil, err
1087 }
1088 }
1089 if len(seg.PartitionID) != 0 {
1090 _, pid, err := codec.DecodeInt(seg.PartitionID)
1091 if err != nil {
1092 return nil, err
1093 }
1094 handle = kv.NewPartitionHandle(pid, handle)
1095 }
1096 return handle, nil
1097}
1098
1099// DecodeIntHandleInIndexValue uses to decode index value as int handle id.
1100func DecodeIntHandleInIndexValue(data []byte) kv.Handle {

Callers 15

createMethod · 0.92
DeleteMethod · 0.92
FetchDuplicatedHandleFunction · 0.92
initializeMethod · 0.92
NextMethod · 0.92
batchMarkDupMethod · 0.92
TestReturnValuesFunction · 0.92
BackfillDataMethod · 0.92
checkTempIndexKeyFunction · 0.92
prefetchPointPlanKeysMethod · 0.92

Calls 5

NewCommonHandleFunction · 0.92
DecodeIntFunction · 0.92
NewPartitionHandleFunction · 0.92
SplitIndexValueFunction · 0.85

Tested by 5

TestReturnValuesFunction · 0.74
TestTempIndexValueCodecFunction · 0.68