[MDEV-754] LP:655186 - disabling innobase_stats_on_metadata disables ANALYZE Created: 2010-10-05  Updated: 2014-03-26  Resolved: 2014-03-26

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: Stewart Smith Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: Launchpad, upstream

Attachments: XML File LPexportBug655186.xml    

 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



 Comments   
Comment by Rasmus Johansson (Inactive) [ 2010-10-15 ]

Re: disabling innobase_stats_on_metadata disables ANALYZE
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??

Comment by Michael Widenius [ 2010-10-16 ]

re: [Bug 655186] [NEW] disabling innobase_stats_on_metadata disables ANALYZE

Hi!

>>>>> "Stewart" == Stewart Smith <stewart@flamingspork.com> 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

Comment by Michael Widenius [ 2010-10-16 ]

[Bug 655186] Re: disabling innobase_stats_on_metadata disables ANALYZE

Hi!

>>>>> "Yasufumi" == Yasufumi Kinoshita <yasufumi.kinoshita@percona.com> 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

Comment by Rasmus Johansson (Inactive) [ 2010-10-18 ]

Re: disabling innobase_stats_on_metadata disables ANALYZE
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

Comment by Rasmus Johansson (Inactive) [ 2010-11-30 ]

Launchpad bug id: 655186

Comment by Elena Stepanova [ 2012-11-04 ]

Not sure if the problem still exists in the code, but I don't think it has suddenly become urgent after two years; setting to Minor and removing the upcoming 5.3.10 release from the 'fix' list.

Comment by Elena Stepanova [ 2014-03-26 ]

The upstream bug #57252 was fixed in MySQL 5.1 (and merged up) long time ago.

Comment by Elena Stepanova [ 2014-03-26 ]

The upstream fix is present in MariaDB 5.1 and higher.

Generated at Thu Feb 08 06:31:06 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.