DbTxn::discard

APIRef

#include <db_cxx.h>

int DbTxn::discard(u_int32_t flags);

Description

The DbTxn::discard method frees up all the per-process resources associated with the specified DbTxn handle, neither committing nor aborting the transaction. This call may be used only after calls to DbEnv::txn_recover when there are multiple global transaction managers recovering transactions in a single Berkeley DB environment. Any transactions returned by DbEnv::txn_recover that are not handled by the current global transaction manager should be discarded using DbTxn::discard.

The flags parameter is currently unused, and must be set to 0.

The DbTxn::discard method returns EINVAL if the transaction handle does not refer to a transaction that was recovered into a prepared but not yet completed state.

Otherwise, the DbTxn::discard 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.

After DbTxn::discard has been called, regardless of its return, the DbTxn handle may not be accessed again.

Errors

The DbTxn::discard method may fail and throw an exception or return a non-zero error for the following conditions:

EINVAL
An invalid flag value or parameter was specified.

The transaction handle does not refer to a transaction that was recovered into a prepared but not yet completed state.

The DbTxn::discard 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::discard method may fail and either return DB_RUNRECOVERY or throw an exception encapsulating DB_RUNRECOVERY, in which case all subsequent Berkeley DB calls will fail in the same way.

Class

DbEnv, DbTxn

See Also

DbEnv::set_tx_max, DbEnv::set_tx_recover, DbEnv::set_tx_timestamp, DbTxn::abort, DbEnv::txn_begin, DbEnv::txn_checkpoint, DbTxn::commit, DbTxn::discard, DbTxn::id, DbTxn::prepare, DbEnv::txn_recover, and DbEnv::txn_stat.

APIRef

Copyright Sleepycat Software