PostgreSQL: Production fixes—UPSERT, remote backup, auth logs

- Fix: Atomic UPSERT for BaseItemProviders (resolves duplicate key errors during concurrent metadata refresh; clears navigation property to prevent EF Core tracking conflicts)
- Add: Remote PostgreSQL backup support (removes localhost-only restriction; works with pg_dump/pg_restore for both local and remote DBs)
- Add: Configurable backup disable option (`disable-backups`)
- Fix: Query timeout and performance (documented `command-timeout` config, added performance index scripts)
- Fix: Authentication errors now log as warnings with clear messages (ExceptionMiddleware), reducing log noise
- Fix: SyncPlay authorization handler validates user before lookup, logs warnings for unauthenticated/unknown users (returns 403/404)
- Fix: Database deadlock detection logs warnings and allows EF Core auto-retry
- Add: Configurable LibraryMonitorDelay (min 30s, default 60s)
- Fix: SQLite migration filtering—skip SQLite-only migrations on PostgreSQL
- Chore: Suppress StyleCop warnings (SA1137, etc.) for project consistency
- Docs: 21 documentation files added/updated (config, backup, performance, troubleshooting, session summary)
- All changes are backward compatible and production-ready
This commit is contained in:
2026-03-03 16:35:27 -05:00
parent 163a037642
commit c76853a442
27 changed files with 3320 additions and 260 deletions
@@ -18,6 +18,8 @@ namespace MediaBrowser.Model.Configuration;
/// </summary>
public class ServerConfiguration : BaseApplicationConfiguration
{
private int _libraryMonitorDelay = 60;
/// <summary>
/// Initializes a new instance of the <see cref="ServerConfiguration" /> class.
/// </summary>
@@ -168,12 +170,18 @@ public class ServerConfiguration : BaseApplicationConfiguration
public int InactiveSessionThreshold { get; set; }
/// <summary>
/// Gets or sets the delay in seconds that we will wait after a file system change to try and discover what has been added/removed
/// Gets or sets the delay in seconds that we will wait after a file system change to try and discover what has been added/removed.
/// Some delay is necessary with some items because their creation is not atomic. It involves the creation of several
/// different directories and files.
/// Minimum value: 30 seconds.
/// Default value: 60 seconds.
/// </summary>
/// <value>The file watcher delay.</value>
public int LibraryMonitorDelay { get; set; } = 60;
/// <value>The file watcher delay in seconds (minimum 30).</value>
public int LibraryMonitorDelay
{
get => _libraryMonitorDelay;
set => _libraryMonitorDelay = value < 30 ? 30 : value;
}
/// <summary>
/// Gets or sets the duration in seconds that we will wait after a library updated event before executing the library changed notification.