From ba3d58ad4cf4e152bc3854c1526ea72bbcb31ed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 11 May 2020 14:23:37 +0300 Subject: MDEV-22523 index->rtr_ssn.mutex is wasting memory As part of the SPATIAL INDEX implementation in InnoDB, dict_index_t was expanded by a rtr_ssn_t field. There are only 3 operations for this field, all protected by rtr_ssn_t::mutex: * btr_cur_search_to_nth_level() stores the least significant 32 bits of the 64-bit value that is stored in the index root page. (This would better be done when the table is opened for the very first time.) * rtr_get_new_ssn_id() increments the value by 1. * rtr_get_current_ssn_id() reads the current value. All these operations can be implemented equally safely by using atomic memory access operations. --- storage/innobase/dict/dict0mem.cc | 2 -- 1 file changed, 2 deletions(-) (limited to 'storage/innobase/dict') diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc index 02ab1d77eb3..21a3c743f52 100644 --- a/storage/innobase/dict/dict0mem.cc +++ b/storage/innobase/dict/dict0mem.cc @@ -741,7 +741,6 @@ dict_mem_index_create( dict_index_zip_pad_mutex_create_lazy(index); if (type & DICT_SPATIAL) { - mutex_create(LATCH_ID_RTR_SSN_MUTEX, &index->rtr_ssn.mutex); index->rtr_track = static_cast( mem_heap_alloc( heap, @@ -1067,7 +1066,6 @@ dict_mem_index_free( rtr_info->index = NULL; } - mutex_destroy(&index->rtr_ssn.mutex); mutex_destroy(&index->rtr_track->rtr_active_mutex); UT_DELETE(index->rtr_track->rtr_active); } -- cgit v1.2.1 From 0e6a5786d4fc0e96c34ccee2c59a707e3debb3b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 12 May 2020 10:13:16 +0300 Subject: 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. --- storage/innobase/dict/dict0dict.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'storage/innobase/dict') 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; -- cgit v1.2.1