Skip to content

Commit

Permalink
move to normal records
Browse files Browse the repository at this point in the history
Signed-off-by: Bugen Zhao <[email protected]>
  • Loading branch information
BugenZhao committed Nov 4, 2024
1 parent 109129a commit 2619ddf
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 32 deletions.
1 change: 0 additions & 1 deletion src/tests/simulation/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ async fn main() {
} else {
vec!["SET STREAMING_USE_ARRANGEMENT_BACKFILL = false;".to_string()].into()
},
..Default::default()
};
let kill_opts = KillOpts {
kill_meta: false,
Expand Down
66 changes: 35 additions & 31 deletions src/tests/simulation/src/slt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,43 @@ pub async fn run_slt_task(
break;
}

let cmd = match &record {
sqllogictest::Record::Statement { sql, .. }
| sqllogictest::Record::Query { sql, .. } => extract_sql_command(sql),
_ => SqlCmd::Others,
};

// For normal records.
if !kill {
if let Record::Statement {
loc,
conditions,
connection,
..
} = &record
&& cmd.is_create()
&& can_use_random_vnode_count
{
let sql = format!(
"SET STREAMING_MAX_PARALLELISM = {};",
((1..=64)
.chain(224..=288)
.chain(992..=1056)
.chain(std::iter::once(32768)))
.choose(&mut thread_rng())
.unwrap()
);
println!("setting vnode count: {sql}");
let set_random_vnode_count = Record::Statement {
loc: loc.clone(),
conditions: conditions.clone(),
connection: connection.clone(),
sql,
expected: StatementExpect::Ok,
};
tester.run_async(set_random_vnode_count).await.unwrap();
}

match tester
.run_async(record.clone())
.timed(|_res, elapsed| {
Expand All @@ -275,11 +310,6 @@ pub async fn run_slt_task(
}

// For kill enabled.
let cmd = match &record {
sqllogictest::Record::Statement { sql, .. }
| sqllogictest::Record::Query { sql, .. } => extract_sql_command(sql),
_ => SqlCmd::Others,
};
tracing::debug!(?cmd, "Running");

if background_ddl_rate > 0.0
Expand Down Expand Up @@ -315,32 +345,6 @@ pub async fn run_slt_task(
background_ddl_enabled = background_ddl_setting;
};

if let Record::Statement {
loc,
conditions,
connection,
..
} = &record
&& cmd.is_create()
&& can_use_random_vnode_count
{
let sql = format!(
"SET STREAMING_MAX_PARALLELISM = {};",
((1..=64).chain(224..=288).chain(992..=1056))
.choose(&mut thread_rng())
.unwrap()
);
println!("setting vnode count: {sql}");
let set_random_vnode_count = Record::Statement {
loc: loc.clone(),
conditions: conditions.clone(),
connection: connection.clone(),
sql,
expected: StatementExpect::Ok,
};
tester.run_async(set_random_vnode_count).await.unwrap();
}

if !cmd.allow_kill() {
for i in 0usize.. {
let delay = Duration::from_secs(1 << i);
Expand Down

0 comments on commit 2619ddf

Please sign in to comment.