Commit 068416d3 authored by Rich Prohaska's avatar Rich Prohaska

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

parent 8e193934
...@@ -585,6 +585,7 @@ static void print_db_txn_struct (void) { ...@@ -585,6 +585,7 @@ static void print_db_txn_struct (void) {
"uint64_t (*id64) (DB_TXN*)", "uint64_t (*id64) (DB_TXN*)",
"void (*set_client_id)(DB_TXN *, uint64_t client_id)", "void (*set_client_id)(DB_TXN *, uint64_t client_id)",
"uint64_t (*get_client_id)(DB_TXN *)", "uint64_t (*get_client_id)(DB_TXN *)",
"bool (*is_prepared)(DB_TXN *)",
NULL}; NULL};
sort_and_dump_fields("db_txn", false, extra); sort_and_dump_fields("db_txn", false, extra);
} }
......
...@@ -421,6 +421,11 @@ static int toku_txn_discard(DB_TXN *txn, uint32_t flags) { ...@@ -421,6 +421,11 @@ static int toku_txn_discard(DB_TXN *txn, uint32_t flags) {
return 0; 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) { static inline void txn_func_init(DB_TXN *txn) {
#define STXN(name) txn->name = locked_txn_ ## name #define STXN(name) txn->name = locked_txn_ ## name
STXN(abort); STXN(abort);
...@@ -437,6 +442,7 @@ static inline void txn_func_init(DB_TXN *txn) { ...@@ -437,6 +442,7 @@ static inline void txn_func_init(DB_TXN *txn) {
SUTXN(discard); SUTXN(discard);
#undef SUTXN #undef SUTXN
txn->id64 = toku_txn_id64; 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