@point3/node-rdkafka 3.6.0-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 (707) hide show
  1. package/LICENSE.txt +20 -0
  2. package/README.md +636 -0
  3. package/binding.gyp +154 -0
  4. package/deps/librdkafka/.clang-format +136 -0
  5. package/deps/librdkafka/.clang-format-cpp +103 -0
  6. package/deps/librdkafka/.dir-locals.el +10 -0
  7. package/deps/librdkafka/.formatignore +33 -0
  8. package/deps/librdkafka/.gdbmacros +19 -0
  9. package/deps/librdkafka/.github/CODEOWNERS +1 -0
  10. package/deps/librdkafka/.github/ISSUE_TEMPLATE +34 -0
  11. package/deps/librdkafka/.semaphore/run-all-tests.yml +77 -0
  12. package/deps/librdkafka/.semaphore/semaphore-integration.yml +250 -0
  13. package/deps/librdkafka/.semaphore/semaphore.yml +378 -0
  14. package/deps/librdkafka/.semaphore/verify-linux-packages.yml +41 -0
  15. package/deps/librdkafka/CHANGELOG.md +2208 -0
  16. package/deps/librdkafka/CMakeLists.txt +291 -0
  17. package/deps/librdkafka/CODE_OF_CONDUCT.md +46 -0
  18. package/deps/librdkafka/CONFIGURATION.md +209 -0
  19. package/deps/librdkafka/CONTRIBUTING.md +431 -0
  20. package/deps/librdkafka/Doxyfile +2375 -0
  21. package/deps/librdkafka/INTRODUCTION.md +2481 -0
  22. package/deps/librdkafka/LICENSE +26 -0
  23. package/deps/librdkafka/LICENSE.cjson +22 -0
  24. package/deps/librdkafka/LICENSE.crc32c +28 -0
  25. package/deps/librdkafka/LICENSE.fnv1a +18 -0
  26. package/deps/librdkafka/LICENSE.hdrhistogram +27 -0
  27. package/deps/librdkafka/LICENSE.lz4 +26 -0
  28. package/deps/librdkafka/LICENSE.murmur2 +25 -0
  29. package/deps/librdkafka/LICENSE.nanopb +22 -0
  30. package/deps/librdkafka/LICENSE.opentelemetry +203 -0
  31. package/deps/librdkafka/LICENSE.pycrc +23 -0
  32. package/deps/librdkafka/LICENSE.queue +31 -0
  33. package/deps/librdkafka/LICENSE.regexp +5 -0
  34. package/deps/librdkafka/LICENSE.snappy +36 -0
  35. package/deps/librdkafka/LICENSE.tinycthread +26 -0
  36. package/deps/librdkafka/LICENSE.wingetopt +49 -0
  37. package/deps/librdkafka/LICENSES.txt +625 -0
  38. package/deps/librdkafka/Makefile +125 -0
  39. package/deps/librdkafka/README.md +199 -0
  40. package/deps/librdkafka/README.win32 +26 -0
  41. package/deps/librdkafka/STATISTICS.md +624 -0
  42. package/deps/librdkafka/configure +214 -0
  43. package/deps/librdkafka/configure.self +331 -0
  44. package/deps/librdkafka/debian/changelog +111 -0
  45. package/deps/librdkafka/debian/compat +1 -0
  46. package/deps/librdkafka/debian/control +71 -0
  47. package/deps/librdkafka/debian/copyright +99 -0
  48. package/deps/librdkafka/debian/gbp.conf +9 -0
  49. package/deps/librdkafka/debian/librdkafka++1.install +1 -0
  50. package/deps/librdkafka/debian/librdkafka-dev.examples +2 -0
  51. package/deps/librdkafka/debian/librdkafka-dev.install +9 -0
  52. package/deps/librdkafka/debian/librdkafka1.docs +5 -0
  53. package/deps/librdkafka/debian/librdkafka1.install +1 -0
  54. package/deps/librdkafka/debian/librdkafka1.symbols +135 -0
  55. package/deps/librdkafka/debian/rules +19 -0
  56. package/deps/librdkafka/debian/source/format +1 -0
  57. package/deps/librdkafka/debian/watch +2 -0
  58. package/deps/librdkafka/dev-conf.sh +123 -0
  59. package/deps/librdkafka/examples/CMakeLists.txt +79 -0
  60. package/deps/librdkafka/examples/Makefile +167 -0
  61. package/deps/librdkafka/examples/README.md +42 -0
  62. package/deps/librdkafka/examples/alter_consumer_group_offsets.c +338 -0
  63. package/deps/librdkafka/examples/consumer.c +271 -0
  64. package/deps/librdkafka/examples/delete_records.c +233 -0
  65. package/deps/librdkafka/examples/describe_cluster.c +322 -0
  66. package/deps/librdkafka/examples/describe_consumer_groups.c +455 -0
  67. package/deps/librdkafka/examples/describe_topics.c +427 -0
  68. package/deps/librdkafka/examples/elect_leaders.c +317 -0
  69. package/deps/librdkafka/examples/globals.json +11 -0
  70. package/deps/librdkafka/examples/idempotent_producer.c +344 -0
  71. package/deps/librdkafka/examples/incremental_alter_configs.c +347 -0
  72. package/deps/librdkafka/examples/kafkatest_verifiable_client.cpp +945 -0
  73. package/deps/librdkafka/examples/list_consumer_group_offsets.c +359 -0
  74. package/deps/librdkafka/examples/list_consumer_groups.c +365 -0
  75. package/deps/librdkafka/examples/list_offsets.c +327 -0
  76. package/deps/librdkafka/examples/misc.c +287 -0
  77. package/deps/librdkafka/examples/openssl_engine_example.cpp +248 -0
  78. package/deps/librdkafka/examples/producer.c +251 -0
  79. package/deps/librdkafka/examples/producer.cpp +228 -0
  80. package/deps/librdkafka/examples/rdkafka_complex_consumer_example.c +617 -0
  81. package/deps/librdkafka/examples/rdkafka_complex_consumer_example.cpp +467 -0
  82. package/deps/librdkafka/examples/rdkafka_consume_batch.cpp +264 -0
  83. package/deps/librdkafka/examples/rdkafka_example.c +853 -0
  84. package/deps/librdkafka/examples/rdkafka_example.cpp +679 -0
  85. package/deps/librdkafka/examples/rdkafka_performance.c +1781 -0
  86. package/deps/librdkafka/examples/transactions-older-broker.c +668 -0
  87. package/deps/librdkafka/examples/transactions.c +665 -0
  88. package/deps/librdkafka/examples/user_scram.c +491 -0
  89. package/deps/librdkafka/examples/win_ssl_cert_store.cpp +396 -0
  90. package/deps/librdkafka/lds-gen.py +73 -0
  91. package/deps/librdkafka/mainpage.doxy +40 -0
  92. package/deps/librdkafka/mklove/Makefile.base +329 -0
  93. package/deps/librdkafka/mklove/modules/configure.atomics +144 -0
  94. package/deps/librdkafka/mklove/modules/configure.base +2484 -0
  95. package/deps/librdkafka/mklove/modules/configure.builtin +70 -0
  96. package/deps/librdkafka/mklove/modules/configure.cc +186 -0
  97. package/deps/librdkafka/mklove/modules/configure.cxx +8 -0
  98. package/deps/librdkafka/mklove/modules/configure.fileversion +65 -0
  99. package/deps/librdkafka/mklove/modules/configure.gitversion +29 -0
  100. package/deps/librdkafka/mklove/modules/configure.good_cflags +18 -0
  101. package/deps/librdkafka/mklove/modules/configure.host +132 -0
  102. package/deps/librdkafka/mklove/modules/configure.lib +49 -0
  103. package/deps/librdkafka/mklove/modules/configure.libcurl +99 -0
  104. package/deps/librdkafka/mklove/modules/configure.libsasl2 +36 -0
  105. package/deps/librdkafka/mklove/modules/configure.libssl +147 -0
  106. package/deps/librdkafka/mklove/modules/configure.libzstd +58 -0
  107. package/deps/librdkafka/mklove/modules/configure.parseversion +95 -0
  108. package/deps/librdkafka/mklove/modules/configure.pic +16 -0
  109. package/deps/librdkafka/mklove/modules/configure.socket +20 -0
  110. package/deps/librdkafka/mklove/modules/configure.zlib +61 -0
  111. package/deps/librdkafka/mklove/modules/patches/README.md +8 -0
  112. package/deps/librdkafka/mklove/modules/patches/libcurl.0000-no-runtime-linking-check.patch +11 -0
  113. package/deps/librdkafka/mklove/modules/patches/libssl.0000-osx-rand-include-fix-OpenSSL-PR16409.patch +56 -0
  114. package/deps/librdkafka/packaging/RELEASE.md +319 -0
  115. package/deps/librdkafka/packaging/alpine/build-alpine.sh +38 -0
  116. package/deps/librdkafka/packaging/archlinux/PKGBUILD +30 -0
  117. package/deps/librdkafka/packaging/cmake/Config.cmake.in +37 -0
  118. package/deps/librdkafka/packaging/cmake/Modules/FindLZ4.cmake +38 -0
  119. package/deps/librdkafka/packaging/cmake/Modules/FindZSTD.cmake +27 -0
  120. package/deps/librdkafka/packaging/cmake/Modules/LICENSE.FindZstd +178 -0
  121. package/deps/librdkafka/packaging/cmake/README.md +38 -0
  122. package/deps/librdkafka/packaging/cmake/config.h.in +52 -0
  123. package/deps/librdkafka/packaging/cmake/parseversion.cmake +60 -0
  124. package/deps/librdkafka/packaging/cmake/rdkafka.pc.in +12 -0
  125. package/deps/librdkafka/packaging/cmake/try_compile/atomic_32_test.c +8 -0
  126. package/deps/librdkafka/packaging/cmake/try_compile/atomic_64_test.c +8 -0
  127. package/deps/librdkafka/packaging/cmake/try_compile/c11threads_test.c +14 -0
  128. package/deps/librdkafka/packaging/cmake/try_compile/crc32c_hw_test.c +27 -0
  129. package/deps/librdkafka/packaging/cmake/try_compile/dlopen_test.c +11 -0
  130. package/deps/librdkafka/packaging/cmake/try_compile/libsasl2_test.c +7 -0
  131. package/deps/librdkafka/packaging/cmake/try_compile/pthread_setname_darwin_test.c +6 -0
  132. package/deps/librdkafka/packaging/cmake/try_compile/pthread_setname_freebsd_test.c +7 -0
  133. package/deps/librdkafka/packaging/cmake/try_compile/pthread_setname_gnu_test.c +5 -0
  134. package/deps/librdkafka/packaging/cmake/try_compile/rand_r_test.c +7 -0
  135. package/deps/librdkafka/packaging/cmake/try_compile/rdkafka_setup.cmake +122 -0
  136. package/deps/librdkafka/packaging/cmake/try_compile/regex_test.c +10 -0
  137. package/deps/librdkafka/packaging/cmake/try_compile/strndup_test.c +5 -0
  138. package/deps/librdkafka/packaging/cmake/try_compile/sync_32_test.c +8 -0
  139. package/deps/librdkafka/packaging/cmake/try_compile/sync_64_test.c +8 -0
  140. package/deps/librdkafka/packaging/cp/README.md +16 -0
  141. package/deps/librdkafka/packaging/cp/check_features.c +72 -0
  142. package/deps/librdkafka/packaging/cp/verify-deb.sh +33 -0
  143. package/deps/librdkafka/packaging/cp/verify-packages.sh +69 -0
  144. package/deps/librdkafka/packaging/cp/verify-rpm.sh +32 -0
  145. package/deps/librdkafka/packaging/debian/changelog +66 -0
  146. package/deps/librdkafka/packaging/debian/compat +1 -0
  147. package/deps/librdkafka/packaging/debian/control +49 -0
  148. package/deps/librdkafka/packaging/debian/copyright +84 -0
  149. package/deps/librdkafka/packaging/debian/docs +5 -0
  150. package/deps/librdkafka/packaging/debian/gbp.conf +9 -0
  151. package/deps/librdkafka/packaging/debian/librdkafka-dev.dirs +2 -0
  152. package/deps/librdkafka/packaging/debian/librdkafka-dev.examples +2 -0
  153. package/deps/librdkafka/packaging/debian/librdkafka-dev.install +6 -0
  154. package/deps/librdkafka/packaging/debian/librdkafka-dev.substvars +1 -0
  155. package/deps/librdkafka/packaging/debian/librdkafka.dsc +16 -0
  156. package/deps/librdkafka/packaging/debian/librdkafka1-dbg.substvars +1 -0
  157. package/deps/librdkafka/packaging/debian/librdkafka1.dirs +1 -0
  158. package/deps/librdkafka/packaging/debian/librdkafka1.install +2 -0
  159. package/deps/librdkafka/packaging/debian/librdkafka1.postinst.debhelper +5 -0
  160. package/deps/librdkafka/packaging/debian/librdkafka1.postrm.debhelper +5 -0
  161. package/deps/librdkafka/packaging/debian/librdkafka1.symbols +64 -0
  162. package/deps/librdkafka/packaging/debian/rules +19 -0
  163. package/deps/librdkafka/packaging/debian/source/format +1 -0
  164. package/deps/librdkafka/packaging/debian/watch +2 -0
  165. package/deps/librdkafka/packaging/get_version.py +21 -0
  166. package/deps/librdkafka/packaging/homebrew/README.md +15 -0
  167. package/deps/librdkafka/packaging/homebrew/brew-update-pr.sh +31 -0
  168. package/deps/librdkafka/packaging/mingw-w64/configure-build-msys2-mingw-static.sh +52 -0
  169. package/deps/librdkafka/packaging/mingw-w64/configure-build-msys2-mingw.sh +21 -0
  170. package/deps/librdkafka/packaging/mingw-w64/export-variables.sh +13 -0
  171. package/deps/librdkafka/packaging/mingw-w64/run-tests.sh +6 -0
  172. package/deps/librdkafka/packaging/mingw-w64/semaphoreci-build.sh +38 -0
  173. package/deps/librdkafka/packaging/nuget/README.md +84 -0
  174. package/deps/librdkafka/packaging/nuget/artifact.py +177 -0
  175. package/deps/librdkafka/packaging/nuget/cleanup-s3.py +143 -0
  176. package/deps/librdkafka/packaging/nuget/common/p-common__plat-windows__arch-win32__bldtype-Release/msvcr120.zip +0 -0
  177. package/deps/librdkafka/packaging/nuget/common/p-common__plat-windows__arch-win32__bldtype-Release/msvcr140.zip +0 -0
  178. package/deps/librdkafka/packaging/nuget/common/p-common__plat-windows__arch-x64__bldtype-Release/msvcr120.zip +0 -0
  179. package/deps/librdkafka/packaging/nuget/common/p-common__plat-windows__arch-x64__bldtype-Release/msvcr140.zip +0 -0
  180. package/deps/librdkafka/packaging/nuget/nuget.sh +21 -0
  181. package/deps/librdkafka/packaging/nuget/nugetpackage.py +278 -0
  182. package/deps/librdkafka/packaging/nuget/packaging.py +448 -0
  183. package/deps/librdkafka/packaging/nuget/push-to-nuget.sh +21 -0
  184. package/deps/librdkafka/packaging/nuget/release.py +167 -0
  185. package/deps/librdkafka/packaging/nuget/requirements.txt +3 -0
  186. package/deps/librdkafka/packaging/nuget/staticpackage.py +178 -0
  187. package/deps/librdkafka/packaging/nuget/templates/librdkafka.redist.nuspec +21 -0
  188. package/deps/librdkafka/packaging/nuget/templates/librdkafka.redist.props +18 -0
  189. package/deps/librdkafka/packaging/nuget/templates/librdkafka.redist.targets +19 -0
  190. package/deps/librdkafka/packaging/nuget/zfile/__init__.py +0 -0
  191. package/deps/librdkafka/packaging/nuget/zfile/zfile.py +98 -0
  192. package/deps/librdkafka/packaging/rpm/Makefile +92 -0
  193. package/deps/librdkafka/packaging/rpm/README.md +23 -0
  194. package/deps/librdkafka/packaging/rpm/el7-x86_64.cfg +40 -0
  195. package/deps/librdkafka/packaging/rpm/librdkafka.spec +118 -0
  196. package/deps/librdkafka/packaging/rpm/mock-on-docker.sh +96 -0
  197. package/deps/librdkafka/packaging/rpm/tests/Makefile +25 -0
  198. package/deps/librdkafka/packaging/rpm/tests/README.md +8 -0
  199. package/deps/librdkafka/packaging/rpm/tests/run-test.sh +42 -0
  200. package/deps/librdkafka/packaging/rpm/tests/test-on-docker.sh +56 -0
  201. package/deps/librdkafka/packaging/rpm/tests/test.c +77 -0
  202. package/deps/librdkafka/packaging/rpm/tests/test.cpp +34 -0
  203. package/deps/librdkafka/packaging/tools/Dockerfile +31 -0
  204. package/deps/librdkafka/packaging/tools/build-configurations-checks.sh +12 -0
  205. package/deps/librdkafka/packaging/tools/build-deb-package.sh +64 -0
  206. package/deps/librdkafka/packaging/tools/build-debian.sh +65 -0
  207. package/deps/librdkafka/packaging/tools/build-manylinux.sh +68 -0
  208. package/deps/librdkafka/packaging/tools/build-release-artifacts.sh +139 -0
  209. package/deps/librdkafka/packaging/tools/distro-build.sh +38 -0
  210. package/deps/librdkafka/packaging/tools/gh-release-checksums.py +39 -0
  211. package/deps/librdkafka/packaging/tools/rdutcoverage.sh +25 -0
  212. package/deps/librdkafka/packaging/tools/requirements.txt +2 -0
  213. package/deps/librdkafka/packaging/tools/run-in-docker.sh +28 -0
  214. package/deps/librdkafka/packaging/tools/run-integration-tests.sh +31 -0
  215. package/deps/librdkafka/packaging/tools/run-style-check.sh +4 -0
  216. package/deps/librdkafka/packaging/tools/style-format.sh +149 -0
  217. package/deps/librdkafka/packaging/tools/update_rpcs_max_versions.py +100 -0
  218. package/deps/librdkafka/service.yml +172 -0
  219. package/deps/librdkafka/src/CMakeLists.txt +374 -0
  220. package/deps/librdkafka/src/Makefile +103 -0
  221. package/deps/librdkafka/src/README.lz4.md +30 -0
  222. package/deps/librdkafka/src/cJSON.c +2834 -0
  223. package/deps/librdkafka/src/cJSON.h +398 -0
  224. package/deps/librdkafka/src/crc32c.c +430 -0
  225. package/deps/librdkafka/src/crc32c.h +38 -0
  226. package/deps/librdkafka/src/generate_proto.sh +66 -0
  227. package/deps/librdkafka/src/librdkafka_cgrp_synch.png +0 -0
  228. package/deps/librdkafka/src/lz4.c +2727 -0
  229. package/deps/librdkafka/src/lz4.h +842 -0
  230. package/deps/librdkafka/src/lz4frame.c +2078 -0
  231. package/deps/librdkafka/src/lz4frame.h +692 -0
  232. package/deps/librdkafka/src/lz4frame_static.h +47 -0
  233. package/deps/librdkafka/src/lz4hc.c +1631 -0
  234. package/deps/librdkafka/src/lz4hc.h +413 -0
  235. package/deps/librdkafka/src/nanopb/pb.h +917 -0
  236. package/deps/librdkafka/src/nanopb/pb_common.c +388 -0
  237. package/deps/librdkafka/src/nanopb/pb_common.h +49 -0
  238. package/deps/librdkafka/src/nanopb/pb_decode.c +1727 -0
  239. package/deps/librdkafka/src/nanopb/pb_decode.h +193 -0
  240. package/deps/librdkafka/src/nanopb/pb_encode.c +1000 -0
  241. package/deps/librdkafka/src/nanopb/pb_encode.h +185 -0
  242. package/deps/librdkafka/src/opentelemetry/common.pb.c +32 -0
  243. package/deps/librdkafka/src/opentelemetry/common.pb.h +170 -0
  244. package/deps/librdkafka/src/opentelemetry/metrics.options +2 -0
  245. package/deps/librdkafka/src/opentelemetry/metrics.pb.c +67 -0
  246. package/deps/librdkafka/src/opentelemetry/metrics.pb.h +966 -0
  247. package/deps/librdkafka/src/opentelemetry/resource.pb.c +12 -0
  248. package/deps/librdkafka/src/opentelemetry/resource.pb.h +58 -0
  249. package/deps/librdkafka/src/queue.h +850 -0
  250. package/deps/librdkafka/src/rd.h +584 -0
  251. package/deps/librdkafka/src/rdaddr.c +255 -0
  252. package/deps/librdkafka/src/rdaddr.h +202 -0
  253. package/deps/librdkafka/src/rdatomic.h +230 -0
  254. package/deps/librdkafka/src/rdavg.h +260 -0
  255. package/deps/librdkafka/src/rdavl.c +210 -0
  256. package/deps/librdkafka/src/rdavl.h +250 -0
  257. package/deps/librdkafka/src/rdbase64.c +200 -0
  258. package/deps/librdkafka/src/rdbase64.h +43 -0
  259. package/deps/librdkafka/src/rdbuf.c +1884 -0
  260. package/deps/librdkafka/src/rdbuf.h +375 -0
  261. package/deps/librdkafka/src/rdcrc32.c +114 -0
  262. package/deps/librdkafka/src/rdcrc32.h +170 -0
  263. package/deps/librdkafka/src/rddl.c +179 -0
  264. package/deps/librdkafka/src/rddl.h +43 -0
  265. package/deps/librdkafka/src/rdendian.h +175 -0
  266. package/deps/librdkafka/src/rdfloat.h +67 -0
  267. package/deps/librdkafka/src/rdfnv1a.c +113 -0
  268. package/deps/librdkafka/src/rdfnv1a.h +35 -0
  269. package/deps/librdkafka/src/rdgz.c +120 -0
  270. package/deps/librdkafka/src/rdgz.h +46 -0
  271. package/deps/librdkafka/src/rdhdrhistogram.c +721 -0
  272. package/deps/librdkafka/src/rdhdrhistogram.h +87 -0
  273. package/deps/librdkafka/src/rdhttp.c +830 -0
  274. package/deps/librdkafka/src/rdhttp.h +101 -0
  275. package/deps/librdkafka/src/rdinterval.h +177 -0
  276. package/deps/librdkafka/src/rdkafka.c +5505 -0
  277. package/deps/librdkafka/src/rdkafka.h +10686 -0
  278. package/deps/librdkafka/src/rdkafka_admin.c +9794 -0
  279. package/deps/librdkafka/src/rdkafka_admin.h +661 -0
  280. package/deps/librdkafka/src/rdkafka_assignment.c +1010 -0
  281. package/deps/librdkafka/src/rdkafka_assignment.h +73 -0
  282. package/deps/librdkafka/src/rdkafka_assignor.c +1786 -0
  283. package/deps/librdkafka/src/rdkafka_assignor.h +402 -0
  284. package/deps/librdkafka/src/rdkafka_aux.c +409 -0
  285. package/deps/librdkafka/src/rdkafka_aux.h +174 -0
  286. package/deps/librdkafka/src/rdkafka_background.c +221 -0
  287. package/deps/librdkafka/src/rdkafka_broker.c +6337 -0
  288. package/deps/librdkafka/src/rdkafka_broker.h +744 -0
  289. package/deps/librdkafka/src/rdkafka_buf.c +543 -0
  290. package/deps/librdkafka/src/rdkafka_buf.h +1525 -0
  291. package/deps/librdkafka/src/rdkafka_cert.c +576 -0
  292. package/deps/librdkafka/src/rdkafka_cert.h +62 -0
  293. package/deps/librdkafka/src/rdkafka_cgrp.c +7587 -0
  294. package/deps/librdkafka/src/rdkafka_cgrp.h +477 -0
  295. package/deps/librdkafka/src/rdkafka_conf.c +4880 -0
  296. package/deps/librdkafka/src/rdkafka_conf.h +732 -0
  297. package/deps/librdkafka/src/rdkafka_confval.h +97 -0
  298. package/deps/librdkafka/src/rdkafka_coord.c +623 -0
  299. package/deps/librdkafka/src/rdkafka_coord.h +132 -0
  300. package/deps/librdkafka/src/rdkafka_error.c +228 -0
  301. package/deps/librdkafka/src/rdkafka_error.h +80 -0
  302. package/deps/librdkafka/src/rdkafka_event.c +502 -0
  303. package/deps/librdkafka/src/rdkafka_event.h +126 -0
  304. package/deps/librdkafka/src/rdkafka_feature.c +898 -0
  305. package/deps/librdkafka/src/rdkafka_feature.h +104 -0
  306. package/deps/librdkafka/src/rdkafka_fetcher.c +1422 -0
  307. package/deps/librdkafka/src/rdkafka_fetcher.h +44 -0
  308. package/deps/librdkafka/src/rdkafka_header.c +220 -0
  309. package/deps/librdkafka/src/rdkafka_header.h +76 -0
  310. package/deps/librdkafka/src/rdkafka_idempotence.c +807 -0
  311. package/deps/librdkafka/src/rdkafka_idempotence.h +144 -0
  312. package/deps/librdkafka/src/rdkafka_int.h +1260 -0
  313. package/deps/librdkafka/src/rdkafka_interceptor.c +819 -0
  314. package/deps/librdkafka/src/rdkafka_interceptor.h +104 -0
  315. package/deps/librdkafka/src/rdkafka_lz4.c +450 -0
  316. package/deps/librdkafka/src/rdkafka_lz4.h +49 -0
  317. package/deps/librdkafka/src/rdkafka_metadata.c +2209 -0
  318. package/deps/librdkafka/src/rdkafka_metadata.h +345 -0
  319. package/deps/librdkafka/src/rdkafka_metadata_cache.c +1183 -0
  320. package/deps/librdkafka/src/rdkafka_mock.c +3661 -0
  321. package/deps/librdkafka/src/rdkafka_mock.h +610 -0
  322. package/deps/librdkafka/src/rdkafka_mock_cgrp.c +1876 -0
  323. package/deps/librdkafka/src/rdkafka_mock_handlers.c +3113 -0
  324. package/deps/librdkafka/src/rdkafka_mock_int.h +710 -0
  325. package/deps/librdkafka/src/rdkafka_msg.c +2589 -0
  326. package/deps/librdkafka/src/rdkafka_msg.h +614 -0
  327. package/deps/librdkafka/src/rdkafka_msgbatch.h +62 -0
  328. package/deps/librdkafka/src/rdkafka_msgset.h +98 -0
  329. package/deps/librdkafka/src/rdkafka_msgset_reader.c +1806 -0
  330. package/deps/librdkafka/src/rdkafka_msgset_writer.c +1474 -0
  331. package/deps/librdkafka/src/rdkafka_offset.c +1565 -0
  332. package/deps/librdkafka/src/rdkafka_offset.h +150 -0
  333. package/deps/librdkafka/src/rdkafka_op.c +997 -0
  334. package/deps/librdkafka/src/rdkafka_op.h +858 -0
  335. package/deps/librdkafka/src/rdkafka_partition.c +4896 -0
  336. package/deps/librdkafka/src/rdkafka_partition.h +1182 -0
  337. package/deps/librdkafka/src/rdkafka_pattern.c +228 -0
  338. package/deps/librdkafka/src/rdkafka_pattern.h +70 -0
  339. package/deps/librdkafka/src/rdkafka_plugin.c +213 -0
  340. package/deps/librdkafka/src/rdkafka_plugin.h +41 -0
  341. package/deps/librdkafka/src/rdkafka_proto.h +736 -0
  342. package/deps/librdkafka/src/rdkafka_protocol.h +128 -0
  343. package/deps/librdkafka/src/rdkafka_queue.c +1230 -0
  344. package/deps/librdkafka/src/rdkafka_queue.h +1220 -0
  345. package/deps/librdkafka/src/rdkafka_range_assignor.c +1748 -0
  346. package/deps/librdkafka/src/rdkafka_request.c +7089 -0
  347. package/deps/librdkafka/src/rdkafka_request.h +732 -0
  348. package/deps/librdkafka/src/rdkafka_roundrobin_assignor.c +123 -0
  349. package/deps/librdkafka/src/rdkafka_sasl.c +530 -0
  350. package/deps/librdkafka/src/rdkafka_sasl.h +63 -0
  351. package/deps/librdkafka/src/rdkafka_sasl_cyrus.c +722 -0
  352. package/deps/librdkafka/src/rdkafka_sasl_int.h +89 -0
  353. package/deps/librdkafka/src/rdkafka_sasl_oauthbearer.c +1833 -0
  354. package/deps/librdkafka/src/rdkafka_sasl_oauthbearer.h +52 -0
  355. package/deps/librdkafka/src/rdkafka_sasl_oauthbearer_oidc.c +1666 -0
  356. package/deps/librdkafka/src/rdkafka_sasl_oauthbearer_oidc.h +47 -0
  357. package/deps/librdkafka/src/rdkafka_sasl_plain.c +142 -0
  358. package/deps/librdkafka/src/rdkafka_sasl_scram.c +858 -0
  359. package/deps/librdkafka/src/rdkafka_sasl_win32.c +550 -0
  360. package/deps/librdkafka/src/rdkafka_ssl.c +2129 -0
  361. package/deps/librdkafka/src/rdkafka_ssl.h +86 -0
  362. package/deps/librdkafka/src/rdkafka_sticky_assignor.c +4785 -0
  363. package/deps/librdkafka/src/rdkafka_subscription.c +278 -0
  364. package/deps/librdkafka/src/rdkafka_telemetry.c +760 -0
  365. package/deps/librdkafka/src/rdkafka_telemetry.h +52 -0
  366. package/deps/librdkafka/src/rdkafka_telemetry_decode.c +1053 -0
  367. package/deps/librdkafka/src/rdkafka_telemetry_decode.h +59 -0
  368. package/deps/librdkafka/src/rdkafka_telemetry_encode.c +997 -0
  369. package/deps/librdkafka/src/rdkafka_telemetry_encode.h +301 -0
  370. package/deps/librdkafka/src/rdkafka_timer.c +402 -0
  371. package/deps/librdkafka/src/rdkafka_timer.h +117 -0
  372. package/deps/librdkafka/src/rdkafka_topic.c +2161 -0
  373. package/deps/librdkafka/src/rdkafka_topic.h +334 -0
  374. package/deps/librdkafka/src/rdkafka_transport.c +1309 -0
  375. package/deps/librdkafka/src/rdkafka_transport.h +99 -0
  376. package/deps/librdkafka/src/rdkafka_transport_int.h +100 -0
  377. package/deps/librdkafka/src/rdkafka_txnmgr.c +3256 -0
  378. package/deps/librdkafka/src/rdkafka_txnmgr.h +171 -0
  379. package/deps/librdkafka/src/rdkafka_zstd.c +226 -0
  380. package/deps/librdkafka/src/rdkafka_zstd.h +57 -0
  381. package/deps/librdkafka/src/rdlist.c +576 -0
  382. package/deps/librdkafka/src/rdlist.h +434 -0
  383. package/deps/librdkafka/src/rdlog.c +89 -0
  384. package/deps/librdkafka/src/rdlog.h +41 -0
  385. package/deps/librdkafka/src/rdmap.c +508 -0
  386. package/deps/librdkafka/src/rdmap.h +492 -0
  387. package/deps/librdkafka/src/rdmurmur2.c +167 -0
  388. package/deps/librdkafka/src/rdmurmur2.h +35 -0
  389. package/deps/librdkafka/src/rdports.c +61 -0
  390. package/deps/librdkafka/src/rdports.h +38 -0
  391. package/deps/librdkafka/src/rdposix.h +250 -0
  392. package/deps/librdkafka/src/rdrand.c +80 -0
  393. package/deps/librdkafka/src/rdrand.h +43 -0
  394. package/deps/librdkafka/src/rdregex.c +156 -0
  395. package/deps/librdkafka/src/rdregex.h +43 -0
  396. package/deps/librdkafka/src/rdsignal.h +57 -0
  397. package/deps/librdkafka/src/rdstring.c +645 -0
  398. package/deps/librdkafka/src/rdstring.h +98 -0
  399. package/deps/librdkafka/src/rdsysqueue.h +404 -0
  400. package/deps/librdkafka/src/rdtime.h +356 -0
  401. package/deps/librdkafka/src/rdtypes.h +86 -0
  402. package/deps/librdkafka/src/rdunittest.c +549 -0
  403. package/deps/librdkafka/src/rdunittest.h +232 -0
  404. package/deps/librdkafka/src/rdvarint.c +134 -0
  405. package/deps/librdkafka/src/rdvarint.h +165 -0
  406. package/deps/librdkafka/src/rdwin32.h +382 -0
  407. package/deps/librdkafka/src/rdxxhash.c +1030 -0
  408. package/deps/librdkafka/src/rdxxhash.h +328 -0
  409. package/deps/librdkafka/src/regexp.c +1352 -0
  410. package/deps/librdkafka/src/regexp.h +41 -0
  411. package/deps/librdkafka/src/snappy.c +1866 -0
  412. package/deps/librdkafka/src/snappy.h +62 -0
  413. package/deps/librdkafka/src/snappy_compat.h +138 -0
  414. package/deps/librdkafka/src/statistics_schema.json +444 -0
  415. package/deps/librdkafka/src/tinycthread.c +932 -0
  416. package/deps/librdkafka/src/tinycthread.h +503 -0
  417. package/deps/librdkafka/src/tinycthread_extra.c +199 -0
  418. package/deps/librdkafka/src/tinycthread_extra.h +212 -0
  419. package/deps/librdkafka/src/win32_config.h +58 -0
  420. package/deps/librdkafka/src-cpp/CMakeLists.txt +90 -0
  421. package/deps/librdkafka/src-cpp/ConfImpl.cpp +84 -0
  422. package/deps/librdkafka/src-cpp/ConsumerImpl.cpp +244 -0
  423. package/deps/librdkafka/src-cpp/HandleImpl.cpp +436 -0
  424. package/deps/librdkafka/src-cpp/HeadersImpl.cpp +48 -0
  425. package/deps/librdkafka/src-cpp/KafkaConsumerImpl.cpp +296 -0
  426. package/deps/librdkafka/src-cpp/Makefile +55 -0
  427. package/deps/librdkafka/src-cpp/MessageImpl.cpp +38 -0
  428. package/deps/librdkafka/src-cpp/MetadataImpl.cpp +170 -0
  429. package/deps/librdkafka/src-cpp/ProducerImpl.cpp +197 -0
  430. package/deps/librdkafka/src-cpp/QueueImpl.cpp +70 -0
  431. package/deps/librdkafka/src-cpp/README.md +16 -0
  432. package/deps/librdkafka/src-cpp/RdKafka.cpp +59 -0
  433. package/deps/librdkafka/src-cpp/TopicImpl.cpp +124 -0
  434. package/deps/librdkafka/src-cpp/TopicPartitionImpl.cpp +57 -0
  435. package/deps/librdkafka/src-cpp/rdkafkacpp.h +3797 -0
  436. package/deps/librdkafka/src-cpp/rdkafkacpp_int.h +1641 -0
  437. package/deps/librdkafka/tests/0000-unittests.c +72 -0
  438. package/deps/librdkafka/tests/0001-multiobj.c +102 -0
  439. package/deps/librdkafka/tests/0002-unkpart.c +244 -0
  440. package/deps/librdkafka/tests/0003-msgmaxsize.c +173 -0
  441. package/deps/librdkafka/tests/0004-conf.c +934 -0
  442. package/deps/librdkafka/tests/0005-order.c +133 -0
  443. package/deps/librdkafka/tests/0006-symbols.c +163 -0
  444. package/deps/librdkafka/tests/0007-autotopic.c +136 -0
  445. package/deps/librdkafka/tests/0008-reqacks.c +179 -0
  446. package/deps/librdkafka/tests/0009-mock_cluster.c +97 -0
  447. package/deps/librdkafka/tests/0011-produce_batch.c +753 -0
  448. package/deps/librdkafka/tests/0012-produce_consume.c +537 -0
  449. package/deps/librdkafka/tests/0013-null-msgs.c +473 -0
  450. package/deps/librdkafka/tests/0014-reconsume-191.c +512 -0
  451. package/deps/librdkafka/tests/0015-offset_seeks.c +172 -0
  452. package/deps/librdkafka/tests/0016-client_swname.c +181 -0
  453. package/deps/librdkafka/tests/0017-compression.c +140 -0
  454. package/deps/librdkafka/tests/0018-cgrp_term.c +338 -0
  455. package/deps/librdkafka/tests/0019-list_groups.c +289 -0
  456. package/deps/librdkafka/tests/0020-destroy_hang.c +162 -0
  457. package/deps/librdkafka/tests/0021-rkt_destroy.c +72 -0
  458. package/deps/librdkafka/tests/0022-consume_batch.c +279 -0
  459. package/deps/librdkafka/tests/0025-timers.c +147 -0
  460. package/deps/librdkafka/tests/0026-consume_pause.c +547 -0
  461. package/deps/librdkafka/tests/0028-long_topicnames.c +79 -0
  462. package/deps/librdkafka/tests/0029-assign_offset.c +202 -0
  463. package/deps/librdkafka/tests/0030-offset_commit.c +589 -0
  464. package/deps/librdkafka/tests/0031-get_offsets.c +235 -0
  465. package/deps/librdkafka/tests/0033-regex_subscribe.c +536 -0
  466. package/deps/librdkafka/tests/0034-offset_reset.c +398 -0
  467. package/deps/librdkafka/tests/0035-api_version.c +73 -0
  468. package/deps/librdkafka/tests/0036-partial_fetch.c +87 -0
  469. package/deps/librdkafka/tests/0037-destroy_hang_local.c +85 -0
  470. package/deps/librdkafka/tests/0038-performance.c +121 -0
  471. package/deps/librdkafka/tests/0039-event.c +284 -0
  472. package/deps/librdkafka/tests/0040-io_event.c +257 -0
  473. package/deps/librdkafka/tests/0041-fetch_max_bytes.c +97 -0
  474. package/deps/librdkafka/tests/0042-many_topics.c +252 -0
  475. package/deps/librdkafka/tests/0043-no_connection.c +77 -0
  476. package/deps/librdkafka/tests/0044-partition_cnt.c +94 -0
  477. package/deps/librdkafka/tests/0045-subscribe_update.c +1010 -0
  478. package/deps/librdkafka/tests/0046-rkt_cache.c +65 -0
  479. package/deps/librdkafka/tests/0047-partial_buf_tmout.c +98 -0
  480. package/deps/librdkafka/tests/0048-partitioner.c +283 -0
  481. package/deps/librdkafka/tests/0049-consume_conn_close.c +162 -0
  482. package/deps/librdkafka/tests/0050-subscribe_adds.c +145 -0
  483. package/deps/librdkafka/tests/0051-assign_adds.c +126 -0
  484. package/deps/librdkafka/tests/0052-msg_timestamps.c +238 -0
  485. package/deps/librdkafka/tests/0053-stats_cb.cpp +527 -0
  486. package/deps/librdkafka/tests/0054-offset_time.cpp +236 -0
  487. package/deps/librdkafka/tests/0055-producer_latency.c +539 -0
  488. package/deps/librdkafka/tests/0056-balanced_group_mt.c +315 -0
  489. package/deps/librdkafka/tests/0057-invalid_topic.cpp +112 -0
  490. package/deps/librdkafka/tests/0058-log.cpp +123 -0
  491. package/deps/librdkafka/tests/0059-bsearch.cpp +241 -0
  492. package/deps/librdkafka/tests/0060-op_prio.cpp +163 -0
  493. package/deps/librdkafka/tests/0061-consumer_lag.cpp +295 -0
  494. package/deps/librdkafka/tests/0062-stats_event.c +126 -0
  495. package/deps/librdkafka/tests/0063-clusterid.cpp +180 -0
  496. package/deps/librdkafka/tests/0064-interceptors.c +481 -0
  497. package/deps/librdkafka/tests/0065-yield.cpp +140 -0
  498. package/deps/librdkafka/tests/0066-plugins.cpp +129 -0
  499. package/deps/librdkafka/tests/0067-empty_topic.cpp +151 -0
  500. package/deps/librdkafka/tests/0068-produce_timeout.c +136 -0
  501. package/deps/librdkafka/tests/0069-consumer_add_parts.c +119 -0
  502. package/deps/librdkafka/tests/0070-null_empty.cpp +197 -0
  503. package/deps/librdkafka/tests/0072-headers_ut.c +448 -0
  504. package/deps/librdkafka/tests/0073-headers.c +381 -0
  505. package/deps/librdkafka/tests/0074-producev.c +87 -0
  506. package/deps/librdkafka/tests/0075-retry.c +290 -0
  507. package/deps/librdkafka/tests/0076-produce_retry.c +452 -0
  508. package/deps/librdkafka/tests/0077-compaction.c +363 -0
  509. package/deps/librdkafka/tests/0078-c_from_cpp.cpp +96 -0
  510. package/deps/librdkafka/tests/0079-fork.c +93 -0
  511. package/deps/librdkafka/tests/0080-admin_ut.c +3095 -0
  512. package/deps/librdkafka/tests/0081-admin.c +5633 -0
  513. package/deps/librdkafka/tests/0082-fetch_max_bytes.cpp +137 -0
  514. package/deps/librdkafka/tests/0083-cb_event.c +233 -0
  515. package/deps/librdkafka/tests/0084-destroy_flags.c +208 -0
  516. package/deps/librdkafka/tests/0085-headers.cpp +392 -0
  517. package/deps/librdkafka/tests/0086-purge.c +368 -0
  518. package/deps/librdkafka/tests/0088-produce_metadata_timeout.c +162 -0
  519. package/deps/librdkafka/tests/0089-max_poll_interval.c +511 -0
  520. package/deps/librdkafka/tests/0090-idempotence.c +171 -0
  521. package/deps/librdkafka/tests/0091-max_poll_interval_timeout.c +295 -0
  522. package/deps/librdkafka/tests/0092-mixed_msgver.c +103 -0
  523. package/deps/librdkafka/tests/0093-holb.c +200 -0
  524. package/deps/librdkafka/tests/0094-idempotence_msg_timeout.c +231 -0
  525. package/deps/librdkafka/tests/0095-all_brokers_down.cpp +122 -0
  526. package/deps/librdkafka/tests/0097-ssl_verify.cpp +658 -0
  527. package/deps/librdkafka/tests/0098-consumer-txn.cpp +1218 -0
  528. package/deps/librdkafka/tests/0099-commit_metadata.c +194 -0
  529. package/deps/librdkafka/tests/0100-thread_interceptors.cpp +195 -0
  530. package/deps/librdkafka/tests/0101-fetch-from-follower.cpp +446 -0
  531. package/deps/librdkafka/tests/0102-static_group_rebalance.c +836 -0
  532. package/deps/librdkafka/tests/0103-transactions.c +1383 -0
  533. package/deps/librdkafka/tests/0104-fetch_from_follower_mock.c +625 -0
  534. package/deps/librdkafka/tests/0105-transactions_mock.c +3930 -0
  535. package/deps/librdkafka/tests/0106-cgrp_sess_timeout.c +318 -0
  536. package/deps/librdkafka/tests/0107-topic_recreate.c +259 -0
  537. package/deps/librdkafka/tests/0109-auto_create_topics.cpp +278 -0
  538. package/deps/librdkafka/tests/0110-batch_size.cpp +182 -0
  539. package/deps/librdkafka/tests/0111-delay_create_topics.cpp +127 -0
  540. package/deps/librdkafka/tests/0112-assign_unknown_part.c +87 -0
  541. package/deps/librdkafka/tests/0113-cooperative_rebalance.cpp +3473 -0
  542. package/deps/librdkafka/tests/0114-sticky_partitioning.cpp +176 -0
  543. package/deps/librdkafka/tests/0115-producer_auth.cpp +182 -0
  544. package/deps/librdkafka/tests/0116-kafkaconsumer_close.cpp +216 -0
  545. package/deps/librdkafka/tests/0117-mock_errors.c +331 -0
  546. package/deps/librdkafka/tests/0118-commit_rebalance.c +154 -0
  547. package/deps/librdkafka/tests/0119-consumer_auth.cpp +167 -0
  548. package/deps/librdkafka/tests/0120-asymmetric_subscription.c +185 -0
  549. package/deps/librdkafka/tests/0121-clusterid.c +115 -0
  550. package/deps/librdkafka/tests/0122-buffer_cleaning_after_rebalance.c +227 -0
  551. package/deps/librdkafka/tests/0123-connections_max_idle.c +98 -0
  552. package/deps/librdkafka/tests/0124-openssl_invalid_engine.c +69 -0
  553. package/deps/librdkafka/tests/0125-immediate_flush.c +144 -0
  554. package/deps/librdkafka/tests/0126-oauthbearer_oidc.c +528 -0
  555. package/deps/librdkafka/tests/0127-fetch_queue_backoff.cpp +165 -0
  556. package/deps/librdkafka/tests/0128-sasl_callback_queue.cpp +125 -0
  557. package/deps/librdkafka/tests/0129-fetch_aborted_msgs.c +79 -0
  558. package/deps/librdkafka/tests/0130-store_offsets.c +178 -0
  559. package/deps/librdkafka/tests/0131-connect_timeout.c +81 -0
  560. package/deps/librdkafka/tests/0132-strategy_ordering.c +179 -0
  561. package/deps/librdkafka/tests/0133-ssl_keys.c +150 -0
  562. package/deps/librdkafka/tests/0134-ssl_provider.c +92 -0
  563. package/deps/librdkafka/tests/0135-sasl_credentials.cpp +143 -0
  564. package/deps/librdkafka/tests/0136-resolve_cb.c +181 -0
  565. package/deps/librdkafka/tests/0137-barrier_batch_consume.c +619 -0
  566. package/deps/librdkafka/tests/0138-admin_mock.c +281 -0
  567. package/deps/librdkafka/tests/0139-offset_validation_mock.c +950 -0
  568. package/deps/librdkafka/tests/0140-commit_metadata.cpp +108 -0
  569. package/deps/librdkafka/tests/0142-reauthentication.c +515 -0
  570. package/deps/librdkafka/tests/0143-exponential_backoff_mock.c +552 -0
  571. package/deps/librdkafka/tests/0144-idempotence_mock.c +373 -0
  572. package/deps/librdkafka/tests/0145-pause_resume_mock.c +119 -0
  573. package/deps/librdkafka/tests/0146-metadata_mock.c +505 -0
  574. package/deps/librdkafka/tests/0147-consumer_group_consumer_mock.c +952 -0
  575. package/deps/librdkafka/tests/0148-offset_fetch_commit_error_mock.c +563 -0
  576. package/deps/librdkafka/tests/0149-broker-same-host-port.c +140 -0
  577. package/deps/librdkafka/tests/0150-telemetry_mock.c +651 -0
  578. package/deps/librdkafka/tests/0151-purge-brokers.c +566 -0
  579. package/deps/librdkafka/tests/0152-rebootstrap.c +59 -0
  580. package/deps/librdkafka/tests/0153-memberid.c +128 -0
  581. package/deps/librdkafka/tests/1000-unktopic.c +164 -0
  582. package/deps/librdkafka/tests/8000-idle.cpp +60 -0
  583. package/deps/librdkafka/tests/8001-fetch_from_follower_mock_manual.c +113 -0
  584. package/deps/librdkafka/tests/CMakeLists.txt +170 -0
  585. package/deps/librdkafka/tests/LibrdkafkaTestApp.py +291 -0
  586. package/deps/librdkafka/tests/Makefile +182 -0
  587. package/deps/librdkafka/tests/README.md +509 -0
  588. package/deps/librdkafka/tests/autotest.sh +33 -0
  589. package/deps/librdkafka/tests/backtrace.gdb +30 -0
  590. package/deps/librdkafka/tests/broker_version_tests.py +315 -0
  591. package/deps/librdkafka/tests/buildbox.sh +17 -0
  592. package/deps/librdkafka/tests/cleanup-checker-tests.sh +20 -0
  593. package/deps/librdkafka/tests/cluster_testing.py +191 -0
  594. package/deps/librdkafka/tests/delete-test-topics.sh +56 -0
  595. package/deps/librdkafka/tests/fixtures/oauthbearer/jwt_assertion_template.json +10 -0
  596. package/deps/librdkafka/tests/fixtures/ssl/Makefile +8 -0
  597. package/deps/librdkafka/tests/fixtures/ssl/README.md +13 -0
  598. package/deps/librdkafka/tests/fixtures/ssl/client.keystore.intermediate.p12 +0 -0
  599. package/deps/librdkafka/tests/fixtures/ssl/client.keystore.p12 +0 -0
  600. package/deps/librdkafka/tests/fixtures/ssl/client2.certificate.intermediate.pem +72 -0
  601. package/deps/librdkafka/tests/fixtures/ssl/client2.certificate.pem +50 -0
  602. package/deps/librdkafka/tests/fixtures/ssl/client2.intermediate.key +46 -0
  603. package/deps/librdkafka/tests/fixtures/ssl/client2.key +46 -0
  604. package/deps/librdkafka/tests/fixtures/ssl/create_keys.sh +168 -0
  605. package/deps/librdkafka/tests/fuzzers/Makefile +12 -0
  606. package/deps/librdkafka/tests/fuzzers/README.md +31 -0
  607. package/deps/librdkafka/tests/fuzzers/fuzz_regex.c +74 -0
  608. package/deps/librdkafka/tests/fuzzers/helpers.h +90 -0
  609. package/deps/librdkafka/tests/gen-ssl-certs.sh +165 -0
  610. package/deps/librdkafka/tests/interactive_broker_version.py +170 -0
  611. package/deps/librdkafka/tests/interceptor_test/CMakeLists.txt +16 -0
  612. package/deps/librdkafka/tests/interceptor_test/Makefile +22 -0
  613. package/deps/librdkafka/tests/interceptor_test/interceptor_test.c +314 -0
  614. package/deps/librdkafka/tests/interceptor_test/interceptor_test.h +54 -0
  615. package/deps/librdkafka/tests/java/IncrementalRebalanceCli.java +97 -0
  616. package/deps/librdkafka/tests/java/Makefile +13 -0
  617. package/deps/librdkafka/tests/java/Murmur2Cli.java +46 -0
  618. package/deps/librdkafka/tests/java/README.md +14 -0
  619. package/deps/librdkafka/tests/java/TransactionProducerCli.java +162 -0
  620. package/deps/librdkafka/tests/java/run-class.sh +11 -0
  621. package/deps/librdkafka/tests/librdkafka.suppressions +483 -0
  622. package/deps/librdkafka/tests/lz4_manual_test.sh +59 -0
  623. package/deps/librdkafka/tests/multi-broker-version-test.sh +50 -0
  624. package/deps/librdkafka/tests/parse-refcnt.sh +43 -0
  625. package/deps/librdkafka/tests/performance_plot.py +115 -0
  626. package/deps/librdkafka/tests/plugin_test/Makefile +19 -0
  627. package/deps/librdkafka/tests/plugin_test/plugin_test.c +58 -0
  628. package/deps/librdkafka/tests/requirements.txt +2 -0
  629. package/deps/librdkafka/tests/run-all-tests.sh +79 -0
  630. package/deps/librdkafka/tests/run-consumer-tests.sh +16 -0
  631. package/deps/librdkafka/tests/run-producer-tests.sh +16 -0
  632. package/deps/librdkafka/tests/run-test-batches.py +157 -0
  633. package/deps/librdkafka/tests/run-test.sh +140 -0
  634. package/deps/librdkafka/tests/rusage.c +249 -0
  635. package/deps/librdkafka/tests/sasl_test.py +289 -0
  636. package/deps/librdkafka/tests/scenarios/README.md +6 -0
  637. package/deps/librdkafka/tests/scenarios/ak23.json +6 -0
  638. package/deps/librdkafka/tests/scenarios/default.json +5 -0
  639. package/deps/librdkafka/tests/scenarios/noautocreate.json +5 -0
  640. package/deps/librdkafka/tests/sockem.c +801 -0
  641. package/deps/librdkafka/tests/sockem.h +85 -0
  642. package/deps/librdkafka/tests/sockem_ctrl.c +145 -0
  643. package/deps/librdkafka/tests/sockem_ctrl.h +61 -0
  644. package/deps/librdkafka/tests/test.c +7778 -0
  645. package/deps/librdkafka/tests/test.conf.example +27 -0
  646. package/deps/librdkafka/tests/test.h +1028 -0
  647. package/deps/librdkafka/tests/testcpp.cpp +131 -0
  648. package/deps/librdkafka/tests/testcpp.h +388 -0
  649. package/deps/librdkafka/tests/testshared.h +416 -0
  650. package/deps/librdkafka/tests/tools/README.md +4 -0
  651. package/deps/librdkafka/tests/tools/stats/README.md +21 -0
  652. package/deps/librdkafka/tests/tools/stats/filter.jq +42 -0
  653. package/deps/librdkafka/tests/tools/stats/graph.py +150 -0
  654. package/deps/librdkafka/tests/tools/stats/requirements.txt +3 -0
  655. package/deps/librdkafka/tests/tools/stats/to_csv.py +124 -0
  656. package/deps/librdkafka/tests/trivup/trivup-0.14.0.tar.gz +0 -0
  657. package/deps/librdkafka/tests/until-fail.sh +87 -0
  658. package/deps/librdkafka/tests/xxxx-assign_partition.c +122 -0
  659. package/deps/librdkafka/tests/xxxx-metadata.cpp +159 -0
  660. package/deps/librdkafka/vcpkg.json +23 -0
  661. package/deps/librdkafka/win32/README.md +5 -0
  662. package/deps/librdkafka/win32/build-package.bat +3 -0
  663. package/deps/librdkafka/win32/build.bat +19 -0
  664. package/deps/librdkafka/win32/common.vcxproj +84 -0
  665. package/deps/librdkafka/win32/interceptor_test/interceptor_test.vcxproj +87 -0
  666. package/deps/librdkafka/win32/librdkafka.autopkg.template +54 -0
  667. package/deps/librdkafka/win32/librdkafka.master.testing.targets +13 -0
  668. package/deps/librdkafka/win32/librdkafka.sln +226 -0
  669. package/deps/librdkafka/win32/librdkafka.vcxproj +276 -0
  670. package/deps/librdkafka/win32/librdkafkacpp/librdkafkacpp.vcxproj +104 -0
  671. package/deps/librdkafka/win32/msbuild.ps1 +15 -0
  672. package/deps/librdkafka/win32/openssl_engine_example/openssl_engine_example.vcxproj +132 -0
  673. package/deps/librdkafka/win32/package-zip.ps1 +46 -0
  674. package/deps/librdkafka/win32/packages/repositories.config +4 -0
  675. package/deps/librdkafka/win32/push-package.bat +4 -0
  676. package/deps/librdkafka/win32/rdkafka_complex_consumer_example_cpp/rdkafka_complex_consumer_example_cpp.vcxproj +67 -0
  677. package/deps/librdkafka/win32/rdkafka_example/rdkafka_example.vcxproj +97 -0
  678. package/deps/librdkafka/win32/rdkafka_performance/rdkafka_performance.vcxproj +97 -0
  679. package/deps/librdkafka/win32/setup-msys2.ps1 +47 -0
  680. package/deps/librdkafka/win32/setup-vcpkg.ps1 +34 -0
  681. package/deps/librdkafka/win32/tests/test.conf.example +25 -0
  682. package/deps/librdkafka/win32/tests/tests.vcxproj +253 -0
  683. package/deps/librdkafka/win32/win_ssl_cert_store/win_ssl_cert_store.vcxproj +132 -0
  684. package/deps/librdkafka/win32/wingetopt.c +564 -0
  685. package/deps/librdkafka/win32/wingetopt.h +101 -0
  686. package/deps/librdkafka/win32/wintime.h +33 -0
  687. package/deps/librdkafka.gyp +62 -0
  688. package/lib/admin.js +233 -0
  689. package/lib/client.js +573 -0
  690. package/lib/error.js +500 -0
  691. package/lib/index.js +34 -0
  692. package/lib/kafka-consumer-stream.js +397 -0
  693. package/lib/kafka-consumer.js +698 -0
  694. package/lib/producer/high-level-producer.js +323 -0
  695. package/lib/producer-stream.js +307 -0
  696. package/lib/producer.js +375 -0
  697. package/lib/tools/ref-counter.js +52 -0
  698. package/lib/topic-partition.js +88 -0
  699. package/lib/topic.js +42 -0
  700. package/lib/util.js +29 -0
  701. package/package.json +61 -0
  702. package/prebuilds/darwin-arm64/@point3+node-rdkafka.node +0 -0
  703. package/prebuilds/linux-x64/@point3+node-rdkafka.node +0 -0
  704. package/util/configure.js +30 -0
  705. package/util/get-env.js +6 -0
  706. package/util/test-compile.js +11 -0
  707. package/util/test-producer-delivery.js +100 -0
@@ -0,0 +1,1383 @@
1
+ /*
2
+ * librdkafka - Apache Kafka C library
3
+ *
4
+ * Copyright (c) 2019-2022, Magnus Edenhill
5
+ * 2023, Confluent Inc.
6
+ * All rights reserved.
7
+ *
8
+ * Redistribution and use in source and binary forms, with or without
9
+ * modification, are permitted provided that the following conditions are met:
10
+ *
11
+ * 1. Redistributions of source code must retain the above copyright notice,
12
+ * this list of conditions and the following disclaimer.
13
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
14
+ * this list of conditions and the following disclaimer in the documentation
15
+ * and/or other materials provided with the distribution.
16
+ *
17
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
+ * POSSIBILITY OF SUCH DAMAGE.
28
+ */
29
+
30
+ #include "test.h"
31
+
32
+ #include "rdkafka.h"
33
+
34
+ /**
35
+ * @name Producer transaction tests
36
+ *
37
+ */
38
+
39
+
40
+ /**
41
+ * @brief Produce messages using batch interface.
42
+ */
43
+ void do_produce_batch(rd_kafka_t *rk,
44
+ const char *topic,
45
+ uint64_t testid,
46
+ int32_t partition,
47
+ int msg_base,
48
+ int cnt) {
49
+ rd_kafka_message_t *messages;
50
+ rd_kafka_topic_t *rkt = rd_kafka_topic_new(rk, topic, NULL);
51
+ int i;
52
+ int ret;
53
+ int remains = cnt;
54
+
55
+ TEST_SAY("Batch-producing %d messages to partition %" PRId32 "\n", cnt,
56
+ partition);
57
+
58
+ messages = rd_calloc(sizeof(*messages), cnt);
59
+ for (i = 0; i < cnt; i++) {
60
+ char key[128];
61
+ char value[128];
62
+
63
+ test_prepare_msg(testid, partition, msg_base + i, value,
64
+ sizeof(value), key, sizeof(key));
65
+ messages[i].key = rd_strdup(key);
66
+ messages[i].key_len = strlen(key);
67
+ messages[i].payload = rd_strdup(value);
68
+ messages[i].len = strlen(value);
69
+ messages[i]._private = &remains;
70
+ }
71
+
72
+ ret = rd_kafka_produce_batch(rkt, partition, RD_KAFKA_MSG_F_COPY,
73
+ messages, cnt);
74
+
75
+ rd_kafka_topic_destroy(rkt);
76
+
77
+ TEST_ASSERT(ret == cnt,
78
+ "Failed to batch-produce: %d/%d messages produced", ret,
79
+ cnt);
80
+
81
+ for (i = 0; i < cnt; i++) {
82
+ TEST_ASSERT(!messages[i].err, "Failed to produce message: %s",
83
+ rd_kafka_err2str(messages[i].err));
84
+ rd_free(messages[i].key);
85
+ rd_free(messages[i].payload);
86
+ }
87
+ rd_free(messages);
88
+
89
+ /* Wait for deliveries */
90
+ test_wait_delivery(rk, &remains);
91
+ }
92
+
93
+
94
+
95
+ /**
96
+ * @brief Basic producer transaction testing without consumed input
97
+ * (only consumed output for verification).
98
+ * e.g., no consumer offsets to commit with transaction.
99
+ */
100
+ static void do_test_basic_producer_txn(rd_bool_t enable_compression) {
101
+ const char *topic = test_mk_topic_name("0103_transactions", 1);
102
+ const int partition_cnt = 4;
103
+ #define _TXNCNT 6
104
+ struct {
105
+ const char *desc;
106
+ uint64_t testid;
107
+ int msgcnt;
108
+ rd_bool_t abort;
109
+ rd_bool_t sync;
110
+ rd_bool_t batch;
111
+ rd_bool_t batch_any;
112
+ } txn[_TXNCNT] = {
113
+ {"Commit transaction, sync producing", 0, 100, rd_false, rd_true},
114
+ {"Commit transaction, async producing", 0, 1000, rd_false,
115
+ rd_false},
116
+ {"Commit transaction, sync batch producing to any partition", 0,
117
+ 100, rd_false, rd_true, rd_true, rd_true},
118
+ {"Abort transaction, sync producing", 0, 500, rd_true, rd_true},
119
+ {"Abort transaction, async producing", 0, 5000, rd_true, rd_false},
120
+ {"Abort transaction, sync batch producing to one partition", 0, 500,
121
+ rd_true, rd_true, rd_true, rd_false},
122
+
123
+ };
124
+ rd_kafka_t *p, *c;
125
+ rd_kafka_conf_t *conf, *p_conf, *c_conf;
126
+ int i;
127
+
128
+ /* Mark one of run modes as quick so we don't run both when
129
+ * in a hurry.*/
130
+ SUB_TEST0(enable_compression /* quick */, "with%s compression",
131
+ enable_compression ? "" : "out");
132
+
133
+ test_conf_init(&conf, NULL, 30);
134
+
135
+ /* Create producer */
136
+ p_conf = rd_kafka_conf_dup(conf);
137
+ rd_kafka_conf_set_dr_msg_cb(p_conf, test_dr_msg_cb);
138
+ test_conf_set(p_conf, "transactional.id", topic);
139
+ if (enable_compression)
140
+ test_conf_set(p_conf, "compression.type", "lz4");
141
+ p = test_create_handle(RD_KAFKA_PRODUCER, p_conf);
142
+
143
+ // FIXME: add testing were the txn id is reused (and thus fails)
144
+
145
+ /* Create topic */
146
+ test_create_topic_wait_exists(p, topic, partition_cnt, 3, 5000);
147
+
148
+ /* Create consumer */
149
+ c_conf = conf;
150
+ test_conf_set(conf, "auto.offset.reset", "earliest");
151
+ /* Make sure default isolation.level is transaction aware */
152
+ TEST_ASSERT(
153
+ !strcmp(test_conf_get(c_conf, "isolation.level"), "read_committed"),
154
+ "expected isolation.level=read_committed, not %s",
155
+ test_conf_get(c_conf, "isolation.level"));
156
+
157
+ c = test_create_consumer(topic, NULL, c_conf, NULL);
158
+
159
+ /* Wait for topic to propagate to avoid test flakyness */
160
+ test_wait_topic_exists(c, topic, tmout_multip(5000));
161
+
162
+ /* Subscribe to topic */
163
+ test_consumer_subscribe(c, topic);
164
+
165
+ /* Wait for assignment to make sure consumer is fetching messages
166
+ * below, so we can use the poll_no_msgs() timeout to
167
+ * determine that messages were indeed aborted. */
168
+ test_consumer_wait_assignment(c, rd_true);
169
+
170
+ /* Init transactions */
171
+ TEST_CALL_ERROR__(rd_kafka_init_transactions(p, 30 * 1000));
172
+
173
+ for (i = 0; i < _TXNCNT; i++) {
174
+ int wait_msgcnt = 0;
175
+
176
+ TEST_SAY(_C_BLU "txn[%d]: Begin transaction: %s\n" _C_CLR, i,
177
+ txn[i].desc);
178
+
179
+ /* Begin a transaction */
180
+ TEST_CALL_ERROR__(rd_kafka_begin_transaction(p));
181
+
182
+ /* If the transaction is aborted it is okay if
183
+ * messages fail producing, since they'll be
184
+ * purged from queues. */
185
+ test_curr->ignore_dr_err = txn[i].abort;
186
+
187
+ /* Produce messages */
188
+ txn[i].testid = test_id_generate();
189
+ TEST_SAY(
190
+ "txn[%d]: Produce %d messages %ssynchronously "
191
+ "with testid %" PRIu64 "\n",
192
+ i, txn[i].msgcnt, txn[i].sync ? "" : "a", txn[i].testid);
193
+
194
+ if (!txn[i].batch) {
195
+ if (txn[i].sync)
196
+ test_produce_msgs2(p, topic, txn[i].testid,
197
+ RD_KAFKA_PARTITION_UA, 0,
198
+ txn[i].msgcnt, NULL, 0);
199
+ else
200
+ test_produce_msgs2_nowait(
201
+ p, topic, txn[i].testid,
202
+ RD_KAFKA_PARTITION_UA, 0, txn[i].msgcnt,
203
+ NULL, 0, &wait_msgcnt);
204
+ } else if (txn[i].batch_any) {
205
+ /* Batch: use any partition */
206
+ do_produce_batch(p, topic, txn[i].testid,
207
+ RD_KAFKA_PARTITION_UA, 0,
208
+ txn[i].msgcnt);
209
+ } else {
210
+ /* Batch: specific partition */
211
+ do_produce_batch(p, topic, txn[i].testid,
212
+ 1 /* partition */, 0, txn[i].msgcnt);
213
+ }
214
+
215
+
216
+ /* Abort or commit transaction */
217
+ TEST_SAY("txn[%d]: %s" _C_CLR " transaction\n", i,
218
+ txn[i].abort ? _C_RED "Abort" : _C_GRN "Commit");
219
+ if (txn[i].abort) {
220
+ test_curr->ignore_dr_err = rd_true;
221
+ TEST_CALL_ERROR__(
222
+ rd_kafka_abort_transaction(p, 30 * 1000));
223
+ } else {
224
+ test_curr->ignore_dr_err = rd_false;
225
+ TEST_CALL_ERROR__(
226
+ rd_kafka_commit_transaction(p, 30 * 1000));
227
+ }
228
+
229
+ if (!txn[i].sync)
230
+ /* Wait for delivery reports */
231
+ test_wait_delivery(p, &wait_msgcnt);
232
+
233
+ /* Consume messages */
234
+ if (txn[i].abort)
235
+ test_consumer_poll_no_msgs(txn[i].desc, c,
236
+ txn[i].testid, 3000);
237
+ else
238
+ test_consumer_poll(txn[i].desc, c, txn[i].testid,
239
+ partition_cnt, 0, txn[i].msgcnt,
240
+ NULL);
241
+
242
+ TEST_SAY(_C_GRN "txn[%d]: Finished successfully: %s\n" _C_CLR,
243
+ i, txn[i].desc);
244
+ }
245
+
246
+ rd_kafka_destroy(p);
247
+
248
+ test_consumer_close(c);
249
+ rd_kafka_destroy(c);
250
+
251
+ SUB_TEST_PASS();
252
+ }
253
+
254
+
255
+ /**
256
+ * @brief Consumes \p cnt messages and returns them in the provided array
257
+ * which must be pre-allocated.
258
+ */
259
+ static void
260
+ consume_messages(rd_kafka_t *c, rd_kafka_message_t **msgs, int msgcnt) {
261
+ int i = 0;
262
+ while (i < msgcnt) {
263
+ msgs[i] = rd_kafka_consumer_poll(c, 1000);
264
+ if (!msgs[i])
265
+ continue;
266
+
267
+ if (msgs[i]->err) {
268
+ TEST_SAY("%s consumer error: %s\n", rd_kafka_name(c),
269
+ rd_kafka_message_errstr(msgs[i]));
270
+ rd_kafka_message_destroy(msgs[i]);
271
+ continue;
272
+ }
273
+
274
+ TEST_SAYL(3, "%s: consumed message %s [%d] @ %" PRId64 "\n",
275
+ rd_kafka_name(c), rd_kafka_topic_name(msgs[i]->rkt),
276
+ msgs[i]->partition, msgs[i]->offset);
277
+
278
+
279
+ i++;
280
+ }
281
+ }
282
+
283
+ static void destroy_messages(rd_kafka_message_t **msgs, int msgcnt) {
284
+ while (msgcnt-- > 0)
285
+ rd_kafka_message_destroy(msgs[msgcnt]);
286
+ }
287
+
288
+
289
+ /**
290
+ * @brief Test a transactional consumer + transactional producer combo,
291
+ * mimicing a streams job.
292
+ *
293
+ * One input topic produced to by transactional producer 1,
294
+ * consumed by transactional consumer 1, which forwards messages
295
+ * to transactional producer 2 that writes messages to output topic,
296
+ * which is consumed and verified by transactional consumer 2.
297
+ *
298
+ * Every 3rd transaction is aborted.
299
+ */
300
+ void do_test_consumer_producer_txn(void) {
301
+ char *input_topic =
302
+ rd_strdup(test_mk_topic_name("0103-transactions-input", 1));
303
+ char *output_topic =
304
+ rd_strdup(test_mk_topic_name("0103-transactions-output", 1));
305
+ const char *c1_groupid = input_topic;
306
+ const char *c2_groupid = output_topic;
307
+ rd_kafka_t *p1, *p2, *c1, *c2;
308
+ rd_kafka_conf_t *conf, *tmpconf;
309
+ uint64_t testid;
310
+ #define _MSGCNT (10 * 30)
311
+ const int txncnt = 10;
312
+ const int msgcnt = _MSGCNT;
313
+ int txn;
314
+ int committed_msgcnt = 0;
315
+ test_msgver_t expect_mv, actual_mv;
316
+
317
+ SUB_TEST_QUICK("transactional test with %d transactions", txncnt);
318
+
319
+ test_conf_init(&conf, NULL, 30);
320
+
321
+ testid = test_id_generate();
322
+
323
+ /*
324
+ *
325
+ * Producer 1
326
+ * |
327
+ * v
328
+ * input topic
329
+ * |
330
+ * v
331
+ * Consumer 1 }
332
+ * | } transactional streams job
333
+ * v }
334
+ * Producer 2 }
335
+ * |
336
+ * v
337
+ * output tpic
338
+ * |
339
+ * v
340
+ * Consumer 2
341
+ */
342
+
343
+
344
+ /* Create Producer 1 and seed input topic */
345
+ tmpconf = rd_kafka_conf_dup(conf);
346
+ test_conf_set(tmpconf, "transactional.id", input_topic);
347
+ rd_kafka_conf_set_dr_msg_cb(tmpconf, test_dr_msg_cb);
348
+ p1 = test_create_handle(RD_KAFKA_PRODUCER, tmpconf);
349
+
350
+ /* Create input and output topics */
351
+ test_create_topic_wait_exists(p1, input_topic, 4, 3, 5000);
352
+ test_create_topic_wait_exists(p1, output_topic, 4, 3, 5000);
353
+
354
+ /* Seed input topic with messages */
355
+ TEST_CALL_ERROR__(rd_kafka_init_transactions(p1, 30 * 1000));
356
+ TEST_CALL_ERROR__(rd_kafka_begin_transaction(p1));
357
+ test_produce_msgs2(p1, input_topic, testid, RD_KAFKA_PARTITION_UA, 0,
358
+ msgcnt, NULL, 0);
359
+ TEST_CALL_ERROR__(rd_kafka_commit_transaction(p1, 30 * 1000));
360
+
361
+ rd_kafka_destroy(p1);
362
+
363
+ /* Create Consumer 1: reading msgs from input_topic (Producer 1) */
364
+ tmpconf = rd_kafka_conf_dup(conf);
365
+ test_conf_set(tmpconf, "isolation.level", "read_committed");
366
+ test_conf_set(tmpconf, "auto.offset.reset", "earliest");
367
+ test_conf_set(tmpconf, "enable.auto.commit", "false");
368
+ c1 = test_create_consumer(c1_groupid, NULL, tmpconf, NULL);
369
+ test_consumer_subscribe(c1, input_topic);
370
+
371
+ /* Create Producer 2 */
372
+ tmpconf = rd_kafka_conf_dup(conf);
373
+ test_conf_set(tmpconf, "transactional.id", output_topic);
374
+ rd_kafka_conf_set_dr_msg_cb(tmpconf, test_dr_msg_cb);
375
+ p2 = test_create_handle(RD_KAFKA_PRODUCER, tmpconf);
376
+ TEST_CALL_ERROR__(rd_kafka_init_transactions(p2, 30 * 1000));
377
+
378
+ /* Create Consumer 2: reading msgs from output_topic (Producer 2) */
379
+ tmpconf = rd_kafka_conf_dup(conf);
380
+ test_conf_set(tmpconf, "isolation.level", "read_committed");
381
+ test_conf_set(tmpconf, "auto.offset.reset", "earliest");
382
+ c2 = test_create_consumer(c2_groupid, NULL, tmpconf, NULL);
383
+ test_consumer_subscribe(c2, output_topic);
384
+
385
+ /* Keep track of what messages to expect on the output topic */
386
+ test_msgver_init(&expect_mv, testid);
387
+
388
+ for (txn = 0; txn < txncnt; txn++) {
389
+ int msgcnt2 = 10 * (1 + (txn % 3));
390
+ rd_kafka_message_t *msgs[_MSGCNT];
391
+ int i;
392
+ rd_bool_t do_abort = !(txn % 3);
393
+ rd_bool_t recreate_consumer =
394
+ (do_abort && txn == 3) || (!do_abort && txn == 2);
395
+ rd_kafka_topic_partition_list_t *offsets,
396
+ *expected_offsets = NULL;
397
+ rd_kafka_resp_err_t err;
398
+ rd_kafka_consumer_group_metadata_t *c1_cgmetadata;
399
+ int remains = msgcnt2;
400
+
401
+ TEST_SAY(_C_BLU
402
+ "Begin transaction #%d/%d "
403
+ "(msgcnt=%d, do_abort=%s, recreate_consumer=%s)\n",
404
+ txn, txncnt, msgcnt2, do_abort ? "true" : "false",
405
+ recreate_consumer ? "true" : "false");
406
+
407
+ consume_messages(c1, msgs, msgcnt2);
408
+
409
+ TEST_CALL_ERROR__(rd_kafka_begin_transaction(p2));
410
+
411
+ for (i = 0; i < msgcnt2; i++) {
412
+ rd_kafka_message_t *msg = msgs[i];
413
+
414
+ if (!do_abort) {
415
+ /* The expected msgver based on the input topic
416
+ * will be compared to the actual msgver based
417
+ * on the output topic, so we need to
418
+ * override the topic name to match
419
+ * the actual msgver's output topic. */
420
+ test_msgver_add_msg0(
421
+ __FUNCTION__, __LINE__, rd_kafka_name(p2),
422
+ &expect_mv, msg, output_topic);
423
+ committed_msgcnt++;
424
+ }
425
+
426
+ err = rd_kafka_producev(
427
+ p2, RD_KAFKA_V_TOPIC(output_topic),
428
+ RD_KAFKA_V_KEY(msg->key, msg->key_len),
429
+ RD_KAFKA_V_VALUE(msg->payload, msg->len),
430
+ RD_KAFKA_V_MSGFLAGS(RD_KAFKA_MSG_F_COPY),
431
+ RD_KAFKA_V_OPAQUE(&remains), RD_KAFKA_V_END);
432
+ TEST_ASSERT(!err, "produce failed: %s",
433
+ rd_kafka_err2str(err));
434
+
435
+ rd_kafka_poll(p2, 0);
436
+ }
437
+
438
+ destroy_messages(msgs, msgcnt2);
439
+
440
+ err = rd_kafka_assignment(c1, &offsets);
441
+ TEST_ASSERT(!err, "failed to get consumer assignment: %s",
442
+ rd_kafka_err2str(err));
443
+
444
+ err = rd_kafka_position(c1, offsets);
445
+ TEST_ASSERT(!err, "failed to get consumer position: %s",
446
+ rd_kafka_err2str(err));
447
+
448
+ c1_cgmetadata = rd_kafka_consumer_group_metadata(c1);
449
+ TEST_ASSERT(c1_cgmetadata != NULL,
450
+ "failed to get consumer group metadata");
451
+
452
+ TEST_CALL_ERROR__(rd_kafka_send_offsets_to_transaction(
453
+ p2, offsets, c1_cgmetadata, -1));
454
+
455
+ if (recreate_consumer && !do_abort) {
456
+ expected_offsets =
457
+ rd_kafka_topic_partition_list_new(offsets->cnt);
458
+
459
+ /* Cannot use rd_kafka_topic_partition_list_copy
460
+ * as it needs to be destroyed before closing the
461
+ * consumer, because of the _private field holding
462
+ * a reference to the internal toppar */
463
+ for (i = 0; i < offsets->cnt; i++) {
464
+ rd_kafka_topic_partition_t *rktpar =
465
+ &offsets->elems[i];
466
+ rd_kafka_topic_partition_t *rktpar_new;
467
+ rktpar_new = rd_kafka_topic_partition_list_add(
468
+ expected_offsets, rktpar->topic,
469
+ rktpar->partition);
470
+ rktpar_new->offset = rktpar->offset;
471
+ rd_kafka_topic_partition_set_leader_epoch(
472
+ rktpar_new,
473
+ rd_kafka_topic_partition_get_leader_epoch(
474
+ rktpar));
475
+ }
476
+ }
477
+
478
+ rd_kafka_consumer_group_metadata_destroy(c1_cgmetadata);
479
+
480
+ rd_kafka_topic_partition_list_destroy(offsets);
481
+
482
+
483
+ if (do_abort) {
484
+ test_curr->ignore_dr_err = rd_true;
485
+ TEST_CALL_ERROR__(
486
+ rd_kafka_abort_transaction(p2, 30 * 1000));
487
+ } else {
488
+ test_curr->ignore_dr_err = rd_false;
489
+ TEST_CALL_ERROR__(
490
+ rd_kafka_commit_transaction(p2, 30 * 1000));
491
+ }
492
+
493
+ TEST_ASSERT(remains == 0,
494
+ "expected no remaining messages "
495
+ "in-flight/in-queue, got %d",
496
+ remains);
497
+
498
+
499
+ if (recreate_consumer) {
500
+ /* Recreate the consumer to pick up
501
+ * on the committed offset. */
502
+ TEST_SAY("Recreating consumer 1\n");
503
+ rd_kafka_consumer_close(c1);
504
+ rd_kafka_destroy(c1);
505
+
506
+ tmpconf = rd_kafka_conf_dup(conf);
507
+ test_conf_set(tmpconf, "isolation.level",
508
+ "read_committed");
509
+ test_conf_set(tmpconf, "auto.offset.reset", "earliest");
510
+ test_conf_set(tmpconf, "enable.auto.commit", "false");
511
+ c1 = test_create_consumer(c1_groupid, NULL, tmpconf,
512
+ NULL);
513
+ test_consumer_subscribe(c1, input_topic);
514
+
515
+
516
+ if (expected_offsets) {
517
+ rd_kafka_topic_partition_list_t
518
+ *committed_offsets =
519
+ rd_kafka_topic_partition_list_copy(
520
+ expected_offsets);
521
+ /* Set committed offsets and epochs to a
522
+ * different value before requesting them. */
523
+ for (i = 0; i < committed_offsets->cnt; i++) {
524
+ rd_kafka_topic_partition_t *rktpar =
525
+ &committed_offsets->elems[i];
526
+ rktpar->offset = -100;
527
+ rd_kafka_topic_partition_set_leader_epoch(
528
+ rktpar, -100);
529
+ }
530
+
531
+ TEST_CALL_ERR__(rd_kafka_committed(
532
+ c1, committed_offsets, -1));
533
+
534
+ if (test_partition_list_and_offsets_cmp(
535
+ expected_offsets, committed_offsets)) {
536
+ TEST_SAY("expected list:\n");
537
+ test_print_partition_list(
538
+ expected_offsets);
539
+ TEST_SAY("committed() list:\n");
540
+ test_print_partition_list(
541
+ committed_offsets);
542
+ TEST_FAIL(
543
+ "committed offsets don't match");
544
+ }
545
+
546
+ rd_kafka_topic_partition_list_destroy(
547
+ committed_offsets);
548
+
549
+ rd_kafka_topic_partition_list_destroy(
550
+ expected_offsets);
551
+ }
552
+ }
553
+ }
554
+
555
+ rd_kafka_conf_destroy(conf);
556
+
557
+ test_msgver_init(&actual_mv, testid);
558
+
559
+ test_consumer_poll("Verify output topic", c2, testid, -1, 0,
560
+ committed_msgcnt, &actual_mv);
561
+
562
+ test_msgver_verify_compare("Verify output topic", &actual_mv,
563
+ &expect_mv, TEST_MSGVER_ALL);
564
+
565
+ test_msgver_clear(&actual_mv);
566
+ test_msgver_clear(&expect_mv);
567
+
568
+ rd_kafka_consumer_close(c1);
569
+ rd_kafka_consumer_close(c2);
570
+ rd_kafka_destroy(c1);
571
+ rd_kafka_destroy(c2);
572
+ rd_kafka_destroy(p2);
573
+
574
+ rd_free(input_topic);
575
+ rd_free(output_topic);
576
+
577
+ SUB_TEST_PASS();
578
+ }
579
+
580
+
581
+ /**
582
+ * @brief Testing misuse of the transaction API.
583
+ */
584
+ static void do_test_misuse_txn(void) {
585
+ const char *topic = test_mk_topic_name("0103-test_misuse_txn", 1);
586
+ rd_kafka_t *p;
587
+ rd_kafka_conf_t *conf;
588
+ rd_kafka_error_t *error;
589
+ rd_kafka_resp_err_t fatal_err;
590
+ char errstr[512];
591
+ int i;
592
+
593
+ /*
594
+ * transaction.timeout.ms out of range (from broker's point of view)
595
+ */
596
+ SUB_TEST_QUICK();
597
+
598
+ test_conf_init(&conf, NULL, 10);
599
+
600
+ test_conf_set(conf, "transactional.id", topic);
601
+ test_conf_set(conf, "transaction.timeout.ms", "2147483647");
602
+
603
+ p = test_create_handle(RD_KAFKA_PRODUCER, conf);
604
+
605
+ error = rd_kafka_init_transactions(p, 10 * 1000);
606
+ TEST_ASSERT(error, "Expected init_transactions() to fail");
607
+ TEST_ASSERT(rd_kafka_error_code(error) ==
608
+ RD_KAFKA_RESP_ERR_INVALID_TRANSACTION_TIMEOUT,
609
+ "Expected error ERR_INVALID_TRANSACTION_TIMEOUT, "
610
+ "not %s: %s",
611
+ rd_kafka_error_name(error),
612
+ error ? rd_kafka_error_string(error) : "");
613
+ TEST_ASSERT(rd_kafka_error_is_fatal(error),
614
+ "Expected error to have is_fatal() set");
615
+ rd_kafka_error_destroy(error);
616
+ /* Check that a fatal error is raised */
617
+ fatal_err = rd_kafka_fatal_error(p, errstr, sizeof(errstr));
618
+ TEST_ASSERT(fatal_err == RD_KAFKA_RESP_ERR_INVALID_TRANSACTION_TIMEOUT,
619
+ "Expected fatal error ERR_INVALID_TRANSACTION_TIMEOUT, "
620
+ "not %s: %s",
621
+ rd_kafka_err2name(fatal_err), fatal_err ? errstr : "");
622
+
623
+ rd_kafka_destroy(p);
624
+
625
+
626
+ /*
627
+ * Multiple calls to init_transactions(): finish on first.
628
+ */
629
+ TEST_SAY("[ Test multiple init_transactions(): finish on first ]\n");
630
+ test_conf_init(&conf, NULL, 10);
631
+
632
+ test_conf_set(conf, "transactional.id", topic);
633
+
634
+ p = test_create_handle(RD_KAFKA_PRODUCER, conf);
635
+
636
+ TEST_CALL_ERROR__(rd_kafka_init_transactions(p, 30 * 1000));
637
+
638
+ error = rd_kafka_init_transactions(p, 1);
639
+ TEST_ASSERT(error, "Expected init_transactions() to fail");
640
+ TEST_ASSERT(rd_kafka_error_code(error) == RD_KAFKA_RESP_ERR__STATE,
641
+ "Expected ERR__STATE error, not %s",
642
+ rd_kafka_error_name(error));
643
+ rd_kafka_error_destroy(error);
644
+
645
+ TEST_CALL_ERROR__(rd_kafka_begin_transaction(p));
646
+
647
+ error = rd_kafka_init_transactions(p, 3 * 1000);
648
+ TEST_ASSERT(error, "Expected init_transactions() to fail");
649
+ TEST_ASSERT(rd_kafka_error_code(error) == RD_KAFKA_RESP_ERR__STATE,
650
+ "Expected ERR__STATE error, not %s",
651
+ rd_kafka_error_name(error));
652
+ rd_kafka_error_destroy(error);
653
+
654
+ rd_kafka_destroy(p);
655
+
656
+
657
+ /*
658
+ * Multiple calls to init_transactions(): timeout on first.
659
+ */
660
+ TEST_SAY("[ Test multiple init_transactions(): timeout on first ]\n");
661
+ test_conf_init(&conf, NULL, 10);
662
+
663
+ test_conf_set(conf, "transactional.id", topic);
664
+
665
+ p = test_create_handle(RD_KAFKA_PRODUCER, conf);
666
+
667
+ error = rd_kafka_init_transactions(p, 1);
668
+ TEST_ASSERT(error, "Expected init_transactions() to fail");
669
+ TEST_SAY("error: %s, %d\n", rd_kafka_error_string(error),
670
+ rd_kafka_error_is_retriable(error));
671
+ TEST_ASSERT(rd_kafka_error_code(error) == RD_KAFKA_RESP_ERR__TIMED_OUT,
672
+ "Expected ERR__TIMED_OUT, not %s: %s",
673
+ rd_kafka_error_name(error), rd_kafka_error_string(error));
674
+ TEST_ASSERT(rd_kafka_error_is_retriable(error),
675
+ "Expected error to be retriable");
676
+ rd_kafka_error_destroy(error);
677
+
678
+ TEST_CALL_ERROR__(rd_kafka_init_transactions(p, 30 * 1000));
679
+
680
+ rd_kafka_destroy(p);
681
+
682
+
683
+ /*
684
+ * Multiple calls to init_transactions(): hysterical amounts
685
+ */
686
+ TEST_SAY("[ Test multiple init_transactions(): hysterical amounts ]\n");
687
+ test_conf_init(&conf, NULL, 10);
688
+
689
+ test_conf_set(conf, "transactional.id", topic);
690
+
691
+ p = test_create_handle(RD_KAFKA_PRODUCER, conf);
692
+
693
+ /* Call until init succeeds */
694
+ for (i = 0; i < 5000; i++) {
695
+ if (!(error = rd_kafka_init_transactions(p, 1)))
696
+ break;
697
+
698
+ TEST_ASSERT(rd_kafka_error_is_retriable(error),
699
+ "Expected error to be retriable");
700
+ rd_kafka_error_destroy(error);
701
+
702
+ error = rd_kafka_begin_transaction(p);
703
+ TEST_ASSERT(error, "Expected begin_transactions() to fail");
704
+ TEST_ASSERT(rd_kafka_error_code(error) ==
705
+ RD_KAFKA_RESP_ERR__CONFLICT,
706
+ "Expected begin_transactions() to fail "
707
+ "with CONFLICT, not %s",
708
+ rd_kafka_error_name(error));
709
+
710
+ rd_kafka_error_destroy(error);
711
+ }
712
+
713
+ TEST_ASSERT(i <= 5000,
714
+ "init_transactions() did not succeed after %d calls\n", i);
715
+
716
+ TEST_SAY("init_transactions() succeeded after %d call(s)\n", i + 1);
717
+
718
+ /* Make sure a sub-sequent init call fails. */
719
+ error = rd_kafka_init_transactions(p, 5 * 1000);
720
+ TEST_ASSERT(error, "Expected init_transactions() to fail");
721
+ TEST_ASSERT(rd_kafka_error_code(error) == RD_KAFKA_RESP_ERR__STATE,
722
+ "Expected init_transactions() to fail with STATE, not %s",
723
+ rd_kafka_error_name(error));
724
+ rd_kafka_error_destroy(error);
725
+
726
+ /* But begin.. should work now */
727
+ TEST_CALL_ERROR__(rd_kafka_begin_transaction(p));
728
+
729
+ rd_kafka_destroy(p);
730
+
731
+ SUB_TEST_PASS();
732
+ }
733
+
734
+
735
+ /**
736
+ * @brief is_fatal_cb for fenced_txn test.
737
+ */
738
+ static int fenced_txn_is_fatal_cb(rd_kafka_t *rk,
739
+ rd_kafka_resp_err_t err,
740
+ const char *reason) {
741
+ TEST_SAY("is_fatal?: %s: %s\n", rd_kafka_err2str(err), reason);
742
+ if (err == RD_KAFKA_RESP_ERR__FENCED) {
743
+ TEST_SAY("Saw the expected fatal error\n");
744
+ return 0;
745
+ }
746
+ return 1;
747
+ }
748
+
749
+
750
+ /**
751
+ * @brief Check that transaction fencing is handled correctly.
752
+ */
753
+ static void do_test_fenced_txn(rd_bool_t produce_after_fence) {
754
+ const char *topic = test_mk_topic_name("0103_fenced_txn", 1);
755
+ rd_kafka_conf_t *conf;
756
+ rd_kafka_t *p1, *p2;
757
+ rd_kafka_error_t *error;
758
+ uint64_t testid;
759
+
760
+ SUB_TEST_QUICK("%sproduce after fence",
761
+ produce_after_fence ? "" : "do not ");
762
+
763
+ if (produce_after_fence)
764
+ test_curr->is_fatal_cb = fenced_txn_is_fatal_cb;
765
+
766
+ test_curr->ignore_dr_err = rd_false;
767
+
768
+ testid = test_id_generate();
769
+
770
+ test_conf_init(&conf, NULL, 30);
771
+
772
+ test_conf_set(conf, "transactional.id", topic);
773
+ rd_kafka_conf_set_dr_msg_cb(conf, test_dr_msg_cb);
774
+
775
+ p1 = test_create_handle(RD_KAFKA_PRODUCER, rd_kafka_conf_dup(conf));
776
+ p2 = test_create_handle(RD_KAFKA_PRODUCER, rd_kafka_conf_dup(conf));
777
+ rd_kafka_conf_destroy(conf);
778
+
779
+ TEST_CALL_ERROR__(rd_kafka_init_transactions(p1, 30 * 1000));
780
+
781
+ /* Begin a transaction */
782
+ TEST_CALL_ERROR__(rd_kafka_begin_transaction(p1));
783
+
784
+ /* Produce some messages */
785
+ test_produce_msgs2(p1, topic, testid, RD_KAFKA_PARTITION_UA, 0, 10,
786
+ NULL, 0);
787
+
788
+ /* Initialize transactions on producer 2, this should
789
+ * fence off producer 1. */
790
+ TEST_CALL_ERROR__(rd_kafka_init_transactions(p2, 30 * 1000));
791
+
792
+ if (produce_after_fence) {
793
+ /* This will fail hard since the epoch was bumped. */
794
+ TEST_SAY("Producing after producing fencing\n");
795
+ test_curr->ignore_dr_err = rd_true;
796
+ test_produce_msgs2(p1, topic, testid, RD_KAFKA_PARTITION_UA, 0,
797
+ 10, NULL, 0);
798
+ }
799
+
800
+
801
+ error = rd_kafka_commit_transaction(p1, 30 * 1000);
802
+
803
+ TEST_ASSERT(error, "Expected commit to fail");
804
+ TEST_ASSERT(rd_kafka_fatal_error(p1, NULL, 0),
805
+ "Expected a fatal error to have been raised");
806
+ TEST_ASSERT(error, "Expected commit_transaction() to fail");
807
+ TEST_ASSERT(rd_kafka_error_is_fatal(error),
808
+ "Expected commit_transaction() to return a "
809
+ "fatal error");
810
+ TEST_ASSERT(!rd_kafka_error_txn_requires_abort(error),
811
+ "Expected commit_transaction() not to return an "
812
+ "abortable error");
813
+ TEST_ASSERT(!rd_kafka_error_is_retriable(error),
814
+ "Expected commit_transaction() not to return a "
815
+ "retriable error");
816
+ TEST_ASSERT(rd_kafka_error_code(error) == RD_KAFKA_RESP_ERR__FENCED,
817
+ "Expected commit_transaction() to return %s, "
818
+ "not %s: %s",
819
+ rd_kafka_err2name(RD_KAFKA_RESP_ERR__FENCED),
820
+ rd_kafka_error_name(error), rd_kafka_error_string(error));
821
+ rd_kafka_error_destroy(error);
822
+
823
+ rd_kafka_destroy(p1);
824
+ rd_kafka_destroy(p2);
825
+
826
+ /* Make sure no messages were committed. */
827
+ test_consume_txn_msgs_easy(
828
+ topic, topic, testid,
829
+ test_get_partition_count(NULL, topic, 10 * 1000), 0, NULL);
830
+
831
+ SUB_TEST_PASS();
832
+ }
833
+
834
+
835
+
836
+ /**
837
+ * @brief Check that fatal idempotent producer errors are also fatal
838
+ * transactional errors when KIP-360 is not supported.
839
+ */
840
+ static void do_test_fatal_idempo_error_without_kip360(void) {
841
+ const char *topic = test_mk_topic_name("0103_fatal_idempo", 1);
842
+ const int32_t partition = 0;
843
+ rd_kafka_conf_t *conf, *c_conf;
844
+ rd_kafka_t *p, *c;
845
+ rd_kafka_error_t *error;
846
+ uint64_t testid;
847
+ const int msgcnt[3] = {6, 4, 1};
848
+ rd_kafka_topic_partition_list_t *records;
849
+ test_msgver_t expect_mv, actual_mv;
850
+ /* This test triggers UNKNOWN_PRODUCER_ID on AK <2.4 and >2.4, but
851
+ * not on AK 2.4.
852
+ * On AK <2.5 (pre KIP-360) these errors are unrecoverable,
853
+ * on AK >2.5 (with KIP-360) we can recover.
854
+ * Since 2.4 is not behaving as the other releases we skip it here. */
855
+ rd_bool_t expect_fail = test_broker_version < TEST_BRKVER(2, 5, 0, 0);
856
+
857
+ SUB_TEST_QUICK(
858
+ "%s", expect_fail ? "expecting failure since broker is < 2.5"
859
+ : "not expecting failure since broker is >= 2.5");
860
+
861
+ if (test_broker_version >= TEST_BRKVER(2, 4, 0, 0) &&
862
+ test_broker_version < TEST_BRKVER(2, 5, 0, 0))
863
+ SUB_TEST_SKIP("can't trigger UNKNOWN_PRODUCER_ID on AK 2.4");
864
+
865
+ if (expect_fail)
866
+ test_curr->is_fatal_cb = test_error_is_not_fatal_cb;
867
+ test_curr->ignore_dr_err = expect_fail;
868
+
869
+ testid = test_id_generate();
870
+
871
+ /* Keep track of what messages to expect on the output topic */
872
+ test_msgver_init(&expect_mv, testid);
873
+
874
+ test_conf_init(&conf, NULL, 30);
875
+
876
+ test_conf_set(conf, "transactional.id", topic);
877
+ test_conf_set(conf, "batch.num.messages", "1");
878
+ rd_kafka_conf_set_dr_msg_cb(conf, test_dr_msg_cb);
879
+
880
+ p = test_create_handle(RD_KAFKA_PRODUCER, conf);
881
+
882
+ test_create_topic_wait_exists(p, topic, 1, 3, 5000);
883
+
884
+
885
+ TEST_CALL_ERROR__(rd_kafka_init_transactions(p, 30 * 1000));
886
+
887
+ /*
888
+ * 3 transactions:
889
+ * 1. Produce some messages, commit.
890
+ * 2. Produce some messages, then delete the messages from txn 1 and
891
+ * then produce some more messages: UNKNOWN_PRODUCER_ID should be
892
+ * raised as a fatal error.
893
+ * 3. Start a new transaction, produce and commit some new messages.
894
+ * (this step is only performed when expect_fail is false).
895
+ */
896
+
897
+ /*
898
+ * Transaction 1
899
+ */
900
+ TEST_SAY(_C_BLU "Transaction 1: %d msgs\n", msgcnt[0]);
901
+ TEST_CALL_ERROR__(rd_kafka_begin_transaction(p));
902
+ test_produce_msgs2(p, topic, testid, partition, 0, msgcnt[0], NULL, 0);
903
+ TEST_CALL_ERROR__(rd_kafka_commit_transaction(p, -1));
904
+
905
+
906
+ /*
907
+ * Transaction 2
908
+ */
909
+ TEST_SAY(_C_BLU "Transaction 2: %d msgs\n", msgcnt[1]);
910
+ TEST_CALL_ERROR__(rd_kafka_begin_transaction(p));
911
+
912
+ /* Now delete the messages from txn1 */
913
+ TEST_SAY("Deleting records < %s [%" PRId32 "] offset %d+1\n", topic,
914
+ partition, msgcnt[0]);
915
+ records = rd_kafka_topic_partition_list_new(1);
916
+ rd_kafka_topic_partition_list_add(records, topic, partition)->offset =
917
+ msgcnt[0]; /* include the control message too */
918
+
919
+ TEST_CALL_ERR__(test_DeleteRecords_simple(p, NULL, records, NULL));
920
+ rd_kafka_topic_partition_list_destroy(records);
921
+
922
+ /* Wait for deletes to propagate */
923
+ rd_sleep(2);
924
+
925
+ if (!expect_fail)
926
+ test_curr->dr_mv = &expect_mv;
927
+
928
+ /* Produce more messages, should now fail */
929
+ test_produce_msgs2(p, topic, testid, partition, 0, msgcnt[1], NULL, 0);
930
+
931
+ error = rd_kafka_commit_transaction(p, -1);
932
+
933
+ TEST_SAY_ERROR(error, "commit_transaction() returned: ");
934
+
935
+ if (expect_fail) {
936
+ TEST_ASSERT(error != NULL, "Expected transaction to fail");
937
+ TEST_ASSERT(rd_kafka_error_txn_requires_abort(error),
938
+ "Expected abortable error");
939
+ rd_kafka_error_destroy(error);
940
+
941
+ /* Now abort transaction, which should raise the fatal error
942
+ * since it is the abort that performs the PID reinitialization.
943
+ */
944
+ error = rd_kafka_abort_transaction(p, -1);
945
+ TEST_SAY_ERROR(error, "abort_transaction() returned: ");
946
+ TEST_ASSERT(error != NULL, "Expected abort to fail");
947
+ TEST_ASSERT(rd_kafka_error_is_fatal(error),
948
+ "Expecting fatal error");
949
+ TEST_ASSERT(!rd_kafka_error_is_retriable(error),
950
+ "Did not expect retriable error");
951
+ TEST_ASSERT(!rd_kafka_error_txn_requires_abort(error),
952
+ "Did not expect abortable error");
953
+
954
+ rd_kafka_error_destroy(error);
955
+
956
+ } else {
957
+ TEST_ASSERT(!error, "Did not expect commit to fail: %s",
958
+ rd_kafka_error_string(error));
959
+ }
960
+
961
+
962
+ if (!expect_fail) {
963
+ /*
964
+ * Transaction 3
965
+ */
966
+ TEST_SAY(_C_BLU "Transaction 3: %d msgs\n", msgcnt[2]);
967
+ test_curr->dr_mv = &expect_mv;
968
+ TEST_CALL_ERROR__(rd_kafka_begin_transaction(p));
969
+ test_produce_msgs2(p, topic, testid, partition, 0, msgcnt[2],
970
+ NULL, 0);
971
+ TEST_CALL_ERROR__(rd_kafka_commit_transaction(p, -1));
972
+ }
973
+
974
+ rd_kafka_destroy(p);
975
+
976
+ /* Consume messages.
977
+ * On AK<2.5 (expect_fail=true) we do not expect to see any messages
978
+ * since the producer will have failed with a fatal error.
979
+ * On AK>=2.5 (expect_fail=false) we should only see messages from
980
+ * txn 3 which are sent after the producer has recovered.
981
+ */
982
+
983
+ test_conf_init(&c_conf, NULL, 0);
984
+ test_conf_set(c_conf, "enable.partition.eof", "true");
985
+ c = test_create_consumer(topic, NULL, c_conf, NULL);
986
+ test_consumer_assign_partition("consume", c, topic, partition,
987
+ RD_KAFKA_OFFSET_BEGINNING);
988
+
989
+ test_msgver_init(&actual_mv, testid);
990
+ test_msgver_ignore_eof(&actual_mv);
991
+
992
+ test_consumer_poll("Verify output topic", c, testid, 1, 0, -1,
993
+ &actual_mv);
994
+
995
+ test_msgver_verify_compare("Verify output topic", &actual_mv,
996
+ &expect_mv, TEST_MSGVER_ALL);
997
+
998
+ test_msgver_clear(&actual_mv);
999
+ test_msgver_clear(&expect_mv);
1000
+
1001
+ rd_kafka_destroy(c);
1002
+
1003
+ SUB_TEST_PASS();
1004
+ }
1005
+
1006
+
1007
+ /**
1008
+ * @brief Check that empty transactions, with no messages produced, work
1009
+ * as expected.
1010
+ */
1011
+ static void do_test_empty_txn(rd_bool_t send_offsets, rd_bool_t do_commit) {
1012
+ const char *topic = test_mk_topic_name("0103_empty_txn", 1);
1013
+ rd_kafka_conf_t *conf, *c_conf;
1014
+ rd_kafka_t *p, *c;
1015
+ uint64_t testid;
1016
+ const int msgcnt = 10;
1017
+ rd_kafka_topic_partition_list_t *committed;
1018
+ int64_t offset;
1019
+
1020
+ SUB_TEST_QUICK("%ssend offsets, %s", send_offsets ? "" : "don't ",
1021
+ do_commit ? "commit" : "abort");
1022
+
1023
+ testid = test_id_generate();
1024
+
1025
+ test_conf_init(&conf, NULL, 30);
1026
+ c_conf = rd_kafka_conf_dup(conf);
1027
+
1028
+ test_conf_set(conf, "transactional.id", topic);
1029
+ rd_kafka_conf_set_dr_msg_cb(conf, test_dr_msg_cb);
1030
+ p = test_create_handle(RD_KAFKA_PRODUCER, conf);
1031
+
1032
+ test_create_topic_wait_exists(p, topic, 1, 3, 5000);
1033
+
1034
+ /* Produce some non-txnn messages for the consumer to read and commit */
1035
+ test_produce_msgs_easy(topic, testid, 0, msgcnt);
1036
+
1037
+ /* Create consumer and subscribe to the topic */
1038
+ test_conf_set(c_conf, "auto.offset.reset", "earliest");
1039
+ test_conf_set(c_conf, "enable.auto.commit", "false");
1040
+ c = test_create_consumer(topic, NULL, c_conf, NULL);
1041
+ test_consumer_subscribe(c, topic);
1042
+ test_consumer_wait_assignment(c, rd_false);
1043
+
1044
+ TEST_CALL_ERROR__(rd_kafka_init_transactions(p, -1));
1045
+
1046
+ TEST_CALL_ERROR__(rd_kafka_begin_transaction(p));
1047
+
1048
+ /* send_offsets? Consume messages and send those offsets to the txn */
1049
+ if (send_offsets) {
1050
+ rd_kafka_topic_partition_list_t *offsets;
1051
+ rd_kafka_consumer_group_metadata_t *cgmetadata;
1052
+
1053
+ test_consumer_poll("consume", c, testid, -1, 0, msgcnt, NULL);
1054
+
1055
+ TEST_CALL_ERR__(rd_kafka_assignment(c, &offsets));
1056
+ TEST_CALL_ERR__(rd_kafka_position(c, offsets));
1057
+
1058
+ cgmetadata = rd_kafka_consumer_group_metadata(c);
1059
+ TEST_ASSERT(cgmetadata != NULL,
1060
+ "failed to get consumer group metadata");
1061
+
1062
+ TEST_CALL_ERROR__(rd_kafka_send_offsets_to_transaction(
1063
+ p, offsets, cgmetadata, -1));
1064
+
1065
+ rd_kafka_consumer_group_metadata_destroy(cgmetadata);
1066
+
1067
+ rd_kafka_topic_partition_list_destroy(offsets);
1068
+ }
1069
+
1070
+
1071
+ if (do_commit)
1072
+ TEST_CALL_ERROR__(rd_kafka_commit_transaction(p, -1));
1073
+ else
1074
+ TEST_CALL_ERROR__(rd_kafka_abort_transaction(p, -1));
1075
+
1076
+ /* Wait before checking the committed offsets (Kafka < 2.5.0) */
1077
+ if (test_broker_version < TEST_BRKVER(2, 5, 0, 0))
1078
+ rd_usleep(tmout_multip(5000 * 1000), NULL);
1079
+
1080
+ /* Get the committed offsets */
1081
+ TEST_CALL_ERR__(rd_kafka_assignment(c, &committed));
1082
+ TEST_CALL_ERR__(rd_kafka_committed(c, committed, 10 * 1000));
1083
+
1084
+ TEST_ASSERT(committed->cnt == 1,
1085
+ "expected one committed offset, not %d", committed->cnt);
1086
+ offset = committed->elems[0].offset;
1087
+ TEST_SAY("Committed offset is %" PRId64 "\n", offset);
1088
+
1089
+ if (do_commit && send_offsets)
1090
+ TEST_ASSERT(offset >= msgcnt,
1091
+ "expected committed offset >= %d, got %" PRId64,
1092
+ msgcnt, offset);
1093
+ else
1094
+ TEST_ASSERT(offset < 0,
1095
+ "expected no committed offset, got %" PRId64,
1096
+ offset);
1097
+
1098
+ rd_kafka_topic_partition_list_destroy(committed);
1099
+
1100
+ rd_kafka_destroy(c);
1101
+ rd_kafka_destroy(p);
1102
+
1103
+ SUB_TEST_PASS();
1104
+ }
1105
+
1106
+
1107
+ /**
1108
+ * @brief A control message should increase stored offset and
1109
+ * that stored offset should have correct leader epoch
1110
+ * and be included in commit.
1111
+ * See #4384.
1112
+ */
1113
+ static void do_test_txn_abort_control_message_leader_epoch(void) {
1114
+ const char *topic = test_mk_topic_name(__FUNCTION__, 1);
1115
+
1116
+ rd_kafka_t *p, *c;
1117
+ rd_kafka_conf_t *p_conf, *c_conf;
1118
+ test_msgver_t mv;
1119
+ int exp_msg_cnt = 0;
1120
+ uint64_t testid = test_id_generate();
1121
+ rd_kafka_topic_partition_list_t *offsets;
1122
+ int r;
1123
+
1124
+ SUB_TEST_QUICK();
1125
+
1126
+ test_conf_init(&p_conf, NULL, 30);
1127
+ c_conf = rd_kafka_conf_dup(p_conf);
1128
+
1129
+ test_conf_set(p_conf, "transactional.id", topic);
1130
+ rd_kafka_conf_set_dr_msg_cb(p_conf, test_dr_msg_cb);
1131
+ p = test_create_handle(RD_KAFKA_PRODUCER, p_conf);
1132
+
1133
+ test_create_topic_wait_exists(p, topic, 1, 3, 5000);
1134
+
1135
+ TEST_CALL_ERROR__(rd_kafka_init_transactions(p, 5000));
1136
+
1137
+ TEST_CALL_ERROR__(rd_kafka_begin_transaction(p));
1138
+
1139
+ /* Produce one message */
1140
+ test_produce_msgs2(p, topic, testid, RD_KAFKA_PARTITION_UA, 0, 1, NULL,
1141
+ 0);
1142
+
1143
+ /* Abort the transaction */
1144
+ TEST_CALL_ERROR__(rd_kafka_abort_transaction(p, -1));
1145
+
1146
+ /**
1147
+ * Create consumer.
1148
+ */
1149
+ test_conf_set(c_conf, "enable.auto.commit", "false");
1150
+ test_conf_set(c_conf, "group.id", topic);
1151
+ test_conf_set(c_conf, "enable.partition.eof", "true");
1152
+ test_conf_set(c_conf, "auto.offset.reset", "earliest");
1153
+ test_msgver_init(&mv, testid);
1154
+ c = test_create_consumer(topic, NULL, c_conf, NULL);
1155
+
1156
+
1157
+ test_consumer_subscribe(c, topic);
1158
+ /* Expect 0 messages and 1 EOF */
1159
+ r = test_consumer_poll("consume.nothing", c, testid,
1160
+ /* exp_eof_cnt */ 1,
1161
+ /* exp_msg_base */ 0, exp_msg_cnt, &mv);
1162
+ test_msgver_clear(&mv);
1163
+
1164
+ TEST_ASSERT(r == exp_msg_cnt, "expected %d messages, got %d",
1165
+ exp_msg_cnt, r);
1166
+
1167
+ /* Commits offset 2 (1 aborted message + 1 control message) */
1168
+ TEST_CALL_ERR__(rd_kafka_commit(c, NULL, rd_false));
1169
+
1170
+ offsets = rd_kafka_topic_partition_list_new(1);
1171
+ rd_kafka_topic_partition_list_add(offsets, topic, 0);
1172
+ rd_kafka_committed(c, offsets, -1);
1173
+
1174
+ /* Committed offset must be 2 */
1175
+ TEST_ASSERT(offsets->cnt == 1, "expected 1 partition, got %d",
1176
+ offsets->cnt);
1177
+ TEST_ASSERT(offsets->elems[0].offset == 2,
1178
+ "expected offset 2, got %" PRId64,
1179
+ offsets->elems[0].offset);
1180
+
1181
+ /* All done */
1182
+ test_consumer_close(c);
1183
+ rd_kafka_topic_partition_list_destroy(offsets);
1184
+ rd_kafka_destroy(c);
1185
+ rd_kafka_destroy(p);
1186
+
1187
+ SUB_TEST_PASS();
1188
+ }
1189
+
1190
+ /**
1191
+ * @returns the high watermark for the given partition.
1192
+ */
1193
+ int64_t
1194
+ query_hi_wmark0(int line, rd_kafka_t *c, const char *topic, int32_t partition) {
1195
+ rd_kafka_resp_err_t err;
1196
+ int64_t lo = -1, hi = -1;
1197
+
1198
+ err = rd_kafka_query_watermark_offsets(c, topic, partition, &lo, &hi,
1199
+ tmout_multip(5 * 1000));
1200
+ TEST_ASSERT(!err, "%d: query_watermark_offsets(%s) failed: %s", line,
1201
+ topic, rd_kafka_err2str(err));
1202
+
1203
+ return hi;
1204
+ }
1205
+ #define query_hi_wmark(c, topic, part) query_hi_wmark0(__LINE__, c, topic, part)
1206
+
1207
+ /**
1208
+ * @brief Check that isolation.level works as expected for query_watermark..().
1209
+ */
1210
+ static void do_test_wmark_isolation_level(void) {
1211
+ const char *topic = test_mk_topic_name("0103_wmark_isol", 1);
1212
+ rd_kafka_conf_t *conf, *c_conf;
1213
+ rd_kafka_t *p, *c1, *c2;
1214
+ uint64_t testid;
1215
+ int64_t hw_uncommitted, hw_committed;
1216
+
1217
+ SUB_TEST_QUICK();
1218
+
1219
+ testid = test_id_generate();
1220
+
1221
+ test_conf_init(&conf, NULL, 30);
1222
+ c_conf = rd_kafka_conf_dup(conf);
1223
+
1224
+ test_conf_set(conf, "transactional.id", topic);
1225
+ rd_kafka_conf_set_dr_msg_cb(conf, test_dr_msg_cb);
1226
+ p = test_create_handle(RD_KAFKA_PRODUCER, rd_kafka_conf_dup(conf));
1227
+
1228
+ test_create_topic_wait_exists(p, topic, 1, 3, 5000);
1229
+
1230
+ /* Produce some non-txn messages to avoid 0 as the committed hwmark */
1231
+ test_produce_msgs_easy(topic, testid, 0, 100);
1232
+
1233
+ /* Create consumer and subscribe to the topic */
1234
+ test_conf_set(c_conf, "isolation.level", "read_committed");
1235
+ c1 = test_create_consumer(topic, NULL, rd_kafka_conf_dup(c_conf), NULL);
1236
+ test_conf_set(c_conf, "isolation.level", "read_uncommitted");
1237
+ c2 = test_create_consumer(topic, NULL, c_conf, NULL);
1238
+
1239
+ TEST_CALL_ERROR__(rd_kafka_init_transactions(p, -1));
1240
+
1241
+ TEST_CALL_ERROR__(rd_kafka_begin_transaction(p));
1242
+
1243
+ /* Produce some txn messages */
1244
+ test_produce_msgs2(p, topic, testid, 0, 0, 100, NULL, 0);
1245
+
1246
+ test_flush(p, 10 * 1000);
1247
+
1248
+ hw_committed = query_hi_wmark(c1, topic, 0);
1249
+ hw_uncommitted = query_hi_wmark(c2, topic, 0);
1250
+
1251
+ TEST_SAY("Pre-commit hwmarks: committed %" PRId64
1252
+ ", uncommitted %" PRId64 "\n",
1253
+ hw_committed, hw_uncommitted);
1254
+
1255
+ TEST_ASSERT(hw_committed > 0 && hw_committed < hw_uncommitted,
1256
+ "Committed hwmark %" PRId64
1257
+ " should be lower than "
1258
+ "uncommitted hwmark %" PRId64 " for %s [0]",
1259
+ hw_committed, hw_uncommitted, topic);
1260
+
1261
+ TEST_CALL_ERROR__(rd_kafka_commit_transaction(p, -1));
1262
+
1263
+ /* Re-create the producer and re-init transactions to make
1264
+ * sure the transaction is fully committed in the cluster. */
1265
+ rd_kafka_destroy(p);
1266
+ p = test_create_handle(RD_KAFKA_PRODUCER, conf);
1267
+ TEST_CALL_ERROR__(rd_kafka_init_transactions(p, -1));
1268
+ rd_kafka_destroy(p);
1269
+
1270
+
1271
+ /* Now query wmarks again */
1272
+ hw_committed = query_hi_wmark(c1, topic, 0);
1273
+ hw_uncommitted = query_hi_wmark(c2, topic, 0);
1274
+
1275
+ TEST_SAY("Post-commit hwmarks: committed %" PRId64
1276
+ ", uncommitted %" PRId64 "\n",
1277
+ hw_committed, hw_uncommitted);
1278
+
1279
+ TEST_ASSERT(hw_committed == hw_uncommitted,
1280
+ "Committed hwmark %" PRId64
1281
+ " should be equal to "
1282
+ "uncommitted hwmark %" PRId64 " for %s [0]",
1283
+ hw_committed, hw_uncommitted, topic);
1284
+
1285
+ rd_kafka_destroy(c1);
1286
+ rd_kafka_destroy(c2);
1287
+
1288
+ SUB_TEST_PASS();
1289
+ }
1290
+
1291
+
1292
+
1293
+ int main_0103_transactions(int argc, char **argv) {
1294
+
1295
+ do_test_misuse_txn();
1296
+ do_test_basic_producer_txn(rd_false /* without compression */);
1297
+ do_test_basic_producer_txn(rd_true /* with compression */);
1298
+ do_test_consumer_producer_txn();
1299
+ do_test_fenced_txn(rd_false /* no produce after fencing */);
1300
+ do_test_fenced_txn(rd_true /* produce after fencing */);
1301
+ do_test_fatal_idempo_error_without_kip360();
1302
+ do_test_empty_txn(rd_false /*don't send offsets*/, rd_true /*commit*/);
1303
+ do_test_empty_txn(rd_false /*don't send offsets*/, rd_false /*abort*/);
1304
+ do_test_empty_txn(rd_true /*send offsets*/, rd_true /*commit*/);
1305
+ do_test_empty_txn(rd_true /*send offsets*/, rd_false /*abort*/);
1306
+ do_test_wmark_isolation_level();
1307
+ do_test_txn_abort_control_message_leader_epoch();
1308
+ return 0;
1309
+ }
1310
+
1311
+
1312
+
1313
+ /**
1314
+ * @brief Transaction tests that don't require a broker.
1315
+ */
1316
+ static void do_test_txn_local(void) {
1317
+ rd_kafka_conf_t *conf;
1318
+ rd_kafka_t *p;
1319
+ rd_kafka_error_t *error;
1320
+ test_timing_t t_init;
1321
+ int timeout_ms = 7 * 1000;
1322
+
1323
+ SUB_TEST_QUICK();
1324
+
1325
+ /*
1326
+ * No transactional.id, init_transactions() should fail.
1327
+ */
1328
+ test_conf_init(&conf, NULL, 0);
1329
+ test_conf_set(conf, "bootstrap.servers", NULL);
1330
+
1331
+ p = test_create_handle(RD_KAFKA_PRODUCER, conf);
1332
+
1333
+ error = rd_kafka_init_transactions(p, 10);
1334
+ TEST_ASSERT(error, "Expected init_transactions() to fail");
1335
+ TEST_ASSERT(
1336
+ rd_kafka_error_code(error) == RD_KAFKA_RESP_ERR__NOT_CONFIGURED,
1337
+ "Expected ERR__NOT_CONFIGURED, not %s", rd_kafka_error_name(error));
1338
+ rd_kafka_error_destroy(error);
1339
+
1340
+ rd_kafka_destroy(p);
1341
+
1342
+
1343
+ /*
1344
+ * No brokers, init_transactions() should time out according
1345
+ * to the timeout.
1346
+ */
1347
+ test_conf_init(&conf, NULL, 0);
1348
+ test_conf_set(conf, "bootstrap.servers", NULL);
1349
+ test_conf_set(conf, "transactional.id", "test");
1350
+ p = test_create_handle(RD_KAFKA_PRODUCER, conf);
1351
+
1352
+ TEST_SAY("Waiting for init_transactions() timeout %d ms\n", timeout_ms);
1353
+
1354
+ test_timeout_set((timeout_ms + 2000) / 1000);
1355
+
1356
+ TIMING_START(&t_init, "init_transactions()");
1357
+ error = rd_kafka_init_transactions(p, timeout_ms);
1358
+ TIMING_STOP(&t_init);
1359
+ TEST_ASSERT(error, "Expected init_transactions() to fail");
1360
+ TEST_ASSERT(rd_kafka_error_code(error) == RD_KAFKA_RESP_ERR__TIMED_OUT,
1361
+ "Expected RD_KAFKA_RESP_ERR__TIMED_OUT, "
1362
+ "not %s: %s",
1363
+ rd_kafka_error_name(error), rd_kafka_error_string(error));
1364
+
1365
+ TEST_SAY("init_transactions() failed as expected: %s\n",
1366
+ rd_kafka_error_string(error));
1367
+
1368
+ rd_kafka_error_destroy(error);
1369
+
1370
+ TIMING_ASSERT(&t_init, timeout_ms - 2000, timeout_ms + 5000);
1371
+
1372
+ rd_kafka_destroy(p);
1373
+
1374
+ SUB_TEST_PASS();
1375
+ }
1376
+
1377
+
1378
+ int main_0103_transactions_local(int argc, char **argv) {
1379
+
1380
+ do_test_txn_local();
1381
+
1382
+ return 0;
1383
+ }