Code

Add rd_kafka_last_error.patch
authorMarc Fournier <marc@bl.uem.li>
Wed, 21 Feb 2018 15:54:25 +0000 (16:54 +0100)
committerMarc Fournier <marc@bl.uem.li>
Wed, 21 Feb 2018 15:56:13 +0000 (16:56 +0100)
This is needed to make the write_kafka plugin build on sid, and can be
dropped when uploading collectd 5.8.1.

debian/changelog
debian/patches/rd_kafka_last_error.patch [new file with mode: 0644]
debian/patches/series

index e7fc4c5994e13815b52409f3cf2b50955e484eb7..6e5d341c68aa521075e9a63b17778128e35cc166 100644 (file)
@@ -5,6 +5,8 @@ collectd (5.8.0-1) UNRELEASED; urgency=medium
   * Enable the intel_rdt plugin, libpqos is now available.
   * Re-enable the varnish plugin, support for varnish 5.2 now implemented.
   * debian/patches:
+    - Added rd_kafka_last_error.patch; needed to build against
+      librdkafka-0.11.0.
     - Removed dpdk-pkg-config.patch; included upstream.
     - Removed libcollectdclient_error_buffer.patch; inclued upstream.
     - Removed local-msr-index-h.patch; included upstream.
diff --git a/debian/patches/rd_kafka_last_error.patch b/debian/patches/rd_kafka_last_error.patch
new file mode 100644 (file)
index 0000000..27fceac
--- /dev/null
@@ -0,0 +1,34 @@
+Description: 'rd_kafka_errno2err' is deprecated, fix failed builds
+ Since librdkafka-0.11.0 applications should use
+ rd_kafka_last_error() to retrieve the error code from the legacy APIs.
+Author: Pavel Rochnyack <pavel2000@ngs.ru>
+Forwarded: https://github.com/collectd/collectd/pull/2683
+
+diff --git a/src/write_kafka.c b/src/write_kafka.c
+index 306d92ccb..17a83e0e9 100644
+--- a/src/write_kafka.c
++++ b/src/write_kafka.c
+@@ -77,6 +77,14 @@ static void kafka_log(const rd_kafka_t *rkt, int level, const char *fac,
+ }
+ #endif
++static rd_kafka_resp_err_t kafka_error() {
++#if RD_KAFKA_VERSION >= 0x000b00ff
++  return rd_kafka_last_error();
++#else
++  return rd_kafka_errno2err(errno);
++#endif
++}
++
+ static uint32_t kafka_hash(const char *keydata, size_t keylen) {
+   uint32_t hash = 5381;
+   for (; keylen > 0; keylen--)
+@@ -147,7 +155,7 @@ static int kafka_handle(struct kafka_topic_context *ctx) /* {{{ */
+     if ((ctx->topic = rd_kafka_topic_new(ctx->kafka, ctx->topic_name,
+                                          topic_conf)) == NULL) {
+       ERROR("write_kafka plugin: cannot create topic : %s\n",
+-            rd_kafka_err2str(rd_kafka_errno2err(errno)));
++            rd_kafka_err2str(kafka_error()));
+       return errno;
+     }
index 8c3f46b2e3722b791529ef4ad0b272c6927927ab..c795534bb94c00dd43d9c0ac7a3739b3ce60a8e4 100644 (file)
@@ -2,3 +2,4 @@ rrd_filter_path.patch
 collection_conf_path.patch
 myplugin_includes.patch
 nagios-debian-paths.patch
+rd_kafka_last_error.patch