]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/overlays/accesslog.c
ITS#8789 revert previous patch
[openldap] / servers / slapd / overlays / accesslog.c
index faa94d49693eff2a8d1d1b23024300e8c7ec2fdd..61f9da9781288862c848fdde571fe5b50274ba65 100644 (file)
@@ -1458,7 +1458,7 @@ static int accesslog_response(Operation *op, SlapReply *rs) {
        Modifications *m;
        struct berval *b, uuid = BER_BVNULL;
        int i;
-       int logop, do_graduate = 0;
+       int logop;
        slap_verbmasks *lo;
        Entry *e = NULL, *old = NULL, *e_uuid = NULL;
        char timebuf[LDAP_LUTIL_GENTIME_BUFSIZE+8];
@@ -1491,17 +1491,9 @@ static int accesslog_response(Operation *op, SlapReply *rs) {
        if ( lo->mask & LOG_OP_WRITES ) {
                slap_callback *cb;
 
-               /* Most internal ops are not logged */
-               if ( op->o_dont_replicate) {
-                       /* Let contextCSN updates from syncrepl thru; the underlying
-                        * syncprov needs to see them. Skip others.
-                        */
-                       if (( op->o_tag != LDAP_REQ_MODIFY ||
-                               op->orm_modlist->sml_op != LDAP_MOD_REPLACE ||
-                               op->orm_modlist->sml_desc != slap_schema.si_ad_contextCSN ) &&
-                               op->orm_no_opattrs )
+               /* These internal ops are not logged */
+               if ( op->o_dont_replicate )
                        return SLAP_CB_CONTINUE;
-               }
 
                ldap_pvt_thread_mutex_lock( &li->li_log_mutex );
                old = li->li_old;
@@ -1872,7 +1864,6 @@ static int accesslog_response(Operation *op, SlapReply *rs) {
                slap_get_commit_csn( op, &maxcsn, &foundit );
                if ( !BER_BVISEMPTY( &maxcsn ) ) {
                        slap_queue_csn( &op2, &op->o_csn );
-                       do_graduate = 1;
                } else {
                        attr_merge_normalize_one( e, slap_schema.si_ad_entryCSN,
                                &op->o_csn, op->o_tmpmemctx );
@@ -1880,11 +1871,13 @@ static int accesslog_response(Operation *op, SlapReply *rs) {
        }
 
        op2.o_bd->be_add( &op2, &rs2 );
+       if ( rs2.sr_err != LDAP_SUCCESS ) {
+               Debug( LDAP_DEBUG_SYNC,
+                       "accesslog_response: got result 0x%x adding log entry %s\n",
+                       rs2.sr_err, op2.o_req_dn.bv_val, 0 );
+       }
        if ( e == op2.ora_e ) entry_free( e );
        e = NULL;
-       if ( do_graduate ) {
-               slap_graduate_commit_csn( &op2 );
-       }
 
 done:
        if ( lo->mask & LOG_OP_WRITES )
@@ -1962,22 +1955,8 @@ accesslog_op_mod( Operation *op, SlapReply *rs )
        int doit = 0;
 
        /* These internal ops are not logged */
-       if ( op->o_dont_replicate ) {
-               /* Let contextCSN updates from syncrepl thru; the underlying
-                * syncprov needs to see them. Skip others.
-                */
-               if (( op->o_tag != LDAP_REQ_MODIFY ||
-                       op->orm_modlist->sml_op != LDAP_MOD_REPLACE ||
-                       op->orm_modlist->sml_desc != slap_schema.si_ad_contextCSN ) &&
-                       op->orm_no_opattrs )
+       if ( op->o_dont_replicate )
                return SLAP_CB_CONTINUE;
-               /* give this a unique timestamp */
-               op->o_tincr++;
-               if ( op->o_tincr >= 1000000 ) {
-                       op->o_tincr -= 1000000;
-                       op->o_time++;
-               }
-       }
 
        logop = accesslog_op2logop( op );
        lo = logops+logop+EN_OFFSET;
@@ -1994,11 +1973,11 @@ accesslog_op_mod( Operation *op, SlapReply *rs )
        }
                        
        if ( doit ) {
-               slap_callback *cb = op->o_tmpcalloc( 1, sizeof( slap_callback ), op->o_tmpmemctx );
+               slap_callback *cb = op->o_tmpcalloc( 1, sizeof( slap_callback ), op->o_tmpmemctx ), *cb2;
                cb->sc_cleanup = accesslog_mod_cleanup;
                cb->sc_private = on;
-               cb->sc_next = op->o_callback;
-               op->o_callback = cb;
+               for ( cb2 = op->o_callback; cb2->sc_next; cb2 = cb2->sc_next );
+               cb2->sc_next = cb;
 
 #ifdef RMUTEX_DEBUG
                Debug( LDAP_DEBUG_SYNC,