Simplify purge a little

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?
This commit is contained in:
Marko Mäkelä 2022-10-06 13:15:12 +03:00
parent ea1415cbb6
commit 1b1501b0f1
2 changed files with 34 additions and 51 deletions

View File

@ -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(
/*===========*/
@ -198,21 +197,7 @@ public:
}
/** 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. */
@ -253,16 +238,7 @@ public:
/** 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

View File

@ -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);
ut_ad(in_progress);
DBUG_ASSERT(common.type == QUE_NODE_PURGE);
thr->run_node = static_cast<purge_node_t*>(thr->run_node)->end();
ut_a(thr->run_node != NULL);
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;
}
/** 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(
/*===========*/
@ -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);
}