# DB_TXN->abort

`

###

    #include <db.h>

    int
    DB_TXN->abort(DB_TXN *tid);

# Description

The DB_TXN->abort function causes an abnormal termination of the transaction. The log is played backward, and any necessary recovery operations are initiated through the recover function specified to DB_ENV->open. After the log processing is completed, all locks held by the transaction are released. As is the case for DB_TXN->commit, applications that require strict two-phase locking should not explicitly release any locks.

In the case of nested transactions, aborting a parent transaction causes all children (unresolved or not) of the parent transaction to be aborted.

All cursors opened within the transaction must be closed before the transaction is aborted.

After DB_TXN->abort has been called, regardless of its return, the DB_TXN handle may not be accessed again.

The DB_TXN->abort function returns a non-zero error value on failure and 0 on success.

# Errors

The DB_TXN->abort function may fail and return a non-zero error for errors specified for other Berkeley DB and C library or system functions. If a catastrophic error has occurred, the DB_TXN->abort function may fail and return DB_RUNRECOVERY, in which case all subsequent Berkeley DB calls will fail in the same way.

# See Also

DB_ENV->set_tx_max, DB_ENV->set_tx_recover, DB_ENV->set_tx_timestamp, DB_TXN->abort, DB_ENV->txn_begin, DB_ENV->txn_checkpoint, DB_TXN->commit, DB_TXN->discard, DB_TXN->id, DB_TXN->prepare, DB_ENV->txn_recover, DB_TXN->set_timeout and DB_ENV->txn_stat.`

Copyright Sleepycat Software