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

Function IndexKVIsUnique

pkg/tablecodec/tablecodec.go:2009–2019  ·  view source on GitHub ↗

IndexKVIsUnique uses to judge if an index is unique, it can handle the KV committed by txn already, it doesn't consider the untouched flag.

(value []byte)

Source from the content-addressed store, hash-verified

2007
2008// IndexKVIsUnique uses to judge if an index is unique, it can handle the KV committed by txn already, it doesn't consider the untouched flag.
2009func IndexKVIsUnique(value []byte) bool {
2010 if len(value) <= MaxOldEncodeValueLen {
2011 return len(value) == 8
2012 }
2013 if getIndexVersion(value) == 1 {
2014 segs := splitIndexValueForClusteredIndexVersion1(value)
2015 return segs.CommonHandle != nil
2016 }
2017 segs := splitIndexValueForIndexValueVersion0(value)
2018 return segs.IntHandle != nil || segs.CommonHandle != nil
2019}
2020
2021// VerifyTableIDForRanges verifies that all given ranges are valid to decode the table id.
2022func VerifyTableIDForRanges(keyRanges *kv.KeyRanges) ([]int64, error) {

Callers 4

KeyNeedToLockFunction · 0.92
checkTempIndexKeyFunction · 0.92
fetchTempIndexValsMethod · 0.92
TestTempIndexValueCodecFunction · 0.85

Tested by 1

TestTempIndexValueCodecFunction · 0.68