Undocumented purge changes in 5.5

Bug #1058100 reported by Laurynas Biveinis
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.5
Triaged
High
Unassigned
5.6
Invalid
Undecided
Unassigned
5.7
Invalid
Undecided
Unassigned

Bug Description

Percona Server 5.5 patches the following:

in trx0purge.c, trx_purge_add_update_undo_to_history(), comments out:

// if (!(trx_sys->rseg_history_len % srv_purge_batch_size)) { /*should wake up always*/
  /* Inform the purge thread that there is work to do. */
  srv_wake_purge_thread_if_not_active();
// }

so it always wakes up the purge thread.

in srv0srv.c, srv_purge_thread(), adds last purge wall-time based throttling:

  cur_time = ut_time_ms();
  if (next_itr_time > cur_time) {
   os_thread_sleep(ut_min(1000000,
     (next_itr_time - cur_time)
      * 1000));
   next_itr_time = ut_time_ms() + 1000;
  } else {
   next_itr_time = cur_time + 1000;
  }

The presence of these changes should be justified, and if they are OK, they should be documented.

Revision history for this message
Raghavendra D Prabhu (raghavendra-prabhu) wrote :

That patch was added in 234.1.13 as part of import innodb_io_patches into the tree.

The original code is from 0.15941.195

Now, the wall-time code referred to in the description was also added in as part of 234.1.13

234.1.13 stewart |
                      | cur_time = ut_time_ms();
                      | if (next_itr_time > cur_time) {
                      | os_thread_sleep(ut_min(1000000,
                      | (next_itr_time - cur_time)
                      | * 1000));
                      | next_itr_time = ut_time_ms() + 1000;
                      | } else {
                      | next_itr_time = cur_time + 1000;
                      | }

The thread was suspended for --

  if (trx_sys->rseg_history_len < srv_purge_batch_size
      || (n_total_purged == 0
   && retries >= TRX_SYS_N_RSEGS)) {

It is being woken up unconditionally (does the purge thread get woken up
elsewhere as well?). However, the original condition didn't make sense as well
-- to check if history_len is a perfect multiple of innodb_purge_batch_size.

I think trx_sys->rseg_history_len < srv_purge_batch_size needs to checked in
trx_purge_add_update_undo_to_history before waking up the purge thread (unless
purge thread is not woken anywhere else), otherwise this break the definition
of innodb_purge_batch_size as well.

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-2809

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.