[Ultrapossum-cvs 1116] plugin/slapd/upstream 1.4, 1.5, syncbackup-2.2.18.patch

Back to archive index

Masato Taruishi taru****@users*****
2004年 11月 4日 (木) 14:45:13 JST


===================================================================
RCS file: plugin/slapd/upstream/syncbackup-2.2.18.patch,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- plugin/slapd/upstream/syncbackup-2.2.18.patch	2004/11/02 03:31:41	1.4
+++ plugin/slapd/upstream/syncbackup-2.2.18.patch	2004/11/04 05:45:12	1.5
@@ -2,16 +2,16 @@
 ===================================================================
 RCS file: /cvsroot/openldap-ha/build-tree/openldap-2.2.18/build/version.var,v
 retrieving revision 1.1.1.1
-retrieving revision 1.4
-diff -u -r1.1.1.1 -r1.4
+retrieving revision 1.5
+diff -u -r1.1.1.1 -r1.5
 --- openldap-2.2.18/build/version.var	26 Oct 2004 10:14:56 -0000	1.1.1.1
-+++ openldap-2.2.18/build/version.var	1 Nov 2004 13:30:29 -0000	1.4
++++ openldap-2.2.18/build/version.var	4 Nov 2004 04:37:10 -0000	1.5
 @@ -15,7 +15,7 @@
  ol_package=OpenLDAP
  ol_major=2
  ol_minor=2
 -ol_patch=18
-+ol_patch=18sb3
++ol_patch=18sb4
  ol_api_inc=20218
  ol_api_current=7
  ol_api_revision=11
@@ -83,10 +83,10 @@
 ===================================================================
 RCS file: /cvsroot/openldap-ha/build-tree/openldap-2.2.18/servers/slapd/add.c,v
 retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -r1.1.1.1 -r1.2
+retrieving revision 1.3
+diff -u -r1.1.1.1 -r1.3
 --- openldap-2.2.18/servers/slapd/add.c	26 Oct 2004 10:15:06 -0000	1.1.1.1
-+++ openldap-2.2.18/servers/slapd/add.c	26 Oct 2004 10:26:09 -0000	1.2
++++ openldap-2.2.18/servers/slapd/add.c	2 Nov 2004 19:39:01 -0000	1.3
 @@ -33,6 +33,10 @@
  #include "ldap_pvt.h"
  #include "slap.h"
@@ -98,7 +98,20 @@
  #ifdef LDAP_SLAPI
  #include "slapi/slapi.h"
  
-@@ -254,8 +258,12 @@
+@@ -244,6 +248,12 @@
+ 	if ( op->o_pb ) init_add_pblock( op, &dn, e, manageDSAit );
+ #endif /* LDAP_SLAPI */
+ 
++#ifdef LDAP_SYNCBACKUP
++	if ( op->o_bd->syncbackupinfo ) {
++        	ldap_pvt_thread_mutex_lock(&op->o_bd->syncbackupinfo->syncbackup_mutex);
++	}
++#endif
++
+ 	/*
+ 	 * do the add if 1 && (2 || 3)
+ 	 * 1) there is an add function implemented in this backend;
+@@ -254,8 +264,12 @@
  		/* do the update here */
  		int repl_user = be_isupdate( op );
  #ifndef SLAPD_MULTIMASTER
@@ -111,7 +124,7 @@
  		{
  			int update = op->o_bd->be_update_ndn.bv_len;
  			char textbuf[SLAP_TEXT_BUFLEN];
-@@ -285,7 +293,13 @@
+@@ -285,7 +299,14 @@
  					goto done;
  				}
  			}
@@ -120,13 +133,14 @@
 +			if ( SLAP_BACKUP_SHADOW(op->o_bd) ) {
 +				struct berval csn = { 0, NULL };
 +				char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
++				
 +				slap_get_csn ( op, csnbuf, sizeof(csnbuf), &csn, 1 );
 +			}
 +#endif
  			rs->sr_err = slap_mods2entry( modlist, &e, repl_user, 0,
  				&rs->sr_text, textbuf, textlen );
  			if( rs->sr_err != LDAP_SUCCESS ) {
-@@ -309,7 +323,11 @@
+@@ -309,7 +330,11 @@
  
  			op->ora_e = e;
  #ifdef SLAPD_MULTIMASTER
@@ -139,6 +153,18 @@
  #endif
  			{
  				cb.sc_next = op->o_callback;
+@@ -385,6 +410,11 @@
+ done:
+ 	slap_graduate_commit_csn( op );
+ 
++#ifdef LDAP_SYNCBACKUP
++	if ( op->o_bd->syncbackupinfo ) {
++        	ldap_pvt_thread_mutex_unlock(&op->o_bd->syncbackupinfo->syncbackup_mutex);
++	}
++#endif
+ 	if( modlist != NULL ) {
+ 		slap_mods_free( modlist );
+ 	}
 Index: openldap-2.2.18/servers/slapd/backend.c
 ===================================================================
 RCS file: /cvsroot/openldap-ha/build-tree/openldap-2.2.18/servers/slapd/backend.c,v
@@ -817,11 +843,11 @@
 ===================================================================
 RCS file: /cvsroot/openldap-ha/build-tree/openldap-2.2.18/servers/slapd/connection.c,v
 retrieving revision 1.1.1.1
-retrieving revision 1.3
-diff -u -r1.1.1.1 -r1.3
+retrieving revision 1.4
+diff -u -r1.1.1.1 -r1.4
 --- openldap-2.2.18/servers/slapd/connection.c	26 Oct 2004 10:15:06 -0000	1.1.1.1
-+++ openldap-2.2.18/servers/slapd/connection.c	30 Oct 2004 19:20:19 -0000	1.3
-@@ -1164,6 +1164,19 @@
++++ openldap-2.2.18/servers/slapd/connection.c	2 Nov 2004 16:10:32 -0000	1.4
+@@ -1164,6 +1164,18 @@
  		conn->c_n_ops_executing--;
  		conn->c_n_ops_completed++;
  
@@ -831,7 +857,6 @@
 +		LDAP_STAILQ_NEXT(op, o_next) = NULL;
 +		conn->c_n_ops_executing--;
 +		conn->c_n_ops_completed++;
-+		fprintf(stderr, "startsync: %d\n", rc );
 +		if( rc == SLAPD_ABANDON ) {
 +			sl_mem_detach( ctx, memctx );
 +		} else {
@@ -965,11 +990,24 @@
 ===================================================================
 RCS file: /cvsroot/openldap-ha/build-tree/openldap-2.2.18/servers/slapd/delete.c,v
 retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -r1.1.1.1 -r1.2
+retrieving revision 1.3
+diff -u -r1.1.1.1 -r1.3
 --- openldap-2.2.18/servers/slapd/delete.c	26 Oct 2004 10:15:06 -0000	1.1.1.1
-+++ openldap-2.2.18/servers/slapd/delete.c	26 Oct 2004 10:26:09 -0000	1.2
-@@ -207,20 +207,33 @@
++++ openldap-2.2.18/servers/slapd/delete.c	2 Nov 2004 19:39:01 -0000	1.3
+@@ -197,6 +197,12 @@
+ 	}
+ #endif /* defined( LDAP_SLAPI ) */
+ 
++#ifdef LDAP_SYNCBACKUP
++	if ( op->o_bd->syncbackupinfo ) {
++		ldap_pvt_thread_mutex_lock(&op->o_bd->syncbackupinfo->syncbackup_mutex);
++	}
++#endif
++
+ 	/*
+ 	 * do the delete if 1 && (2 || 3)
+ 	 * 1) there is a delete function implemented in this backend;
+@@ -207,20 +213,33 @@
  		/* do the update here */
  		int repl_user = be_isupdate( op );
  #ifndef SLAPD_MULTIMASTER
@@ -1005,6 +1043,19 @@
  #endif
  			{
  				cb.sc_next = op->o_callback;
+@@ -305,6 +324,12 @@
+ 
+ 	slap_graduate_commit_csn( op );
+ 
++#ifdef LDAP_SYNCBACKUP
++	if ( op->o_bd->syncbackupinfo ) {
++		ldap_pvt_thread_mutex_unlock(&op->o_bd->syncbackupinfo->syncbackup_mutex);
++	}
++#endif
++
+ 	op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
+ 	op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
+ 	return rs->sr_err;
 Index: openldap-2.2.18/servers/slapd/extended.c
 ===================================================================
 RCS file: /cvsroot/openldap-ha/build-tree/openldap-2.2.18/servers/slapd/extended.c,v
@@ -1037,11 +1088,24 @@
 ===================================================================
 RCS file: /cvsroot/openldap-ha/build-tree/openldap-2.2.18/servers/slapd/modify.c,v
 retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -r1.1.1.1 -r1.2
+retrieving revision 1.3
+diff -u -r1.1.1.1 -r1.3
 --- openldap-2.2.18/servers/slapd/modify.c	26 Oct 2004 10:15:07 -0000	1.1.1.1
-+++ openldap-2.2.18/servers/slapd/modify.c	26 Oct 2004 10:26:09 -0000	1.2
-@@ -462,8 +462,13 @@
++++ openldap-2.2.18/servers/slapd/modify.c	2 Nov 2004 19:39:01 -0000	1.3
+@@ -448,6 +448,12 @@
+ 	 */
+ #endif /* defined( LDAP_SLAPI ) */
+ 
++#ifdef LDAP_SYNCBACKUP
++	if ( op->o_bd->syncbackupinfo ) {
++		ldap_pvt_thread_mutex_lock(&op->o_bd->syncbackupinfo->syncbackup_mutex);
++	}
++#endif
++
+ 	/*
+ 	 * do the modify if 1 && (2 || 3)
+ 	 * 1) there is a modify function implemented in this backend;
+@@ -462,8 +468,13 @@
  		 * because it accepts each modify request
  		 */
  #ifndef SLAPD_MULTIMASTER
@@ -1055,7 +1119,7 @@
  		{
  			int update = op->o_bd->be_update_ndn.bv_len;
  			char textbuf[SLAP_TEXT_BUFLEN];
-@@ -494,9 +499,20 @@
+@@ -494,9 +505,20 @@
  				}
  			}
  
@@ -1077,15 +1141,41 @@
  #endif
  			{
  				/* but we log only the ones not from a replicator user */
+@@ -548,6 +570,12 @@
+ cleanup:
+ 	slap_graduate_commit_csn( op );
+ 
++#ifdef LDAP_SYNCBACKUP
++	if ( op->o_bd->syncbackupinfo ) {
++		ldap_pvt_thread_mutex_unlock(&op->o_bd->syncbackupinfo->syncbackup_mutex);
++	}
++#endif
++
+ 	op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
+ 	op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
+ 	if ( modlist != NULL ) slap_mods_free( modlist );
 Index: openldap-2.2.18/servers/slapd/modrdn.c
 ===================================================================
 RCS file: /cvsroot/openldap-ha/build-tree/openldap-2.2.18/servers/slapd/modrdn.c,v
 retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -r1.1.1.1 -r1.2
+retrieving revision 1.3
+diff -u -r1.1.1.1 -r1.3
 --- openldap-2.2.18/servers/slapd/modrdn.c	26 Oct 2004 10:15:07 -0000	1.1.1.1
-+++ openldap-2.2.18/servers/slapd/modrdn.c	26 Oct 2004 10:26:09 -0000	1.2
-@@ -364,13 +364,22 @@
++++ openldap-2.2.18/servers/slapd/modrdn.c	2 Nov 2004 19:39:01 -0000	1.3
+@@ -354,6 +354,12 @@
+ 	}
+ #endif /* defined( LDAP_SLAPI ) */
+ 
++#ifdef LDAP_SYNCBACKUP
++	if ( op->o_bd->syncbackupinfo ) {
++		ldap_pvt_thread_mutex_lock(&op->o_bd->syncbackupinfo->syncbackup_mutex);
++	}
++#endif
++
+ 	/*
+ 	 * do the modrdn if 1 && (2 || 3)
+ 	 * 1) there is a modrdn function implemented in this backend;
+@@ -364,13 +370,22 @@
  		/* do the update here */
  		int repl_user = be_isupdate( op );
  #ifndef SLAPD_MULTIMASTER
@@ -1109,7 +1199,20 @@
  #endif
  			{
  				cb.sc_next = op->o_callback;
-@@ -619,7 +628,11 @@
+@@ -452,6 +467,12 @@
+ 
+ 	slap_graduate_commit_csn( op );
+ 
++#ifdef LDAP_SYNCBACKUP
++	if ( op->o_bd->syncbackupinfo ) {
++		ldap_pvt_thread_mutex_unlock(&op->o_bd->syncbackupinfo->syncbackup_mutex);
++	}
++#endif
++
+ 	op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
+ 	op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
+ 
+@@ -619,7 +640,11 @@
  	
  done:
  
@@ -1189,11 +1292,11 @@
 ===================================================================
 RCS file: /cvsroot/openldap-ha/build-tree/openldap-2.2.18/servers/slapd/slap.h,v
 retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -r1.1.1.1 -r1.2
+retrieving revision 1.4
+diff -u -r1.1.1.1 -r1.4
 --- openldap-2.2.18/servers/slapd/slap.h	26 Oct 2004 10:15:09 -0000	1.1.1.1
-+++ openldap-2.2.18/servers/slapd/slap.h	26 Oct 2004 10:26:09 -0000	1.2
-@@ -1410,8 +1410,143 @@
++++ openldap-2.2.18/servers/slapd/slap.h	2 Nov 2004 16:10:32 -0000	1.4
+@@ -1410,8 +1410,144 @@
  		LDAP				*si_ld;
  		LDAP_LIST_HEAD(np, nonpresent_entry) si_nonpresentlist;
  		LDAP_STAILQ_ENTRY( syncinfo_s ) si_next;
@@ -1261,7 +1364,6 @@
 +	unsigned long opid;
 +	unsigned long connid;
 +
-+	// TODO: allow another bind method
 +	struct ri *ri;
 +	char *syncid;
 +
@@ -1319,6 +1421,8 @@
 +
 +	BackendDB *sb_bd;
 +
++	ldap_pvt_thread_mutex_t syncbackup_mutex;
++
 +	struct berval *init_cookie;
 +        int num_atleast_result;
 +	syncbackup_table_t backup_tbl;
@@ -1337,7 +1441,7 @@
  LDAP_TAILQ_HEAD( be_pcl, slap_csn_entry );
  
  struct slap_backend_db {
-@@ -1479,6 +1614,9 @@
+@@ -1479,6 +1615,9 @@
  #define SLAP_DBFLAG_SHADOW		0x8000U /* a shadow */
  #define SLAP_DBFLAG_SYNC_SHADOW		0x1000U /* a sync shadow */
  #define SLAP_DBFLAG_SLURP_SHADOW	0x2000U /* a slurp shadow */
@@ -1347,7 +1451,7 @@
  	slap_mask_t	be_flags;
  #define SLAP_DBFLAGS(be)			((be)->be_flags)
  #define SLAP_NOLASTMOD(be)			(SLAP_DBFLAGS(be) & SLAP_DBFLAG_NOLASTMOD)
-@@ -1494,7 +1632,9 @@
+@@ -1494,7 +1633,9 @@
  #define SLAP_SHADOW(be)				(SLAP_DBFLAGS(be) & SLAP_DBFLAG_SHADOW)
  #define SLAP_SYNC_SHADOW(be)			(SLAP_DBFLAGS(be) & SLAP_DBFLAG_SYNC_SHADOW)
  #define SLAP_SLURP_SHADOW(be)			(SLAP_DBFLAGS(be) & SLAP_DBFLAG_SLURP_SHADOW)
@@ -1358,7 +1462,7 @@
  	slap_mask_t	be_restrictops;		/* restriction operations */
  #define SLAP_RESTRICT_OP_ADD		0x0001U
  #define	SLAP_RESTRICT_OP_BIND		0x0002U
-@@ -1558,6 +1698,9 @@
+@@ -1558,6 +1699,9 @@
  	struct slap_replica_info **be_replica;	/* replicas of this backend (in master)	*/
  	char	*be_replogfile;	/* replication log file (in master)	   */
  	struct berval be_update_ndn;	/* allowed to make changes (in replicas) */
@@ -1368,7 +1472,7 @@
  	BerVarray	be_update_refs;	/* where to refer modifying clients to */
  	struct		be_pcl	*be_pending_csn_list;
  	ldap_pvt_thread_mutex_t					be_pcl_mutex;
-@@ -1565,7 +1708,10 @@
+@@ -1565,7 +1709,10 @@
  	struct berval							be_context_csn;
  	ldap_pvt_thread_mutex_t					be_context_csn_mutex;
  	LDAP_STAILQ_HEAD( be_si, syncinfo_s )	be_syncinfo; /* For syncrepl */
@@ -1380,7 +1484,7 @@
  	char	*be_realm;
  	void    *be_pb;         /* Netscape plugin */
  
-@@ -2156,6 +2302,12 @@
+@@ -2156,6 +2303,12 @@
  	int o_nocaching;
  	int	o_delete_glue_parent;
  
@@ -1750,8 +1854,8 @@
 RCS file: openldap-2.2.18/servers/slapd/syncbackup.c
 diff -N openldap-2.2.18/servers/slapd/syncbackup.c
 --- /dev/null	1 Jan 1970 00:00:00 -0000
-+++ openldap-2.2.18/servers/slapd/syncbackup.c	2 Nov 2004 01:26:44 -0000	1.3
-@@ -0,0 +1,2791 @@
++++ openldap-2.2.18/servers/slapd/syncbackup.c	4 Nov 2004 04:26:13 -0000	1.9
+@@ -0,0 +1,2818 @@
 +/* $OpenLDAP:$ */
 +/*
 + * Synchronized Backup Engine
@@ -1847,7 +1951,7 @@
 +
 +#define WAITLIMIT 30
 +
-+volatile sig_atomic_t slapd_abrupt_shutdown;
++volatile sig_atomic_t slapd_shutdown;
 +
 +/* Prototypes */
 +
@@ -1872,7 +1976,6 @@
 +static int backup_call_cb( syncbackupinfo_t *info, int id, int rc, char *err, int severity );
 +static int is_backup_op_avail( syncbackupinfo_t *info, int id );
 +static int is_backup_avail( syncbackupinfo_t *info, int id );
-+static int is_backup_age( syncbackupinfo_t *info, int id, int age );
 +static int is_sync_backup( syncbackupinfo_t *info, int id );
 +
 +/* propagation management/operation */
@@ -1942,6 +2045,7 @@
 +
 +	info->num_sync_backups = 0;
 +	ldap_pvt_thread_mutex_init( &info->num_sync_backups_mutex );
++	ldap_pvt_thread_mutex_init( &info->syncbackup_mutex );
 +	info->sb_backups = NULL;
 +	info->ages = NULL;
 +
@@ -1967,6 +2071,7 @@
 +void
 +syncbackupinfo_destroy(syncbackupinfo_t *info)
 +{
++	ldap_pvt_thread_mutex_destroy ( &info->syncbackup_mutex );
 +	ldap_pvt_thread_mutex_destroy ( &info->num_sync_backups_mutex );
 +	ch_free ( info->ages );
 +	ldap_pvt_thread_mutex_destroy ( &info->backup_tbl.backup_avail_mutex );
@@ -2353,6 +2458,7 @@
 +	SlapReply *rs
 +)
 +{
++	struct slap_csn_entry *csne = NULL;
 +	int i, rc, num_rc = 0;
 +	LDAPMod **mods;
 +	BackendDB *be = op->o_bd;
@@ -2365,7 +2471,7 @@
 +	if( info == NULL || op->o_backup == 0 ) {
 +		return LDAP_SUCCESS;
 +	}
-+	
++
 +#ifdef NEW_LOGGING
 +	LDAP_LOG ( OPERATION, DETAIL1, "syncbackup\n", 0, 0, 0);
 +#else
@@ -2484,9 +2590,9 @@
 +		info->sb_backups[i]->time = slap_get_time();
 +				
 +#ifdef NEW_LOGGING
-+		LDAP_LOG ( OPERATION, DETAIL1, "syncbackup: propagation done id=%s, msgid(%d)\n", info->sb_backups[i]->syncid, info->sb_backups[i]->msgid, 0 );
++		LDAP_LOG ( OPERATION, DETAIL1, "syncbackup: propagation done id=%s, msgid(%d) latest_time(%d)\n", info->sb_backups[i]->syncid, info->sb_backups[i]->msgid, 0 );
 +#else
-+		Debug ( LDAP_DEBUG_TRACE, "syncbackup: propagation done id=%s, msgid(%d) \n", info->sb_backups[i]->syncid, info->sb_backups[i]->msgid, 0 );
++		Debug ( LDAP_DEBUG_TRACE, "syncbackup: propagation done id=%s, msgid(%d) latest_time(%d)\n", info->sb_backups[i]->syncid, info->sb_backups[i]->msgid, info->sb_backups[i]->time );
 +#endif
 +	}
 +
@@ -2510,6 +2616,13 @@
 +		return rc;
 +	}
 +
++#ifdef NO_THREADS
++	ldap_pvt_thread_mutex_lock( &info->follow_mutex );
++	if ( ldap_pvt_thread_pool_backload( &info->follow_pool ) == 0 )
++		ldap_pvt_thread_pool_submit( &info->follow_pool, follow, be );
++	ldap_pvt_thread_mutex_unlock( &info->follow_mutex );
++#endif
++
 +#ifdef NEW_LOGGING
 +	LDAP_LOG ( OPERATION, DETAIL1, "syncbackup\n", 0, 0, 0);
 +#else
@@ -2794,10 +2907,10 @@
 +#endif
 +						op = info->sb_backups[i]->op;
 +						Statslog( LDAP_DEBUG_STATS, 
-+							"conn=%lu op=%lu BACKUP BIND backup=\"%s\" latency=%d\n",
++							"conn=%lu op=%lu BACKUP BIND backup=\"%s\" \n",
 +							op->o_conn->c_connid, op->o_opid, 
-+							info->sb_backups[i]->syncid, history_backup_latency( be, i ),
-+							0 );
++							info->sb_backups[i]->syncid,
++							0, 0 );
 +					} else {
 +						backup_call_cb ( info, i, rc, "bind error", SYNC_ERROR );
 +						detach_backup( be, i );
@@ -2869,11 +2982,13 @@
 +			stime = stime1;
 +		}
 +
-+	} while(f > 0 && ! slapd_abrupt_shutdown );
++	} while(f > 0 && ! slapd_shutdown );
 +
++#ifndef NO_THREADS
 +	ldap_pvt_thread_mutex_lock(&info->backup_tbl.backup_avail_mutex);
 +	ldap_pvt_thread_cond_signal( &info->backup_tbl.backup_avail_cv );
 +	ldap_pvt_thread_mutex_unlock(&info->backup_tbl.backup_avail_mutex);
++#endif
 +
 +	num_gc = consider_history_gc( info );
 +
@@ -3432,13 +3547,13 @@
 +	int num_rc = 0, i, rc, j, waittime;
 +	BackendDB *be = op->o_bd;
 +	syncbackupinfo_t *info = be->syncbackupinfo;
-+	long tlimit = op->o_time + WAITLIMIT;
++	long tlimit = ev->time + WAITLIMIT;
 +	event_t *sync_point;
 +
 +#ifdef NEW_LOGGING
 +	LDAP_LOG ( OPERATION, DETAIL1, "wait_sync_result\n", 0, 0, 0);
 +#else
-+	Debug ( LDAP_DEBUG_TRACE, "=>wait_sync_result\n", 0, 0, 0);
++	Debug ( LDAP_DEBUG_TRACE, "=>wait_sync_result: dn: %s, id: %d, tlimit: %d\n", op->o_req_dn.bv_val, op->o_opid, tlimit);
 +#endif
 +
 +	for(waittime=30; num_rc < num_backups; ) {
@@ -3568,6 +3683,16 @@
 +#else
 +	Debug ( LDAP_DEBUG_TRACE, "=>join_syncbackup\n", 0, 0, 0);
 +#endif
++
++#ifdef NO_THREADS
++	if(info->backup_tbl.num_backups == 0) {
++		ldap_pvt_thread_mutex_lock( &info->follow_mutex );
++		if ( ldap_pvt_thread_pool_backload( &info->follow_pool ) == 0 )
++		ldap_pvt_thread_pool_submit( &info->follow_pool, follow, be );
++		ldap_pvt_thread_mutex_unlock( &info->follow_mutex );
++	}
++#endif
++
 +	waittime = 30;
 +	do {
 +
@@ -4316,7 +4441,7 @@
 +{
 +	int i, j;
 +	syncbackupinfo_t *info = be->syncbackupinfo;
-+	syncinfo_t si;
++	syncinfo_t *si;
 +
 +	/*
 +	 * we use thread to invoke do_syncrepl because there is
@@ -4341,18 +4466,21 @@
 +	}
 +
 +	for ( i=0; i < info->backup_tbl.num_max_backups; i++ ) {
-+		memset(&si, 0, sizeof(syncinfo_t));
-+		replica2syncinfo(info->sb_backups[i]->ri, &si);
-+       	        ber_dupbv( &si.si_base, &be->be_suffix[0] );
-+		si.si_be = be;
-+		ber_dupbv( &si.si_updatedn, &be->be_rootndn );
++		si = (syncinfo_t *)ch_malloc(sizeof(syncinfo_t));
++		memset(si, 0, sizeof(syncinfo_t));
++		replica2syncinfo(info->sb_backups[i]->ri, si);
++       	        ber_dupbv( &si->si_base, &be->be_suffix[0] );
++		si->si_be = be;
++		ber_dupbv( &si->si_updatedn, &be->be_rootndn );
 +
-+		rtask.arg = &si;
++		rtask.arg = si;
 +
 +		ldap_pvt_thread_pool_init(&boot_syncrepl_pool, 1, 0);
 +		ldap_pvt_thread_pool_submit(&boot_syncrepl_pool, do_syncrepl, &rtask);
 +		ldap_pvt_thread_pool_destroy(&boot_syncrepl_pool, 1 );
 +
++		syncinfo_free( si );
++#if 0
 +		ch_free( si.si_base.bv_val );
 +		ch_free( si.si_updatedn.bv_val );
 +		ch_free( si.si_provideruri );
@@ -4361,6 +4489,8 @@
 +        		ch_free( si.si_attrs[j] );
 +		for ( j = 0; si.si_exattrs[j] != NULL; j++ )
 +        		ch_free( si.si_exattrs[j] );
++#endif
++
 +	}
 +
 +#ifdef NEW_LOGGING
@@ -4385,21 +4515,21 @@
 +	si->si_provideruri = (char *)ch_malloc(len + 1);
 +
 +	sprintf(si->si_provideruri, "ldap://%s:%d", ri->ri_hostname, ri->ri_port);
-+	si->si_binddn = ri->ri_bind_dn;
-+	si->si_passwd = ri->ri_password;
-+	si->si_syncid = ri->ri_syncid;
++	if( ri->ri_bind_dn ) si->si_binddn = ch_strdup( ri->ri_bind_dn );
++	if( ri->ri_password ) si->si_passwd = ch_strdup( ri->ri_password );
++	if( ri->ri_syncid ) si->si_syncid = ch_strdup( ri->ri_syncid );
 +
 +	si->si_tls = ri->ri_tls;
 +
 +	si->si_bindmethod = ri->ri_bind_method;
-+	si->si_saslmech = ri->ri_saslmech;
-+	si->si_secprops = ri->ri_secprops;
-+	si->si_realm = ri->ri_realm;
-+	si->si_authcId = ri->ri_authcId;
-+	si->si_authzId = ri->ri_authzId;
++	if( ri->ri_saslmech ) si->si_saslmech = ch_strdup( ri->ri_saslmech );
++	if( ri->ri_secprops ) si->si_secprops = ch_strdup( ri->ri_secprops );
++	if( ri->ri_realm ) si->si_realm = ch_strdup( ri->ri_realm );
++	if( ri->ri_authcId ) si->si_authcId = ch_strdup( ri->ri_authcId );
++	if( ri->ri_authzId ) si->si_authzId = ch_strdup( ri->ri_authzId );
 +
 +	si->si_rid = 0;
-+	ber_str2bv( "(objectclass=*)", sizeof("(objectclass=*)")-1, 0,
++	ber_str2bv( "(objectclass=*)", sizeof("(objectclass=*)")-1, 1,
 +		&si->si_filterstr );
 +	si->si_scope = LDAP_SCOPE_SUBTREE;
 +        si->si_attrsonly = 0;
@@ -4535,6 +4665,7 @@
 +				ch_free(mods[i]->mod_bvalues[j]->bv_val);
 +				ch_free(mods[i]->mod_bvalues[j]);
 +			}
++			ch_free(mods[i]->mod_bvalues);
 +			ch_free(mods[i]);
 +		}
 +	}
@@ -4828,11 +4959,21 @@
 ===================================================================
 RCS file: /cvsroot/openldap-ha/build-tree/openldap-2.2.18/servers/slapd/back-bdb/add.c,v
 retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -r1.1.1.1 -r1.2
+retrieving revision 1.4
+diff -u -r1.1.1.1 -r1.4
 --- openldap-2.2.18/servers/slapd/back-bdb/add.c	26 Oct 2004 10:15:10 -0000	1.1.1.1
-+++ openldap-2.2.18/servers/slapd/back-bdb/add.c	26 Oct 2004 10:26:09 -0000	1.2
-@@ -411,6 +411,16 @@
++++ openldap-2.2.18/servers/slapd/back-bdb/add.c	2 Nov 2004 16:10:56 -0000	1.4
+@@ -42,6 +42,9 @@
+ 	DB_LOCK		lock;
+ 
+ 	int		num_retries = 0;
++#ifdef LDAP_SYNCBACKUP
++	int		did_syncbackup = 0;
++#endif
+ 
+ 	Operation* ps_list;
+ 	int		rc;
+@@ -411,6 +414,20 @@
  		goto return_results;
  	}
  
@@ -4842,14 +4983,18 @@
 +	 *   after bdb_index_entry_add(), bdb_idl_insert_key() will 
 +	 *   sometimes fail by DB->cusror failure.
 +	 * */
-+	if( ( rs->sr_err = syncbackup(op, rs) ) != LDAP_SUCCESS ) {
-+		goto return_results;
++	if( ! did_syncbackup ) {
++		rs->sr_err = syncbackup(op, rs);
++		if ( rs->sr_err != LDAP_SUCCESS ) {
++			goto return_results;
++		}
++		did_syncbackup = 1;
 +	}
 +#endif
  	/* attribute indexes */
  	rs->sr_err = bdb_index_entry_add( op, lt2, op->oq_add.rs_e );
  	if ( rs->sr_err != LDAP_SUCCESS ) {
-@@ -431,13 +441,18 @@
+@@ -431,13 +448,18 @@
  		rs->sr_text = "index generation failed";
  		goto return_results;
  	}
@@ -4868,7 +5013,7 @@
  		rc = bdb_csn_commit( op, rs, ltid, ei, &suffix_ei,
  			&ctxcsn_e, &ctxcsn_added, locker );
  		switch ( rc ) {
-@@ -493,7 +508,11 @@
+@@ -493,7 +515,11 @@
  			suffix_ei = BEI(e);
  		}
  
@@ -4918,24 +5063,38 @@
 ===================================================================
 RCS file: /cvsroot/openldap-ha/build-tree/openldap-2.2.18/servers/slapd/back-bdb/delete.c,v
 retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -r1.1.1.1 -r1.2
+retrieving revision 1.4
+diff -u -r1.1.1.1 -r1.4
 --- openldap-2.2.18/servers/slapd/back-bdb/delete.c	26 Oct 2004 10:15:10 -0000	1.1.1.1
-+++ openldap-2.2.18/servers/slapd/back-bdb/delete.c	26 Oct 2004 10:26:09 -0000	1.2
-@@ -534,6 +534,12 @@
++++ openldap-2.2.18/servers/slapd/back-bdb/delete.c	2 Nov 2004 16:10:56 -0000	1.4
+@@ -41,6 +41,9 @@
+ 	DB_LOCK		lock, plock;
+ 
+ 	int		num_retries = 0;
++#ifdef LDAP_SYNCBACKUP
++	int		did_syncbackup = 0;
++#endif
+ 
+ 	Operation* ps_list;
+ 	int     rc;
+@@ -534,6 +537,16 @@
  		p = NULL;
  	}
  
 +#ifdef LDAP_SYNCBACKUP
-+	if( ( rs->sr_err = syncbackup(op, rs) ) != LDAP_SUCCESS ) {
-+		goto return_results;
++	if( ! did_syncbackup ) {
++		rs->sr_err = syncbackup(op, rs);
++		if ( rs->sr_err != LDAP_SUCCESS ) {
++			goto return_results;
++		}
++		did_syncbackup = 1;
 +	}
 +#endif
 +
  	if ( TXN_COMMIT( lt2, 0 ) != 0 ) {
  		rs->sr_err = LDAP_OTHER;
  		rs->sr_text = "txn_commit(2) failed";
-@@ -548,7 +554,11 @@
+@@ -548,7 +561,11 @@
  	ldap_pvt_thread_mutex_unlock( &bdb->bi_lastid_mutex );
  #endif
  
@@ -4947,7 +5106,7 @@
  		rc = bdb_csn_commit( op, rs, ltid, ei, &suffix_ei,
  			&ctxcsn_e, &ctxcsn_added, locker );
  		switch ( rc ) {
-@@ -575,7 +585,11 @@
+@@ -575,7 +592,11 @@
  			goto retry;
  		}
  
@@ -4981,18 +5140,31 @@
 ===================================================================
 RCS file: /cvsroot/openldap-ha/build-tree/openldap-2.2.18/servers/slapd/back-bdb/modify.c,v
 retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -r1.1.1.1 -r1.2
+retrieving revision 1.4
+diff -u -r1.1.1.1 -r1.4
 --- openldap-2.2.18/servers/slapd/back-bdb/modify.c	26 Oct 2004 10:15:11 -0000	1.1.1.1
-+++ openldap-2.2.18/servers/slapd/back-bdb/modify.c	26 Oct 2004 10:26:09 -0000	1.2
-@@ -656,13 +656,24 @@
++++ openldap-2.2.18/servers/slapd/back-bdb/modify.c	2 Nov 2004 16:10:56 -0000	1.4
+@@ -359,6 +359,9 @@
+ 	DB_LOCK		lock;
+ 
+ 	int		num_retries = 0;
++#ifdef LDAP_SYNCBACKUP
++	int		did_syncbackup = 0;
++#endif
+ 
+ 	LDAPControl **preread_ctrl = NULL;
+ 	LDAPControl **postread_ctrl = NULL;
+@@ -656,13 +659,27 @@
  		goto return_results;
  	}
  
 +#ifdef LDAP_SYNCBACKUP
-+	// TODO: move up this as a general operation
-+	if( ( rs->sr_err = syncbackup(op, rs) ) != LDAP_SUCCESS ) {
-+		goto return_results;
++	if( ! did_syncbackup ) {
++		rs->sr_err = syncbackup(op, rs);
++		if ( rs->sr_err != LDAP_SUCCESS ) {
++			goto return_results;
++		}
++		did_syncbackup = 1;
 +	}
 +#endif
 +
@@ -5010,7 +5182,7 @@
  		rc = bdb_csn_commit( op, rs, ltid, ei, &suffix_ei,
  			&ctxcsn_e, &ctxcsn_added, locker );
  		switch ( rc ) {
-@@ -708,7 +719,11 @@
+@@ -708,7 +725,11 @@
  		}
  		dummy.e_attrs = NULL;
  
@@ -5026,18 +5198,31 @@
 ===================================================================
 RCS file: /cvsroot/openldap-ha/build-tree/openldap-2.2.18/servers/slapd/back-bdb/modrdn.c,v
 retrieving revision 1.1.1.1
-retrieving revision 1.2
-diff -u -r1.1.1.1 -r1.2
+retrieving revision 1.4
+diff -u -r1.1.1.1 -r1.4
 --- openldap-2.2.18/servers/slapd/back-bdb/modrdn.c	26 Oct 2004 10:15:11 -0000	1.1.1.1
-+++ openldap-2.2.18/servers/slapd/back-bdb/modrdn.c	26 Oct 2004 10:26:09 -0000	1.2
-@@ -985,13 +985,24 @@
++++ openldap-2.2.18/servers/slapd/back-bdb/modrdn.c	2 Nov 2004 16:10:56 -0000	1.4
+@@ -59,6 +59,9 @@
+ 	DB_LOCK		lock, plock, nplock;
+ 
+ 	int		num_retries = 0;
++#ifdef LDAP_SYNCBACKUP
++	int		did_syncbackup = 0;
++#endif
+ 
+ 	LDAPControl **preread_ctrl = NULL;
+ 	LDAPControl **postread_ctrl = NULL;
+@@ -985,13 +988,27 @@
  		p = NULL;
  	}
  
 +#ifdef LDAP_SYNCBACKUP
-+	// TODO: move up this as a general operation
-+	if( ( rs->sr_err = syncbackup(op, rs) ) != LDAP_SUCCESS ) {
-+		goto return_results;
++	if( ! did_syncbackup ) {
++		rs->sr_err = syncbackup(op, rs);
++		if ( rs->sr_err != LDAP_SUCCESS ) {
++			goto return_results;
++		}
++		did_syncbackup = 1;
 +	}
 +#endif
 +
@@ -5055,7 +5240,7 @@
  		rc = bdb_csn_commit( op, rs, ltid, ei, &suffix_ei,
  			&ctxcsn_e, &ctxcsn_added, locker );
  		switch ( rc ) {
-@@ -1041,7 +1052,11 @@
+@@ -1041,7 +1058,11 @@
  		new_dn.bv_val = NULL;
  		new_ndn.bv_val = NULL;
  



Ultrapossum-cvs メーリングリストの案内
Back to archive index