usual. This allows for smooth crash recovery with no administrator
intervention.
- - if TDB1_NOSYNC is passed to flags in tdb1_open then transactions are
+ - if TDB_NOSYNC is passed to flags in tdb1_open then transactions are
still available, but no transaction recovery area is used and no
fsync/msync calls are made.
- - if TDB1_ALLOW_NESTING is passed to flags in tdb open, or added using
+ - if TDB_ALLOW_NESTING is passed to flags in tdb open, or added using
tdb1_add_flags() transaction nesting is enabled.
- It resets the TDB1_DISALLOW_NESTING flag, as both cannot be used together.
- The default is that transaction nesting is allowed.
- Note: this default may change in future versions of tdb.
+ The default is that transaction nesting is NOT allowed.
Beware. when transactions are nested a transaction successfully
completed with tdb1_transaction_commit() can be silently unrolled later.
-
- - if TDB1_DISALLOW_NESTING is passed to flags in tdb open, or added using
- tdb1_add_flags() transaction nesting is disabled.
- It resets the TDB1_ALLOW_NESTING flag, as both cannot be used together.
- An attempt create a nested transaction will fail with TDB_ERR_EINVAL.
- The default is that transaction nesting is allowed.
- Note: this default may change in future versions of tdb.
*/
static int _tdb1_transaction_start(struct tdb1_context *tdb)
{
/* some sanity checks */
- if (tdb->read_only || (tdb->flags & TDB1_INTERNAL) || tdb->traverse_read) {
+ if (tdb->read_only || (tdb->flags & TDB_INTERNAL) || tdb->traverse_read) {
tdb->last_error = tdb_logerr(tdb, TDB_ERR_EINVAL, TDB_LOG_USE_ERROR,
"tdb1_transaction_start: cannot start a"
" transaction on a read-only or"
/* cope with nested tdb1_transaction_start() calls */
if (tdb->transaction != NULL) {
- if (!(tdb->flags & TDB1_ALLOW_NESTING)) {
+ if (!(tdb->flags & TDB_ALLOW_NESTING)) {
tdb->last_error = TDB_ERR_EINVAL;
return -1;
}
/* get the transaction write lock. This is a blocking lock. As
discussed with Volker, there are a number of ways we could
make this async, which we will probably do in the future */
- if (tdb1_transaction_lock(tdb, F_WRLCK, TDB1_LOCK_WAIT) == -1) {
+ if (tdb1_transaction_lock(tdb, F_WRLCK, TDB_LOCK_WAIT) == -1) {
SAFE_FREE(tdb->transaction->blocks);
SAFE_FREE(tdb->transaction);
return -1;
/* get a read lock from the freelist to the end of file. This
is upgraded to a write lock during the commit */
- if (tdb1_allrecord_lock(tdb, F_RDLCK, TDB1_LOCK_WAIT, true) == -1) {
+ if (tdb1_allrecord_lock(tdb, F_RDLCK, TDB_LOCK_WAIT, true) == -1) {
tdb_logerr(tdb, tdb->last_error, TDB_LOG_ERROR,
"tdb1_transaction_start: failed to get hash locks");
goto fail_allrecord_lock;
*/
static int transaction1_sync(struct tdb1_context *tdb, tdb1_off_t offset, tdb1_len_t length)
{
- if (tdb->flags & TDB1_NOSYNC) {
+ if (tdb->flags & TDB_NOSYNC) {
return 0;
}
/* get the open lock - this prevents new users attaching to the database
during the commit */
- if (tdb1_nest_lock(tdb, TDB1_OPEN_LOCK, F_WRLCK, TDB1_LOCK_WAIT) == -1) {
+ if (tdb1_nest_lock(tdb, TDB1_OPEN_LOCK, F_WRLCK, TDB_LOCK_WAIT) == -1) {
tdb_logerr(tdb, tdb->last_error, TDB_LOG_ERROR,
"tdb1_transaction_prepare_commit:"
" failed to get open lock");
return -1;
}
- if (!(tdb->flags & TDB1_NOSYNC)) {
+ if (!(tdb->flags & TDB_NOSYNC)) {
/* write the recovery data to the end of the file */
if (transaction1_setup_recovery(tdb, &tdb->transaction->magic_offset) == -1) {
tdb_logerr(tdb, tdb->last_error, TDB_LOG_ERROR,