[icinga-checkins] icinga.org: icinga-core/master: idoutils: fix postgresql: integer not big enough for bytes_processed (Stig Sandbeck) #1401

git at icinga.org git at icinga.org
Sat Apr 30 21:33:38 CEST 2011


Module: icinga-core
Branch: master
Commit: e914b5b2d4d7ad5ea3291fac83f917a2f309bd74
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=e914b5b2d4d7ad5ea3291fac83f917a2f309bd74

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Thu Apr 28 22:52:09 2011 +0200

idoutils: fix postgresql: integer not big enough for bytes_processed (Stig Sandbeck) #1401

add upgrade scripts for pgsql/mysql too.
fix minor compiler warning.

refs #1401

---

 Changelog                                          |    1 +
 THANKS                                             |    1 +
 .../db/mysql/upgrade/mysql-upgrade-1.4.0.sql       |   15 +++++++++++++
 module/idoutils/db/pgsql/pgsql.sql                 |    4 +-
 .../db/pgsql/upgrade/pgsql-upgrade-1.4.0.sql       |   22 ++++++++++++++++++++
 module/idoutils/src/ido2db.c                       |    4 ---
 6 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/Changelog b/Changelog
index 05a2958..940b436 100644
--- a/Changelog
+++ b/Changelog
@@ -55,6 +55,7 @@ FIXES
 * idoutils: idomod: larger buffer size (by Opsview) #1286
 * idoutils: fix rdbms deconnect after connection error #1313
 * idoutils: fix race condition when issueing multiple reloads results in hanging IDO2DB processes #1410
+* idoutils: fix postgresql: integer not big enough for bytes_processed (Stig Sandbeck) #1401
 
 * install: use *.so instead of *.o for solaris, patch in contrib/solaris/ #524
 
diff --git a/THANKS b/THANKS
index 1f5c100..122c5c1 100644
--- a/THANKS
+++ b/THANKS
@@ -283,6 +283,7 @@ in various ways.  If we missed your name, let us know.
 * Gordon Smith
 * Lou Sneddon
 * Mark Spieth
+* Stig Sandbeck
 * Tim Starling
 * Thomas Stolle
 * Kevin Stone
diff --git a/module/idoutils/db/mysql/upgrade/mysql-upgrade-1.4.0.sql b/module/idoutils/db/mysql/upgrade/mysql-upgrade-1.4.0.sql
new file mode 100644
index 0000000..3a7633e
--- /dev/null
+++ b/module/idoutils/db/mysql/upgrade/mysql-upgrade-1.4.0.sql
@@ -0,0 +1,15 @@
+-- -----------------------------------------
+-- upgrade path for Icinga IDOUtils 1.4.0
+--
+-- -----------------------------------------
+-- Copyright (c) 2010-2011 Icinga Development Team (http://www.icinga.org)
+--
+-- Please check http://docs.icinga.org for upgrading information!
+-- -----------------------------------------
+
+-- -----------------------------------------
+-- update dbversion
+-- -----------------------------------------
+
+INSERT INTO icinga_dbversion (name, version) VALUES ('idoutils', '1.4.0') ON DUPLICATE KEY UPDATE version='1.4.0';
+
diff --git a/module/idoutils/db/pgsql/pgsql.sql b/module/idoutils/db/pgsql/pgsql.sql
index 9ec98a6..3bfc15c 100644
--- a/module/idoutils/db/pgsql/pgsql.sql
+++ b/module/idoutils/db/pgsql/pgsql.sql
@@ -191,8 +191,8 @@ CREATE TABLE  icinga_conninfo (
   last_checkin_time timestamp NOT NULL default '1970-01-01 00:00:00',
   data_start_time timestamp NOT NULL default '1970-01-01 00:00:00',
   data_end_time timestamp NOT NULL default '1970-01-01 00:00:00',
-  bytes_processed INTEGER NOT NULL default 0,
-  lines_processed INTEGER NOT NULL default 0,
+  bytes_processed BIGINT NOT NULL default 0,
+  lines_processed BIGINT NOT NULL default 0,
   entries_processed INTEGER NOT NULL default 0,
   PRIMARY KEY  (conninfo_id)
 ) ;
diff --git a/module/idoutils/db/pgsql/upgrade/pgsql-upgrade-1.4.0.sql b/module/idoutils/db/pgsql/upgrade/pgsql-upgrade-1.4.0.sql
new file mode 100644
index 0000000..8d3e2e2
--- /dev/null
+++ b/module/idoutils/db/pgsql/upgrade/pgsql-upgrade-1.4.0.sql
@@ -0,0 +1,22 @@
+-- -----------------------------------------
+-- upgrade path for Icinga IDOUtils 1.4.0
+--
+-- -----------------------------------------
+-- Copyright (c) 2010-2011 Icinga Development Team (http://www.icinga.org)
+--
+-- Please check http://docs.icinga.org for upgrading information!
+-- -----------------------------------------
+
+-- -----------------------------------------
+-- update dbversion
+-- -----------------------------------------
+
+SELECT updatedbversion('1.4.0');
+
+-- -----------------------------------------
+-- change integer to bigint
+-- -----------------------------------------
+
+ALTER TABLE icinga_conninfo ALTER COLUMN bytes_processed TYPE BIGINT;
+ALTER TABLE icinga_conninfo ALTER COLUMN lines_processed TYPE BIGINT;
+
diff --git a/module/idoutils/src/ido2db.c b/module/idoutils/src/ido2db.c
index de82edb..96e7e6e 100644
--- a/module/idoutils/src/ido2db.c
+++ b/module/idoutils/src/ido2db.c
@@ -2616,8 +2616,6 @@ void * ido2db_thread_worker(void *data) {
 
         ido2db_idi *idi = (ido2db_idi*) data;
 
-        int old_thread_state;
-
         struct timespec delay;
         delay.tv_sec = 5;
         delay.tv_nsec = 500000;
@@ -2686,8 +2684,6 @@ void * ido2db_thread_cleanup(void *data) {
 
 	ido2db_idi *idi = (ido2db_idi*) data;
 
-	int old_thread_state;
-
 	struct timespec delay;
 	delay.tv_sec = 0;
 	delay.tv_nsec = 500;





More information about the icinga-checkins mailing list