Skip to content

Conversation

@sergeimam
Copy link
Contributor

@sergeimam sergeimam commented Oct 9, 2025

As per #980 added explicit verification of the consumer sequence for an ordered consumer

@sergeimam sergeimam force-pushed the ordered-consumer-sequence-verification-fix branch from cb1813e to a34811b Compare October 10, 2025 14:14
Copy link
Member

@mtmk mtmk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @sergeimam looks good. Just a comment about the concern you raised regarding a potential infinite loop when using max-bytes option. let me know what you think.

@sergeimam sergeimam marked this pull request as ready for review October 20, 2025 13:30
Copy link
Member

@mtmk mtmk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks @sergeimam


// Assert
Assert.True(result);
Assert.Equal(2, Interlocked.CompareExchange(ref _result, 0, 0));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated test fix. rarely we get an error here. guessing potential race on the result bool.

@mtmk mtmk requested a review from scottf October 28, 2025 13:22
}
finally
{
var deleted = await TryDeleteConsumer(_fetchConsumerName, cancellationToken);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you care if the delete succeeds? It should be ephemeral anyway. The key is to always generate an ordered consumer name. We agreed that the user can provide a prefix for ordered consumer names, which will allow them to be found more easily in logs

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_fetchConsumerName is kept around to delete the ephemeral when we finish with it just to be a good citizen. so if we couldn't delete it this time round and there is another fetch we try our best to delete again potentially. I don't think prefix feature is implemented in this client.

Copy link
Contributor

@scottf scottf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mtmk mtmk merged commit 0d1194b into nats-io:main Oct 29, 2025
22 of 25 checks passed
mtmk added a commit that referenced this pull request Dec 11, 2025
* Add prioritized mode (#1011)
* Add Publish Timeout on Disconnect (#1001)
* Fix test flap (#1012)
* Add test to promote mirrored to regular stream (#1008)
* Add Nats-Expected-Last-Subject-Sequence-Subject (#1007)
* Fix keyed NATS clients with configurations (#1006)
* ensure NatsConnectionPool cannot overflow (#1005)
* Fix stream config adjustments on update (#995)
* Handel Unobserved Exceptions During Connection State Transitions (#999)
* Added verification of the consumer sequence number for pull ordered consumers (#981)
* Fix build warnings (#991)
* Reduce closure allocations (#988)
@mtmk mtmk mentioned this pull request Dec 11, 2025
mtmk added a commit that referenced this pull request Dec 11, 2025
* Add prioritized mode (#1011)
* Add Publish Timeout on Disconnect (#1001)
* Fix test flap (#1012)
* Add test to promote mirrored to regular stream (#1008)
* Add Nats-Expected-Last-Subject-Sequence-Subject (#1007)
* Fix keyed NATS clients with configurations (#1006)
* ensure NatsConnectionPool cannot overflow (#1005)
* Fix stream config adjustments on update (#995)
* Handel Unobserved Exceptions During Connection State Transitions (#999)
* Added verification of the consumer sequence number for pull ordered consumers (#981)
* Fix build warnings (#991)
* Reduce closure allocations (#988)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An ordered consumer has no internal check for the sequence numbers in ConsumeAsync

3 participants