Skip to content

out_rdkafka2: Fix rdkafka patch version dispatch - #578

Merged
kenhys merged 1 commit into
fluent:masterfrom
Watson1978:rdkafka-patch-dispatch
Sep 1, 2026
Merged

out_rdkafka2: Fix rdkafka patch version dispatch#578
kenhys merged 1 commit into
fluent:masterfrom
Watson1978:rdkafka-patch-dispatch

Conversation

@Watson1978

Copy link
Copy Markdown
Contributor

>= 0.14.0 was tested before >= 0.16.0, so 0_16_0 has never been loaded since it was added. 0.12.1 through 0.13.x matched no branch at all, where producer.close(10) raises ArgumentError on shutdown. The chain now runs from the newest version down and ends with else.

0.13 is built differently from 0.12 — Rdkafka::Producer::Client became Rdkafka::NativeKafka — so 0_13_0 is added instead of reusing 0_12_0.

0_16_0 needed two fixes now that it is reachable: the retun typo, and Producer#close returning the Hash from @topics_refs_map.clear rather than whether the producer closed in time.

The elsif chain tested `>= 0.14.0` before `>= 0.16.0`, so the 0_16_0
patch has been unreachable since it was added and 0.16.0 or later kept
using the 0_14_0 one. The 0.12.x arm matched 0.12.0 exactly, which left
0.12.1 through 0.13.x with no patch at all, where `producer.close(10)`
raises ArgumentError on shutdown.

- Order the chain from the newest version down and end it with else, so
  every version lands on exactly one patch
- Add 0_13_0 for 0.13.x, where Rdkafka::Producer::Client became
  Rdkafka::NativeKafka. 0_12_0 cannot cover it: Producer has no @client
  there, and reopening the missing Producer::Client defines an empty
  class rather than raising NameError, so the rescue does not catch it
- Fix the `retun` typo in 0_16_0, which is now reachable
- Return whether the producer closed in time from 0_16_0, instead of
  the Hash that @topics_refs_map.clear returns

Signed-off-by: Shizuo Fujita <fujita@clear-code.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
@Watson1978
Watson1978 requested a review from kenhys September 1, 2026 06:57

@kenhys kenhys left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

@kenhys
kenhys merged commit 4fcafc9 into fluent:master Sep 1, 2026
32 checks passed
@Watson1978
Watson1978 deleted the rdkafka-patch-dispatch branch September 2, 2026 02:09
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.

2 participants