Commit 762d2b96 authored by Sergey Vojtovich's avatar Sergey Vojtovich

Fixed FederatedX to follow THD ha_data protocol

Use thd_get_ha_data()/thd_set_ha_data() which protect against plugin
removal until it has THD ha_data.

Do not reset THD ha_data in ha_federatedx::disconnect(), cleaner approach
is to let ha_close_connection() do it.

Part of MDEV-19515 - Improve connect speed
parent ce30c994
......@@ -2664,10 +2664,6 @@ double handler::keyread_time(uint index, uint ranges, ha_rows rows)
return cost;
}
void **handler::ha_data(THD *thd) const
{
return thd_ha_data(thd, ht);
}
THD *handler::ha_thd(void) const
{
......
......@@ -4475,7 +4475,6 @@ class handler :public Sql_alloc
TABLE_SHARE* get_table_share() { return table_share; }
protected:
/* Service methods for use by storage engines. */
void **ha_data(THD *) const;
THD *ha_thd(void) const;
/**
......
......@@ -1746,10 +1746,13 @@ ha_rows ha_federatedx::records_in_range(uint inx, key_range *start_key,
federatedx_txn *ha_federatedx::get_txn(THD *thd, bool no_create)
{
federatedx_txn **txnp= (federatedx_txn **) ha_data(thd);
if (!*txnp && !no_create)
*txnp= new federatedx_txn();
return *txnp;
federatedx_txn *txn= (federatedx_txn *) thd_get_ha_data(thd, federatedx_hton);
if (!txn && !no_create)
{
txn= new federatedx_txn();
thd_set_ha_data(thd, federatedx_hton, txn);
}
return txn;
}
......@@ -1757,7 +1760,6 @@ int ha_federatedx::disconnect(handlerton *hton, MYSQL_THD thd)
{
federatedx_txn *txn= (federatedx_txn *) thd_get_ha_data(thd, hton);
delete txn;
*((federatedx_txn **) thd_ha_data(thd, hton))= 0;
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