Skip to content

chipingress/batch: add WithNoAck option - #2491

Merged
pkcll merged 2 commits into
infoplat-19548-producenoackfrom
chipingress-batch-with-noack
Oct 26, 2026
Merged

pkcll merged 2 commits into
infoplat-19548-producenoackfrom
chipingress-batch-with-noack

Conversation

@pkcll

@pkcll pkcll commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

INFOPLAT-19548

Stacked on #2478 (base is that PR's branch; review only the last commit). Will retarget to main once #2478 merges.

What

  • batch.WithNoAck(): makes the batch client send batches with PublishBatchNoAck (server-side Kafka acks=0) instead of PublishBatch. This is the deferred follow-up listed in PublishBatchNoAck client side #2478.
  • The option only selects the RPC. Batching, size-based splitting, maxPublishTimeout, the PublishOptions on the request, positional per-event results and PublishError codes are unchanged, so callbacks behave exactly as with PublishBatch. A nil callback error means the server validated the event and handed it to its producer, not that it was persisted (documented on the option).
  • Metrics: NoAck clients tag send_requests_total, request_latency_ms and config.info with no_ack=true, so hand-off latency is not mixed into acked latency. The attribute is omitted for acked clients, so existing series keep their label set. The four metric descriptions that said "PublishBatch" now say "Batch publish".

Why

  • batch.Client is the shared buffering client and always called acked PublishBatch, so loss-tolerant callers (OTI migration) could not use the new RPC through it.

Testing

  1. cd pkg/chipingress && go test ./... -race -count=3 (pass).
  2. New batch/client_noack_test.go: routing (NoAck never calls PublishBatch and the reverse for the default), identical request incl. transaction_enabled, per-event results by position with the same error codes, result-count mismatch still reported, transport error / Unimplemented fails every callback with no fallback, size-based split issues multiple PublishBatchNoAck calls, and no_ack present only for NoAck clients.
  3. Mutation-checked: ignoring the option, or emitting no_ack=false for acked clients, fails the new tests.

Notes

  • Depends on the server returning the same positional results as PublishBatch for PublishBatchNoAck (the PublishBatchNoAck client side #2478 proto contract). An empty response would surface as RESULTS_MISMATCH on every event; that is deliberately not worked around client-side.
  • No automatic fallback to PublishBatch on Unimplemented: servers that predate the RPC fail the batch with the existing error log and send_requests_total{status="failure"}. Roll the server out first.
  • WithNoAck can be combined with WithTransactionEnabled(true) client-side; what all-or-nothing means under acks=0 is a server-side definition not covered here.
  • Per-message NoAck is out of scope (one batch maps to one RPC); use two clients if a caller needs both modes.
  • Draft commit is unsigned; it will be signed at the ready-for-review step.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

✅ API Diff Results - github.com/smartcontractkit/chainlink-common/pkg/chipingress

✅ Compatible Changes (1)

batch (1)
  • WithNoAck — ➕ Added

📄 View full apidiff report

Add batch.WithNoAck(), which makes the batch client send batches with
PublishBatchNoAck instead of PublishBatch. The option only selects the RPC:
batching, splitting, timeouts, per-event results and error codes are
unchanged. A nil callback error means the server validated the event and
handed it to its producer, not that it was persisted.

Servers that predate PublishBatchNoAck fail the batch with Unimplemented;
there is no fallback to PublishBatch.

NoAck clients tag send_requests_total, request_latency_ms and
config.info with no_ack=true. The attribute is omitted for acked clients
so their existing series keep their label set.
@pkcll
pkcll force-pushed the chipingress-batch-with-noack branch from 9c0b069 to 669bab1 Compare October 22, 2026 21:02
Use require for error assertions (testifylint) and drop a redundant
PublishErrorCode conversion (unconvert).
@pkcll
pkcll marked this pull request as ready for review October 23, 2026 04:36
@pkcll
pkcll requested a review from a team as a code owner October 23, 2026 04:36
@pkcll
pkcll merged commit 4fbcc63 into infoplat-19548-producenoack Oct 26, 2026
17 of 18 checks passed
@pkcll
pkcll deleted the chipingress-batch-with-noack branch October 26, 2026 12:47
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.

1 participant