DbTxn::abort

APIRef

#include <db_cxx.h>

int DbTxn::abort();

Description

The DbTxn::abort method 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 DbEnv::open. After the log processing is completed, all locks held by the transaction are released. As is the case for DbTxn::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 DbTxn::abort has been called, regardless of its return, the DbTxn handle may not be accessed again.

The DbTxn::abort method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 0 on success.

Errors

The DbTxn::abort method may fail and throw an exception or return a non-zero error for errors specified for other Berkeley DB and C library or system methods. If a catastrophic error has occurred, the DbTxn::abort method may fail and either return DB_RUNRECOVERY or throw a DbRunRecoveryException, in which case all subsequent Berkeley DB calls will fail in the same way.

Class

DbEnv, DbTxn

See Also

Transaction Subsystem and Related Methods

APIRef

Copyright Sleepycat Software