Support ADR 50 Fast Ingest with constants - #1628
Conversation
|
Claude finished @scottf's task in 2m 3s —— View job PR Review
SummaryThis is a pure constants PR — no logic, no thread-safety or exception-handling concerns, and no security issues. The additions are well-organised and the comments are helpful. Three observations worth verifying against ADR 50 / the server spec:
None of these block correctness if the values match the server — they're documentation/completeness concerns. |
| // Values for NATS_BATCH_COMMIT_HDR. | ||
| // STORE commits the batch and stores the final message. | ||
| // EOB commits the batch without storing the final message. Server 2.14+ | ||
| String NATS_BATCH_COMMIT_STORE = "1"; |
There was a problem hiding this comment.
The value "1" for NATS_BATCH_COMMIT_STORE is not immediately obvious. Could this be a boolean-ish wire value (1 = true/store)? A brief comment noting the exact wire format or a link to the ADR/spec would help future readers — the name implies "store" but the value doesn't make that self-evident.
There was a problem hiding this comment.
Good instinct - "1" is exactly a boolean true. Expanded the comment block above the constants: the header's presence marks the commit message, the value selects the mode, and "1" is the original 2.12 value from before eob existed. Skipped an ADR link since no other constant in this file carries one.
| int JS_ATOMIC_PUBLISH_MISSING_SEQ = 10175; | ||
| int JS_ATOMIC_PUBLISH_INCOMPLETE_BATCH = 10176; | ||
| int JS_ATOMIC_PUBLISH_UNSUPPORTED_HEADER = 10177; | ||
| int JS_ATOMIC_PUBLISH_INVALID_BATCH_ID = 10179; |
There was a problem hiding this comment.
Error code 10178 is missing between JS_ATOMIC_PUBLISH_UNSUPPORTED_HEADER (10177) and JS_ATOMIC_PUBLISH_INVALID_BATCH_ID (10179). Similarly, 10180–10198 are skipped before 10199. If these are intentionally unhandled by the client (server-internal or reserved), a brief comment would prevent future contributors from wondering if they were accidentally omitted.
There was a problem hiding this comment.
10178 is JSConsumerPushWithPriorityGroupErr (push consumers + priority groups), not a batch error, so it's correctly absent - same for most of 10180-10197.
But checking that range turned up 10198 JSMirrorWithAtomicPublishErr, which is ours and was missing. Added as JS_MIRROR_WITH_ATOMIC_PUBLISH.
Not annotating the remaining gaps: this is a curated set of batch-publish codes, not a contiguous range, and comments about other features' codes would rot here.
| int JS_BATCH_PUBLISH_INVALID_PATTERN = 10206; | ||
| int JS_BATCH_PUBLISH_INVALID_BATCH_ID = 10207; | ||
| int JS_BATCH_PUBLISH_UNKNOWN_BATCH_ID = 10208; | ||
| int JS_BATCH_PUBLISH_TOO_MANY_INFLIGHT = 10211; |
There was a problem hiding this comment.
Code 10209 is absent in both the atomic and batch-publish error groups. JS_BATCH_PUBLISH_TOO_MANY_INFLIGHT jumps from 10208 to 10211 (10209/10210 are already taken by atomic publish). Intentional? If so, a comment helps. If not, it may indicate a missing constant.
There was a problem hiding this comment.
Correct, though not for the stated reason - 10209 is JSMirrorWithBatchPublishErr, not a code taken by atomic publish. Added as JS_MIRROR_WITH_BATCH_PUBLISH, alongside its atomic twin 10198.
Both come from ADR-50's "Mirrors and Sources" section; I'd pulled error codes from the publish path only and missed the stream-config ones. The full set now matches every batch/atomic code in the server's errors.json - 16 of 16, verified programmatically.
No description provided.