Skip to content

Commit 8a123c9

Browse files
committed
pkg/cmd/roachtests: fix disk bandwidth passed to cluster setting
As of #135019, the disk bandwidth variable has units of bytes, but the string passed to the cluster setting has units of `MiB`. This can result an effective bandwidth that is orders of magnitude too high. Change the former to match the units of the latter. Release note: None.
1 parent 0e35b2b commit 8a123c9

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

pkg/cmd/roachtest/tests/admission_control_disk_bandwidth_overload.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func registerDiskBandwidthOverload(r registry.Registry) {
7272
staller := roachtestutil.MakeCgroupDiskStaller(t, c,
7373
false /* readsToo */, false /* logsToo */)
7474
staller.Setup(ctx)
75-
staller.Slow(ctx, c.CRDBNodes(), provisionedBandwidth)
75+
staller.Slow(ctx, c.CRDBNodes(), provisionedBandwidth /* bytesPerSecond */)
7676

7777
// TODO(aaditya): Extend this test to also limit reads once we have a
7878
// mechanism to pace read traffic in AC.
@@ -133,11 +133,11 @@ func registerDiskBandwidthOverload(r registry.Registry) {
133133
db := c.Conn(ctx, t.L(), len(c.CRDBNodes()))
134134
defer db.Close()
135135

136-
const bandwidthLimit = 75
136+
const bandwidthLimitMbs = 75
137137
if _, err := db.ExecContext(
138138
// We intentionally set this to much lower than the provisioned value
139139
// above to clearly show that the bandwidth limiter works.
140-
ctx, fmt.Sprintf("SET CLUSTER SETTING kvadmission.store.provisioned_bandwidth = '%dMiB'", bandwidthLimit)); err != nil {
140+
ctx, fmt.Sprintf("SET CLUSTER SETTING kvadmission.store.provisioned_bandwidth = '%dMiB'", bandwidthLimitMbs)); err != nil {
141141
t.Fatalf("failed to set kvadmission.store.provisioned_bandwidth: %v", err)
142142
}
143143

@@ -170,7 +170,7 @@ func registerDiskBandwidthOverload(r registry.Registry) {
170170
}
171171

172172
// Allow a 5% room for error.
173-
const bandwidthThreshold = bandwidthLimit * 1.05
173+
const bandwidthThreshold = bandwidthLimitMbs * 1.05
174174
const sampleCountForBW = 12
175175
const collectionIntervalSeconds = 10.0
176176
// Loop for ~20 minutes.

pkg/cmd/roachtest/tests/admission_control_snapshot_overload_io.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,15 @@ func runAdmissionControlSnapshotOverloadIO(
172172

173173
// Now set disk bandwidth limits
174174
if cfg.limitDiskBandwidth {
175-
const bandwidthLimit = 128 << 20 // 128 MiB
176-
t.Status(fmt.Sprintf("limiting disk bandwidth to %d bytes/s", bandwidthLimit))
175+
const bandwidthLimitMbs = 128
176+
t.Status(fmt.Sprintf("limiting disk bandwidth to %d MB/s", bandwidthLimitMbs))
177177
staller := roachtestutil.MakeCgroupDiskStaller(t, c,
178178
false /* readsToo */, false /* logsToo */)
179179
staller.Setup(ctx)
180-
staller.Slow(ctx, c.CRDBNodes(), bandwidthLimit)
180+
staller.Slow(ctx, c.CRDBNodes(), bandwidthLimitMbs<<20 /* bytesPerSecond */)
181181

182182
if _, err := db.ExecContext(
183-
ctx, fmt.Sprintf("SET CLUSTER SETTING kvadmission.store.provisioned_bandwidth = '%dMiB'", bandwidthLimit)); err != nil {
183+
ctx, fmt.Sprintf("SET CLUSTER SETTING kvadmission.store.provisioned_bandwidth = '%dMiB'", bandwidthLimitMbs)); err != nil {
184184
t.Fatalf("failed to set kvadmission.store.provisioned_bandwidth: %v", err)
185185
}
186186
if _, err := db.ExecContext(

0 commit comments

Comments
 (0)