From: Kurt Zeilenga Date: Wed, 23 Jun 2004 06:02:49 +0000 (+0000) Subject: Move pre/post read calls into outer transaction. X-Git-Tag: OPENDLAP_REL_ENG_2_2_MP~182 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e23b0f677f7fb50b5fdb42eec38e04b1bb6c2a8a;p=openldap Move pre/post read calls into outer transaction. Need to fix retry handling. --- diff --git a/servers/slapd/back-bdb/add.c b/servers/slapd/back-bdb/add.c index faf1c54155..a40c68ac8a 100644 --- a/servers/slapd/back-bdb/add.c +++ b/servers/slapd/back-bdb/add.c @@ -344,23 +344,6 @@ retry: /* transaction retry */ goto return_results;; } - /* post-read */ - if( op->o_postread ) { - if ( slap_read_controls( op, rs, op->oq_add.rs_e, - &slap_post_read_bv, &ctrls[num_ctrls] ) ) - { -#ifdef NEW_LOGGING - LDAP_LOG ( OPERATION, DETAIL1, - "<=- bdb_add: post-read failed!\n", 0, 0, 0 ); -#else - Debug( LDAP_DEBUG_TRACE, - "<=- bdb_add: post-read failed!\n", 0, 0, 0 ); -#endif - goto return_results; - } - ctrls[++num_ctrls] = NULL; - } - /* nested transaction */ rs->sr_err = TXN_BEGIN( bdb->bi_dbenv, ltid, <2, bdb->bi_db_opflags ); @@ -462,6 +445,25 @@ retry: /* transaction retry */ } } + /* post-read */ + if( op->o_postread ) { + if ( slap_read_controls( op, rs, op->oq_add.rs_e, + &slap_post_read_bv, &ctrls[num_ctrls] ) ) + { +#ifdef NEW_LOGGING + LDAP_LOG ( OPERATION, DETAIL1, + "<=- bdb_add: post-read failed!\n", 0, 0, 0 ); +#else + Debug( LDAP_DEBUG_TRACE, + "<=- bdb_add: post-read failed!\n", 0, 0, 0 ); +#endif + goto return_results; + } + ctrls[++num_ctrls] = NULL; + op->o_postread = 0; /* prevent redo on retry */ + /* FIXME: should read entry on the last retry */ + } + if ( op->o_noop ) { if (( rs->sr_err=TXN_ABORT( ltid )) != 0 ) { rs->sr_text = "txn_abort (no-op) failed"; diff --git a/servers/slapd/back-bdb/delete.c b/servers/slapd/back-bdb/delete.c index e81a3567a3..e7fda3acf3 100644 --- a/servers/slapd/back-bdb/delete.c +++ b/servers/slapd/back-bdb/delete.c @@ -359,6 +359,8 @@ retry: /* transaction retry */ goto return_results; } ctrls[++num_ctrls] = NULL; + op->o_preread = 0; /* prevent redo on retry */ + /* FIXME: should read entry on the last retry */ } /* nested transaction */ diff --git a/servers/slapd/back-bdb/modify.c b/servers/slapd/back-bdb/modify.c index dea52e7970..eed52e6034 100644 --- a/servers/slapd/back-bdb/modify.c +++ b/servers/slapd/back-bdb/modify.c @@ -597,24 +597,6 @@ retry: /* transaction retry */ goto return_results; } - if( op->o_postread ) { - if( slap_read_controls( op, rs, e, - &slap_post_read_bv, &ctrls[num_ctrls] ) ) - { -#ifdef NEW_LOGGING - LDAP_LOG ( OPERATION, DETAIL1, - "<=- bdb_modify: post-read failed!\n", 0, 0, 0 ); -#else - Debug( LDAP_DEBUG_TRACE, - "<=- bdb_modify: post-read failed!\n", 0, 0, 0 ); -#endif - goto return_results; - } - ctrls[++num_ctrls] = NULL; - op->o_postread = 0; /* prevent redo on retry */ - /* FIXME: should read entry on the last retry */ - } - /* change the entry itself */ rs->sr_err = bdb_id2entry_update( op->o_bd, lt2, &dummy ); if ( rs->sr_err != 0 ) { @@ -652,6 +634,24 @@ retry: /* transaction retry */ } } + if( op->o_postread ) { + if( slap_read_controls( op, rs, e, + &slap_post_read_bv, &ctrls[num_ctrls] ) ) + { +#ifdef NEW_LOGGING + LDAP_LOG ( OPERATION, DETAIL1, + "<=- bdb_modify: post-read failed!\n", 0, 0, 0 ); +#else + Debug( LDAP_DEBUG_TRACE, + "<=- bdb_modify: post-read failed!\n", 0, 0, 0 ); +#endif + goto return_results; + } + ctrls[++num_ctrls] = NULL; + op->o_postread = 0; /* prevent redo on retry */ + /* FIXME: should read entry on the last retry */ + } + if( op->o_noop ) { if ( ( rs->sr_err = TXN_ABORT( ltid ) ) != 0 ) { rs->sr_text = "txn_abort (no-op) failed"; diff --git a/servers/slapd/back-bdb/modrdn.c b/servers/slapd/back-bdb/modrdn.c index b8daf98cae..5de38fa7e7 100644 --- a/servers/slapd/back-bdb/modrdn.c +++ b/servers/slapd/back-bdb/modrdn.c @@ -803,6 +803,7 @@ retry: /* transaction retry */ } ctrls[++num_ctrls] = NULL; op->o_preread = 0; /* prevent redo on retry */ + /* FIXME: should read entry on the last retry */ } /* nested transaction */ @@ -919,24 +920,6 @@ retry: /* transaction retry */ goto return_results; } - if( op->o_postread ) { - if( slap_read_controls( op, rs, e, - &slap_post_read_bv, &ctrls[num_ctrls] ) ) - { -#ifdef NEW_LOGGING - LDAP_LOG ( OPERATION, DETAIL1, - "<=- bdb_modrdn: post-read failed!\n", 0, 0, 0 ); -#else - Debug( LDAP_DEBUG_TRACE, - "<=- bdb_modrdn: post-read failed!\n", 0, 0, 0 ); -#endif - goto return_results; - } - ctrls[++num_ctrls] = NULL; - op->o_postread = 0; /* prevent redo on retry */ - /* FIXME: should read entry on the last retry */ - } - /* id2entry index */ rs->sr_err = bdb_id2entry_update( op->o_bd, lt2, e ); if ( rs->sr_err != 0 ) { @@ -1008,6 +991,24 @@ retry: /* transaction retry */ } } + if( op->o_postread ) { + if( slap_read_controls( op, rs, e, + &slap_post_read_bv, &ctrls[num_ctrls] ) ) + { +#ifdef NEW_LOGGING + LDAP_LOG ( OPERATION, DETAIL1, + "<=- bdb_modrdn: post-read failed!\n", 0, 0, 0 ); +#else + Debug( LDAP_DEBUG_TRACE, + "<=- bdb_modrdn: post-read failed!\n", 0, 0, 0 ); +#endif + goto return_results; + } + ctrls[++num_ctrls] = NULL; + op->o_postread = 0; /* prevent redo on retry */ + /* FIXME: should read entry on the last retry */ + } + if( op->o_noop ) { if(( rs->sr_err=TXN_ABORT( ltid )) != 0 ) { rs->sr_text = "txn_abort (no-op) failed";