@platformatic/rdkafka 4.0.0 → 4.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/bench/seed.sh +0 -0
- package/binding.gyp +3 -3
- package/ci/prepublish.js +4 -3
- package/ci/update-version.js +123 -0
- package/config.d.ts +126 -10
- package/configure +0 -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 +67 -44
- package/deps/librdkafka/.semaphore/verify-linux-packages.yml +41 -0
- package/deps/librdkafka/CHANGELOG.md +471 -1
- package/deps/librdkafka/CONFIGURATION.md +29 -9
- package/deps/librdkafka/INTRODUCTION.md +909 -601
- package/deps/librdkafka/Makefile +2 -1
- package/deps/librdkafka/configure +0 -0
- package/deps/librdkafka/debian/rules +0 -0
- package/deps/librdkafka/dev-conf.sh +0 -0
- package/deps/librdkafka/examples/consumer.c +18 -8
- package/deps/librdkafka/examples/describe_consumer_groups.c +25 -6
- package/deps/librdkafka/examples/incremental_alter_configs.c +4 -5
- package/deps/librdkafka/examples/kafkatest_verifiable_client.cpp +26 -42
- package/deps/librdkafka/examples/openssl_engine_example.cpp +3 -4
- package/deps/librdkafka/examples/producer.cpp +2 -2
- package/deps/librdkafka/examples/user_scram.c +4 -5
- package/deps/librdkafka/examples/win_ssl_cert_store.cpp +4 -3
- package/deps/librdkafka/lds-gen.py +0 -0
- package/deps/librdkafka/mklove/Makefile.base +0 -0
- package/deps/librdkafka/packaging/RELEASE.md +8 -0
- package/deps/librdkafka/packaging/alpine/build-alpine.sh +0 -0
- package/deps/librdkafka/packaging/cp/README.md +4 -1
- package/deps/librdkafka/packaging/cp/check_features.c +12 -4
- package/deps/librdkafka/packaging/cp/verify-deb.sh +6 -6
- package/deps/librdkafka/packaging/cp/verify-packages.sh +52 -31
- package/deps/librdkafka/packaging/cp/verify-rpm.sh +6 -13
- package/deps/librdkafka/packaging/debian/docs +5 -0
- package/deps/librdkafka/packaging/debian/rules +0 -0
- package/deps/librdkafka/packaging/get_version.py +0 -0
- package/deps/librdkafka/packaging/homebrew/brew-update-pr.sh +0 -0
- package/deps/librdkafka/packaging/mingw-w64/{travis-before-install.sh → export-variables.sh} +0 -7
- package/deps/librdkafka/packaging/mingw-w64/semaphoreci-build.sh +1 -1
- package/deps/librdkafka/packaging/nuget/artifact.py +0 -0
- package/deps/librdkafka/packaging/nuget/cleanup-s3.py +0 -0
- package/deps/librdkafka/packaging/nuget/nuget.sh +0 -0
- package/deps/librdkafka/packaging/nuget/packaging.py +0 -0
- package/deps/librdkafka/packaging/nuget/push-to-nuget.sh +0 -0
- package/deps/librdkafka/packaging/nuget/release.py +0 -0
- package/deps/librdkafka/packaging/nuget/requirements.txt +3 -3
- package/deps/librdkafka/packaging/rpm/mock-on-docker.sh +0 -0
- package/deps/librdkafka/packaging/rpm/tests/run-test.sh +0 -0
- package/deps/librdkafka/packaging/rpm/tests/test-on-docker.sh +0 -0
- package/deps/librdkafka/packaging/tools/build-configurations-checks.sh +3 -1
- package/deps/librdkafka/packaging/tools/build-deb-package.sh +0 -0
- package/deps/librdkafka/packaging/tools/build-debian.sh +0 -0
- package/deps/librdkafka/packaging/tools/build-manylinux.sh +0 -0
- package/deps/librdkafka/packaging/tools/build-release-artifacts.sh +0 -0
- package/deps/librdkafka/packaging/tools/distro-build.sh +0 -0
- package/deps/librdkafka/packaging/tools/gh-release-checksums.py +0 -0
- package/deps/librdkafka/packaging/tools/rdutcoverage.sh +0 -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 +6 -5
- package/deps/librdkafka/packaging/tools/update_rpcs_max_versions.py +100 -0
- package/deps/librdkafka/service.yml +154 -0
- package/deps/librdkafka/src/generate_proto.sh +0 -0
- package/deps/librdkafka/src/rd.h +145 -2
- package/deps/librdkafka/src/rdaddr.h +6 -7
- package/deps/librdkafka/src/rdatomic.h +15 -11
- package/deps/librdkafka/src/rdavg.h +3 -2
- package/deps/librdkafka/src/rdbase64.c +33 -2
- package/deps/librdkafka/src/rdbase64.h +2 -0
- package/deps/librdkafka/src/rdendian.h +10 -9
- package/deps/librdkafka/src/rdhttp.c +418 -100
- package/deps/librdkafka/src/rdhttp.h +23 -5
- package/deps/librdkafka/src/rdkafka.c +299 -145
- package/deps/librdkafka/src/rdkafka.h +89 -6
- package/deps/librdkafka/src/rdkafka_admin.c +482 -105
- package/deps/librdkafka/src/rdkafka_admin.h +42 -0
- package/deps/librdkafka/src/rdkafka_broker.c +463 -312
- package/deps/librdkafka/src/rdkafka_broker.h +68 -10
- package/deps/librdkafka/src/rdkafka_buf.c +8 -5
- package/deps/librdkafka/src/rdkafka_buf.h +4 -3
- package/deps/librdkafka/src/rdkafka_cert.c +25 -1
- package/deps/librdkafka/src/rdkafka_cert.h +4 -3
- package/deps/librdkafka/src/rdkafka_cgrp.c +468 -143
- package/deps/librdkafka/src/rdkafka_cgrp.h +36 -2
- package/deps/librdkafka/src/rdkafka_conf.c +526 -102
- package/deps/librdkafka/src/rdkafka_conf.h +68 -4
- package/deps/librdkafka/src/rdkafka_feature.c +472 -35
- package/deps/librdkafka/src/rdkafka_feature.h +2 -0
- package/deps/librdkafka/src/rdkafka_fetcher.c +22 -2
- package/deps/librdkafka/src/rdkafka_fetcher.h +2 -2
- package/deps/librdkafka/src/rdkafka_int.h +84 -46
- package/deps/librdkafka/src/rdkafka_metadata.c +221 -136
- package/deps/librdkafka/src/rdkafka_metadata.h +15 -11
- package/deps/librdkafka/src/rdkafka_metadata_cache.c +279 -73
- package/deps/librdkafka/src/rdkafka_mock.c +795 -19
- package/deps/librdkafka/src/rdkafka_mock.h +119 -0
- package/deps/librdkafka/src/rdkafka_mock_cgrp.c +1298 -132
- package/deps/librdkafka/src/rdkafka_mock_handlers.c +345 -49
- package/deps/librdkafka/src/rdkafka_mock_int.h +180 -61
- package/deps/librdkafka/src/rdkafka_msg.c +35 -19
- package/deps/librdkafka/src/rdkafka_msg.h +3 -3
- package/deps/librdkafka/src/rdkafka_msgset_writer.c +14 -10
- package/deps/librdkafka/src/rdkafka_offset.c +33 -5
- package/deps/librdkafka/src/rdkafka_op.c +1 -1
- package/deps/librdkafka/src/rdkafka_op.h +45 -21
- package/deps/librdkafka/src/rdkafka_partition.c +118 -23
- package/deps/librdkafka/src/rdkafka_partition.h +16 -7
- package/deps/librdkafka/src/rdkafka_proto.h +4 -1
- package/deps/librdkafka/src/rdkafka_protocol.h +1 -0
- package/deps/librdkafka/src/rdkafka_queue.c +125 -48
- package/deps/librdkafka/src/rdkafka_queue.h +19 -0
- package/deps/librdkafka/src/rdkafka_range_assignor.c +1 -1
- package/deps/librdkafka/src/rdkafka_request.c +336 -64
- package/deps/librdkafka/src/rdkafka_request.h +24 -1
- package/deps/librdkafka/src/rdkafka_sasl.c +5 -3
- package/deps/librdkafka/src/rdkafka_sasl_oauthbearer.c +14 -10
- package/deps/librdkafka/src/rdkafka_sasl_oauthbearer_oidc.c +1166 -89
- package/deps/librdkafka/src/rdkafka_sasl_oauthbearer_oidc.h +13 -3
- package/deps/librdkafka/src/rdkafka_sasl_plain.c +3 -3
- package/deps/librdkafka/src/rdkafka_sasl_scram.c +4 -3
- package/deps/librdkafka/src/rdkafka_ssl.c +306 -81
- package/deps/librdkafka/src/rdkafka_ssl.h +22 -0
- package/deps/librdkafka/src/rdkafka_sticky_assignor.c +4 -0
- package/deps/librdkafka/src/rdkafka_telemetry.c +80 -23
- package/deps/librdkafka/src/rdkafka_telemetry_encode.c +5 -1
- package/deps/librdkafka/src/rdkafka_telemetry_encode.h +20 -20
- package/deps/librdkafka/src/rdkafka_topic.c +220 -137
- package/deps/librdkafka/src/rdkafka_topic.h +14 -8
- package/deps/librdkafka/src/rdkafka_transport.c +59 -47
- package/deps/librdkafka/src/rdkafka_transport.h +5 -0
- package/deps/librdkafka/src/rdkafka_txnmgr.c +6 -1
- package/deps/librdkafka/src/rdmap.c +6 -1
- package/deps/librdkafka/src/rdrand.c +11 -1
- package/deps/librdkafka/src/rdtime.h +48 -17
- package/deps/librdkafka/src/rdunittest.c +42 -25
- package/deps/librdkafka/src/rdunittest.h +2 -0
- package/deps/librdkafka/src/rdwin32.h +1 -1
- package/deps/librdkafka/src/regexp.c +47 -42
- package/deps/librdkafka/src/tinycthread_extra.c +45 -21
- package/deps/librdkafka/src/tinycthread_extra.h +7 -3
- package/deps/librdkafka/src-cpp/rdkafkacpp.h +28 -2
- package/deps/librdkafka/tests/0001-multiobj.c +4 -0
- package/deps/librdkafka/tests/0004-conf.c +103 -36
- package/deps/librdkafka/tests/0009-mock_cluster.c +1 -0
- package/deps/librdkafka/tests/0011-produce_batch.c +2 -1
- package/deps/librdkafka/tests/0016-client_swname.c +18 -3
- package/deps/librdkafka/tests/0017-compression.c +6 -8
- package/deps/librdkafka/tests/0018-cgrp_term.c +8 -3
- package/deps/librdkafka/tests/0021-rkt_destroy.c +1 -0
- package/deps/librdkafka/tests/0022-consume_batch.c +4 -1
- package/deps/librdkafka/tests/0026-consume_pause.c +12 -14
- package/deps/librdkafka/tests/0028-long_topicnames.c +1 -1
- package/deps/librdkafka/tests/0029-assign_offset.c +6 -8
- package/deps/librdkafka/tests/0030-offset_commit.c +2 -2
- package/deps/librdkafka/tests/0033-regex_subscribe.c +33 -17
- package/deps/librdkafka/tests/0034-offset_reset.c +25 -4
- package/deps/librdkafka/tests/0036-partial_fetch.c +1 -0
- package/deps/librdkafka/tests/0038-performance.c +1 -0
- package/deps/librdkafka/tests/0040-io_event.c +11 -5
- package/deps/librdkafka/tests/0041-fetch_max_bytes.c +1 -0
- package/deps/librdkafka/tests/0044-partition_cnt.c +3 -2
- package/deps/librdkafka/tests/0045-subscribe_update.c +284 -20
- package/deps/librdkafka/tests/0047-partial_buf_tmout.c +1 -0
- package/deps/librdkafka/tests/0048-partitioner.c +1 -1
- package/deps/librdkafka/tests/0050-subscribe_adds.c +1 -0
- package/deps/librdkafka/tests/0051-assign_adds.c +1 -0
- package/deps/librdkafka/tests/0052-msg_timestamps.c +22 -4
- package/deps/librdkafka/tests/0053-stats_cb.cpp +12 -20
- package/deps/librdkafka/tests/0055-producer_latency.c +176 -3
- package/deps/librdkafka/tests/0056-balanced_group_mt.c +6 -2
- package/deps/librdkafka/tests/0058-log.cpp +3 -3
- package/deps/librdkafka/tests/0059-bsearch.cpp +8 -4
- package/deps/librdkafka/tests/0061-consumer_lag.cpp +25 -5
- package/deps/librdkafka/tests/0067-empty_topic.cpp +3 -0
- package/deps/librdkafka/tests/0068-produce_timeout.c +21 -23
- package/deps/librdkafka/tests/0069-consumer_add_parts.c +3 -7
- package/deps/librdkafka/tests/0075-retry.c +38 -1
- package/deps/librdkafka/tests/0076-produce_retry.c +2 -0
- package/deps/librdkafka/tests/0077-compaction.c +8 -2
- package/deps/librdkafka/tests/0080-admin_ut.c +34 -4
- package/deps/librdkafka/tests/0081-admin.c +455 -155
- package/deps/librdkafka/tests/0082-fetch_max_bytes.cpp +4 -0
- package/deps/librdkafka/tests/0083-cb_event.c +8 -3
- package/deps/librdkafka/tests/0084-destroy_flags.c +14 -18
- package/deps/librdkafka/tests/0085-headers.cpp +4 -0
- package/deps/librdkafka/tests/0086-purge.c +40 -7
- package/deps/librdkafka/tests/0088-produce_metadata_timeout.c +1 -1
- package/deps/librdkafka/tests/0089-max_poll_interval.c +12 -7
- package/deps/librdkafka/tests/0090-idempotence.c +1 -2
- package/deps/librdkafka/tests/0091-max_poll_interval_timeout.c +5 -7
- package/deps/librdkafka/tests/0092-mixed_msgver.c +6 -0
- package/deps/librdkafka/tests/0093-holb.c +8 -5
- package/deps/librdkafka/tests/0094-idempotence_msg_timeout.c +1 -0
- package/deps/librdkafka/tests/0097-ssl_verify.cpp +262 -70
- package/deps/librdkafka/tests/0098-consumer-txn.cpp +16 -16
- package/deps/librdkafka/tests/0099-commit_metadata.c +1 -1
- package/deps/librdkafka/tests/0101-fetch-from-follower.cpp +1 -1
- package/deps/librdkafka/tests/0102-static_group_rebalance.c +317 -16
- package/deps/librdkafka/tests/0103-transactions.c +7 -7
- package/deps/librdkafka/tests/0104-fetch_from_follower_mock.c +1 -0
- package/deps/librdkafka/tests/0105-transactions_mock.c +18 -11
- package/deps/librdkafka/tests/0106-cgrp_sess_timeout.c +35 -14
- package/deps/librdkafka/tests/0107-topic_recreate.c +2 -2
- package/deps/librdkafka/tests/0109-auto_create_topics.cpp +86 -26
- package/deps/librdkafka/tests/0110-batch_size.cpp +1 -2
- package/deps/librdkafka/tests/0112-assign_unknown_part.c +3 -14
- package/deps/librdkafka/tests/0113-cooperative_rebalance.cpp +248 -104
- package/deps/librdkafka/tests/0114-sticky_partitioning.cpp +3 -3
- package/deps/librdkafka/tests/0115-producer_auth.cpp +4 -1
- package/deps/librdkafka/tests/0116-kafkaconsumer_close.cpp +7 -5
- package/deps/librdkafka/tests/0117-mock_errors.c +15 -5
- package/deps/librdkafka/tests/0118-commit_rebalance.c +41 -8
- package/deps/librdkafka/tests/0119-consumer_auth.cpp +20 -1
- package/deps/librdkafka/tests/0120-asymmetric_subscription.c +8 -3
- package/deps/librdkafka/tests/0125-immediate_flush.c +1 -1
- package/deps/librdkafka/tests/0126-oauthbearer_oidc.c +323 -8
- package/deps/librdkafka/tests/0129-fetch_aborted_msgs.c +1 -0
- package/deps/librdkafka/tests/0132-strategy_ordering.c +12 -4
- package/deps/librdkafka/tests/0133-ssl_keys.c +28 -6
- package/deps/librdkafka/tests/0137-barrier_batch_consume.c +24 -14
- package/deps/librdkafka/tests/0139-offset_validation_mock.c +510 -2
- package/deps/librdkafka/tests/0140-commit_metadata.cpp +1 -1
- package/deps/librdkafka/tests/0142-reauthentication.c +37 -17
- package/deps/librdkafka/tests/0143-exponential_backoff_mock.c +39 -40
- package/deps/librdkafka/tests/0146-metadata_mock.c +76 -15
- 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 +9 -6
- 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/CMakeLists.txt +6 -0
- package/deps/librdkafka/tests/LibrdkafkaTestApp.py +34 -9
- package/deps/librdkafka/tests/autotest.sh +0 -0
- package/deps/librdkafka/tests/broker_version_tests.py +0 -0
- package/deps/librdkafka/tests/buildbox.sh +0 -0
- package/deps/librdkafka/tests/cleanup-checker-tests.sh +0 -0
- package/deps/librdkafka/tests/cluster_testing.py +0 -0
- package/deps/librdkafka/tests/delete-test-topics.sh +0 -0
- package/deps/librdkafka/tests/fixtures/oauthbearer/jwt_assertion_template.json +10 -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 +42 -101
- package/deps/librdkafka/tests/fixtures/ssl/client2.intermediate.key +46 -0
- package/deps/librdkafka/tests/fixtures/ssl/client2.key +41 -29
- package/deps/librdkafka/tests/fixtures/ssl/create_keys.sh +112 -37
- package/deps/librdkafka/tests/gen-ssl-certs.sh +0 -0
- package/deps/librdkafka/tests/interactive_broker_version.py +0 -0
- package/deps/librdkafka/tests/java/Makefile +2 -1
- package/deps/librdkafka/tests/java/run-class.sh +0 -0
- package/deps/librdkafka/tests/lz4_manual_test.sh +0 -0
- package/deps/librdkafka/tests/multi-broker-version-test.sh +0 -0
- package/deps/librdkafka/tests/parse-refcnt.sh +0 -0
- package/deps/librdkafka/tests/performance_plot.py +0 -0
- package/deps/librdkafka/tests/requirements.txt +1 -1
- package/deps/librdkafka/tests/run-all-tests.sh +79 -0
- package/deps/librdkafka/tests/run-consumer-tests.sh +0 -0
- package/deps/librdkafka/tests/run-producer-tests.sh +0 -0
- package/deps/librdkafka/tests/run-test-batches.py +157 -0
- package/deps/librdkafka/tests/run-test.sh +0 -0
- package/deps/librdkafka/tests/sasl_test.py +0 -0
- package/deps/librdkafka/tests/test.c +478 -18
- package/deps/librdkafka/tests/test.h +62 -13
- package/deps/librdkafka/tests/testcpp.cpp +6 -1
- package/deps/librdkafka/tests/testcpp.h +30 -2
- package/deps/librdkafka/tests/testshared.h +16 -2
- package/deps/librdkafka/tests/tools/stats/graph.py +0 -0
- package/deps/librdkafka/tests/tools/stats/to_csv.py +1 -1
- package/deps/librdkafka/tests/trivup/trivup-0.14.0.tar.gz +0 -0
- package/deps/librdkafka/tests/until-fail.sh +0 -0
- package/deps/librdkafka/tests/xxxx-metadata.cpp +1 -1
- package/deps/librdkafka/vcpkg.json +1 -1
- package/deps/librdkafka/win32/setup-msys2.ps1 +24 -8
- package/deps/librdkafka/win32/setup-vcpkg.ps1 +28 -6
- package/deps/librdkafka/win32/tests/tests.vcxproj +6 -0
- package/deps/librdkafka/win32/wingetopt.h +5 -4
- package/errors.d.ts +27 -1
- package/lib/error.js +29 -3
- package/make_docs.sh +0 -0
- package/package.json +12 -13
- package/run_docker.sh +0 -0
- package/src/callbacks.cc +6 -9
- package/src/callbacks.h +1 -5
- package/test/kafka-consumer-worker.js +10 -7
- package/test/kafka-consumer.spec.js +32 -21
- package/deps/librdkafka/.semaphore/project.yml +0 -43
- package/deps/librdkafka/.semaphore/project_public.yml +0 -20
- package/deps/librdkafka/win32/install-openssl.ps1 +0 -33
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* librdkafka - Apache Kafka C library
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2019-2022, Magnus Edenhill
|
|
5
|
+
* 2025, Confluent Inc.
|
|
5
6
|
* All rights reserved.
|
|
6
7
|
*
|
|
7
8
|
* Redistribution and use in source and binary forms, with or without
|
|
@@ -28,6 +29,7 @@
|
|
|
28
29
|
|
|
29
30
|
#include "test.h"
|
|
30
31
|
|
|
32
|
+
#include "../src/rdkafka_proto.h"
|
|
31
33
|
|
|
32
34
|
/**
|
|
33
35
|
* @name KafkaConsumer static membership tests
|
|
@@ -160,13 +162,16 @@ static void do_test_static_group_rebalance(void) {
|
|
|
160
162
|
c[0].mv = &mv;
|
|
161
163
|
c[1].mv = &mv;
|
|
162
164
|
|
|
163
|
-
|
|
165
|
+
test_create_topic_wait_exists(NULL, topic, 3, 1, 5000);
|
|
164
166
|
test_produce_msgs_easy(topic, testid, RD_KAFKA_PARTITION_UA, msgcnt);
|
|
165
167
|
|
|
166
168
|
test_conf_set(conf, "max.poll.interval.ms", "9000");
|
|
167
169
|
test_conf_set(conf, "session.timeout.ms", "6000");
|
|
168
170
|
test_conf_set(conf, "auto.offset.reset", "earliest");
|
|
169
|
-
|
|
171
|
+
/* Keep this interval higher than cluster metadata propagation
|
|
172
|
+
* time to make sure no additional rebalances are triggered
|
|
173
|
+
* when refreshing the full metadata with a regex subscription. */
|
|
174
|
+
test_conf_set(conf, "topic.metadata.refresh.interval.ms", "2000");
|
|
170
175
|
test_conf_set(conf, "metadata.max.age.ms", "5000");
|
|
171
176
|
test_conf_set(conf, "enable.partition.eof", "true");
|
|
172
177
|
test_conf_set(conf, "group.instance.id", "consumer1");
|
|
@@ -179,7 +184,6 @@ static void do_test_static_group_rebalance(void) {
|
|
|
179
184
|
test_conf_set(conf, "group.instance.id", "consumer2");
|
|
180
185
|
c[1].rk = test_create_consumer(topic, rebalance_cb,
|
|
181
186
|
rd_kafka_conf_dup(conf), NULL);
|
|
182
|
-
rd_kafka_conf_destroy(conf);
|
|
183
187
|
|
|
184
188
|
test_wait_topic_exists(c[1].rk, topic, 5000);
|
|
185
189
|
|
|
@@ -222,15 +226,15 @@ static void do_test_static_group_rebalance(void) {
|
|
|
222
226
|
test_msgver_verify("first.verify", &mv, TEST_MSGVER_ALL, 0, msgcnt);
|
|
223
227
|
|
|
224
228
|
TEST_SAY("== Testing consumer restart ==\n");
|
|
225
|
-
conf = rd_kafka_conf_dup(rd_kafka_conf(c[1].rk));
|
|
226
229
|
|
|
227
230
|
/* Only c[1] should exhibit rebalance behavior */
|
|
228
231
|
c[1].expected_rb_event = RD_KAFKA_RESP_ERR__REVOKE_PARTITIONS;
|
|
229
232
|
TIMING_START(&t_close, "consumer restart");
|
|
230
233
|
test_consumer_close(c[1].rk);
|
|
231
234
|
rd_kafka_destroy(c[1].rk);
|
|
232
|
-
|
|
233
|
-
|
|
235
|
+
c[1].rk = test_create_consumer(topic, rebalance_cb,
|
|
236
|
+
rd_kafka_conf_dup(conf), NULL);
|
|
237
|
+
rd_kafka_conf_destroy(conf);
|
|
234
238
|
rd_kafka_poll_set_consumer(c[1].rk);
|
|
235
239
|
|
|
236
240
|
test_consumer_subscribe(c[1].rk, topics);
|
|
@@ -255,7 +259,8 @@ static void do_test_static_group_rebalance(void) {
|
|
|
255
259
|
* New topics matching the subscription pattern should cause
|
|
256
260
|
* group rebalance
|
|
257
261
|
*/
|
|
258
|
-
|
|
262
|
+
test_create_topic_wait_exists(c->rk, tsprintf("%snew", topic), 1, 1,
|
|
263
|
+
5000);
|
|
259
264
|
|
|
260
265
|
/* Await revocation */
|
|
261
266
|
rebalance_start = test_clock();
|
|
@@ -328,16 +333,25 @@ static void do_test_static_group_rebalance(void) {
|
|
|
328
333
|
/* max.poll.interval.ms should still be enforced by the consumer */
|
|
329
334
|
|
|
330
335
|
/*
|
|
331
|
-
*
|
|
332
|
-
* `max.poll.interval.ms`
|
|
336
|
+
* Stop polling consumer 2 until we reach
|
|
337
|
+
* `max.poll.interval.ms` and is evicted from the group.
|
|
333
338
|
*/
|
|
334
339
|
rebalance_start = test_clock();
|
|
335
340
|
c[1].expected_rb_event = RD_KAFKA_RESP_ERR__REVOKE_PARTITIONS;
|
|
336
341
|
c[0].expected_rb_event = RD_KAFKA_RESP_ERR__REVOKE_PARTITIONS;
|
|
337
342
|
c[0].curr_line = __LINE__;
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
c[
|
|
343
|
+
/* consumer 2 will time out and all partitions will be assigned to
|
|
344
|
+
* consumer 1. */
|
|
345
|
+
static_member_expect_rebalance(&c[0], rebalance_start, &c[0].revoked_at,
|
|
346
|
+
-1);
|
|
347
|
+
c[0].expected_rb_event = RD_KAFKA_RESP_ERR__ASSIGN_PARTITIONS;
|
|
348
|
+
static_member_expect_rebalance(&c[0], rebalance_start,
|
|
349
|
+
&c[0].assigned_at, -1);
|
|
350
|
+
|
|
351
|
+
/* consumer 2 restarts polling and re-joins the group */
|
|
352
|
+
rebalance_start = test_clock();
|
|
353
|
+
c[0].expected_rb_event = RD_KAFKA_RESP_ERR__REVOKE_PARTITIONS;
|
|
354
|
+
c[1].curr_line = __LINE__;
|
|
341
355
|
test_consumer_poll_expect_err(c[1].rk, testid, 1000,
|
|
342
356
|
RD_KAFKA_RESP_ERR__MAX_POLL_EXCEEDED);
|
|
343
357
|
|
|
@@ -440,9 +454,9 @@ is_fatal_cb(rd_kafka_t *rk, rd_kafka_resp_err_t err, const char *reason) {
|
|
|
440
454
|
}
|
|
441
455
|
|
|
442
456
|
/**
|
|
443
|
-
* @brief Test that consumer fencing raises a fatal error
|
|
457
|
+
* @brief Test that consumer fencing raises a fatal error, classic protocol
|
|
444
458
|
*/
|
|
445
|
-
static void
|
|
459
|
+
static void do_test_fenced_member_classic(void) {
|
|
446
460
|
rd_kafka_t *c[3]; /* 0: consumer2b, 1: consumer1, 2: consumer2a */
|
|
447
461
|
rd_kafka_conf_t *conf;
|
|
448
462
|
const char *topic =
|
|
@@ -458,9 +472,11 @@ static void do_test_fenced_member(void) {
|
|
|
458
472
|
test_create_topic(NULL, topic, 3, 1);
|
|
459
473
|
|
|
460
474
|
test_conf_set(conf, "group.instance.id", "consumer1");
|
|
475
|
+
test_conf_set(conf, "client.id", "consumer1");
|
|
461
476
|
c[1] = test_create_consumer(topic, NULL, rd_kafka_conf_dup(conf), NULL);
|
|
462
477
|
|
|
463
478
|
test_conf_set(conf, "group.instance.id", "consumer2");
|
|
479
|
+
test_conf_set(conf, "client.id", "consumer2a");
|
|
464
480
|
c[2] = test_create_consumer(topic, NULL, rd_kafka_conf_dup(conf), NULL);
|
|
465
481
|
|
|
466
482
|
test_wait_topic_exists(c[2], topic, 5000);
|
|
@@ -473,6 +489,7 @@ static void do_test_fenced_member(void) {
|
|
|
473
489
|
/* Create conflicting consumer */
|
|
474
490
|
TEST_SAY("Creating conflicting consumer2 instance\n");
|
|
475
491
|
test_conf_set(conf, "group.instance.id", "consumer2");
|
|
492
|
+
test_conf_set(conf, "client.id", "consumer2b");
|
|
476
493
|
c[0] = test_create_consumer(topic, NULL, rd_kafka_conf_dup(conf), NULL);
|
|
477
494
|
rd_kafka_conf_destroy(conf);
|
|
478
495
|
|
|
@@ -523,13 +540,297 @@ static void do_test_fenced_member(void) {
|
|
|
523
540
|
SUB_TEST_PASS();
|
|
524
541
|
}
|
|
525
542
|
|
|
543
|
+
/**
|
|
544
|
+
* @brief Test that consumer fencing raises a fatal error,
|
|
545
|
+
* consumer protocol (KIP-848).
|
|
546
|
+
* The difference with the behavior of the classic one is that
|
|
547
|
+
* the member that is fenced is the one that is joining the group
|
|
548
|
+
* and not the one that was already in the group.
|
|
549
|
+
* Also the error is ERR_UNRELEASED_INSTANCE_ID instead of
|
|
550
|
+
* ERR_FENCED_INSTANCE_ID.
|
|
551
|
+
*/
|
|
552
|
+
static void do_test_fenced_member_consumer(void) {
|
|
553
|
+
rd_kafka_t *c[3]; /* 0: consumer2b, 1: consumer1, 2: consumer2a */
|
|
554
|
+
rd_kafka_conf_t *conf;
|
|
555
|
+
const char *topic =
|
|
556
|
+
test_mk_topic_name("0102_static_group_rebalance", 1);
|
|
557
|
+
rd_kafka_message_t *rkm;
|
|
558
|
+
char errstr[512];
|
|
559
|
+
rd_kafka_resp_err_t err;
|
|
560
|
+
|
|
561
|
+
SUB_TEST();
|
|
526
562
|
|
|
563
|
+
test_conf_init(&conf, NULL, 30);
|
|
564
|
+
|
|
565
|
+
test_create_topic(NULL, topic, 3, 1);
|
|
566
|
+
|
|
567
|
+
test_conf_set(conf, "group.instance.id", "consumer1");
|
|
568
|
+
test_conf_set(conf, "client.id", "consumer1");
|
|
569
|
+
c[1] = test_create_consumer(topic, NULL, rd_kafka_conf_dup(conf), NULL);
|
|
570
|
+
|
|
571
|
+
test_conf_set(conf, "group.instance.id", "consumer2");
|
|
572
|
+
test_conf_set(conf, "client.id", "consumer2a");
|
|
573
|
+
c[2] = test_create_consumer(topic, NULL, rd_kafka_conf_dup(conf), NULL);
|
|
574
|
+
|
|
575
|
+
test_wait_topic_exists(c[2], topic, 5000);
|
|
576
|
+
|
|
577
|
+
test_consumer_subscribe(c[1], topic);
|
|
578
|
+
test_consumer_subscribe(c[2], topic);
|
|
579
|
+
|
|
580
|
+
await_assignment_multi("Awaiting initial assignments", &c[1], 2);
|
|
581
|
+
|
|
582
|
+
/* Create conflicting consumer */
|
|
583
|
+
TEST_SAY("Creating conflicting consumer 2 instance\n");
|
|
584
|
+
test_conf_set(conf, "group.instance.id", "consumer2");
|
|
585
|
+
test_conf_set(conf, "client.id", "consumer2b");
|
|
586
|
+
c[0] = test_create_consumer(topic, NULL, rd_kafka_conf_dup(conf), NULL);
|
|
587
|
+
rd_kafka_conf_destroy(conf);
|
|
588
|
+
|
|
589
|
+
test_curr->is_fatal_cb = is_fatal_cb;
|
|
590
|
+
valid_fatal_rk = c[0]; /* consumer2b is the consumer that should fail */
|
|
591
|
+
|
|
592
|
+
test_consumer_subscribe(c[0], topic);
|
|
593
|
+
|
|
594
|
+
/* consumer1 should not be affected (other than a rebalance which
|
|
595
|
+
* we ignore here)... */
|
|
596
|
+
test_consumer_poll_no_msgs("consumer1", c[1], 0, 5000);
|
|
597
|
+
|
|
598
|
+
/* consumer2b should be fenced off on joining */
|
|
599
|
+
rkm = rd_kafka_consumer_poll(c[0], 5000);
|
|
600
|
+
TEST_ASSERT(rkm != NULL, "Expected error, not timeout");
|
|
601
|
+
TEST_ASSERT(rkm->err == RD_KAFKA_RESP_ERR__FATAL,
|
|
602
|
+
"Expected ERR__FATAL, not %s: %s",
|
|
603
|
+
rd_kafka_err2str(rkm->err), rd_kafka_message_errstr(rkm));
|
|
604
|
+
TEST_SAY("Fenced consumer returned expected: %s: %s\n",
|
|
605
|
+
rd_kafka_err2name(rkm->err), rd_kafka_message_errstr(rkm));
|
|
606
|
+
rd_kafka_message_destroy(rkm);
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
/* Read the actual error */
|
|
610
|
+
err = rd_kafka_fatal_error(c[0], errstr, sizeof(errstr));
|
|
611
|
+
TEST_SAY("%s fatal error: %s: %s\n", rd_kafka_name(c[0]),
|
|
612
|
+
rd_kafka_err2name(err), errstr);
|
|
613
|
+
TEST_ASSERT(
|
|
614
|
+
err == RD_KAFKA_RESP_ERR_UNRELEASED_INSTANCE_ID,
|
|
615
|
+
"Expected ERR_UNRELEASED_INSTANCE_ID as fatal error, not %s",
|
|
616
|
+
rd_kafka_err2name(err));
|
|
617
|
+
|
|
618
|
+
TEST_SAY("close\n");
|
|
619
|
+
/* Close consumer2b, should also return a fatal error */
|
|
620
|
+
err = rd_kafka_consumer_close(c[0]);
|
|
621
|
+
TEST_ASSERT(err == RD_KAFKA_RESP_ERR__FATAL,
|
|
622
|
+
"Expected close on %s to return ERR__FATAL, not %s",
|
|
623
|
+
rd_kafka_name(c[0]), rd_kafka_err2name(err));
|
|
624
|
+
|
|
625
|
+
rd_kafka_destroy(c[0]);
|
|
626
|
+
|
|
627
|
+
/* consumer1 and consumer2a should be fine and get their
|
|
628
|
+
* assignments */
|
|
629
|
+
await_assignment_multi("Awaiting post-fencing assignment", &c[1], 2);
|
|
630
|
+
|
|
631
|
+
rd_kafka_destroy(c[1]);
|
|
632
|
+
rd_kafka_destroy(c[2]);
|
|
633
|
+
|
|
634
|
+
SUB_TEST_PASS();
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* @brief Create a new consumer with given \p boostraps
|
|
638
|
+
* \p group_id and \p group_instance_id .
|
|
639
|
+
*/
|
|
640
|
+
static rd_kafka_t *create_consumer(const char *bootstraps,
|
|
641
|
+
const char *group_id,
|
|
642
|
+
const char *group_instance_id) {
|
|
643
|
+
rd_kafka_conf_t *conf;
|
|
644
|
+
test_conf_init(&conf, NULL, 0);
|
|
645
|
+
test_conf_set(conf, "bootstrap.servers", bootstraps);
|
|
646
|
+
test_conf_set(conf, "group.instance.id", group_instance_id);
|
|
647
|
+
test_conf_set(conf, "auto.offset.reset", "earliest");
|
|
648
|
+
test_conf_set(conf, "enable.partition.eof", "true");
|
|
649
|
+
return test_create_consumer(group_id, NULL, conf, NULL);
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* @brief Get generation id of consumer \p consumer .
|
|
654
|
+
*/
|
|
655
|
+
static int32_t consumer_generation_id(rd_kafka_t *consumer) {
|
|
656
|
+
rd_kafka_consumer_group_metadata_t *group_metadata;
|
|
657
|
+
int32_t generation_id;
|
|
658
|
+
|
|
659
|
+
group_metadata = rd_kafka_consumer_group_metadata(consumer);
|
|
660
|
+
generation_id =
|
|
661
|
+
rd_kafka_consumer_group_metadata_generation_id(group_metadata);
|
|
662
|
+
rd_kafka_consumer_group_metadata_destroy(group_metadata);
|
|
663
|
+
return generation_id;
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* @brief Check if the API key in \p request is the same as that
|
|
668
|
+
* pointed by \p opaque .
|
|
669
|
+
*/
|
|
670
|
+
static rd_bool_t is_api_key(rd_kafka_mock_request_t *request, void *opaque) {
|
|
671
|
+
int32_t api_key = *(int32_t *)opaque;
|
|
672
|
+
return rd_kafka_mock_request_api_key(request) == api_key;
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* @enum do_test_static_membership_mock_variation_t
|
|
677
|
+
* @brief Variations of the static membership mock test.
|
|
678
|
+
*/
|
|
679
|
+
typedef enum do_test_static_membership_mock_variation_t {
|
|
680
|
+
/** Consumer 1 leaves with unsubscribe and rejoins the group */
|
|
681
|
+
DO_TEST_STATIC_MEMBERSHIP_MOCK_VARIATION_SAME_INSTANCE = 0,
|
|
682
|
+
/** Consumer 1 leaves with unsubscribe and a new consumer with same
|
|
683
|
+
* group.instance.id joins the group */
|
|
684
|
+
DO_TEST_STATIC_MEMBERSHIP_MOCK_VARIATION_NEW_INSTANCE = 1,
|
|
685
|
+
DO_TEST_STATIC_MEMBERSHIP_MOCK_VARIATION__CNT
|
|
686
|
+
} do_test_static_membership_mock_variation_t;
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* @brief Static group membership tests with the mock cluster.
|
|
690
|
+
* Checks that consumer returns the same assignment
|
|
691
|
+
* and generation id after re-joining.
|
|
692
|
+
*
|
|
693
|
+
* @param variation Test variation to run.
|
|
694
|
+
*
|
|
695
|
+
* @sa `do_test_static_membership_mock_variation_t`
|
|
696
|
+
*/
|
|
697
|
+
static void do_test_static_membership_mock(
|
|
698
|
+
do_test_static_membership_mock_variation_t variation) {
|
|
699
|
+
const char *bootstraps;
|
|
700
|
+
rd_kafka_mock_cluster_t *mcluster;
|
|
701
|
+
int32_t api_key = RD_KAFKAP_ConsumerGroupHeartbeat;
|
|
702
|
+
const char *topic = test_mk_topic_name(__FUNCTION__, 0);
|
|
703
|
+
rd_kafka_t *consumer1, *consumer2, *consumer_1_to_destroy = NULL;
|
|
704
|
+
int32_t prev_generation_id1, next_generation_id1, prev_generation_id2,
|
|
705
|
+
next_generation_id2;
|
|
706
|
+
rd_kafka_topic_partition_list_t *prev_assignment1, *prev_assignment2,
|
|
707
|
+
*next_assignment1, *next_assignment2;
|
|
708
|
+
|
|
709
|
+
SUB_TEST_QUICK(
|
|
710
|
+
"%s",
|
|
711
|
+
variation == DO_TEST_STATIC_MEMBERSHIP_MOCK_VARIATION_SAME_INSTANCE
|
|
712
|
+
? "with same instance"
|
|
713
|
+
: "with new instance");
|
|
714
|
+
|
|
715
|
+
mcluster = test_mock_cluster_new(3, &bootstraps);
|
|
716
|
+
rd_kafka_mock_topic_create(mcluster, topic, 2, 3);
|
|
717
|
+
|
|
718
|
+
TEST_SAY("Creating consumers\n");
|
|
719
|
+
consumer1 = create_consumer(bootstraps, topic, "c1");
|
|
720
|
+
consumer2 = create_consumer(bootstraps, topic, "c2");
|
|
721
|
+
|
|
722
|
+
TEST_SAY("Subscribing consumers to topic \"%s\"\n", topic);
|
|
723
|
+
test_consumer_subscribe(consumer1, topic);
|
|
724
|
+
test_consumer_subscribe(consumer2, topic);
|
|
725
|
+
|
|
726
|
+
TEST_SAY("Waiting one EOF of consumer 1\n");
|
|
727
|
+
test_consumer_poll_exact("first consumer", consumer1, 0, 1, 0, 0,
|
|
728
|
+
rd_true, NULL);
|
|
729
|
+
TEST_SAY("Waiting one EOF of consumer 2\n");
|
|
730
|
+
test_consumer_poll_exact("second consumer", consumer2, 0, 1, 0, 0,
|
|
731
|
+
rd_true, NULL);
|
|
732
|
+
|
|
733
|
+
prev_generation_id1 = consumer_generation_id(consumer1);
|
|
734
|
+
prev_generation_id2 = consumer_generation_id(consumer2);
|
|
735
|
+
TEST_CALL_ERR__(rd_kafka_assignment(consumer1, &prev_assignment1));
|
|
736
|
+
TEST_CALL_ERR__(rd_kafka_assignment(consumer2, &prev_assignment2));
|
|
737
|
+
TEST_ASSERT(prev_assignment1 != NULL,
|
|
738
|
+
"Expected assignment for consumer 1 before the change");
|
|
739
|
+
TEST_ASSERT(prev_assignment2 != NULL,
|
|
740
|
+
"Expected assignment for consumer 2 before the change");
|
|
741
|
+
|
|
742
|
+
TEST_SAY("Unsubscribing consumer 1\n");
|
|
743
|
+
rd_kafka_mock_start_request_tracking(mcluster);
|
|
744
|
+
TEST_CALL_ERR__(rd_kafka_unsubscribe(consumer1));
|
|
745
|
+
test_mock_wait_matching_requests(mcluster, 1, 1000, is_api_key,
|
|
746
|
+
&api_key);
|
|
747
|
+
rd_kafka_mock_stop_request_tracking(mcluster);
|
|
748
|
+
|
|
749
|
+
if (variation ==
|
|
750
|
+
DO_TEST_STATIC_MEMBERSHIP_MOCK_VARIATION_NEW_INSTANCE) {
|
|
751
|
+
/* Don't destroy it immediately because the
|
|
752
|
+
* topic partition lists still hold a reference. */
|
|
753
|
+
consumer_1_to_destroy = consumer1;
|
|
754
|
+
|
|
755
|
+
TEST_SAY("Re-creating consumer 1\n");
|
|
756
|
+
/* Re-create the consumer with same group and instance id. */
|
|
757
|
+
consumer1 = create_consumer(bootstraps, topic, "c1");
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
TEST_SAY("Subscribing consumer 1 again\n");
|
|
761
|
+
test_consumer_subscribe(consumer1, topic);
|
|
762
|
+
test_consumer_wait_assignment(consumer1, rd_false);
|
|
763
|
+
|
|
764
|
+
next_generation_id1 = consumer_generation_id(consumer1);
|
|
765
|
+
next_generation_id2 = consumer_generation_id(consumer2);
|
|
766
|
+
|
|
767
|
+
TEST_ASSERT(next_generation_id1 == prev_generation_id1,
|
|
768
|
+
"Expected same generation id for consumer 1, "
|
|
769
|
+
"got %d != %d",
|
|
770
|
+
prev_generation_id1, next_generation_id1);
|
|
771
|
+
TEST_ASSERT(next_generation_id2 == prev_generation_id2,
|
|
772
|
+
"Expected same generation id for consumer 2, "
|
|
773
|
+
"got %d != %d",
|
|
774
|
+
prev_generation_id2, next_generation_id2);
|
|
775
|
+
|
|
776
|
+
TEST_CALL_ERR__(rd_kafka_assignment(consumer1, &next_assignment1));
|
|
777
|
+
TEST_CALL_ERR__(rd_kafka_assignment(consumer2, &next_assignment2));
|
|
778
|
+
TEST_ASSERT(next_assignment1 != NULL,
|
|
779
|
+
"Expected assignment for consumer 1 after the change");
|
|
780
|
+
TEST_ASSERT(next_assignment2 != NULL,
|
|
781
|
+
"Expected assignment for consumer 2 after the change");
|
|
782
|
+
TEST_ASSERT(!test_partition_list_and_offsets_cmp(prev_assignment1,
|
|
783
|
+
next_assignment1),
|
|
784
|
+
"Expected same assignment for consumer 1 after the change");
|
|
785
|
+
TEST_ASSERT(!test_partition_list_and_offsets_cmp(prev_assignment2,
|
|
786
|
+
next_assignment2),
|
|
787
|
+
"Expected same assignment for consumer 2 after the change");
|
|
788
|
+
|
|
789
|
+
rd_kafka_topic_partition_list_destroy(prev_assignment1);
|
|
790
|
+
rd_kafka_topic_partition_list_destroy(prev_assignment2);
|
|
791
|
+
rd_kafka_topic_partition_list_destroy(next_assignment1);
|
|
792
|
+
rd_kafka_topic_partition_list_destroy(next_assignment2);
|
|
793
|
+
|
|
794
|
+
RD_IF_FREE(consumer_1_to_destroy, rd_kafka_destroy);
|
|
795
|
+
rd_kafka_destroy(consumer1);
|
|
796
|
+
rd_kafka_destroy(consumer2);
|
|
797
|
+
test_mock_cluster_destroy(mcluster);
|
|
798
|
+
|
|
799
|
+
SUB_TEST_PASS();
|
|
800
|
+
}
|
|
527
801
|
|
|
528
802
|
int main_0102_static_group_rebalance(int argc, char **argv) {
|
|
803
|
+
/* TODO: check again when regexes
|
|
804
|
+
* will be supported by KIP-848 */
|
|
805
|
+
if (test_consumer_group_protocol_classic()) {
|
|
806
|
+
do_test_static_group_rebalance();
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
if (test_consumer_group_protocol_classic()) {
|
|
810
|
+
do_test_fenced_member_classic();
|
|
811
|
+
} else {
|
|
812
|
+
do_test_fenced_member_consumer();
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
return 0;
|
|
816
|
+
}
|
|
529
817
|
|
|
530
|
-
|
|
818
|
+
int main_0102_static_group_rebalance_mock(int argc, char **argv) {
|
|
819
|
+
TEST_SKIP_MOCK_CLUSTER(0);
|
|
820
|
+
int variation;
|
|
531
821
|
|
|
532
|
-
|
|
822
|
+
if (test_consumer_group_protocol_classic()) {
|
|
823
|
+
TEST_SKIP(
|
|
824
|
+
"Static membership isn't implemented "
|
|
825
|
+
"in mock cluster for classic protocol\n");
|
|
826
|
+
return 0;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
for (variation = DO_TEST_STATIC_MEMBERSHIP_MOCK_VARIATION_SAME_INSTANCE;
|
|
830
|
+
variation < DO_TEST_STATIC_MEMBERSHIP_MOCK_VARIATION__CNT;
|
|
831
|
+
variation++) {
|
|
832
|
+
do_test_static_membership_mock(variation);
|
|
833
|
+
}
|
|
533
834
|
|
|
534
835
|
return 0;
|
|
535
836
|
}
|
|
@@ -143,7 +143,7 @@ static void do_test_basic_producer_txn(rd_bool_t enable_compression) {
|
|
|
143
143
|
// FIXME: add testing were the txn id is reused (and thus fails)
|
|
144
144
|
|
|
145
145
|
/* Create topic */
|
|
146
|
-
|
|
146
|
+
test_create_topic_wait_exists(p, topic, partition_cnt, 3, 5000);
|
|
147
147
|
|
|
148
148
|
/* Create consumer */
|
|
149
149
|
c_conf = conf;
|
|
@@ -348,8 +348,8 @@ void do_test_consumer_producer_txn(void) {
|
|
|
348
348
|
p1 = test_create_handle(RD_KAFKA_PRODUCER, tmpconf);
|
|
349
349
|
|
|
350
350
|
/* Create input and output topics */
|
|
351
|
-
|
|
352
|
-
|
|
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
353
|
|
|
354
354
|
/* Seed input topic with messages */
|
|
355
355
|
TEST_CALL_ERROR__(rd_kafka_init_transactions(p1, 30 * 1000));
|
|
@@ -879,7 +879,7 @@ static void do_test_fatal_idempo_error_without_kip360(void) {
|
|
|
879
879
|
|
|
880
880
|
p = test_create_handle(RD_KAFKA_PRODUCER, conf);
|
|
881
881
|
|
|
882
|
-
|
|
882
|
+
test_create_topic_wait_exists(p, topic, 1, 3, 5000);
|
|
883
883
|
|
|
884
884
|
|
|
885
885
|
TEST_CALL_ERROR__(rd_kafka_init_transactions(p, 30 * 1000));
|
|
@@ -1029,7 +1029,7 @@ static void do_test_empty_txn(rd_bool_t send_offsets, rd_bool_t do_commit) {
|
|
|
1029
1029
|
rd_kafka_conf_set_dr_msg_cb(conf, test_dr_msg_cb);
|
|
1030
1030
|
p = test_create_handle(RD_KAFKA_PRODUCER, conf);
|
|
1031
1031
|
|
|
1032
|
-
|
|
1032
|
+
test_create_topic_wait_exists(p, topic, 1, 3, 5000);
|
|
1033
1033
|
|
|
1034
1034
|
/* Produce some non-txnn messages for the consumer to read and commit */
|
|
1035
1035
|
test_produce_msgs_easy(topic, testid, 0, msgcnt);
|
|
@@ -1130,7 +1130,7 @@ static void do_test_txn_abort_control_message_leader_epoch(void) {
|
|
|
1130
1130
|
rd_kafka_conf_set_dr_msg_cb(p_conf, test_dr_msg_cb);
|
|
1131
1131
|
p = test_create_handle(RD_KAFKA_PRODUCER, p_conf);
|
|
1132
1132
|
|
|
1133
|
-
|
|
1133
|
+
test_create_topic_wait_exists(p, topic, 1, 3, 5000);
|
|
1134
1134
|
|
|
1135
1135
|
TEST_CALL_ERROR__(rd_kafka_init_transactions(p, 5000));
|
|
1136
1136
|
|
|
@@ -1225,7 +1225,7 @@ static void do_test_wmark_isolation_level(void) {
|
|
|
1225
1225
|
rd_kafka_conf_set_dr_msg_cb(conf, test_dr_msg_cb);
|
|
1226
1226
|
p = test_create_handle(RD_KAFKA_PRODUCER, rd_kafka_conf_dup(conf));
|
|
1227
1227
|
|
|
1228
|
-
|
|
1228
|
+
test_create_topic_wait_exists(p, topic, 1, 3, 5000);
|
|
1229
1229
|
|
|
1230
1230
|
/* Produce some non-txn messages to avoid 0 as the committed hwmark */
|
|
1231
1231
|
test_produce_msgs_easy(topic, testid, 0, 100);
|
|
@@ -584,6 +584,7 @@ static void do_test_seek_to_offset_with_previous_epoch(void) {
|
|
|
584
584
|
* from offset 'msgcnt'. */
|
|
585
585
|
rd_kafka_topic_partition_set_leader_epoch(rktpar, 0);
|
|
586
586
|
rd_kafka_seek_partitions(c, rktpars, -1);
|
|
587
|
+
rd_kafka_topic_partition_list_destroy(rktpars);
|
|
587
588
|
|
|
588
589
|
test_consumer_poll("third", c, 0, 0, msgcnt, msgcnt, NULL);
|
|
589
590
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* librdkafka - Apache Kafka C library
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) 2019-2022, Magnus Edenhill
|
|
5
|
+
* 2025, Confluent Inc.
|
|
5
6
|
* All rights reserved.
|
|
6
7
|
*
|
|
7
8
|
* Redistribution and use in source and binary forms, with or without
|
|
@@ -44,13 +45,14 @@
|
|
|
44
45
|
|
|
45
46
|
|
|
46
47
|
static int allowed_error;
|
|
48
|
+
static int allowed_error_2;
|
|
47
49
|
|
|
48
50
|
/**
|
|
49
51
|
* @brief Decide what error_cb's will cause the test to fail.
|
|
50
52
|
*/
|
|
51
53
|
static int
|
|
52
54
|
error_is_fatal_cb(rd_kafka_t *rk, rd_kafka_resp_err_t err, const char *reason) {
|
|
53
|
-
if (err == allowed_error ||
|
|
55
|
+
if (err == allowed_error || err == allowed_error_2 ||
|
|
54
56
|
/* If transport errors are allowed then it is likely
|
|
55
57
|
* that we'll also see ALL_BROKERS_DOWN. */
|
|
56
58
|
(allowed_error == RD_KAFKA_RESP_ERR__TRANSPORT &&
|
|
@@ -1926,8 +1928,8 @@ retry:
|
|
|
1926
1928
|
/* The retry should succeed */
|
|
1927
1929
|
test_curr->ignore_dr_err = rd_false;
|
|
1928
1930
|
test_curr->exp_dr_err = is_retry
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
+
? RD_KAFKA_RESP_ERR_NO_ERROR
|
|
1932
|
+
: RD_KAFKA_RESP_ERR__MSG_TIMED_OUT;
|
|
1931
1933
|
|
|
1932
1934
|
rd_kafka_mock_partition_set_leader(mcluster, topic, 0, 1);
|
|
1933
1935
|
rd_kafka_mock_partition_set_leader(mcluster, topic, 1, 1);
|
|
@@ -2062,7 +2064,9 @@ static void do_test_txn_coord_req_destroy(void) {
|
|
|
2062
2064
|
|
|
2063
2065
|
rd_kafka_mock_push_request_errors(
|
|
2064
2066
|
mcluster, RD_KAFKAP_AddOffsetsToTxn,
|
|
2065
|
-
|
|
2067
|
+
3, /* first request + number of internal retries */
|
|
2068
|
+
RD_KAFKA_RESP_ERR_CONCURRENT_TRANSACTIONS,
|
|
2069
|
+
RD_KAFKA_RESP_ERR_CONCURRENT_TRANSACTIONS,
|
|
2066
2070
|
RD_KAFKA_RESP_ERR_CONCURRENT_TRANSACTIONS);
|
|
2067
2071
|
|
|
2068
2072
|
err = rd_kafka_producev(rk, RD_KAFKA_V_TOPIC("mytopic"),
|
|
@@ -2125,6 +2129,7 @@ static void do_test_txn_coord_req_destroy(void) {
|
|
|
2125
2129
|
TEST_CALL_ERROR__(rd_kafka_abort_transaction(rk, 5000));
|
|
2126
2130
|
}
|
|
2127
2131
|
|
|
2132
|
+
TEST_SAY("Got %d errors\n", errcnt);
|
|
2128
2133
|
TEST_ASSERT(errcnt > 0,
|
|
2129
2134
|
"Expected at least one send_offets_to_transaction() "
|
|
2130
2135
|
"failure");
|
|
@@ -2222,12 +2227,12 @@ static void do_test_txn_coord_req_multi_find(void) {
|
|
|
2222
2227
|
|
|
2223
2228
|
on_response_received_cb = multi_find_on_response_received_cb;
|
|
2224
2229
|
rk = create_txn_producer(&mcluster, txnid, 3,
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2230
|
+
/* Need connections to all brokers so we
|
|
2231
|
+
* can trigger coord_req_fsm events
|
|
2232
|
+
* by toggling connections. */
|
|
2233
|
+
"enable.sparse.connections", "false",
|
|
2234
|
+
/* Set up on_response_received interceptor */
|
|
2235
|
+
"on_response_received", "", NULL);
|
|
2231
2236
|
|
|
2232
2237
|
/* Let broker 1 be both txn and group coordinator
|
|
2233
2238
|
* so that the group coordinator connection is up when it is time
|
|
@@ -3042,6 +3047,7 @@ static void do_test_txn_coordinator_null_not_fatal(void) {
|
|
|
3042
3047
|
|
|
3043
3048
|
/* Broker down is not a test-failing error */
|
|
3044
3049
|
allowed_error = RD_KAFKA_RESP_ERR__TRANSPORT;
|
|
3050
|
+
allowed_error_2 = RD_KAFKA_RESP_ERR__TIMED_OUT;
|
|
3045
3051
|
test_curr->is_fatal_cb = error_is_fatal_cb;
|
|
3046
3052
|
test_curr->exp_dr_err = RD_KAFKA_RESP_ERR__MSG_TIMED_OUT;
|
|
3047
3053
|
|
|
@@ -3113,6 +3119,7 @@ static void do_test_txn_coordinator_null_not_fatal(void) {
|
|
|
3113
3119
|
rd_kafka_destroy(rk);
|
|
3114
3120
|
|
|
3115
3121
|
allowed_error = RD_KAFKA_RESP_ERR_NO_ERROR;
|
|
3122
|
+
allowed_error_2 = RD_KAFKA_RESP_ERR_NO_ERROR;
|
|
3116
3123
|
test_curr->exp_dr_err = RD_KAFKA_RESP_ERR_NO_ERROR;
|
|
3117
3124
|
test_curr->is_fatal_cb = NULL;
|
|
3118
3125
|
|
|
@@ -3795,7 +3802,7 @@ do_test_txn_offset_commit_doesnt_retry_too_quickly(rd_bool_t times_out) {
|
|
|
3795
3802
|
* 2000ms for this call to succeed. */
|
|
3796
3803
|
timeout = times_out ? 500 : 4000;
|
|
3797
3804
|
error = rd_kafka_send_offsets_to_transaction(rk, offsets, cgmetadata,
|
|
3798
|
-
|
|
3805
|
+
timeout);
|
|
3799
3806
|
rd_kafka_consumer_group_metadata_destroy(cgmetadata);
|
|
3800
3807
|
rd_kafka_topic_partition_list_destroy(offsets);
|
|
3801
3808
|
|