From ab918c6292bb27a0e39f3d54f0f449b97246e59b Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Mon, 9 Jan 2023 00:07:53 +0100 Subject: Fine tune DB settings --- Emby.Server.Implementations/Data/BaseSqliteRepository.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'Emby.Server.Implementations/Data/BaseSqliteRepository.cs') diff --git a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs index ff9aa4c2a..230f633a7 100644 --- a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs +++ b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs @@ -60,11 +60,16 @@ namespace Emby.Server.Implementations.Data /// The cache size or null. protected virtual int? CacheSize => null; + /// + /// Gets the locking mode. . + /// + protected virtual string LockingMode => "EXCLUSIVE"; + /// /// Gets the journal mode. . /// /// The journal mode. - protected virtual string JournalMode => "TRUNCATE"; + protected virtual string JournalMode => "WAL"; /// /// Gets the page size. @@ -116,6 +121,11 @@ namespace Emby.Server.Implementations.Data WriteConnection.Execute("PRAGMA cache_size=" + CacheSize.Value); } + if (!string.IsNullOrWhiteSpace(LockingMode)) + { + WriteConnection.Execute("PRAGMA locking_mode=" + LockingMode); + } + if (!string.IsNullOrWhiteSpace(JournalMode)) { WriteConnection.Execute("PRAGMA journal_mode=" + JournalMode); -- cgit v1.2.3 From 73740f6c6ea8e75ed57ab27228e3796938a93c81 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Mon, 9 Jan 2023 14:14:19 +0100 Subject: Change synchronous_mode to normal --- Emby.Server.Implementations/Data/BaseSqliteRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Emby.Server.Implementations/Data/BaseSqliteRepository.cs') diff --git a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs index 230f633a7..acbccc665 100644 --- a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs +++ b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs @@ -89,7 +89,7 @@ namespace Emby.Server.Implementations.Data /// /// The synchronous mode or null. /// - protected virtual SynchronousMode? Synchronous => null; + protected virtual SynchronousMode? Synchronous => SynchronousMode.Normal; /// /// Gets or sets the write lock. -- cgit v1.2.3 From 6a8d24d9e926bd7b8f54132bf769f92790d9d68a Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Tue, 10 Jan 2023 22:29:05 +0100 Subject: Set journal_size_limit --- Emby.Server.Implementations/Data/BaseSqliteRepository.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'Emby.Server.Implementations/Data/BaseSqliteRepository.cs') diff --git a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs index acbccc665..1d61667f8 100644 --- a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs +++ b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs @@ -71,6 +71,12 @@ namespace Emby.Server.Implementations.Data /// The journal mode. protected virtual string JournalMode => "WAL"; + /// + /// Gets the journal size limit. . + /// + /// The journal size limit. + protected virtual int? JournalSizeLimit => 0; + /// /// Gets the page size. /// @@ -131,6 +137,11 @@ namespace Emby.Server.Implementations.Data WriteConnection.Execute("PRAGMA journal_mode=" + JournalMode); } + if (JournalSizeLimit.HasValue) + { + WriteConnection.Execute("PRAGMA journal_size_limit=" + (int)JournalSizeLimit.Value); + } + if (Synchronous.HasValue) { WriteConnection.Execute("PRAGMA synchronous=" + (int)Synchronous.Value); -- cgit v1.2.3