Skip to content

Commit b1a6f42

Browse files
authored
Revert "Re-open DuckDB context between iterations" (#4355)
Reverts #4346 Seems to be causing segfault on TPC-H NVMe Signed-off-by: Will Manning <[email protected]>
1 parent 8b00bc7 commit b1a6f42

File tree

2 files changed

+3
-31
lines changed

2 files changed

+3
-31
lines changed

bench-vortex/src/benchmark_driver.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,6 @@ fn execute_queries<B: Benchmark>(
188188
let mut row_count = None;
189189

190190
for _ in 0..iterations {
191-
// Ensure we reopen the database to clear caches between runs.
192-
ctx.reopen()?;
193-
194191
let (duration, current_row_count) =
195192
ctx.execute_query(query_string).unwrap_or_else(|err| {
196193
vortex_panic!("query: {query_idx} failed with: {err}")

bench-vortex/src/engines/ddb/mod.rs

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// SPDX-FileCopyrightText: Copyright the Vortex contributors
33

4-
use std::path::PathBuf;
54
use std::time::{Duration, Instant};
65

76
use anyhow::Result;
@@ -31,7 +30,6 @@ impl DuckDBObject {
3130
pub struct DuckDBCtx {
3231
pub db: Database,
3332
pub connection: Connection,
34-
pub db_path: Option<PathBuf>,
3533
}
3634

3735
impl DuckDBCtx {
@@ -53,40 +51,17 @@ impl DuckDBCtx {
5351
if delete_database {
5452
std::fs::remove_file(&db_path)?;
5553
}
56-
let db = Database::open(&db_path)?;
54+
let db = Database::open(db_path)?;
5755
let connection = db.connect()?;
5856
vortex_duckdb::register_table_functions(&connection)?;
59-
60-
Ok(Self {
61-
db,
62-
connection,
63-
db_path: Some(db_path),
64-
})
65-
}
66-
67-
pub fn reopen(&mut self) -> Result<()> {
68-
let mut db = match &self.db_path {
69-
Some(path) => Database::open(path),
70-
None => Database::open_in_memory(),
71-
}?;
72-
let mut connection = db.connect()?;
73-
vortex_duckdb::register_table_functions(&connection)?;
74-
75-
std::mem::swap(&mut self.connection, &mut connection);
76-
std::mem::swap(&mut self.db, &mut db);
77-
78-
Ok(())
57+
Ok(Self { db, connection })
7958
}
8059

8160
pub fn new_in_memory() -> Result<Self> {
8261
let db = Database::open_in_memory()?;
8362
let connection = db.connect()?;
8463
vortex_duckdb::register_table_functions(&connection)?;
85-
Ok(Self {
86-
db,
87-
connection,
88-
db_path: None,
89-
})
64+
Ok(Self { db, connection })
9065
}
9166

9267
/// Execute DuckDB queries for benchmarks using the internal connection

0 commit comments

Comments
 (0)