Skip to content

Commit 962109b

Browse files
committed
s-b: add the error-limit flag
Implements the "error-limit" flag which was recently added in scylladb/scylla-bench#110. The flag allows to limit the total number of errors allowed before a run is stopped. Support for that flag is implemented via the `max_retries_in_total` parameter added in the previous commit.
1 parent 3152452 commit 962109b

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/bin/cql-stress-scylla-bench/args.rs

+11
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ pub(crate) struct ScyllaBenchArgs {
4343
pub mode: Mode,
4444
pub latency_type: LatencyType,
4545
pub max_retries_per_op: u64,
46+
pub max_retries_in_total: u64,
4647
pub concurrency: u64,
4748
pub maximum_rate: u64,
4849

@@ -178,6 +179,12 @@ where
178179
After exceeding it, the workflow will terminate with an error. \
179180
Set to 0 if you want to have unlimited retries",
180181
);
182+
let max_errors = flag.u64_var(
183+
"error-limit",
184+
0,
185+
"the number of total errors after which the workflow should stop and fail; \
186+
set it to 0 (the default) to disable this limit",
187+
);
181188
let concurrency = flag.u64_var("concurrency", 16, "number of used tasks");
182189
let maximum_rate = flag.u64_var(
183190
"max-rate",
@@ -332,6 +339,9 @@ where
332339
// therefore just subtract with wraparound and treat u64::MAX as infinity
333340
let max_retries_per_op = max_errors_at_row.get().wrapping_sub(1);
334341

342+
// Similar to above
343+
let max_retries_in_total = max_errors.get().wrapping_sub(1);
344+
335345
let hdr_latency_resolution = match hdr_latency_units.get().as_str() {
336346
"ns" => 1,
337347
"us" => 1000,
@@ -377,6 +387,7 @@ where
377387
concurrency,
378388
latency_type,
379389
max_retries_per_op,
390+
max_retries_in_total,
380391
maximum_rate,
381392
test_duration: test_duration.get(),
382393
partition_count,

src/bin/cql-stress-scylla-bench/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ async fn prepare(args: Arc<ScyllaBenchArgs>, stats: Arc<ShardedStats>) -> Result
146146
rate_limit_per_second,
147147
operation_factory,
148148
max_retries_per_op: args.max_retries_per_op as usize,
149-
max_retries_in_total: usize::MAX,
149+
max_retries_in_total: args.max_retries_in_total as usize,
150150
})
151151
}
152152

0 commit comments

Comments
 (0)