mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-03-07 14:18:15 +08:00
improved support for NOOP; add is fine, the other write funcs still need work
This commit is contained in:
parent
a0c54f1625
commit
0d5fe062e2
@ -23,7 +23,7 @@ bdb_add(
|
||||
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
|
||||
struct berval pdn;
|
||||
Entry *p = NULL;
|
||||
int rc, ret;
|
||||
int rc;
|
||||
const char *text;
|
||||
char textbuf[SLAP_TEXT_BUFLEN];
|
||||
size_t textlen = sizeof textbuf;
|
||||
@ -39,6 +39,7 @@ bdb_add(
|
||||
u_int32_t lockid;
|
||||
DB_LOCK lock;
|
||||
#endif
|
||||
int noop = 0;
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( OPERATION, ARGS, "==> bdb_add: %s\n", e->e_dn, 0, 0 );
|
||||
@ -434,6 +435,7 @@ retry: /* transaction retry */
|
||||
if (( rc=TXN_ABORT( ltid )) != 0 ) {
|
||||
text = "txn_abort (no-op) failed";
|
||||
} else {
|
||||
noop = 1;
|
||||
rc = LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
@ -447,7 +449,9 @@ retry: /* transaction retry */
|
||||
text = "txn_prepare failed";
|
||||
|
||||
} else {
|
||||
ret = bdb_cache_add_entry_rw(bdb->bi_dbenv, &bdb->bi_cache, e, CACHE_WRITE_LOCK, locker, &lock);
|
||||
int ret = bdb_cache_add_entry_rw(bdb->bi_dbenv,
|
||||
&bdb->bi_cache, e, CACHE_WRITE_LOCK,
|
||||
locker, &lock);
|
||||
#if 0
|
||||
if ( bdb_cache_add_entry_rw(&bdb->bi_cache,
|
||||
e, CACHE_WRITE_LOCK) != 0 )
|
||||
@ -492,7 +496,9 @@ retry: /* transaction retry */
|
||||
op->o_noop ? " (no-op)" : "", e->e_id, e->e_dn );
|
||||
#endif
|
||||
text = NULL;
|
||||
bdb_cache_entry_commit( e );
|
||||
if ( !noop ) {
|
||||
bdb_cache_entry_commit( e );
|
||||
}
|
||||
}
|
||||
else {
|
||||
#ifdef NEW_LOGGING
|
||||
@ -522,5 +528,5 @@ done:
|
||||
op->o_private = NULL;
|
||||
}
|
||||
|
||||
return rc;
|
||||
return ( ( rc == LDAP_SUCCESS ) ? noop : rc );
|
||||
}
|
||||
|
@ -41,6 +41,8 @@ bdb_delete(
|
||||
DB_LOCK lock;
|
||||
#endif
|
||||
|
||||
int noop = 0;
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( OPERATION, ARGS, "==> bdb_delete: %s\n", dn->bv_val, 0, 0 );
|
||||
#else
|
||||
@ -416,7 +418,12 @@ retry: /* transaction retry */
|
||||
#endif
|
||||
|
||||
if( op->o_noop ) {
|
||||
rc = TXN_ABORT( ltid );
|
||||
if ( ( rc = TXN_ABORT( ltid ) ) != 0 ) {
|
||||
text = "txn_abort (no-op) failed";
|
||||
} else {
|
||||
noop = 1;
|
||||
rc = LDAP_SUCCESS;
|
||||
}
|
||||
} else {
|
||||
rc = TXN_COMMIT( ltid, 0 );
|
||||
}
|
||||
@ -472,5 +479,5 @@ done:
|
||||
op->o_private = NULL;
|
||||
}
|
||||
|
||||
return rc;
|
||||
return ( ( rc == LDAP_SUCCESS ) ? noop : rc );
|
||||
}
|
||||
|
@ -268,6 +268,8 @@ bdb_modify(
|
||||
u_int32_t locker;
|
||||
DB_LOCK lock;
|
||||
|
||||
int noop = 0;
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( OPERATION, ENTRY, "bdb_modify: %s\n", dn->bv_val, 0, 0 );
|
||||
#else
|
||||
@ -439,7 +441,12 @@ retry: /* transaction retry */
|
||||
}
|
||||
|
||||
if( op->o_noop ) {
|
||||
rc = TXN_ABORT( ltid );
|
||||
if ( ( rc = TXN_ABORT( ltid ) ) != 0 ) {
|
||||
text = "txn_abort (no-op) failed";
|
||||
} else {
|
||||
noop = 1;
|
||||
rc = LDAP_SUCCESS;
|
||||
}
|
||||
} else {
|
||||
rc = TXN_COMMIT( ltid, 0 );
|
||||
}
|
||||
@ -494,5 +501,5 @@ done:
|
||||
if( e != NULL ) {
|
||||
bdb_unlocked_cache_return_entry_w (&bdb->bi_cache, e);
|
||||
}
|
||||
return rc;
|
||||
return ( ( rc == LDAP_SUCCESS ) ? noop : rc );
|
||||
}
|
||||
|
@ -59,6 +59,8 @@ bdb_modrdn(
|
||||
u_int32_t locker;
|
||||
DB_LOCK lock;
|
||||
|
||||
int noop = 0;
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( OPERATION, ENTRY, "==>bdb_modrdn(%s,%s,%s)\n",
|
||||
dn->bv_val,newrdn->bv_val, newSuperior ? newSuperior->bv_val : "NULL" );
|
||||
@ -705,6 +707,7 @@ retry: /* transaction retry */
|
||||
if(( rc=TXN_ABORT( ltid )) != 0 ) {
|
||||
text = "txn_abort (no-op) failed";
|
||||
} else {
|
||||
noop = 1;
|
||||
rc = LDAP_SUCCESS;
|
||||
}
|
||||
|
||||
@ -812,5 +815,5 @@ done:
|
||||
op->o_private = NULL;
|
||||
}
|
||||
|
||||
return rc;
|
||||
return ( ( rc == LDAP_SUCCESS ) ? noop : rc );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user