DB-785 add a txn api to check if a txn is prepared

This commit is contained in:
Rich Prohaska 2015-01-02 09:50:26 -05:00
parent ef0269a5f7
commit 906c8b2794
2 changed files with 7 additions and 0 deletions

View file

@ -585,6 +585,7 @@ static void print_db_txn_struct (void) {
"uint64_t (*id64) (DB_TXN*)",
"void (*set_client_id)(DB_TXN *, uint64_t client_id)",
"uint64_t (*get_client_id)(DB_TXN *)",
"bool (*is_prepared)(DB_TXN *)",
NULL};
sort_and_dump_fields("db_txn", false, extra);
}

View file

@ -421,6 +421,11 @@ static int toku_txn_discard(DB_TXN *txn, uint32_t flags) {
return 0;
}
static bool toku_txn_is_prepared(DB_TXN *txn) {
TOKUTXN ttxn = db_txn_struct_i(txn)->tokutxn;
return toku_txn_get_state(ttxn) == TOKUTXN_PREPARING;
}
static inline void txn_func_init(DB_TXN *txn) {
#define STXN(name) txn->name = locked_txn_ ## name
STXN(abort);
@ -437,6 +442,7 @@ static inline void txn_func_init(DB_TXN *txn) {
SUTXN(discard);
#undef SUTXN
txn->id64 = toku_txn_id64;
txn->is_prepared = toku_txn_is_prepared;
}
//