(t *testing.T)
| 730 | } |
| 731 | |
| 732 | func TestV2TableCodec(t *testing.T) { |
| 733 | const tableID int64 = 31415926 |
| 734 | key := EncodeTablePrefix(tableID) |
| 735 | c, err := tikv.NewCodecV2(tikv.ModeTxn, &keyspacepb.KeyspaceMeta{Id: 271828}) |
| 736 | require.NoError(t, err) |
| 737 | key = c.EncodeKey(key) |
| 738 | tbid := DecodeTableID(key) |
| 739 | require.Equal(t, tableID, tbid) |
| 740 | |
| 741 | key = []byte("x001HelloWorld") |
| 742 | tbid = DecodeTableID(key) |
| 743 | require.Equal(t, int64(0), tbid) |
| 744 | |
| 745 | key = []byte("x001x001t123") |
| 746 | tbid = DecodeTableID(key) |
| 747 | require.Equal(t, int64(0), tbid) |
| 748 | } |
| 749 | |
| 750 | // TestDecodeIndexHandleWithPartitionIDInKeyAndValue tests the scenario where |
| 751 | // a GlobalIndexVersionV1+ non-unique index has partition ID in both the key |
nothing calls this directly
no test coverage detected