fix(grpc-data): maxAge=0 projected reads served from an awaited origin read; origin refusals are access denials; Write/CreateMonitoredItems renew lapsed leases (#938, #939, #940)
#938: OtOpcUaNodeManager implements IReadAsyncNodeManager. A projected Value read whose maxAge the cache cannot satisfy (0 always: Part 4 "read the source"; ScadaBridge's DCL and the Client CLI send 0) is served from IProjectedDataAccess.ReadNowAsync in the same request — same unary admission, authenticated freshness-checked read and cache publication as ScheduleRead, pumped through the unary budget, at most 5 s / request deadline − 250 ms, no Lock, no blocked thread. A lapsed lease is renewed first and read in the same request. Previously every maxAge=0 read answered BadWaitingForInitialData forever. #939: RemoteNamespaceResolver.RenewExactOutcomeAsync reports Renewed/Refused/Failed. Refused only for the origin's verdict (PERMISSION_DENIED call, Denied item, Metadata not granted, operation not granted / not writable) ⇒ BadUserAccessDenied, held 5 s per node+operation unsent; transport and other failures stay retryable. HistoryRead follows it. #940: RenewLapsed accepts Write (gated on the local write role) and Subscribe. WriteAsync awaits the renewal (≤ 4 s, ≤ half the timeout hint) then dispatches, BadResourceUnavailable unsent otherwise. CreateMonitoredItems awaits renewals once per request (ICreateMonitoredItemsAsyncNodeManager) and classifies each projected item PER ITEM outside Lock (lapse ⇒ BadResourceUnavailable, refusal ⇒ BadUserAccessDenied) — a refusal thrown from the item manager used to fault the whole request. Red/green: 15 wire tests in GrpcDataProjectedOriginAccessWireTests (12 red on the pre-fix source, controls green both ways); 4 existing tests updated where the first read is now Good. Evidence: docs/plans/evidence/grpc-data-ext/938-939-940-948.md.
This commit is contained in:
+27
-13
@@ -94,19 +94,29 @@ unavailable until valid authority can be established.
|
||||
`MetadataLeaseMilliseconds` keeps its retained proof; the lease is only *lapsed* when its time ran
|
||||
out or its route was replaced while the local catalog authority, mapping binding and cache
|
||||
generation are all still current and nothing revoked it. On a refused value Read / attribute Read /
|
||||
HistoryRead of such a node, the consumer first authorizes the caller against the lapsed subject
|
||||
(local grant + mapping bit, everything but the lease). A caller without the grant is still
|
||||
HistoryRead / Write / CreateMonitoredItems (the last two since #940) of such a node, the consumer first
|
||||
authorizes the caller against the lapsed subject (local grant + mapping bit, everything but the lease;
|
||||
a write also needs this node's local write role). A caller without the grant is still
|
||||
`BadUserAccessDenied` and nothing is sent to the origin. A granted caller gets the same exact
|
||||
`GetMetadata` renewal as above, for the operation it is performing (Read / HistoryRead bit, not
|
||||
Subscribe), one per node and operation at a time, with a 250 ms back-off after a failure. On-demand
|
||||
`GetMetadata` renewal as above, for the operation it is performing (its Read / HistoryRead / Write /
|
||||
Subscribe bit), one per node and operation at a time, with a 250 ms back-off after a failure. On-demand
|
||||
renewals never touch the unary budget (cold reads, writes) or the browse/subscription-renewal fetch
|
||||
slots: they queue (at most 64) for their own pool of `max(1, maxConcurrentFetches / 2)` origin calls,
|
||||
reserve 256 KiB each, and have 3 s end to end, so a batch of N lapsed nodes renews all N:
|
||||
|
||||
- **Value Read** answers `BadWaitingForInitialData` (as a cold read does) while the renewal runs off
|
||||
the request thread; once it commits, a read is scheduled so the client's retry is served from the
|
||||
fresh sample. `BadResourceUnavailable` while a renewal cannot be started (capacity, back-off).
|
||||
- **Value Read** awaits the renewal within the request (#938; the async Read, no `Lock`, at most
|
||||
5 s together with the origin read that follows) and is then served from an origin read. A renewal
|
||||
still running at the deadline answers `BadWaitingForInitialData` (as a cold read does);
|
||||
`BadResourceUnavailable` while a renewal cannot be started (capacity, back-off) or failed.
|
||||
A non-Value attribute of a lapsed node answers `BadResourceUnavailable` while it renews.
|
||||
- **Write** (#940) awaits the renewal (at most 4 s, and at most half the request's timeout hint)
|
||||
and is then dispatched. A renewal that cannot complete or start answers `BadResourceUnavailable`
|
||||
with nothing sent to the origin.
|
||||
- **CreateMonitoredItems** (#940) awaits the renewal of its lapsed Value items once per request (at
|
||||
most 4 s, async, no `Lock`) and then creates them. An item still not acquirable is answered PER
|
||||
ITEM — `BadResourceUnavailable` for a lapse the caller is granted, `BadUserAccessDenied` for a real
|
||||
refusal. (Before, a refused projected item was thrown from the item manager and faulted the whole
|
||||
CreateMonitoredItems request.)
|
||||
- **HistoryRead** renews within the request and is then served. The wait (one per batch, at most 4 s
|
||||
and never past `HistoryReadDeadline`, no node-manager `Lock` held, the request's cancellation
|
||||
honoured) takes one of the non-local history batch slots first. A batch that finds none free does
|
||||
@@ -116,13 +126,17 @@ reserve 256 KiB each, and have 3 s end to end, so a batch of N lapsed nodes rene
|
||||
- **Browse:** a cached page past half its lease is served as is *and* refreshed in the background
|
||||
(one refresh per page key), so a re-browse renews the leases of the nodes it lists.
|
||||
|
||||
An origin that stopped granting the operation fails the renewal; the consumer then keeps answering
|
||||
the retryable status (it cannot tell that from an unreachable origin).
|
||||
**An origin refusal is an access denial (#939).** The renewal reports why it did not commit. A
|
||||
definitive refusal BY THE ORIGIN — the call answered `PERMISSION_DENIED`, the item answered `Denied`,
|
||||
the principal no longer holds Metadata, or the returned metadata no longer grants the operation (for a
|
||||
write: or is no longer writable) — is answered `BadUserAccessDenied` and held for 5 s
|
||||
(`ProjectedDataAccess.LapseRefusalHold`) per node and operation, during which the node is refused
|
||||
without another origin call; after it the next request asks the origin again. Everything else (an
|
||||
unreachable, unready or non-primary origin, an `Unauthenticated` call, capacity, a timeout, a changed
|
||||
shape) stays retryable with the 250 ms back-off. HistoryRead follows the same rule.
|
||||
|
||||
Not covered yet: a **Write** or **CreateMonitoredItems** on a lapsed node is still refused
|
||||
`BadUserAccessDenied` (neither starts a renewal; a re-browse, a Read or a HistoryRead of the node
|
||||
renews it, after which they succeed). A lease that was revoked (`Invalidate`), a removed mapping and a
|
||||
retired node are refusals, not lapses, and are never renewed.
|
||||
A lease that was revoked (`Invalidate`), a removed mapping and a retired node are refusals, not
|
||||
lapses, and are never renewed.
|
||||
|
||||
An authorized logical monitored-item request can survive a physical stream expiry and seek a new
|
||||
pinned binding with bounded retries. The old binding and any queued sample evidence remain tied to
|
||||
|
||||
Reference in New Issue
Block a user