mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
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
This commit is contained in:
@ -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 @@ public:
|
||||
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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user