Skip to content

Commit 4973f87

Browse files
authored
lightning: save NEXT_GLOBAL_ROW_ID as uint64 instead of int64 (#45614) (#45944)
close #45427
1 parent 0f63de7 commit 4973f87

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

br/pkg/lightning/backend/tidb/tidb.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ func (w *Writer) IsSynced() bool {
799799

800800
type TableAutoIDInfo struct {
801801
Column string
802-
NextID int64
802+
NextID uint64
803803
Type string
804804
}
805805

@@ -812,7 +812,7 @@ func FetchTableAutoIDInfos(ctx context.Context, exec utils.QueryExecutor, tableN
812812
for rows.Next() {
813813
var (
814814
dbName, tblName, columnName, idType string
815-
nextID int64
815+
nextID uint64
816816
)
817817
columns, err := rows.Columns()
818818
if err != nil {
@@ -825,7 +825,7 @@ func FetchTableAutoIDInfos(ctx context.Context, exec utils.QueryExecutor, tableN
825825
//| testsysbench | t | _tidb_rowid | 1 | AUTO_INCREMENT |
826826
//+--------------+------------+-------------+--------------------+----------------+
827827

828-
// if columns length is 4, it doesn't contains the last column `ID_TYPE`, and it will always be 'AUTO_INCREMENT'
828+
// if columns length is 4, it doesn't contain the last column `ID_TYPE`, and it will always be 'AUTO_INCREMENT'
829829
// for v4.0.0~v4.0.2 show table t next_row_id only returns 4 columns.
830830
if len(columns) == 4 {
831831
err = rows.Scan(&dbName, &tblName, &columnName, &nextID)

br/pkg/lightning/backend/tidb/tidb_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ func TestFetchRemoteTableModels_4_0(t *testing.T) {
304304
AddRow("t", "id", "bigint(20) unsigned", "", "auto_increment"))
305305
s.mockDB.ExpectQuery("SHOW TABLE `test`.`t` NEXT_ROW_ID").
306306
WillReturnRows(sqlmock.NewRows([]string{"DB_NAME", "TABLE_NAME", "COLUMN_NAME", "NEXT_GLOBAL_ROW_ID"}).
307-
AddRow("test", "t", "id", int64(1)))
307+
AddRow("test", "t", "id", "10942694589135710585"))
308308
s.mockDB.ExpectCommit()
309309

310310
bk := tidb.NewTiDBBackend(context.Background(), s.dbHandle, config.ErrorOnDup, errormanager.New(nil, config.NewConfig(), log.L()))

0 commit comments

Comments
 (0)