From 6b29f39c2213e209f0996105c78b77f034b983f9 Mon Sep 17 00:00:00 2001 From: Pavel Rochnyack Date: Sun, 12 Aug 2018 02:47:15 +0700 Subject: [PATCH] dbi plugin: Removed excessive error reporting Latest libdbi code sets BADIDX error when no more rows is in 'dbi_result_next_row()' (similar to 'dbi_result_prev_row()' and to match library documentation). There is confusing errors in Collectd logs due to this change. Added a 'dbi_result_has_next_row()' check to solve. Closes: #2894 --- src/dbi.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/dbi.c b/src/dbi.c index fe9bc516..899c802c 100644 --- a/src/dbi.c +++ b/src/dbi.c @@ -603,15 +603,16 @@ static int cdbi_read_database_query(cdbi_database_t *db, /* {{{ */ } /* }}} */ /* Get the next row from the database. */ + if (!dbi_result_has_next_row(res)) + break; + status = dbi_result_next_row(res); /* {{{ */ if (status != 1) { - if (dbi_conn_error(db->connection, NULL) != 0) { - char errbuf[1024]; - WARNING("dbi plugin: cdbi_read_database_query (%s, %s): " - "dbi_result_next_row failed: %s.", - db->name, udb_query_get_name(q), - cdbi_strerror(db->connection, errbuf, sizeof(errbuf))); - } + char errbuf[1024]; + WARNING("dbi plugin: cdbi_read_database_query (%s, %s): " + "dbi_result_next_row failed: %s.", + db->name, udb_query_get_name(q), + cdbi_strerror(db->connection, errbuf, sizeof(errbuf))); break; } /* }}} */ } /* }}} while (42) */ -- 2.11.0