Skip to content

Commit

Permalink
Fix linearizability test
Browse files Browse the repository at this point in the history
  • Loading branch information
jkosh44 committed Aug 3, 2022
1 parent 9d4bc48 commit 14a26c1
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/environmentd/tests/sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1353,10 +1353,6 @@ fn test_linearizability() -> Result<(), Box<dyn Error>> {
.runtime
.block_on(pg_client.execute(&format!("INSERT INTO {view_name} VALUES (42);"), &[]))?;

// Create user table in Materialize.
mz_client.batch_execute(&"DROP TABLE IF EXISTS t;")?;
mz_client.batch_execute(&"CREATE TABLE t (a INT);")?;

wait_for_view_population(&mut mz_client, view_name, 1, Arc::clone(&now))?;

// The user table's write frontier will be close to zero because we use a deterministic
Expand All @@ -1370,6 +1366,9 @@ fn test_linearizability() -> Result<(), Box<dyn Error>> {

mz_client.batch_execute(&"SET transaction_isolation = serializable")?;
let view_ts = get_explain_timestamp(view_name, &mut mz_client);
// Create user table in Materialize.
mz_client.batch_execute(&"DROP TABLE IF EXISTS t;")?;
mz_client.batch_execute(&"CREATE TABLE t (a INT);")?;
let join_ts = get_explain_timestamp(&format!("{view_name}, t"), &mut mz_client);
// In serializable transaction isolation, read timestamps can go backwards.
assert!(join_ts < view_ts);
Expand All @@ -1381,12 +1380,6 @@ fn test_linearizability() -> Result<(), Box<dyn Error>> {
// equal timestamp in strict serializable mode.
assert!(join_ts >= view_ts);

mz_client.batch_execute(&"SET transaction_isolation = serializable")?;
let view_ts = get_explain_timestamp(view_name, &mut mz_client);
let join_ts = get_explain_timestamp(&format!("{view_name}, t"), &mut mz_client);
// If we go back to serializable, then timestamps can revert again.
assert!(join_ts < view_ts);

cleanup_fn(&mut mz_client, &mut pg_client, &server.runtime)?;

Ok(())
Expand Down

0 comments on commit 14a26c1

Please sign in to comment.