"SHOW ..." statements update "Rows_fetched" value in "information_schema.user_statistics"

Bug #1510953 reported by Yura Sorokin on 2015-10-28
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Server moved to https://jira.percona.com/projects/PS
Fix Released
High
Yura Sorokin
5.1
Won't Fix
Low
Yura Sorokin
5.5
Fix Released
High
Yura Sorokin
5.6
Fix Released
High
Yura Sorokin

Bug Description

When user stats are enabled ("SET GLOBAL userstat = ON"), after executing any statement of the "SHOW ..." family that produces non-empty result, the total number of the sent rows ("Rown_fetched") is updated in the "information_schema.user_statistics".

This happens because of the invalid "if" condition in the "void THD::update_stats(bool ran_command)" ("sql_class.cc")
**************************************************************************
      else if (!sql_command_flags[lex->sql_command] & CF_STATUS_COMMAND)
**************************************************************************
which is always "false" and therefore gets optimized out.

Yura Sorokin (yura-sorokin) wrote :

Also, this condition is considered suspicious and generates compiler's warning on newer versions of GCC (observed on 5.2.1 , Ubuntu 15.10 64-bit).
This could lead to build failures when"-Werror" is enabled.

no longer affects: percona-server/5.7

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

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

Other bug subscribers