Skip to content

Commit

Permalink
Merge 'fix empty range error when 0 interactions are produced by crea…
Browse files Browse the repository at this point in the history
…ting at least 1 interaction' from Alperen Keleş

Fixes the panicking case in
#548

Closes #549
  • Loading branch information
penberg committed Dec 25, 2024
2 parents 37e1f35 + e49ba4f commit 548f66e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions simulator/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,20 @@ fn run_simulation(
(read_percent, write_percent, delete_percent)
};

if cli_opts.maximum_size < 1 {
panic!("maximum size must be at least 1");
}

let opts = SimulatorOpts {
ticks: rng.gen_range(0..cli_opts.maximum_size),
ticks: rng.gen_range(1..=cli_opts.maximum_size),
max_connections: 1, // TODO: for now let's use one connection as we didn't implement
// correct transactions procesing
max_tables: rng.gen_range(0..128),
read_percent,
write_percent,
delete_percent,
page_size: 4096, // TODO: randomize this too
max_interactions: rng.gen_range(0..cli_opts.maximum_size),
max_interactions: rng.gen_range(1..=cli_opts.maximum_size),
};
let io = Arc::new(SimulatorIO::new(seed, opts.page_size).unwrap());

Expand Down

0 comments on commit 548f66e

Please sign in to comment.