Commit 7ff86b49 authored by Vicențiu Ciorbaru's avatar Vicențiu Ciorbaru

MDEV-10247 TokuDB assertion error when building with DEBUG

Fix the assertion failure by setting the struct to 0. This can not be
done using a macro due to different definitions of mutexes on various
OS-es.
Afterwards we call toku_mutex_init and completely initialize the locks.
parent 12ae8403
...@@ -336,17 +336,26 @@ static txn_child_manager tcm; ...@@ -336,17 +336,26 @@ static txn_child_manager tcm;
.xa_xid = {0, 0, 0, {}}, .xa_xid = {0, 0, 0, {}},
.progress_poll_fun = NULL, .progress_poll_fun = NULL,
.progress_poll_fun_extra = NULL, .progress_poll_fun_extra = NULL,
.txn_lock = TOKU_MUTEX_INITIALIZER, .txn_lock = {}, // Needs to be set to 0 after initialization.
// See:
// https://llvm.org/bugs/show_bug.cgi?id=21689
// and MDEV-10229
.open_fts = open_fts, .open_fts = open_fts,
.roll_info = roll_info, .roll_info = roll_info,
.state_lock = TOKU_MUTEX_INITIALIZER, .state_lock = {}, // Needs to be set to 0.
.state_cond = TOKU_COND_INITIALIZER, .state_cond = {}, // Needs to be set to 0.
.state = TOKUTXN_LIVE, .state = TOKUTXN_LIVE,
.num_pin = 0, .num_pin = 0,
.client_id = 0, .client_id = 0,
.start_time = time(NULL), .start_time = time(NULL),
}; };
// We initialize the locks afterwards, but to prevent undefined behaviour
// we zero-out the structures containing them.
ZERO_STRUCT(new_txn.txn_lock);
ZERO_STRUCT(new_txn.state_lock);
ZERO_STRUCT(new_txn.state_cond);
TOKUTXN result = NULL; TOKUTXN result = NULL;
XMEMDUP(result, &new_txn); XMEMDUP(result, &new_txn);
invalidate_xa_xid(&result->xa_xid); invalidate_xa_xid(&result->xa_xid);
......
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