Commit dc485699 authored by Yoni Fogel's avatar Yoni Fogel

refs #5170 Fix memory allocation (and use macros) during hot indexing.

Also make some invariants cleaner

git-svn-id: file:///svn/toku/tokudb@45075 c7de825b-a66e-492c-adef-691d508d4ae1
parent 92be5bc8
......@@ -125,8 +125,7 @@ indexer_undo_do_committed(DB_INDEXER *indexer, DB *hotdb, ULEHANDLE ule) {
break;
// placeholders in the committed stack are not allowed
if (uxr_is_placeholder(uxr))
assert(0);
invariant(!uxr_is_placeholder(uxr));
// undo
if (xrindex > 0) {
......@@ -292,7 +291,7 @@ indexer_undo_do_provisional(DB_INDEXER *indexer, DB *hotdb, ULEHANDLE ule, struc
switch (outermost_xid_state) {
case TOKUTXN_LIVE:
case TOKUTXN_PREPARING:
assert(this_xid_state != TOKUTXN_ABORTING);
invariant(this_xid_state != TOKUTXN_ABORTING);
result = indexer_ft_delete_provisional(indexer, hotdb, &indexer->i->hotkey, xids, curr_txn);
if (result == 0)
result = indexer_lock_key(indexer, hotdb, &indexer->i->hotkey, prov_ids[0], curr_txn);
......
......@@ -290,9 +290,9 @@ ule_prov_info_init(struct ule_prov_info *prov_info, LEAFENTRY le, ULEHANDLE ule)
prov_info->num_committed = ule_get_num_committed(ule);
uint32_t n = prov_info->num_provisional;
if (n > 0) {
prov_info->prov_ids = toku_malloc(n * sizeof(prov_info->prov_ids));
prov_info->prov_states = toku_malloc(n * sizeof(prov_info->prov_states));
prov_info->prov_txns = toku_malloc(n * sizeof(prov_info->prov_txns));
XMALLOC_N(n, prov_info->prov_ids);
XMALLOC_N(n, prov_info->prov_states);
XMALLOC_N(n, prov_info->prov_txns);
}
}
......
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