[fix][fn] Honour negativeAckRedeliveryDelayMs in the Go function runtime - #26415
Merged
Conversation
The Go runtime negatively acknowledges on failure but never configured the redelivery delay, so the client default of 60 seconds applied regardless of what SourceSpec.NegativeAckRedeliveryDelayMs carried. Add resolveNackRedeliveryDelay and set NackRedeliveryDelay on all four ConsumerOptions in setupConsumer - the regex and non-regex branches of both the receiver-queue-size and default paths. The field is a proto3 scalar with no presence, so an unset value reads as 0. Only a positive value produces a duration; zero leaves ConsumerOptions at its zero value, which the client treats as unset. That matches the guard the Java runtime applies in JavaInstanceRunnable, and means a function that does not configure the delay is unaffected. Fixes apache#26409 Master Issue: apache#26404 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
nodece
approved these changes
Aug 24, 2026
david-streamlio
added a commit
to david-streamlio/pulsar
that referenced
this pull request
Aug 24, 2026
Resolves a conflict in pulsar-function-go/pf/instance.go with apache#26415 (negativeAckRedeliveryDelayMs), which landed on master and added resolveNackRedeliveryDelay at the same insertion point ahead of setupConsumer. Both helpers are kept. setupConsumer now resolves the subscription type through resolveSubscriptionType and the redelivery delay through resolveNackRedeliveryDelay, and all four Subscribe call sites carry both.
david-streamlio
added a commit
to david-streamlio/pulsar
that referenced
this pull request
Aug 24, 2026
Resolves a conflict in pulsar-function-go/pf/instance.go with apache#26415 (negativeAckRedeliveryDelayMs), which landed on master and added resolveNackRedeliveryDelay at the same insertion point ahead of setupConsumer. Both helpers are kept. setupConsumer now resolves the subscription type through resolveSubscriptionType and the redelivery delay through resolveNackRedeliveryDelay, and all four Subscribe call sites carry both.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #26409
Master Issue: #26404
Motivation
SourceSpec.negativeAckRedeliveryDelayMssets how long the broker waits before redelivering a negatively acknowledged message. The Go runtime negatively acknowledges on failure (instance.go:389-397,shouldNackInputOnFailure) but never configured the delay —NackRedeliveryDelaywas absent from everyConsumerOptionsit builds, so the client default of one minute always applied.A function configured for fast retry, or for a long back-off from a struggling downstream, silently got neither. The Java runtime applies it; the Python runtime has the same gap, with a fix open at #26413.
Modifications
Add
resolveNackRedeliveryDelayand setNackRedeliveryDelayon all fourConsumerOptionsinsetupConsumer— the regex and non-regex branches of both the receiver-queue-size path and the default path.The field is a proto3 scalar with no presence, so an unset value reads as
0. Only a positive value produces a duration; zero leavesConsumerOptionsat its zero value, which the client treats as unset. That matches the guardJavaInstanceRunnableapplies (if (sourceSpec.getNegativeAckRedeliveryDelayMs() > 0)) and means a function that does not configure the delay is unaffected.Note this touches the same function as #26414 (
retainOrdering/retainKeyOrdering), which is filed against a sibling issue under the same master issue. The two are independent — different fields, different lines — but whichever merges second will need a trivial rebase.Verifying this change
This change added tests and can be verified as follows:
pf/nackDelay_test.go: unset leaving the client default; milliseconds converted to a duration; a sub-second value preserved; and the client default expressed explicitly still round-tripping.resolveNackRedeliveryDelayreturn0unconditionally fails the suite.go build ./...and the fullgo test ./pf/pass;go vetreports the same three pre-existing lock-copy warnings as master and no new ones.Does this pull request potentially affect one of the following parts:
A Go function already deployed with
--negative-ack-redelivery-delaygets the configured delay on its next restart instead of the 60s default. That is the option taking effect for the first time, but it is a behaviour change for anyone who set it and adapted to it being ignored. A function that does not set it is unaffected.Documentation
doc-requireddoc-not-neededdocdoc-completeThe option is already documented; this makes the Go runtime honour it.