@platformatic/rdkafka 4.0.0 → 4.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. package/README.md +5 -5
  2. package/bench/seed.sh +0 -0
  3. package/binding.gyp +3 -3
  4. package/ci/prepublish.js +4 -3
  5. package/ci/update-version.js +123 -0
  6. package/config.d.ts +126 -10
  7. package/configure +0 -0
  8. package/deps/librdkafka/.semaphore/run-all-tests.yml +77 -0
  9. package/deps/librdkafka/.semaphore/semaphore-integration.yml +250 -0
  10. package/deps/librdkafka/.semaphore/semaphore.yml +67 -44
  11. package/deps/librdkafka/.semaphore/verify-linux-packages.yml +41 -0
  12. package/deps/librdkafka/CHANGELOG.md +471 -1
  13. package/deps/librdkafka/CONFIGURATION.md +29 -9
  14. package/deps/librdkafka/INTRODUCTION.md +909 -601
  15. package/deps/librdkafka/Makefile +2 -1
  16. package/deps/librdkafka/configure +0 -0
  17. package/deps/librdkafka/debian/rules +0 -0
  18. package/deps/librdkafka/dev-conf.sh +0 -0
  19. package/deps/librdkafka/examples/consumer.c +18 -8
  20. package/deps/librdkafka/examples/describe_consumer_groups.c +25 -6
  21. package/deps/librdkafka/examples/incremental_alter_configs.c +4 -5
  22. package/deps/librdkafka/examples/kafkatest_verifiable_client.cpp +26 -42
  23. package/deps/librdkafka/examples/openssl_engine_example.cpp +3 -4
  24. package/deps/librdkafka/examples/producer.cpp +2 -2
  25. package/deps/librdkafka/examples/user_scram.c +4 -5
  26. package/deps/librdkafka/examples/win_ssl_cert_store.cpp +4 -3
  27. package/deps/librdkafka/lds-gen.py +0 -0
  28. package/deps/librdkafka/mklove/Makefile.base +0 -0
  29. package/deps/librdkafka/packaging/RELEASE.md +8 -0
  30. package/deps/librdkafka/packaging/alpine/build-alpine.sh +0 -0
  31. package/deps/librdkafka/packaging/cp/README.md +4 -1
  32. package/deps/librdkafka/packaging/cp/check_features.c +12 -4
  33. package/deps/librdkafka/packaging/cp/verify-deb.sh +6 -6
  34. package/deps/librdkafka/packaging/cp/verify-packages.sh +52 -31
  35. package/deps/librdkafka/packaging/cp/verify-rpm.sh +6 -13
  36. package/deps/librdkafka/packaging/debian/docs +5 -0
  37. package/deps/librdkafka/packaging/debian/rules +0 -0
  38. package/deps/librdkafka/packaging/get_version.py +0 -0
  39. package/deps/librdkafka/packaging/homebrew/brew-update-pr.sh +0 -0
  40. package/deps/librdkafka/packaging/mingw-w64/{travis-before-install.sh → export-variables.sh} +0 -7
  41. package/deps/librdkafka/packaging/mingw-w64/semaphoreci-build.sh +1 -1
  42. package/deps/librdkafka/packaging/nuget/artifact.py +0 -0
  43. package/deps/librdkafka/packaging/nuget/cleanup-s3.py +0 -0
  44. package/deps/librdkafka/packaging/nuget/nuget.sh +0 -0
  45. package/deps/librdkafka/packaging/nuget/packaging.py +0 -0
  46. package/deps/librdkafka/packaging/nuget/push-to-nuget.sh +0 -0
  47. package/deps/librdkafka/packaging/nuget/release.py +0 -0
  48. package/deps/librdkafka/packaging/nuget/requirements.txt +3 -3
  49. package/deps/librdkafka/packaging/rpm/mock-on-docker.sh +0 -0
  50. package/deps/librdkafka/packaging/rpm/tests/run-test.sh +0 -0
  51. package/deps/librdkafka/packaging/rpm/tests/test-on-docker.sh +0 -0
  52. package/deps/librdkafka/packaging/tools/build-configurations-checks.sh +3 -1
  53. package/deps/librdkafka/packaging/tools/build-deb-package.sh +0 -0
  54. package/deps/librdkafka/packaging/tools/build-debian.sh +0 -0
  55. package/deps/librdkafka/packaging/tools/build-manylinux.sh +0 -0
  56. package/deps/librdkafka/packaging/tools/build-release-artifacts.sh +0 -0
  57. package/deps/librdkafka/packaging/tools/distro-build.sh +0 -0
  58. package/deps/librdkafka/packaging/tools/gh-release-checksums.py +0 -0
  59. package/deps/librdkafka/packaging/tools/rdutcoverage.sh +0 -0
  60. package/deps/librdkafka/packaging/tools/run-in-docker.sh +28 -0
  61. package/deps/librdkafka/packaging/tools/run-integration-tests.sh +31 -0
  62. package/deps/librdkafka/packaging/tools/run-style-check.sh +4 -0
  63. package/deps/librdkafka/packaging/tools/style-format.sh +6 -5
  64. package/deps/librdkafka/packaging/tools/update_rpcs_max_versions.py +100 -0
  65. package/deps/librdkafka/service.yml +154 -0
  66. package/deps/librdkafka/src/generate_proto.sh +0 -0
  67. package/deps/librdkafka/src/rd.h +145 -2
  68. package/deps/librdkafka/src/rdaddr.h +6 -7
  69. package/deps/librdkafka/src/rdatomic.h +15 -11
  70. package/deps/librdkafka/src/rdavg.h +3 -2
  71. package/deps/librdkafka/src/rdbase64.c +33 -2
  72. package/deps/librdkafka/src/rdbase64.h +2 -0
  73. package/deps/librdkafka/src/rdendian.h +10 -9
  74. package/deps/librdkafka/src/rdhttp.c +418 -100
  75. package/deps/librdkafka/src/rdhttp.h +23 -5
  76. package/deps/librdkafka/src/rdkafka.c +299 -145
  77. package/deps/librdkafka/src/rdkafka.h +89 -6
  78. package/deps/librdkafka/src/rdkafka_admin.c +482 -105
  79. package/deps/librdkafka/src/rdkafka_admin.h +42 -0
  80. package/deps/librdkafka/src/rdkafka_broker.c +463 -312
  81. package/deps/librdkafka/src/rdkafka_broker.h +68 -10
  82. package/deps/librdkafka/src/rdkafka_buf.c +8 -5
  83. package/deps/librdkafka/src/rdkafka_buf.h +4 -3
  84. package/deps/librdkafka/src/rdkafka_cert.c +25 -1
  85. package/deps/librdkafka/src/rdkafka_cert.h +4 -3
  86. package/deps/librdkafka/src/rdkafka_cgrp.c +468 -143
  87. package/deps/librdkafka/src/rdkafka_cgrp.h +36 -2
  88. package/deps/librdkafka/src/rdkafka_conf.c +526 -102
  89. package/deps/librdkafka/src/rdkafka_conf.h +68 -4
  90. package/deps/librdkafka/src/rdkafka_feature.c +472 -35
  91. package/deps/librdkafka/src/rdkafka_feature.h +2 -0
  92. package/deps/librdkafka/src/rdkafka_fetcher.c +22 -2
  93. package/deps/librdkafka/src/rdkafka_fetcher.h +2 -2
  94. package/deps/librdkafka/src/rdkafka_int.h +84 -46
  95. package/deps/librdkafka/src/rdkafka_metadata.c +221 -136
  96. package/deps/librdkafka/src/rdkafka_metadata.h +15 -11
  97. package/deps/librdkafka/src/rdkafka_metadata_cache.c +279 -73
  98. package/deps/librdkafka/src/rdkafka_mock.c +795 -19
  99. package/deps/librdkafka/src/rdkafka_mock.h +119 -0
  100. package/deps/librdkafka/src/rdkafka_mock_cgrp.c +1298 -132
  101. package/deps/librdkafka/src/rdkafka_mock_handlers.c +345 -49
  102. package/deps/librdkafka/src/rdkafka_mock_int.h +180 -61
  103. package/deps/librdkafka/src/rdkafka_msg.c +35 -19
  104. package/deps/librdkafka/src/rdkafka_msg.h +3 -3
  105. package/deps/librdkafka/src/rdkafka_msgset_writer.c +14 -10
  106. package/deps/librdkafka/src/rdkafka_offset.c +33 -5
  107. package/deps/librdkafka/src/rdkafka_op.c +1 -1
  108. package/deps/librdkafka/src/rdkafka_op.h +45 -21
  109. package/deps/librdkafka/src/rdkafka_partition.c +118 -23
  110. package/deps/librdkafka/src/rdkafka_partition.h +16 -7
  111. package/deps/librdkafka/src/rdkafka_proto.h +4 -1
  112. package/deps/librdkafka/src/rdkafka_protocol.h +1 -0
  113. package/deps/librdkafka/src/rdkafka_queue.c +125 -48
  114. package/deps/librdkafka/src/rdkafka_queue.h +19 -0
  115. package/deps/librdkafka/src/rdkafka_range_assignor.c +1 -1
  116. package/deps/librdkafka/src/rdkafka_request.c +336 -64
  117. package/deps/librdkafka/src/rdkafka_request.h +24 -1
  118. package/deps/librdkafka/src/rdkafka_sasl.c +5 -3
  119. package/deps/librdkafka/src/rdkafka_sasl_oauthbearer.c +14 -10
  120. package/deps/librdkafka/src/rdkafka_sasl_oauthbearer_oidc.c +1166 -89
  121. package/deps/librdkafka/src/rdkafka_sasl_oauthbearer_oidc.h +13 -3
  122. package/deps/librdkafka/src/rdkafka_sasl_plain.c +3 -3
  123. package/deps/librdkafka/src/rdkafka_sasl_scram.c +4 -3
  124. package/deps/librdkafka/src/rdkafka_ssl.c +306 -81
  125. package/deps/librdkafka/src/rdkafka_ssl.h +22 -0
  126. package/deps/librdkafka/src/rdkafka_sticky_assignor.c +4 -0
  127. package/deps/librdkafka/src/rdkafka_telemetry.c +80 -23
  128. package/deps/librdkafka/src/rdkafka_telemetry_encode.c +5 -1
  129. package/deps/librdkafka/src/rdkafka_telemetry_encode.h +20 -20
  130. package/deps/librdkafka/src/rdkafka_topic.c +220 -137
  131. package/deps/librdkafka/src/rdkafka_topic.h +14 -8
  132. package/deps/librdkafka/src/rdkafka_transport.c +59 -47
  133. package/deps/librdkafka/src/rdkafka_transport.h +5 -0
  134. package/deps/librdkafka/src/rdkafka_txnmgr.c +6 -1
  135. package/deps/librdkafka/src/rdmap.c +6 -1
  136. package/deps/librdkafka/src/rdrand.c +11 -1
  137. package/deps/librdkafka/src/rdtime.h +48 -17
  138. package/deps/librdkafka/src/rdunittest.c +42 -25
  139. package/deps/librdkafka/src/rdunittest.h +2 -0
  140. package/deps/librdkafka/src/rdwin32.h +1 -1
  141. package/deps/librdkafka/src/regexp.c +47 -42
  142. package/deps/librdkafka/src/tinycthread_extra.c +45 -21
  143. package/deps/librdkafka/src/tinycthread_extra.h +7 -3
  144. package/deps/librdkafka/src-cpp/rdkafkacpp.h +28 -2
  145. package/deps/librdkafka/tests/0001-multiobj.c +4 -0
  146. package/deps/librdkafka/tests/0004-conf.c +103 -36
  147. package/deps/librdkafka/tests/0009-mock_cluster.c +1 -0
  148. package/deps/librdkafka/tests/0011-produce_batch.c +2 -1
  149. package/deps/librdkafka/tests/0016-client_swname.c +18 -3
  150. package/deps/librdkafka/tests/0017-compression.c +6 -8
  151. package/deps/librdkafka/tests/0018-cgrp_term.c +8 -3
  152. package/deps/librdkafka/tests/0021-rkt_destroy.c +1 -0
  153. package/deps/librdkafka/tests/0022-consume_batch.c +4 -1
  154. package/deps/librdkafka/tests/0026-consume_pause.c +12 -14
  155. package/deps/librdkafka/tests/0028-long_topicnames.c +1 -1
  156. package/deps/librdkafka/tests/0029-assign_offset.c +6 -8
  157. package/deps/librdkafka/tests/0030-offset_commit.c +2 -2
  158. package/deps/librdkafka/tests/0033-regex_subscribe.c +33 -17
  159. package/deps/librdkafka/tests/0034-offset_reset.c +25 -4
  160. package/deps/librdkafka/tests/0036-partial_fetch.c +1 -0
  161. package/deps/librdkafka/tests/0038-performance.c +1 -0
  162. package/deps/librdkafka/tests/0040-io_event.c +11 -5
  163. package/deps/librdkafka/tests/0041-fetch_max_bytes.c +1 -0
  164. package/deps/librdkafka/tests/0044-partition_cnt.c +3 -2
  165. package/deps/librdkafka/tests/0045-subscribe_update.c +284 -20
  166. package/deps/librdkafka/tests/0047-partial_buf_tmout.c +1 -0
  167. package/deps/librdkafka/tests/0048-partitioner.c +1 -1
  168. package/deps/librdkafka/tests/0050-subscribe_adds.c +1 -0
  169. package/deps/librdkafka/tests/0051-assign_adds.c +1 -0
  170. package/deps/librdkafka/tests/0052-msg_timestamps.c +22 -4
  171. package/deps/librdkafka/tests/0053-stats_cb.cpp +12 -20
  172. package/deps/librdkafka/tests/0055-producer_latency.c +176 -3
  173. package/deps/librdkafka/tests/0056-balanced_group_mt.c +6 -2
  174. package/deps/librdkafka/tests/0058-log.cpp +3 -3
  175. package/deps/librdkafka/tests/0059-bsearch.cpp +8 -4
  176. package/deps/librdkafka/tests/0061-consumer_lag.cpp +25 -5
  177. package/deps/librdkafka/tests/0067-empty_topic.cpp +3 -0
  178. package/deps/librdkafka/tests/0068-produce_timeout.c +21 -23
  179. package/deps/librdkafka/tests/0069-consumer_add_parts.c +3 -7
  180. package/deps/librdkafka/tests/0075-retry.c +38 -1
  181. package/deps/librdkafka/tests/0076-produce_retry.c +2 -0
  182. package/deps/librdkafka/tests/0077-compaction.c +8 -2
  183. package/deps/librdkafka/tests/0080-admin_ut.c +34 -4
  184. package/deps/librdkafka/tests/0081-admin.c +455 -155
  185. package/deps/librdkafka/tests/0082-fetch_max_bytes.cpp +4 -0
  186. package/deps/librdkafka/tests/0083-cb_event.c +8 -3
  187. package/deps/librdkafka/tests/0084-destroy_flags.c +14 -18
  188. package/deps/librdkafka/tests/0085-headers.cpp +4 -0
  189. package/deps/librdkafka/tests/0086-purge.c +40 -7
  190. package/deps/librdkafka/tests/0088-produce_metadata_timeout.c +1 -1
  191. package/deps/librdkafka/tests/0089-max_poll_interval.c +12 -7
  192. package/deps/librdkafka/tests/0090-idempotence.c +1 -2
  193. package/deps/librdkafka/tests/0091-max_poll_interval_timeout.c +5 -7
  194. package/deps/librdkafka/tests/0092-mixed_msgver.c +6 -0
  195. package/deps/librdkafka/tests/0093-holb.c +8 -5
  196. package/deps/librdkafka/tests/0094-idempotence_msg_timeout.c +1 -0
  197. package/deps/librdkafka/tests/0097-ssl_verify.cpp +262 -70
  198. package/deps/librdkafka/tests/0098-consumer-txn.cpp +16 -16
  199. package/deps/librdkafka/tests/0099-commit_metadata.c +1 -1
  200. package/deps/librdkafka/tests/0101-fetch-from-follower.cpp +1 -1
  201. package/deps/librdkafka/tests/0102-static_group_rebalance.c +317 -16
  202. package/deps/librdkafka/tests/0103-transactions.c +7 -7
  203. package/deps/librdkafka/tests/0104-fetch_from_follower_mock.c +1 -0
  204. package/deps/librdkafka/tests/0105-transactions_mock.c +18 -11
  205. package/deps/librdkafka/tests/0106-cgrp_sess_timeout.c +35 -14
  206. package/deps/librdkafka/tests/0107-topic_recreate.c +2 -2
  207. package/deps/librdkafka/tests/0109-auto_create_topics.cpp +86 -26
  208. package/deps/librdkafka/tests/0110-batch_size.cpp +1 -2
  209. package/deps/librdkafka/tests/0112-assign_unknown_part.c +3 -14
  210. package/deps/librdkafka/tests/0113-cooperative_rebalance.cpp +248 -104
  211. package/deps/librdkafka/tests/0114-sticky_partitioning.cpp +3 -3
  212. package/deps/librdkafka/tests/0115-producer_auth.cpp +4 -1
  213. package/deps/librdkafka/tests/0116-kafkaconsumer_close.cpp +7 -5
  214. package/deps/librdkafka/tests/0117-mock_errors.c +15 -5
  215. package/deps/librdkafka/tests/0118-commit_rebalance.c +41 -8
  216. package/deps/librdkafka/tests/0119-consumer_auth.cpp +20 -1
  217. package/deps/librdkafka/tests/0120-asymmetric_subscription.c +8 -3
  218. package/deps/librdkafka/tests/0125-immediate_flush.c +1 -1
  219. package/deps/librdkafka/tests/0126-oauthbearer_oidc.c +323 -8
  220. package/deps/librdkafka/tests/0129-fetch_aborted_msgs.c +1 -0
  221. package/deps/librdkafka/tests/0132-strategy_ordering.c +12 -4
  222. package/deps/librdkafka/tests/0133-ssl_keys.c +28 -6
  223. package/deps/librdkafka/tests/0137-barrier_batch_consume.c +24 -14
  224. package/deps/librdkafka/tests/0139-offset_validation_mock.c +510 -2
  225. package/deps/librdkafka/tests/0140-commit_metadata.cpp +1 -1
  226. package/deps/librdkafka/tests/0142-reauthentication.c +37 -17
  227. package/deps/librdkafka/tests/0143-exponential_backoff_mock.c +39 -40
  228. package/deps/librdkafka/tests/0146-metadata_mock.c +76 -15
  229. package/deps/librdkafka/tests/0147-consumer_group_consumer_mock.c +952 -0
  230. package/deps/librdkafka/tests/0148-offset_fetch_commit_error_mock.c +563 -0
  231. package/deps/librdkafka/tests/0149-broker-same-host-port.c +140 -0
  232. package/deps/librdkafka/tests/0150-telemetry_mock.c +9 -6
  233. package/deps/librdkafka/tests/0151-purge-brokers.c +566 -0
  234. package/deps/librdkafka/tests/0152-rebootstrap.c +59 -0
  235. package/deps/librdkafka/tests/0153-memberid.c +128 -0
  236. package/deps/librdkafka/tests/CMakeLists.txt +6 -0
  237. package/deps/librdkafka/tests/LibrdkafkaTestApp.py +34 -9
  238. package/deps/librdkafka/tests/autotest.sh +0 -0
  239. package/deps/librdkafka/tests/broker_version_tests.py +0 -0
  240. package/deps/librdkafka/tests/buildbox.sh +0 -0
  241. package/deps/librdkafka/tests/cleanup-checker-tests.sh +0 -0
  242. package/deps/librdkafka/tests/cluster_testing.py +0 -0
  243. package/deps/librdkafka/tests/delete-test-topics.sh +0 -0
  244. package/deps/librdkafka/tests/fixtures/oauthbearer/jwt_assertion_template.json +10 -0
  245. package/deps/librdkafka/tests/fixtures/ssl/client.keystore.intermediate.p12 +0 -0
  246. package/deps/librdkafka/tests/fixtures/ssl/client.keystore.p12 +0 -0
  247. package/deps/librdkafka/tests/fixtures/ssl/client2.certificate.intermediate.pem +72 -0
  248. package/deps/librdkafka/tests/fixtures/ssl/client2.certificate.pem +42 -101
  249. package/deps/librdkafka/tests/fixtures/ssl/client2.intermediate.key +46 -0
  250. package/deps/librdkafka/tests/fixtures/ssl/client2.key +41 -29
  251. package/deps/librdkafka/tests/fixtures/ssl/create_keys.sh +112 -37
  252. package/deps/librdkafka/tests/gen-ssl-certs.sh +0 -0
  253. package/deps/librdkafka/tests/interactive_broker_version.py +0 -0
  254. package/deps/librdkafka/tests/java/Makefile +2 -1
  255. package/deps/librdkafka/tests/java/run-class.sh +0 -0
  256. package/deps/librdkafka/tests/lz4_manual_test.sh +0 -0
  257. package/deps/librdkafka/tests/multi-broker-version-test.sh +0 -0
  258. package/deps/librdkafka/tests/parse-refcnt.sh +0 -0
  259. package/deps/librdkafka/tests/performance_plot.py +0 -0
  260. package/deps/librdkafka/tests/requirements.txt +1 -1
  261. package/deps/librdkafka/tests/run-all-tests.sh +79 -0
  262. package/deps/librdkafka/tests/run-consumer-tests.sh +0 -0
  263. package/deps/librdkafka/tests/run-producer-tests.sh +0 -0
  264. package/deps/librdkafka/tests/run-test-batches.py +157 -0
  265. package/deps/librdkafka/tests/run-test.sh +0 -0
  266. package/deps/librdkafka/tests/sasl_test.py +0 -0
  267. package/deps/librdkafka/tests/test.c +478 -18
  268. package/deps/librdkafka/tests/test.h +62 -13
  269. package/deps/librdkafka/tests/testcpp.cpp +6 -1
  270. package/deps/librdkafka/tests/testcpp.h +30 -2
  271. package/deps/librdkafka/tests/testshared.h +16 -2
  272. package/deps/librdkafka/tests/tools/stats/graph.py +0 -0
  273. package/deps/librdkafka/tests/tools/stats/to_csv.py +1 -1
  274. package/deps/librdkafka/tests/trivup/trivup-0.14.0.tar.gz +0 -0
  275. package/deps/librdkafka/tests/until-fail.sh +0 -0
  276. package/deps/librdkafka/tests/xxxx-metadata.cpp +1 -1
  277. package/deps/librdkafka/vcpkg.json +1 -1
  278. package/deps/librdkafka/win32/setup-msys2.ps1 +24 -8
  279. package/deps/librdkafka/win32/setup-vcpkg.ps1 +28 -6
  280. package/deps/librdkafka/win32/tests/tests.vcxproj +6 -0
  281. package/deps/librdkafka/win32/wingetopt.h +5 -4
  282. package/errors.d.ts +27 -1
  283. package/lib/error.js +29 -3
  284. package/make_docs.sh +0 -0
  285. package/package.json +12 -13
  286. package/run_docker.sh +0 -0
  287. package/src/callbacks.cc +6 -9
  288. package/src/callbacks.h +1 -5
  289. package/test/kafka-consumer-worker.js +10 -7
  290. package/test/kafka-consumer.spec.js +32 -21
  291. package/deps/librdkafka/.semaphore/project.yml +0 -43
  292. package/deps/librdkafka/.semaphore/project_public.yml +0 -20
  293. package/deps/librdkafka/win32/install-openssl.ps1 +0 -33
@@ -2,6 +2,7 @@
2
2
  * librdkafka - Apache Kafka C library
3
3
  *
4
4
  * Copyright (c) 2020-2022, Magnus Edenhill
5
+ * 2025, Confluent Inc.
5
6
  * All rights reserved.
6
7
  *
7
8
  * Redistribution and use in source and binary forms, with or without
@@ -55,7 +56,7 @@ static void rebalance_cb(rd_kafka_t *rk,
55
56
  rd_kafka_err2name(rebalance_exp_event), rd_kafka_err2name(err));
56
57
 
57
58
  if (err == RD_KAFKA_RESP_ERR__ASSIGN_PARTITIONS) {
58
- test_consumer_assign("assign", rk, parts);
59
+ test_consumer_assign_by_rebalance_protocol("assign", rk, parts);
59
60
  } else {
60
61
  rd_kafka_resp_err_t commit_err;
61
62
 
@@ -92,8 +93,8 @@ static void rebalance_cb(rd_kafka_t *rk,
92
93
  rd_kafka_err2name(commit_exp_err),
93
94
  rd_kafka_err2name(commit_err));
94
95
  }
95
-
96
- test_consumer_unassign("unassign", rk);
96
+ test_consumer_unassign_by_rebalance_protocol("unassign", rk,
97
+ parts);
97
98
  }
98
99
 
99
100
  /* Make sure only one rebalance callback is served per poll()
@@ -169,21 +170,26 @@ static void do_test_session_timeout(const char *use_commit_type) {
169
170
  test_conf_set(conf, "auto.offset.reset", "earliest");
170
171
  test_conf_set(conf, "enable.auto.commit",
171
172
  !strcmp(commit_type, "auto") ? "true" : "false");
173
+ rd_kafka_mock_set_group_consumer_session_timeout_ms(mcluster, 1000);
174
+ rd_kafka_mock_set_group_consumer_heartbeat_interval_ms(mcluster, 100);
172
175
 
173
176
  c = test_create_consumer(groupid, rebalance_cb, conf, NULL);
174
177
 
175
178
  test_consumer_subscribe(c, topic);
176
179
 
177
- /* Let Heartbeats fail after a couple of successful ones */
178
- rd_kafka_mock_push_request_errors(
179
- mcluster, RD_KAFKAP_Heartbeat, 9, RD_KAFKA_RESP_ERR_NO_ERROR,
180
- RD_KAFKA_RESP_ERR_NO_ERROR, RD_KAFKA_RESP_ERR_NOT_COORDINATOR,
181
- RD_KAFKA_RESP_ERR_NOT_COORDINATOR,
182
- RD_KAFKA_RESP_ERR_NOT_COORDINATOR,
183
- RD_KAFKA_RESP_ERR_NOT_COORDINATOR,
184
- RD_KAFKA_RESP_ERR_NOT_COORDINATOR,
185
- RD_KAFKA_RESP_ERR_NOT_COORDINATOR,
186
- RD_KAFKA_RESP_ERR_NOT_COORDINATOR);
180
+ if (test_consumer_group_protocol_classic()) {
181
+ /* Let Heartbeats fail after a couple of successful ones */
182
+ rd_kafka_mock_push_request_errors(
183
+ mcluster, RD_KAFKAP_Heartbeat, 9,
184
+ RD_KAFKA_RESP_ERR_NO_ERROR, RD_KAFKA_RESP_ERR_NO_ERROR,
185
+ RD_KAFKA_RESP_ERR_NOT_COORDINATOR,
186
+ RD_KAFKA_RESP_ERR_NOT_COORDINATOR,
187
+ RD_KAFKA_RESP_ERR_NOT_COORDINATOR,
188
+ RD_KAFKA_RESP_ERR_NOT_COORDINATOR,
189
+ RD_KAFKA_RESP_ERR_NOT_COORDINATOR,
190
+ RD_KAFKA_RESP_ERR_NOT_COORDINATOR,
191
+ RD_KAFKA_RESP_ERR_NOT_COORDINATOR);
192
+ }
187
193
 
188
194
  expect_rebalance("initial assignment", c,
189
195
  RD_KAFKA_RESP_ERR__ASSIGN_PARTITIONS, 5 + 2);
@@ -191,6 +197,12 @@ static void do_test_session_timeout(const char *use_commit_type) {
191
197
  /* Consume a couple of messages so that we have something to commit */
192
198
  test_consumer_poll("consume", c, 0, -1, 0, 10, NULL);
193
199
 
200
+ if (!test_consumer_group_protocol_classic()) {
201
+ /* Increase HB interval so member is fenced from the group */
202
+ rd_kafka_mock_set_group_consumer_heartbeat_interval_ms(mcluster,
203
+ 2000);
204
+ }
205
+
194
206
  /* The commit in the rebalance callback should fail when the
195
207
  * member has timed out from the group. */
196
208
  commit_exp_err = RD_KAFKA_RESP_ERR_UNKNOWN_MEMBER_ID;
@@ -291,7 +303,16 @@ int main_0106_cgrp_sess_timeout(int argc, char **argv) {
291
303
  do_test_session_timeout("async");
292
304
  do_test_session_timeout("auto");
293
305
 
294
- do_test_commit_on_lost();
306
+ /* With KIP-848 session timeout is remote only.
307
+ * Partitions will stay assigned and fetchable
308
+ * when there's no communication with the
309
+ * coordinator, but the messages won't be
310
+ * committed.
311
+ * TODO: see if session timeout can be received by
312
+ * the broker and be enforced locally too. */
313
+ if (test_consumer_group_protocol_classic()) {
314
+ do_test_commit_on_lost();
315
+ }
295
316
 
296
317
  return 0;
297
318
  }
@@ -189,7 +189,7 @@ static void do_test_create_delete_create(int part_cnt_1, int part_cnt_2) {
189
189
  consumer = test_create_consumer(topic, NULL, NULL, NULL);
190
190
 
191
191
  /* Create topic */
192
- test_create_topic(consumer, topic, part_cnt_1, 3);
192
+ test_create_topic_wait_exists(consumer, topic, part_cnt_1, 3, 5000);
193
193
 
194
194
  /* Start consumer */
195
195
  test_consumer_subscribe(consumer, topic);
@@ -216,7 +216,7 @@ static void do_test_create_delete_create(int part_cnt_1, int part_cnt_2) {
216
216
  rd_sleep(5);
217
217
 
218
218
  /* Re-create topic */
219
- test_create_topic(consumer, topic, part_cnt_2, 3);
219
+ test_create_topic_wait_exists(consumer, topic, part_cnt_2, 3, 5000);
220
220
 
221
221
  mtx_lock(&value_mtx);
222
222
  value = "after";
@@ -39,21 +39,39 @@
39
39
  * The same test is run with and without allow.auto.create.topics
40
40
  * and with and without wildcard subscribes.
41
41
  *
42
+ * With the KIP 848 consumer group protocol, topics aren't automatically
43
+ * created when subscribing and the topic authorization error
44
+ * applies to the whole subscription, not just the unauthorized topics.
42
45
  */
43
46
 
44
47
 
45
48
  static void do_test_consumer(bool allow_auto_create_topics,
46
- bool with_wildcards) {
49
+ bool with_wildcards,
50
+ bool test_unauthorized_topic) {
47
51
  Test::Say(tostr() << _C_MAG << "[ Test allow.auto.create.topics="
48
52
  << (allow_auto_create_topics ? "true" : "false")
49
53
  << " with_wildcards=" << (with_wildcards ? "true" : "false")
50
- << " ]\n");
54
+ << " test_unauthorized_topic="
55
+ << (test_unauthorized_topic ? "true" : "false") << " ]\n");
51
56
 
52
57
  bool has_acl_cli = test_broker_version >= TEST_BRKVER(2, 1, 0, 0) &&
53
58
  !test_needs_auth(); /* We can't bother passing Java
54
59
  * security config to kafka-acls.sh */
60
+ if (test_unauthorized_topic && !has_acl_cli) {
61
+ Test::Say(
62
+ "Skipping unauthorized topic test since kafka-acls.sh is not "
63
+ "available\n");
64
+ return;
65
+ }
66
+ if (!test_consumer_group_protocol_classic() && allow_auto_create_topics) {
67
+ Test::Say(
68
+ "Skipping test as it would be duplicate "
69
+ "with KIP 848 consumer protocol\n");
70
+ return;
71
+ }
55
72
 
56
73
  bool supports_allow = test_broker_version >= TEST_BRKVER(0, 11, 0, 0);
74
+ const int cgrp_consumer_expected_consecutive_error_cnt = 3;
57
75
 
58
76
  std::string topic_exists = Test::mk_topic_name("0109-exists", 1);
59
77
  std::string topic_notexists = Test::mk_topic_name("0109-notexists", 1);
@@ -83,7 +101,7 @@ static void do_test_consumer(bool allow_auto_create_topics,
83
101
  /* Create topics */
84
102
  Test::create_topic(c, topic_exists.c_str(), 1, 1);
85
103
 
86
- if (has_acl_cli) {
104
+ if (test_unauthorized_topic) {
87
105
  Test::create_topic(c, topic_unauth.c_str(), 1, 1);
88
106
 
89
107
  /* Add denying ACL for unauth topic */
@@ -107,34 +125,50 @@ static void do_test_consumer(bool allow_auto_create_topics,
107
125
  std::map<std::string, RdKafka::ErrorCode> exp_errors;
108
126
 
109
127
  topics.push_back(topic_notexists);
110
- if (has_acl_cli)
128
+
129
+ if (test_unauthorized_topic)
111
130
  topics.push_back(topic_unauth);
112
131
 
113
132
  if (with_wildcards) {
114
133
  topics.push_back("^" + topic_exists);
115
134
  topics.push_back("^" + topic_notexists);
116
- /* If the subscription contains at least one wildcard/regex
117
- * then no auto topic creation will take place (since the consumer
118
- * requests all topics in metadata, and not specific ones, thus
119
- * not triggering topic auto creation).
120
- * We need to handle the expected error cases accordingly. */
121
- exp_errors["^" + topic_notexists] = RdKafka::ERR_UNKNOWN_TOPIC_OR_PART;
122
- exp_errors[topic_notexists] = RdKafka::ERR_UNKNOWN_TOPIC_OR_PART;
123
-
124
- if (has_acl_cli) {
125
- /* Unauthorized topics are not included in list-all-topics Metadata,
126
- * which we use for wildcards, so in this case the error code for
127
- * unauthorixed topics show up as unknown topic. */
128
- exp_errors[topic_unauth] = RdKafka::ERR_UNKNOWN_TOPIC_OR_PART;
129
- }
130
135
  } else {
131
136
  topics.push_back(topic_exists);
137
+ }
132
138
 
133
- if (has_acl_cli)
139
+ /* `classic` protocol case: if the subscription contains at least one
140
+ * wildcard/regex then no auto topic creation will take place (since the
141
+ * consumer requests all topics in metadata, and not specific ones, thus not
142
+ * triggering topic auto creation). We need to handle the expected error cases
143
+ * accordingly.
144
+ *
145
+ * `consumer` protocol case: there's no automatic topic creation. */
146
+ if (test_consumer_group_protocol_classic()) {
147
+ if (with_wildcards) {
148
+ exp_errors["^" + topic_notexists] = RdKafka::ERR_UNKNOWN_TOPIC_OR_PART;
149
+ exp_errors[topic_notexists] = RdKafka::ERR_UNKNOWN_TOPIC_OR_PART;
150
+ if (test_unauthorized_topic) {
151
+ /* Unauthorized topics are not included in list-all-topics Metadata,
152
+ * which we use for wildcards, so in this case the error code for
153
+ * unauthorixed topics show up as unknown topic. */
154
+ exp_errors[topic_unauth] = RdKafka::ERR_UNKNOWN_TOPIC_OR_PART;
155
+ }
156
+ } else if (test_unauthorized_topic) {
134
157
  exp_errors[topic_unauth] = RdKafka::ERR_TOPIC_AUTHORIZATION_FAILED;
158
+ }
159
+ } else if (test_unauthorized_topic) {
160
+ /* Authorization errors happen if even a single topic
161
+ * is unauthorized and an error is returned for the whole subscription
162
+ * without reference to the topic. */
163
+ exp_errors[""] = RdKafka::ERR_TOPIC_AUTHORIZATION_FAILED;
135
164
  }
136
165
 
137
- if (supports_allow && !allow_auto_create_topics)
166
+ /* `classic` protocol case: expect an error only if the broker supports the
167
+ * property and the test disallowed it.
168
+ *
169
+ * `consumer` protocol case: there's no automatic topic creation. */
170
+ if (supports_allow && !allow_auto_create_topics &&
171
+ test_consumer_group_protocol_classic())
138
172
  exp_errors[topic_notexists] = RdKafka::ERR_UNKNOWN_TOPIC_OR_PART;
139
173
 
140
174
  RdKafka::ErrorCode err;
@@ -143,7 +177,8 @@ static void do_test_consumer(bool allow_auto_create_topics,
143
177
 
144
178
  /* Start consuming until EOF is reached, which indicates that we have an
145
179
  * assignment and any errors should have been reported. */
146
- bool run = true;
180
+ bool run = true;
181
+ int consecutive_error_cnt = 0;
147
182
  while (run) {
148
183
  RdKafka::Message *msg = c->consume(tmout_multip(1000));
149
184
  switch (msg->err()) {
@@ -155,6 +190,17 @@ static void do_test_consumer(bool allow_auto_create_topics,
155
190
  run = false;
156
191
  break;
157
192
 
193
+ case RdKafka::ERR_TOPIC_AUTHORIZATION_FAILED:
194
+ if (test_consumer_group_protocol_classic()) {
195
+ run = true;
196
+ } else {
197
+ /* `consumer` rebalance protocol:
198
+ * wait for `unauthorized_error_cnt` consecutive errors. */
199
+ run = (++consecutive_error_cnt) <
200
+ cgrp_consumer_expected_consecutive_error_cnt;
201
+ }
202
+ /* FALLTHRU */
203
+
158
204
  default:
159
205
  Test::Say("Consume error on " + msg->topic_name() + ": " + msg->errstr() +
160
206
  "\n");
@@ -186,6 +232,13 @@ static void do_test_consumer(bool allow_auto_create_topics,
186
232
  RdKafka::err2str(msg->err()));
187
233
  } else {
188
234
  exp_errors.erase(msg->topic_name());
235
+ if (!test_consumer_group_protocol_classic() &&
236
+ test_unauthorized_topic &&
237
+ consecutive_error_cnt <
238
+ cgrp_consumer_expected_consecutive_error_cnt) {
239
+ /* Expect same error on next HB */
240
+ exp_errors[""] = RdKafka::ERR_TOPIC_AUTHORIZATION_FAILED;
241
+ }
189
242
  }
190
243
 
191
244
  break;
@@ -207,11 +260,18 @@ static void do_test_consumer(bool allow_auto_create_topics,
207
260
  extern "C" {
208
261
  int main_0109_auto_create_topics(int argc, char **argv) {
209
262
  /* Parameters:
210
- * allow auto create, with wildcards */
211
- do_test_consumer(true, true);
212
- do_test_consumer(true, false);
213
- do_test_consumer(false, true);
214
- do_test_consumer(false, false);
263
+ * allow auto create, with wildcards, test unauthorized topic */
264
+ do_test_consumer(true, false, false);
265
+ do_test_consumer(false, false, false);
266
+
267
+ do_test_consumer(true, true, false);
268
+ do_test_consumer(false, true, false);
269
+
270
+ do_test_consumer(true, false, true);
271
+ do_test_consumer(false, false, true);
272
+
273
+ do_test_consumer(true, true, true);
274
+ do_test_consumer(false, true, true);
215
275
 
216
276
  return 0;
217
277
  }
@@ -154,8 +154,7 @@ static void do_test_batch_size() {
154
154
  while (event_cb.avg_batchsize == 0)
155
155
  p->poll(1000);
156
156
 
157
- Test::Say(tostr() << "Batchsize: "
158
- << "configured " << batchsize << ", min "
157
+ Test::Say(tostr() << "Batchsize: " << "configured " << batchsize << ", min "
159
158
  << event_cb.min_batchsize << ", max "
160
159
  << event_cb.max_batchsize << ", avg "
161
160
  << event_cb.avg_batchsize << "\n");
@@ -43,7 +43,6 @@ int main_0112_assign_unknown_part(int argc, char **argv) {
43
43
  uint64_t testid = test_id_generate();
44
44
  rd_kafka_t *c;
45
45
  rd_kafka_topic_partition_list_t *tpl;
46
- int r;
47
46
 
48
47
  test_conf_init(NULL, NULL, 60);
49
48
 
@@ -51,8 +50,7 @@ int main_0112_assign_unknown_part(int argc, char **argv) {
51
50
  c = test_create_consumer(topic, NULL, NULL, NULL);
52
51
 
53
52
  TEST_SAY("Creating topic %s with 1 partition\n", topic);
54
- test_create_topic(c, topic, 1, 1);
55
- test_wait_topic_exists(c, topic, 10 * 1000);
53
+ test_create_topic_wait_exists(c, topic, 1, 1, 10 * 1000);
56
54
 
57
55
  TEST_SAY("Producing message to partition 0\n");
58
56
  test_produce_msgs_easy(topic, testid, 0, 1);
@@ -68,17 +66,8 @@ int main_0112_assign_unknown_part(int argc, char **argv) {
68
66
  TEST_SAY("Changing partition count for topic %s\n", topic);
69
67
  test_create_partitions(NULL, topic, 2);
70
68
 
71
- /* FIXME: The new partition might not have propagated through the
72
- * cluster by the time the producer tries to produce to it
73
- * which causes the produce to fail.
74
- * Loop until the partition count is correct. */
75
- while ((r = test_get_partition_count(c, topic, 5000)) != 2) {
76
- TEST_SAY(
77
- "Waiting for %s partition count to reach 2, "
78
- "currently %d\n",
79
- topic, r);
80
- rd_sleep(1);
81
- }
69
+ /* Allow the partition to propagate */
70
+ rd_sleep(1);
82
71
 
83
72
  TEST_SAY("Producing message to partition 1\n");
84
73
  test_produce_msgs_easy(topic, testid, 1, 1);