Commit a3a2b898 authored by Marko Mäkelä's avatar Marko Mäkelä

Cleanup: Do not pass globals as parameters

trx_purge(): Remove the parameter limit or batch_size, which is
always passed as srv_purge_batch_size.

trx_purge_attach_undo_recs(): Remove the parameters purge_sys, batch_size.
Refer to srv_purge_batch_size.

trx_purge_wait_for_workers_to_complete(): Remove the parameter purge_sys.
parent fe0e263e
...@@ -59,8 +59,6 @@ trx_purge( ...@@ -59,8 +59,6 @@ trx_purge(
/*======*/ /*======*/
ulint n_purge_threads, /*!< in: number of purge tasks to ulint n_purge_threads, /*!< in: number of purge tasks to
submit to task queue. */ submit to task queue. */
ulint limit, /*!< in: the maximum number of
records to purge in one batch */
bool truncate); /*!< in: truncate history if true */ bool truncate); /*!< in: truncate history if true */
/*******************************************************************//** /*******************************************************************//**
Stop purge and wait for it to stop, move to PURGE_STATE_STOP. */ Stop purge and wait for it to stop, move to PURGE_STATE_STOP. */
......
...@@ -2655,7 +2655,7 @@ srv_do_purge(ulint* n_total_purged) ...@@ -2655,7 +2655,7 @@ srv_do_purge(ulint* n_total_purged)
undo_trunc_freq); undo_trunc_freq);
n_pages_purged = trx_purge( n_pages_purged = trx_purge(
n_use_threads, srv_purge_batch_size, n_use_threads,
(++count % rseg_truncate_frequency) == 0); (++count % rseg_truncate_frequency) == 0);
*n_total_purged += n_pages_purged; *n_total_purged += n_pages_purged;
......
...@@ -1349,16 +1349,12 @@ trx_purge_fetch_next_rec( ...@@ -1349,16 +1349,12 @@ trx_purge_fetch_next_rec(
return(trx_purge_get_next_rec(n_pages_handled, heap)); return(trx_purge_get_next_rec(n_pages_handled, heap));
} }
/*******************************************************************//** /** Run a purge batch.
This function runs a purge batch. @param n_purge_threads number of purge threads
@return number of undo log pages handled in the batch */ @return number of undo log pages handled in the batch */
static static
ulint ulint
trx_purge_attach_undo_recs( trx_purge_attach_undo_recs(ulint n_purge_threads)
/*=======================*/
ulint n_purge_threads,/*!< in: number of purge threads */
purge_sys_t* purge_sys, /*!< in/out: purge instance */
ulint batch_size) /*!< in: no. of pages to purge */
{ {
que_thr_t* thr; que_thr_t* thr;
ulint i = 0; ulint i = 0;
...@@ -1399,6 +1395,8 @@ trx_purge_attach_undo_recs( ...@@ -1399,6 +1395,8 @@ trx_purge_attach_undo_recs(
i = 0; i = 0;
const ulint batch_size = srv_purge_batch_size;
for (;;) { for (;;) {
purge_node_t* node; purge_node_t* node;
trx_purge_rec_t* purge_rec; trx_purge_rec_t* purge_rec;
...@@ -1498,13 +1496,10 @@ trx_purge_dml_delay(void) ...@@ -1498,13 +1496,10 @@ trx_purge_dml_delay(void)
return(delay); return(delay);
} }
/*******************************************************************//** /** Wait for pending purge jobs to complete. */
Wait for pending purge jobs to complete. */
static static
void void
trx_purge_wait_for_workers_to_complete( trx_purge_wait_for_workers_to_complete()
/*===================================*/
purge_sys_t* purge_sys) /*!< in: purge instance */
{ {
ulint n_submitted = purge_sys->n_submitted; ulint n_submitted = purge_sys->n_submitted;
...@@ -1534,8 +1529,6 @@ trx_purge( ...@@ -1534,8 +1529,6 @@ trx_purge(
/*======*/ /*======*/
ulint n_purge_threads, /*!< in: number of purge tasks ulint n_purge_threads, /*!< in: number of purge tasks
to submit to the work queue */ to submit to the work queue */
ulint batch_size, /*!< in: the maximum number of records
to purge in one batch */
bool truncate) /*!< in: truncate history if true */ bool truncate) /*!< in: truncate history if true */
{ {
que_thr_t* thr = NULL; que_thr_t* thr = NULL;
...@@ -1559,8 +1552,7 @@ trx_purge( ...@@ -1559,8 +1552,7 @@ trx_purge(
#endif /* UNIV_DEBUG */ #endif /* UNIV_DEBUG */
/* Fetch the UNDO recs that need to be purged. */ /* Fetch the UNDO recs that need to be purged. */
n_pages_handled = trx_purge_attach_undo_recs( n_pages_handled = trx_purge_attach_undo_recs(n_purge_threads);
n_purge_threads, purge_sys, batch_size);
/* Do we do an asynchronous purge or not ? */ /* Do we do an asynchronous purge or not ? */
if (n_purge_threads > 1) { if (n_purge_threads > 1) {
...@@ -1597,7 +1589,7 @@ trx_purge( ...@@ -1597,7 +1589,7 @@ trx_purge(
&purge_sys->n_completed, 1); &purge_sys->n_completed, 1);
if (n_purge_threads > 1) { if (n_purge_threads > 1) {
trx_purge_wait_for_workers_to_complete(purge_sys); trx_purge_wait_for_workers_to_complete();
} }
} }
......
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