mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-18 06:24:56 +01:00
remove mvvmode and set logical log as default
This commit is contained in:
@@ -23,22 +23,10 @@ pub struct ConnectArgs {
|
||||
pub async fn connect(args: ConnectArgs) -> RustConnection {
|
||||
let database = if args.url == ":memory:" {
|
||||
let io: Arc<dyn turso_core::IO> = Arc::new(turso_core::MemoryIO::new());
|
||||
turso_core::Database::open_file(
|
||||
io,
|
||||
args.url.as_str(),
|
||||
false,
|
||||
true,
|
||||
turso_core::MvccMode::Noop,
|
||||
)
|
||||
turso_core::Database::open_file(io, args.url.as_str(), false, true)
|
||||
} else {
|
||||
let io: Arc<dyn turso_core::IO> = Arc::new(turso_core::PlatformIO::new().unwrap());
|
||||
turso_core::Database::open_file(
|
||||
io,
|
||||
args.url.as_str(),
|
||||
false,
|
||||
true,
|
||||
turso_core::MvccMode::Noop,
|
||||
)
|
||||
turso_core::Database::open_file(io, args.url.as_str(), false, true)
|
||||
}
|
||||
.unwrap();
|
||||
let connection = database.connect().unwrap();
|
||||
|
||||
@@ -68,7 +68,7 @@ pub extern "system" fn Java_tech_turso_core_TursoDB_openUtf8<'local>(
|
||||
}
|
||||
};
|
||||
|
||||
let db = match Database::open_file(io.clone(), &path, false, true, turso_core::MvccMode::Noop) {
|
||||
let db = match Database::open_file(io.clone(), &path, false, true) {
|
||||
Ok(db) => db,
|
||||
Err(e) => {
|
||||
set_err_msg_and_throw_exception(&mut env, obj, TURSO_ETC, e.to_string());
|
||||
|
||||
@@ -40,7 +40,6 @@ pub mod value;
|
||||
use transaction::TransactionBehavior;
|
||||
#[cfg(feature = "conn_raw_api")]
|
||||
use turso_core::types::WalFrameInfo;
|
||||
pub use turso_core::MvccMode;
|
||||
pub use value::Value;
|
||||
|
||||
pub use params::params_from_iter;
|
||||
@@ -83,7 +82,6 @@ pub type Result<T> = std::result::Result<T, Error>;
|
||||
pub struct Builder {
|
||||
path: String,
|
||||
enable_mvcc: bool,
|
||||
mvcc_mode: MvccMode,
|
||||
vfs: Option<String>,
|
||||
}
|
||||
|
||||
@@ -93,14 +91,12 @@ impl Builder {
|
||||
Self {
|
||||
path: path.to_string(),
|
||||
enable_mvcc: false,
|
||||
mvcc_mode: MvccMode::Noop,
|
||||
vfs: None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_mvcc(mut self, mvcc_enabled: bool, mvcc_mode: MvccMode) -> Self {
|
||||
pub fn with_mvcc(mut self, mvcc_enabled: bool) -> Self {
|
||||
self.enable_mvcc = mvcc_enabled;
|
||||
self.mvcc_mode = mvcc_mode;
|
||||
self
|
||||
}
|
||||
|
||||
@@ -113,13 +109,7 @@ impl Builder {
|
||||
#[allow(unused_variables, clippy::arc_with_non_send_sync)]
|
||||
pub async fn build(self) -> Result<Database> {
|
||||
let io = self.get_io()?;
|
||||
let db = turso_core::Database::open_file(
|
||||
io,
|
||||
self.path.as_str(),
|
||||
self.enable_mvcc,
|
||||
true,
|
||||
self.mvcc_mode,
|
||||
)?;
|
||||
let db = turso_core::Database::open_file(io, self.path.as_str(), self.enable_mvcc, true)?;
|
||||
Ok(Database { inner: db })
|
||||
}
|
||||
|
||||
|
||||
15
cli/app.rs
15
cli/app.rs
@@ -182,11 +182,6 @@ impl Limbo {
|
||||
flags,
|
||||
turso_core::DatabaseOpts::new()
|
||||
.with_mvcc(opts.experimental_mvcc)
|
||||
.with_mvcc_mode(if opts.experimental_logical_log {
|
||||
turso_core::MvccMode::LogicalLog
|
||||
} else {
|
||||
turso_core::MvccMode::Noop
|
||||
})
|
||||
.with_indexes(indexes_enabled)
|
||||
.with_views(opts.experimental_views)
|
||||
.with_strict(opts.experimental_strict),
|
||||
@@ -382,7 +377,7 @@ impl Limbo {
|
||||
};
|
||||
(
|
||||
io.clone(),
|
||||
Database::open_file(io.clone(), path, false, false, turso_core::MvccMode::Noop)?,
|
||||
Database::open_file(io.clone(), path, false, false)?,
|
||||
)
|
||||
};
|
||||
self.io = io;
|
||||
@@ -1663,13 +1658,7 @@ impl Limbo {
|
||||
anyhow::bail!("Refusing to overwrite existing file: {output_file}");
|
||||
}
|
||||
let io: Arc<dyn turso_core::IO> = Arc::new(turso_core::PlatformIO::new()?);
|
||||
let db = Database::open_file(
|
||||
io.clone(),
|
||||
output_file,
|
||||
false,
|
||||
true,
|
||||
turso_core::MvccMode::Noop,
|
||||
)?;
|
||||
let db = Database::open_file(io.clone(), output_file, false, true)?;
|
||||
let target = db.connect()?;
|
||||
|
||||
let mut applier = ApplyWriter::new(&target);
|
||||
|
||||
@@ -2,7 +2,7 @@ use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criteri
|
||||
use pprof::criterion::{Output, PProfProfiler};
|
||||
use regex::Regex;
|
||||
use std::{sync::Arc, time::Instant};
|
||||
use turso_core::{Database, LimboError, MvccMode, PlatformIO, StepResult};
|
||||
use turso_core::{Database, LimboError, PlatformIO, StepResult};
|
||||
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
#[global_allocator]
|
||||
@@ -29,7 +29,6 @@ fn bench_open(criterion: &mut Criterion) {
|
||||
"../testing/schema_5k.db",
|
||||
false,
|
||||
false,
|
||||
MvccMode::Noop,
|
||||
)
|
||||
.unwrap();
|
||||
let conn = db.connect().unwrap();
|
||||
@@ -52,7 +51,6 @@ fn bench_open(criterion: &mut Criterion) {
|
||||
"../testing/schema_5k.db",
|
||||
false,
|
||||
false,
|
||||
MvccMode::Noop,
|
||||
)
|
||||
.unwrap();
|
||||
let conn = db.connect().unwrap();
|
||||
@@ -85,7 +83,6 @@ fn bench_alter(criterion: &mut Criterion) {
|
||||
"../testing/schema_5k.db",
|
||||
false,
|
||||
false,
|
||||
MvccMode::Noop,
|
||||
)
|
||||
.unwrap();
|
||||
let conn = db.connect().unwrap();
|
||||
@@ -107,7 +104,6 @@ fn bench_alter(criterion: &mut Criterion) {
|
||||
"../testing/schema_5k.db",
|
||||
false,
|
||||
false,
|
||||
MvccMode::Noop,
|
||||
)
|
||||
.unwrap();
|
||||
let conn = db.connect().unwrap();
|
||||
@@ -159,7 +155,6 @@ fn bench_alter(criterion: &mut Criterion) {
|
||||
"../testing/schema_5k.db",
|
||||
false,
|
||||
false,
|
||||
MvccMode::Noop,
|
||||
)
|
||||
.unwrap();
|
||||
let conn = db.connect().unwrap();
|
||||
@@ -212,7 +207,6 @@ fn bench_alter(criterion: &mut Criterion) {
|
||||
"../testing/schema_5k.db",
|
||||
false,
|
||||
false,
|
||||
MvccMode::Noop,
|
||||
)
|
||||
.unwrap();
|
||||
let conn = db.connect().unwrap();
|
||||
@@ -264,7 +258,6 @@ fn bench_alter(criterion: &mut Criterion) {
|
||||
"../testing/schema_5k.db",
|
||||
false,
|
||||
false,
|
||||
MvccMode::Noop,
|
||||
)
|
||||
.unwrap();
|
||||
let conn = db.connect().unwrap();
|
||||
@@ -319,7 +312,6 @@ fn bench_prepare_query(criterion: &mut Criterion) {
|
||||
"../testing/testing.db",
|
||||
false,
|
||||
false,
|
||||
MvccMode::Noop,
|
||||
)
|
||||
.unwrap();
|
||||
let limbo_conn = db.connect().unwrap();
|
||||
@@ -405,7 +397,6 @@ fn bench_execute_select_rows(criterion: &mut Criterion) {
|
||||
"../testing/testing.db",
|
||||
false,
|
||||
false,
|
||||
MvccMode::Noop,
|
||||
)
|
||||
.unwrap();
|
||||
let limbo_conn = db.connect().unwrap();
|
||||
@@ -480,7 +471,6 @@ fn bench_execute_select_1(criterion: &mut Criterion) {
|
||||
"../testing/testing.db",
|
||||
false,
|
||||
false,
|
||||
MvccMode::Noop,
|
||||
)
|
||||
.unwrap();
|
||||
let limbo_conn = db.connect().unwrap();
|
||||
@@ -539,7 +529,6 @@ fn bench_execute_select_count(criterion: &mut Criterion) {
|
||||
"../testing/testing.db",
|
||||
false,
|
||||
false,
|
||||
MvccMode::Noop,
|
||||
)
|
||||
.unwrap();
|
||||
let limbo_conn = db.connect().unwrap();
|
||||
@@ -604,7 +593,6 @@ fn bench_insert_rows(criterion: &mut Criterion) {
|
||||
db_path.to_str().unwrap(),
|
||||
false,
|
||||
false,
|
||||
MvccMode::Noop,
|
||||
)
|
||||
.unwrap();
|
||||
let limbo_conn = db.connect().unwrap();
|
||||
@@ -735,7 +723,6 @@ fn bench_limbo(
|
||||
path.to_str().unwrap(),
|
||||
mvcc,
|
||||
false,
|
||||
MvccMode::Noop,
|
||||
)
|
||||
.unwrap();
|
||||
let mut connecitons = Vec::new();
|
||||
@@ -825,7 +812,6 @@ fn bench_limbo_mvcc(
|
||||
path.to_str().unwrap(),
|
||||
mvcc,
|
||||
false,
|
||||
MvccMode::Noop,
|
||||
)
|
||||
.unwrap();
|
||||
let mut connecitons = Vec::new();
|
||||
|
||||
@@ -4,7 +4,7 @@ use pprof::{
|
||||
flamegraph::Options,
|
||||
};
|
||||
use std::sync::Arc;
|
||||
use turso_core::{Database, MvccMode, PlatformIO};
|
||||
use turso_core::{Database, PlatformIO};
|
||||
|
||||
// Title: JSONB Function Benchmarking
|
||||
|
||||
@@ -22,14 +22,7 @@ fn bench(criterion: &mut Criterion) {
|
||||
|
||||
#[allow(clippy::arc_with_non_send_sync)]
|
||||
let io = Arc::new(PlatformIO::new().unwrap());
|
||||
let db = Database::open_file(
|
||||
io.clone(),
|
||||
"../testing/testing.db",
|
||||
false,
|
||||
false,
|
||||
MvccMode::Noop,
|
||||
)
|
||||
.unwrap();
|
||||
let db = Database::open_file(io.clone(), "../testing/testing.db", false, false).unwrap();
|
||||
let limbo_conn = db.connect().unwrap();
|
||||
|
||||
// Benchmark JSONB with different payload sizes
|
||||
@@ -502,7 +495,6 @@ fn bench_sequential_jsonb(criterion: &mut Criterion) {
|
||||
"../testing/testing.db",
|
||||
false,
|
||||
false,
|
||||
MvccMode::Noop,
|
||||
)
|
||||
.unwrap();
|
||||
let limbo_conn = db.connect().unwrap();
|
||||
@@ -665,7 +657,6 @@ fn bench_json_patch(criterion: &mut Criterion) {
|
||||
"../testing/testing.db",
|
||||
false,
|
||||
false,
|
||||
MvccMode::Noop,
|
||||
)
|
||||
.unwrap();
|
||||
let limbo_conn = db.connect().unwrap();
|
||||
|
||||
@@ -7,7 +7,7 @@ use turso_core::mvcc::clock::LocalClock;
|
||||
use turso_core::mvcc::database::{MvStore, Row, RowID};
|
||||
use turso_core::state_machine::{StateTransition, TransitionResult};
|
||||
use turso_core::types::{ImmutableRecord, Text};
|
||||
use turso_core::{Connection, Database, MemoryIO, MvccMode, Value};
|
||||
use turso_core::{Connection, Database, MemoryIO, Value};
|
||||
|
||||
struct BenchDb {
|
||||
_db: Arc<Database>,
|
||||
@@ -17,7 +17,7 @@ struct BenchDb {
|
||||
|
||||
fn bench_db() -> BenchDb {
|
||||
let io = Arc::new(MemoryIO::new());
|
||||
let db = Database::open_file(io.clone(), ":memory:", true, true, MvccMode::Noop).unwrap();
|
||||
let db = Database::open_file(io.clone(), ":memory:", true, true).unwrap();
|
||||
let conn = db.connect().unwrap();
|
||||
let mvcc_store = db.get_mv_store().unwrap().clone();
|
||||
BenchDb {
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::sync::Arc;
|
||||
|
||||
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion, SamplingMode};
|
||||
use pprof::criterion::{Output, PProfProfiler};
|
||||
use turso_core::{Database, MvccMode, PlatformIO};
|
||||
use turso_core::{Database, PlatformIO};
|
||||
|
||||
const TPC_H_PATH: &str = "../perf/tpc-h/TPC-H.db";
|
||||
|
||||
@@ -30,7 +30,7 @@ fn bench_tpc_h_queries(criterion: &mut Criterion) {
|
||||
|
||||
#[allow(clippy::arc_with_non_send_sync)]
|
||||
let io = Arc::new(PlatformIO::new().unwrap());
|
||||
let db = Database::open_file(io.clone(), TPC_H_PATH, false, true, MvccMode::Noop).unwrap();
|
||||
let db = Database::open_file(io.clone(), TPC_H_PATH, false, true).unwrap();
|
||||
let limbo_conn = db.connect().unwrap();
|
||||
|
||||
let queries = [
|
||||
|
||||
@@ -155,7 +155,7 @@ impl Database {
|
||||
}
|
||||
},
|
||||
};
|
||||
let db = Self::open_file(io.clone(), path, false, false, crate::MvccMode::Noop)?;
|
||||
let db = Self::open_file(io.clone(), path, false, false)?;
|
||||
Ok((io, db))
|
||||
}
|
||||
|
||||
|
||||
@@ -1115,7 +1115,7 @@ impl DbspCompiler {
|
||||
|
||||
// Create an internal connection for expression compilation
|
||||
let io = Arc::new(MemoryIO::new());
|
||||
let db = Database::open_file(io, ":memory:", false, false, crate::MvccMode::Noop)?;
|
||||
let db = Database::open_file(io, ":memory:", false, false)?;
|
||||
let internal_conn = db.connect()?;
|
||||
internal_conn.query_only.set(true);
|
||||
internal_conn.auto_commit.set(false);
|
||||
@@ -1318,8 +1318,7 @@ mod tests {
|
||||
use crate::translate::logical::LogicalPlanBuilder;
|
||||
use crate::translate::logical::LogicalSchema;
|
||||
use crate::util::IOExt;
|
||||
use crate::{Database, MemoryIO, MvccMode, Pager, IO};
|
||||
use std::rc::Rc;
|
||||
use crate::{Database, MemoryIO, Pager, IO};
|
||||
use std::sync::Arc;
|
||||
use turso_parser::ast;
|
||||
use turso_parser::parser::Parser;
|
||||
@@ -1417,7 +1416,7 @@ mod tests {
|
||||
|
||||
fn setup_btree_for_circuit() -> (Arc<Pager>, usize, usize, usize) {
|
||||
let io: Arc<dyn IO> = Arc::new(MemoryIO::new());
|
||||
let db = Database::open_file(io.clone(), ":memory:", false, false, MvccMode::Noop).unwrap();
|
||||
let db = Database::open_file(io.clone(), ":memory:", false, false).unwrap();
|
||||
let conn = db.connect().unwrap();
|
||||
let pager = conn.pager.borrow().clone();
|
||||
|
||||
|
||||
@@ -1018,11 +1018,8 @@ impl ProjectOperator {
|
||||
// Set up internal connection for expression evaluation
|
||||
let io = Arc::new(crate::MemoryIO::new());
|
||||
let db = Database::open_file(
|
||||
io,
|
||||
":memory:",
|
||||
false, // no MVCC needed for expression evaluation
|
||||
io, ":memory:", false, // no MVCC needed for expression evaluation
|
||||
false, // no indexes needed
|
||||
crate::MvccMode::Noop,
|
||||
)?;
|
||||
let internal_conn = db.connect()?;
|
||||
// Set to read-only mode and disable auto-commit since we're only evaluating expressions
|
||||
@@ -1135,11 +1132,8 @@ impl ProjectOperator {
|
||||
// Set up internal connection for expression evaluation
|
||||
let io = Arc::new(crate::MemoryIO::new());
|
||||
let db = Database::open_file(
|
||||
io,
|
||||
":memory:",
|
||||
false, // no MVCC needed for expression evaluation
|
||||
io, ":memory:", false, // no MVCC needed for expression evaluation
|
||||
false, // no indexes needed
|
||||
crate::MvccMode::Noop,
|
||||
)?;
|
||||
let internal_conn = db.connect()?;
|
||||
// Set to read-only mode and disable auto-commit since we're only evaluating expressions
|
||||
@@ -2240,14 +2234,14 @@ mod tests {
|
||||
use crate::storage::pager::CreateBTreeFlags;
|
||||
use crate::types::Text;
|
||||
use crate::util::IOExt;
|
||||
use crate::Value;
|
||||
use crate::{Database, MemoryIO, IO};
|
||||
use crate::{MvccMode, Value};
|
||||
use std::sync::{Arc, Mutex};
|
||||
|
||||
/// Create a test pager for operator tests with both table and index
|
||||
fn create_test_pager() -> (std::sync::Arc<crate::Pager>, usize, usize) {
|
||||
let io: Arc<dyn IO> = Arc::new(MemoryIO::new());
|
||||
let db = Database::open_file(io.clone(), ":memory:", false, false, MvccMode::Noop).unwrap();
|
||||
let db = Database::open_file(io.clone(), ":memory:", false, false).unwrap();
|
||||
let conn = db.connect().unwrap();
|
||||
|
||||
let pager = conn.pager.borrow().clone();
|
||||
|
||||
21
core/lib.rs
21
core/lib.rs
@@ -99,12 +99,6 @@ use util::parse_schema_rows;
|
||||
pub use util::IOExt;
|
||||
pub use vdbe::{builder::QueryMode, explain::EXPLAIN_COLUMNS, explain::EXPLAIN_QUERY_PLAN_COLUMNS};
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub enum MvccMode {
|
||||
Noop,
|
||||
LogicalLog,
|
||||
}
|
||||
|
||||
/// Configuration for database features
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||
pub struct DatabaseOpts {
|
||||
@@ -119,7 +113,7 @@ impl Default for DatabaseOpts {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
enable_mvcc: false,
|
||||
mvcc_mode: MvccMode::Noop,
|
||||
mvcc_mode: MvccMode::LogicalLog,
|
||||
enable_indexes: true,
|
||||
enable_views: false,
|
||||
enable_strict: false,
|
||||
@@ -137,11 +131,6 @@ impl DatabaseOpts {
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_mvcc_mode(mut self, mvcc_mode: MvccMode) -> Self {
|
||||
self.mvcc_mode = mvcc_mode;
|
||||
self
|
||||
}
|
||||
|
||||
pub fn with_indexes(mut self, enable: bool) -> Self {
|
||||
self.enable_indexes = enable;
|
||||
self
|
||||
@@ -186,6 +175,12 @@ pub enum SyncMode {
|
||||
Full = 2,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
|
||||
pub enum MvccMode {
|
||||
Noop,
|
||||
LogicalLog,
|
||||
}
|
||||
|
||||
pub(crate) type MvStore = mvcc::MvStore<mvcc::LocalClock>;
|
||||
|
||||
pub(crate) type MvCursor = mvcc::cursor::MvccLazyCursor<mvcc::LocalClock>;
|
||||
@@ -280,7 +275,6 @@ impl Database {
|
||||
path: &str,
|
||||
enable_mvcc: bool,
|
||||
enable_indexes: bool,
|
||||
mvcc_mode: MvccMode,
|
||||
) -> Result<Arc<Database>> {
|
||||
Self::open_file_with_flags(
|
||||
io,
|
||||
@@ -288,7 +282,6 @@ impl Database {
|
||||
OpenFlags::default(),
|
||||
DatabaseOpts::new()
|
||||
.with_mvcc(enable_mvcc)
|
||||
.with_mvcc_mode(mvcc_mode)
|
||||
.with_indexes(enable_indexes),
|
||||
None,
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ pub(crate) struct MvccTestDb {
|
||||
impl MvccTestDb {
|
||||
pub fn new() -> Self {
|
||||
let io = Arc::new(MemoryIO::new());
|
||||
let db = Database::open_file(io.clone(), ":memory:", true, true, MvccMode::Noop).unwrap();
|
||||
let db = Database::open_file(io.clone(), ":memory:", true, true).unwrap();
|
||||
let conn = db.connect().unwrap();
|
||||
let mvcc_store = db.mv_store.as_ref().unwrap().clone();
|
||||
Self {
|
||||
@@ -33,7 +33,7 @@ impl MvccTestDb {
|
||||
impl MvccTestDbNoConn {
|
||||
pub fn new() -> Self {
|
||||
let io = Arc::new(MemoryIO::new());
|
||||
let db = Database::open_file(io.clone(), ":memory:", true, true, MvccMode::Noop).unwrap();
|
||||
let db = Database::open_file(io.clone(), ":memory:", true, true).unwrap();
|
||||
Self {
|
||||
db: Some(db),
|
||||
path: None,
|
||||
@@ -50,14 +50,8 @@ impl MvccTestDbNoConn {
|
||||
std::fs::create_dir_all(path.parent().unwrap()).unwrap();
|
||||
let io = Arc::new(PlatformIO::new().unwrap());
|
||||
println!("path: {}", path.as_os_str().to_str().unwrap());
|
||||
let db = Database::open_file(
|
||||
io.clone(),
|
||||
path.as_os_str().to_str().unwrap(),
|
||||
true,
|
||||
true,
|
||||
MvccMode::Noop,
|
||||
)
|
||||
.unwrap();
|
||||
let db = Database::open_file(io.clone(), path.as_os_str().to_str().unwrap(), true, true)
|
||||
.unwrap();
|
||||
Self {
|
||||
db: Some(db),
|
||||
path: Some(path.to_str().unwrap().to_string()),
|
||||
@@ -69,7 +63,7 @@ impl MvccTestDbNoConn {
|
||||
pub fn restart(&mut self) {
|
||||
let io = Arc::new(PlatformIO::new().unwrap());
|
||||
let path = self.path.as_ref().unwrap();
|
||||
let db = Database::open_file(io.clone(), path, true, true, MvccMode::Noop).unwrap();
|
||||
let db = Database::open_file(io.clone(), path, true, true).unwrap();
|
||||
self.db.replace(db);
|
||||
}
|
||||
|
||||
@@ -733,10 +727,10 @@ fn test_future_row() {
|
||||
use crate::mvcc::cursor::MvccLazyCursor;
|
||||
use crate::mvcc::database::{MvStore, Row, RowID};
|
||||
use crate::types::Text;
|
||||
use crate::RefValue;
|
||||
use crate::Value;
|
||||
use crate::{Database, StepResult};
|
||||
use crate::{MemoryIO, Statement};
|
||||
use crate::{MvccMode, RefValue};
|
||||
|
||||
// Simple atomic clock implementation for testing
|
||||
|
||||
|
||||
@@ -7810,8 +7810,7 @@ mod tests {
|
||||
},
|
||||
types::Text,
|
||||
vdbe::Register,
|
||||
BufferPool, Completion, Connection, IOContext, MvccMode, StepResult, WalFile,
|
||||
WalFileShared,
|
||||
BufferPool, Completion, Connection, IOContext, StepResult, WalFile, WalFileShared,
|
||||
};
|
||||
use std::{
|
||||
cell::RefCell,
|
||||
@@ -7857,14 +7856,7 @@ mod tests {
|
||||
.unwrap();
|
||||
}
|
||||
let io: Arc<dyn IO> = Arc::new(PlatformIO::new().unwrap());
|
||||
let db = Database::open_file(
|
||||
io.clone(),
|
||||
path.to_str().unwrap(),
|
||||
false,
|
||||
false,
|
||||
MvccMode::Noop,
|
||||
)
|
||||
.unwrap();
|
||||
let db = Database::open_file(io.clone(), path.to_str().unwrap(), false, false).unwrap();
|
||||
|
||||
db
|
||||
}
|
||||
@@ -8166,7 +8158,7 @@ mod tests {
|
||||
fn empty_btree() -> (Arc<Pager>, usize, Arc<Database>, Arc<Connection>) {
|
||||
#[allow(clippy::arc_with_non_send_sync)]
|
||||
let io: Arc<dyn IO> = Arc::new(MemoryIO::new());
|
||||
let db = Database::open_file(io.clone(), ":memory:", false, false, MvccMode::Noop).unwrap();
|
||||
let db = Database::open_file(io.clone(), ":memory:", false, false).unwrap();
|
||||
let conn = db.connect().unwrap();
|
||||
let pager = conn.pager.borrow().clone();
|
||||
|
||||
@@ -8181,7 +8173,7 @@ mod tests {
|
||||
fn btree_with_virtual_page_1() -> Result<()> {
|
||||
#[allow(clippy::arc_with_non_send_sync)]
|
||||
let io: Arc<dyn IO> = Arc::new(MemoryIO::new());
|
||||
let db = Database::open_file(io.clone(), ":memory:", false, false, MvccMode::Noop).unwrap();
|
||||
let db = Database::open_file(io.clone(), ":memory:", false, false).unwrap();
|
||||
let conn = db.connect().unwrap();
|
||||
let pager = conn.pager.borrow().clone();
|
||||
|
||||
|
||||
@@ -2427,14 +2427,7 @@ pub mod test {
|
||||
.unwrap();
|
||||
}
|
||||
let io: Arc<dyn IO> = Arc::new(PlatformIO::new().unwrap());
|
||||
let db = Database::open_file(
|
||||
io.clone(),
|
||||
path.to_str().unwrap(),
|
||||
false,
|
||||
false,
|
||||
crate::MvccMode::Noop,
|
||||
)
|
||||
.unwrap();
|
||||
let db = Database::open_file(io.clone(), path.to_str().unwrap(), false, false).unwrap();
|
||||
// db + tmp directory
|
||||
(db, dbpath)
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ struct Args {
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<()> {
|
||||
let _ = tracing_subscriber::fmt()
|
||||
tracing_subscriber::fmt()
|
||||
.with_env_filter(EnvFilter::from_default_env())
|
||||
.with_ansi(false)
|
||||
.with_thread_ids(true)
|
||||
@@ -156,17 +156,9 @@ async fn setup_database(
|
||||
let db = match mode {
|
||||
TransactionMode::Legacy => builder.build().await?,
|
||||
TransactionMode::Mvcc | TransactionMode::Concurrent => {
|
||||
builder
|
||||
.with_mvcc(true, turso::MvccMode::Noop)
|
||||
.build()
|
||||
.await?
|
||||
}
|
||||
TransactionMode::LogicalLog => {
|
||||
builder
|
||||
.with_mvcc(true, turso::MvccMode::LogicalLog)
|
||||
.build()
|
||||
.await?
|
||||
builder.with_mvcc(true).build().await?
|
||||
}
|
||||
TransactionMode::LogicalLog => builder.with_mvcc(true).build().await?,
|
||||
};
|
||||
let conn = db.connect()?;
|
||||
|
||||
|
||||
@@ -811,7 +811,6 @@ fn reopen_database(env: &mut SimulatorEnv) {
|
||||
env.get_db_path().to_str().expect("path should be 'to_str'"),
|
||||
false,
|
||||
true,
|
||||
turso_core::MvccMode::Noop,
|
||||
) {
|
||||
Ok(db) => db,
|
||||
Err(e) => {
|
||||
|
||||
@@ -9,7 +9,7 @@ use garde::Validate;
|
||||
use rand::{Rng, SeedableRng};
|
||||
use rand_chacha::ChaCha8Rng;
|
||||
use sql_generation::model::table::Table;
|
||||
use turso_core::{Database, MvccMode};
|
||||
use turso_core::Database;
|
||||
|
||||
use crate::profiles::Profile;
|
||||
use crate::runner::SimIO;
|
||||
@@ -141,7 +141,6 @@ impl SimulatorEnv {
|
||||
db_path.to_str().unwrap(),
|
||||
self.profile.experimental_mvcc,
|
||||
self.profile.query.gen_opts.indexes,
|
||||
MvccMode::Noop,
|
||||
) {
|
||||
Ok(db) => db,
|
||||
Err(e) => {
|
||||
@@ -272,7 +271,6 @@ impl SimulatorEnv {
|
||||
db_path.to_str().unwrap(),
|
||||
profile.experimental_mvcc,
|
||||
profile.query.gen_opts.indexes,
|
||||
MvccMode::Noop,
|
||||
) {
|
||||
Ok(db) => db,
|
||||
Err(e) => {
|
||||
|
||||
@@ -151,13 +151,7 @@ pub unsafe extern "C" fn sqlite3_open(
|
||||
Err(_) => return SQLITE_CANTOPEN,
|
||||
},
|
||||
};
|
||||
match turso_core::Database::open_file(
|
||||
io.clone(),
|
||||
filename_str,
|
||||
false,
|
||||
false,
|
||||
turso_core::MvccMode::Noop,
|
||||
) {
|
||||
match turso_core::Database::open_file(io.clone(), filename_str, false, false) {
|
||||
Ok(db) => {
|
||||
let conn = db.connect().unwrap();
|
||||
let filename = match filename_str {
|
||||
|
||||
@@ -673,7 +673,6 @@ mod tests {
|
||||
use std::sync::Arc;
|
||||
|
||||
use tempfile::NamedTempFile;
|
||||
use turso::MvccMode;
|
||||
|
||||
use crate::{
|
||||
database_tape::{
|
||||
@@ -688,9 +687,7 @@ mod tests {
|
||||
let db_path1 = temp_file1.path().to_str().unwrap();
|
||||
|
||||
let io: Arc<dyn turso_core::IO> = Arc::new(turso_core::PlatformIO::new().unwrap());
|
||||
let db1 =
|
||||
turso_core::Database::open_file(io.clone(), db_path1, false, false, MvccMode::Noop)
|
||||
.unwrap();
|
||||
let db1 = turso_core::Database::open_file(io.clone(), db_path1, false, false).unwrap();
|
||||
let db1 = Arc::new(DatabaseTape::new(db1));
|
||||
let mut gen = genawaiter::sync::Gen::new({
|
||||
let db1 = db1.clone();
|
||||
@@ -720,9 +717,7 @@ mod tests {
|
||||
let db_path1 = temp_file1.path().to_str().unwrap();
|
||||
|
||||
let io: Arc<dyn turso_core::IO> = Arc::new(turso_core::PlatformIO::new().unwrap());
|
||||
let db1 =
|
||||
turso_core::Database::open_file(io.clone(), db_path1, false, false, MvccMode::Noop)
|
||||
.unwrap();
|
||||
let db1 = turso_core::Database::open_file(io.clone(), db_path1, false, false).unwrap();
|
||||
let db1 = Arc::new(DatabaseTape::new(db1));
|
||||
|
||||
let mut gen = genawaiter::sync::Gen::new({
|
||||
@@ -790,14 +785,10 @@ mod tests {
|
||||
let db_path2 = temp_file2.path().to_str().unwrap();
|
||||
|
||||
let io: Arc<dyn turso_core::IO> = Arc::new(turso_core::PlatformIO::new().unwrap());
|
||||
let db1 =
|
||||
turso_core::Database::open_file(io.clone(), db_path1, false, false, MvccMode::Noop)
|
||||
.unwrap();
|
||||
let db1 = turso_core::Database::open_file(io.clone(), db_path1, false, false).unwrap();
|
||||
let db1 = Arc::new(DatabaseTape::new(db1));
|
||||
|
||||
let db2 =
|
||||
turso_core::Database::open_file(io.clone(), db_path2, false, false, MvccMode::Noop)
|
||||
.unwrap();
|
||||
let db2 = turso_core::Database::open_file(io.clone(), db_path2, false, false).unwrap();
|
||||
let db2 = Arc::new(DatabaseTape::new(db2));
|
||||
|
||||
let mut gen = genawaiter::sync::Gen::new({
|
||||
@@ -873,14 +864,10 @@ mod tests {
|
||||
let db_path2 = temp_file2.path().to_str().unwrap();
|
||||
|
||||
let io: Arc<dyn turso_core::IO> = Arc::new(turso_core::PlatformIO::new().unwrap());
|
||||
let db1 =
|
||||
turso_core::Database::open_file(io.clone(), db_path1, false, false, MvccMode::Noop)
|
||||
.unwrap();
|
||||
let db1 = turso_core::Database::open_file(io.clone(), db_path1, false, false).unwrap();
|
||||
let db1 = Arc::new(DatabaseTape::new(db1));
|
||||
|
||||
let db2 =
|
||||
turso_core::Database::open_file(io.clone(), db_path2, false, false, MvccMode::Noop)
|
||||
.unwrap();
|
||||
let db2 = turso_core::Database::open_file(io.clone(), db_path2, false, false).unwrap();
|
||||
let db2 = Arc::new(DatabaseTape::new(db2));
|
||||
|
||||
let mut gen = genawaiter::sync::Gen::new({
|
||||
@@ -950,14 +937,10 @@ mod tests {
|
||||
let db_path2 = temp_file2.path().to_str().unwrap();
|
||||
|
||||
let io: Arc<dyn turso_core::IO> = Arc::new(turso_core::PlatformIO::new().unwrap());
|
||||
let db1 =
|
||||
turso_core::Database::open_file(io.clone(), db_path1, false, true, MvccMode::Noop)
|
||||
.unwrap();
|
||||
let db1 = turso_core::Database::open_file(io.clone(), db_path1, false, true).unwrap();
|
||||
let db1 = Arc::new(DatabaseTape::new(db1));
|
||||
|
||||
let db2 =
|
||||
turso_core::Database::open_file(io.clone(), db_path2, false, true, MvccMode::Noop)
|
||||
.unwrap();
|
||||
let db2 = turso_core::Database::open_file(io.clone(), db_path2, false, true).unwrap();
|
||||
let db2 = Arc::new(DatabaseTape::new(db2));
|
||||
|
||||
let mut gen = genawaiter::sync::Gen::new({
|
||||
@@ -1019,19 +1002,13 @@ mod tests {
|
||||
|
||||
let io: Arc<dyn turso_core::IO> = Arc::new(turso_core::PlatformIO::new().unwrap());
|
||||
|
||||
let db1 =
|
||||
turso_core::Database::open_file(io.clone(), db_path1, false, true, MvccMode::Noop)
|
||||
.unwrap();
|
||||
let db1 = turso_core::Database::open_file(io.clone(), db_path1, false, true).unwrap();
|
||||
let db1 = Arc::new(DatabaseTape::new(db1));
|
||||
|
||||
let db2 =
|
||||
turso_core::Database::open_file(io.clone(), db_path2, false, true, MvccMode::Noop)
|
||||
.unwrap();
|
||||
let db2 = turso_core::Database::open_file(io.clone(), db_path2, false, true).unwrap();
|
||||
let db2 = Arc::new(DatabaseTape::new(db2));
|
||||
|
||||
let db3 =
|
||||
turso_core::Database::open_file(io.clone(), db_path3, false, true, MvccMode::Noop)
|
||||
.unwrap();
|
||||
let db3 = turso_core::Database::open_file(io.clone(), db_path3, false, true).unwrap();
|
||||
let db3 = Arc::new(DatabaseTape::new(db3));
|
||||
|
||||
let mut gen = genawaiter::sync::Gen::new({
|
||||
@@ -1154,14 +1131,10 @@ mod tests {
|
||||
|
||||
let io: Arc<dyn turso_core::IO> = Arc::new(turso_core::PlatformIO::new().unwrap());
|
||||
|
||||
let db1 =
|
||||
turso_core::Database::open_file(io.clone(), db_path1, false, true, MvccMode::Noop)
|
||||
.unwrap();
|
||||
let db1 = turso_core::Database::open_file(io.clone(), db_path1, false, true).unwrap();
|
||||
let db1 = Arc::new(DatabaseTape::new(db1));
|
||||
|
||||
let db2 =
|
||||
turso_core::Database::open_file(io.clone(), db_path2, false, true, MvccMode::Noop)
|
||||
.unwrap();
|
||||
let db2 = turso_core::Database::open_file(io.clone(), db_path2, false, true).unwrap();
|
||||
let db2 = Arc::new(DatabaseTape::new(db2));
|
||||
|
||||
let mut gen = genawaiter::sync::Gen::new({
|
||||
@@ -1242,14 +1215,10 @@ mod tests {
|
||||
|
||||
let io: Arc<dyn turso_core::IO> = Arc::new(turso_core::PlatformIO::new().unwrap());
|
||||
|
||||
let db1 =
|
||||
turso_core::Database::open_file(io.clone(), db_path1, false, true, MvccMode::Noop)
|
||||
.unwrap();
|
||||
let db1 = turso_core::Database::open_file(io.clone(), db_path1, false, true).unwrap();
|
||||
let db1 = Arc::new(DatabaseTape::new(db1));
|
||||
|
||||
let db2 =
|
||||
turso_core::Database::open_file(io.clone(), db_path2, false, true, MvccMode::Noop)
|
||||
.unwrap();
|
||||
let db2 = turso_core::Database::open_file(io.clone(), db_path2, false, true).unwrap();
|
||||
let db2 = Arc::new(DatabaseTape::new(db2));
|
||||
|
||||
let mut gen = genawaiter::sync::Gen::new({
|
||||
@@ -1322,19 +1291,13 @@ mod tests {
|
||||
|
||||
let io: Arc<dyn turso_core::IO> = Arc::new(turso_core::PlatformIO::new().unwrap());
|
||||
|
||||
let db1 =
|
||||
turso_core::Database::open_file(io.clone(), db_path1, false, true, MvccMode::Noop)
|
||||
.unwrap();
|
||||
let db1 = turso_core::Database::open_file(io.clone(), db_path1, false, true).unwrap();
|
||||
let db1 = Arc::new(DatabaseTape::new(db1));
|
||||
|
||||
let db2 =
|
||||
turso_core::Database::open_file(io.clone(), db_path2, false, true, MvccMode::Noop)
|
||||
.unwrap();
|
||||
let db2 = turso_core::Database::open_file(io.clone(), db_path2, false, true).unwrap();
|
||||
let db2 = Arc::new(DatabaseTape::new(db2));
|
||||
|
||||
let db3 =
|
||||
turso_core::Database::open_file(io.clone(), db_path3, false, true, MvccMode::Noop)
|
||||
.unwrap();
|
||||
let db3 = turso_core::Database::open_file(io.clone(), db_path3, false, true).unwrap();
|
||||
let db3 = Arc::new(DatabaseTape::new(db3));
|
||||
|
||||
let mut gen = genawaiter::sync::Gen::new({
|
||||
|
||||
@@ -23,9 +23,7 @@ pub trait IoOperations {
|
||||
impl IoOperations for Arc<dyn turso_core::IO> {
|
||||
fn open_tape(&self, path: &str, capture: bool) -> Result<DatabaseTape> {
|
||||
let io = self.clone();
|
||||
let clean =
|
||||
turso_core::Database::open_file(io, path, false, true, turso_core::MvccMode::Noop)
|
||||
.unwrap();
|
||||
let clean = turso_core::Database::open_file(io, path, false, true).unwrap();
|
||||
let opts = DatabaseTapeOpts {
|
||||
cdc_table: None,
|
||||
cdc_mode: Some(if capture { "full" } else { "off" }.to_string()),
|
||||
|
||||
@@ -5,7 +5,6 @@ use std::path::{Path, PathBuf};
|
||||
use std::sync::Arc;
|
||||
use tempfile::TempDir;
|
||||
use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
|
||||
use turso::MvccMode;
|
||||
use turso_core::{Connection, Database, Row, StepResult, IO};
|
||||
|
||||
#[allow(dead_code)]
|
||||
@@ -123,7 +122,6 @@ impl TempDatabase {
|
||||
self.path.to_str().unwrap(),
|
||||
false,
|
||||
enable_indexes,
|
||||
MvccMode::Noop,
|
||||
)
|
||||
.unwrap()
|
||||
}
|
||||
@@ -342,7 +340,6 @@ pub fn run_query_core(
|
||||
mod tests {
|
||||
use std::{sync::Arc, vec};
|
||||
use tempfile::{NamedTempFile, TempDir};
|
||||
use turso::MvccMode;
|
||||
use turso_core::{Database, StepResult, IO};
|
||||
|
||||
use crate::common::do_flush;
|
||||
@@ -638,7 +635,7 @@ mod tests {
|
||||
// Open database
|
||||
#[allow(clippy::arc_with_non_send_sync)]
|
||||
let io: Arc<dyn IO> = Arc::new(turso_core::PlatformIO::new().unwrap());
|
||||
let db = Database::open_file(io, &db_path, false, false, MvccMode::Noop)?;
|
||||
let db = Database::open_file(io, &db_path, false, false)?;
|
||||
|
||||
const NUM_CONNECTIONS: usize = 5;
|
||||
let mut connections = Vec::new();
|
||||
|
||||
@@ -594,7 +594,7 @@ async fn multiple_connections_fuzz(opts: FuzzOptions) {
|
||||
// Create a fresh database for each iteration
|
||||
let tempfile = tempfile::NamedTempFile::new().unwrap();
|
||||
let db = Builder::new_local(tempfile.path().to_str().unwrap())
|
||||
.with_mvcc(opts.mvcc_enabled, turso::MvccMode::Noop)
|
||||
.with_mvcc(opts.mvcc_enabled)
|
||||
.build()
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
Reference in New Issue
Block a user