int tdb_ret = 0;
int ret;
- if (ltdb->in_transaction == 0 &&
+ if (tdb_transaction_active(ltdb->tdb) == false &&
ltdb->read_lock_count == 0) {
tdb_ret = tdb_lockall_read(ltdb->tdb);
}
{
void *data = ldb_module_get_private(module);
struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private);
- if (ltdb->in_transaction == 0 && ltdb->read_lock_count == 1) {
+ if (!tdb_transaction_active(ltdb->tdb) && ltdb->read_lock_count == 1) {
tdb_unlockall_read(ltdb->tdb);
ltdb->read_lock_count--;
return 0;
/* only allow modifies inside a transaction, otherwise the
* ldb is unsafe */
- if (ltdb->in_transaction == 0) {
+ if (ltdb->kv_ops->transaction_active(ltdb) == false) {
ldb_set_errstring(ldb_module_get_ctx(module), "ltdb modify without transaction");
return LDB_ERR_OPERATIONS_ERROR;
}
return ltdb->kv_ops->error(ltdb);
}
- ltdb->in_transaction++;
ltdb_index_transaction_start(module);
void *data = ldb_module_get_private(module);
struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private);
- if (ltdb->in_transaction != 1) {
- return LDB_SUCCESS;
+ if (!ltdb->kv_ops->transaction_active(ltdb)) {
+ ldb_set_errstring(ldb_module_get_ctx(module),
+ "ltdb_prepare_commit() called "
+ "without transaction active");
+ return LDB_ERR_OPERATIONS_ERROR;
}
/*
ret = ltdb_index_transaction_commit(module);
if (ret != LDB_SUCCESS) {
ltdb->kv_ops->abort_write(ltdb);
- ltdb->in_transaction--;
return ret;
}
if (ltdb->kv_ops->prepare_write(ltdb) != 0) {
ret = ltdb->kv_ops->error(ltdb);
- ltdb->in_transaction--;
ldb_debug_set(ldb_module_get_ctx(module),
LDB_DEBUG_FATAL,
"Failure during "
}
}
- ltdb->in_transaction--;
ltdb->prepared_commit = false;
if (ltdb->kv_ops->finish_write(ltdb) != 0) {
void *data = ldb_module_get_private(module);
struct ltdb_private *ltdb = talloc_get_type(data, struct ltdb_private);
- ltdb->in_transaction--;
if (ltdb_index_transaction_cancel(module) != 0) {
ltdb->kv_ops->abort_write(ltdb);
.ctx = ctx,
.ltdb = ltdb
};
- if (ltdb->in_transaction != 0) {
+ if (tdb_transaction_active(ltdb->tdb)) {
return tdb_traverse(ltdb->tdb, ldb_tdb_traverse_fn_wrapper, &kv_ctx);
} else {
return tdb_traverse_read(ltdb->tdb, ldb_tdb_traverse_fn_wrapper, &kv_ctx);
path = url;
}
- tdb_flags = TDB_DEFAULT | TDB_SEQNUM;
+ tdb_flags = TDB_DEFAULT | TDB_SEQNUM | TDB_DISALLOW_NESTING;
/* check for the 'nosync' option */
if (flags & LDB_FLG_NOSYNC) {