-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
409 Batch Completed & Pending-Messages/Bytes for Pull Consumers #212
Comments
|
not sure we should do a diff code in this stage. For 3.x I would really like to have different codes... |
|
Just to be clear about behavior. Given this:
Items 2, 3 and 4 are not affected by this new status. In looking at my code I don't need this new message. I have already handled the situation by :
For servers before 2.10 it has to be done this way. For 2.10 and later I could have different logic to not zero out and only rely on the status, but why bother when the above already works. But I do have to have code to specifically ignore this status, because it is a 409 and this makes the 3rd different behavior for 409s, which require checking the text to know which. In case you are wondering, I treat these as errors:
These as warnings:
And ignore this
|
@Jarema I'm still thinking about the case you said that we are being bytes centric and just needed to work it out. TLDR; I see that I need the Batch Complete Considering simplification and the pull request config at 12 message and 12000 bytes. So my tracking is now at 12 - 2 + 9 = 19 messages and 12000 - 3100 + 9000 - 17900 bytes. The server tracking has 2 pulls, one with 10/8900 and the 2nd with 9/9000 Let's say then 18 more messages come in, 9 to each pull, each 900 bytes. (Granted this will have triggered a 3rd maybe 4th pull, but ignore that for now...) Let's say then that the 2nd pull completes first with 9 messages of 8100 bytes. There were 900 bytes leftover, I won't zero out bytes because I still have more than 1 message, but if I don't track that 900, my byte count will be off by that much, which will affect the re-pull. |
So I guess the only question is, what do we do pre 2.10? I guess it will have to be "close enough for government work" :) |
Not a problem with simplification, but some situations that are always going to be a problem with [users] making multiple raw pulls.
One possible way to address this is by requiring all subsequent raw pulls to make sense. For instance once a pull turns on heartbeats, all subsequent pulls must have the same heartbeat. Once a pull uses max bytes all subsequent pulls have max bytes. Thinking about ways to handle this... Just erroring if a new pull is bad? Enforcing it at the api level and only every allowing 1 exact type of pull request? |
Overview
When
MaxBytes
is used in Pull Request, when the Pull Request finishes because it hitsMaxBytes
, clients do not know how many messages and bytes are pending.To address that, a new status has been added and will land with 2.10 release:
409 Batch Completed
With added information about not sent bytes and messages requested by Pull Request:
Nats-Pending-Bytes
- number of bytes that were still pending for that Pull RequestNats-Pending-Messages
- number of messages that were still pending for that Pull RequestThose two headers were also added to
408 Request Timeout
statuses and are available in 2.9.x.This allows clients, especially for JS Simplification, to calculate future Pull Request sizing accurately.
Relevant ADR will be issued.
Clients and Tools
Other Tasks
Implemented
Client authors please update with your progress. If you open issues in your own repositories as a result of this request, please link them to this one by pasting the issue URL in a comment or main issue description.
The text was updated successfully, but these errors were encountered: