mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-18 11:05:48 +08:00
Added LDAP_LOG Messages
This commit is contained in:
parent
b7f0983efa
commit
4ab3ce1651
@ -55,7 +55,12 @@ Ri_process(
|
||||
(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;
|
||||
}
|
||||
|
||||
@ -85,22 +90,40 @@ Ri_process(
|
||||
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: {
|
||||
@ -122,8 +145,13 @@ Ri_process(
|
||||
}
|
||||
}
|
||||
} 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 &&
|
||||
|
@ -133,8 +133,13 @@ Rq_delhead(
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
@ -217,7 +222,11 @@ Rq_gc(
|
||||
)
|
||||
{
|
||||
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 );
|
||||
@ -245,23 +254,42 @@ Rq_dump(
|
||||
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;
|
||||
}
|
||||
|
||||
@ -293,8 +321,13 @@ Rq_write(
|
||||
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
|
||||
@ -312,8 +345,13 @@ Rq_write(
|
||||
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 );
|
||||
|
@ -97,9 +97,15 @@ St_write (
|
||||
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;
|
||||
@ -177,15 +183,26 @@ St_read(
|
||||
* 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 ) {
|
||||
@ -230,12 +247,23 @@ St_read(
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user