disabling innobase_stats_on_metadata disables ANALYZE

Bug #655186 reported by Stewart Smith on 2010-10-05
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Drizzle
Fix Released
Low
Andrew Hutchings
7.0
Fix Released
Low
Andrew Hutchings
MariaDB
New
Undecided
Unassigned
MySQL Server
Unknown
Unknown
Percona Server moved to https://jira.percona.com/projects/PS
Invalid
Undecided
Unassigned

Bug Description

ha_innobase::analyze(
/*=================*/
 THD* thd, /*!< in: connection thread handle */
 HA_CHECK_OPT* check_opt) /*!< in: currently ignored */
{
 /* Simply call ::info() with all the flags */
 info(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE);

 return(0);
}

versus this code in ::info():

 if (flag & HA_STATUS_TIME) {
  if (innobase_stats_on_metadata) {
   /* In sql_show we call with this flag: update
   then statistics so that they are up-to-date */

   prebuilt->trx->op_info = "updating table statistics";

   dict_update_statistics(ib_table);

   prebuilt->trx->op_info = "returning various info to MySQL";
  }

The solution is pretty simple, in ::info() do something like the following:

if (! innobase_stats_on_metadata)
    dict_update_statistics(prebuilt->table);

It does not seem like it was the intention of innobase_stats_on_metadata to also disable ANALYZE

Related branches

Changed in percona-xtradb:
status: New → Confirmed
assignee: nobody → Yasufumi Kinoshita (yasufumi-kinoshita)
affects: percona-xtradb → percona-server
Changed in drizzle:
assignee: nobody → Andrew Hutchings (linuxjedi)
Changed in drizzle:
milestone: none → 2010-10-25
status: Confirmed → Triaged
Changed in drizzle:
status: Triaged → Fix Committed

XtraDB already has the following code.

        if (flag & HA_STATUS_TIME) {
- if (innobase_stats_on_metadata) {
+ if (innobase_stats_on_metadata
+ || thd_sql_command(user_thd) == SQLCOM_ANALYZE
+ ) {
                        /* In sql_show we call with this flag: update
                        then statistics so that they are up-to-date */

Why was the bug confirmed??

Changed in percona-server:
status: Confirmed → Invalid
Changed in drizzle:
status: Fix Committed → Fix Released

Hi!

>>>>> "Stewart" == Stewart Smith <email address hidden> writes:

Stewart> Public bug reported:
Stewart> ha_innobase::analyze(
Stewart> /*=================*/
Stewart> THD* thd, /*!< in: connection thread handle */
Stewart> HA_CHECK_OPT* check_opt) /*!< in: currently ignored */
Stewart> {
Stewart> /* Simply call ::info() with all the flags */
Stewart> info(HA_STATUS_TIME | HA_STATUS_CONST | HA_STATUS_VARIABLE);

Stewart> return(0);
Stewart> }

Stewart> versus this code in ::info():

Stewart> if (flag & HA_STATUS_TIME) {
Stewart> if (innobase_stats_on_metadata) {
Stewart> /* In sql_show we call with this flag: update
Stewart> then statistics so that they are up-to-date */

Stewart> prebuilt->trx->op_info = "updating table
Stewart> statistics";

Stewart> dict_update_statistics(ib_table);

Stewart> prebuilt->trx->op_info = "returning various info to MySQL";
Stewart> }

Stewart> The solution is pretty simple, in ::info() do something like the following:

Stewart> if (! innobase_stats_on_metadata)
Stewart> dict_update_statistics(prebuilt->table);

Stewart> It does not seem like it was the intention of innobase_stats_on_metadata to also disable ANALYZE

Good catch.

Vadim, can you add this fix to xtradb?

Regards,
Monty

Hi!

>>>>> "Yasufumi" == Yasufumi Kinoshita <email address hidden> writes:

Yasufumi> XtraDB already has the following code.
Yasufumi> if (flag & HA_STATUS_TIME) {
Yasufumi> - if (innobase_stats_on_metadata) {
Yasufumi> + if (innobase_stats_on_metadata
Yasufumi> + || thd_sql_command(user_thd) == SQLCOM_ANALYZE
Yasufumi> + ) {
Yasufumi> /* In sql_show we call with this flag: update
Yasufumi> then statistics so that they are up-to-date */

Yasufumi> Why was the bug confirmed??

I don't think you should depend on the SQLCOM_ANALYZE status; Someone
may want in the future to call analyze() from other points in the code.

A better way would be to add an engine specific
HA_STATUS_INNODB_ANALYZE flag from ha_innobase::analyze() and test
this in info().

Regards,
Monty

Monty,

XtraDB currently is maintained as patch cluster form InnoDB-Plugin by only few person.
It can be ignored and conflicted in the future InnoDB-Plugin.
Especially, the first-aid patch for the bug of InnoDB-Plugin should be small and clear to understand later,
and doesn't need to think future call.

This bug should be fixed at the main branch of InnoDB at first.
I will decide after fixing at the main branch when I will meet the conflict through porting the patches to the next version.
I have limited resource only, I don't want to spent them for dim specification which can be ineffectual in the future.

Regards,
Yasufumi

Changed in maria:
milestone: none → 5.1

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

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

Other bug subscribers

Remote bug watches

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