Commit 23e107d7 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-33031 Assertion failure upon reading from performance schema with binlog enabled

same assertion with spider. spider status variables
didn't expect to be queried from a different thread
without LOCK_thd_data.

And they didn't expect to be queried under LOCK_thd_data either
(because spider_get_trx() calls thd_set_ha_data()).
parent b3065af6
#
# MDEV-33031 Assertion failure upon reading from performance schema with binlog enabled
#
connect foo,localhost,root;
select variable_name, variable_value from performance_schema.status_by_thread
where variable_name like '%spider_direct_aggregate%';
variable_name variable_value
Spider_direct_aggregate 0
Spider_direct_aggregate 0
disconnect foo;
connection default;
disable_query_log;
source ../../include/init_spider.inc;
enable_query_log;
--echo #
--echo # MDEV-33031 Assertion failure upon reading from performance schema with binlog enabled
--echo #
connect foo,localhost,root;
select variable_name, variable_value from performance_schema.status_by_thread
where variable_name like '%spider_direct_aggregate%';
disconnect foo;
connection default;
disable_query_log;
source ../../include/deinit_spider.inc;
......@@ -116,16 +116,20 @@ extern volatile ulonglong spider_mon_table_cache_version_req;
MYSQL_SYSVAR_NAME(param_name).def_val; \
}
extern handlerton *spider_hton_ptr;
static int spider_trx_status_var(THD *thd, SHOW_VAR *var, char *buff,
ulonglong SPIDER_TRX::*counter)
{
int error_num = 0;
SPIDER_TRX *trx;
DBUG_ENTER("spider_direct_update");
var->type = SHOW_LONGLONG;
if ((trx = spider_get_trx(thd, TRUE, &error_num)))
var->value = (char *) &(trx->*counter);
DBUG_RETURN(error_num);
var->value= buff;
if (thd != current_thd)
mysql_mutex_lock(&thd->LOCK_thd_data);
SPIDER_TRX *trx = (SPIDER_TRX*)thd_get_ha_data(thd, spider_hton_ptr);
*(ulonglong*)buff= trx ? trx->*counter : 0;
if (thd != current_thd)
mysql_mutex_unlock(&thd->LOCK_thd_data);
DBUG_RETURN(0);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment