Skip to content

Commit

Permalink
MDEV-10247 TokuDB assertion error when building with DEBUG
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
cvicentiu committed Jun 17, 2016
1 parent 12ae840 commit 7ff86b4
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions storage/tokudb/ft-index/ft/txn/txn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -336,17 +336,26 @@ static txn_child_manager tcm;
.xa_xid = {0, 0, 0, {}},
.progress_poll_fun = 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,
.roll_info = roll_info,
.state_lock = TOKU_MUTEX_INITIALIZER,
.state_cond = TOKU_COND_INITIALIZER,
.state_lock = {}, // Needs to be set to 0.
.state_cond = {}, // Needs to be set to 0.
.state = TOKUTXN_LIVE,
.num_pin = 0,
.client_id = 0,
.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;
XMEMDUP(result, &new_txn);
invalidate_xa_xid(&result->xa_xid);
Expand Down

0 comments on commit 7ff86b4

Please sign in to comment.