Suboptimal userstat code

Bug #1128066 reported by Alexey Kopytov on 2013-02-17
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Fix Released
Low
Alexey Kopytov
5.1
Won't Fix
Undecided
Unassigned
5.5
Fix Released
Low
Alexey Kopytov
5.6
Fix Released
Low
Alexey Kopytov

Bug Description

In close_thread_table() the following handler methods are called unconditionally:

  if(table->file)
  {
    table->file->update_global_table_stats();
    table->file->update_global_index_stats();
  }

What update_global_table_stats() does what userstats are disabled is it just zeroes rows_read and rows_changed and returns. update_global_index_stats() traverses the index_rows_read array and zeroes all elements.

Problems:

- 2 functions calls even if userstats are disabled.
- we probably don't need to zero all those data structures if userstats are disabled, as they are initialized to zero in handler::ha_open()
- even if we do have to zero them on close, why not memset() for the array, as the code for handler::ha_open() does?

Related branches

tags: added: userstat
tags: added: userstats
removed: userstat
tags: added: low-hanging-fruit
tags: added: userstat
removed: userstats

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

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

Other bug subscribers