andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

Blame 0116-Ticket-47516-replication-stops-with-excessive-clock-.patch

dc8c34
From 950e31275f70141fdb195162ce8d7dc5cc3b169e Mon Sep 17 00:00:00 2001
dc8c34
From: Rich Megginson <rmeggins@redhat.com>
dc8c34
Date: Wed, 18 Sep 2013 12:32:23 -0600
dc8c34
Subject: [PATCH 116/225] Ticket #47516 replication stops with excessive clock
dc8c34
 skew
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47516
dc8c34
Reviewed by: nhosoi (Thanks!)
dc8c34
Branch: master
dc8c34
Fix Description: Add a new configuration parameter to cn=config
dc8c34
nsslapd-ignore-time-skew: on|off - default off
dc8c34
If nsslapd-ignore-time-skew: on, the replication consumer will log errors
dc8c34
about excessive time skew, but will allow replication to proceed, and will
dc8c34
not return a time skew error to the replication supplier.
dc8c34
Platforms tested: RHEL6 x86_64
dc8c34
Flag Day: no
dc8c34
Doc impact: yes - document new config param
dc8c34
(cherry picked from commit 9dc7a4630cb13f1da074183208b1b34962fe8101)
dc8c34
---
dc8c34
 ldap/servers/plugins/replication/repl_extop.c | 11 +++++++--
dc8c34
 ldap/servers/slapd/libglobs.c                 | 32 ++++++++++++++++++++++++++-
dc8c34
 ldap/servers/slapd/proto-slap.h               |  2 ++
dc8c34
 ldap/servers/slapd/slap.h                     |  2 ++
dc8c34
 4 files changed, 44 insertions(+), 3 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/plugins/replication/repl_extop.c b/ldap/servers/plugins/replication/repl_extop.c
dc8c34
index 37ee1ff..cccebb4 100644
dc8c34
--- a/ldap/servers/plugins/replication/repl_extop.c
dc8c34
+++ b/ldap/servers/plugins/replication/repl_extop.c
dc8c34
@@ -835,12 +835,19 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
dc8c34
 				rc = replica_update_csngen_state_ext (replica, supplier_ruv, replicacsn); /* too much skew */
dc8c34
 				if (rc == CSN_LIMIT_EXCEEDED)
dc8c34
 				{
dc8c34
-					response = NSDS50_REPL_EXCESSIVE_CLOCK_SKEW;
dc8c34
+					extern int config_get_ignore_time_skew();
dc8c34
+
dc8c34
 					slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
dc8c34
 									"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
dc8c34
 									"Excessive clock skew from supplier RUV\n",
dc8c34
 									connid, opid, repl_root);
dc8c34
-					goto send_response;
dc8c34
+					if (!config_get_ignore_time_skew()) {
dc8c34
+						response = NSDS50_REPL_EXCESSIVE_CLOCK_SKEW;
dc8c34
+						goto send_response;
dc8c34
+					} else {
dc8c34
+						/* else just continue */
dc8c34
+						rc = 0;
dc8c34
+					}
dc8c34
 				}
dc8c34
 				else if (rc != 0)
dc8c34
 				{
dc8c34
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
dc8c34
index aaee33a..930fd72 100644
dc8c34
--- a/ldap/servers/slapd/libglobs.c
dc8c34
+++ b/ldap/servers/slapd/libglobs.c
dc8c34
@@ -696,7 +696,11 @@ static struct config_get_and_set {
dc8c34
 	{CONFIG_LISTEN_BACKLOG_SIZE, config_set_listen_backlog_size,
dc8c34
 		NULL, 0,
dc8c34
 		(void**)&global_slapdFrontendConfig.listen_backlog_size, CONFIG_INT,
dc8c34
-		(ConfigGetFunc)config_get_listen_backlog_size}
dc8c34
+		(ConfigGetFunc)config_get_listen_backlog_size},
dc8c34
+	{CONFIG_IGNORE_TIME_SKEW, config_set_ignore_time_skew,
dc8c34
+		NULL, 0,
dc8c34
+		(void**)&global_slapdFrontendConfig.ignore_time_skew,
dc8c34
+		CONFIG_ON_OFF, (ConfigGetFunc)config_get_ignore_time_skew}
dc8c34
 #ifdef MEMPOOL_EXPERIMENTAL
dc8c34
 	,{CONFIG_MEMPOOL_SWITCH_ATTRIBUTE, config_set_mempool_switch,
dc8c34
 		NULL, 0,
dc8c34
@@ -1100,6 +1104,7 @@ FrontendConfig_init () {
dc8c34
   cfg->sasl_max_bufsize = SLAPD_DEFAULT_SASL_MAXBUFSIZE;
dc8c34
 
dc8c34
   cfg->listen_backlog_size = DAEMON_LISTEN_SIZE;
dc8c34
+  cfg->ignore_time_skew = LDAP_OFF;
dc8c34
 #ifdef MEMPOOL_EXPERIMENTAL
dc8c34
   cfg->mempool_switch = LDAP_ON;
dc8c34
   cfg->mempool_maxfreelist = 1024;
dc8c34
@@ -6215,6 +6220,31 @@ config_get_listen_backlog_size()
dc8c34
   return retVal; 
dc8c34
 }
dc8c34
 
dc8c34
+int
dc8c34
+config_get_ignore_time_skew(void)
dc8c34
+{
dc8c34
+    int retVal;
dc8c34
+    slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
dc8c34
+    CFG_LOCK_READ(slapdFrontendConfig);
dc8c34
+    retVal = slapdFrontendConfig->ignore_time_skew;
dc8c34
+    CFG_UNLOCK_READ(slapdFrontendConfig);
dc8c34
+
dc8c34
+    return retVal;
dc8c34
+}
dc8c34
+
dc8c34
+int
dc8c34
+config_set_ignore_time_skew( const char *attrname, char *value,
dc8c34
+                            char *errorbuf, int apply )
dc8c34
+{
dc8c34
+    int retVal = LDAP_SUCCESS;
dc8c34
+    slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
dc8c34
+
dc8c34
+    retVal = config_set_onoff(attrname, value,
dc8c34
+                              &(slapdFrontendConfig->ignore_time_skew),
dc8c34
+                              errorbuf, apply);
dc8c34
+    return retVal;
dc8c34
+}
dc8c34
+
dc8c34
 /*
dc8c34
  * This function is intended to be used from the dse code modify callback.  It
dc8c34
  * is "optimized" for that case because it takes a berval** of values, which is
dc8c34
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
dc8c34
index d4c9ab6..c87d2f2 100644
dc8c34
--- a/ldap/servers/slapd/proto-slap.h
dc8c34
+++ b/ldap/servers/slapd/proto-slap.h
dc8c34
@@ -392,6 +392,7 @@ int config_set_disk_logging_critical( const char *attrname, char *value, char *e
dc8c34
 int config_set_auditlog_unhashed_pw(const char *attrname, char *value, char *errorbuf, int apply);
dc8c34
 int config_set_sasl_maxbufsize(const char *attrname, char *value, char *errorbuf, int apply );
dc8c34
 int config_set_listen_backlog_size(const char *attrname, char *value, char *errorbuf, int apply);
dc8c34
+int config_set_ignore_time_skew(const char *attrname, char *value, char *errorbuf, int apply);
dc8c34
 
dc8c34
 #if !defined(_WIN32) && !defined(AIX)
dc8c34
 int config_set_maxdescriptors( const char *attrname, char *value, char *errorbuf, int apply );
dc8c34
@@ -548,6 +549,7 @@ int config_get_disk_grace_period();
dc8c34
 int config_get_disk_logging_critical();
dc8c34
 int config_get_sasl_maxbufsize();
dc8c34
 int config_get_listen_backlog_size(void);
dc8c34
+int config_get_ignore_time_skew();
dc8c34
 
dc8c34
 int is_abspath(const char *);
dc8c34
 char* rel2abspath( char * );
dc8c34
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
dc8c34
index eaa1fee..4724f27 100644
dc8c34
--- a/ldap/servers/slapd/slap.h
dc8c34
+++ b/ldap/servers/slapd/slap.h
dc8c34
@@ -2006,6 +2006,7 @@ typedef struct _slapdEntryPoints {
dc8c34
 #define CONFIG_DISK_LOGGING_CRITICAL "nsslapd-disk-monitoring-logging-critical"
dc8c34
 #define CONFIG_SASL_MAXBUFSIZE "nsslapd-sasl-max-buffer-size"
dc8c34
 #define CONFIG_LISTEN_BACKLOG_SIZE	"nsslapd-listen-backlog-size"
dc8c34
+#define CONFIG_IGNORE_TIME_SKEW "nsslapd-ignore-time-skew"
dc8c34
 
dc8c34
 /*
dc8c34
  * Define the backlog number for use in listen() call.
dc8c34
@@ -2250,6 +2251,7 @@ typedef struct _slapdFrontendConfig {
dc8c34
   PRUint64 disk_threshold;
dc8c34
   int disk_grace_period;
dc8c34
   int disk_logging_critical;
dc8c34
+  int ignore_time_skew;
dc8c34
 } slapdFrontendConfig_t;
dc8c34
 
dc8c34
 /* possible values for slapdFrontendConfig_t.schemareplace */
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34