feat(batch15): complete group 6 msgblock/consumerfilestore

This commit is contained in:
Joseph Doherty
2026-02-28 18:34:28 -05:00
parent 854f410aad
commit cfddfc9084
10 changed files with 720 additions and 45 deletions

View File

@@ -175,6 +175,59 @@ public sealed partial class ConcurrencyTests1
}
}
[Fact]
public void NoRaceJetStreamConsumerDeleteWithFlushPending_ShouldSucceed()
{
WithStore((fs, _) =>
{
const int consumerCount = 100;
var errors = new ConcurrentQueue<Exception>();
var ts = DateTimeOffset.UtcNow.ToUnixTimeSeconds() * 1_000_000_000L;
var workers = new List<Task>(consumerCount);
for (var i = 0; i < consumerCount; i++)
{
var consumer = fs.ConsumerStore(
$"flush-del-{i}",
DateTime.UtcNow,
new ConsumerConfig { AckPolicy = AckPolicy.AckExplicit });
workers.Add(Task.Run(() =>
{
var updater = Task.Run(() =>
{
for (ulong n = 1; n <= 50; n++)
{
try
{
consumer.UpdateDelivered(n, n, 1, ts + (long)n);
}
catch (Exception ex) when (ReferenceEquals(ex, StoreErrors.ErrStoreClosed))
{
break;
}
}
});
Thread.Sleep(1);
try
{
consumer.Delete();
updater.Wait();
}
catch (Exception ex)
{
errors.Enqueue(ex);
}
}));
}
Task.WaitAll(workers.ToArray());
errors.ShouldBeEmpty();
});
}
[Fact] // T:2441
public void NoRaceJetStreamFileStoreLargeKVAccessTiming_ShouldSucceed()
{