Skip to content

Commit

Permalink
Simplify purge a little
Browse files Browse the repository at this point in the history
row_purge_step(): Process all available purge_node_t::undo_recs.

row_purge_end(): Replaced with purge_node_t::end().

TODO: Do we need a "query graph node" at all for purge?
  • Loading branch information
dr-m committed Oct 6, 2022
1 parent ea1415c commit 1b1501b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 51 deletions.
32 changes: 4 additions & 28 deletions storage/innobase/include/row0purge.h
Expand Up @@ -72,9 +72,8 @@ row_purge_poss_sec(
bool is_tree=false);

/***************************************************************
Does the purge operation for a single undo log record. This is a high-level
function used in an SQL execution graph.
@return query thread to run next or NULL */
Does the purge operation.
@return query thread to run next */
que_thr_t*
row_purge_step(
/*===========*/
Expand Down Expand Up @@ -198,21 +197,7 @@ struct purge_node_t{
}

/** Start processing an undo log record. */
void start()
{
ut_ad(in_progress);
DBUG_ASSERT(common.type == QUE_NODE_PURGE);

row= nullptr;
ref= nullptr;
index= nullptr;
update= nullptr;
found_clust= FALSE;
rec_type= ULINT_UNDEFINED;
cmpl_info= ULINT_UNDEFINED;
if (!purge_thd)
purge_thd= current_thd;
}
inline void start();


/** Close the existing table and release the MDL for it. */
Expand Down Expand Up @@ -253,16 +238,7 @@ struct purge_node_t{

/** Reset the state at end
@return the query graph parent */
que_node_t* end()
{
DBUG_ASSERT(common.type == QUE_NODE_PURGE);
close_table();
ut_ad(undo_recs.empty());
ut_d(in_progress= false);
purge_thd= nullptr;
mem_heap_empty(heap);
return common.parent;
}
inline que_node_t *end();
};

#endif
53 changes: 30 additions & 23 deletions storage/innobase/row/row0purge.cc
Expand Up @@ -1264,25 +1264,39 @@ row_purge(
}
}

/***********************************************************//**
Reset the purge query thread. */
UNIV_INLINE
void
row_purge_end(
/*==========*/
que_thr_t* thr) /*!< in: query thread */
inline void purge_node_t::start()
{
ut_ad(thr);

thr->run_node = static_cast<purge_node_t*>(thr->run_node)->end();
ut_ad(in_progress);
DBUG_ASSERT(common.type == QUE_NODE_PURGE);

row= nullptr;
ref= nullptr;
index= nullptr;
update= nullptr;
found_clust= FALSE;
rec_type= ULINT_UNDEFINED;
cmpl_info= ULINT_UNDEFINED;
if (!purge_thd)
purge_thd= current_thd;
}

ut_a(thr->run_node != NULL);
/** Reset the state at end
@return the query graph parent */
inline que_node_t *purge_node_t::end()
{
DBUG_ASSERT(common.type == QUE_NODE_PURGE);
close_table();
ut_ad(undo_recs.empty());
ut_d(in_progress= false);
purge_thd= nullptr;
mem_heap_empty(heap);
return common.parent;
}


/***********************************************************//**
Does the purge operation for a single undo log record. This is a high-level
function used in an SQL execution graph.
@return query thread to run next or NULL */
Does the purge operation.
@return query thread to run next */
que_thr_t*
row_purge_step(
/*===========*/
Expand All @@ -1294,22 +1308,15 @@ row_purge_step(

node->start();

if (!node->undo_recs.empty()) {
while (!node->undo_recs.empty()) {
trx_purge_rec_t purge_rec = node->undo_recs.front();
node->undo_recs.pop();
node->roll_ptr = purge_rec.roll_ptr;

row_purge(node, purge_rec.undo_rec, thr);

if (node->undo_recs.empty()) {
row_purge_end(thr);
} else {
thr->run_node = node;
}
} else {
row_purge_end(thr);
}

thr->run_node = node->end();
return(thr);
}

Expand Down

0 comments on commit 1b1501b

Please sign in to comment.