]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-bdb/modify.c
ITS#4532 fix
[openldap] / servers / slapd / back-bdb / modify.c
index a1aeb801fc30adf5117026fd3789562879af2f2a..4854b9e40e6452a324916817ccaa379151d71807 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2000-2005 The OpenLDAP Foundation.
+ * Copyright 2000-2006 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -91,7 +91,9 @@ int bdb_modify_internal(
 
                switch ( mod->sm_op ) {
                case LDAP_MOD_ADD:
-                       Debug(LDAP_DEBUG_ARGS, "bdb_modify_internal: add\n", 0, 0, 0);
+                       Debug(LDAP_DEBUG_ARGS,
+                               "bdb_modify_internal: add %s\n",
+                               mod->sm_desc->ad_cname.bv_val, 0, 0);
                        err = modify_add_values( e, mod, get_permissiveModify(op),
                                text, textbuf, textlen );
                        if( err != LDAP_SUCCESS ) {
@@ -106,7 +108,9 @@ int bdb_modify_internal(
                                break;
                        }
 
-                       Debug(LDAP_DEBUG_ARGS, "bdb_modify_internal: delete\n", 0, 0, 0);
+                       Debug(LDAP_DEBUG_ARGS,
+                               "bdb_modify_internal: delete %s\n",
+                               mod->sm_desc->ad_cname.bv_val, 0, 0);
                        err = modify_delete_values( e, mod, get_permissiveModify(op),
                                text, textbuf, textlen );
                        assert( err != LDAP_TYPE_OR_VALUE_EXISTS );
@@ -117,7 +121,9 @@ int bdb_modify_internal(
                        break;
 
                case LDAP_MOD_REPLACE:
-                       Debug(LDAP_DEBUG_ARGS, "bdb_modify_internal: replace\n", 0, 0, 0);
+                       Debug(LDAP_DEBUG_ARGS,
+                               "bdb_modify_internal: replace %s\n",
+                               mod->sm_desc->ad_cname.bv_val, 0, 0);
                        err = modify_replace_values( e, mod, get_permissiveModify(op),
                                text, textbuf, textlen );
                        if( err != LDAP_SUCCESS ) {
@@ -128,7 +134,8 @@ int bdb_modify_internal(
 
                case LDAP_MOD_INCREMENT:
                        Debug(LDAP_DEBUG_ARGS,
-                               "bdb_modify_internal: increment\n", 0, 0, 0);
+                               "bdb_modify_internal: increment %s\n",
+                               mod->sm_desc->ad_cname.bv_val, 0, 0);
                        err = modify_increment_values( e, mod, get_permissiveModify(op),
                                text, textbuf, textlen );
                        if( err != LDAP_SUCCESS ) {
@@ -139,7 +146,9 @@ int bdb_modify_internal(
                        break;
 
                case SLAP_MOD_SOFTADD:
-                       Debug(LDAP_DEBUG_ARGS, "bdb_modify_internal: softadd\n", 0, 0, 0);
+                       Debug(LDAP_DEBUG_ARGS,
+                               "bdb_modify_internal: softadd %s\n",
+                               mod->sm_desc->ad_cname.bv_val, 0, 0);
                        /* Avoid problems in index_add_mods()
                         * We need to add index if necessary.
                         */
@@ -289,8 +298,7 @@ bdb_modify( Operation *op, SlapReply *rs )
 
        ctrls[num_ctrls] = NULL;
 
-       if ( !SLAP_SHADOW( op->o_bd ))
-               slap_mods_opattrs( op, &op->orm_modlist, 1 );
+       slap_mods_opattrs( op, &op->orm_modlist, 1 );
 
        if( 0 ) {
 retry: /* transaction retry */
@@ -318,7 +326,6 @@ retry:      /* transaction retry */
                        rs->sr_err = SLAPD_ABANDON;
                        goto return_results;
                }
-               ldap_pvt_thread_yield();
                bdb_trans_backoff( ++num_retries );
        }
 
@@ -582,16 +589,15 @@ return_results:
                attrs_free( dummy.e_attrs );
        }
        send_ldap_result( op, rs );
-       if ( !SLAP_SHADOW( op->o_bd ))
-               slap_graduate_commit_csn( op );
 
        if( rs->sr_err == LDAP_SUCCESS && bdb->bi_txn_cp ) {
-               ldap_pvt_thread_yield();
                TXN_CHECKPOINT( bdb->bi_dbenv,
                        bdb->bi_txn_cp_kbyte, bdb->bi_txn_cp_min, 0 );
        }
 
 done:
+       slap_graduate_commit_csn( op );
+
        if( ltid != NULL ) {
                TXN_ABORT( ltid );
        }
@@ -601,11 +607,11 @@ done:
                bdb_unlocked_cache_return_entry_w (&bdb->bi_cache, e);
        }
 
-       if( preread_ctrl != NULL ) {
+       if( preread_ctrl != NULL && (*preread_ctrl) != NULL ) {
                slap_sl_free( (*preread_ctrl)->ldctl_value.bv_val, op->o_tmpmemctx );
                slap_sl_free( *preread_ctrl, op->o_tmpmemctx );
        }
-       if( postread_ctrl != NULL ) {
+       if( postread_ctrl != NULL && (*postread_ctrl) != NULL ) {
                slap_sl_free( (*postread_ctrl)->ldctl_value.bv_val, op->o_tmpmemctx );
                slap_sl_free( *postread_ctrl, op->o_tmpmemctx );
        }