Skip to content

Bump librdkafka from 2.15.1 to 2.16.0 - #128315

Open
actueleai wants to merge 1 commit into
ClickHouse:masterfrom
actueleai:bump-librdkafka-v2.16.0
Open

actueleai wants to merge 1 commit into
ClickHouse:masterfrom
actueleai:bump-librdkafka-v2.16.0

Conversation

@actueleai

@actueleai actueleai commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Bump librdkafka from v2.15.1 to v2.16.0.

ClickHouse-side changes

  • contrib/librdkafka-cmake/HOW_TO_UPDATE.md — new 2.15.1 -> 2.16.0 section recording the carried patch set.

Fork

Carries the 16 ClickHouse patches (ClickHouse/librdkafka#25).

Changelog category (leave one):

  • Build/Testing/Packaging Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Update librdkafka from v2.15.1 to v2.16.0.


Workflow [PR]
Sync PR [sync-upstream/pr/128315]

The ClickHouse fork branch `ClickHouse/v2.16.0` (head 1dd451578aed) carries the
same patch series as 2.15.1, rebased onto the v2.16.0 tag without conflicts.

No ClickHouse-side adaptation was needed: v2.16.0 adds no source files under
`src/`, so the explicit source list in `contrib/librdkafka-cmake/CMakeLists.txt`
is unchanged, upstream `config.h.in` gains no new `WITH_*`/`HAVE_*` macros, and
the files behind the uncurlify patch (`src/rdhttp.[ch]`,
`src/rdkafka_sasl_oauthbearer_oidc.c`) are untouched upstream, so the
Poco-based `rdhttp_poco.c` needed no update. The cJSON files are also unchanged
between the two tags, so the `kafka_` prefix rename applied as is.

Co-Authored-By: Claude Code <[email protected]>
@thevar1able thevar1able added the can be tested Allows running workflows for external contributors label Oct 30, 2026
@clickhouse-gh

clickhouse-gh Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [dc1e2c4]

Summary: ❌

job_name test_name status info comment
Performance Comparison (arm_release, master_head, 4/6) FAIL Performance dashboard
prewhere_subcolumns #1 FAIL dashboard

AI Review

Summary

Updates librdkafka from 2.15.1 to 2.16.0. Two reproduced regressions in the imported revision block this upgrade: destruction can use an already-destroyed mutex, and metadata recovery can duplicate produced records despite retries=0.

Missing context / blind spots
  • ⚠️ Kafka-enabled ClickHouse builds and integration results were still pending in Praktika. Local validation used standalone builds of both dependency revisions; completed Kafka integration results would close this gap.
Findings

❌ Blockers

  • contrib/librdkafka:1 — shutdown barrier races cache destruction. In imported src/rdkafka.c:1251, rd_kafka_destroy_app sets RD_KAFKA_DESTROY_F_TERMINATE before entering the new metadata waiter barrier. The internal thread can observe the flag, exit, and destroy the cache mutex and condition variable first. A deterministic scheduling repro observes mtx_lock returning thrd_error on the destroyed mutex during ordinary producer destruction. Synchronize internal-thread teardown with the waiter drain before destroying these objects.
  • contrib/librdkafka:1 — recovery bypasses producer retry limits and duplicates records. Imported src/rdkafka.c:2307 now decommissions live brokers with produce acknowledgements outstanding. RD_KAFKA_RESP_ERR__DESTROY_BROKER reaches rd_kafka_handle_Produce_error, which assumes the records were not persisted and retries without incrementing the retry count. A mock regression repro with one send, retries=0, idempotence disabled, a delayed successful acknowledgement, and metadata recovery produces one record on 2.15.1 but two on 2.16.0. Preserve the possibly-persisted classification and honor the retry budget for sent requests.
Tests
  • ⚠️ Add focused regression coverage for the shutdown scheduling interleaving and for recovery while a successful produce acknowledgement is pending with retries=0. The local reproductions demonstrate both failures; existing imported tests miss these cases.
Final Verdict

❌ Block. Fix both dependency regressions and retain focused tests before advancing the submodule pointer.

@clickhouse-gh clickhouse-gh Bot added pr-build Pull request with build/testing/packaging improvement submodule changed At least one submodule changed in this PR. labels Oct 30, 2026
Comment thread contrib/librdkafka
@@ -1 +1 @@
Subproject commit c58ce6331fb871bfb4b15758cfd3283dd0a512fd
Subproject commit 1dd451578aed49ba05ce8d466095048dcd7ccaa7

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.

[P1] Keep the metadata mutex alive until the shutdown barrier completes

This revision adds rd_kafka_metadata_cache_wait_terminate after setting RD_KAFKA_DESTROY_F_TERMINATE (imported code). That flag independently lets the internal main thread exit and call rd_kafka_destroy_internal, which destroys the metadata cache mutex and condition variable. There is no synchronization preventing that destruction before the application thread enters the new barrier, so ordinary Kafka client destruction can lock a destroyed mutex; outstanding metadata calls can also race destruction of their synchronization objects.

A deterministic local repro pauses the application thread at the new barrier until the internal thread finishes, then observes mtx_lock returning thrd_error for the destroyed metadata mutex. Please synchronize the barrier with internal-thread teardown, or perform the waiter drain on that thread before destroying the cache, and include this shutdown interleaving in regression coverage.

Comment thread contrib/librdkafka
@@ -1 +1 @@
Subproject commit c58ce6331fb871bfb4b15758cfd3283dd0a512fd
Subproject commit 1dd451578aed49ba05ce8d466095048dcd7ccaa7

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.

[P1] Honor producer retry limits when recovery closes live brokers

The new rebootstrap path decommissions connected brokers, including in-flight Produce requests whose records may already be appended. Those requests fail with RD_KAFKA_RESP_ERR__DESTROY_BROKER, but rd_kafka_handle_Produce_error treats that as definitely unpersisted and sets incr_retry to zero. It therefore resends them even with retries=0, silently duplicating writes for non-idempotent producers.

Reproduced with one mock broker, enable.idempotence=false, retries=0, metadata.recovery.rebootstrap.trigger.ms=200, and a successful produce acknowledgement delayed by 5000 ms. Requesting topic metadata while that acknowledgement is pending triggers recovery: the old revision sends once and ends at offset watermark 1; this revision sends twice and ends at watermark 2, reporting successful delivery. Please classify already-sent requests as possibly persisted and honor the retry budget when decommissioning brokers, with a regression test for this case.

@clickhouse-gh clickhouse-gh Bot added the comp-external-dependencies Third-party deps updates in contrib/, vendored code, and platform base libraries. label Oct 31, 2026
@clickhouse-gh

clickhouse-gh Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing dc1e2c4a6 with master 2eafca8a6 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of cc5af2c4d; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

69 translation units recompiled, 20 s compile time in total, 69 of them have a recent master baseline.

Job report

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-external-dependencies Third-party deps updates in contrib/, vendored code, and platform base libraries. pr-build Pull request with build/testing/packaging improvement submodule changed At least one submodule changed in this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants