# DB_TXN->discard |

`

###

    #include <db.h>

    int
    DB_TXN->discard(DB_TXN *tid, u_int32_t flags);

# Description

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

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

The DB_TXN->discard function 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 DB_TXN->discard function returns a non-zero error value on failure and 0 on success.

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

# Errors

The DB_TXN->discard function may fail and 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 DB_TXN->discard 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->discard 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