Debug(LDAP_DEBUG_ARGS, "==> " LDAP_XSTRING(bdb_add) ": %s\n",
op->oq_add.rs_e->e_name.bv_val, 0, 0);
+ if( op->o_txnSpec ) {
+ /* acquire connection lock */
+ ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
+ if( op->o_conn->c_txn == 0 ) {
+ rs->sr_text = "invalid transaction identifier";
+ rs->sr_err = LDAP_X_TXN_ID_INVALID;
+ goto txnReturn;
+ }
+ if( op->o_conn->c_txn_backend == NULL ) {
+ op->o_conn->c_txn_backend = op->o_bd;
+
+ } else if( op->o_conn->c_txn_backend != op->o_bd ) {
+ rs->sr_text = "transaction cannot span multiple database contexts";
+ rs->sr_err = LDAP_AFFECTS_MULTIPLE_DSAS;
+ goto txnReturn;
+ }
+
+ /* insert operation into transaction */
+
+ rs->sr_text = "transaction specified";
+ rs->sr_err = LDAP_SUCCESS;
+
+txnReturn:
+ /* release connection lock */
+ ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
+
+ send_ldap_result( op, rs );
+ return rs->sr_err;
+ }
+
ctrls[num_ctrls] = 0;
/* add opattrs to shadow as well, only missing attrs will actually
int parent_is_glue = 0;
int parent_is_leaf = 0;
- ctrls[num_ctrls] = 0;
-
Debug( LDAP_DEBUG_ARGS, "==> " LDAP_XSTRING(bdb_delete) ": %s\n",
op->o_req_dn.bv_val, 0, 0 );
+ if( op->o_txnSpec ) {
+ /* acquire connection lock */
+ ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
+ if( op->o_conn->c_txn == 0 ) {
+ rs->sr_text = "invalid transaction identifier";
+ rs->sr_err = LDAP_X_TXN_ID_INVALID;
+ goto txnReturn;
+ }
+ if( op->o_conn->c_txn_backend == NULL ) {
+ op->o_conn->c_txn_backend = op->o_bd;
+
+ } else if( op->o_conn->c_txn_backend != op->o_bd ) {
+ rs->sr_text = "transaction cannot span multiple database contexts";
+ rs->sr_err = LDAP_AFFECTS_MULTIPLE_DSAS;
+ goto txnReturn;
+ }
+
+ /* insert operation into transaction */
+
+ rs->sr_text = "transaction specified";
+ rs->sr_err = LDAP_SUCCESS;
+
+txnReturn:
+ /* release connection lock */
+ ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
+
+ send_ldap_result( op, rs );
+ return rs->sr_err;
+ }
+
+ ctrls[num_ctrls] = 0;
+
/* allocate CSN */
if ( BER_BVISEMPTY( &op->o_csn )) {
struct berval csn;
#ifdef SLAP_ZONE_ALLOC
if ( bdb->bi_cache.c_maxsize ) {
bdb->bi_cache.c_zctx = slap_zn_mem_create(
- SLAP_ZONE_INITSIZE,
- SLAP_ZONE_MAXSIZE,
- SLAP_ZONE_DELTA,
- SLAP_ZONE_SIZE);
+ SLAP_ZONE_INITSIZE, SLAP_ZONE_MAXSIZE,
+ SLAP_ZONE_DELTA, SLAP_ZONE_SIZE);
}
#endif
LDAP_CONTROL_PAGEDRESULTS,
LDAP_CONTROL_SUBENTRIES,
LDAP_CONTROL_X_PERMISSIVE_MODIFY,
+#ifdef LDAP_X_TXN
+ LDAP_CONTROL_X_TXN_SPEC,
+#endif
NULL
};
Debug( LDAP_DEBUG_ARGS, LDAP_XSTRING(bdb_modify) ": %s\n",
op->o_req_dn.bv_val, 0, 0 );
+ if( op->o_txnSpec ) {
+ /* acquire connection lock */
+ ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
+ if( op->o_conn->c_txn == 0 ) {
+ rs->sr_text = "invalid transaction identifier";
+ rs->sr_err = LDAP_X_TXN_ID_INVALID;
+ goto txnReturn;
+ }
+ if( op->o_conn->c_txn_backend == NULL ) {
+ op->o_conn->c_txn_backend = op->o_bd;
+
+ } else if( op->o_conn->c_txn_backend != op->o_bd ) {
+ rs->sr_text = "transaction cannot span multiple database contexts";
+ rs->sr_err = LDAP_AFFECTS_MULTIPLE_DSAS;
+ goto txnReturn;
+ }
+
+ /* insert operation into transaction */
+
+ rs->sr_text = "transaction specified";
+ rs->sr_err = LDAP_SUCCESS;
+
+txnReturn:
+ /* release connection lock */
+ ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
+
+ send_ldap_result( op, rs );
+ return rs->sr_err;
+ }
+
ctrls[num_ctrls] = NULL;
slap_mods_opattrs( op, &op->orm_modlist, 1 );
int parent_is_glue = 0;
int parent_is_leaf = 0;
- ctrls[num_ctrls] = NULL;
-
Debug( LDAP_DEBUG_TRACE, "==>" LDAP_XSTRING(bdb_modrdn) "(%s,%s,%s)\n",
op->o_req_dn.bv_val,op->oq_modrdn.rs_newrdn.bv_val,
op->oq_modrdn.rs_newSup ? op->oq_modrdn.rs_newSup->bv_val : "NULL" );
+ if( op->o_txnSpec ) {
+ /* acquire connection lock */
+ ldap_pvt_thread_mutex_lock( &op->o_conn->c_mutex );
+ if( op->o_conn->c_txn == 0 ) {
+ rs->sr_text = "invalid transaction identifier";
+ rs->sr_err = LDAP_X_TXN_ID_INVALID;
+ goto txnReturn;
+ }
+ if( op->o_conn->c_txn_backend == NULL ) {
+ op->o_conn->c_txn_backend = op->o_bd;
+
+ } else if( op->o_conn->c_txn_backend != op->o_bd ) {
+ rs->sr_text = "transaction cannot span multiple database contexts";
+ rs->sr_err = LDAP_AFFECTS_MULTIPLE_DSAS;
+ goto txnReturn;
+ }
+
+ /* insert operation into transaction */
+
+ rs->sr_text = "transaction specified";
+ rs->sr_err = LDAP_SUCCESS;
+
+txnReturn:
+ /* release connection lock */
+ ldap_pvt_thread_mutex_unlock( &op->o_conn->c_mutex );
+
+ send_ldap_result( op, rs );
+ return rs->sr_err;
+ }
+
+ ctrls[num_ctrls] = NULL;
+
slap_mods_opattrs( op, &op->orr_modlist, 1 );
if( 0 ) {
LDAP_STAILQ_INIT(&c->c_ops);
LDAP_STAILQ_INIT(&c->c_pending_ops);
+#ifdef LDAP_X_TXN
+ c->c_txn = 0;
+ c->c_txn_backend = NULL;
+ LDAP_STAILQ_INIT(&c->c_txn_ops);
+#endif
+
BER_BVZERO( &c->c_sasl_bind_mech );
c->c_sasl_done = 0;
c->c_sasl_authctx = NULL;
assert( BER_BVISNULL( &c->c_peer_name ) );
assert( LDAP_STAILQ_EMPTY(&c->c_ops) );
assert( LDAP_STAILQ_EMPTY(&c->c_pending_ops) );
+#ifdef LDAP_X_TXN
+ assert( c->c_txn == 0 );
+ assert( c->c_txn_backend == NULL );
+ assert( LDAP_STAILQ_EMPTY(&c->c_txn_ops) );
+#endif
assert( BER_BVISNULL( &c->c_sasl_bind_mech ) );
assert( c->c_sasl_done == 0 );
assert( c->c_sasl_authctx == NULL );
struct slap_op *c_sasl_bindop; /* set to current op if it's a bind */
#ifdef LDAP_X_TXN
- int c_txn; /* in transaction */
+ int c_txn; /* true if transaction started */
+ Backend *c_txn_backend;
+ LDAP_STAILQ_HEAD(c_to, slap_op) c_txn_ops; /* list of operations in txn */
#endif
PagedResultsState c_pagedresults_state; /* paged result state */
goto done;
}
+ assert( op->o_conn->c_txn_backend == NULL );
++op->o_conn->c_txn;
bv = (struct berval *) ch_malloc( sizeof (struct berval) );
}
op->o_conn->c_txn = 0;
+ op->o_conn->c_txn_backend = NULL;
done:
/* release connection lock */