]> git.sur5r.net Git - openldap/commitdiff
Add link to FAQ entry on BDB tuning
authorKurt Zeilenga <kurt@openldap.org>
Thu, 30 Mar 2006 17:56:56 +0000 (17:56 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 30 Mar 2006 17:56:56 +0000 (17:56 +0000)
servers/slapd/DB_CONFIG
servers/slapd/add.c
servers/slapd/back-bdb/add.c
servers/slapd/back-bdb/delete.c
servers/slapd/back-bdb/modify.c
servers/slapd/back-bdb/modrdn.c
servers/slapd/connection.c
servers/slapd/delete.c
servers/slapd/modify.c
servers/slapd/modrdn.c
servers/slapd/operation.c

index ba2fbe524c112d3757ae58850349d30e17b39cf5..7977195342aa87fdc60cccf0eee455302a16e97e 100644 (file)
@@ -7,6 +7,8 @@
 #
 # Hints can also be found in the OpenLDAP Software FAQ
 #      <http://www.openldap.org/faq/index.cgi?file=2>
+# in particular:
+#   <http://www.openldap.org/faq/index.cgi?file=1075>
 
 # one 0.25 GB cache
 set_cachesize 0 268435456 1
index 57733a938ba31f9d0a841681e0231218bb0936f4..314d044aab249978f40cf5c1998a4e69337ceb27 100644 (file)
@@ -180,6 +180,13 @@ do_add( Operation *op, SlapReply *rs )
 
        op->o_bd = frontendDB;
        rc = frontendDB->be_add( op, rs );
+
+#ifdef LDAP_X_TXN
+       if ( rc == LDAP_X_TXN_SPECIFY_OKAY ) {
+               /* skip cleanup */
+               return rc;
+       } else
+#endif
        if ( rc == 0 ) {
                if ( op->ora_e != NULL && op->o_private != NULL ) {
                        BackendDB       *bd = op->o_bd;
@@ -281,8 +288,7 @@ fe_op_add( Operation *op, SlapReply *rs )
        if ( op->o_bd->be_add ) {
                /* do the update here */
                int repl_user = be_isupdate( op );
-               if ( !SLAP_SINGLE_SHADOW(op->o_bd) || repl_user )
-               {
+               if ( !SLAP_SINGLE_SHADOW(op->o_bd) || repl_user ) {
                        int             update = !BER_BVISEMPTY( &op->o_bd->be_update_ndn );
                        slap_callback   cb = { NULL, slap_replog_cb, NULL, NULL };
 
index 5fa8f7981ed4916cf93bf70275a5d864b0028865..88b61cc819845fdb06bf0ec4520e06e30df039ef 100644 (file)
@@ -76,7 +76,7 @@ bdb_add(Operation *op, SlapReply *rs )
                /* insert operation into transaction */
 
                rs->sr_text = "transaction specified";
-               rs->sr_err = LDAP_SUCCESS;
+               rs->sr_err = LDAP_X_TXN_SPECIFY_OKAY;
 
 txnReturn:
                /* release connection lock */
index 488cdafd3b2fbf026ec98550cbc6455b3520c018..97c3c613ee8fe4b3e17f73a2b339f7af0ed407e4 100644 (file)
@@ -84,7 +84,7 @@ bdb_delete( Operation *op, SlapReply *rs )
                /* insert operation into transaction */
 
                rs->sr_text = "transaction specified";
-               rs->sr_err = LDAP_SUCCESS;
+               rs->sr_err = LDAP_X_TXN_SPECIFY_OKAY;
 
 txnReturn:
                /* release connection lock */
index 19cd76f4abafbed78d9a54fac525d6ad26bc9e06..094f0915dc3837604c56d3b47e7c285bd5507f3b 100644 (file)
@@ -325,7 +325,7 @@ bdb_modify( Operation *op, SlapReply *rs )
                /* insert operation into transaction */
 
                rs->sr_text = "transaction specified";
-               rs->sr_err = LDAP_SUCCESS;
+               rs->sr_err = LDAP_X_TXN_SPECIFY_OKAY;
 
 txnReturn:
                /* release connection lock */
index f32abdf5671584e76e6b682f509d2ea33b11889e..cb557832f8f8981d6cbad7fedf78e0a2fab6298e 100644 (file)
@@ -94,7 +94,7 @@ bdb_modrdn( Operation *op, SlapReply *rs )
                /* insert operation into transaction */
 
                rs->sr_text = "transaction specified";
-               rs->sr_err = LDAP_SUCCESS;
+               rs->sr_err = LDAP_X_TXN_SPECIFY_OKAY;
 
 txnReturn:
                /* release connection lock */
index 71d6a35b5737bff7f6902429735d9e8ad614a883..be3fca041bd96f65cd7cab6e656d21ee40b9827d 100644 (file)
@@ -1268,6 +1268,20 @@ connection_operation( void *ctx, void *arg_v )
                goto operations_error;
        }
 
+#ifdef LDAP_X_TXN
+       if (( conn->c_txn == CONN_TXN_SPECIFY ) && (
+               ( tag == LDAP_REQ_ADD ) ||
+               ( tag == LDAP_REQ_DELETE ) ||
+               ( tag == LDAP_REQ_MODIFY ) ||
+               ( tag == LDAP_REQ_MODRDN )))
+       {
+               /* Disable SLAB allocator for all update operations
+                       issued inside of a transaction */
+               op->o_tmpmemctx = NULL;
+               op->o_tmpmfuncs = &ch_mfuncs;
+       } else
+#endif
+       {
        /* We can use Thread-Local storage for most mallocs. We can
         * also use TL for ber parsing, but not on Add or Modify.
         */
@@ -1287,6 +1301,7 @@ connection_operation( void *ctx, void *arg_v )
                 */
                ber_set_option( op->o_ber, LBER_OPT_BER_MEMCTX, &memctx );
        }
+       }
 
        switch ( tag ) {
        case LDAP_REQ_BIND:
index ab5653b6c3dad04d6cf2ce4e8892d8e126945eef..f2501476a9d3340e525af96c38617240d64424fb 100644 (file)
@@ -90,6 +90,13 @@ do_delete(
        op->o_bd = frontendDB;
        rs->sr_err = frontendDB->be_delete( op, rs );
 
+#ifdef LDAP_X_TXN
+       if( rs->sr_err == LDAP_X_TXN_SPECIFY_OKAY ) {
+               /* skip cleanup */
+               return rs->sr_err;
+       }
+#endif
+
 cleanup:;
        op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
        op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
@@ -155,8 +162,7 @@ fe_op_delete( Operation *op, SlapReply *rs )
        if ( op->o_bd->be_delete ) {
                /* do the update here */
                int repl_user = be_isupdate( op );
-               if ( !SLAP_SINGLE_SHADOW(op->o_bd) || repl_user )
-               {
+               if ( !SLAP_SINGLE_SHADOW(op->o_bd) || repl_user ) {
                        struct berval   org_req_dn = BER_BVNULL;
                        struct berval   org_req_ndn = BER_BVNULL;
                        struct berval   org_dn = BER_BVNULL;
@@ -166,8 +172,7 @@ fe_op_delete( Operation *op, SlapReply *rs )
 
                        op->o_bd = op_be;
 
-                       if ( !op->o_bd->be_update_ndn.bv_len || !repl_user )
-                       {
+                       if ( !op->o_bd->be_update_ndn.bv_len || !repl_user ) {
                                cb.sc_next = op->o_callback;
                                op->o_callback = &cb;
                        }
index 47ca13a697bdd514744e7081a313059815c32243..9770919784b8283a008b4a3c9cce0c8c9eef0b14 100644 (file)
@@ -198,6 +198,13 @@ do_modify(
        op->o_bd = frontendDB;
        rs->sr_err = frontendDB->be_modify( op, rs );
 
+#ifdef LDAP_X_TXN
+       if( rs->sr_err == LDAP_X_TXN_SPECIFY_OKAY ) {
+               /* skip cleanup */
+               return rs->sr_err;
+       }
+#endif
+
 cleanup:
        op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
        op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
index 234cc83ac91fd2e42d5e3f08457443579e2fc022..258519349e9e00f95ae07c5fa867b4eb86f1dce0 100644 (file)
@@ -184,6 +184,12 @@ do_modrdn(
        op->o_bd = frontendDB;
        rs->sr_err = frontendDB->be_modrdn( op, rs );
 
+#ifdef LDAP_X_TXN
+       if( rs->sr_err == LDAP_X_TXN_SPECIFY_OKAY ) {
+               /* skip cleanup */
+       }
+#endif
+
 cleanup:
        op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
        op->o_tmpfree( op->o_req_ndn.bv_val, op->o_tmpmemctx );
@@ -194,10 +200,12 @@ cleanup:
        if ( op->orr_modlist != NULL )
                slap_mods_free( op->orr_modlist, 1 );
 
-       if ( !BER_BVISNULL( &pnewSuperior ) ) 
+       if ( !BER_BVISNULL( &pnewSuperior ) ) {
                op->o_tmpfree( pnewSuperior.bv_val, op->o_tmpmemctx );
-       if ( !BER_BVISNULL( &nnewSuperior ) )
+       }
+       if ( !BER_BVISNULL( &nnewSuperior ) ) {
                op->o_tmpfree( nnewSuperior.bv_val, op->o_tmpmemctx );
+       }
 
        return rs->sr_err;
 }
index 28054793f1504472ca8ddcd2f132a0b2a226054b..13bb5cf590bbcc05e6f5adf1666035e004e2244a 100644 (file)
@@ -132,8 +132,7 @@ slap_op_alloc(
     BerElement         *ber,
     ber_int_t  msgid,
     ber_tag_t  tag,
-    ber_int_t  id
-)
+    ber_int_t  id )
 {
        Operation       *op;