@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.
- package/LICENSE.txt +20 -0
- package/README.md +636 -0
- package/binding.gyp +154 -0
- package/deps/librdkafka/.clang-format +136 -0
- package/deps/librdkafka/.clang-format-cpp +103 -0
- package/deps/librdkafka/.dir-locals.el +10 -0
- package/deps/librdkafka/.formatignore +33 -0
- package/deps/librdkafka/.gdbmacros +19 -0
- package/deps/librdkafka/.github/CODEOWNERS +1 -0
- package/deps/librdkafka/.github/ISSUE_TEMPLATE +34 -0
- package/deps/librdkafka/.semaphore/run-all-tests.yml +77 -0
- package/deps/librdkafka/.semaphore/semaphore-integration.yml +250 -0
- package/deps/librdkafka/.semaphore/semaphore.yml +378 -0
- package/deps/librdkafka/.semaphore/verify-linux-packages.yml +41 -0
- package/deps/librdkafka/CHANGELOG.md +2208 -0
- package/deps/librdkafka/CMakeLists.txt +291 -0
- package/deps/librdkafka/CODE_OF_CONDUCT.md +46 -0
- package/deps/librdkafka/CONFIGURATION.md +209 -0
- package/deps/librdkafka/CONTRIBUTING.md +431 -0
- package/deps/librdkafka/Doxyfile +2375 -0
- package/deps/librdkafka/INTRODUCTION.md +2481 -0
- package/deps/librdkafka/LICENSE +26 -0
- package/deps/librdkafka/LICENSE.cjson +22 -0
- package/deps/librdkafka/LICENSE.crc32c +28 -0
- package/deps/librdkafka/LICENSE.fnv1a +18 -0
- package/deps/librdkafka/LICENSE.hdrhistogram +27 -0
- package/deps/librdkafka/LICENSE.lz4 +26 -0
- package/deps/librdkafka/LICENSE.murmur2 +25 -0
- package/deps/librdkafka/LICENSE.nanopb +22 -0
- package/deps/librdkafka/LICENSE.opentelemetry +203 -0
- package/deps/librdkafka/LICENSE.pycrc +23 -0
- package/deps/librdkafka/LICENSE.queue +31 -0
- package/deps/librdkafka/LICENSE.regexp +5 -0
- package/deps/librdkafka/LICENSE.snappy +36 -0
- package/deps/librdkafka/LICENSE.tinycthread +26 -0
- package/deps/librdkafka/LICENSE.wingetopt +49 -0
- package/deps/librdkafka/LICENSES.txt +625 -0
- package/deps/librdkafka/Makefile +125 -0
- package/deps/librdkafka/README.md +199 -0
- package/deps/librdkafka/README.win32 +26 -0
- package/deps/librdkafka/STATISTICS.md +624 -0
- package/deps/librdkafka/configure +214 -0
- package/deps/librdkafka/configure.self +331 -0
- package/deps/librdkafka/debian/changelog +111 -0
- package/deps/librdkafka/debian/compat +1 -0
- package/deps/librdkafka/debian/control +71 -0
- package/deps/librdkafka/debian/copyright +99 -0
- package/deps/librdkafka/debian/gbp.conf +9 -0
- package/deps/librdkafka/debian/librdkafka++1.install +1 -0
- package/deps/librdkafka/debian/librdkafka-dev.examples +2 -0
- package/deps/librdkafka/debian/librdkafka-dev.install +9 -0
- package/deps/librdkafka/debian/librdkafka1.docs +5 -0
- package/deps/librdkafka/debian/librdkafka1.install +1 -0
- package/deps/librdkafka/debian/librdkafka1.symbols +135 -0
- package/deps/librdkafka/debian/rules +19 -0
- package/deps/librdkafka/debian/source/format +1 -0
- package/deps/librdkafka/debian/watch +2 -0
- package/deps/librdkafka/dev-conf.sh +123 -0
- package/deps/librdkafka/examples/CMakeLists.txt +79 -0
- package/deps/librdkafka/examples/Makefile +167 -0
- package/deps/librdkafka/examples/README.md +42 -0
- package/deps/librdkafka/examples/alter_consumer_group_offsets.c +338 -0
- package/deps/librdkafka/examples/consumer.c +271 -0
- package/deps/librdkafka/examples/delete_records.c +233 -0
- package/deps/librdkafka/examples/describe_cluster.c +322 -0
- package/deps/librdkafka/examples/describe_consumer_groups.c +455 -0
- package/deps/librdkafka/examples/describe_topics.c +427 -0
- package/deps/librdkafka/examples/elect_leaders.c +317 -0
- package/deps/librdkafka/examples/globals.json +11 -0
- package/deps/librdkafka/examples/idempotent_producer.c +344 -0
- package/deps/librdkafka/examples/incremental_alter_configs.c +347 -0
- package/deps/librdkafka/examples/kafkatest_verifiable_client.cpp +945 -0
- package/deps/librdkafka/examples/list_consumer_group_offsets.c +359 -0
- package/deps/librdkafka/examples/list_consumer_groups.c +365 -0
- package/deps/librdkafka/examples/list_offsets.c +327 -0
- package/deps/librdkafka/examples/misc.c +287 -0
- package/deps/librdkafka/examples/openssl_engine_example.cpp +248 -0
- package/deps/librdkafka/examples/producer.c +251 -0
- package/deps/librdkafka/examples/producer.cpp +228 -0
- package/deps/librdkafka/examples/rdkafka_complex_consumer_example.c +617 -0
- package/deps/librdkafka/examples/rdkafka_complex_consumer_example.cpp +467 -0
- package/deps/librdkafka/examples/rdkafka_consume_batch.cpp +264 -0
- package/deps/librdkafka/examples/rdkafka_example.c +853 -0
- package/deps/librdkafka/examples/rdkafka_example.cpp +679 -0
- package/deps/librdkafka/examples/rdkafka_performance.c +1781 -0
- package/deps/librdkafka/examples/transactions-older-broker.c +668 -0
- package/deps/librdkafka/examples/transactions.c +665 -0
- package/deps/librdkafka/examples/user_scram.c +491 -0
- package/deps/librdkafka/examples/win_ssl_cert_store.cpp +396 -0
- package/deps/librdkafka/lds-gen.py +73 -0
- package/deps/librdkafka/mainpage.doxy +40 -0
- package/deps/librdkafka/mklove/Makefile.base +329 -0
- package/deps/librdkafka/mklove/modules/configure.atomics +144 -0
- package/deps/librdkafka/mklove/modules/configure.base +2484 -0
- package/deps/librdkafka/mklove/modules/configure.builtin +70 -0
- package/deps/librdkafka/mklove/modules/configure.cc +186 -0
- package/deps/librdkafka/mklove/modules/configure.cxx +8 -0
- package/deps/librdkafka/mklove/modules/configure.fileversion +65 -0
- package/deps/librdkafka/mklove/modules/configure.gitversion +29 -0
- package/deps/librdkafka/mklove/modules/configure.good_cflags +18 -0
- package/deps/librdkafka/mklove/modules/configure.host +132 -0
- package/deps/librdkafka/mklove/modules/configure.lib +49 -0
- package/deps/librdkafka/mklove/modules/configure.libcurl +99 -0
- package/deps/librdkafka/mklove/modules/configure.libsasl2 +36 -0
- package/deps/librdkafka/mklove/modules/configure.libssl +147 -0
- package/deps/librdkafka/mklove/modules/configure.libzstd +58 -0
- package/deps/librdkafka/mklove/modules/configure.parseversion +95 -0
- package/deps/librdkafka/mklove/modules/configure.pic +16 -0
- package/deps/librdkafka/mklove/modules/configure.socket +20 -0
- package/deps/librdkafka/mklove/modules/configure.zlib +61 -0
- package/deps/librdkafka/mklove/modules/patches/README.md +8 -0
- package/deps/librdkafka/mklove/modules/patches/libcurl.0000-no-runtime-linking-check.patch +11 -0
- package/deps/librdkafka/mklove/modules/patches/libssl.0000-osx-rand-include-fix-OpenSSL-PR16409.patch +56 -0
- package/deps/librdkafka/packaging/RELEASE.md +319 -0
- package/deps/librdkafka/packaging/alpine/build-alpine.sh +38 -0
- package/deps/librdkafka/packaging/archlinux/PKGBUILD +30 -0
- package/deps/librdkafka/packaging/cmake/Config.cmake.in +37 -0
- package/deps/librdkafka/packaging/cmake/Modules/FindLZ4.cmake +38 -0
- package/deps/librdkafka/packaging/cmake/Modules/FindZSTD.cmake +27 -0
- package/deps/librdkafka/packaging/cmake/Modules/LICENSE.FindZstd +178 -0
- package/deps/librdkafka/packaging/cmake/README.md +38 -0
- package/deps/librdkafka/packaging/cmake/config.h.in +52 -0
- package/deps/librdkafka/packaging/cmake/parseversion.cmake +60 -0
- package/deps/librdkafka/packaging/cmake/rdkafka.pc.in +12 -0
- package/deps/librdkafka/packaging/cmake/try_compile/atomic_32_test.c +8 -0
- package/deps/librdkafka/packaging/cmake/try_compile/atomic_64_test.c +8 -0
- package/deps/librdkafka/packaging/cmake/try_compile/c11threads_test.c +14 -0
- package/deps/librdkafka/packaging/cmake/try_compile/crc32c_hw_test.c +27 -0
- package/deps/librdkafka/packaging/cmake/try_compile/dlopen_test.c +11 -0
- package/deps/librdkafka/packaging/cmake/try_compile/libsasl2_test.c +7 -0
- package/deps/librdkafka/packaging/cmake/try_compile/pthread_setname_darwin_test.c +6 -0
- package/deps/librdkafka/packaging/cmake/try_compile/pthread_setname_freebsd_test.c +7 -0
- package/deps/librdkafka/packaging/cmake/try_compile/pthread_setname_gnu_test.c +5 -0
- package/deps/librdkafka/packaging/cmake/try_compile/rand_r_test.c +7 -0
- package/deps/librdkafka/packaging/cmake/try_compile/rdkafka_setup.cmake +122 -0
- package/deps/librdkafka/packaging/cmake/try_compile/regex_test.c +10 -0
- package/deps/librdkafka/packaging/cmake/try_compile/strndup_test.c +5 -0
- package/deps/librdkafka/packaging/cmake/try_compile/sync_32_test.c +8 -0
- package/deps/librdkafka/packaging/cmake/try_compile/sync_64_test.c +8 -0
- package/deps/librdkafka/packaging/cp/README.md +16 -0
- package/deps/librdkafka/packaging/cp/check_features.c +72 -0
- package/deps/librdkafka/packaging/cp/verify-deb.sh +33 -0
- package/deps/librdkafka/packaging/cp/verify-packages.sh +69 -0
- package/deps/librdkafka/packaging/cp/verify-rpm.sh +32 -0
- package/deps/librdkafka/packaging/debian/changelog +66 -0
- package/deps/librdkafka/packaging/debian/compat +1 -0
- package/deps/librdkafka/packaging/debian/control +49 -0
- package/deps/librdkafka/packaging/debian/copyright +84 -0
- package/deps/librdkafka/packaging/debian/docs +5 -0
- package/deps/librdkafka/packaging/debian/gbp.conf +9 -0
- package/deps/librdkafka/packaging/debian/librdkafka-dev.dirs +2 -0
- package/deps/librdkafka/packaging/debian/librdkafka-dev.examples +2 -0
- package/deps/librdkafka/packaging/debian/librdkafka-dev.install +6 -0
- package/deps/librdkafka/packaging/debian/librdkafka-dev.substvars +1 -0
- package/deps/librdkafka/packaging/debian/librdkafka.dsc +16 -0
- package/deps/librdkafka/packaging/debian/librdkafka1-dbg.substvars +1 -0
- package/deps/librdkafka/packaging/debian/librdkafka1.dirs +1 -0
- package/deps/librdkafka/packaging/debian/librdkafka1.install +2 -0
- package/deps/librdkafka/packaging/debian/librdkafka1.postinst.debhelper +5 -0
- package/deps/librdkafka/packaging/debian/librdkafka1.postrm.debhelper +5 -0
- package/deps/librdkafka/packaging/debian/librdkafka1.symbols +64 -0
- package/deps/librdkafka/packaging/debian/rules +19 -0
- package/deps/librdkafka/packaging/debian/source/format +1 -0
- package/deps/librdkafka/packaging/debian/watch +2 -0
- package/deps/librdkafka/packaging/get_version.py +21 -0
- package/deps/librdkafka/packaging/homebrew/README.md +15 -0
- package/deps/librdkafka/packaging/homebrew/brew-update-pr.sh +31 -0
- package/deps/librdkafka/packaging/mingw-w64/configure-build-msys2-mingw-static.sh +52 -0
- package/deps/librdkafka/packaging/mingw-w64/configure-build-msys2-mingw.sh +21 -0
- package/deps/librdkafka/packaging/mingw-w64/export-variables.sh +13 -0
- package/deps/librdkafka/packaging/mingw-w64/run-tests.sh +6 -0
- package/deps/librdkafka/packaging/mingw-w64/semaphoreci-build.sh +38 -0
- package/deps/librdkafka/packaging/nuget/README.md +84 -0
- package/deps/librdkafka/packaging/nuget/artifact.py +177 -0
- package/deps/librdkafka/packaging/nuget/cleanup-s3.py +143 -0
- package/deps/librdkafka/packaging/nuget/common/p-common__plat-windows__arch-win32__bldtype-Release/msvcr120.zip +0 -0
- package/deps/librdkafka/packaging/nuget/common/p-common__plat-windows__arch-win32__bldtype-Release/msvcr140.zip +0 -0
- package/deps/librdkafka/packaging/nuget/common/p-common__plat-windows__arch-x64__bldtype-Release/msvcr120.zip +0 -0
- package/deps/librdkafka/packaging/nuget/common/p-common__plat-windows__arch-x64__bldtype-Release/msvcr140.zip +0 -0
- package/deps/librdkafka/packaging/nuget/nuget.sh +21 -0
- package/deps/librdkafka/packaging/nuget/nugetpackage.py +278 -0
- package/deps/librdkafka/packaging/nuget/packaging.py +448 -0
- package/deps/librdkafka/packaging/nuget/push-to-nuget.sh +21 -0
- package/deps/librdkafka/packaging/nuget/release.py +167 -0
- package/deps/librdkafka/packaging/nuget/requirements.txt +3 -0
- package/deps/librdkafka/packaging/nuget/staticpackage.py +178 -0
- package/deps/librdkafka/packaging/nuget/templates/librdkafka.redist.nuspec +21 -0
- package/deps/librdkafka/packaging/nuget/templates/librdkafka.redist.props +18 -0
- package/deps/librdkafka/packaging/nuget/templates/librdkafka.redist.targets +19 -0
- package/deps/librdkafka/packaging/nuget/zfile/__init__.py +0 -0
- package/deps/librdkafka/packaging/nuget/zfile/zfile.py +98 -0
- package/deps/librdkafka/packaging/rpm/Makefile +92 -0
- package/deps/librdkafka/packaging/rpm/README.md +23 -0
- package/deps/librdkafka/packaging/rpm/el7-x86_64.cfg +40 -0
- package/deps/librdkafka/packaging/rpm/librdkafka.spec +118 -0
- package/deps/librdkafka/packaging/rpm/mock-on-docker.sh +96 -0
- package/deps/librdkafka/packaging/rpm/tests/Makefile +25 -0
- package/deps/librdkafka/packaging/rpm/tests/README.md +8 -0
- package/deps/librdkafka/packaging/rpm/tests/run-test.sh +42 -0
- package/deps/librdkafka/packaging/rpm/tests/test-on-docker.sh +56 -0
- package/deps/librdkafka/packaging/rpm/tests/test.c +77 -0
- package/deps/librdkafka/packaging/rpm/tests/test.cpp +34 -0
- package/deps/librdkafka/packaging/tools/Dockerfile +31 -0
- package/deps/librdkafka/packaging/tools/build-configurations-checks.sh +12 -0
- package/deps/librdkafka/packaging/tools/build-deb-package.sh +64 -0
- package/deps/librdkafka/packaging/tools/build-debian.sh +65 -0
- package/deps/librdkafka/packaging/tools/build-manylinux.sh +68 -0
- package/deps/librdkafka/packaging/tools/build-release-artifacts.sh +139 -0
- package/deps/librdkafka/packaging/tools/distro-build.sh +38 -0
- package/deps/librdkafka/packaging/tools/gh-release-checksums.py +39 -0
- package/deps/librdkafka/packaging/tools/rdutcoverage.sh +25 -0
- package/deps/librdkafka/packaging/tools/requirements.txt +2 -0
- package/deps/librdkafka/packaging/tools/run-in-docker.sh +28 -0
- package/deps/librdkafka/packaging/tools/run-integration-tests.sh +31 -0
- package/deps/librdkafka/packaging/tools/run-style-check.sh +4 -0
- package/deps/librdkafka/packaging/tools/style-format.sh +149 -0
- package/deps/librdkafka/packaging/tools/update_rpcs_max_versions.py +100 -0
- package/deps/librdkafka/service.yml +172 -0
- package/deps/librdkafka/src/CMakeLists.txt +374 -0
- package/deps/librdkafka/src/Makefile +103 -0
- package/deps/librdkafka/src/README.lz4.md +30 -0
- package/deps/librdkafka/src/cJSON.c +2834 -0
- package/deps/librdkafka/src/cJSON.h +398 -0
- package/deps/librdkafka/src/crc32c.c +430 -0
- package/deps/librdkafka/src/crc32c.h +38 -0
- package/deps/librdkafka/src/generate_proto.sh +66 -0
- package/deps/librdkafka/src/librdkafka_cgrp_synch.png +0 -0
- package/deps/librdkafka/src/lz4.c +2727 -0
- package/deps/librdkafka/src/lz4.h +842 -0
- package/deps/librdkafka/src/lz4frame.c +2078 -0
- package/deps/librdkafka/src/lz4frame.h +692 -0
- package/deps/librdkafka/src/lz4frame_static.h +47 -0
- package/deps/librdkafka/src/lz4hc.c +1631 -0
- package/deps/librdkafka/src/lz4hc.h +413 -0
- package/deps/librdkafka/src/nanopb/pb.h +917 -0
- package/deps/librdkafka/src/nanopb/pb_common.c +388 -0
- package/deps/librdkafka/src/nanopb/pb_common.h +49 -0
- package/deps/librdkafka/src/nanopb/pb_decode.c +1727 -0
- package/deps/librdkafka/src/nanopb/pb_decode.h +193 -0
- package/deps/librdkafka/src/nanopb/pb_encode.c +1000 -0
- package/deps/librdkafka/src/nanopb/pb_encode.h +185 -0
- package/deps/librdkafka/src/opentelemetry/common.pb.c +32 -0
- package/deps/librdkafka/src/opentelemetry/common.pb.h +170 -0
- package/deps/librdkafka/src/opentelemetry/metrics.options +2 -0
- package/deps/librdkafka/src/opentelemetry/metrics.pb.c +67 -0
- package/deps/librdkafka/src/opentelemetry/metrics.pb.h +966 -0
- package/deps/librdkafka/src/opentelemetry/resource.pb.c +12 -0
- package/deps/librdkafka/src/opentelemetry/resource.pb.h +58 -0
- package/deps/librdkafka/src/queue.h +850 -0
- package/deps/librdkafka/src/rd.h +584 -0
- package/deps/librdkafka/src/rdaddr.c +255 -0
- package/deps/librdkafka/src/rdaddr.h +202 -0
- package/deps/librdkafka/src/rdatomic.h +230 -0
- package/deps/librdkafka/src/rdavg.h +260 -0
- package/deps/librdkafka/src/rdavl.c +210 -0
- package/deps/librdkafka/src/rdavl.h +250 -0
- package/deps/librdkafka/src/rdbase64.c +200 -0
- package/deps/librdkafka/src/rdbase64.h +43 -0
- package/deps/librdkafka/src/rdbuf.c +1884 -0
- package/deps/librdkafka/src/rdbuf.h +375 -0
- package/deps/librdkafka/src/rdcrc32.c +114 -0
- package/deps/librdkafka/src/rdcrc32.h +170 -0
- package/deps/librdkafka/src/rddl.c +179 -0
- package/deps/librdkafka/src/rddl.h +43 -0
- package/deps/librdkafka/src/rdendian.h +175 -0
- package/deps/librdkafka/src/rdfloat.h +67 -0
- package/deps/librdkafka/src/rdfnv1a.c +113 -0
- package/deps/librdkafka/src/rdfnv1a.h +35 -0
- package/deps/librdkafka/src/rdgz.c +120 -0
- package/deps/librdkafka/src/rdgz.h +46 -0
- package/deps/librdkafka/src/rdhdrhistogram.c +721 -0
- package/deps/librdkafka/src/rdhdrhistogram.h +87 -0
- package/deps/librdkafka/src/rdhttp.c +830 -0
- package/deps/librdkafka/src/rdhttp.h +101 -0
- package/deps/librdkafka/src/rdinterval.h +177 -0
- package/deps/librdkafka/src/rdkafka.c +5505 -0
- package/deps/librdkafka/src/rdkafka.h +10686 -0
- package/deps/librdkafka/src/rdkafka_admin.c +9794 -0
- package/deps/librdkafka/src/rdkafka_admin.h +661 -0
- package/deps/librdkafka/src/rdkafka_assignment.c +1010 -0
- package/deps/librdkafka/src/rdkafka_assignment.h +73 -0
- package/deps/librdkafka/src/rdkafka_assignor.c +1786 -0
- package/deps/librdkafka/src/rdkafka_assignor.h +402 -0
- package/deps/librdkafka/src/rdkafka_aux.c +409 -0
- package/deps/librdkafka/src/rdkafka_aux.h +174 -0
- package/deps/librdkafka/src/rdkafka_background.c +221 -0
- package/deps/librdkafka/src/rdkafka_broker.c +6337 -0
- package/deps/librdkafka/src/rdkafka_broker.h +744 -0
- package/deps/librdkafka/src/rdkafka_buf.c +543 -0
- package/deps/librdkafka/src/rdkafka_buf.h +1525 -0
- package/deps/librdkafka/src/rdkafka_cert.c +576 -0
- package/deps/librdkafka/src/rdkafka_cert.h +62 -0
- package/deps/librdkafka/src/rdkafka_cgrp.c +7587 -0
- package/deps/librdkafka/src/rdkafka_cgrp.h +477 -0
- package/deps/librdkafka/src/rdkafka_conf.c +4880 -0
- package/deps/librdkafka/src/rdkafka_conf.h +732 -0
- package/deps/librdkafka/src/rdkafka_confval.h +97 -0
- package/deps/librdkafka/src/rdkafka_coord.c +623 -0
- package/deps/librdkafka/src/rdkafka_coord.h +132 -0
- package/deps/librdkafka/src/rdkafka_error.c +228 -0
- package/deps/librdkafka/src/rdkafka_error.h +80 -0
- package/deps/librdkafka/src/rdkafka_event.c +502 -0
- package/deps/librdkafka/src/rdkafka_event.h +126 -0
- package/deps/librdkafka/src/rdkafka_feature.c +898 -0
- package/deps/librdkafka/src/rdkafka_feature.h +104 -0
- package/deps/librdkafka/src/rdkafka_fetcher.c +1422 -0
- package/deps/librdkafka/src/rdkafka_fetcher.h +44 -0
- package/deps/librdkafka/src/rdkafka_header.c +220 -0
- package/deps/librdkafka/src/rdkafka_header.h +76 -0
- package/deps/librdkafka/src/rdkafka_idempotence.c +807 -0
- package/deps/librdkafka/src/rdkafka_idempotence.h +144 -0
- package/deps/librdkafka/src/rdkafka_int.h +1260 -0
- package/deps/librdkafka/src/rdkafka_interceptor.c +819 -0
- package/deps/librdkafka/src/rdkafka_interceptor.h +104 -0
- package/deps/librdkafka/src/rdkafka_lz4.c +450 -0
- package/deps/librdkafka/src/rdkafka_lz4.h +49 -0
- package/deps/librdkafka/src/rdkafka_metadata.c +2209 -0
- package/deps/librdkafka/src/rdkafka_metadata.h +345 -0
- package/deps/librdkafka/src/rdkafka_metadata_cache.c +1183 -0
- package/deps/librdkafka/src/rdkafka_mock.c +3661 -0
- package/deps/librdkafka/src/rdkafka_mock.h +610 -0
- package/deps/librdkafka/src/rdkafka_mock_cgrp.c +1876 -0
- package/deps/librdkafka/src/rdkafka_mock_handlers.c +3113 -0
- package/deps/librdkafka/src/rdkafka_mock_int.h +710 -0
- package/deps/librdkafka/src/rdkafka_msg.c +2589 -0
- package/deps/librdkafka/src/rdkafka_msg.h +614 -0
- package/deps/librdkafka/src/rdkafka_msgbatch.h +62 -0
- package/deps/librdkafka/src/rdkafka_msgset.h +98 -0
- package/deps/librdkafka/src/rdkafka_msgset_reader.c +1806 -0
- package/deps/librdkafka/src/rdkafka_msgset_writer.c +1474 -0
- package/deps/librdkafka/src/rdkafka_offset.c +1565 -0
- package/deps/librdkafka/src/rdkafka_offset.h +150 -0
- package/deps/librdkafka/src/rdkafka_op.c +997 -0
- package/deps/librdkafka/src/rdkafka_op.h +858 -0
- package/deps/librdkafka/src/rdkafka_partition.c +4896 -0
- package/deps/librdkafka/src/rdkafka_partition.h +1182 -0
- package/deps/librdkafka/src/rdkafka_pattern.c +228 -0
- package/deps/librdkafka/src/rdkafka_pattern.h +70 -0
- package/deps/librdkafka/src/rdkafka_plugin.c +213 -0
- package/deps/librdkafka/src/rdkafka_plugin.h +41 -0
- package/deps/librdkafka/src/rdkafka_proto.h +736 -0
- package/deps/librdkafka/src/rdkafka_protocol.h +128 -0
- package/deps/librdkafka/src/rdkafka_queue.c +1230 -0
- package/deps/librdkafka/src/rdkafka_queue.h +1220 -0
- package/deps/librdkafka/src/rdkafka_range_assignor.c +1748 -0
- package/deps/librdkafka/src/rdkafka_request.c +7089 -0
- package/deps/librdkafka/src/rdkafka_request.h +732 -0
- package/deps/librdkafka/src/rdkafka_roundrobin_assignor.c +123 -0
- package/deps/librdkafka/src/rdkafka_sasl.c +530 -0
- package/deps/librdkafka/src/rdkafka_sasl.h +63 -0
- package/deps/librdkafka/src/rdkafka_sasl_cyrus.c +722 -0
- package/deps/librdkafka/src/rdkafka_sasl_int.h +89 -0
- package/deps/librdkafka/src/rdkafka_sasl_oauthbearer.c +1833 -0
- package/deps/librdkafka/src/rdkafka_sasl_oauthbearer.h +52 -0
- package/deps/librdkafka/src/rdkafka_sasl_oauthbearer_oidc.c +1666 -0
- package/deps/librdkafka/src/rdkafka_sasl_oauthbearer_oidc.h +47 -0
- package/deps/librdkafka/src/rdkafka_sasl_plain.c +142 -0
- package/deps/librdkafka/src/rdkafka_sasl_scram.c +858 -0
- package/deps/librdkafka/src/rdkafka_sasl_win32.c +550 -0
- package/deps/librdkafka/src/rdkafka_ssl.c +2129 -0
- package/deps/librdkafka/src/rdkafka_ssl.h +86 -0
- package/deps/librdkafka/src/rdkafka_sticky_assignor.c +4785 -0
- package/deps/librdkafka/src/rdkafka_subscription.c +278 -0
- package/deps/librdkafka/src/rdkafka_telemetry.c +760 -0
- package/deps/librdkafka/src/rdkafka_telemetry.h +52 -0
- package/deps/librdkafka/src/rdkafka_telemetry_decode.c +1053 -0
- package/deps/librdkafka/src/rdkafka_telemetry_decode.h +59 -0
- package/deps/librdkafka/src/rdkafka_telemetry_encode.c +997 -0
- package/deps/librdkafka/src/rdkafka_telemetry_encode.h +301 -0
- package/deps/librdkafka/src/rdkafka_timer.c +402 -0
- package/deps/librdkafka/src/rdkafka_timer.h +117 -0
- package/deps/librdkafka/src/rdkafka_topic.c +2161 -0
- package/deps/librdkafka/src/rdkafka_topic.h +334 -0
- package/deps/librdkafka/src/rdkafka_transport.c +1309 -0
- package/deps/librdkafka/src/rdkafka_transport.h +99 -0
- package/deps/librdkafka/src/rdkafka_transport_int.h +100 -0
- package/deps/librdkafka/src/rdkafka_txnmgr.c +3256 -0
- package/deps/librdkafka/src/rdkafka_txnmgr.h +171 -0
- package/deps/librdkafka/src/rdkafka_zstd.c +226 -0
- package/deps/librdkafka/src/rdkafka_zstd.h +57 -0
- package/deps/librdkafka/src/rdlist.c +576 -0
- package/deps/librdkafka/src/rdlist.h +434 -0
- package/deps/librdkafka/src/rdlog.c +89 -0
- package/deps/librdkafka/src/rdlog.h +41 -0
- package/deps/librdkafka/src/rdmap.c +508 -0
- package/deps/librdkafka/src/rdmap.h +492 -0
- package/deps/librdkafka/src/rdmurmur2.c +167 -0
- package/deps/librdkafka/src/rdmurmur2.h +35 -0
- package/deps/librdkafka/src/rdports.c +61 -0
- package/deps/librdkafka/src/rdports.h +38 -0
- package/deps/librdkafka/src/rdposix.h +250 -0
- package/deps/librdkafka/src/rdrand.c +80 -0
- package/deps/librdkafka/src/rdrand.h +43 -0
- package/deps/librdkafka/src/rdregex.c +156 -0
- package/deps/librdkafka/src/rdregex.h +43 -0
- package/deps/librdkafka/src/rdsignal.h +57 -0
- package/deps/librdkafka/src/rdstring.c +645 -0
- package/deps/librdkafka/src/rdstring.h +98 -0
- package/deps/librdkafka/src/rdsysqueue.h +404 -0
- package/deps/librdkafka/src/rdtime.h +356 -0
- package/deps/librdkafka/src/rdtypes.h +86 -0
- package/deps/librdkafka/src/rdunittest.c +549 -0
- package/deps/librdkafka/src/rdunittest.h +232 -0
- package/deps/librdkafka/src/rdvarint.c +134 -0
- package/deps/librdkafka/src/rdvarint.h +165 -0
- package/deps/librdkafka/src/rdwin32.h +382 -0
- package/deps/librdkafka/src/rdxxhash.c +1030 -0
- package/deps/librdkafka/src/rdxxhash.h +328 -0
- package/deps/librdkafka/src/regexp.c +1352 -0
- package/deps/librdkafka/src/regexp.h +41 -0
- package/deps/librdkafka/src/snappy.c +1866 -0
- package/deps/librdkafka/src/snappy.h +62 -0
- package/deps/librdkafka/src/snappy_compat.h +138 -0
- package/deps/librdkafka/src/statistics_schema.json +444 -0
- package/deps/librdkafka/src/tinycthread.c +932 -0
- package/deps/librdkafka/src/tinycthread.h +503 -0
- package/deps/librdkafka/src/tinycthread_extra.c +199 -0
- package/deps/librdkafka/src/tinycthread_extra.h +212 -0
- package/deps/librdkafka/src/win32_config.h +58 -0
- package/deps/librdkafka/src-cpp/CMakeLists.txt +90 -0
- package/deps/librdkafka/src-cpp/ConfImpl.cpp +84 -0
- package/deps/librdkafka/src-cpp/ConsumerImpl.cpp +244 -0
- package/deps/librdkafka/src-cpp/HandleImpl.cpp +436 -0
- package/deps/librdkafka/src-cpp/HeadersImpl.cpp +48 -0
- package/deps/librdkafka/src-cpp/KafkaConsumerImpl.cpp +296 -0
- package/deps/librdkafka/src-cpp/Makefile +55 -0
- package/deps/librdkafka/src-cpp/MessageImpl.cpp +38 -0
- package/deps/librdkafka/src-cpp/MetadataImpl.cpp +170 -0
- package/deps/librdkafka/src-cpp/ProducerImpl.cpp +197 -0
- package/deps/librdkafka/src-cpp/QueueImpl.cpp +70 -0
- package/deps/librdkafka/src-cpp/README.md +16 -0
- package/deps/librdkafka/src-cpp/RdKafka.cpp +59 -0
- package/deps/librdkafka/src-cpp/TopicImpl.cpp +124 -0
- package/deps/librdkafka/src-cpp/TopicPartitionImpl.cpp +57 -0
- package/deps/librdkafka/src-cpp/rdkafkacpp.h +3797 -0
- package/deps/librdkafka/src-cpp/rdkafkacpp_int.h +1641 -0
- package/deps/librdkafka/tests/0000-unittests.c +72 -0
- package/deps/librdkafka/tests/0001-multiobj.c +102 -0
- package/deps/librdkafka/tests/0002-unkpart.c +244 -0
- package/deps/librdkafka/tests/0003-msgmaxsize.c +173 -0
- package/deps/librdkafka/tests/0004-conf.c +934 -0
- package/deps/librdkafka/tests/0005-order.c +133 -0
- package/deps/librdkafka/tests/0006-symbols.c +163 -0
- package/deps/librdkafka/tests/0007-autotopic.c +136 -0
- package/deps/librdkafka/tests/0008-reqacks.c +179 -0
- package/deps/librdkafka/tests/0009-mock_cluster.c +97 -0
- package/deps/librdkafka/tests/0011-produce_batch.c +753 -0
- package/deps/librdkafka/tests/0012-produce_consume.c +537 -0
- package/deps/librdkafka/tests/0013-null-msgs.c +473 -0
- package/deps/librdkafka/tests/0014-reconsume-191.c +512 -0
- package/deps/librdkafka/tests/0015-offset_seeks.c +172 -0
- package/deps/librdkafka/tests/0016-client_swname.c +181 -0
- package/deps/librdkafka/tests/0017-compression.c +140 -0
- package/deps/librdkafka/tests/0018-cgrp_term.c +338 -0
- package/deps/librdkafka/tests/0019-list_groups.c +289 -0
- package/deps/librdkafka/tests/0020-destroy_hang.c +162 -0
- package/deps/librdkafka/tests/0021-rkt_destroy.c +72 -0
- package/deps/librdkafka/tests/0022-consume_batch.c +279 -0
- package/deps/librdkafka/tests/0025-timers.c +147 -0
- package/deps/librdkafka/tests/0026-consume_pause.c +547 -0
- package/deps/librdkafka/tests/0028-long_topicnames.c +79 -0
- package/deps/librdkafka/tests/0029-assign_offset.c +202 -0
- package/deps/librdkafka/tests/0030-offset_commit.c +589 -0
- package/deps/librdkafka/tests/0031-get_offsets.c +235 -0
- package/deps/librdkafka/tests/0033-regex_subscribe.c +536 -0
- package/deps/librdkafka/tests/0034-offset_reset.c +398 -0
- package/deps/librdkafka/tests/0035-api_version.c +73 -0
- package/deps/librdkafka/tests/0036-partial_fetch.c +87 -0
- package/deps/librdkafka/tests/0037-destroy_hang_local.c +85 -0
- package/deps/librdkafka/tests/0038-performance.c +121 -0
- package/deps/librdkafka/tests/0039-event.c +284 -0
- package/deps/librdkafka/tests/0040-io_event.c +257 -0
- package/deps/librdkafka/tests/0041-fetch_max_bytes.c +97 -0
- package/deps/librdkafka/tests/0042-many_topics.c +252 -0
- package/deps/librdkafka/tests/0043-no_connection.c +77 -0
- package/deps/librdkafka/tests/0044-partition_cnt.c +94 -0
- package/deps/librdkafka/tests/0045-subscribe_update.c +1010 -0
- package/deps/librdkafka/tests/0046-rkt_cache.c +65 -0
- package/deps/librdkafka/tests/0047-partial_buf_tmout.c +98 -0
- package/deps/librdkafka/tests/0048-partitioner.c +283 -0
- package/deps/librdkafka/tests/0049-consume_conn_close.c +162 -0
- package/deps/librdkafka/tests/0050-subscribe_adds.c +145 -0
- package/deps/librdkafka/tests/0051-assign_adds.c +126 -0
- package/deps/librdkafka/tests/0052-msg_timestamps.c +238 -0
- package/deps/librdkafka/tests/0053-stats_cb.cpp +527 -0
- package/deps/librdkafka/tests/0054-offset_time.cpp +236 -0
- package/deps/librdkafka/tests/0055-producer_latency.c +539 -0
- package/deps/librdkafka/tests/0056-balanced_group_mt.c +315 -0
- package/deps/librdkafka/tests/0057-invalid_topic.cpp +112 -0
- package/deps/librdkafka/tests/0058-log.cpp +123 -0
- package/deps/librdkafka/tests/0059-bsearch.cpp +241 -0
- package/deps/librdkafka/tests/0060-op_prio.cpp +163 -0
- package/deps/librdkafka/tests/0061-consumer_lag.cpp +295 -0
- package/deps/librdkafka/tests/0062-stats_event.c +126 -0
- package/deps/librdkafka/tests/0063-clusterid.cpp +180 -0
- package/deps/librdkafka/tests/0064-interceptors.c +481 -0
- package/deps/librdkafka/tests/0065-yield.cpp +140 -0
- package/deps/librdkafka/tests/0066-plugins.cpp +129 -0
- package/deps/librdkafka/tests/0067-empty_topic.cpp +151 -0
- package/deps/librdkafka/tests/0068-produce_timeout.c +136 -0
- package/deps/librdkafka/tests/0069-consumer_add_parts.c +119 -0
- package/deps/librdkafka/tests/0070-null_empty.cpp +197 -0
- package/deps/librdkafka/tests/0072-headers_ut.c +448 -0
- package/deps/librdkafka/tests/0073-headers.c +381 -0
- package/deps/librdkafka/tests/0074-producev.c +87 -0
- package/deps/librdkafka/tests/0075-retry.c +290 -0
- package/deps/librdkafka/tests/0076-produce_retry.c +452 -0
- package/deps/librdkafka/tests/0077-compaction.c +363 -0
- package/deps/librdkafka/tests/0078-c_from_cpp.cpp +96 -0
- package/deps/librdkafka/tests/0079-fork.c +93 -0
- package/deps/librdkafka/tests/0080-admin_ut.c +3095 -0
- package/deps/librdkafka/tests/0081-admin.c +5633 -0
- package/deps/librdkafka/tests/0082-fetch_max_bytes.cpp +137 -0
- package/deps/librdkafka/tests/0083-cb_event.c +233 -0
- package/deps/librdkafka/tests/0084-destroy_flags.c +208 -0
- package/deps/librdkafka/tests/0085-headers.cpp +392 -0
- package/deps/librdkafka/tests/0086-purge.c +368 -0
- package/deps/librdkafka/tests/0088-produce_metadata_timeout.c +162 -0
- package/deps/librdkafka/tests/0089-max_poll_interval.c +511 -0
- package/deps/librdkafka/tests/0090-idempotence.c +171 -0
- package/deps/librdkafka/tests/0091-max_poll_interval_timeout.c +295 -0
- package/deps/librdkafka/tests/0092-mixed_msgver.c +103 -0
- package/deps/librdkafka/tests/0093-holb.c +200 -0
- package/deps/librdkafka/tests/0094-idempotence_msg_timeout.c +231 -0
- package/deps/librdkafka/tests/0095-all_brokers_down.cpp +122 -0
- package/deps/librdkafka/tests/0097-ssl_verify.cpp +658 -0
- package/deps/librdkafka/tests/0098-consumer-txn.cpp +1218 -0
- package/deps/librdkafka/tests/0099-commit_metadata.c +194 -0
- package/deps/librdkafka/tests/0100-thread_interceptors.cpp +195 -0
- package/deps/librdkafka/tests/0101-fetch-from-follower.cpp +446 -0
- package/deps/librdkafka/tests/0102-static_group_rebalance.c +836 -0
- package/deps/librdkafka/tests/0103-transactions.c +1383 -0
- package/deps/librdkafka/tests/0104-fetch_from_follower_mock.c +625 -0
- package/deps/librdkafka/tests/0105-transactions_mock.c +3930 -0
- package/deps/librdkafka/tests/0106-cgrp_sess_timeout.c +318 -0
- package/deps/librdkafka/tests/0107-topic_recreate.c +259 -0
- package/deps/librdkafka/tests/0109-auto_create_topics.cpp +278 -0
- package/deps/librdkafka/tests/0110-batch_size.cpp +182 -0
- package/deps/librdkafka/tests/0111-delay_create_topics.cpp +127 -0
- package/deps/librdkafka/tests/0112-assign_unknown_part.c +87 -0
- package/deps/librdkafka/tests/0113-cooperative_rebalance.cpp +3473 -0
- package/deps/librdkafka/tests/0114-sticky_partitioning.cpp +176 -0
- package/deps/librdkafka/tests/0115-producer_auth.cpp +182 -0
- package/deps/librdkafka/tests/0116-kafkaconsumer_close.cpp +216 -0
- package/deps/librdkafka/tests/0117-mock_errors.c +331 -0
- package/deps/librdkafka/tests/0118-commit_rebalance.c +154 -0
- package/deps/librdkafka/tests/0119-consumer_auth.cpp +167 -0
- package/deps/librdkafka/tests/0120-asymmetric_subscription.c +185 -0
- package/deps/librdkafka/tests/0121-clusterid.c +115 -0
- package/deps/librdkafka/tests/0122-buffer_cleaning_after_rebalance.c +227 -0
- package/deps/librdkafka/tests/0123-connections_max_idle.c +98 -0
- package/deps/librdkafka/tests/0124-openssl_invalid_engine.c +69 -0
- package/deps/librdkafka/tests/0125-immediate_flush.c +144 -0
- package/deps/librdkafka/tests/0126-oauthbearer_oidc.c +528 -0
- package/deps/librdkafka/tests/0127-fetch_queue_backoff.cpp +165 -0
- package/deps/librdkafka/tests/0128-sasl_callback_queue.cpp +125 -0
- package/deps/librdkafka/tests/0129-fetch_aborted_msgs.c +79 -0
- package/deps/librdkafka/tests/0130-store_offsets.c +178 -0
- package/deps/librdkafka/tests/0131-connect_timeout.c +81 -0
- package/deps/librdkafka/tests/0132-strategy_ordering.c +179 -0
- package/deps/librdkafka/tests/0133-ssl_keys.c +150 -0
- package/deps/librdkafka/tests/0134-ssl_provider.c +92 -0
- package/deps/librdkafka/tests/0135-sasl_credentials.cpp +143 -0
- package/deps/librdkafka/tests/0136-resolve_cb.c +181 -0
- package/deps/librdkafka/tests/0137-barrier_batch_consume.c +619 -0
- package/deps/librdkafka/tests/0138-admin_mock.c +281 -0
- package/deps/librdkafka/tests/0139-offset_validation_mock.c +950 -0
- package/deps/librdkafka/tests/0140-commit_metadata.cpp +108 -0
- package/deps/librdkafka/tests/0142-reauthentication.c +515 -0
- package/deps/librdkafka/tests/0143-exponential_backoff_mock.c +552 -0
- package/deps/librdkafka/tests/0144-idempotence_mock.c +373 -0
- package/deps/librdkafka/tests/0145-pause_resume_mock.c +119 -0
- package/deps/librdkafka/tests/0146-metadata_mock.c +505 -0
- package/deps/librdkafka/tests/0147-consumer_group_consumer_mock.c +952 -0
- package/deps/librdkafka/tests/0148-offset_fetch_commit_error_mock.c +563 -0
- package/deps/librdkafka/tests/0149-broker-same-host-port.c +140 -0
- package/deps/librdkafka/tests/0150-telemetry_mock.c +651 -0
- package/deps/librdkafka/tests/0151-purge-brokers.c +566 -0
- package/deps/librdkafka/tests/0152-rebootstrap.c +59 -0
- package/deps/librdkafka/tests/0153-memberid.c +128 -0
- package/deps/librdkafka/tests/1000-unktopic.c +164 -0
- package/deps/librdkafka/tests/8000-idle.cpp +60 -0
- package/deps/librdkafka/tests/8001-fetch_from_follower_mock_manual.c +113 -0
- package/deps/librdkafka/tests/CMakeLists.txt +170 -0
- package/deps/librdkafka/tests/LibrdkafkaTestApp.py +291 -0
- package/deps/librdkafka/tests/Makefile +182 -0
- package/deps/librdkafka/tests/README.md +509 -0
- package/deps/librdkafka/tests/autotest.sh +33 -0
- package/deps/librdkafka/tests/backtrace.gdb +30 -0
- package/deps/librdkafka/tests/broker_version_tests.py +315 -0
- package/deps/librdkafka/tests/buildbox.sh +17 -0
- package/deps/librdkafka/tests/cleanup-checker-tests.sh +20 -0
- package/deps/librdkafka/tests/cluster_testing.py +191 -0
- package/deps/librdkafka/tests/delete-test-topics.sh +56 -0
- package/deps/librdkafka/tests/fixtures/oauthbearer/jwt_assertion_template.json +10 -0
- package/deps/librdkafka/tests/fixtures/ssl/Makefile +8 -0
- package/deps/librdkafka/tests/fixtures/ssl/README.md +13 -0
- package/deps/librdkafka/tests/fixtures/ssl/client.keystore.intermediate.p12 +0 -0
- package/deps/librdkafka/tests/fixtures/ssl/client.keystore.p12 +0 -0
- package/deps/librdkafka/tests/fixtures/ssl/client2.certificate.intermediate.pem +72 -0
- package/deps/librdkafka/tests/fixtures/ssl/client2.certificate.pem +50 -0
- package/deps/librdkafka/tests/fixtures/ssl/client2.intermediate.key +46 -0
- package/deps/librdkafka/tests/fixtures/ssl/client2.key +46 -0
- package/deps/librdkafka/tests/fixtures/ssl/create_keys.sh +168 -0
- package/deps/librdkafka/tests/fuzzers/Makefile +12 -0
- package/deps/librdkafka/tests/fuzzers/README.md +31 -0
- package/deps/librdkafka/tests/fuzzers/fuzz_regex.c +74 -0
- package/deps/librdkafka/tests/fuzzers/helpers.h +90 -0
- package/deps/librdkafka/tests/gen-ssl-certs.sh +165 -0
- package/deps/librdkafka/tests/interactive_broker_version.py +170 -0
- package/deps/librdkafka/tests/interceptor_test/CMakeLists.txt +16 -0
- package/deps/librdkafka/tests/interceptor_test/Makefile +22 -0
- package/deps/librdkafka/tests/interceptor_test/interceptor_test.c +314 -0
- package/deps/librdkafka/tests/interceptor_test/interceptor_test.h +54 -0
- package/deps/librdkafka/tests/java/IncrementalRebalanceCli.java +97 -0
- package/deps/librdkafka/tests/java/Makefile +13 -0
- package/deps/librdkafka/tests/java/Murmur2Cli.java +46 -0
- package/deps/librdkafka/tests/java/README.md +14 -0
- package/deps/librdkafka/tests/java/TransactionProducerCli.java +162 -0
- package/deps/librdkafka/tests/java/run-class.sh +11 -0
- package/deps/librdkafka/tests/librdkafka.suppressions +483 -0
- package/deps/librdkafka/tests/lz4_manual_test.sh +59 -0
- package/deps/librdkafka/tests/multi-broker-version-test.sh +50 -0
- package/deps/librdkafka/tests/parse-refcnt.sh +43 -0
- package/deps/librdkafka/tests/performance_plot.py +115 -0
- package/deps/librdkafka/tests/plugin_test/Makefile +19 -0
- package/deps/librdkafka/tests/plugin_test/plugin_test.c +58 -0
- package/deps/librdkafka/tests/requirements.txt +2 -0
- package/deps/librdkafka/tests/run-all-tests.sh +79 -0
- package/deps/librdkafka/tests/run-consumer-tests.sh +16 -0
- package/deps/librdkafka/tests/run-producer-tests.sh +16 -0
- package/deps/librdkafka/tests/run-test-batches.py +157 -0
- package/deps/librdkafka/tests/run-test.sh +140 -0
- package/deps/librdkafka/tests/rusage.c +249 -0
- package/deps/librdkafka/tests/sasl_test.py +289 -0
- package/deps/librdkafka/tests/scenarios/README.md +6 -0
- package/deps/librdkafka/tests/scenarios/ak23.json +6 -0
- package/deps/librdkafka/tests/scenarios/default.json +5 -0
- package/deps/librdkafka/tests/scenarios/noautocreate.json +5 -0
- package/deps/librdkafka/tests/sockem.c +801 -0
- package/deps/librdkafka/tests/sockem.h +85 -0
- package/deps/librdkafka/tests/sockem_ctrl.c +145 -0
- package/deps/librdkafka/tests/sockem_ctrl.h +61 -0
- package/deps/librdkafka/tests/test.c +7778 -0
- package/deps/librdkafka/tests/test.conf.example +27 -0
- package/deps/librdkafka/tests/test.h +1028 -0
- package/deps/librdkafka/tests/testcpp.cpp +131 -0
- package/deps/librdkafka/tests/testcpp.h +388 -0
- package/deps/librdkafka/tests/testshared.h +416 -0
- package/deps/librdkafka/tests/tools/README.md +4 -0
- package/deps/librdkafka/tests/tools/stats/README.md +21 -0
- package/deps/librdkafka/tests/tools/stats/filter.jq +42 -0
- package/deps/librdkafka/tests/tools/stats/graph.py +150 -0
- package/deps/librdkafka/tests/tools/stats/requirements.txt +3 -0
- package/deps/librdkafka/tests/tools/stats/to_csv.py +124 -0
- package/deps/librdkafka/tests/trivup/trivup-0.14.0.tar.gz +0 -0
- package/deps/librdkafka/tests/until-fail.sh +87 -0
- package/deps/librdkafka/tests/xxxx-assign_partition.c +122 -0
- package/deps/librdkafka/tests/xxxx-metadata.cpp +159 -0
- package/deps/librdkafka/vcpkg.json +23 -0
- package/deps/librdkafka/win32/README.md +5 -0
- package/deps/librdkafka/win32/build-package.bat +3 -0
- package/deps/librdkafka/win32/build.bat +19 -0
- package/deps/librdkafka/win32/common.vcxproj +84 -0
- package/deps/librdkafka/win32/interceptor_test/interceptor_test.vcxproj +87 -0
- package/deps/librdkafka/win32/librdkafka.autopkg.template +54 -0
- package/deps/librdkafka/win32/librdkafka.master.testing.targets +13 -0
- package/deps/librdkafka/win32/librdkafka.sln +226 -0
- package/deps/librdkafka/win32/librdkafka.vcxproj +276 -0
- package/deps/librdkafka/win32/librdkafkacpp/librdkafkacpp.vcxproj +104 -0
- package/deps/librdkafka/win32/msbuild.ps1 +15 -0
- package/deps/librdkafka/win32/openssl_engine_example/openssl_engine_example.vcxproj +132 -0
- package/deps/librdkafka/win32/package-zip.ps1 +46 -0
- package/deps/librdkafka/win32/packages/repositories.config +4 -0
- package/deps/librdkafka/win32/push-package.bat +4 -0
- package/deps/librdkafka/win32/rdkafka_complex_consumer_example_cpp/rdkafka_complex_consumer_example_cpp.vcxproj +67 -0
- package/deps/librdkafka/win32/rdkafka_example/rdkafka_example.vcxproj +97 -0
- package/deps/librdkafka/win32/rdkafka_performance/rdkafka_performance.vcxproj +97 -0
- package/deps/librdkafka/win32/setup-msys2.ps1 +47 -0
- package/deps/librdkafka/win32/setup-vcpkg.ps1 +34 -0
- package/deps/librdkafka/win32/tests/test.conf.example +25 -0
- package/deps/librdkafka/win32/tests/tests.vcxproj +253 -0
- package/deps/librdkafka/win32/win_ssl_cert_store/win_ssl_cert_store.vcxproj +132 -0
- package/deps/librdkafka/win32/wingetopt.c +564 -0
- package/deps/librdkafka/win32/wingetopt.h +101 -0
- package/deps/librdkafka/win32/wintime.h +33 -0
- package/deps/librdkafka.gyp +62 -0
- package/lib/admin.js +233 -0
- package/lib/client.js +573 -0
- package/lib/error.js +500 -0
- package/lib/index.js +34 -0
- package/lib/kafka-consumer-stream.js +397 -0
- package/lib/kafka-consumer.js +698 -0
- package/lib/producer/high-level-producer.js +323 -0
- package/lib/producer-stream.js +307 -0
- package/lib/producer.js +375 -0
- package/lib/tools/ref-counter.js +52 -0
- package/lib/topic-partition.js +88 -0
- package/lib/topic.js +42 -0
- package/lib/util.js +29 -0
- package/package.json +61 -0
- package/prebuilds/darwin-arm64/@point3+node-rdkafka.node +0 -0
- package/prebuilds/linux-x64/@point3+node-rdkafka.node +0 -0
- package/util/configure.js +30 -0
- package/util/get-env.js +6 -0
- package/util/test-compile.js +11 -0
- 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
|
+
}
|