nats-server
nats-server copied to clipboard
JetStream: incorrect consumer num_pending against stream with subjects ending in `.>`
Observed behavior
A new generic consumer reports more num_pending than actual messages in the stream.
Expected behavior
The consumer reports the correct num_pending.
Server version
2.10.10 or later. (Tested against 2.10.9 the information was reported correctly)
Steps to reproduce
Create a consumer against attached data, nats consumer create give it a name and all defaults. Look at the consumer info, it shows "Unprocessed Messages: 5,803". There are only 5670 messages.
Notes
All subjects end with .> (dot greater) as in OrchestrationStream_08fa7d3dcd644745bace255d2c76fbc2.>
Data
Originally reported as a discussion in the Java repo: https://github.com/nats-io/nats.net/discussions/905
Can this be re-produced against main?
Can this be re-produced against main?
I used the data with 2.10.17 the first time I was able to reproduce it. I only checked the older versions after Wally explained to me about stree and so I just tested starting with the version he suggested until I found the one it stopped working in.
Have figured out the problem. The stree Match was firing the callback twice for OrchestrationStream_08fa7d3dcd644745bace255d2c76fbc2.>, which had 133 messages, and 5803-133=5670. Posted a PR to fix it.