From 5e139437a5c624b3bb55fb269fa91b63b7b65deb Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Thu, 16 May 2019 15:18:15 +0400 Subject: Adiue thd_ha_data(), you've broke many hearts Part of MDEV-19515 - Improve connect speed --- include/mysql/plugin.h | 1 - include/mysql/plugin_audit.h.pp | 1 - include/mysql/plugin_auth.h.pp | 1 - include/mysql/plugin_encryption.h.pp | 1 - include/mysql/plugin_ftparser.h.pp | 1 - include/mysql/plugin_password_validation.h.pp | 1 - sql/sql_class.cc | 10 ++-------- 7 files changed, 2 insertions(+), 14 deletions(-) diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index 02a87c6db71..0705ad84a9b 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -645,7 +645,6 @@ int thd_in_lock_tables(const MYSQL_THD thd); int thd_tablespace_op(const MYSQL_THD thd); long long thd_test_options(const MYSQL_THD thd, long long test_options); int thd_sql_command(const MYSQL_THD thd); -void **thd_ha_data(const MYSQL_THD thd, const struct handlerton *hton); void thd_storage_lock_wait(MYSQL_THD thd, long long value); int thd_tx_isolation(const MYSQL_THD thd); int thd_tx_is_read_only(const MYSQL_THD thd); diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp index c5ae678e82a..f9c87dce23b 100644 --- a/include/mysql/plugin_audit.h.pp +++ b/include/mysql/plugin_audit.h.pp @@ -559,7 +559,6 @@ int thd_in_lock_tables(const void* thd); int thd_tablespace_op(const void* thd); long long thd_test_options(const void* thd, long long test_options); int thd_sql_command(const void* thd); -void **thd_ha_data(const void* thd, const struct handlerton *hton); void thd_storage_lock_wait(void* thd, long long value); int thd_tx_isolation(const void* thd); int thd_tx_is_read_only(const void* thd); diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp index 41cb7d075c4..40ff9a80634 100644 --- a/include/mysql/plugin_auth.h.pp +++ b/include/mysql/plugin_auth.h.pp @@ -559,7 +559,6 @@ int thd_in_lock_tables(const void* thd); int thd_tablespace_op(const void* thd); long long thd_test_options(const void* thd, long long test_options); int thd_sql_command(const void* thd); -void **thd_ha_data(const void* thd, const struct handlerton *hton); void thd_storage_lock_wait(void* thd, long long value); int thd_tx_isolation(const void* thd); int thd_tx_is_read_only(const void* thd); diff --git a/include/mysql/plugin_encryption.h.pp b/include/mysql/plugin_encryption.h.pp index 6597decfbef..cd5304d8113 100644 --- a/include/mysql/plugin_encryption.h.pp +++ b/include/mysql/plugin_encryption.h.pp @@ -559,7 +559,6 @@ int thd_in_lock_tables(const void* thd); int thd_tablespace_op(const void* thd); long long thd_test_options(const void* thd, long long test_options); int thd_sql_command(const void* thd); -void **thd_ha_data(const void* thd, const struct handlerton *hton); void thd_storage_lock_wait(void* thd, long long value); int thd_tx_isolation(const void* thd); int thd_tx_is_read_only(const void* thd); diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp index bd1cfc7b68b..68afdfa80f0 100644 --- a/include/mysql/plugin_ftparser.h.pp +++ b/include/mysql/plugin_ftparser.h.pp @@ -513,7 +513,6 @@ int thd_in_lock_tables(const void* thd); int thd_tablespace_op(const void* thd); long long thd_test_options(const void* thd, long long test_options); int thd_sql_command(const void* thd); -void **thd_ha_data(const void* thd, const struct handlerton *hton); void thd_storage_lock_wait(void* thd, long long value); int thd_tx_isolation(const void* thd); int thd_tx_is_read_only(const void* thd); diff --git a/include/mysql/plugin_password_validation.h.pp b/include/mysql/plugin_password_validation.h.pp index 2f9d2299c1f..d9122302c4e 100644 --- a/include/mysql/plugin_password_validation.h.pp +++ b/include/mysql/plugin_password_validation.h.pp @@ -559,7 +559,6 @@ int thd_in_lock_tables(const void* thd); int thd_tablespace_op(const void* thd); long long thd_test_options(const void* thd, long long test_options); int thd_sql_command(const void* thd); -void **thd_ha_data(const void* thd, const struct handlerton *hton); void thd_storage_lock_wait(void* thd, long long value); int thd_tx_isolation(const void* thd); int thd_tx_is_read_only(const void* thd); diff --git a/sql/sql_class.cc b/sql/sql_class.cc index bd2965efa3e..9ee1cfe044d 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -419,12 +419,6 @@ void thd_exit_cond(MYSQL_THD thd, const PSI_stage_info *stage, return; } -extern "C" -void **thd_ha_data(const THD *thd, const struct handlerton *hton) -{ - return (void **) &thd->ha_data[hton->slot].ha_ptr; -} - extern "C" void thd_storage_lock_wait(THD *thd, long long value) { @@ -437,7 +431,7 @@ void thd_storage_lock_wait(THD *thd, long long value) extern "C" void *thd_get_ha_data(const THD *thd, const struct handlerton *hton) { - return *thd_ha_data(thd, hton); + return thd->ha_data[hton->slot].ha_ptr; } @@ -450,6 +444,7 @@ void thd_set_ha_data(THD *thd, const struct handlerton *hton, const void *ha_data) { plugin_ref *lock= &thd->ha_data[hton->slot].lock; + thd->ha_data[hton->slot].ha_ptr= const_cast(ha_data); if (ha_data && !*lock) *lock= ha_lock_engine(NULL, (handlerton*) hton); else if (!ha_data && *lock) @@ -457,7 +452,6 @@ void thd_set_ha_data(THD *thd, const struct handlerton *hton, plugin_unlock(NULL, *lock); *lock= NULL; } - *thd_ha_data(thd, hton)= (void*) ha_data; } -- cgit v1.2.1