perf(acl,grpc-data): #1053 alloc-free warm UNS ACL decisions; unresolvable configured refs back off; restart keeps the comms latch (decided)
U-8: a warm cached decision on a UNS node allocated 416-680 B/call ahead of the cache (live id-chain list, identifier split, LINQ, segment array, string.Join key, DataCallerIdentity). Now 0 B: the live chain is cached per folder instance (re-verified against the live ancestry every call), the generation hands out one segment array per path, the authorizer keys its resolved cache keys on that array, reference variables key on their own identifier (scope = its split), and the caller identity is built once per session identity. R-25: ConfiguredProjectedInterestOwner re-ran discovery for an unresolvable configured reference every 1 s sweep forever; a failed resolve now backs off 1 s doubling to 30 s (60 s unreachable: 61 discoveries -> 6). Publishing into the source hub only for sources with interest is DECLINED: that cache answers a new subscription's first snapshot and projected Reads. Restart comms latch (decided: keep): the nodes stay Bad across an operator Restart and the respawned incarnation must re-publish them; the stopped child's PostStop announcement already re-latches and cancels the old audit. Pinned by test. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -137,10 +137,22 @@ public sealed class DataPlaneAuthoritySnapshot
|
||||
return false;
|
||||
}
|
||||
|
||||
unsSegments = path.Segments.Skip(1).ToArray();
|
||||
unsSegments = BelowRealm(path);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <paramref name="path"/>'s segments below the realm, computed once per path instance (#1053 / review U-8). A
|
||||
/// generation's paths are immutable and these lookups run per ACL decision on every UNS node, so the
|
||||
/// <c>Skip(1).ToArray()</c> they used to do allocated on every warm cached decision. Callers treat the result as
|
||||
/// read-only; the same instance is returned for the life of the path, which also lets the authorizer key its own
|
||||
/// per-placement cache on it.
|
||||
/// </summary>
|
||||
private static IReadOnlyList<string> BelowRealm(NodeAclPath path) =>
|
||||
BelowRealmCache.GetValue(path, static p => p.Segments.Skip(1).ToArray());
|
||||
|
||||
private static readonly System.Runtime.CompilerServices.ConditionalWeakTable<NodeAclPath, string[]> BelowRealmCache = new();
|
||||
|
||||
/// <summary>
|
||||
/// <c>UNS folder id → (its ACL path, its folder-id chain)</c> for every UNS Area, Line and Equipment in the
|
||||
/// artifact this generation was built from (Gitea #808). Keyed <c>OrdinalIgnoreCase</c> (identifier rule).
|
||||
@@ -225,7 +237,7 @@ public sealed class DataPlaneAuthoritySnapshot
|
||||
if (!string.Equals(scope.IdChain[i], liveIdChain[i], StringComparison.OrdinalIgnoreCase)) return false;
|
||||
}
|
||||
|
||||
unsSegments = scope.Path.Segments.Skip(1).ToArray();
|
||||
unsSegments = BelowRealm(scope.Path);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user