Skip to content

Commit

Permalink
simplify background_ddl test
Browse files Browse the repository at this point in the history
  • Loading branch information
kwannoel committed Nov 2, 2023
1 parent e12dcd9 commit a225173
Showing 1 changed file with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,38 +97,30 @@ async fn test_background_mv_barrier_recovery() -> Result<()> {
session.run(CREATE_TABLE).await?;
session.run(SEED_TABLE).await?;
session.flush().await?;
session.run(SET_RATE_LIMIT_1).await?;
session.run(SET_RATE_LIMIT_2).await?;
session.run(SET_BACKGROUND_DDL).await?;
create_mv(&mut session).await?;

// If the CN is killed before first barrier pass for the MV, the MV will be dropped.
// This is because it's table fragments will NOT be committed until first barrier pass.
kill_cn_and_wait_recover(&cluster).await;
kill_and_wait_recover(&cluster).await;

// Send some upstream updates.
session.run(SEED_TABLE).await?;
session.run(SEED_TABLE).await?;
session.flush().await?;

kill_and_wait_recover(&cluster).await;
kill_cn_and_wait_recover(&cluster).await;

// Send some upstream updates.
session.run(SEED_TABLE).await?;
session.run(SEED_TABLE).await?;
session.flush().await?;

kill_cn_and_wait_recover(&cluster).await;
kill_and_wait_recover(&cluster).await;

// Now just wait for it to complete.
session.run(WAIT).await?;

session
let t_count = session.run("SELECT COUNT(v1) FROM t").await?;

let mv1_count = session
.run("SELECT COUNT(v1) FROM mv1")
.await?
.assert_result_eq("3500");
.await?;

assert_eq!(t_count, mv1_count);

// Make sure that if MV killed and restarted
// it will not be dropped.
Expand Down

0 comments on commit a225173

Please sign in to comment.