stress: Don't die if database is locked during integrity check

This commit is contained in:
Pekka Enberg
2025-09-04 18:37:26 +03:00
parent efc105d99e
commit adb538e61a

View File

@@ -559,13 +559,19 @@ async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
const INTEGRITY_CHECK_INTERVAL: usize = 100;
if query_index % INTEGRITY_CHECK_INTERVAL == 0 {
let mut res = conn.query("PRAGMA integrity_check", ()).await.unwrap();
if let Some(row) = res.next().await? {
let value = row.get_value(0).unwrap();
if value != "ok".into() {
panic!("integrity check failed: {:?}", value);
match res.next().await {
Ok(Some(row)) => {
let value = row.get_value(0).unwrap();
if value != "ok".into() {
panic!("integrity check failed: {:?}", value);
}
}
Ok(None) => {
panic!("integrity check failed: no rows");
}
Err(e) => {
println!("Error performing integrity check: {e}");
}
} else {
panic!("integrity check failed: no rows");
}
}
}