Skip to content

Commit

Permalink
Cleanup: Do not pass globals as parameters
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dr-m committed Feb 22, 2018
1 parent fe0e263 commit a3a2b89
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 20 deletions.
2 changes: 0 additions & 2 deletions storage/innobase/include/trx0purge.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ trx_purge(
/*======*/
ulint n_purge_threads, /*!< in: number of purge tasks to
submit to task queue. */
ulint limit, /*!< in: the maximum number of
records to purge in one batch */
bool truncate); /*!< in: truncate history if true */
/*******************************************************************//**
Stop purge and wait for it to stop, move to PURGE_STATE_STOP. */
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/srv/srv0srv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2655,7 +2655,7 @@ srv_do_purge(ulint* n_total_purged)
undo_trunc_freq);

n_pages_purged = trx_purge(
n_use_threads, srv_purge_batch_size,
n_use_threads,
(++count % rseg_truncate_frequency) == 0);

*n_total_purged += n_pages_purged;
Expand Down
26 changes: 9 additions & 17 deletions storage/innobase/trx/trx0purge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1349,16 +1349,12 @@ trx_purge_fetch_next_rec(
return(trx_purge_get_next_rec(n_pages_handled, heap));
}

/*******************************************************************//**
This function runs a purge batch.
/** Run a purge batch.
@param n_purge_threads number of purge threads
@return number of undo log pages handled in the batch */
static
ulint
trx_purge_attach_undo_recs(
/*=======================*/
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 */
trx_purge_attach_undo_recs(ulint n_purge_threads)
{
que_thr_t* thr;
ulint i = 0;
Expand Down Expand Up @@ -1399,6 +1395,8 @@ trx_purge_attach_undo_recs(

i = 0;

const ulint batch_size = srv_purge_batch_size;

for (;;) {
purge_node_t* node;
trx_purge_rec_t* purge_rec;
Expand Down Expand Up @@ -1498,13 +1496,10 @@ trx_purge_dml_delay(void)
return(delay);
}

/*******************************************************************//**
Wait for pending purge jobs to complete. */
/** Wait for pending purge jobs to complete. */
static
void
trx_purge_wait_for_workers_to_complete(
/*===================================*/
purge_sys_t* purge_sys) /*!< in: purge instance */
trx_purge_wait_for_workers_to_complete()
{
ulint n_submitted = purge_sys->n_submitted;

Expand Down Expand Up @@ -1534,8 +1529,6 @@ trx_purge(
/*======*/
ulint n_purge_threads, /*!< in: number of purge tasks
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 */
{
que_thr_t* thr = NULL;
Expand All @@ -1559,8 +1552,7 @@ trx_purge(
#endif /* UNIV_DEBUG */

/* Fetch the UNDO recs that need to be purged. */
n_pages_handled = trx_purge_attach_undo_recs(
n_purge_threads, purge_sys, batch_size);
n_pages_handled = trx_purge_attach_undo_recs(n_purge_threads);

/* Do we do an asynchronous purge or not ? */
if (n_purge_threads > 1) {
Expand Down Expand Up @@ -1597,7 +1589,7 @@ trx_purge(
&purge_sys->n_completed, 1);

if (n_purge_threads > 1) {
trx_purge_wait_for_workers_to_complete(purge_sys);
trx_purge_wait_for_workers_to_complete();
}
}

Expand Down

0 comments on commit a3a2b89

Please sign in to comment.