diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-05-12 10:13:16 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-05-12 10:15:44 +0300 |
commit | 0e6a5786d4fc0e96c34ccee2c59a707e3debb3b3 (patch) | |
tree | eba9acff2d2daf6deba09e4bf862c683471ca188 | |
parent | a2560b00770d36d3509c5ebdddad8c34dab0dddf (diff) | |
download | mariadb-git-0e6a5786d4fc0e96c34ccee2c59a707e3debb3b3.tar.gz |
Cleanup: Remove InnoDB wrappers of thd_charset(), thd_query_safe()
innobase_get_charset(), innobase_get_stmt_safe(): Remove.
It is more efficient and readable to invoke thd_charset()
and thd_query_safe() directly, without a non-inlined wrapper function.
-rw-r--r-- | storage/innobase/dict/dict0dict.cc | 4 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 27 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.h | 2 | ||||
-rw-r--r-- | storage/innobase/include/ha_prototypes.h | 23 | ||||
-rw-r--r-- | storage/innobase/trx/trx0i_s.cc | 9 |
5 files changed, 7 insertions, 58 deletions
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 455d51af438..8f94ccb4c63 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -4959,7 +4959,7 @@ dict_create_foreign_constraints( heap = mem_heap_create(10000); err = dict_create_foreign_constraints_low( - trx, heap, innobase_get_charset(trx->mysql_thd), + trx, heap, thd_charset(trx->mysql_thd), str, name, reject_fks); mem_heap_free(heap); @@ -4994,7 +4994,7 @@ dict_foreign_parse_drop_constraints( ut_a(trx->mysql_thd); - cs = innobase_get_charset(trx->mysql_thd); + cs = thd_charset(trx->mysql_thd); *n = 0; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 32f7c6460e2..8cf867458e2 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -2299,17 +2299,6 @@ innobase_casedn_str( my_casedn_str(system_charset_info, a); } -/**********************************************************************//** -Determines the connection character set. -@return connection character set */ -CHARSET_INFO* -innobase_get_charset( -/*=================*/ - THD* mysql_thd) /*!< in: MySQL thread handle */ -{ - return(thd_charset(mysql_thd)); -} - /** Determines the current SQL statement. Thread unsafe, can only be called from the thread owning the THD. @param[in] thd MySQL thread handle @@ -2329,22 +2318,6 @@ innobase_get_stmt_unsafe( return NULL; } -/** Determines the current SQL statement. -Thread safe, can be called from any thread as the string is copied -into the provided buffer. -@param[in] thd MySQL thread handle -@param[out] buf Buffer containing SQL statement -@param[in] buflen Length of provided buffer -@return Length of the SQL statement */ -size_t -innobase_get_stmt_safe( - THD* thd, - char* buf, - size_t buflen) -{ - return thd_query_safe(thd, buf, buflen); -} - /**********************************************************************//** Get the current setting of the tdc_size global parameter. We do a dirty read because for one there is no synchronization object and diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index cdbbce51085..6d5c108c4a3 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -508,8 +508,6 @@ size_t thd_query_safe(MYSQL_THD thd, char *buf, size_t buflen); extern "C" { -struct charset_info_st *thd_charset(MYSQL_THD thd); - /** Check if a user thread is a replication slave thread @param thd user thread @retval 0 the user thread is not a replication slave thread diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h index 693dcd15163..05dc3f57df7 100644 --- a/storage/innobase/include/ha_prototypes.h +++ b/storage/innobase/include/ha_prototypes.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2006, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2019, MariaDB Corporation. +Copyright (c) 2017, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -244,13 +244,7 @@ int wsrep_innobase_mysql_sort(int mysql_type, uint charset_number, unsigned int buf_length); #endif /* WITH_WSREP */ -/**********************************************************************//** -Determines the connection character set. -@return connection character set */ -CHARSET_INFO* -innobase_get_charset( -/*=================*/ - THD* thd); /*!< in: MySQL thread handle */ +extern "C" struct charset_info_st *thd_charset(THD *thd); /** Determines the current SQL statement. Thread unsafe, can only be called from the thread owning the THD. @@ -262,19 +256,6 @@ innobase_get_stmt_unsafe( THD* thd, size_t* length); -/** Determines the current SQL statement. -Thread safe, can be called from any thread as the string is copied -into the provided buffer. -@param[in] thd MySQL thread handle -@param[out] buf Buffer containing SQL statement -@param[in] buflen Length of provided buffer -@return Length of the SQL statement */ -size_t -innobase_get_stmt_safe( - THD* thd, - char* buf, - size_t buflen); - /******************************************************************//** This function is used to find the storage length in bytes of the first n characters for prefix indexes using a multibyte character set. The function diff --git a/storage/innobase/trx/trx0i_s.cc b/storage/innobase/trx/trx0i_s.cc index 7838ef4826d..2b9d6c96acd 100644 --- a/storage/innobase/trx/trx0i_s.cc +++ b/storage/innobase/trx/trx0i_s.cc @@ -450,7 +450,6 @@ fill_trx_row( which to copy volatile strings */ { - size_t stmt_len; const char* s; ut_ad(lock_mutex_own()); @@ -485,16 +484,14 @@ fill_trx_row( row->trx_mysql_thread_id = thd_get_thread_id(trx->mysql_thd); char query[TRX_I_S_TRX_QUERY_MAX_LEN + 1]; - stmt_len = innobase_get_stmt_safe(trx->mysql_thd, query, sizeof(query)); - - if (stmt_len > 0) { - + if (size_t stmt_len = thd_query_safe(trx->mysql_thd, query, + sizeof query)) { row->trx_query = static_cast<const char*>( ha_storage_put_memlim( cache->storage, query, stmt_len + 1, MAX_ALLOWED_FOR_STORAGE(cache))); - row->trx_query_cs = innobase_get_charset(trx->mysql_thd); + row->trx_query_cs = thd_charset(trx->mysql_thd); if (row->trx_query == NULL) { |