From 37b9734c06dd424d926e99f9a21a41a2df38b85b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 3 Feb 2020 10:02:58 +0200 Subject: MDEV-21636 information_schema.innodb_mutexes.name column is not populated The column INFORMATION_SCHEMA.INNODB_MUTEXES.NAME is not populated ever since commit 2e814d4702d71a04388386a9f591d14a35980bfe applied the InnoDB changes from MySQL 5.7.9 to MariaDB Server 10.2.2. Since the same commit, the view is only providing information about rw_lock_t, not any mutexes. For now, let us convert the source code file name and line number of the rw_lock_t creation into a name. A better option in the future might be to store the information somewhere where it can be looked up by mysql_pfs_key_t, and possibly to remove the CREATE_FILE and CREATE_LINE columns. --- storage/innobase/handler/i_s.cc | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'storage') diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index fae634630fd..b32d703f79e 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2019, MariaDB Corporation. +Copyright (c) 2014, 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 @@ -9101,6 +9101,8 @@ i_s_innodb_mutexes_fill_table( ~Locking() { mutex_exit(&rw_lock_list_mutex); } } locking; + char lock_name[sizeof "buf0dump.cc:12345"]; + for (lock = UT_LIST_GET_FIRST(rw_lock_list); lock != NULL; lock = UT_LIST_GET_NEXT(list, lock)) { if (lock->count_os_wait == 0) { @@ -9113,11 +9115,16 @@ i_s_innodb_mutexes_fill_table( continue; } - //OK(field_store_string(fields[MUTEXES_NAME], - // lock->lock_name)); - OK(field_store_string( - fields[MUTEXES_CREATE_FILE], - innobase_basename(lock->cfile_name))); + const char* basename = innobase_basename( + lock->cfile_name); + + snprintf(lock_name, sizeof lock_name, "%s:%u", + basename, lock->cline); + + OK(field_store_string(fields[MUTEXES_NAME], + lock_name)); + OK(field_store_string(fields[MUTEXES_CREATE_FILE], + basename)); OK(fields[MUTEXES_CREATE_LINE]->store(lock->cline, true)); fields[MUTEXES_CREATE_LINE]->set_notnull(); @@ -9133,8 +9140,8 @@ i_s_innodb_mutexes_fill_table( snprintf(buf1, sizeof buf1, "combined %s", innobase_basename(block_lock->cfile_name)); - //OK(field_store_string(fields[MUTEXES_NAME], - // block_lock->lock_name)); + OK(field_store_string(fields[MUTEXES_NAME], + "buf_block_t::lock")); OK(field_store_string(fields[MUTEXES_CREATE_FILE], buf1)); OK(fields[MUTEXES_CREATE_LINE]->store(block_lock->cline, -- cgit v1.2.1