aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortheguymadmax <171496228+theguymadmax@users.noreply.github.com>2026-03-01 05:57:23 -0500
committerBond_009 <bond.009@outlook.com>2026-03-01 05:57:23 -0500
commitf680495ca377b20488cc8133a054317d6daf48fc (patch)
tree88759e4d1842ed38e33bb306888bb6379d066717
parentd2f733f9a4d91a09ab887d410b2778a916f27c7d (diff)
Backport pull request #16253 from jellyfin/release-10.11.zHEADmaster
Checkpoint WAL before moving library.db in migration Original-merge: b6a96513de5fa301db83c6adab47fe64db0ff48e Merged-by: Bond-009 <bond.009@outlook.com> Backported-by: Bond_009 <bond.009@outlook.com>
-rw-r--r--Jellyfin.Server/Migrations/Routines/MigrateLibraryDb.cs10
1 files changed, 10 insertions, 0 deletions
diff --git a/Jellyfin.Server/Migrations/Routines/MigrateLibraryDb.cs b/Jellyfin.Server/Migrations/Routines/MigrateLibraryDb.cs
index 70761fa7d..c6ac55b6e 100644
--- a/Jellyfin.Server/Migrations/Routines/MigrateLibraryDb.cs
+++ b/Jellyfin.Server/Migrations/Routines/MigrateLibraryDb.cs
@@ -464,6 +464,16 @@ internal class MigrateLibraryDb : IDatabaseMigrationRoutine
SqliteConnection.ClearAllPools();
+ using (var checkpointConnection = new SqliteConnection($"Filename={libraryDbPath}"))
+ {
+ checkpointConnection.Open();
+ using var cmd = checkpointConnection.CreateCommand();
+ cmd.CommandText = "PRAGMA wal_checkpoint(TRUNCATE);";
+ cmd.ExecuteNonQuery();
+ }
+
+ SqliteConnection.ClearAllPools();
+
_logger.LogInformation("Move {0} to {1}.", libraryDbPath, libraryDbPath + ".old");
File.Move(libraryDbPath, libraryDbPath + ".old", true);
}