[icinga-checkins] icinga.org: icinga-core/next: remove socketqueue/ transaction config options and enable them by default

git at icinga.org git at icinga.org
Thu May 2 12:02:21 CEST 2013


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

Author: Michael Friedrich <michael.friedrich at netways.de>
Date:   Thu May  2 11:23:01 2013 +0200

remove socketqueue/transaction config options and enable them by default

tests on the long run were just fine, and if this would be made a config
option, noone would ever test it anways, so we keep this feature as big
enhancement for 1.9 and may provide fixes in minor releases, if any.

fixes #4032

---

 Changelog                                          |   11 +++---
 module/idoutils/config/ido2db.cfg-sample.in        |   24 ------------
 .../config/updates/ido2db.cfg_added_1.8_to_1.9.cfg |   23 ------------
 module/idoutils/include/db.h                       |    1 -
 module/idoutils/include/ido2db.h                   |    1 -
 module/idoutils/src/ido2db.c                       |   38 +++++++------------
 6 files changed, 20 insertions(+), 78 deletions(-)

diff --git a/Changelog b/Changelog
index 1895cb3..6368db3 100644
--- a/Changelog
+++ b/Changelog
@@ -15,6 +15,7 @@ UPGRADE NOTES
 1.9.0 - 07/05/2013
 
 NOTES
+* idoutils uses a socket queue and transactions for large object dumps! #3527 #3533
 * ido2db.cfg enable_sla is now deprecated! #3450
 
 ENHANCEMENTS
@@ -40,8 +41,8 @@ ENHANCEMENTS
 * classic ui: Made classic ui work standalone #3869 - RB
 * classic ui: add 'executed command' to extinfo.cgi linking to command expander #3901 - MF
 
-* idoutils: use transactions for large object dumps, opt-in config option #3527 - GB
-* idoutils: add experimental socket queue proxy; opt-in via config option #3533 - GB
+* idoutils: use transactions for large object dumps #3527 - GB
+* idoutils: add socket queue proxy addressing core reload problems #3533 - GB
 * idoutils: add more indexes for sla reporting #3649 - MF
 * idoutils: Oracle - change output fields to clob #3412 - TD
 
@@ -122,6 +123,9 @@ FIXES
 
 CHANGES
 
+* idoutils: use transactions for large object dumps #3527
+* idoutils: add socket queue proxy addressing core reload problems #3533
+
 * icinga.cfg - enable_state_based_escalation_ranges=0 (disabled if not set) fix for #3441
 * icinga.cfg - set status_file=/dev/null to disable its creation #3819
 * icinga.cfg - set object_cache_file=/dev/null to disable its creation #3819
@@ -135,9 +139,6 @@ CHANGES
 	** if enable_environment_macros=1
 	** and use_large_installation_tweaks=1
 
-* ido2db.cfg:
-	** use_transactions #3527
-	** enable_socket_queue #3533
 
 * icinga.spec: add idoutils as transitional package #3640
 
diff --git a/module/idoutils/config/ido2db.cfg-sample.in b/module/idoutils/config/ido2db.cfg-sample.in
index 8442fc6..c644fdf 100644
--- a/module/idoutils/config/ido2db.cfg-sample.in
+++ b/module/idoutils/config/ido2db.cfg-sample.in
@@ -351,27 +351,3 @@ oracle_trace_level=0
 # anymore, as it has never been used by any Icinga application.
 
 enable_sla=0
-
-# ENABLE TRANSACTIONS - EXPERIMENTAL!
-# This setting enables SQL transactions during data processing. It will
-# be useful when dumping config objects and their relations (contacts, etc),
-# during normal operations it won't help that much.
-# The intention is clearly to reduce the reload/restart time when idomod
-# dumps the config data, blocking the core.
-#
-# WARNING: uses BEGIN / COMMIT for the transactions - make sure this
-# works with your DBMS!
-
-use_transactions=0
-
-# ENABLE SOCKET QUEUE - EXPERIMENTAL!
-# This setting enables a socket queue which will proxy the data received
-# from ido socket and the data(base) actions.
-# Values: 0 = disabled, 1 = enabled
-#
-# WARNING: This setting is highly experimental and may cause data loss on
-# your system if enabled. This is especially harmful when dumping the config
-# during core reload/restart. If problems occur, explicitely tell that you
-# are using this feature. You've been warned.
-
-enable_socket_queue=0
diff --git a/module/idoutils/config/updates/ido2db.cfg_added_1.8_to_1.9.cfg b/module/idoutils/config/updates/ido2db.cfg_added_1.8_to_1.9.cfg
index 89ea5a8..f619757 100644
--- a/module/idoutils/config/updates/ido2db.cfg_added_1.8_to_1.9.cfg
+++ b/module/idoutils/config/updates/ido2db.cfg_added_1.8_to_1.9.cfg
@@ -6,29 +6,6 @@
 #	full Icinga experience!
 #################################################################
 
-# ENABLE TRANSACTIONS - EXPERIMENTAL!
-# This setting enables SQL transactions during data processing. It will
-# be useful when dumping config objects and their relations (contacts, etc),
-# during normal operations it won't help that much.
-# The intention is clearly to reduce the reload/restart time when idomod
-# dumps the config data, blocking the core.
-#
-# WARNING: uses BEGIN / COMMIT for the transactions - make sure this
-# works with your DBMS!
-
-use_transactions=0
-
-# ENABLE SOCKET QUEUE - EXPERIMENTAL!
-# This setting enables a socket queue which will proxy the data received
-# from ido socket and the data(base) actions.
-# Values: 0 = disabled, 1 = enabled
-#
-# WARNING: This setting is highly experimental and may cause data loss on
-# your system if enabled. This is especially harmful when dumping the config
-# during core reload/restart. If problems occur, explicitely tell that you
-# are using this feature. You've been warned.
-
-enable_socket_queue=0
 
 
 
diff --git a/module/idoutils/include/db.h b/module/idoutils/include/db.h
index 75ace06..66e31d8 100644
--- a/module/idoutils/include/db.h
+++ b/module/idoutils/include/db.h
@@ -39,7 +39,6 @@ typedef struct ido2db_dbconfig_struct{
         unsigned long clean_config_tables_on_core_startup;
 	unsigned long oci_errors_to_syslog;
 	unsigned int oracle_trace_level;
-	unsigned int use_transactions;
         }ido2db_dbconfig;
 
 /*************** DB server types ***************/
diff --git a/module/idoutils/include/ido2db.h b/module/idoutils/include/ido2db.h
index fd361ea..73ecd87 100644
--- a/module/idoutils/include/ido2db.h
+++ b/module/idoutils/include/ido2db.h
@@ -225,7 +225,6 @@ typedef struct ido2db_dbconninfo_struct{
 	unsigned long clean_realtime_tables_on_core_startup;
 	unsigned long clean_config_tables_on_core_startup;
 	unsigned long oci_errors_to_syslog;
-	unsigned int use_transactions;
 	time_t last_table_trim_time;
 	time_t last_logentry_time;
 	char *last_logentry_data;
diff --git a/module/idoutils/src/ido2db.c b/module/idoutils/src/ido2db.c
index 0519c2c..2a0777a 100644
--- a/module/idoutils/src/ido2db.c
+++ b/module/idoutils/src/ido2db.c
@@ -87,8 +87,6 @@ int ido2db_debug_verbosity = IDO2DB_DEBUGV_BASIC;
 FILE *ido2db_debug_file_fp = NULL;
 unsigned long ido2db_max_debug_file_size = 0L;
 
-int enable_socket_queue = IDO_FALSE;
-
 int enable_sla = IDO_FALSE;
 int ido2db_debug_readable_timestamp = IDO_FALSE;
 
@@ -618,10 +616,6 @@ int ido2db_process_config_var(char *arg) {
 		enable_sla = (atoi(val) > 0) ? IDO_TRUE : IDO_FALSE;
 	} else if (!strcmp(var, "debug_readable_timestamp")) {
 		ido2db_debug_readable_timestamp = (atoi(val) > 0) ? IDO_TRUE : IDO_FALSE;
-	} else if (!strcmp(var, "use_transactions")) {
-		ido2db_db_settings.use_transactions = (atoi(val) > 0) ? IDO_TRUE : IDO_FALSE;
-        } else if (!strcmp(var, "enable_socket_queue")) {
-                enable_socket_queue = (atoi(val) > 0) ? IDO_TRUE : IDO_FALSE;
         }
 	else if (!strcmp(var, "libdbi_driver_dir")) {
 		if ((libdbi_driver_dir = strdup(val)) == NULL)
@@ -665,7 +659,6 @@ int ido2db_initialize_variables(void) {
 	ido2db_db_settings.clean_config_tables_on_core_startup = IDO_TRUE;
 	ido2db_db_settings.oci_errors_to_syslog = DEFAULT_OCI_ERRORS_TO_SYSLOG;
 	ido2db_db_settings.oracle_trace_level = ORACLE_TRACE_LEVEL_OFF;
-	ido2db_db_settings.use_transactions = IDO_FALSE;
 
 	ido2db_log_debug_info(IDO2DB_DEBUGL_PROCESSINFO, 2, "ido2db_initialize_variables() end\n");
 	return IDO_OK;
@@ -1268,22 +1261,20 @@ int ido2db_wait_for_connections(void) {
 
 			new_sd = accept(ido2db_sd, (ido2db_socket_type == IDO_SINK_TCPSOCKET) ? (struct sockaddr *)&client_address_i : (struct sockaddr *)&client_address_u, (socklen_t *)&client_address_length);
 
-			if (enable_socket_queue == IDO_TRUE) {
-				if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNIX, fds) == 0) {
-					pthread_t tid;
+			if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNIX, fds) == 0) {
+				pthread_t tid;
 
-					ido2db_proxy_args *pa = (ido2db_proxy_args *)malloc(sizeof(ido2db_proxy_args));
-					pa->fd_left = new_sd;
-					pa->fd_right = fds[0];
+				ido2db_proxy_args *pa = (ido2db_proxy_args *)malloc(sizeof(ido2db_proxy_args));
+				pa->fd_left = new_sd;
+				pa->fd_right = fds[0];
 
-					if (pthread_create(&tid, NULL, ido2db_proxy_thread_proc, pa) == 0) {
-						(void) pthread_detach(tid);
+				if (pthread_create(&tid, NULL, ido2db_proxy_thread_proc, pa) == 0) {
+					(void) pthread_detach(tid);
 
-						new_sd = fds[1];
-					} else {
-						close(fds[0]);
-						close(fds[1]);
-					}
+					new_sd = fds[1];
+				} else {
+					close(fds[0]);
+					close(fds[1]);
 				}
 			}
 
@@ -1542,12 +1533,11 @@ int ido2db_handle_client_connection(int sd) {
 		/* 2011-02-23 MF: only do that in a worker thread */
 		/* 2011-05-02 MF: redo it the old way */
 
-		if(ido2db_db_settings.use_transactions == IDO_TRUE) {
-			result = ido2db_db_tx_begin(&idi);
-		}
+		result = ido2db_db_tx_begin(&idi);
+
 		ido2db_check_for_client_input(&idi);
 
-		if (ido2db_db_settings.use_transactions == IDO_TRUE && result == IDO_OK) {
+		if (result == IDO_OK) {
 			if (ido2db_db_tx_commit(&idi) != IDO_OK) {
 				syslog(LOG_ERR, "IDO2DB commit failed. Some data may have been lost.\n");
 			}





More information about the icinga-checkins mailing list