From 0238682f66506f3a4f6ba200d28d2103ce430171 Mon Sep 17 00:00:00 2001 From: Demian Vladi Date: Tue, 29 Oct 2024 11:18:54 -0700 Subject: [PATCH 1/3] Rely on librdkafka error handling --- nmsg/kafkaio.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/nmsg/kafkaio.c b/nmsg/kafkaio.c index 2f332677..d02bde71 100644 --- a/nmsg/kafkaio.c +++ b/nmsg/kafkaio.c @@ -210,7 +210,7 @@ _kafka_state_to_str(kafka_state state) static void _kafka_set_state(kafka_ctx_t ctx, const char *func, kafka_state state) { - _nmsg_dprintf(3, "%s changing state from %s to %s\n", func, + _nmsg_dprintf(3, "%s: changing state from %s to %s\n", func, _kafka_state_to_str(ctx->state), _kafka_state_to_str(state)); ctx->state = state; } @@ -597,19 +597,15 @@ _kafka_error_cb(rd_kafka_t *rk, int err, const char *reason, void *opaque) return; } switch (err_kafka) { - /* Keep retrying on socket disconnect, brokers down and message timeout */ case RD_KAFKA_RESP_ERR__TRANSPORT: case RD_KAFKA_RESP_ERR__ALL_BROKERS_DOWN: case RD_KAFKA_RESP_ERR__MSG_TIMED_OUT: - _nmsg_dprintf(2, "%s: got Kafka error %d: %s\n", __func__, err, reason); - break; case RD_KAFKA_RESP_ERR__UNKNOWN_PARTITION: case RD_KAFKA_RESP_ERR_UNKNOWN_TOPIC_OR_PART: case RD_KAFKA_RESP_ERR_OFFSET_OUT_OF_RANGE: - /* At the moment treat any broker's error as fatal */ default: + /* Just log, let librdkafka handle all errors */ _nmsg_dprintf(2, "%s: got Kafka error %d: %s\n", __func__, err, reason); - _kafka_set_state(ctx, __func__, kafka_state_break); break; } } @@ -630,10 +626,7 @@ _kafka_delivery_cb(rd_kafka_t *rk, const rd_kafka_message_t *rkmessage, void *op } if (rkmessage->err != RD_KAFKA_RESP_ERR_NO_ERROR) { int level = 2; - if (rkmessage->err != RD_KAFKA_RESP_ERR__MSG_TIMED_OUT) { - _kafka_set_state(ctx, __func__, kafka_state_break); - rd_kafka_yield(rk); - } else { + if (rkmessage->err == RD_KAFKA_RESP_ERR__MSG_TIMED_OUT) { ctx->dropped++; level = 4; } From 077be12d1c92126c06a6ddaa6ed1290784c9090d Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Thu, 31 Oct 2024 18:42:20 +0000 Subject: [PATCH 2/3] 1.3.1 release metadata. --- ChangeLog | 4 ++++ configure.ac | 2 +- debian/changelog | 6 ++++++ nmsg.spec | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index d575c218..3216bb5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +nmsg (1.3.1-1) + + * Rely on librdkafka error handling. + nmsg (1.2.0) * Add support for Kafka i/o in JSON and binary forms. diff --git a/configure.ac b/configure.ac index 87ab970c..8287c6ce 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ(2.64) m4_define(nmsg_major_version, 1) m4_define(nmsg_minor_version, 3) -m4_define(nmsg_patchlevel_version, 0) +m4_define(nmsg_patchlevel_version, 1) m4_define(nmsg_version, nmsg_major_version.nmsg_minor_version.nmsg_patchlevel_version) m4_define(nmsg_version_number, diff --git a/debian/changelog b/debian/changelog index 90de54af..4f16778b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +nmsg (1.3.1-1) debian-fsi; urgency=medium + + * Rely on librdkafka error handling. + + -- Farsight Security, Inc. Thu, 31 Oct 2024 18:19:04 +0000 + nmsg (1.3.0-1) debian-fsi; urgency=medium * Added external configuration for Kafka IO. diff --git a/nmsg.spec b/nmsg.spec index a47fe41c..2c4767c5 100644 --- a/nmsg.spec +++ b/nmsg.spec @@ -1,5 +1,5 @@ Name: nmsg -Version: 1.3.0 +Version: 1.3.1 Release: 1%{?dist} Summary: network message encapsulation library From 3cdc1c88c99ecd6c45f9f4edb0e94872f0a41894 Mon Sep 17 00:00:00 2001 From: Allan LeSage Date: Thu, 31 Oct 2024 22:47:39 +0000 Subject: [PATCH 3/3] Improve changelog: 'built-in' error handing. --- ChangeLog | 2 +- debian/changelog | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3216bb5c..c496da26 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,6 @@ nmsg (1.3.1-1) - * Rely on librdkafka error handling. + * Rely on built-in librdkafka error handling. nmsg (1.2.0) diff --git a/debian/changelog b/debian/changelog index 4f16778b..b64a41b0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ nmsg (1.3.1-1) debian-fsi; urgency=medium - * Rely on librdkafka error handling. + * Rely on built-in librdkafka error handling. -- Farsight Security, Inc. Thu, 31 Oct 2024 18:19:04 +0000