[icinga-checkins] icinga.org: icinga-core/rbartels/html-cleanup: ido2db: add enable_socket_queue and add shroud's sauce opt-in
git at icinga.org
git at icinga.org
Thu Feb 7 01:23:54 CET 2013
Module: icinga-core
Branch: rbartels/html-cleanup
Commit: 0d4949b15aa769499bad226ca916779f53dc30e3
URL: https://git.icinga.org/?p=icinga-core.git;a=commit;h=0d4949b15aa769499bad226ca916779f53dc30e3
Author: Michael Friedrich <michael.friedrich at netways.de>
Date: Wed Jan 16 21:13:32 2013 +0100
ido2db: add enable_socket_queue and add shroud's sauce opt-in
refs #3533
---
module/idoutils/config/ido2db.cfg-sample.in | 13 +++++++++++
module/idoutils/src/ido2db.c | 30 ++++++++++++++++----------
2 files changed, 31 insertions(+), 12 deletions(-)
diff --git a/module/idoutils/config/ido2db.cfg-sample.in b/module/idoutils/config/ido2db.cfg-sample.in
index 03ec80f..d5ec9f5 100644
--- a/module/idoutils/config/ido2db.cfg-sample.in
+++ b/module/idoutils/config/ido2db.cfg-sample.in
@@ -352,3 +352,16 @@ oracle_trace_level=0
# occur, remark that you are explicitely using it. You've been warned.
enable_sla=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/src/ido2db.c b/module/idoutils/src/ido2db.c
index 8e257e9..1211e1a 100644
--- a/module/idoutils/src/ido2db.c
+++ b/module/idoutils/src/ido2db.c
@@ -87,6 +87,8 @@ 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;
@@ -611,7 +613,9 @@ 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, "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)
return IDO_ERROR;
@@ -1256,20 +1260,22 @@ 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 (socketpair(AF_UNIX, SOCK_STREAM, PF_UNIX, fds) == 0) {
- pthread_t tid;
+ if (enable_socket_queue == IDO_TRUE) {
+ 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]);
+ }
}
}
More information about the icinga-checkins
mailing list