fix: keep render filing retryable and writers out of a folder another index moved
Third fix round of owner review 2, phase 4a (Reorganize), cross-cutting items. - Server render filing now runs under the sequence lease, so it can meet a busy sequence or an offline archive. Both completions (client render uploads and render-node results) used to answer 500 and leave the upload stuck in Committing until a restart. They now answer 503 sequence_busy or archive_offline, which clients retry. The upload goes back to receiving with its part file and the node keeps its job (UploadService.ReceiveAgainAsync). - Save both: when this PC's copy cannot be written (another index moved the folder), the server's version is no longer applied, even if this index's scan relocates the row before the apply would run. A copy that has to be dropped is deleted from where the folder is now, as a best effort. - Export rebase on a folder move (scan and Reorganize): the sequence's own export follows the folder unless its file is still at the old path and not at the new one. A file written into a re-created old folder therefore keeps a row that finds it, so the file is never stranded. - A render job refuses to start when its folder is not where the index has it, which also stops it from re-creating the old folder. Renders fetched by sync are now filed under the sequence lease into the current folder, or not at all (new string Errors.Archive.FolderMoved, en and it). - The proxy pass holds the thumbnail lease one batch at a time (a quarter of the lease wait), then lets it go for longer than a waiter's poll and reads the folder and sidecar again. Before, another process's Reorganize, sequence deletion or pack compaction could wait out its lease wait and fail. Updated the stale comments on that lease and ARCHITECTURE.md to match. Tests cover each fix, and each new test fails with its fix reverted. Also covered: proxy store and pass in a moved folder, RenderStore with the folder gone, Take server with the folder moved, and an editor save with the folder moved. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 811509d32a118ed50ad10d47d4b002e534da9d77)
This commit is contained in:
1 parent
0377040a19
commit
c3756d03c9
26 files changed
+666
-134
No files matched your search
@@ -21,7 +21,8 @@ namespace Chronos.Data.Processing.Jobs;
|
||||
/// server), named by the template without taking a name another render of this process is writing, and each finished
|
||||
/// output is recorded at once (its row id derives from the job and the entry, so every attempt knows what is recorded).
|
||||
/// Checkpoint: the entries recorded and the output being written, so a crashed attempt's leftovers are removed and only
|
||||
/// unfinished entries render again. A failed entry fails the job after the others ran; retrying renders it alone.
|
||||
/// unfinished entries render again. A failed entry fails the job after the others ran; retrying renders it alone. A
|
||||
/// sequence whose folder is not where the index has it (another index moved it, until this index's next scan) is refused.
|
||||
/// </summary>
|
||||
internal sealed class RenderJobHandler(ChronosDatabase db, ProcessingOptions options, FrameTiers tiers) : IJobHandler
|
||||
{
|
||||
@@ -40,6 +41,9 @@ internal sealed class RenderJobHandler(ChronosDatabase db, ProcessingOptions opt
|
||||
var paths = new ArchivePaths(archive.RootPath);
|
||||
ArchiveVolume.EnsureWritable(paths);
|
||||
var folder = paths.Sequence(sequence.Folder);
|
||||
// A folder another index moved is found by this index's next scan. Until then nothing renders: its photos would all be
|
||||
// stand-ins, and its outputs would create the old folder again.
|
||||
if (!Directory.Exists(folder.Folder)) throw new InvalidOperationException(Loc.L("Errors.Archive.FolderMoved"));
|
||||
// A server writes only inside its archive (BRIEF §14.2): an export folder chosen on a client means nothing there.
|
||||
if (options.Host == EncoderHost.Server) export = export with { Folder = null };
|
||||
var project = (parameters.SettingsJson is { } embedded ? ProjectStore.Parse(embedded) : ProjectStore.Read(sequence, folder)) with { Export = export };
|
||||
|
||||
Reference in new issue
Block a user