Commit 37b9734c authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-21636 information_schema.innodb_mutexes.name column is not populated

The column INFORMATION_SCHEMA.INNODB_MUTEXES.NAME is not populated ever since
commit 2e814d47 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.
parent bd36a4ca
/*****************************************************************************
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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment