Skip to content

Commit 3497d8a

Browse files
authored
Merge pull request #1898 from tursodatabase/lucio/disable-checkpointing-bottomless
sqld: disable checkpoint on primary conn create
2 parents 5beaf27 + d95fe5d commit 3497d8a

File tree

2 files changed

+18
-3
lines changed

2 files changed

+18
-3
lines changed

bottomless/src/replicator.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -935,6 +935,14 @@ impl Replicator {
935935
})?;
936936
tracing::trace!("Local change counter: {change_counter}");
937937

938+
// TODO: we shouldn't leak the connection here but for some reason when this connection get
939+
// dropped it seems to checkpoint the database
940+
if std::env::var("LIBSQL_BOTTOMLESS_DISABLE_INIT_CHECKPOINTING").is_ok()
941+
|| std::env::var("LIBSQL_DISABLE_INIT_CHECKPOINTING").is_ok()
942+
{
943+
std::mem::forget(conn);
944+
}
945+
938946
Ok(change_counter.to_be_bytes())
939947
}
940948

libsql-server/src/namespace/configurator/helpers.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,16 @@ pub(super) async fn make_primary_connection_maker(
8484

8585
let bottomless_replicator = match primary_config.bottomless_replication {
8686
Some(ref options) => {
87-
tracing::debug!("Checkpointing before initializing bottomless");
88-
crate::replication::primary::logger::checkpoint_db(&db_path.join("data"))?;
89-
tracing::debug!("Checkpointed before initializing bottomless");
87+
// TODO: figure out why we really need this the fixme above is not clear enough but
88+
// disabling this allows us to prevent checkpointing of the wal file.
89+
if !std::env::var("LIBSQL_DISABLE_INIT_CHECKPOINTING").is_ok() {
90+
tracing::debug!("Checkpointing before initializing bottomless");
91+
crate::replication::primary::logger::checkpoint_db(&db_path.join("data"))?;
92+
tracing::debug!("Checkpointed before initializing bottomless");
93+
} else {
94+
tracing::warn!("Disabling initial checkpoint before bottomless");
95+
}
96+
9097
let options = make_bottomless_options(options, bottomless_db_id, name.clone());
9198
let (replicator, did_recover) =
9299
init_bottomless_replicator(db_path.join("data"), options, &restore_option).await?;

0 commit comments

Comments
 (0)