Skip to content

Commit

Permalink
memtx: remove dead code
Browse files Browse the repository at this point in the history
The function memtx_tx_story_delete is expected to delete fully
unlinked stories and thus should not try to unlink something by
itself. So remove unlink and add asserts instead.

Part of #8648
Part of #8654

NO_DOC=refactoring
NO_TEST=refactoring
NO_CHANGELOG=refactoring

(cherry picked from commit 0706740)
  • Loading branch information
alyapunov committed Jun 23, 2023
1 parent a0d7a95 commit 4981aaa
Showing 1 changed file with 8 additions and 21 deletions.
29 changes: 8 additions & 21 deletions src/box/memtx_tx.c
Expand Up @@ -949,24 +949,19 @@ memtx_tx_story_new(struct space *space, struct tuple *tuple)
static void
memtx_tx_story_delete(struct memtx_story *story)
{
/* Expecting to delete fully unlinked story. */
assert(story->add_stmt == NULL);
assert(story->del_stmt == NULL);
for (uint32_t i = 0; i < story->index_count; i++) {
assert(story->link[i].newer_story == NULL);
assert(story->link[i].older_story == NULL);
}

memtx_tx_stats_discard(&txm.story_stats[story->status],
memtx_story_size(story));
if (story->tuple_is_retained)
memtx_tx_story_untrack_retained_tuple(story);

if (story->add_stmt != NULL) {
assert(story->add_stmt->add_story == story);
story->add_stmt->add_story = NULL;
story->add_stmt = NULL;
}
while (story->del_stmt != NULL) {
assert(story->del_stmt->del_story == story);
story->del_stmt->del_story = NULL;
struct txn_stmt *next = story->del_stmt->next_in_del_list;
story->del_stmt->next_in_del_list = NULL;
story->del_stmt = next;
}

if (txm.traverse_all_stories == &story->in_all_stories)
txm.traverse_all_stories = rlist_next(txm.traverse_all_stories);
rlist_del(&story->in_all_stories);
Expand All @@ -979,14 +974,6 @@ memtx_tx_story_delete(struct memtx_story *story)
story->tuple->is_dirty = false;
tuple_unref(story->tuple);

#ifndef NDEBUG
/* Expecting to delete fully unlinked story. */
for (uint32_t i = 0; i < story->index_count; i++) {
assert(story->link[i].newer_story == NULL);
assert(story->link[i].older_story == NULL);
}
#endif

struct mempool *pool = &txm.memtx_tx_story_pool[story->index_count];
mempool_free(pool, story);
}
Expand Down

0 comments on commit 4981aaa

Please sign in to comment.