Private
Public Access
1
0

fix(db): use int for netspeed_active to prevent overflow
All checks were successful
continuous-integration/drone/push Build is passing

GetZoneStatsData and GetZoneStatsV2's netspeed_active values can
exceed 2 billion, causing 32-bit integer overflow. Changed from
int32/uint32 to int (64-bit on modern systems) to handle large
network speed totals.

- Update sqlc column overrides to use int type
- Fix type compatibility in dnsanswers.go zoneTotals map
- Regenerate database code with new types

Fixes https://community.ntppool.org/t/error-message-displayed-on-the-monitoring-score-page/4063
This commit is contained in:
2025-09-21 00:08:21 -07:00
parent 02a6f587bb
commit 196f90a2b9
4 changed files with 10 additions and 6 deletions

View File

@@ -339,5 +339,5 @@ type ZoneServerCount struct {
Date time.Time `db:"date" json:"date"`
CountActive uint32 `db:"count_active" json:"count_active"`
CountRegistered uint32 `db:"count_registered" json:"count_registered"`
NetspeedActive uint32 `db:"netspeed_active" json:"netspeed_active"`
NetspeedActive int `db:"netspeed_active" json:"netspeed_active"`
}

View File

@@ -421,7 +421,7 @@ type GetZoneStatsDataRow struct {
IpVersion ZoneServerCountsIpVersion `db:"ip_version" json:"ip_version"`
CountActive uint32 `db:"count_active" json:"count_active"`
CountRegistered uint32 `db:"count_registered" json:"count_registered"`
NetspeedActive uint32 `db:"netspeed_active" json:"netspeed_active"`
NetspeedActive int `db:"netspeed_active" json:"netspeed_active"`
}
func (q *Queries) GetZoneStatsData(ctx context.Context) ([]GetZoneStatsDataRow, error) {
@@ -484,7 +484,7 @@ AS server_netspeed
type GetZoneStatsV2Row struct {
ZoneName string `db:"zone_name" json:"zone_name"`
NetspeedActive int32 `db:"netspeed_active" json:"netspeed_active"`
NetspeedActive int `db:"netspeed_active" json:"netspeed_active"`
}
func (q *Queries) GetZoneStatsV2(ctx context.Context, ip string) ([]GetZoneStatsV2Row, error) {