Commit 906c8b27 authored by Rich Prohaska's avatar Rich Prohaska

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

parent ef0269a5
......@@ -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);
}
......
......@@ -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;
}
//
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment