diff --git a/pkg/utils/db.go b/pkg/utils/db.go index 019b6d88da..8d43994380 100644 --- a/pkg/utils/db.go +++ b/pkg/utils/db.go @@ -303,7 +303,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{}, }, }