LDAP_SLAPD_F (int) add_replica_attrs LDAP_P(( Backend *be,
int nr, char *attrs, int exclude ));
LDAP_SLAPD_F (void) replog LDAP_P(( Operation *op ));
-LDAP_SLAPD_F (void) repstamp LDAP_P(( Operation *op ));
/*
* result.c
LDAP_SLAPD_F (int) slap_send_search_reference LDAP_P(( Operation *op, SlapReply *rs ));
LDAP_SLAPD_F (int) slap_send_search_entry LDAP_P(( Operation *op, SlapReply *rs ));
LDAP_SLAPD_F (int) slap_null_cb LDAP_P(( Operation *op, SlapReply *rs ));
+LDAP_SLAPD_F (int) slap_replog_cb LDAP_P(( Operation *op, SlapReply *rs ));
LDAP_SLAPD_V( const struct berval ) slap_pre_read_bv;
LDAP_SLAPD_V( const struct berval ) slap_post_read_bv;
LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) entry2str_mutex;
LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) replog_mutex;
-LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) repstamp_mutex;
#if defined( SLAPD_CRYPT ) || defined( SLAPD_SPASSWD )
LDAP_SLAPD_V (ldap_pvt_thread_mutex_t) passwd_mutex;
return ( be->be_replica[nr]->ri_attrs == NULL );
}
-static struct timestamp {
- long time;
- long seq;
-} oldstamp;
-
static void
print_vals( FILE *fp, struct berval *type, struct berval *bv );
static void
-replog1( struct slap_replica_info *ri, Operation *op, FILE *fp );
-
-void
-repstamp( Operation *op )
-{
- ldap_pvt_thread_mutex_lock( &repstamp_mutex );
- op->o_time = slap_get_time();
- if ( op->o_time == oldstamp.time ) {
- op->o_tseq = ++oldstamp.seq;
- } else {
- oldstamp.time = op->o_time;
- oldstamp.seq = 0;
- op->o_tseq = 0;
- }
- ldap_pvt_thread_mutex_unlock( &repstamp_mutex );
-}
+replog1( struct slap_replica_info *ri, Operation *op, FILE *fp, long now);
void
replog( Operation *op )
int count = 0;
#endif
int subsets = 0;
+ long now = slap_get_time();
if ( op->o_bd->be_replogfile == NULL && replogfile == NULL ) {
return;
}
#endif
- replog1( NULL, op, fp );
+ replog1( NULL, op, fp, now );
if ( subsets > 0 ) {
for ( i = subsets - 1; op->o_bd->be_replica[i] != NULL; i++ ) {
/* Other operations were logged in the first pass */
continue;
}
- replog1( op->o_bd->be_replica[i], op, fp );
+ replog1( op->o_bd->be_replica[i], op, fp, now );
}
}
rephdr(
struct slap_replica_info *ri,
Operation *op,
- FILE *fp
+ FILE *fp,
+ long now
)
{
if ( ri ) {
fprintf( fp, "replica: %s\n", ri->ri_host );
}
- fprintf( fp, "time: %ld.%ld\n", op->o_time, op->o_tseq );
+ fprintf( fp, "time: %ld\n", now );
fprintf( fp, "dn: %s\n", op->o_req_dn.bv_val );
}
replog1(
struct slap_replica_info *ri,
Operation *op,
- FILE *fp
+ FILE *fp,
+ long now
)
{
Modifications *ml;
/* Found a match, log it */
if ( match ) {
if ( dohdr ) {
- rephdr( ri, op, fp );
+ rephdr( ri, op, fp, now );
fprintf( fp, "changetype: modify\n" );
dohdr = 0;
}
}
}
if ( dohdr ) {
- rephdr( ri, op, fp );
+ rephdr( ri, op, fp, now );
fprintf( fp, "changetype: modify\n" );
dohdr = 0;
}
match ^= ri->ri_exclude;
if ( match ) {
if ( dohdr ) {
- rephdr( ri, op, fp );
+ rephdr( ri, op, fp, now );
fprintf( fp, "changetype: add\n" );
dohdr = 0;
}
}
}
if ( dohdr ) {
- rephdr( ri, op, fp );
+ rephdr( ri, op, fp, now );
fprintf( fp, "changetype: add\n" );
dohdr = 0;
}
break;
case LDAP_REQ_DELETE:
- rephdr( ri, op, fp );
+ rephdr( ri, op, fp, now );
fprintf( fp, "changetype: delete\n" );
break;
case LDAP_REQ_MODRDN:
- rephdr( ri, op, fp );
+ rephdr( ri, op, fp, now );
fprintf( fp, "changetype: modrdn\n" );
fprintf( fp, "newrdn: %s\n", op->orr_newrdn.bv_val );
fprintf( fp, "deleteoldrdn: %d\n", op->orr_deleteoldrdn ? 1 : 0 );