txn_abort

APIRef

#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 DBENV->open. After the log processing is completed, all locks held by the transaction are released. 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 a non-zero error value on failure and 0 on success.

Errors

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

In addition, the txn_abort function may fail and return a non-zero error for the following conditions:

EINVAL
The transaction was already aborted.

In addition, the txn_abort function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions.

See Also

DBENV->set_tx_max, DBENV->set_tx_recover, txn_abort, txn_begin, txn_checkpoint, txn_commit, txn_id, txn_prepare and txn_stat.

APIRef

Copyright Sleepycat Software