-I'Berkeley DB: txn_prepare[P

txn_prepare





#include <db.h>

inttxn_prepare(DB_TXN *tid);





Description



GThe txn_prepare function initiates the beginning of a two-phase commit.

LIn a distributed transaction environment, Berkeley DB can be used as a localGtransaction manager. In this case, the distributed transaction managerCmust send prepare messages to each local manager. The local>manager must then issue a txn_prepare and await its successfulFreturn before responding to the distributed transaction manager. OnlyGafter the distributed transaction manager receives successful responses;from all of its prepare messages should it issue anycommit messages.

The txn_prepareHfunction returns the value of errno on failure, and 0 on success.



Errors

TIf a fatal error occurs in Berkeley DB, the txn_prepare function may fail and returnFDB_RUNRECOVERY, at which point all subsequent database calls will alsoreturn DB_RUNRECOVERY.

The txn_prepare)function may fail and return errnoKfor any of the errors specified for the following Berkeley DB and C library functions: abort(3), fcntl(3), fflush(3), fprintf(3),free(3), getpid(3),1log_put, malloc(3), memcpy(3), memset(3), strerror(3), vfprintf(3),and vsnprintf(3).



See Also

5txn_abort,8txn_begin,Btxn_checkpoint,8txn_close,7txn_commit,/txn_id,6txn_open, txn_prepare,5txn_statand:txn_unlink.
ÿÿ