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)
| 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. |
| 2009 | func 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. |
| 2022 | func VerifyTableIDForRanges(keyRanges *kv.KeyRanges) ([]int64, error) { |