From: Kurt Zeilenga Date: Thu, 30 Mar 2006 17:56:56 +0000 (+0000) Subject: Add link to FAQ entry on BDB tuning X-Git-Tag: OPENLDAP_REL_ENG_2_4_BP~93 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=5487575086d2060ab05a408543ff07be31b400a8;p=openldap Add link to FAQ entry on BDB tuning --- diff --git a/servers/slapd/DB_CONFIG b/servers/slapd/DB_CONFIG index ba2fbe524c..7977195342 100644 --- a/servers/slapd/DB_CONFIG +++ b/servers/slapd/DB_CONFIG @@ -7,6 +7,8 @@ # # Hints can also be found in the OpenLDAP Software FAQ # +# in particular: +# # one 0.25 GB cache set_cachesize 0 268435456 1 diff --git a/servers/slapd/add.c b/servers/slapd/add.c index 57733a938b..314d044aab 100644 --- a/servers/slapd/add.c +++ b/servers/slapd/add.c @@ -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 }; diff --git a/servers/slapd/back-bdb/add.c b/servers/slapd/back-bdb/add.c index 5fa8f7981e..88b61cc819 100644 --- a/servers/slapd/back-bdb/add.c +++ b/servers/slapd/back-bdb/add.c @@ -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 */ diff --git a/servers/slapd/back-bdb/delete.c b/servers/slapd/back-bdb/delete.c index 488cdafd3b..97c3c613ee 100644 --- a/servers/slapd/back-bdb/delete.c +++ b/servers/slapd/back-bdb/delete.c @@ -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 */ diff --git a/servers/slapd/back-bdb/modify.c b/servers/slapd/back-bdb/modify.c index 19cd76f4ab..094f0915dc 100644 --- a/servers/slapd/back-bdb/modify.c +++ b/servers/slapd/back-bdb/modify.c @@ -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 */ diff --git a/servers/slapd/back-bdb/modrdn.c b/servers/slapd/back-bdb/modrdn.c index f32abdf567..cb557832f8 100644 --- a/servers/slapd/back-bdb/modrdn.c +++ b/servers/slapd/back-bdb/modrdn.c @@ -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 */ diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index 71d6a35b57..be3fca041b 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -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: diff --git a/servers/slapd/delete.c b/servers/slapd/delete.c index ab5653b6c3..f2501476a9 100644 --- a/servers/slapd/delete.c +++ b/servers/slapd/delete.c @@ -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; } diff --git a/servers/slapd/modify.c b/servers/slapd/modify.c index 47ca13a697..9770919784 100644 --- a/servers/slapd/modify.c +++ b/servers/slapd/modify.c @@ -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 ); diff --git a/servers/slapd/modrdn.c b/servers/slapd/modrdn.c index 234cc83ac9..258519349e 100644 --- a/servers/slapd/modrdn.c +++ b/servers/slapd/modrdn.c @@ -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; } diff --git a/servers/slapd/operation.c b/servers/slapd/operation.c index 28054793f1..13bb5cf590 100644 --- a/servers/slapd/operation.c +++ b/servers/slapd/operation.c @@ -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;