diff --git a/bottomless/src/replicator.rs b/bottomless/src/replicator.rs index 180ca38576..6f318fd125 100644 --- a/bottomless/src/replicator.rs +++ b/bottomless/src/replicator.rs @@ -935,6 +935,14 @@ impl Replicator { })?; tracing::trace!("Local change counter: {change_counter}"); + // TODO: we shouldn't leak the connection here but for some reason when this connection get + // dropped it seems to checkpoint the database + if std::env::var("LIBSQL_BOTTOMLESS_DISABLE_INIT_CHECKPOINTING").is_ok() + || std::env::var("LIBSQL_DISABLE_INIT_CHECKPOINTING").is_ok() + { + std::mem::forget(conn); + } + Ok(change_counter.to_be_bytes()) } diff --git a/libsql-server/src/namespace/configurator/helpers.rs b/libsql-server/src/namespace/configurator/helpers.rs index 081eeaef80..c84c963805 100644 --- a/libsql-server/src/namespace/configurator/helpers.rs +++ b/libsql-server/src/namespace/configurator/helpers.rs @@ -84,9 +84,16 @@ pub(super) async fn make_primary_connection_maker( let bottomless_replicator = match primary_config.bottomless_replication { Some(ref options) => { - tracing::debug!("Checkpointing before initializing bottomless"); - crate::replication::primary::logger::checkpoint_db(&db_path.join("data"))?; - tracing::debug!("Checkpointed before initializing bottomless"); + // TODO: figure out why we really need this the fixme above is not clear enough but + // disabling this allows us to prevent checkpointing of the wal file. + if !std::env::var("LIBSQL_DISABLE_INIT_CHECKPOINTING").is_ok() { + tracing::debug!("Checkpointing before initializing bottomless"); + crate::replication::primary::logger::checkpoint_db(&db_path.join("data"))?; + tracing::debug!("Checkpointed before initializing bottomless"); + } else { + tracing::warn!("Disabling initial checkpoint before bottomless"); + } + let options = make_bottomless_options(options, bottomless_db_id, name.clone()); let (replicator, did_recover) = init_bottomless_replicator(db_path.join("data"), options, &restore_option).await?;