fix(grpc-data): H3 review round 3 nits b/c/d — no origin cursor stranded on Bad, scope moves or a serve-time throw
- b: ProjectedHistoryAccess releases the prior origin cursor on any Bad answer to a resumed node (and on a mismatched answer) — an unsent refusal left it open at the origin; idempotent. - c: DataConnectionDeploymentLease, when its scope moves while a history answer is in flight, releases the dropped answer's new continuations (best effort); resumed items are BadContinuationPointInvalid, fresh ones BadNoCommunication. - d: ProjectedHistoryRead: a throw while serving outcome i (FromClr on an unconvertible value, a store fault) releases outcome i's cursor unless the store already owns it, and every later outcome's. Each red on revert (mutation).
This commit is contained in:
+28
-1
@@ -443,6 +443,30 @@ public sealed partial class GrpcDataConfiguredDiscoveryWireTests
|
||||
}, localPermissions: 15, allowHistory: true, connectionSource: connections);
|
||||
}
|
||||
|
||||
[Fact(Timeout = 90000)]
|
||||
[Trait("Phase", "H3")]
|
||||
public async Task A_bad_answer_to_a_resume_releases_the_prior_origin_cursor()
|
||||
{
|
||||
// H3 review round 3 nit (b): the connection answered the resume Bad without sending it — the origin still holds page 1's
|
||||
// cursor; the consumer releases it (positive control: the store returns to 0).
|
||||
await using var originServer = await HistoryOrigin.StartAsync(7);
|
||||
using var origin = new LocalDataFixture(servingGeneration: 1, history: originServer.Port);
|
||||
var connections = new HistorySwitchConnections(origin);
|
||||
ProjectedHistoryAccess? history = null;
|
||||
await WithComposedServer(origin, origin.Raw, async (session, _, _, _, _, _, anchor) =>
|
||||
{
|
||||
var client = (SessionClient)session;
|
||||
await BrowseAll(client, anchor, 1);
|
||||
var page = await RawHistory(client, anchor, 2, default);
|
||||
origin.Services.HistoryOpenContinuations.ShouldBe(1);
|
||||
connections.Mode = HistoryMode.RefuseResumedUnsent;
|
||||
(await RawHistory(client, anchor, 2, page.ContinuationPoint)).StatusCode.Code.ShouldBe(StatusCodes.BadNoCommunication.Code);
|
||||
await AwaitReleases(history!, () => origin.Services.HistoryOpenContinuations == 0);
|
||||
origin.Services.HistoryOpenContinuations.ShouldBe(0, "the unconsumed prior cursor was released");
|
||||
connections.Mode = HistoryMode.Pass;
|
||||
}, localPermissions: 15, allowHistory: true, connectionSource: connections, onHistory: (h, _) => history = h);
|
||||
}
|
||||
|
||||
[Fact(Timeout = 90000)]
|
||||
[Trait("Phase", "H3")]
|
||||
public async Task An_origins_budget_refusal_is_a_per_node_answer_and_never_stops_the_request()
|
||||
@@ -509,7 +533,7 @@ public sealed partial class GrpcDataConfiguredDiscoveryWireTests
|
||||
}
|
||||
}
|
||||
|
||||
public enum HistoryMode { Pass, Hang, Throw, Retired, Poison, BudgetRefused, OriginRefusedFresh }
|
||||
public enum HistoryMode { Pass, Hang, Throw, Retired, Poison, BudgetRefused, OriginRefusedFresh, RefuseResumedUnsent }
|
||||
|
||||
/// <summary>
|
||||
/// One long-lived origin connection whose HISTORY path can be switched to never answer (then fault as a cancelled gRPC call,
|
||||
@@ -578,6 +602,9 @@ public sealed partial class GrpcDataConfiguredDiscoveryWireTests
|
||||
case HistoryMode.BudgetRefused:
|
||||
return request.Items.Select(i => new DataHistoryReadResult(i.CorrelationId, 0x80100000u, [], null,
|
||||
"History assembly budget exceeded.") { ConsumerBudgetRefused = true }).ToArray();
|
||||
case HistoryMode.RefuseResumedUnsent when request.Items.Any(i => i.Continuation is not null):
|
||||
// Answered Bad without the origin ever seeing the resume: its cursor is still open there.
|
||||
return request.Items.Select(i => new DataHistoryReadResult(i.CorrelationId, 0x80310000u, [], null)).ToArray();
|
||||
case HistoryMode.OriginRefusedFresh when request.Items.All(i => i.Continuation is null):
|
||||
// The ORIGIN's own refusal, whose text also mentions a budget (LocalDataServices.History).
|
||||
return request.Items.Select(i => new DataHistoryReadResult(i.CorrelationId, 0x80100000u, [], null,
|
||||
|
||||
Reference in New Issue
Block a user