DbEnv::txn_recover

API Ref

#include <db_cxx.h>

int DbEnv::txn_recover(DB_PREPLIST preplist[], long count, long *retp, u_int32_t flags);


Description: DbEnv::txn_recover

The DbEnv::txn_recover method returns a list of prepared but not yet resolved transactions. The DbEnv::txn_recover method should only be called after the environment has been recovered. Because database environment state must be preserved between recovery and the application calling DbEnv::txn_recover, applications must either call DbEnv::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 DbEnv::txn_recover, the preplist parameter will be filled in with a list of transactions that must be resolved by the application (committed, aborted or discarded). The preplist parameter 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 DbTxn::abort, DbTxn::commit or DbTxn::discard on each returned DbTxn handle before starting any new operations.

The DbEnv::txn_recover 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.

Parameters

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

flags
The flags parameter 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 DbEnv::txn_recover left off.

preplist
The preplist parameter references memory into which the list of transactions to be resolved by the application is copied.

Class

DbEnv, DbTxn

See Also

Transaction Subsystem and Related Methods

APIRef

Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.