]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/overlays/accesslog.c
ITS#8752 additional debug info, thread ID of rmutex lockers
[openldap] / servers / slapd / overlays / accesslog.c
index d8bb9e3303214731f915d8ddf361d979ed4e36c4..53369b32c54c1553f92419319907783450d49e54 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2005-2016 The OpenLDAP Foundation.
+ * Copyright 2005-2017 The OpenLDAP Foundation.
  * Portions copyright 2004-2005 Symas Corporation.
  * All rights reserved.
  *
@@ -701,6 +701,7 @@ accesslog_purge( void *ctx, void *arg )
                        }
                        ch_free( pd.ndn[i].bv_val );
                        ch_free( pd.dn[i].bv_val );
+                       ldap_pvt_thread_pool_pausecheck( &connection_pool );
                }
                ch_free( pd.ndn );
                ch_free( pd.dn );
@@ -1514,6 +1515,11 @@ static int accesslog_response(Operation *op, SlapReply *rs) {
                                break;
                        }
                }
+#ifdef RMUTEX_DEBUG
+               Debug( LDAP_DEBUG_SYNC,
+                       "accesslog_response: unlocking rmutex for tid %x\n",
+                       op->o_tid, 0, 0 );
+#endif
                ldap_pvt_thread_rmutex_unlock( &li->li_op_rmutex, op->o_tid );
        }
 
@@ -1585,7 +1591,7 @@ static int accesslog_response(Operation *op, SlapReply *rs) {
 
        case LOG_EN_MODRDN:
        case LOG_EN_MODIFY:
-               /* count all the mods */
+               /* count all the mods + attributes (ITS#6545) */
                i = 0;
                for ( m = op->orm_modlist; m; m = m->sml_next ) {
                        if ( m->sml_values ) {
@@ -1595,6 +1601,9 @@ static int accesslog_response(Operation *op, SlapReply *rs) {
                        {
                                i++;
                        }
+                       if ( m->sml_next && m->sml_desc == m->sml_next->sml_desc ) {
+                               i++;
+                       }
                }
                vals = ch_malloc( (i+1) * sizeof( struct berval ));
                i = 0;
@@ -1665,6 +1674,12 @@ static int accesslog_response(Operation *op, SlapReply *rs) {
                                *ptr = '\0';
                                i++;
                        }
+                       /* ITS#6545: when the same attribute is edited multiple times,
+                        * record the transition */
+                       if ( m->sml_next && m->sml_desc == m->sml_next->sml_desc ) {
+                               ber_str2bv( ":", STRLENOF(":"), 1, &vals[i] );
+                               i++;
+                       }
                }
 
                if ( i > 0 ) {
@@ -1958,6 +1973,10 @@ accesslog_op_mod( Operation *op, SlapReply *rs )
                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 );
@@ -1981,7 +2000,17 @@ accesslog_op_mod( Operation *op, SlapReply *rs )
                for ( cb2 = op->o_callback; cb2->sc_next; cb2 = cb2->sc_next );
                cb2->sc_next = cb;
 
+#ifdef RMUTEX_DEBUG
+               Debug( LDAP_DEBUG_SYNC,
+                       "accesslog_op_mod: locking rmutex for tid %x\n",
+                       op->o_tid, 0, 0 );
+#endif
                ldap_pvt_thread_rmutex_lock( &li->li_op_rmutex, op->o_tid );
+#ifdef RMUTEX_DEBUG
+               Debug( LDAP_DEBUG_STATS,
+                       "accesslog_op_mod: locked rmutex for tid %x\n",
+                       op->o_tid, 0, 0 );
+#endif
                if ( li->li_oldf && ( op->o_tag == LDAP_REQ_DELETE ||
                        op->o_tag == LDAP_REQ_MODIFY ||
                        ( op->o_tag == LDAP_REQ_MODRDN && li->li_oldattrs )))