From d8f9f4ee229d99338b5818aee5dac27aef06dcaa Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 25 Dec 2003 14:57:26 +0000 Subject: [PATCH] Revert prev commit, unnecessary --- servers/slapd/init.c | 2 -- servers/slapd/proto-slap.h | 3 +-- servers/slapd/repl.c | 47 ++++++++++++-------------------------- servers/slapd/slap.h | 1 - 4 files changed, 16 insertions(+), 37 deletions(-) diff --git a/servers/slapd/init.c b/servers/slapd/init.c index 71c3477b51..6ab7262322 100644 --- a/servers/slapd/init.c +++ b/servers/slapd/init.c @@ -91,7 +91,6 @@ ldap_pvt_thread_mutex_t num_sent_mutex; */ ldap_pvt_thread_mutex_t entry2str_mutex; ldap_pvt_thread_mutex_t replog_mutex; -ldap_pvt_thread_mutex_t repstamp_mutex; static const char* slap_name = NULL; int slapMode = SLAP_UNDEFINED_MODE; @@ -143,7 +142,6 @@ slap_init( int mode, const char *name ) ldap_pvt_thread_mutex_init( &entry2str_mutex ); ldap_pvt_thread_mutex_init( &replog_mutex ); - ldap_pvt_thread_mutex_init( &repstamp_mutex ); ldap_pvt_thread_mutex_init( &num_ops_mutex ); ldap_pvt_thread_mutex_init( &num_sent_mutex ); diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 2334edef12..6227b18fcd 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -913,7 +913,6 @@ LDAP_SLAPD_F (int) add_replica_suffix LDAP_P(( Backend *be, 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 @@ -927,6 +926,7 @@ LDAP_SLAPD_F (void) slap_send_search_result LDAP_P(( Operation *op, SlapReply *r 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; @@ -1246,7 +1246,6 @@ LDAP_SLAPD_V (int) connection_pool_max; 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; diff --git a/servers/slapd/repl.c b/servers/slapd/repl.c index cb50ba6879..6a54a9bb74 100644 --- a/servers/slapd/repl.c +++ b/servers/slapd/repl.c @@ -116,30 +116,10 @@ add_replica_attrs( 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 ) @@ -153,6 +133,7 @@ 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; @@ -208,7 +189,7 @@ replog( Operation *op ) } #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++ ) { @@ -245,7 +226,7 @@ replog( Operation *op ) /* 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 ); } } @@ -257,13 +238,14 @@ static void 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 ); } @@ -271,7 +253,8 @@ static void replog1( struct slap_replica_info *ri, Operation *op, - FILE *fp + FILE *fp, + long now ) { Modifications *ml; @@ -345,7 +328,7 @@ replog1( /* 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; } @@ -369,7 +352,7 @@ replog1( } } if ( dohdr ) { - rephdr( ri, op, fp ); + rephdr( ri, op, fp, now ); fprintf( fp, "changetype: modify\n" ); dohdr = 0; } @@ -417,7 +400,7 @@ replog1( match ^= ri->ri_exclude; if ( match ) { if ( dohdr ) { - rephdr( ri, op, fp ); + rephdr( ri, op, fp, now ); fprintf( fp, "changetype: add\n" ); dohdr = 0; } @@ -429,7 +412,7 @@ replog1( } } if ( dohdr ) { - rephdr( ri, op, fp ); + rephdr( ri, op, fp, now ); fprintf( fp, "changetype: add\n" ); dohdr = 0; } @@ -438,12 +421,12 @@ replog1( 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 ); diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index b70938be99..357858ddfa 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -1904,7 +1904,6 @@ typedef struct slap_op { ber_int_t o_protocol; /* version of the LDAP protocol used by client */ ber_tag_t o_tag; /* tag of the request */ time_t o_time; /* time op was initiated */ - long o_tseq; /* time/sequence number */ struct berval o_req_dn; /* DN of target of request */ struct berval o_req_ndn; -- 2.39.5