fix(grpc-data): #1102 a client-filter suppression made against an in-flight value's old baseline is re-considered at its commit
The filter compares a newer source version against the last COMMITTED value, but the reader may hold an earlier value past IsEligible and not yet committed. A tick in that window dropped a newer value equal to the old baseline; the earlier value then committed and the client held it until the source changed again. The worker now records the version it suppressed (cleared when a later version is queued). ValueDelivery.OnCommit, committing a value older than that, rewinds LastConsidered and marks the source dirty so the next tick re-evaluates against the new baseline. Pre-existing (predates #1098); independent of shared serving. Tests (GrpcData1102FilterBaselineTests) park the in-flight value at the reader's pre-commit seam and run the tick that considers the newer version to completion: value-equal and deadband cases fail without the fix ([2] instead of [2, 1]); a control pins that a queued newer value is still delivered exactly once.
This commit is contained in:
+9
@@ -143,6 +143,15 @@ internal sealed partial class DataSubscriptionSession
|
||||
item.LastPublished = owned.Version;
|
||||
var now = session._services.Clock.GetTimestamp();
|
||||
item.LastDeliveryTimestamp = now; item.NextDue = session.DueFor(now, item.Settings);
|
||||
// #1102: a newer version was suppressed while this value was in flight, against the baseline this commit just
|
||||
// replaced. If it equals the OLD baseline it was dropped, and without this the client would hold this
|
||||
// superseded value until the source changed again. Re-consider the source against the new baseline.
|
||||
if (item.SuppressedVersion > owned.Version)
|
||||
{
|
||||
item.SuppressedVersion = 0;
|
||||
if (item.LastConsidered > owned.Version) item.LastConsidered = owned.Version;
|
||||
session.MarkDirty(item.View.Source); session.QueueTick();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,6 +112,12 @@ internal sealed partial class DataSubscriptionSession : IDataSubscriptionTranspo
|
||||
internal IDisposable? BaselineCharge;
|
||||
internal SourceTicket? Ticket;
|
||||
internal long LastConsidered, LastPublished, NextDue = 0;
|
||||
/// <summary>
|
||||
/// #1102: the newest version the client filter suppressed on the worker, 0 once a later version was queued. The
|
||||
/// filter compares against the COMMITTED baseline, so a value still in flight (dequeued, not yet committed) can
|
||||
/// commit after it and make that suppression wrong; the commit re-considers the source then (see ValueDelivery).
|
||||
/// </summary>
|
||||
internal long SuppressedVersion;
|
||||
internal long? LastDeliveryTimestamp;
|
||||
internal long? QueuedDue;
|
||||
internal LinkedListNode<ulong>? WaitingNode;
|
||||
@@ -1094,7 +1100,8 @@ internal sealed partial class DataSubscriptionSession : IDataSubscriptionTranspo
|
||||
return;
|
||||
}
|
||||
item.LastConsidered = read.Sample.Version;
|
||||
if (!item.Filter.ShouldDeliver(read.Sample, item.Settings)) return;
|
||||
if (!item.Filter.ShouldDeliver(read.Sample, item.Settings)) { item.SuppressedVersion = read.Sample.Version; return; }
|
||||
item.SuppressedVersion = 0; // a queued newer value supersedes whatever an in-flight commit would re-consider
|
||||
}
|
||||
var version = read.Sample.Version;
|
||||
var delivery = MakeValue(item, read.Sample, read.ReceivedTimestamp, false, null, read: read);
|
||||
|
||||
Reference in New Issue
Block a user