C#: a rewrite keeps the catalog entry that publishes a record's schema as a compatible id
The single-file and directory writers dropped an entry whose own id no record carried, leaving a record under a compatible id with no catalog entry that publishes it: the same store nothing could open. An entry now stays while it publishes any id a record carries. The conditional-commit readability test over compatible-id-only-v3 pins it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b9ce601844
commit
2647f10d20
2 changed files with 3 additions and 2 deletions
|
|
@ -259,7 +259,7 @@ public sealed class DirectoryMessagePackBackingStore : CacheBackingStore
|
||||||
.ToArray();
|
.ToArray();
|
||||||
var usedSchemaIds = currentIndex.Values.Select(record => record.SchemaId).ToHashSet(StringComparer.Ordinal);
|
var usedSchemaIds = currentIndex.Values.Select(record => record.SchemaId).ToHashSet(StringComparer.Ordinal);
|
||||||
var targetCatalog = catalogCandidates
|
var targetCatalog = catalogCandidates
|
||||||
.Where(entry => usedSchemaIds.Contains(entry.SchemaId))
|
.Where(entry => usedSchemaIds.Contains(entry.SchemaId) || entry.CompatibleSchemaIds.Any(usedSchemaIds.Contains))
|
||||||
.OrderBy(entry => entry.SchemaName, StringComparer.Ordinal)
|
.OrderBy(entry => entry.SchemaName, StringComparer.Ordinal)
|
||||||
.ToArray();
|
.ToArray();
|
||||||
var keysToWrite = _dirtyKeys.Keys
|
var keysToWrite = _dirtyKeys.Keys
|
||||||
|
|
|
||||||
|
|
@ -3640,7 +3640,8 @@ namespace GameCult.Caching
|
||||||
SchemaCatalog = catalog
|
SchemaCatalog = catalog
|
||||||
.GroupBy(entry => entry.SchemaId, StringComparer.Ordinal)
|
.GroupBy(entry => entry.SchemaId, StringComparer.Ordinal)
|
||||||
.Select(group => group.First())
|
.Select(group => group.First())
|
||||||
.Where(entry => used.Contains(entry.SchemaId))
|
// An entry stays while it publishes a schema id some record carries, as its own id or a compatible one.
|
||||||
|
.Where(entry => used.Contains(entry.SchemaId) || entry.CompatibleSchemaIds.Any(used.Contains))
|
||||||
.OrderBy(entry => entry.SchemaName, StringComparer.Ordinal)
|
.OrderBy(entry => entry.SchemaName, StringComparer.Ordinal)
|
||||||
.ToArray(),
|
.ToArray(),
|
||||||
Records = ordered
|
Records = ordered
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue