From dd851a2b25d44d4145d59e379f94d44d27bf25d4 Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Sat, 23 Sep 2023 18:41:58 +0000 Subject: [PATCH] Let's try some wal truncating. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4473 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/ssb.rpc.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ssb.rpc.c b/src/ssb.rpc.c index 2e077d73..b3121570 100644 --- a/src/ssb.rpc.c +++ b/src/ssb.rpc.c @@ -1213,6 +1213,13 @@ static void _tf_ssb_rpc_delete_blobs_work(uv_work_t* work) { tf_printf("prepare failed: %s\n", sqlite3_errmsg(db)); } + int64_t checkpoint_start_ms = uv_hrtime(); + int log = 0; + int checkpointed = 0; + if (sqlite3_wal_checkpoint_v2(db, NULL, SQLITE_CHECKPOINT_TRUNCATE, &log, &checkpointed) == SQLITE_OK) + { + tf_printf("Checkpointed %d frames in %d ms. Log is now %d frames.\n", (int)((uv_hrtime() - checkpoint_start_ms) / 1000000LL), checkpointed, log); + } tf_ssb_release_db_writer(ssb, db); int64_t duration_ms = (uv_hrtime() - start_ns) / 1000000LL; tf_printf("Deleted %d blobs in %d ms.\n", deleted, (int)duration_ms);