diff --git a/pkg/utils/db.go b/pkg/utils/db.go index a27c25877c..75dcd8fdb5 100644 --- a/pkg/utils/db.go +++ b/pkg/utils/db.go @@ -274,7 +274,7 @@ func GetServerID(db *sql.DB) (uint32, error) { return 0, err } - serverID, err := strconv.ParseInt(serverIDStr, 10, 32) + serverID, err := strconv.ParseUint(serverIDStr, 10, 32) return uint32(serverID), terror.ErrInvalidServerID.Delegate(err, serverIDStr) } diff --git a/pkg/utils/db_test.go b/pkg/utils/db_test.go index fa76873bd0..1a171cddf6 100644 --- a/pkg/utils/db_test.go +++ b/pkg/utils/db_test.go @@ -32,6 +32,9 @@ func (t *testUtilsSuite) TestGetAllServerID(c *C) { }, { 2, []uint32{}, + }, { + 4294967295, // max server-id. + []uint32{}, }, }