Repository navigation
Description
The replication view of mcli batch status still multiplies the cumulative object count by time.Second as int64 before converting to float64. It can display negative IOPs once the count reaches 9,223,372,037 objects.
Confirmed on main at 18ea0a1ae04f69c7ae7c8f8b11329109ae7dcf71, and present in mcli 20261025. Suggested priority: P3: this is a display calculation defect at a very large cumulative object count, with no demonstrated effect on transferred data, job completion or rate limiting.
The remaining expression is in batchJobMetricsUI.View:
objectsPerSec := float64(int64(time.Second)*m.metric.Replicate.Objects) / float64(accElapsedTime)To reproduce, construct initBatchJobMetricsUI("audit"), set its metric to a replicate job with StartTime = time.Unix(1, 0), LastUpdate = StartTime.Add(time.Second), and Replicate.Objects = 9223372037, then render View():
Objects: 9223372037
IOPs: -9223372036.71 objs/s
Expected IOPs: 9223372037.00 objs/s. The largest count whose intermediate multiplication fits is math.MaxInt64 / 1e9 = 9223372036. The overflow threshold depends on cumulative object count, even for a long-running job; it is not a throughput threshold. Byte throughput in this view already divides by elapsed seconds correctly.
Convert before multiplying, or directly compute float64(Objects) / accElapsedTime.Seconds(), retaining the existing positive-duration guard. This is the same arithmetic defect class as #48 in a separate command; it does not invalidate the site-resync repair or require reopening that issue.
Regression acceptance:
- Render exact signed rate values for zero, threshold minus one, threshold, threshold plus one, and
math.MaxInt64object counts. - Include 1-second and long elapsed durations; positive counts must not render a negative rate.
- Zero and negative durations remain guarded, with no NaN/Inf or panic.
- Compare the complete rendered numeric field, not a substring that could also match a negative value.
- Keep the existing site-resync overflow regression tests passing.
Related: #53 covers missing batch-job metrics and command lifecycle, independently of this arithmetic repair.
Activity
Fix client identity isolation and status reporting (pgsty#55)