Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add getControllerId #554

Merged
merged 5 commits into from
Sep 2, 2024
Merged

Add getControllerId #554

merged 5 commits into from
Sep 2, 2024

Conversation

qkdreyer
Copy link
Contributor

No description provided.

@qkdreyer qkdreyer marked this pull request as draft July 15, 2024 13:42
@qkdreyer qkdreyer changed the title wip Add getControllerId Jul 15, 2024
@qkdreyer qkdreyer force-pushed the controllerid branch 5 times, most recently from d66f9e3 to 1f87298 Compare July 16, 2024 07:09
@qkdreyer qkdreyer marked this pull request as ready for review July 16, 2024 07:20
@qkdreyer
Copy link
Contributor Author

@arnaud-lb not sure why CI is failing; I've tried upgrading the docker images to their latest version in 1f87298 but it looks like that's not compatible with v0.11.6, wdyt?

@qkdreyer

This comment was marked as outdated.

@qkdreyer

This comment was marked as outdated.

docker run -d --network kafka_network --name zookeeper wurstmeister/zookeeper:3.4.6
docker pull wurstmeister/kafka:2.13-2.6.0
docker run -d -p 9092:9092 --network kafka_network -e "KAFKA_AUTO_CREATE_TOPICS_ENABLE=true" -e "KAFKA_CREATE_TOPICS=test-topic:1:1:compact" -e "KAFKA_ADVERTISED_HOST_NAME=kafka" -e "KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181" -e "KAFKA_ADVERTISED_PORT=9092" --name kafka wurstmeister/kafka:2.13-2.6.0
docker pull wurstmeister/zookeeper:latest
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use a fixed version here, otherwise the CI may break independently of changes made in this repos

Copy link
Contributor Author

@qkdreyer qkdreyer Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the thing is wurstmeister/zookeeper only exists with 3.4.6 and latest tags, and 3.4.6 tag seems broken for 2 months

kafka_consumer.c Outdated
Returns the current ControllerId (controller broker id) as reported in broker metadata */
PHP_METHOD(RdKafka_KafkaConsumer, getControllerId)
{
kafka_object *intern;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
kafka_object *intern;
object_intern *intern;

$conf->set('metadata.broker.list', getenv('TEST_KAFKA_BROKERS'));
$conf->set('group.id', 'test');

echo (new RdKafka\KafkaConsumer($conf))->getControllerId(0) . \PHP_EOL;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting a timeout > 0 would make this test more robust. I suggest a timeout of 10*1000 as in getMetadata() tests.

@@ -528,6 +528,28 @@ PHP_METHOD(RdKafka_KafkaConsumer, getMetadata)
}
/* }}} */

#ifdef HAS_RD_KAFKA_CONTROLLERID
Copy link
Owner

@arnaud-lb arnaud-lb Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rd_kafka_controllerid appears to be broken in librdkafka 0.11.x. I suggest not compiling this method on this version:

Suggested change
#ifdef HAS_RD_KAFKA_CONTROLLERID
#if defined(HAS_RD_KAFKA_CONTROLLERID) && RD_KAFKA_VERSION >= 0x010000ff

Then update the test SKIPIF section to check if the method exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've improved HAS_RD_KAFKA_CONTROLLERID the definition instead

php-rdkafka/config.m4

Lines 74 to 82 in 015b7a2

AC_CHECK_LIB($LIBNAME,[rd_kafka_controllerid],[
#if RD_KAFKA_VERSION >= 0x010000ff
AC_DEFINE(HAS_RD_KAFKA_CONTROLLERID,1,[ ])
#else
AC_MSG_WARN([controllerid is broken on 0.11.x])
#endif
],[
AC_MSG_WARN([controllerid is not available])
])

@qkdreyer
Copy link
Contributor Author

failed tests are being flaky with Fatal error: Uncaught RdKafka\Exception: Local: Unknown topic in

@qkdreyer qkdreyer requested a review from arnaud-lb August 30, 2024 19:55
@arnaud-lb arnaud-lb merged commit 554305b into arnaud-lb:6.x Sep 2, 2024
50 of 53 checks passed
@arnaud-lb
Copy link
Owner

Thank you!

@qkdreyer qkdreyer deleted the controllerid branch September 3, 2024 12:05
@qkdreyer
Copy link
Contributor Author

qkdreyer commented Sep 3, 2024

can we release a 6.0.4 version?

@qkdreyer
Copy link
Contributor Author

qkdreyer commented Sep 4, 2024

bump @arnaud-lb 🙏

@arnaud-lb
Copy link
Owner

arnaud-lb commented Oct 24, 2024

Released 6.0.4: https://github.com/arnaud-lb/php-rdkafka/releases/tag/6.0.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants