Commit 8a4cb681 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:4890], make toku_txn_start_txn and toku_txn_create_txn be void functions

git-svn-id: file:///svn/toku/tokudb@43732 c7de825b-a66e-492c-adef-691d508d4ae1
parent 4f2f0f53
...@@ -82,10 +82,9 @@ toku_txn_begin_with_xid ( ...@@ -82,10 +82,9 @@ toku_txn_begin_with_xid (
DB_TXN *container_db_txn DB_TXN *container_db_txn
) )
{ {
int r = toku_txn_create_txn(tokutxn, parent_tokutxn, logger, xid, snapshot_type, container_db_txn); toku_txn_create_txn(tokutxn, parent_tokutxn, logger, xid, snapshot_type, container_db_txn);
if (r == 0) toku_txn_start_txn(*tokutxn);
r = toku_txn_start_txn(*tokutxn); return 0;
return r;
} }
DB_TXN * DB_TXN *
...@@ -174,7 +173,7 @@ static void invalidate_xa_xid (TOKU_XA_XID *xid) { ...@@ -174,7 +173,7 @@ static void invalidate_xa_xid (TOKU_XA_XID *xid) {
xid->formatID = -1; // According to the XA spec, -1 means "invalid data" xid->formatID = -1; // According to the XA spec, -1 means "invalid data"
} }
int void
toku_txn_create_txn ( toku_txn_create_txn (
TOKUTXN *tokutxn, TOKUTXN *tokutxn,
TOKUTXN parent_tokutxn, TOKUTXN parent_tokutxn,
...@@ -235,10 +234,9 @@ toku_txn_create_txn ( ...@@ -235,10 +234,9 @@ toku_txn_create_txn (
if (garbage_collection_debug) { if (garbage_collection_debug) {
verify_snapshot_system(logger); verify_snapshot_system(logger);
} }
return 0;
} }
int void
toku_txn_start_txn(TOKUTXN txn) { toku_txn_start_txn(TOKUTXN txn) {
TOKULOGGER logger = txn->logger; TOKULOGGER logger = txn->logger;
TOKUTXN parent = txn->parent; TOKUTXN parent = txn->parent;
...@@ -322,7 +320,6 @@ toku_txn_start_txn(TOKUTXN txn) { ...@@ -322,7 +320,6 @@ toku_txn_start_txn(TOKUTXN txn) {
} }
} }
toku_mutex_unlock(&logger->txn_list_lock); toku_mutex_unlock(&logger->txn_list_lock);
return 0;
} }
//Used on recovery to recover a transaction. //Used on recovery to recover a transaction.
......
...@@ -32,10 +32,10 @@ int toku_txn_begin_with_xid ( ...@@ -32,10 +32,10 @@ int toku_txn_begin_with_xid (
); );
// Allocate and initialize a txn // Allocate and initialize a txn
int toku_txn_create_txn(TOKUTXN *txn_ptr, TOKUTXN parent, TOKULOGGER logger, TXNID xid, TXN_SNAPSHOT_TYPE snapshot_type, DB_TXN *container_db_txn); void toku_txn_create_txn(TOKUTXN *txn_ptr, TOKUTXN parent, TOKULOGGER logger, TXNID xid, TXN_SNAPSHOT_TYPE snapshot_type, DB_TXN *container_db_txn);
// Assign a txnid. Log the txn begin in the recovery log. Initialize the txn live lists. // Assign a txnid. Log the txn begin in the recovery log. Initialize the txn live lists.
int toku_txn_start_txn(TOKUTXN txn); void toku_txn_start_txn(TOKUTXN txn);
int toku_txn_load_txninfo (TOKUTXN txn, TXNINFO info); int toku_txn_load_txninfo (TOKUTXN txn, TXNINFO info);
......
...@@ -480,22 +480,21 @@ toku_txn_begin(DB_ENV *env, DB_TXN * stxn, DB_TXN ** txn, u_int32_t flags, bool ...@@ -480,22 +480,21 @@ toku_txn_begin(DB_ENV *env, DB_TXN * stxn, DB_TXN ** txn, u_int32_t flags, bool
break; break;
} }
} }
r = toku_txn_create_txn(&db_txn_struct_i(result)->tokutxn, toku_txn_create_txn(
stxn ? db_txn_struct_i(stxn)->tokutxn : 0, &db_txn_struct_i(result)->tokutxn,
env->i->logger, stxn ? db_txn_struct_i(stxn)->tokutxn : 0,
TXNID_NONE, env->i->logger,
snapshot_type, TXNID_NONE,
result snapshot_type,
); result
if (r != 0) );
return r; if (!holds_ydb_lock) {
if (!holds_ydb_lock)
toku_ydb_lock(); toku_ydb_lock();
r = toku_txn_start_txn(db_txn_struct_i(result)->tokutxn); }
if (!holds_ydb_lock) toku_txn_start_txn(db_txn_struct_i(result)->tokutxn);
if (!holds_ydb_lock) {
toku_ydb_unlock(); toku_ydb_unlock();
if (r != 0) }
return r;
//Add to the list of children for the parent. //Add to the list of children for the parent.
if (result->parent) { if (result->parent) {
......
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