-
Notifications
You must be signed in to change notification settings - Fork 8
Add possibility to stop execution after specific number of errors #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
2a6718e
1ceca26
02ab5e6
054ce8d
bee64e1
0aa86e8
25cede3
dde50c0
a92312a
d39e3f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,7 +42,8 @@ pub(crate) struct ScyllaBenchArgs { | |
pub password: String, | ||
pub mode: Mode, | ||
pub latency_type: LatencyType, | ||
pub max_retries_per_op: u64, | ||
pub max_consecutive_errors_per_op: u64, | ||
pub max_errors_in_total: u64, | ||
pub concurrency: u64, | ||
pub maximum_rate: u64, | ||
|
||
|
@@ -174,9 +175,15 @@ where | |
let max_errors_at_row = flag.u64_var( | ||
"error-at-row-limit", | ||
0, | ||
"the maximum number of attempts allowed for a single operation. \ | ||
"the maximum number of consecutive errors allowed. \ | ||
After exceeding it, the workflow will terminate with an error. \ | ||
Set to 0 if you want to have unlimited retries", | ||
Set to 0 if you want to disable this limit", | ||
); | ||
let max_errors = flag.u64_var( | ||
"error-limit", | ||
0, | ||
"the number of total errors after which the workflow should stop and fail; \ | ||
set it to 0 (the default) to disable this limit", | ||
); | ||
let concurrency = flag.u64_var("concurrency", 16, "number of used tasks"); | ||
let maximum_rate = flag.u64_var( | ||
|
@@ -330,7 +337,10 @@ where | |
// Zero means unlimited tries, | ||
// and #tries == #retries + 1, | ||
// therefore just subtract with wraparound and treat u64::MAX as infinity | ||
let max_retries_per_op = max_errors_at_row.get().wrapping_sub(1); | ||
let max_consecutive_errors_per_op = max_errors_at_row.get().wrapping_sub(1); | ||
Comment on lines
337
to
+340
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this I think that the maximum number of consecutive errors should be equal to the value of Another comment says: /// The maximum number of consecutive errors allowed before giving up.
pub max_consecutive_errors_per_op: u64, So AFAIU, the definition of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand what the comment about retries is trying to say, previously it made some sense, as the variable used to specifiy the number of retries, but now it would be good to update it so that it explains the new variable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test With There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree with the above comments. From what I understood, the I think we should either change it to Err(err) if self.consecutive_errors >= self.context.max_consecutive_errors_per_op => {
Err(err)
} There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be also nice to add tests for edge cases such as
, but this should fail:
As of now, I believe that the first scenario wouldn't pass since we use |
||
|
||
// Similar to above | ||
let max_errors_in_total = max_errors.get().wrapping_sub(1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to make sure i understand correctly - this option (unlike If so, then this |
||
|
||
let hdr_latency_resolution = match hdr_latency_units.get().as_str() { | ||
"ns" => 1, | ||
|
@@ -376,7 +386,8 @@ where | |
mode, | ||
concurrency, | ||
latency_type, | ||
max_retries_per_op, | ||
max_consecutive_errors_per_op, | ||
max_errors_in_total, | ||
maximum_rate, | ||
test_duration: test_duration.get(), | ||
partition_count, | ||
|
@@ -418,6 +429,22 @@ impl ScyllaBenchArgs { | |
println!("Mode:\t\t\t {}", show_mode(&self.mode)); | ||
println!("Workload:\t\t {}", show_workload(&self.workload)); | ||
println!("Timeout:\t\t {}", format_duration(self.timeout)); | ||
if self.max_consecutive_errors_per_op == u64::MAX { | ||
println!("Max error number at row: unlimited"); | ||
} else { | ||
println!( | ||
"Max error number at row: {}", | ||
self.max_consecutive_errors_per_op as u128 + 1, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, there's no |
||
); | ||
} | ||
if self.max_errors_in_total == u64::MAX { | ||
println!("Max error number:\t unlimited"); | ||
} else { | ||
println!( | ||
"Max error number:\t {}", | ||
self.max_errors_in_total as u128 + 1, | ||
); | ||
} | ||
println!( | ||
"Consistency level:\t {}", | ||
show_consistency_level(&self.consistency_level) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -252,7 +252,12 @@ impl StatsPrinter { | |
Ok(()) | ||
} | ||
|
||
pub fn print_final(&self, stats: &Stats, out: &mut impl Write) -> Result<()> { | ||
pub fn print_final( | ||
&self, | ||
stats: &Stats, | ||
errors: &[anyhow::Error], | ||
out: &mut impl Write, | ||
) -> Result<()> { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe it would be good to limit the maximum number of errors that are be printed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There will be at most as many error as the Besides, this is what scylla-bench does, and I'm striving for compatibility - maybe not with regards to exact error strings, but formatting at least... |
||
let time = Instant::now() - self.start_time; | ||
writeln!(out)?; | ||
writeln!(out, "Results:")?; | ||
|
@@ -274,7 +279,16 @@ impl StatsPrinter { | |
self.print_final_latency_histogram("c-o fixed latency", &ls.co_fixed, out)?; | ||
} | ||
|
||
// TODO: "critical errors" | ||
if !errors.is_empty() { | ||
writeln!( | ||
out, | ||
"\nFollowing critical errors were caught during the run:" | ||
)?; | ||
for err in errors { | ||
// The {:#} syntax makes sure that the error is printed in one line | ||
writeln!(out, " {:#}", err)?; | ||
Comment on lines
+287
to
+289
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is formatting using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ahyhow's documentation suggests using |
||
} | ||
} | ||
|
||
Ok(()) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name is a bit confusing, I think it could just be
max_consecutive_errors_per_op
, no?.