]> git.sur5r.net Git - openldap/commitdiff
Use BDB transaction log for debug messages
authorHoward Chu <hyc@openldap.org>
Wed, 5 Dec 2007 22:27:12 +0000 (22:27 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 5 Dec 2007 22:27:12 +0000 (22:27 +0000)
servers/slapd/back-bdb/cache.c
servers/slapd/back-bdb/delete.c

index bf0c02b0a400aa4f95f79c049df2f898b830e508..8d6d0c293f45c335817f9c4633a8288fa1fcb166 100644 (file)
@@ -364,7 +364,12 @@ bdb_entryinfo_add_internal(
                        bdb->bi_cache.c_leaves++;
                rc = avl_insert( &ei->bei_parent->bei_kids, ei2, bdb_rdn_cmp,
                        avl_dup_error );
-               assert( !rc );
+#if defined(LDAP_DEBUG) && defined(LDAP_DEVEL)
+               if ( rc ) {
+                       bdb->bi_dbenv->log_flush( bdb->bi_dbenv, NULL );
+                       assert( !rc );
+               }
+#endif
 #ifdef BDB_HIER
                ei->bei_parent->bei_ckids++;
 #endif
@@ -432,6 +437,11 @@ bdb_cache_find_ndn(
                                (ei.bei_nrdn.bv_val - ndn->bv_val);
                        bdb_cache_entryinfo_unlock( eip );
 
+#if defined(LDAP_DEBUG) && defined(LDAP_DEVEL)
+                       bdb->bi_dbenv->log_printf( bdb->bi_dbenv, NULL, "Reading %s",
+                               ei.bei_nrdn.bv_val );
+#endif
+
                        rc = bdb_dn2id( op, locker, &ei.bei_nrdn, &ei );
                        if (rc) {
                                bdb_cache_entryinfo_lock( eip );
@@ -439,9 +449,16 @@ bdb_cache_find_ndn(
                                return rc;
                        }
 
+#if defined(LDAP_DEBUG) && defined(LDAP_DEVEL)
+                       bdb->bi_dbenv->log_printf( bdb->bi_dbenv, NULL, "Read got %s(%d)",
+                               ei.bei_nrdn.bv_val, ei.bei_id );
+#endif
+
                        /* DN exists but needs to be added to cache */
                        ei.bei_nrdn.bv_len = len;
                        rc = bdb_entryinfo_add_internal( bdb, &ei, &ei2 );
+                       Debug( LDAP_DEBUG_TRACE, "add_internal: \"%s\" %d\n",
+                               ei.bei_nrdn.bv_val, ei.bei_id, 0 );
                        /* add_internal left eip and c_rwlock locked */
                        ldap_pvt_thread_rdwr_wunlock( &bdb->bi_cache.c_rwlock );
                        if ( rc ) {
index c9fdba93d6ab159c01569aa6686ea4415e306b07..765a8acc6311208af05d238d7b7dd1d1df18d1fd 100644 (file)
@@ -372,6 +372,11 @@ retry:     /* transaction retry */
                goto return_results;
        }
 
+#if defined(LDAP_DEBUG) && defined(LDAP_DEVEL)
+       bdb->bi_dbenv->log_printf( bdb->bi_dbenv, lt2, "Starting delete %s(%d)",
+               e->e_nname.bv_val, e->e_id );
+#endif
+
        /* Can't do it if we have kids */
        rs->sr_err = bdb_cache_children( op, lt2, e );
        if( rs->sr_err != DB_NOTFOUND ) {
@@ -492,6 +497,11 @@ retry:     /* transaction retry */
                p = NULL;
        }
 
+#if defined(LDAP_DEBUG) && defined(LDAP_DEVEL)
+       bdb->bi_dbenv->log_printf( bdb->bi_dbenv, lt2, "Commit1 delete %s(%d)",
+               e->e_nname.bv_val, e->e_id );
+#endif
+
        if ( TXN_COMMIT( lt2, 0 ) != 0 ) {
                rs->sr_err = LDAP_OTHER;
                rs->sr_text = "txn_commit(2) failed";
@@ -517,6 +527,12 @@ retry:     /* transaction retry */
                        goto return_results;
                }
        } else {
+
+#if defined(LDAP_DEBUG) && defined(LDAP_DEVEL)
+               bdb->bi_dbenv->log_printf( bdb->bi_dbenv, ltid, "Cache delete %s(%d)",
+                       e->e_nname.bv_val, e->e_id );
+#endif
+
                rc = bdb_cache_delete( bdb, e, locker, &lock );
                switch( rc ) {
                case DB_LOCK_DEADLOCK:
@@ -529,6 +545,11 @@ retry:     /* transaction retry */
        ltid = NULL;
        op->o_private = NULL;
 
+#if defined(LDAP_DEBUG) && defined(LDAP_DEVEL)
+       bdb->bi_dbenv->log_printf( bdb->bi_dbenv, NULL, "Committed delete %s(%d)",
+               e->e_nname.bv_val, e->e_id );
+#endif
+
        if( rs->sr_err != 0 ) {
                Debug( LDAP_DEBUG_TRACE,
                        LDAP_XSTRING(bdb_delete) ": txn_%s failed: %s (%d)\n",