]> git.sur5r.net Git - openldap/commitdiff
Revert prev commit, unnecessary
authorHoward Chu <hyc@openldap.org>
Thu, 25 Dec 2003 14:57:26 +0000 (14:57 +0000)
committerHoward Chu <hyc@openldap.org>
Thu, 25 Dec 2003 14:57:26 +0000 (14:57 +0000)
servers/slapd/init.c
servers/slapd/proto-slap.h
servers/slapd/repl.c
servers/slapd/slap.h

index 71c3477b51d679b3a1a060d240495d1184e07691..6ab72623220e8579b275ff378ea5b78a3545cc0f 100644 (file)
@@ -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 );
 
index 2334edef12d8f8cbb03ee820e5be9faeb0fbd7bc..6227b18fcd3f77bff0e23d03463eb48974f1008b 100644 (file)
@@ -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;
index cb50ba6879c9dc825eefffd6e310963956f888c6..6a54a9bb74948d4472aaafa156b0a5de2d4fce82 100644 (file)
@@ -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 );
index b70938be99a1a6d0a604ac4c0ec39b3ccc9d674e..357858ddfa98d727252e1f5eaaa803048c2fa4ac 100644 (file)
@@ -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;