Merge 'sim: add feature flags (indexes,mvcc) to CLI args' from Jussi Saurio

Closes #1979
This commit is contained in:
Pekka Enberg 2025-07-07 10:58:21 +03:00
commit afa0052921
3 changed files with 21 additions and 2 deletions

View file

@ -650,7 +650,12 @@ fn reopen_database(env: &mut SimulatorEnv) {
// 2. Re-open database
let db_path = env.db_path.clone();
let db = match turso_core::Database::open_file(env.io.clone(), &db_path, false, false) {
let db = match turso_core::Database::open_file(
env.io.clone(),
&db_path,
env.opts.experimental_mvcc,
env.opts.experimental_indexes,
) {
Ok(db) => db,
Err(e) => {
panic!("error opening simulator test file {:?}: {:?}", db_path, e);

View file

@ -94,6 +94,10 @@ pub struct SimulatorCLI {
default_value_t = 0
)]
pub latency_probability: usize,
#[clap(long, help = "Enable experimental MVCC feature")]
pub experimental_mvcc: bool,
#[clap(long, help = "Enable experimental indexing feature")]
pub experimental_indexes: bool,
}
#[derive(Parser, Debug, Clone, Serialize, Deserialize, PartialEq, PartialOrd, Eq, Ord)]

View file

@ -123,6 +123,8 @@ impl SimulatorEnv {
max_interactions: rng.gen_range(cli_opts.minimum_tests..=cli_opts.maximum_tests),
max_time_simulation: cli_opts.maximum_time,
disable_reopen_database: cli_opts.disable_reopen_database,
experimental_mvcc: cli_opts.experimental_mvcc,
experimental_indexes: cli_opts.experimental_indexes,
};
let io =
@ -138,7 +140,12 @@ impl SimulatorEnv {
std::fs::remove_file(wal_path).unwrap();
}
let db = match Database::open_file(io.clone(), db_path.to_str().unwrap(), false, false) {
let db = match Database::open_file(
io.clone(),
db_path.to_str().unwrap(),
opts.experimental_mvcc,
opts.experimental_indexes,
) {
Ok(db) => db,
Err(e) => {
panic!("error opening simulator test file {:?}: {:?}", db_path, e);
@ -241,4 +248,7 @@ pub(crate) struct SimulatorOpts {
pub(crate) max_interactions: usize,
pub(crate) page_size: usize,
pub(crate) max_time_simulation: usize,
pub(crate) experimental_mvcc: bool,
pub(crate) experimental_indexes: bool,
}