-
Notifications
You must be signed in to change notification settings - Fork 523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(scale): introduce deterministic scaling tests #5657
Changes from 19 commits
2fa5c9c
ffd39db
d3b75ff
d30b66c
08e61b1
53d222f
9183918
99cd61a
6743964
b7861bc
8e89c8c
d887c4e
62703bb
821012c
f68b67b
9baad0e
c1d8bba
aa96954
f88edfa
c2ab7ba
4d1ee73
21df22d
b68306b
e275e05
1870972
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -495,11 +495,26 @@ cargo nextest run \ | |
"$@" | ||
""" | ||
|
||
[tasks.sarchive-scale-test] | ||
category = "RiseDev - Archive simulation scaling tests" | ||
description = "Archive integration scaling tests in deterministic simulation mode" | ||
dependencies = ["warn-on-missing-tools"] | ||
env = { RUSTFLAGS = "-Ctarget-cpu=native --cfg tokio_unstable --cfg madsim", RUSTDOCFLAGS = "--cfg madsim", CARGO_TARGET_DIR = "target/sim" } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can't decide how to enable SIMD this way through environments. Thus, the results of JSON parsing might be different due to precision errors like #5487. 🥵 |
||
script = """ | ||
#!/bin/bash | ||
set -e | ||
|
||
cargo nextest archive \ | ||
-p risingwave_simulation_scale \ | ||
--archive-file scale-test.tar.zst \ | ||
"$@" | ||
""" | ||
|
||
[tasks.sslt] | ||
category = "RiseDev - Deterministic Simulation End-to-end Test" | ||
description = "Run e2e tests in deterministic simulation mode" | ||
dependencies = ["warn-on-missing-tools"] | ||
env = { RUSTFLAGS = "--cfg tokio_unstable --cfg madsim", RUSTDOCFLAGS = "--cfg madsim", CARGO_TARGET_DIR = "target/sim" } | ||
env = { RUSTFLAGS = "-Ctarget-cpu=native --cfg tokio_unstable --cfg madsim", RUSTDOCFLAGS = "--cfg madsim", CARGO_TARGET_DIR = "target/sim" } | ||
script = """ | ||
#!/bin/bash | ||
set -e | ||
|
@@ -511,7 +526,7 @@ cargo run -p risingwave_simulation "$@" | |
category = "RiseDev - Deterministic Simulation End-to-end Test" | ||
description = "Run e2e tests in deterministic simulation mode and report code coverage" | ||
dependencies = ["warn-on-missing-tools"] | ||
env = { RUSTFLAGS = "--cfg tokio_unstable --cfg madsim", RUSTDOCFLAGS = "--cfg madsim", CARGO_TARGET_DIR = "target/sim-cov" } | ||
env = { RUSTFLAGS = "-Ctarget-cpu=native --cfg tokio_unstable --cfg madsim", RUSTDOCFLAGS = "--cfg madsim", CARGO_TARGET_DIR = "target/sim-cov" } | ||
script = """ | ||
#!/bin/bash | ||
set -e | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
|
||
# Exits as soon as any line fails. | ||
set -euo pipefail | ||
|
||
source ci/scripts/common.env.sh | ||
|
||
echo "--- Download artifacts" | ||
buildkite-agent artifact download scale-test.tar.zst . | ||
|
||
echo "--- Run scaling tests in deterministic simulation mode" | ||
MADSIM_TEST_NUM=5 cargo nextest run --archive-file scale-test.tar.zst --no-fail-fast |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
|
||
use std::time::{Duration, SystemTime, UNIX_EPOCH}; | ||
|
||
use futures::future::pending; | ||
use futures_async_stream::try_stream; | ||
use risingwave_common::bail; | ||
|
||
|
@@ -46,7 +47,6 @@ impl NexmarkEventGenerator { | |
let mut last_event = None; | ||
loop { | ||
let mut msgs: Vec<SourceMessage> = vec![]; | ||
let mut num_event = 0; | ||
let old_events_so_far = self.events_so_far; | ||
|
||
// Get unix timestamp in milliseconds | ||
|
@@ -60,15 +60,17 @@ impl NexmarkEventGenerator { | |
}; | ||
|
||
if let Some(event) = last_event.take() { | ||
num_event += 1; | ||
msgs.push( | ||
NexmarkMessage::new(self.split_id.clone(), self.events_so_far as u64, event) | ||
.into(), | ||
); | ||
} | ||
|
||
while num_event < self.max_chunk_size { | ||
let mut finished = false; | ||
|
||
while (msgs.len() as u64) < self.max_chunk_size { | ||
if self.event_num > 0 && self.events_so_far >= self.event_num as u64 { | ||
finished = true; | ||
break; | ||
} | ||
|
||
|
@@ -99,13 +101,17 @@ impl NexmarkEventGenerator { | |
break; | ||
} | ||
|
||
num_event += 1; | ||
msgs.push( | ||
NexmarkMessage::new(self.split_id.clone(), self.events_so_far as u64, event) | ||
.into(), | ||
); | ||
} | ||
yield msgs; | ||
|
||
if finished && msgs.is_empty() { | ||
break; | ||
} else { | ||
yield msgs; | ||
} | ||
|
||
if !self.use_real_time && self.min_event_gap_in_ns > 0 { | ||
tokio::time::sleep(Duration::from_nanos( | ||
|
@@ -114,5 +120,10 @@ impl NexmarkEventGenerator { | |
.await; | ||
} | ||
} | ||
|
||
// The connector assumes that the stream will never end, so if the `event_num` is hit, we | ||
// pend the stream forever. | ||
// TODO: should we allow the stream to finish? | ||
let () = pending().await; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the stream generator themselves should always end the stream gracefully, as long as they are not infinite streams. Even for those down-streams, they should end themselves as well when the upstream is closed. This way the errors can be propagated to the sink. The system won't be blocking implicitly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We've discussed this issue and decided not to use the For the stream reader, I find that the refactor just merged has removed the assumption (as we're all-in async stream), so maybe the workaround can be removed. Note that there's a |
||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
[package] | ||
name = "risingwave_simulation_scale" | ||
version = "0.1.0" | ||
edition = "2021" | ||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
anyhow = "1.0" | ||
async-trait = "0.1" | ||
clap = "3" | ||
futures = { version = "0.3", default-features = false, features = ["alloc"] } | ||
glob = "0.3" | ||
itertools = "0.10" | ||
madsim = "0.2.7" | ||
rand = "0.8" | ||
risingwave_compactor = { path = "../../storage/compactor" } | ||
risingwave_compute = { path = "../../compute" } | ||
risingwave_ctl = { path = "../../ctl" } | ||
risingwave_frontend = { path = "../../frontend" } | ||
risingwave_meta = { path = "../../meta" } | ||
risingwave_pb = { path = "../../prost" } | ||
sqllogictest = "0.6.4" | ||
tempfile = "3" | ||
tokio = { version = "0.2", package = "madsim-tokio" } | ||
tokio-postgres = "0.7.7" | ||
tracing = "0.1" | ||
|
||
[target.'cfg(not(madsim))'.dependencies] | ||
workspace-hack = { version = "0.1", path = "../../workspace-hack" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer merging it into the existing simulation crate, maybe in a future PR.