Report error when sample space is too low for key generation

It's important that we report an error when the sample space is too
low for the given k/v size and key count. Previously, we'd end up
entering an infinite wait time (essentially an infinite loop); this
has been fixed.
next
Sayan Nandan 3 years ago
parent 1c16e43d3d
commit 12d90944a3
No known key found for this signature in database
GPG Key ID: 18E77EBDCADD5AD6

@ -4,6 +4,10 @@ All changes in this project will be noted in this file.
## Unreleased
### Fixes
- Fixed infinite wait (loop) when sample space for key generation is not large enough
### Additions
- Added support for system native endian storage (backward compatible)

@ -25,6 +25,7 @@
*/
use crate::report::AggregatedReport;
use crate::util;
use devtimer::DevTime;
use libstress::utils::generate_random_byte_vector;
use libstress::PoolConfig;
@ -52,12 +53,18 @@ pub fn runner(
json_out: bool,
runs: usize,
) {
if util::possible_permutations(per_kv_size) < max_queries {
err!("Too low sample space for given k/v size and query count. Try a higher k/v size.");
}
if !json_out {
println!("Running sanity test ...");
}
if let Err(e) = sanity_test!(host, port) {
err!(format!("Sanity test failed with error: {}", e));
}
if !json_out {
println!("{}", NOTICE_INIT_BENCH);
println!("Connections: {}", max_connections);

@ -62,6 +62,13 @@ macro_rules! err {
std::process::exit(0x01);
}};
}
pub fn possible_permutations(r: usize) -> usize {
let mut ret = 1usize;
for i in (256 - r + 1)..=256 {
ret *= i;
}
ret
}
/// Returns the number of queries/sec
pub fn calc(reqs: usize, time: u128) -> f64 {

Loading…
Cancel
Save