From 5b903bf6e3e15538abcbbfdec480484a09c1eb1b Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Mon, 9 Mar 2009 17:42:48 +0100 Subject: [PATCH] patches/postgresql_conf_fix.dpatch: Make sure "disk_io" doesn't return NULL. Starting with some version between 8.3.3 and 8.3.6, pg_statio_*_tables returns NULL instead of 0 for statistics if no instance of the appropriate relation exists. PQgetvalue() returns an empty string in that case which would then result in error messages when udb_result_submit() tries to convert that to a number. Now, the "disk_io" query uses PostgreSQL's coalesce() function to make sure 0 is returned instead of NULL. --- debian/changelog | 5 +-- debian/patches/postgresql_conf_fix.dpatch | 39 +++++++++++++++++++++-- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index b0253d7..ba8dfa6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -42,9 +42,10 @@ collectd (4.6.1-1) unstable; urgency=low all plugins are spelled lowercase. * debian/patches/: - Added postgresql_conf_fix.dpatch - upstream patch to fix the use of - deprecated configuration options. + deprecated configuration options and to make sure the "disk_io" query + does not return NULLs. - -- Sebastian Harl Sat, 07 Mar 2009 17:29:39 +0100 + -- Sebastian Harl Mon, 09 Mar 2009 17:42:01 +0100 collectd (4.5.1-1) experimental; urgency=low diff --git a/debian/patches/postgresql_conf_fix.dpatch b/debian/patches/postgresql_conf_fix.dpatch index 74d9e72..57c5bd1 100755 --- a/debian/patches/postgresql_conf_fix.dpatch +++ b/debian/patches/postgresql_conf_fix.dpatch @@ -1,8 +1,20 @@ #! /bin/sh /usr/share/dpatch/dpatch-run ## postgresql_conf_fix.dpatch by Sebastian Harl ## -## DP: postgresql_default.conf: Don't use the deprecated {Min,Max}PgVersion -## DP: options. +## DP: postgresql_default.conf: +## DP: +## DP: * Don't use the deprecated {Min,Max}PgVersion options. +## DP: +## DP: * Make sure the "disk_io" query does not return NULLs. +## DP: +## DP: Starting with some version between 8.3.3 and 8.3.6, +## DP: pg_statio_*_tables returns NULL instead of 0 for statistics if no +## DP: instance of the appropriate relation exists. PQgetvalue() returns an +## DP: empty string in that case which would then result in error messages +## DP: when udb_result_submit() tries to convert that to a number. +## DP: +## DP: Now, the "disk_io" query uses PostgreSQL's coalesce() function to +## DP: make sure 0 is returned instead of NULL. @DPATCH@ @@ -36,3 +48,26 @@ diff a/src/postgresql_default.conf b/src/postgresql_default.conf +@@ -141,14 +141,14 @@ + + + +- Statement "SELECT sum(heap_blks_read) AS heap_read, \ +- sum(heap_blks_hit) AS heap_hit, \ +- sum(idx_blks_read) AS idx_read, \ +- sum(idx_blks_hit) AS idx_hit, \ +- sum(toast_blks_read) AS toast_read, \ +- sum(toast_blks_hit) AS toast_hit, \ +- sum(tidx_blks_read) AS tidx_read, \ +- sum(tidx_blks_hit) AS tidx_hit \ ++ Statement "SELECT coalesce(sum(heap_blks_read), 0) AS heap_read, \ ++ coalesce(sum(heap_blks_hit), 0) AS heap_hit, \ ++ coalesce(sum(idx_blks_read), 0) AS idx_read, \ ++ coalesce(sum(idx_blks_hit), 0) AS idx_hit, \ ++ coalesce(sum(toast_blks_read), 0) AS toast_read, \ ++ coalesce(sum(toast_blks_hit), 0) AS toast_hit, \ ++ coalesce(sum(tidx_blks_read), 0) AS tidx_read, \ ++ coalesce(sum(tidx_blks_hit), 0) AS tidx_hit \ + FROM pg_statio_user_tables;" + + -- 2.30.2