]> git.sur5r.net Git - openldap/commitdiff
Move pre/post read calls into outer transaction.
authorKurt Zeilenga <kurt@openldap.org>
Wed, 23 Jun 2004 06:02:49 +0000 (06:02 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 23 Jun 2004 06:02:49 +0000 (06:02 +0000)
Need to fix retry handling.

servers/slapd/back-bdb/add.c
servers/slapd/back-bdb/delete.c
servers/slapd/back-bdb/modify.c
servers/slapd/back-bdb/modrdn.c

index faf1c54155ea3e5be2179b3aa31018659e03e978..a40c68ac8a7b65c1f9c38d199361c9ad8041eec1 100644 (file)
@@ -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, &lt2, 
                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";
index e81a3567a351dbef3fda5987c4d1e8926ae53e09..e7fda3acf383f8e2dd3c1fe68bbe514f2918989a 100644 (file)
@@ -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 */
index dea52e79705aba862c350b41cef77746fc27766b..eed52e6034cc584a149a4c845c0bf7dc6af34493 100644 (file)
@@ -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";
index b8daf98caedf8fba2bff86236ca162c295e751d5..5de38fa7e7bf24567fd37380b52ae047797c5509 100644 (file)
@@ -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";