reEncodeHandleConsiderNewCollation encodes the handle as a Datum so it can be properly decoded later.
(handle kv.Handle, columns []rowcodec.ColInfo, restoreData []byte)
| 827 | |
| 828 | // reEncodeHandleConsiderNewCollation encodes the handle as a Datum so it can be properly decoded later. |
| 829 | func reEncodeHandleConsiderNewCollation(handle kv.Handle, columns []rowcodec.ColInfo, restoreData []byte) ([][]byte, error) { |
| 830 | handleColLen := handle.NumCols() |
| 831 | cHandleBytes := make([][]byte, 0, handleColLen) |
| 832 | for i := 0; i < handleColLen; i++ { |
| 833 | cHandleBytes = append(cHandleBytes, handle.EncodedCol(i)) |
| 834 | } |
| 835 | if len(restoreData) == 0 { |
| 836 | return cHandleBytes, nil |
| 837 | } |
| 838 | // Remove some extra columns(ID < 0), such like `model.ExtraPhysTblID`. |
| 839 | // They are not belong to common handle and no need to restore data. |
| 840 | idx := len(columns) |
| 841 | for idx > 0 && columns[idx-1].ID < 0 { |
| 842 | idx-- |
| 843 | } |
| 844 | return decodeRestoredValuesV5(columns[:idx], cHandleBytes, restoreData) |
| 845 | } |
| 846 | |
| 847 | func decodeRestoredValues(columns []rowcodec.ColInfo, restoredVal []byte) ([][]byte, error) { |
| 848 | colIDs := make(map[int64]int, len(columns)) |
no test coverage detected
searching dependent graphs…