Commit c152f595 authored by Marko Mäkelä's avatar Marko Mäkelä

Amend HEAD~: Remove INFORMATION_SCHEMA.INNODB_MUTEXES

The view INNODB_MUTEXES only exported counts of rw-lock waits.

Also, SHOW ENGINE INNODB MUTEX will no longer export any information
about rw-locks.
parent 6a8fdf5f
......@@ -13,5 +13,4 @@
--loose-innodb-sys-foreign-cols
--loose-innodb-sys-tables
--loose-innodb-sys-tablestats
--loose-innodb-mutexes
--loose-innodb-tablespaces-encryption
......@@ -29,7 +29,6 @@ INNODB_CMP_RESET
INNODB_LOCKS
INNODB_LOCK_WAITS
INNODB_METRICS
INNODB_MUTEXES
INNODB_SYS_COLUMNS
INNODB_SYS_FIELDS
INNODB_SYS_FOREIGN
......@@ -109,7 +108,6 @@ INNODB_CMP_RESET page_size
INNODB_LOCKS lock_id
INNODB_LOCK_WAITS requesting_trx_id
INNODB_METRICS NAME
INNODB_MUTEXES NAME
INNODB_SYS_COLUMNS TABLE_ID
INNODB_SYS_FIELDS INDEX_ID
INNODB_SYS_FOREIGN ID
......@@ -189,7 +187,6 @@ INNODB_CMP_RESET page_size
INNODB_LOCKS lock_id
INNODB_LOCK_WAITS requesting_trx_id
INNODB_METRICS NAME
INNODB_MUTEXES NAME
INNODB_SYS_COLUMNS TABLE_ID
INNODB_SYS_FIELDS INDEX_ID
INNODB_SYS_FOREIGN ID
......@@ -274,7 +271,6 @@ INNODB_CMP_RESET information_schema.INNODB_CMP_RESET 1
INNODB_LOCKS information_schema.INNODB_LOCKS 1
INNODB_LOCK_WAITS information_schema.INNODB_LOCK_WAITS 1
INNODB_METRICS information_schema.INNODB_METRICS 1
INNODB_MUTEXES information_schema.INNODB_MUTEXES 1
INNODB_SYS_COLUMNS information_schema.INNODB_SYS_COLUMNS 1
INNODB_SYS_FIELDS information_schema.INNODB_SYS_FIELDS 1
INNODB_SYS_FOREIGN information_schema.INNODB_SYS_FOREIGN 1
......@@ -344,7 +340,6 @@ Database: information_schema
| INNODB_LOCKS |
| INNODB_LOCK_WAITS |
| INNODB_METRICS |
| INNODB_MUTEXES |
| INNODB_SYS_COLUMNS |
| INNODB_SYS_FIELDS |
| INNODB_SYS_FOREIGN |
......@@ -414,7 +409,6 @@ Database: INFORMATION_SCHEMA
| INNODB_LOCKS |
| INNODB_LOCK_WAITS |
| INNODB_METRICS |
| INNODB_MUTEXES |
| INNODB_SYS_COLUMNS |
| INNODB_SYS_FIELDS |
| INNODB_SYS_FOREIGN |
......@@ -459,5 +453,5 @@ Wildcard: inf_rmation_schema
| information_schema |
SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') GROUP BY TABLE_SCHEMA;
table_schema count(*)
information_schema 65
information_schema 64
mysql 31
......@@ -40,8 +40,6 @@ create sql security invoker view i_locks as select * from information_schema.inn
create sql security definer view d_locks as select * from information_schema.innodb_locks;
create sql security invoker view i_metrics as select * from information_schema.innodb_metrics;
create sql security definer view d_metrics as select * from information_schema.innodb_metrics;
create sql security invoker view i_mutexes as select * from information_schema.innodb_mutexes;
create sql security definer view d_mutexes as select * from information_schema.innodb_mutexes;
create sql security invoker view i_sys_columns as select * from information_schema.innodb_sys_columns;
create sql security definer view d_sys_columns as select * from information_schema.innodb_sys_columns;
create sql security invoker view i_sys_fields as select * from information_schema.innodb_sys_fields;
......@@ -189,13 +187,6 @@ ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s)
select count(*) > -1 from d_metrics;
count(*) > -1
1
select count(*) > -1 from information_schema.innodb_mutexes;
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
select count(*) > -1 from i_mutexes;
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
select count(*) > -1 from d_mutexes;
count(*) > -1
1
select count(*) > -1 from information_schema.innodb_sys_columns;
ERROR 42000: Access denied; you need (at least one of) the PROCESS privilege(s) for this operation
select count(*) > -1 from i_sys_columns;
......
connect con1,localhost,root,,;
connect con2,localhost,root,,;
connect con3,localhost,root,,;
create table t1(a int not null primary key, b int, c int,d CHAR(100)) engine=innodb;
create procedure innodb_insert_proc (repeat_count int)
begin
declare current_num int;
set current_num = 0;
while current_num < repeat_count do
insert into t1 values(current_num, RAND(), RAND(), substring(MD5(RAND()), -64));
set current_num = current_num + 1;
end while;
end//
commit;
set autocommit=0;
call innodb_insert_proc(20000);
commit;
set autocommit=1;
connection con1;
delete from t1 where a between 1000 and 1300;
connection con2;
update t1 set b=b+1 where a between 2000 and 2600;
connection con3;
insert into t1 select a+30000,b,c,d from t1 where a between 3000 and 4000;
connection default;
delete from t1 where a between 6000 and 7000;
connection con1;
connection con2;
connection con3;
connection default;
disconnect con1;
disconnect con2;
disconnect con3;
drop procedure innodb_insert_proc;
drop table t1;
......@@ -363,10 +363,6 @@ select * from information_schema.innodb_tablespaces_encryption;
SPACE NAME ENCRYPTION_SCHEME KEYSERVER_REQUESTS MIN_KEY_VERSION CURRENT_KEY_VERSION KEY_ROTATION_PAGE_NUMBER KEY_ROTATION_MAX_PAGE_NUMBER CURRENT_KEY_ID ROTATING_OR_FLUSHING
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_tablespaces_encryption but the InnoDB storage engine is not installed
select * from information_schema.innodb_mutexes;
NAME OS_WAITS
Warnings:
Warning 1012 InnoDB: SELECTing from INFORMATION_SCHEMA.innodb_mutexes but the InnoDB storage engine is not installed
select * from information_schema.innodb_sys_semaphore_waits;
THREAD_ID OBJECT_NAME FILE LINE WAIT_TIME WAIT_OBJECT WAIT_TYPE HOLDER_THREAD_ID HOLDER_FILE HOLDER_LINE CREATED_FILE CREATED_LINE WRITER_THREAD RESERVATION_MODE READERS WAITERS_FLAG LOCK_WORD LAST_WRITER_FILE LAST_WRITER_LINE OS_WAIT_COUNT
Warnings:
......
......@@ -26,6 +26,5 @@
--enable-plugin-innodb-sys-foreign-cols
--enable-plugin-innodb-sys-tablespaces
--enable-plugin-innodb-sys-virtual
--enable-plugin-innodb-mutexes
--enable-plugin-innodb-sys-semaphore-waits
--enable-plugin-innodb-tablespaces-encryption
......@@ -64,9 +64,6 @@ create sql security definer view d_locks as select * from information_schema.inn
create sql security invoker view i_metrics as select * from information_schema.innodb_metrics;
create sql security definer view d_metrics as select * from information_schema.innodb_metrics;
create sql security invoker view i_mutexes as select * from information_schema.innodb_mutexes;
create sql security definer view d_mutexes as select * from information_schema.innodb_mutexes;
create sql security invoker view i_sys_columns as select * from information_schema.innodb_sys_columns;
create sql security definer view d_sys_columns as select * from information_schema.innodb_sys_columns;
......@@ -209,12 +206,6 @@ select count(*) > -1 from information_schema.innodb_metrics;
select count(*) > -1 from i_metrics;
select count(*) > -1 from d_metrics;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
select count(*) > -1 from information_schema.innodb_mutexes;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
select count(*) > -1 from i_mutexes;
select count(*) > -1 from d_mutexes;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
select count(*) > -1 from information_schema.innodb_sys_columns;
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
......
--innodb-mutexes
\ No newline at end of file
--source include/have_innodb.inc
connect(con1,localhost,root,,);
connect(con2,localhost,root,,);
connect(con3,localhost,root,,);
create table t1(a int not null primary key, b int, c int,d CHAR(100)) engine=innodb;
delimiter //;
create procedure innodb_insert_proc (repeat_count int)
begin
declare current_num int;
set current_num = 0;
while current_num < repeat_count do
insert into t1 values(current_num, RAND(), RAND(), substring(MD5(RAND()), -64));
set current_num = current_num + 1;
end while;
end//
delimiter ;//
commit;
set autocommit=0;
call innodb_insert_proc(20000);
commit;
set autocommit=1;
connection con1;
send delete from t1 where a between 1000 and 1300;
connection con2;
send update t1 set b=b+1 where a between 2000 and 2600;
connection con3;
send insert into t1 select a+30000,b,c,d from t1 where a between 3000 and 4000;
connection default;
send delete from t1 where a between 6000 and 7000;
connection con1;
reap;
connection con2;
reap;
connection con3;
reap;
connection default;
reap;
disconnect con1;
disconnect con2;
disconnect con3;
# test that below does not crash, actual result is not
# repeatable
--disable_query_log
--disable_result_log
--disable_warnings
select * from information_schema.innodb_mutexes;
--enable_query_log
--enable_result_log
--enable_warnings
drop procedure innodb_insert_proc;
drop table t1;
\ No newline at end of file
......@@ -59,7 +59,4 @@
--loose-innodb_sys_datafiles
--loose-innodb_changed_pages
--loose-innodb_tablespaces_encryption
--loose-innodb_mutexes
--loose-innodb_sys_semaphore_waits
--loose-innodb_mutexes
--loose-innodb_sys_semaphore_waits
......@@ -27,5 +27,4 @@ select * from information_schema.innodb_sys_foreign;
select * from information_schema.innodb_sys_foreign_cols;
select * from information_schema.innodb_sys_tablespaces;
select * from information_schema.innodb_tablespaces_encryption;
select * from information_schema.innodb_mutexes;
select * from information_schema.innodb_sys_semaphore_waits;
SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_MUTEXES;
Table Create Table
INNODB_MUTEXES CREATE TEMPORARY TABLE `INNODB_MUTEXES` (
`NAME` varchar(4000) NOT NULL DEFAULT '',
`OS_WAITS` bigint(21) unsigned NOT NULL DEFAULT 0
) ENGINE=MEMORY DEFAULT CHARSET=utf8
--source include/have_innodb.inc
SHOW CREATE TABLE INFORMATION_SCHEMA.INNODB_MUTEXES;
......@@ -462,7 +462,6 @@ innodb.innodb_information_schema_buffer : MDEV-23418 - Wrong result
innodb.innodb_max_recordsize_32k : MDEV-14801 - Operation failed
innodb.innodb_max_recordsize_64k : MDEV-15203 - Wrong result
innodb.innodb_monitor : MDEV-10939 - Testcase timeout
innodb.innodb_mutexes : MDEV-23416 - Extra warning
innodb.innodb_mysql : MDEV-19873 - Wrong result
innodb.innodb_scrub : Modified in 10.5.7
innodb.innodb_simulate_comp_failures_small : MDEV-20526 - ASAN use-after-poison
......
......@@ -15838,54 +15838,6 @@ innodb_show_mutex_status(
DBUG_RETURN(0);
}
/** Implement SHOW ENGINE INNODB MUTEX for rw-locks.
@param hton the innodb handlerton
@param thd connection
@param fn function for printing statistics
@return 0 on success. */
static
int
innodb_show_rwlock_status(handlerton* ut_d(hton), THD *thd, stat_print_fn *fn)
{
DBUG_ENTER("innodb_show_rwlock_status");
ut_ad(hton == innodb_hton_ptr);
char waits[20 + sizeof "waits="];
DBUG_RETURN(!dict_sys.for_each_index([&](const dict_index_t &i)
{
uint32_t waited= 0; // FIXME
if (!waited)
return true;
snprintf(waits, sizeof waits, "waits=%u", waited);
std::ostringstream s;
s << i.name << '(' << i.table->name << ')';
return !fn(thd, STRING_WITH_LEN(innobase_hton_name),
s.str().data(), s.str().size(), waits, strlen(waits));
}));
}
/** Implements the SHOW MUTEX STATUS command.
@param[in,out] hton the innodb handlerton
@param[in,out] thd the MySQL query thread of the caller
@param[in,out] stat_print function for printing statistics
@return 0 on success. */
static
int
innodb_show_latch_status(
handlerton* hton,
THD* thd,
stat_print_fn* stat_print)
{
int ret = innodb_show_mutex_status(hton, thd, stat_print);
if (ret != 0) {
return(ret);
}
return(innodb_show_rwlock_status(hton, thd, stat_print));
}
/************************************************************************//**
Return 0 on success and non-zero on failure. Note: the bool return type
seems to be abused here, should be an int. */
......@@ -15907,7 +15859,7 @@ innobase_show_status(
return(innodb_show_status(hton, thd, stat_print) != 0);
case HA_ENGINE_MUTEX:
return(innodb_show_latch_status(hton, thd, stat_print) != 0);
return(innodb_show_mutex_status(hton, thd, stat_print) != 0);
case HA_ENGINE_LOGS:
/* Not handled */
......@@ -19619,7 +19571,6 @@ i_s_innodb_sys_foreign,
i_s_innodb_sys_foreign_cols,
i_s_innodb_sys_tablespaces,
i_s_innodb_sys_virtual,
i_s_innodb_mutexes,
i_s_innodb_sys_semaphore_waits,
i_s_innodb_tablespaces_encryption
maria_declare_plugin_end;
......
......@@ -6880,124 +6880,6 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_tablespaces_encryption =
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE)
};
namespace Show {
/** INNODB_MUTEXES *********************************************/
/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_MUTEXES */
static ST_FIELD_INFO innodb_mutexes_fields_info[] =
{
Column("NAME", Varchar(OS_FILE_MAX_PATH), NOT_NULL),
Column("OS_WAITS", ULonglong(), NOT_NULL),
CEnd()
};
} // namespace Show
/*******************************************************************//**
Function to populate INFORMATION_SCHEMA.INNODB_MUTEXES table.
@see innodb_show_rwlock_status
@return 0 on success */
static
int
i_s_innodb_mutexes_fill_table(
/*==========================*/
THD* thd, /*!< in: thread */
TABLE_LIST* tables, /*!< in/out: tables to fill */
Item* ) /*!< in: condition (not used) */
{
DBUG_ENTER("i_s_innodb_mutexes_fill_table");
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str);
if (check_global_access(thd, PROCESS_ACL))
DBUG_RETURN(0);
Field **fields= tables->table->field;
fields[0]->set_notnull();
fields[1]->set_notnull();
DBUG_RETURN(!dict_sys.for_each_index([&](const dict_index_t &i)
{
uint32_t waited= 0;// FIXME
if (!waited)
return true;
if (fields[1]->store(waited, true))
return false;
std::ostringstream s;
s << i.name << '(' << i.table->name << ')';
return !fields[0]->store(s.str().data(), s.str().size(),
system_charset_info) &&
!schema_table_store_record(thd, tables->table);
}));
}
/*******************************************************************//**
Bind the dynamic table INFORMATION_SCHEMA.INNODB_MUTEXES
@return 0 on success */
static
int
innodb_mutexes_init(
/*================*/
void* p) /*!< in/out: table schema object */
{
ST_SCHEMA_TABLE* schema;
DBUG_ENTER("innodb_mutexes_init");
schema = (ST_SCHEMA_TABLE*) p;
schema->fields_info = Show::innodb_mutexes_fields_info;
schema->fill_table = i_s_innodb_mutexes_fill_table;
DBUG_RETURN(0);
}
UNIV_INTERN struct st_maria_plugin i_s_innodb_mutexes =
{
/* the plugin type (a MYSQL_XXX_PLUGIN value) */
/* int */
STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
/* pointer to type-specific plugin descriptor */
/* void* */
STRUCT_FLD(info, &i_s_info),
/* plugin name */
/* const char* */
STRUCT_FLD(name, "INNODB_MUTEXES"),
/* plugin author (for SHOW PLUGINS) */
/* const char* */
STRUCT_FLD(author, plugin_author),
/* general descriptive text (for SHOW PLUGINS) */
/* const char* */
STRUCT_FLD(descr, "Information on InnoDB rw-locks"),
/* the plugin license (PLUGIN_LICENSE_XXX) */
/* int */
STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
/* the function to invoke when plugin is loaded */
/* int (*)(void*); */
STRUCT_FLD(init, innodb_mutexes_init),
/* the function to invoke when plugin is unloaded */
/* int (*)(void*); */
STRUCT_FLD(deinit, i_s_common_deinit),
/* plugin version (for SHOW PLUGINS) */
/* unsigned int */
STRUCT_FLD(version, INNODB_VERSION_SHORT),
/* struct st_mysql_show_var* */
STRUCT_FLD(status_vars, NULL),
/* struct st_mysql_sys_var** */
STRUCT_FLD(system_vars, NULL),
/* Maria extension */
STRUCT_FLD(version_info, INNODB_VERSION_STR),
STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE),
};
namespace Show {
/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_SYS_SEMAPHORE_WAITS */
static ST_FIELD_INFO innodb_sys_semaphore_waits_fields_info[] =
......
......@@ -59,7 +59,6 @@ extern struct st_maria_plugin i_s_innodb_sys_fields;
extern struct st_maria_plugin i_s_innodb_sys_foreign;
extern struct st_maria_plugin i_s_innodb_sys_foreign_cols;
extern struct st_maria_plugin i_s_innodb_sys_tablespaces;
extern struct st_maria_plugin i_s_innodb_mutexes;
extern struct st_maria_plugin i_s_innodb_sys_virtual;
extern struct st_maria_plugin i_s_innodb_tablespaces_encryption;
extern struct st_maria_plugin i_s_innodb_sys_semaphore_waits;
......
......@@ -1531,19 +1531,6 @@ class dict_sys_t
return table->can_be_evicted ? find<true>(table) : find<false>(table);
}
#endif
private:
/** Invoke f on each index of a table, until it returns false
@param f function object
@param t table
@retval false if f returned false
@retval true if f never returned false */
template<typename F>
inline bool for_each_index(const F &f, const dict_table_t *t);
public:
/** Invoke f on each index of each persistent table, until it returns false
@retval false if f returned false
@retval true if f never returned false */
template<typename F> inline bool for_each_index(const F &f);
/** Move a table to the non-LRU list from the LRU list. */
void prevent_eviction(dict_table_t* table)
......@@ -1611,39 +1598,6 @@ extern dict_sys_t dict_sys;
#define dict_sys_lock() dict_sys.lock(__FILE__, __LINE__)
#define dict_sys_unlock() dict_sys.unlock()
template<typename F>
inline bool dict_sys_t::for_each_index(const F &f, const dict_table_t *t)
{
const dict_index_t *i= UT_LIST_GET_FIRST(t->indexes);
do
{
if (!i->is_corrupted() && !f(*i))
return false;
i= UT_LIST_GET_NEXT(indexes, i);
}
while (i);
return true;
}
template<typename F>
inline bool dict_sys_t::for_each_index(const F &f)
{
struct Locking
{
Locking() { mutex_enter(&dict_sys.mutex); }
~Locking() { mutex_exit(&dict_sys.mutex); }
} locking;
for (const dict_table_t *t= UT_LIST_GET_FIRST(table_non_LRU);
t; t= UT_LIST_GET_NEXT(table_LRU, t))
if (!for_each_index(f, t))
return false;
for (const dict_table_t *t= UT_LIST_GET_FIRST(table_LRU);
t; t= UT_LIST_GET_NEXT(table_LRU, t))
if (!for_each_index(f, t))
return false;
return true;
}
/* Auxiliary structs for checking a table definition @{ */
/* This struct is used to specify the name and type that a column must
......
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