(void) SIGNAL( LDAP_SIGUSR1, do_nothing );
(void) SIGNAL( SIGPIPE, SIG_IGN );
if ( ri == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG (( "ri", LDAP_LEVEL_ERR, "Ri_process: "
+ "Error: ri == NULL!\n" ));
+#else
Debug( LDAP_DEBUG_ANY, "Error: Ri_process: ri == NULL!\n", 0, 0, 0 );
+#endif
return -1;
}
if ( re != NULL ) {
if ( !ismine( ri, re )) {
/* The Re doesn't list my host:port */
+#ifdef NEW_LOGGING
+ LDAP_LOG (( "ri", LDAP_LEVEL_DETAIL1, "Ri_process: "
+ "Replica %s:%d, skip repl record for %s (not mine)\n",
+ ri->ri_hostname, ri->ri_port, re->re_dn ));
+#else
Debug( LDAP_DEBUG_TRACE,
"Replica %s:%d, skip repl record for %s (not mine)\n",
ri->ri_hostname, ri->ri_port, re->re_dn );
+#endif
} else if ( !isnew( ri, re )) {
/* This Re is older than my saved status information */
+#ifdef NEW_LOGGING
+ LDAP_LOG (( "ri", LDAP_LEVEL_DETAIL1, "Ri_process: "
+ "Replica %s:%d, skip repl record for %s (old)\n",
+ ri->ri_hostname, ri->ri_port, re->re_dn ));
+#else
Debug( LDAP_DEBUG_TRACE,
"Replica %s:%d, skip repl record for %s (old)\n",
ri->ri_hostname, ri->ri_port, re->re_dn );
+#endif
} else {
rc = do_ldap( ri, re, &errmsg );
switch ( rc ) {
case DO_LDAP_ERR_RETRYABLE:
ldap_pvt_thread_sleep( RETRY_SLEEP_TIME );
+#ifdef NEW_LOGGING
+ LDAP_LOG (( "ri", LDAP_LEVEL_DETAIL1, "Ri_process: "
+ "Retrying operation for DN %s on replica %s:%d\n",
+ re->re_dn, ri->ri_hostname, ri->ri_port ));
+#else
Debug( LDAP_DEBUG_ANY,
"Retrying operation for DN %s on replica %s:%d\n",
re->re_dn, ri->ri_hostname, ri->ri_port );
+#endif
continue;
break;
case DO_LDAP_ERR_FATAL: {
}
}
} else {
+#ifdef NEW_LOGGING
+ LDAP_LOG (( "ri", LDAP_LEVEL_ERR, "Ri_process: "
+ "Error: re is null in Ri_process\n" ));
+#else
Debug( LDAP_DEBUG_ANY, "Error: re is null in Ri_process\n",
0, 0, 0 );
+#endif
}
rq->rq_lock( rq );
while ( !sglob->slurpd_shutdown &&
}
if ( savedhead->re_getrefcnt( savedhead ) != 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG (( "rq", LDAP_LEVEL_WARNING, "Rq_delhead: "
+ "Warning: attempt to delete when refcnt != 0\n" ));
+#else
Debug( LDAP_DEBUG_ANY, "Warning: attempt to delete when refcnt != 0\n",
0, 0, 0 );
+#endif
return( -1 );
}
)
{
if ( rq == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG (( "rq", LDAP_LEVEL_DETAIL1, "Rq_gc: rq is NULL!\n" ));
+#else
Debug( LDAP_DEBUG_ANY, "Rq_gc: rq is NULL!\n", 0, 0, 0 );
+#endif
return;
}
rq->rq_lock( rq );
int tmpfd;
if ( rq == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG (( "rq", LDAP_LEVEL_ARGS, "Rq_dump: rq is NULL!\n" ));
+#else
Debug( LDAP_DEBUG_ANY, "Rq_dump: rq is NULL!\n", 0, 0, 0 );
+#endif
return;
}
if (unlink(SLURPD_DUMPFILE) == -1 && errno != ENOENT) {
+#ifdef NEW_LOGGING
+ LDAP_LOG (( "rq", LDAP_LEVEL_ERR, "Rq_dump: "
+ "\"%s\" exists, cannot unlink\n", SLURPD_DUMPFILE ));
+#else
Debug( LDAP_DEBUG_ANY, "Rq_dump: \"%s\" exists, and cannot unlink\n",
SLURPD_DUMPFILE, 0, 0 );
+#endif
return;
}
if (( tmpfd = open(SLURPD_DUMPFILE, O_CREAT|O_RDWR|O_EXCL, 0600)) == -1) {
+#ifdef NEW_LOGGING
+ LDAP_LOG (( "rq", LDAP_LEVEL_ERR, "Rq_dump: "
+ "cannot open \"%s\" for write\n", SLURPD_DUMPFILE ));
+#else
Debug( LDAP_DEBUG_ANY, "Rq_dump: cannot open \"%s\" for write\n",
SLURPD_DUMPFILE, 0, 0 );
+#endif
return;
}
if (( fp = fdopen( tmpfd, "w" )) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG (( "rq", LDAP_LEVEL_ERR, "Rq_dump: "
+ "cannot fdopen \"%s\" for write\n", SLURPD_DUMPFILE ));
+#else
Debug( LDAP_DEBUG_ANY, "Rq_dump: cannot fdopen \"%s\" for write\n",
SLURPD_DUMPFILE, 0, 0 );
+#endif
return;
}
return -1;
}
+#ifdef NEW_LOGGING
+ LDAP_LOG (( "rq", LDAP_LEVEL_ENTRY, "Rq_write: "
+ "re-write on-disk replication log\n" ));
+#else
Debug( LDAP_DEBUG_ARGS, "re-write on-disk replication log\n",
0, 0, 0 );
+#endif
#ifndef SEEK_SET
#define SEEK_SET 0
#endif
sglob->srpos = ftell( fp ); /* update replog file position */
/* and truncate to correct len */
if ( ftruncate( fileno( fp ), sglob->srpos ) < 0 ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG (( "rq", LDAP_LEVEL_ERR, "Rq_write: "
+ "Error truncating replication log: %s\n", sys_errlist[ errno ] ));
+#else
Debug( LDAP_DEBUG_ANY, "Error truncating replication log: %s\n",
sys_errlist[ errno ], 0, 0 );
+#endif
}
rq->rq_ndel = 0; /* reset count of deleted re's */
time( &now );
if (( rc = acquire_lock( sglob->slurpd_status_file, &(st->st_fp),
&(st->st_lfp))) < 0 ) {
if ( !st->st_err_logged ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG (( "st", LDAP_LEVEL_ERR, "St_write: "
+ "Error: cannot open status file \"%s\":%s\n",
+ sglob->slurpd_status_file, sys_errlist[ errno ] ));
+#else
Debug( LDAP_DEBUG_ANY,
"Error: cannot open status file \"%s\": %s\n",
sglob->slurpd_status_file, sys_errlist[ errno ], 0 );
+#endif
st->st_err_logged = 1;
ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return -1;
* File doesn't exist, so create it and return.
*/
if (( fp = fopen( sglob->slurpd_status_file, "w" )) == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG (( "st", LDAP_LEVEL_ERR, "St_write: "
+ "Error: cannot create status file \"%s\"\n",
+ sglob->slurpd_status_file ));
+#else
Debug( LDAP_DEBUG_ANY, "Error: cannot create status file \"%s\"\n",
sglob->slurpd_status_file, 0, 0 );
+#endif
ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
return -1;
}
(void) fclose( fp );
ldap_pvt_thread_mutex_unlock( &(st->st_mutex ));
+#ifdef NEW_LOGGING
+ LDAP_LOG (( "st", LDAP_LEVEL_DETAIL1, "St_write: "
+ "No status file found, defaulting values\n" ));
+#else
Debug( LDAP_DEBUG_ARGS, "No status file found, defaulting values\n",
0, 0, 0 );
+#endif
return 0;
}
if (( rc = acquire_lock( sglob->slurpd_status_file, &fp, &lfp)) < 0 ) {
char tbuf[ 255 ];
sprintf( tbuf, "%s:%s (timestamp %s.%s)", hostname, port,
timestamp, seq );
+#ifdef NEW_LOGGING
+ LDAP_LOG (( "st", LDAP_LEVEL_DETAIL1, "St_write: "
+ "Retrieved state information for %s\n", tbuf ));
+#else
Debug( LDAP_DEBUG_ARGS,
"Retrieved state information for %s\n", tbuf, 0, 0 );
+#endif
} else {
+#ifdef NEW_LOGGING
+ LDAP_LOG (( "st", LDAP_LEVEL_WARNING, "St_write: "
+ "Warning: saved state for %s:%s, not a known replica\n",
+ hostname, port ));
+#else
Debug( LDAP_DEBUG_ANY,
"Warning: saved state for %s:%s, not a known replica\n",
hostname, port, 0 );
+#endif
}
}
(void) relinquish_lock( sglob->slurpd_status_file, fp, lfp);