[Fedora-directory-commits] ldapserver/ldap/servers/plugins/replication repl5.h, 1.13, 1.14 repl_globals.c, 1.7, 1.8 windows_inc_protocol.c, 1.18, 1.19 windows_private.c, 1.22, 1.23 windowsrepl.h, 1.17, 1.18

Richard Allen Megginson rmeggins at fedoraproject.org
Wed Jan 14 15:08:00 UTC 2009


Author: rmeggins

Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/replication
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv4430/ldapserver/ldap/servers/plugins/replication

Modified Files:
	repl5.h repl_globals.c windows_inc_protocol.c 
	windows_private.c windowsrepl.h 
Log Message:
Resolves: bug 222055
Bug Description: DirSync interval should be configurable
Reviewed by: nhosoi (Thanks!)
Fix Description: Added a new config attribute - winSyncInterval - this is how often to run the dirsync search, in seconds.  The default is 600 (5 minutes) which was the old hard coded value.  Due to the way it's coded, the change only takes effect when the agreement is created or restarted, so the value cannot really be dynamically changed.
Platforms tested: RHEL5
Flag Day: no
Doc impact: yes - document the new attribute



Index: repl5.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/repl5.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- repl5.h	4 Nov 2008 18:23:08 -0000	1.13
+++ repl5.h	14 Jan 2009 15:07:58 -0000	1.14
@@ -149,6 +149,7 @@
 extern const char *type_nsds7CreateNewGroups;
 extern const char *type_nsds7DirsyncCookie;
 extern const char *type_nsds7WindowsDomain;
+extern const char *type_winSyncInterval;
 /* To Allow Consumer Initialisation when adding an agreement - */
 extern const char *type_nsds5BeginReplicaRefresh;
 


Index: repl_globals.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/repl_globals.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- repl_globals.c	10 Nov 2006 23:45:17 -0000	1.7
+++ repl_globals.c	14 Jan 2009 15:07:58 -0000	1.8
@@ -126,13 +126,14 @@
 const char *type_nsds5ReplicaBusyWaitTime = "nsds5ReplicaBusyWaitTime";
 const char *type_nsds5ReplicaSessionPauseTime = "nsds5ReplicaSessionPauseTime";
 
-/* windows sync specifica attributes */
+/* windows sync specific attributes */
 const char *type_nsds7WindowsReplicaArea = "nsds7WindowsReplicaSubtree";
 const char *type_nsds7DirectoryReplicaArea = "nsds7DirectoryReplicaSubtree";
 const char *type_nsds7CreateNewUsers = "nsds7NewWinUserSyncEnabled";
 const char *type_nsds7CreateNewGroups = "nsds7NewWinGroupSyncEnabled";
 const char *type_nsds7WindowsDomain = "nsds7WindowsDomain";
 const char *type_nsds7DirsyncCookie = "nsds7DirsyncCookie";
+const char *type_winSyncInterval = "winSyncInterval";
 
 /* To Allow Consumer Initialisation when adding an agreement - */
 const char *type_nsds5BeginReplicaRefresh = "nsds5BeginReplicaRefresh";


Index: windows_inc_protocol.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/windows_inc_protocol.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- windows_inc_protocol.c	5 Dec 2008 22:41:52 -0000	1.18
+++ windows_inc_protocol.c	14 Jan 2009 15:07:58 -0000	1.19
@@ -128,11 +128,6 @@
  */
 #define MAX_WAIT_BETWEEN_SESSIONS PR_SecondsToInterval(60 * 5) /* 5 minutes */
 /*
- * Periodic synchronization interval.  This is used for scheduling the periodic_dirsync event.
- * The time is in milliseconds.
- */
-#define PERIODIC_DIRSYNC_INTERVAL 5 * 60 * 1000 /* DBDB this should probably be configurable. 5 mins fixed for now */
-/*
  * tests if the protocol has been shutdown and we need to quit
  * event_occurred resets the bits in the bit flag, so whoever tests for shutdown
  * resets the flags, so the next one who tests for shutdown won't get it, so we
@@ -345,12 +340,13 @@
 
 
 				if (is_first_start) {
+					unsigned long interval = windows_private_get_sync_interval(prp->agmt) * 1000;
 					/*
 					 * The function, the arguments, the time (hence) when it is first to be called, 
 					 * and the repeat interval. 
 					 */ 
 					/* DBDB: we should probably make this polling interval configurable */
-					dirsync = slapi_eq_repeat(periodic_dirsync, (void*) prp, (time_t)0 , PERIODIC_DIRSYNC_INTERVAL);
+					dirsync = slapi_eq_repeat(periodic_dirsync, (void*) prp, (time_t)0 , interval);
 					is_first_start = PR_FALSE;
 				}
 				break;


Index: windows_private.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/windows_private.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- windows_private.c	5 Dec 2008 22:41:52 -0000	1.22
+++ windows_private.c	14 Jan 2009 15:07:58 -0000	1.23
@@ -73,6 +73,7 @@
   Slapi_Filter *deleted_filter; /* Used for checking if an entry is an AD tombstone */
   Slapi_Entry *raw_entry; /* "raw" un-schema processed last entry read from AD */
   void *api_cookie; /* private data used by api callbacks */
+  time_t sync_interval; /* how often to run the dirsync search, in seconds */
 };
 
 static void windows_private_set_windows_domain(const Repl_Agmt *ra, char *domain);
@@ -153,6 +154,16 @@
 		tmpstr = NULL;
 		retval = 1;
 	}
+	if (type == NULL || slapi_attr_types_equivalent(type,type_winSyncInterval))
+	{
+		tmpstr = slapi_entry_attr_get_charptr(e, type_winSyncInterval); 
+		if (NULL != tmpstr)
+		{
+			windows_private_set_sync_interval(ra,tmpstr);
+		}
+		slapi_ch_free_string(&tmpstr);
+		retval = 1;
+	}
 	return retval;
 }
 
@@ -203,6 +214,7 @@
 	dp->dirsync_maxattributecount = -1;
 	dp->directory_filter = NULL;
 	dp->deleted_filter = NULL;
+	dp->sync_interval = PERIODIC_DIRSYNC_INTERVAL;
 
 	LDAPDebug0Args( LDAP_DEBUG_TRACE, "<= windows_private_new\n" );
 	return dp;
@@ -866,6 +878,43 @@
 	LDAPDebug0Args( LDAP_DEBUG_TRACE, "<= windows_private_set_api_cookie\n" );
 }
 
+time_t
+windows_private_get_sync_interval(const Repl_Agmt *ra)
+{
+	Dirsync_Private *dp;
+
+	LDAPDebug0Args( LDAP_DEBUG_TRACE, "=> windows_private_get_sync_interval\n" );
+
+	PR_ASSERT(ra);
+
+	dp = (Dirsync_Private *) agmt_get_priv(ra);
+	PR_ASSERT (dp);
+
+	LDAPDebug0Args( LDAP_DEBUG_TRACE, "<= windows_private_get_sync_interval\n" );
+
+	return dp->sync_interval;	
+}
+
+void
+windows_private_set_sync_interval(Repl_Agmt *ra, char *str)
+{
+	Dirsync_Private *dp;
+	time_t tmpval = 0;
+
+	LDAPDebug0Args( LDAP_DEBUG_TRACE, "=> windows_private_set_sync_interval\n" );
+
+	PR_ASSERT(ra);
+
+	dp = (Dirsync_Private *) agmt_get_priv(ra);
+	PR_ASSERT (dp);
+
+	if (str && (tmpval = (time_t)atol(str))) {
+		dp->sync_interval = tmpval;
+	}
+
+	LDAPDebug0Args( LDAP_DEBUG_TRACE, "<= windows_private_set_sync_interval\n" );
+}
+
 /* an array of function pointers */
 static void **_WinSyncAPI = NULL;
 


Index: windowsrepl.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/windowsrepl.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- windowsrepl.h	23 Sep 2008 21:13:22 -0000	1.17
+++ windowsrepl.h	14 Jan 2009 15:07:58 -0000	1.18
@@ -80,6 +80,8 @@
 void windows_private_set_raw_entry(const Repl_Agmt *ra, Slapi_Entry *e);
 void *windows_private_get_api_cookie(const Repl_Agmt *ra);
 void windows_private_set_api_cookie(Repl_Agmt *ra, void *cookie);
+time_t windows_private_get_sync_interval(const Repl_Agmt *ra);
+void windows_private_set_sync_interval(Repl_Agmt *ra, char *str);
 
 /* in windows_connection.c */
 ConnResult windows_conn_connect(Repl_Connection *conn);
@@ -122,6 +124,12 @@
 #define NTUNIQUEID_LENGTH 32
 #define AD_GUID_LENGTH 36
 
+/*
+ * Periodic synchronization interval.  This is used for scheduling the periodic_dirsync event.
+ * The time is in seconds.
+ */
+#define PERIODIC_DIRSYNC_INTERVAL 5 * 60 /* default value is 5 minutes */
+
 /* called for each replication agreement - so the winsync
    plugin can be agreement specific and store agreement
    specific data




More information about the Fedora-directory-commits mailing list