# DB_ENV->txn_recover |

`

###

    #include <db.h>

    int
    DB_ENV->txn_recover(DB_ENV *dbenv, DB_PREPLIST preplist[],
        long count, long *retp, u_int32_t flags);

# Description

The DB_ENV->txn_recover interface returns a list of prepared but not yet resolved transactions. The DB_ENV->txn_recover function should only be called after the environment has been recovered. Because database environment state must be preserved between recovery and the application calling DB_ENV->txn_recover, applications must either call DB_ENV->txn_recover using the same environment handle used when recovery is done, or the database environment must not be configured using the DB_PRIVATE flag.

On return from DB_ENV->txn_recover, the preplist argument will be filled in with a list of transactions that must be resolved by the application (committed, aborted or discarded). The preplist argument is a structure of type DB_PREPLIST; the following DB_PREPLIST fields will be filled in:

DB_TXN *txn;
  The transaction handle for the transaction.

u_int8_t gid[DB_XIDDATASIZE];
  The global transaction ID for the transaction. The global transaction ID is the one specified when the transaction was prepared. The application is responsible for ensuring uniqueness among global transaction IDs.

The application must call DB_TXN->abort, DB_TXN->commit or DB_TXN->discard on each returned DB_TXN handle before starting any new operations.

The count parameter specifies the number of available entries in the passed-in preplist array. The retp parameter returns the number of entries DB_ENV->txn_recover has filled in, in the array.

The flags value must be set to one of the following values:

DB_FIRST
  Begin returning a list of prepared, but not yet resolved transactions.

DB_NEXT
  Continue returning a list of prepared, but not yet resolved transactions, starting where the last call to DB_ENV->txn_recover left off.

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

# Errors

The DB_ENV->txn_recover 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_ENV->txn_recover 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