[icinga-checkins] icinga.org: icinga-core/rbartels/cgi-current: idoutils: introduce schema version and check against that instead of program version #1368

git at icinga.org git at icinga.org
Fri Apr 29 00:04:44 CEST 2011


Module: icinga-core
Branch: rbartels/cgi-current
Commit: 9c679c44c06f58214fda9caa1bd4cae5323a628d
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=9c679c44c06f58214fda9caa1bd4cae5323a628d

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Wed Apr 27 23:28:03 2011 +0200

idoutils: introduce schema version and check against that instead of program version #1368

added debugoutput too.
needs documentation for releases on how to update the schema version

refs #1368

---

 Changelog                        |    1 +
 module/idoutils/include/ido2db.h |    2 ++
 module/idoutils/src/db.c         |    6 ++++--
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index 6ab696a..1876fbe 100644
--- a/Changelog
+++ b/Changelog
@@ -25,6 +25,7 @@ ENHANCEMENTS
 
 * idoutils: add db socket as config option in ido2db.cfg for mysql and postgresql #1107
 * idoutils: reduce housekeeping cycle to every 3600s, set housekeeping thread startup delay to 300s #1157
+* idoutils: introduce schema version and check against that instead of program version #1368
 
 * config: increase default debug file size to 100M #1316
 
diff --git a/module/idoutils/include/ido2db.h b/module/idoutils/include/ido2db.h
index c9eedbc..77ce145 100644
--- a/module/idoutils/include/ido2db.h
+++ b/module/idoutils/include/ido2db.h
@@ -16,6 +16,8 @@
 #define IDO2DB_DATE "05-11-2011"
 #define IDO2DB_VERSION "1.4.0"
 
+#define IDO2DB_SCHEMA_VERSION "1.4.0"
+
 /*************** RDBMS headers *************/
 
 /* oracle */
diff --git a/module/idoutils/src/db.c b/module/idoutils/src/db.c
index 1a72332..f7c0c66 100644
--- a/module/idoutils/src/db.c
+++ b/module/idoutils/src/db.c
@@ -1312,11 +1312,13 @@ int ido2db_db_version_check(ido2db_idi *idi) {
 
 	/* check dbversion against program version */
 	if(idi->dbinfo.dbversion==NULL){
+		ido2db_log_debug_info(IDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_db_version_check() dbversion is NULL\n");
 		syslog(LOG_ERR, "Error: DB Version cannot be retrieved. Please check the upgrade docs and verify the db schema!");
 		return IDO_ERROR;
 	}
-	if(strcmp(idi->dbinfo.dbversion, IDO2DB_VERSION)!=0){
-		syslog(LOG_ERR, "Error: DB Version %s does not match program version %s. Please check the upgrade docs!", idi->dbinfo.dbversion, IDO2DB_VERSION);
+	if(strcmp(idi->dbinfo.dbversion, IDO2DB_SCHEMA_VERSION)!=0){
+		ido2db_log_debug_info(IDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_db_version_check() db version %s does not match schema version %s\n", idi->dbinfo.dbversion, IDO2DB_SCHEMA_VERSION);
+		syslog(LOG_ERR, "Error: DB Version %s does not match needed schema version %s. Please check the upgrade docs!", idi->dbinfo.dbversion, IDO2DB_SCHEMA_VERSION);
 		return IDO_ERROR;
 	}
 





More information about the icinga-checkins mailing list