C#: a commit condition compares the id a record was loaded under with the file's, exactly
Each stored document carries StoredSchemaId: the id its record sits under in its store, the one it was loaded under until a write puts it under its type's own id. Expect, ExpectUnchanged, the reload and merge identity checks compare (StoredSchemaId, storedAt) with the store's bytes exactly. CanonicalSchemaId is deleted: canonicalising the disk id let an older version's whole-view rewrite (same storedAt, restamped to its own id, a member shed) pass a newer cache's condition (Soul F1), and failed every condition on a record resolved by name or through a file entry listing the local id (F3). A whole-view write marks every record it wrote as stored under its type's id, in the store and the cache. Tests: Soul's rolling-deploy probe as AWholeViewRewriteByAnOlderVersionFails... (Mismatch for Expect and ExpectUnchanged, nothing derived lands, a pull shows the rewrite and the retry commits); F3's H1, H1b, H2 pass Expect and ExpectUnchanged when nothing changed; conditions after a whole-view commit hold for a plain record and a variant. BareDeck is emitted at run time (EmittedDocumentTypes) so the shared registry never sees it beside DeclaringDeck; the CanonicalSchemaId tests and their Claimant fixtures go with the function. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c99f29c309
commit
5c8af219f9
4 changed files with 324 additions and 96 deletions
|
|
@ -109,7 +109,7 @@ public sealed class DirectoryMessagePackBackingStore : CacheBackingStore
|
|||
.Where(pair => !Staged(pair.Key) &&
|
||||
(!Entries.TryGetValue(pair.Key, out var existing) ||
|
||||
existing.StoredAt != pair.Value.StoredAt ||
|
||||
existing.Descriptor.SchemaId != pair.Value.Descriptor.SchemaId))
|
||||
existing.StoredSchemaId != pair.Value.StoredSchemaId))
|
||||
.Select(pair => pair.Value)
|
||||
.ToArray();
|
||||
var departed = _hydratedKeys
|
||||
|
|
@ -178,7 +178,7 @@ public sealed class DirectoryMessagePackBackingStore : CacheBackingStore
|
|||
if (commitLease == null)
|
||||
return CultCommitOutcome.Contended;
|
||||
var manifest = ReadManifest();
|
||||
if (!request.ConditionsHold(manifest.Records, Entries.Values, Registry.CanonicalSchemaId))
|
||||
if (!request.ConditionsHold(manifest.Records, Entries.Values))
|
||||
return CultCommitOutcome.Mismatch;
|
||||
|
||||
var previousEntries = Entries.ToDictionary(pair => pair.Key, pair => pair.Value, StringComparer.Ordinal);
|
||||
|
|
|
|||
Loading…
Reference in a new issue