IsUntouchedIndexKValue uses to check whether the key is index key, and the value is untouched, since the untouched index key/value is no need to commit.
(k, v []byte)
| 1163 | // IsUntouchedIndexKValue uses to check whether the key is index key, and the value is untouched, |
| 1164 | // since the untouched index key/value is no need to commit. |
| 1165 | func IsUntouchedIndexKValue(k, v []byte) bool { |
| 1166 | if !IsIndexKey(k) { |
| 1167 | return false |
| 1168 | } |
| 1169 | vLen := len(v) |
| 1170 | if IsTempIndexKey(k) { |
| 1171 | return vLen > 0 && v[vLen-1] == kv.UnCommitIndexKVFlag |
| 1172 | } |
| 1173 | if vLen <= MaxOldEncodeValueLen { |
| 1174 | return (vLen == 1 || vLen == 9) && v[vLen-1] == kv.UnCommitIndexKVFlag |
| 1175 | } |
| 1176 | // New index value format |
| 1177 | tailLen := int(v[0]) |
| 1178 | if tailLen < 8 { |
| 1179 | // Non-unique index. |
| 1180 | return tailLen >= 1 && v[vLen-1] == kv.UnCommitIndexKVFlag |
| 1181 | } |
| 1182 | // Unique index |
| 1183 | return tailLen == 9 |
| 1184 | } |
| 1185 | |
| 1186 | // GenTablePrefix composes table record and index prefix: "t[tableID]". |
| 1187 | func GenTablePrefix(tableID int64) kv.Key { |