Versions: moving a file whose version key is too long, onto a name whose key fits, can lose the source to a racing save #944

Closed
opened 2026-10-16 22:12:08 +00:00 by Cordy · 1 comment
Owner

Found in the fix-922 Task 6 re-review (2026-10-17).

What happens:

  1. Since #922, a move first records the source file if it has no record.
  2. When the source's version key would be longer than the limit (87 bytes for the name part), that record cannot be made. The move then goes ahead unrecorded, as R3 allows.
  3. If a save to the destination on another Cairn instance passed its check before the move and publishes after it, the source content is lost.

This is deterministic: it follows from the name, not from a fault. The usual case is a long source name moved to a shorter one.

Possible fix: when the source key is too long but the destination key fits, take the source's snapshot directly in the destination's chain. Keep R10 in mind: a failed move must not leave a destination version that someone else still relies on deleted.

To do: decide, then add a twin test with a long source name and a short destination name.

Found in the fix-922 Task 6 re-review (2026-10-17). **What happens:** 1. Since #922, a move first records the source file if it has no record. 2. When the source's version key would be longer than the limit (87 bytes for the name part), that record cannot be made. The move then goes ahead unrecorded, as R3 allows. 3. If a save to the destination on another Cairn instance passed its check before the move and publishes after it, the source content is lost. This is deterministic: it follows from the name, not from a fault. The usual case is a long source name moved to a shorter one. **Possible fix:** when the source key is too long but the destination key fits, take the source's snapshot directly in the destination's chain. Keep R10 in mind: a failed move must not leave a destination version that someone else still relies on deleted. **To do:** decide, then add a twin test with a long source name and a short destination name.
Author
Owner

Research for batch 8 (2026-11-12): this is already fixed in v0.6.401 by commit d0153f94c (st742 task t11). A file with no record and a too-long key now takes the recorded-copy path (longSource, versions.go:1942 at aad4ca91): the moved content is in the destination's chain before it is visible there. The 944 tests pass on main across posix, s3 and encrypt variants, and fail with the fix disabled. Only reachable with two processes on one storage, which the start lock refuses today.

Decision (Nikola): close as fixed. Batch 8 (v0.6.408) adds the untested branches (long-source fallback when the destination record fails; both keys too long). Residual: when both keys are too long the move stays unrecorded (a racing save there is itself refused).

Research for batch 8 (2026-11-12): this is **already fixed in v0.6.401** by commit d0153f94c (st742 task t11). A file with no record and a too-long key now takes the recorded-copy path (`longSource`, versions.go:1942 at aad4ca91): the moved content is in the destination's chain before it is visible there. The 944 tests pass on main across posix, s3 and encrypt variants, and fail with the fix disabled. Only reachable with two processes on one storage, which the start lock refuses today. Decision (Nikola): close as fixed. Batch 8 (v0.6.408) adds the untested branches (long-source fallback when the destination record fails; both keys too long). Residual: when both keys are too long the move stays unrecorded (a racing save there is itself refused).
Cordy closed this issue 2026-11-12 23:48:42 +00:00
Sign in to join this conversation.
No labels
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#944
No description provided.