Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

utils: fix value out of range for getting server_id (#537) #538

Merged
merged 1 commit into from
Mar 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/utils/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
3 changes: 3 additions & 0 deletions pkg/utils/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ func (t *testUtilsSuite) TestGetAllServerID(c *C) {
}, {
2,
[]uint32{},
}, {
4294967295, // max server-id.
[]uint32{},
},
}

Expand Down