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

Function EncodeRecordKey

pkg/tablecodec/tablecodec.go:124–132  ·  view source on GitHub ↗

EncodeRecordKey encodes the recordPrefix, row handle into a kv.Key.

(recordPrefix kv.Key, h kv.Handle)

Source from the content-addressed store, hash-verified

122
123// EncodeRecordKey encodes the recordPrefix, row handle into a kv.Key.
124func EncodeRecordKey(recordPrefix kv.Key, h kv.Handle) kv.Key {
125 buf := make([]byte, 0, len(recordPrefix)+h.Len())
126 if ph, ok := h.(kv.PartitionHandle); ok {
127 recordPrefix = GenTableRecordPrefix(ph.PartitionID)
128 }
129 buf = append(buf, recordPrefix...)
130 buf = append(buf, h.Encoded()...)
131 return buf
132}
133
134func hasTablePrefix(key kv.Key) bool {
135 return key[0] == tablePrefix[0]

Callers 15

fakeRowRawKeyFunction · 0.92
generateStatsFilesFunction · 0.92
encodeTableRecordFunction · 0.92
lockKeysMethod · 0.92
encodeHandleFromRowMethod · 0.92
PartitionRecordKeyFunction · 0.92
firstKeyFunction · 0.92
TestDupKeyCheckModeFunction · 0.92
RecordKeyMethod · 0.92
RowWithColsFunction · 0.92
IterRecordsFunction · 0.92

Calls 3

GenTableRecordPrefixFunction · 0.85
LenMethod · 0.65
EncodedMethod · 0.65

Tested by 11

fakeRowRawKeyFunction · 0.74
generateStatsFilesFunction · 0.74
encodeTableRecordFunction · 0.74
firstKeyFunction · 0.74
TestDupKeyCheckModeFunction · 0.74
TestSplitTableFunction · 0.74
checkColumnKVExistFunction · 0.74
TestGetReverseKeyFunction · 0.74
TestRegionIndexRangeFunction · 0.74
TestRecordKeyFunction · 0.68