Berkeley DB: txn_abort
Полезная информация

txn_abort


#include <db.h>

int txn_abort(DB_TXN *tid);

Description

The txn_abort function causes an abnormal termination of the transaction.

The log is played backwards and any necessary recovery operations are initiated through the recover function specified to txn_open. After recovery is completed, all locks held by the transaction are acquired by the parent transaction in the case of a nested transaction or released in the case of a non-nested transaction. As is the case for txn_commit, applications that require strict two-phase locking should not explicitly release any locks.

In the case of nested transactions, aborting the parent transaction causes all children of that transaction to be aborted.

The txn_abort function returns the value of errno on failure, and 0 on success.

Errors

If a fatal error occurs in Berkeley DB, the txn_abort function may fail and return DB_RUNRECOVERY, at which point all subsequent database calls will also return DB_RUNRECOVERY.

The txn_abort function may fail and return errno for any of the errors specified for the following Berkeley DB and C library functions: DBenv->tx_recover, abort(3), fcntl(3), fflush(3), fprintf(3), free(3), getpid(3), lock_vec, log_get, memset(3), strerror(3), vfprintf(3), and vsnprintf(3).

In addition, the txn_abort function may fail and return errno for the following conditions:

EINVAL
The transaction was already aborted.

See Also

txn_abort, txn_begin, txn_checkpoint, txn_close, txn_commit, txn_id, txn_open, txn_prepare, txn_stat and txn_unlink.