fix(archive): a rebase moves no row of the sequence that took the old folder; writers refuse a folder another sequence holds
Round 4 let every row under the old folder follow when that folder holds another sequence now. When the scan took the new holder first, its own row (already rebased into the old folder) then followed the moving sequence too and named that sequence's file, leaving its own export without a row; a second scan did not repair it. Only the moving sequence's own rows now follow because the old folder is taken, and a row of the sequence holding the old folder never follows: its export is in its own folder whatever the other one took along under the same name. The rebase callback now gets the owner of each row. Writers that file into the folder the index has for a sequence checked only that the folder existed. After another index moved the sequence away and another one into that folder, Take server wrote the server's settings into the other sequence's project.json, Save both wrote this PC's copy into its .chronos, and a render sent for the sequence was filed among its exports. SequenceFolders.Holds treats a folder whose sidecar names another sequence exactly like a missing one, and every such writer asks it: settings sync and conflict resolution (Errors.Archive.FolderMoved), Save both's copy and its clean-up, server render filing (503 folder_moved, the upload kept), export downloads, render jobs as they start, proxies sent and proxy passes, the deep analysis checkpoint and the editor's project save. A thumbnail pass refuses a sidecar of another sequence before it opens the pack. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit b406a4f6a9a7a3121e9e40289663fb62ee31948e)
This commit is contained in:
1 parent
26b03d1c6d
commit
8c2b9f1bfe
17 files changed
+260
-57
No files matched your search
@@ -168,7 +168,8 @@ public sealed class ArchiveImages
|
||||
/// frame's (proxies carry it, so the proxy counts as current and cannot belong to another photo) and whose size is
|
||||
/// the policy's (<see cref="TooSmall"/>), written atomically under the sequence's lease into its folder as the index has
|
||||
/// it then: a Reorganize moves the folder under that lease, and the folder it left is never created again (one another
|
||||
/// index moved, which this index finds at its next scan, takes nothing: <see cref="ProxyStoreResult.Gone"/>).
|
||||
/// index moved, which this index finds at its next scan, takes nothing, nor does that folder when it holds another
|
||||
/// sequence now: <see cref="ProxyStoreResult.Gone"/>).
|
||||
/// </summary>
|
||||
/// <exception cref="ArchiveOfflineException">The archive is offline or read-only.</exception>
|
||||
/// <exception cref="LeaseUnavailableException">Another writer held the sequence for longer than the lease wait.</exception>
|
||||
@@ -191,7 +192,7 @@ public sealed class ArchiveImages
|
||||
{
|
||||
if (await _db.Sequences.GetAsync(sequence.Id, cancellationToken).ConfigureAwait(false) is not { } row) return ProxyStoreResult.Gone;
|
||||
var folder = paths.Sequence(row.Folder);
|
||||
if (!Directory.Exists(folder.Folder)) return ProxyStoreResult.Gone;
|
||||
if (!SequenceFolders.Holds(folder, row.Id)) return ProxyStoreResult.Gone;
|
||||
Directory.CreateDirectory(folder.Proxies);
|
||||
var path = folder.Proxy(frame.Index);
|
||||
AtomicFile.WriteAllBytes(path, jpeg);
|
||||
@@ -226,6 +227,8 @@ public sealed class ArchiveImages
|
||||
{
|
||||
var folder = await SequenceWriter.FolderAsync(_db, paths, sequence, cancellationToken).ConfigureAwait(false);
|
||||
manifest = ManifestStore.ReadSequence(folder.ManifestPath);
|
||||
// Another sequence's folder now (another index moved this one away and that one in): its pack is never opened.
|
||||
if (manifest.Id != sequence.Id) throw new InvalidOperationException(Loc.L("Errors.Archive.FolderMoved"));
|
||||
var companions = await GprCompanions.FindAsync(_db, archive, manifest.Frames, cancellationToken).ConfigureAwait(false);
|
||||
using var pack = ThumbPackWriter.Open(folder.ThumbsPackPath);
|
||||
for (var i = 0; i < startFrame && i < manifest.Frames.Count; i++)
|
||||
@@ -298,8 +301,8 @@ public sealed class ArchiveImages
|
||||
/// originals are decoded at once (<see cref="PassParallelism"/>), and a checkpoint still means that every frame before
|
||||
/// it has its proxy written (<see cref="OrderedWork{T}"/>). The pass works in batches (<see cref="ProxyBatch"/>), each
|
||||
/// under the thumbnail lease with the sequence's folder and sidecar read again; a folder that is not where the index
|
||||
/// has it (another index moved it, until this index's next scan) stops the pass with an
|
||||
/// <see cref="InvalidOperationException"/>, nothing written there.
|
||||
/// has it (another index moved it, until this index's next scan), or that holds another sequence now, stops the pass
|
||||
/// with an <see cref="InvalidOperationException"/>, nothing written there.
|
||||
/// </remarks>
|
||||
public async Task<ImagePassResult> BuildProxiesAsync(Archive archive, Sequence sequence, bool force, int startFrame,
|
||||
Func<int, int, ValueTask> checkpoint, CancellationToken cancellationToken = default)
|
||||
@@ -324,7 +327,7 @@ public sealed class ArchiveImages
|
||||
_writer.Options.LeaseDuration, cancellationToken).ConfigureAwait(false))
|
||||
{
|
||||
var folder = await SequenceWriter.FolderAsync(_db, paths, sequence, cancellationToken).ConfigureAwait(false);
|
||||
if (!Directory.Exists(folder.Folder)) throw new InvalidOperationException(Loc.L("Errors.Archive.FolderMoved"));
|
||||
if (!SequenceFolders.Holds(folder, sequence.Id)) throw new InvalidOperationException(Loc.L("Errors.Archive.FolderMoved"));
|
||||
var read = ManifestStore.ReadSequence(folder.ManifestPath);
|
||||
// Photos added, removed or renumbered since the last batch: what the earlier batches made may not be theirs.
|
||||
if (manifest is not null && !SameFrames(read.Frames, manifest.Frames, names: false)) complete = false;
|
||||
|
||||
Reference in new issue
Block a user