diff options
| author | Joshua M. Boniface <joshua@boniface.me> | 2026-06-26 00:51:36 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-06-26 00:51:36 -0400 |
| commit | d71b17fcc730f6cd51689c76e9301bacfebd9280 (patch) | |
| tree | a1bc1f563e164533e3d609f467b96be532a41be6 /Jellyfin.Server.Implementations | |
| parent | 987744529aadd3a5e0da60ae1e6dec0e6e8ea469 (diff) | |
| parent | b60c535c84a382d06eab5b0c38ee279103b06cf2 (diff) | |
Merge pull request #17153 from joshuaboniface/fix-FixIncorrectOwnerIdRelationships
Fix too many SQL variables in DeleteItem for large batch deletes
Diffstat (limited to 'Jellyfin.Server.Implementations')
| -rw-r--r-- | Jellyfin.Server.Implementations/Item/ItemPersistenceService.cs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Jellyfin.Server.Implementations/Item/ItemPersistenceService.cs b/Jellyfin.Server.Implementations/Item/ItemPersistenceService.cs index 7c0cfe7c15..b10f7c527e 100644 --- a/Jellyfin.Server.Implementations/Item/ItemPersistenceService.cs +++ b/Jellyfin.Server.Implementations/Item/ItemPersistenceService.cs @@ -65,8 +65,13 @@ public class ItemPersistenceService : IItemPersistenceService descendantIds.Add(id); } + // Use WhereOneOrMany instead of a raw HashSet.Contains so large id sets are bound as a + // single parameter (json_each) rather than one SQL variable per id, which would otherwise + // overflow SQLite's variable limit when deleting many items at once (e.g. migrations). + var ownerIds = descendantIds.ToArray(); var extraIds = context.BaseItems - .Where(e => e.OwnerId.HasValue && descendantIds.Contains(e.OwnerId.Value)) + .Where(e => e.OwnerId.HasValue) + .WhereOneOrMany(ownerIds, e => e.OwnerId!.Value) .Select(e => e.Id) .ToArray(); |
