Add first cut BDB no-op control support.

This commit is contained in:
Kurt Zeilenga 2002-01-29 00:02:27 +00:00
parent 98a2c60c3a
commit 4f0e4f60bd
7 changed files with 60 additions and 30 deletions

View File

@ -339,33 +339,41 @@ retry: /* transaction retry */
goto return_results;
}
rc = txn_commit( ltid, 0 );
if( op->o_noop ) {
rc = txn_abort( ltid );
} else {
rc = txn_commit( ltid, 0 );
}
ltid = NULL;
op->o_private = NULL;
if( rc != 0 ) {
Debug( LDAP_DEBUG_TRACE,
"bdb_add: txn_commit failed: %s (%d)\n",
db_strerror(rc), rc, 0 );
"bdb_add: txn_%s failed: %s (%d)\n",
op->o_noop ? "abort (no-op)" : "commit",
db_strerror(rc), rc );
rc = LDAP_OTHER;
text = "commit failed";
} else {
/* add the entry to the entry cache */
/* we should add to cache only upon free of txn-abort */
if (bdb_cache_add_entry_rw(&bdb->bi_cache, e, CACHE_WRITE_LOCK) != 0) {
text = "cache add failed";
goto return_results;
}
/* add the entry to the entry cache */
/* we should add to cache only upon free of txn-abort */
if (!op->o_noop &&
bdb_cache_add_entry_rw(&bdb->bi_cache, e, CACHE_WRITE_LOCK) != 0)
{
text = "cache add failed";
goto return_results;
}
Debug( LDAP_DEBUG_TRACE,
"bdb_add: added id=%08lx dn=\"%s\"\n",
e->e_id, e->e_dn, 0 );
"bdb_add: added%s id=%08lx dn=\"%s\"\n",
op->o_noop ? " (no-op)" : "",
e->e_id, e->e_dn );
rc = LDAP_SUCCESS;
text = NULL;
}
bdb_cache_entry_commit (e);
bdb_cache_entry_commit( e );
return_results:
send_ldap_result( conn, op, rc,

View File

@ -332,21 +332,27 @@ retry: /* transaction retry */
ldap_pvt_thread_mutex_unlock( &bdb->bi_lastid_mutex );
#endif
rc = txn_commit( ltid, 0 );
if( op->o_noop ) {
rc = txn_abort( ltid );
} else {
rc = txn_commit( ltid, 0 );
}
ltid = NULL;
op->o_private = NULL;
if( rc != 0 ) {
Debug( LDAP_DEBUG_TRACE,
"bdb_delete: txn_commit failed: %s (%d)\n",
db_strerror(rc), rc, 0 );
"bdb_delete: txn_%s failed: %s (%d)\n",
op->o_noop ? "abort (no-op)" : "commit",
db_strerror(rc), rc );
rc = LDAP_OTHER;
text = "commit failed";
} else {
Debug( LDAP_DEBUG_TRACE,
"bdb_delete: deleted id=%08lx dn=\"%s\"\n",
e->e_id, e->e_dn, 0 );
"bdb_delete: deleted%s id=%08lx dn=\"%s\"\n",
op->o_noop ? " (no-op)" : "",
e->e_id, e->e_dn );
rc = LDAP_SUCCESS;
text = NULL;
}

View File

@ -135,8 +135,9 @@ int bdb_id2entry_rw(
bdb_fix_dn(be, id, *e);
#endif
if (rc == 0)
if (rc == 0) {
bdb_cache_entry_commit(*e);
}
return rc;
}

View File

@ -401,9 +401,7 @@ bdb_initialize(
static char *controls[] = {
LDAP_CONTROL_MANAGEDSAIT,
LDAP_CONTROL_SUBENTRIES,
#if 0
LDAP_CONTROL_NOOP,
#endif
NULL
};

View File

@ -328,20 +328,26 @@ retry: /* transaction retry */
goto return_results;
}
rc = txn_commit( ltid, 0 );
if( op->o_noop ) {
rc = txn_abort( ltid );
} else {
rc = txn_commit( ltid, 0 );
}
ltid = NULL;
op->o_private = NULL;
if( rc != 0 ) {
Debug( LDAP_DEBUG_TRACE,
"bdb_modify: txn_commit failed: %s (%d)\n",
db_strerror(rc), rc, 0 );
"bdb_modify: txn_%s failed: %s (%d)\n",
op->o_noop ? "abort (no-op)" : "commit",
db_strerror(rc), rc );
rc = LDAP_OTHER;
text = "commit failed";
} else {
Debug( LDAP_DEBUG_TRACE,
"bdb_modify: updated id=%08lx dn=\"%s\"\n",
"bdb_modify: updated%s id=%08lx dn=\"%s\"\n",
op->o_noop ? " (no-op)" : "",
e->e_id, e->e_dn, 0 );
rc = LDAP_SUCCESS;
text = NULL;

View File

@ -620,21 +620,28 @@ retry: /* transaction retry */
goto return_results;
}
rc = txn_commit( ltid, 0 );
if( op->o_noop ) {
rc = txn_abort( ltid );
} else {
rc = txn_commit( ltid, 0 );
}
ltid = NULL;
op->o_private = NULL;
if( rc != 0 ) {
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: txn_commit failed: %s (%d)\n",
db_strerror(rc), rc, 0 );
"bdb_modrdn: txn_%s failed: %s (%d)\n",
op->o_noop ? "abort (no-op)" : "commit",
db_strerror(rc), rc );
rc = LDAP_OTHER;
text = "commit failed";
} else {
(void) bdb_cache_update_entry(&bdb->bi_cache, e);
Debug( LDAP_DEBUG_TRACE,
"bdb_modrdn: added id=%08lx dn=\"%s\"\n",
e->e_id, e->e_dn, 0 );
"bdb_modrdn: added%s id=%08lx dn=\"%s\"\n",
op->o_noop ? " (no-op)" : "",
e->e_id, e->e_dn );
rc = LDAP_SUCCESS;
text = NULL;
bdb_cache_entry_commit( e );

View File

@ -198,7 +198,11 @@ retry: /* transaction retry */
}
if( rc == 0 ) {
rc = txn_commit( ltid, 0 );
if( op->o_noop ) {
rc = txn_abort( ltid );
} else {
rc = txn_commit( ltid, 0 );
}
ltid = NULL;
}
op->o_private = NULL;