mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-33881 Userstat skips system tables inconsistently
Fixed that no tables from 'mysql' schema are included in userstat. A beneif of this is that the server is not reading statistics tables if mysql.proc or other tables in mysql is accessed.
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
--- mysqldump-system.result
|
--- mysqldump-system.result
|
||||||
+++ mysqldump-system,win.result
|
+++ mysqldump-system,win.result
|
||||||
@@ -449,9 +449,9 @@
|
@@ -1861,9 +1861,9 @@
|
||||||
Table Checksum
|
Table Checksum
|
||||||
mysql.roles_mapping 2510045525
|
mysql.roles_mapping 2510045525
|
||||||
mysql.time_zone_transition 3719776009
|
mysql.time_zone_transition 3719776009
|
||||||
@ -9,10 +9,10 @@
|
|||||||
mysql.servers 2079085450
|
mysql.servers 2079085450
|
||||||
-mysql.func 3241572444
|
-mysql.func 3241572444
|
||||||
+mysql.func 310494789
|
+mysql.func 310494789
|
||||||
mysql.innodb_table_stats 1285726777
|
mysql.innodb_table_stats 1972297402
|
||||||
mysql.table_stats 2836905944
|
mysql.table_stats 1911089388
|
||||||
# Opps....
|
# Opps....
|
||||||
@@ -484,9 +484,9 @@
|
@@ -1896,9 +1896,9 @@
|
||||||
Table Checksum
|
Table Checksum
|
||||||
mysql.roles_mapping 2510045525
|
mysql.roles_mapping 2510045525
|
||||||
mysql.time_zone_transition 3719776009
|
mysql.time_zone_transition 3719776009
|
||||||
@ -21,6 +21,6 @@
|
|||||||
mysql.servers 2079085450
|
mysql.servers 2079085450
|
||||||
-mysql.func 3241572444
|
-mysql.func 3241572444
|
||||||
+mysql.func 310494789
|
+mysql.func 310494789
|
||||||
mysql.innodb_table_stats 1285726777
|
mysql.innodb_table_stats 1972297402
|
||||||
mysql.table_stats 2836905944
|
mysql.table_stats 1911089388
|
||||||
DROP FUNCTION IF EXISTS metaphon;
|
DROP FUNCTION IF EXISTS metaphon;
|
||||||
|
@ -19,20 +19,20 @@ GRANT role_2 TO foobar;
|
|||||||
SET DEFAULT ROLE role_2 FOR foobar;
|
SET DEFAULT ROLE role_2 FOR foobar;
|
||||||
ALTER TABLE mysql.roles_mapping ORDER BY Host, User, Role;
|
ALTER TABLE mysql.roles_mapping ORDER BY Host, User, Role;
|
||||||
set @save_innodb_stats_persistent= @@innodb_stats_persistent;
|
set @save_innodb_stats_persistent= @@innodb_stats_persistent;
|
||||||
create table mysql.tz like mysql.time_zone_transition;
|
create table test.tz like mysql.time_zone_transition;
|
||||||
alter table mysql.tz engine=innodb;
|
alter table test.tz engine=innodb;
|
||||||
insert into mysql.tz select * from mysql.time_zone_transition;
|
insert into test.tz select * from mysql.time_zone_transition;
|
||||||
set global innodb_stats_persistent=1;
|
set global innodb_stats_persistent=1;
|
||||||
set time_zone="+03:00";
|
set time_zone="+03:00";
|
||||||
SET TIMESTAMP= UNIX_TIMESTAMP('2022-01-07 07:07:00');
|
SET TIMESTAMP= UNIX_TIMESTAMP('2022-01-07 07:07:00');
|
||||||
ANALYZE TABLE mysql.tz PERSISTENT FOR ALL;
|
ANALYZE TABLE test.tz PERSISTENT FOR ALL;
|
||||||
Table Op Msg_type Msg_text
|
Table Op Msg_type Msg_text
|
||||||
mysql.tz analyze status Engine-independent statistics collected
|
test.tz analyze status Engine-independent statistics collected
|
||||||
mysql.tz analyze status OK
|
test.tz analyze status OK
|
||||||
delete from mysql.index_stats where prefix_arity!=1;
|
delete from mysql.index_stats where prefix_arity!=1;
|
||||||
delete from mysql.column_stats where column_name!='Time_zone_id';
|
delete from mysql.column_stats where column_name!='Time_zone_id';
|
||||||
update mysql.innodb_index_stats set last_update="2020-01-01" where database_name="mysql" and table_name="tz";
|
update mysql.innodb_index_stats set last_update="2020-01-01" where database_name="test" and table_name="tz";
|
||||||
update mysql.innodb_table_stats set last_update="2020-01-01" where database_name="mysql" and table_name="tz";
|
update mysql.innodb_table_stats set last_update="2020-01-01" where database_name="test" and table_name="tz";
|
||||||
update mysql.column_stats set histogram=json_replace(histogram, '$.collected_by', replace(json_value(histogram, '$.collected_by'), @@version, 'version'));
|
update mysql.column_stats set histogram=json_replace(histogram, '$.collected_by', replace(json_value(histogram, '$.collected_by'), @@version, 'version'));
|
||||||
set global innodb_stats_persistent= @save_innodb_stats_persistent;
|
set global innodb_stats_persistent= @save_innodb_stats_persistent;
|
||||||
alter table mysql.time_zone_name ORDER BY Name;
|
alter table mysql.time_zone_name ORDER BY Name;
|
||||||
@ -97,38 +97,38 @@ USE mysql;
|
|||||||
LOCK TABLES `column_stats` WRITE;
|
LOCK TABLES `column_stats` WRITE;
|
||||||
/*!40000 ALTER TABLE `column_stats` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `column_stats` DISABLE KEYS */;
|
||||||
REPLACE INTO `column_stats` VALUES
|
REPLACE INTO `column_stats` VALUES
|
||||||
('mysql','tz','Time_zone_id','1','6',0.0000,4.0000,78.8000,4,'JSON_HB','{\"target_histogram_size\": 254, \"collected_at\": \"2022-01-07 07:07:00\", \"collected_by\": \"version\", \"histogram_hb\": [{\"start\": \"1\", \"size\": 0.340101523, \"ndv\": 1}, {\"start\": \"3\", \"size\": 0.327411168, \"ndv\": 1}, {\"start\": \"4\", \"size\": 0.327411168, \"ndv\": 1}, {\"start\": \"5\", \"end\": \"6\", \"size\": 0.005076142, \"ndv\": 2}]}');
|
('test','tz','Time_zone_id','1','6',0.0000,4.0000,78.8000,4,'JSON_HB','{\"target_histogram_size\": 254, \"collected_at\": \"2022-01-07 07:07:00\", \"collected_by\": \"version\", \"histogram_hb\": [{\"start\": \"1\", \"size\": 0.340101523, \"ndv\": 1}, {\"start\": \"3\", \"size\": 0.327411168, \"ndv\": 1}, {\"start\": \"4\", \"size\": 0.327411168, \"ndv\": 1}, {\"start\": \"5\", \"end\": \"6\", \"size\": 0.005076142, \"ndv\": 2}]}');
|
||||||
/*!40000 ALTER TABLE `column_stats` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `column_stats` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
LOCK TABLES `index_stats` WRITE;
|
LOCK TABLES `index_stats` WRITE;
|
||||||
/*!40000 ALTER TABLE `index_stats` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `index_stats` DISABLE KEYS */;
|
||||||
REPLACE INTO `index_stats` VALUES
|
REPLACE INTO `index_stats` VALUES
|
||||||
('mysql','tz','PRIMARY',1,78.8000);
|
('test','tz','PRIMARY',1,78.8000);
|
||||||
/*!40000 ALTER TABLE `index_stats` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `index_stats` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
LOCK TABLES `table_stats` WRITE;
|
LOCK TABLES `table_stats` WRITE;
|
||||||
/*!40000 ALTER TABLE `table_stats` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `table_stats` DISABLE KEYS */;
|
||||||
REPLACE INTO `table_stats` VALUES
|
REPLACE INTO `table_stats` VALUES
|
||||||
('mysql','tz',394);
|
('test','tz',394);
|
||||||
/*!40000 ALTER TABLE `table_stats` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `table_stats` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
LOCK TABLES `innodb_index_stats` WRITE;
|
LOCK TABLES `innodb_index_stats` WRITE;
|
||||||
/*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */;
|
||||||
REPLACE INTO `innodb_index_stats` VALUES
|
REPLACE INTO `innodb_index_stats` VALUES
|
||||||
('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',5,1,'Time_zone_id'),
|
('test','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',5,1,'Time_zone_id'),
|
||||||
('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',394,1,'Time_zone_id,Transition_time'),
|
('test','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',394,1,'Time_zone_id,Transition_time'),
|
||||||
('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),
|
('test','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),
|
||||||
('mysql','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index');
|
('test','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index');
|
||||||
/*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
LOCK TABLES `innodb_table_stats` WRITE;
|
LOCK TABLES `innodb_table_stats` WRITE;
|
||||||
/*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */;
|
||||||
REPLACE INTO `innodb_table_stats` VALUES
|
REPLACE INTO `innodb_table_stats` VALUES
|
||||||
('mysql','tz','2019-12-31 21:00:00',394,1,0);
|
('test','tz','2019-12-31 21:00:00',394,1,0);
|
||||||
/*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
@ -717,38 +717,38 @@ USE mysql;
|
|||||||
LOCK TABLES `column_stats` WRITE;
|
LOCK TABLES `column_stats` WRITE;
|
||||||
/*!40000 ALTER TABLE `column_stats` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `column_stats` DISABLE KEYS */;
|
||||||
REPLACE INTO `column_stats` VALUES
|
REPLACE INTO `column_stats` VALUES
|
||||||
('mysql','tz','Time_zone_id','1','6',0.0000,4.0000,78.8000,4,'JSON_HB','{\"target_histogram_size\": 254, \"collected_at\": \"2022-01-07 07:07:00\", \"collected_by\": \"version\", \"histogram_hb\": [{\"start\": \"1\", \"size\": 0.340101523, \"ndv\": 1}, {\"start\": \"3\", \"size\": 0.327411168, \"ndv\": 1}, {\"start\": \"4\", \"size\": 0.327411168, \"ndv\": 1}, {\"start\": \"5\", \"end\": \"6\", \"size\": 0.005076142, \"ndv\": 2}]}');
|
('test','tz','Time_zone_id','1','6',0.0000,4.0000,78.8000,4,'JSON_HB','{\"target_histogram_size\": 254, \"collected_at\": \"2022-01-07 07:07:00\", \"collected_by\": \"version\", \"histogram_hb\": [{\"start\": \"1\", \"size\": 0.340101523, \"ndv\": 1}, {\"start\": \"3\", \"size\": 0.327411168, \"ndv\": 1}, {\"start\": \"4\", \"size\": 0.327411168, \"ndv\": 1}, {\"start\": \"5\", \"end\": \"6\", \"size\": 0.005076142, \"ndv\": 2}]}');
|
||||||
/*!40000 ALTER TABLE `column_stats` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `column_stats` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
LOCK TABLES `index_stats` WRITE;
|
LOCK TABLES `index_stats` WRITE;
|
||||||
/*!40000 ALTER TABLE `index_stats` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `index_stats` DISABLE KEYS */;
|
||||||
REPLACE INTO `index_stats` VALUES
|
REPLACE INTO `index_stats` VALUES
|
||||||
('mysql','tz','PRIMARY',1,78.8000);
|
('test','tz','PRIMARY',1,78.8000);
|
||||||
/*!40000 ALTER TABLE `index_stats` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `index_stats` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
LOCK TABLES `table_stats` WRITE;
|
LOCK TABLES `table_stats` WRITE;
|
||||||
/*!40000 ALTER TABLE `table_stats` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `table_stats` DISABLE KEYS */;
|
||||||
REPLACE INTO `table_stats` VALUES
|
REPLACE INTO `table_stats` VALUES
|
||||||
('mysql','tz',394);
|
('test','tz',394);
|
||||||
/*!40000 ALTER TABLE `table_stats` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `table_stats` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
LOCK TABLES `innodb_index_stats` WRITE;
|
LOCK TABLES `innodb_index_stats` WRITE;
|
||||||
/*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */;
|
||||||
REPLACE INTO `innodb_index_stats` VALUES
|
REPLACE INTO `innodb_index_stats` VALUES
|
||||||
('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',5,1,'Time_zone_id'),
|
('test','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',5,1,'Time_zone_id'),
|
||||||
('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',394,1,'Time_zone_id,Transition_time'),
|
('test','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',394,1,'Time_zone_id,Transition_time'),
|
||||||
('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),
|
('test','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),
|
||||||
('mysql','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index');
|
('test','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index');
|
||||||
/*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
LOCK TABLES `innodb_table_stats` WRITE;
|
LOCK TABLES `innodb_table_stats` WRITE;
|
||||||
/*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */;
|
||||||
REPLACE INTO `innodb_table_stats` VALUES
|
REPLACE INTO `innodb_table_stats` VALUES
|
||||||
('mysql','tz','2019-12-31 21:00:00',394,1,0);
|
('test','tz','2019-12-31 21:00:00',394,1,0);
|
||||||
/*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
@ -1314,38 +1314,38 @@ USE mysql;
|
|||||||
LOCK TABLES `column_stats` WRITE;
|
LOCK TABLES `column_stats` WRITE;
|
||||||
/*!40000 ALTER TABLE `column_stats` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `column_stats` DISABLE KEYS */;
|
||||||
INSERT IGNORE INTO `column_stats` VALUES
|
INSERT IGNORE INTO `column_stats` VALUES
|
||||||
('mysql','tz','Time_zone_id','1','6',0.0000,4.0000,78.8000,4,'JSON_HB','{\"target_histogram_size\": 254, \"collected_at\": \"2022-01-07 07:07:00\", \"collected_by\": \"version\", \"histogram_hb\": [{\"start\": \"1\", \"size\": 0.340101523, \"ndv\": 1}, {\"start\": \"3\", \"size\": 0.327411168, \"ndv\": 1}, {\"start\": \"4\", \"size\": 0.327411168, \"ndv\": 1}, {\"start\": \"5\", \"end\": \"6\", \"size\": 0.005076142, \"ndv\": 2}]}');
|
('test','tz','Time_zone_id','1','6',0.0000,4.0000,78.8000,4,'JSON_HB','{\"target_histogram_size\": 254, \"collected_at\": \"2022-01-07 07:07:00\", \"collected_by\": \"version\", \"histogram_hb\": [{\"start\": \"1\", \"size\": 0.340101523, \"ndv\": 1}, {\"start\": \"3\", \"size\": 0.327411168, \"ndv\": 1}, {\"start\": \"4\", \"size\": 0.327411168, \"ndv\": 1}, {\"start\": \"5\", \"end\": \"6\", \"size\": 0.005076142, \"ndv\": 2}]}');
|
||||||
/*!40000 ALTER TABLE `column_stats` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `column_stats` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
LOCK TABLES `index_stats` WRITE;
|
LOCK TABLES `index_stats` WRITE;
|
||||||
/*!40000 ALTER TABLE `index_stats` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `index_stats` DISABLE KEYS */;
|
||||||
INSERT IGNORE INTO `index_stats` VALUES
|
INSERT IGNORE INTO `index_stats` VALUES
|
||||||
('mysql','tz','PRIMARY',1,78.8000);
|
('test','tz','PRIMARY',1,78.8000);
|
||||||
/*!40000 ALTER TABLE `index_stats` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `index_stats` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
LOCK TABLES `table_stats` WRITE;
|
LOCK TABLES `table_stats` WRITE;
|
||||||
/*!40000 ALTER TABLE `table_stats` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `table_stats` DISABLE KEYS */;
|
||||||
INSERT IGNORE INTO `table_stats` VALUES
|
INSERT IGNORE INTO `table_stats` VALUES
|
||||||
('mysql','tz',394);
|
('test','tz',394);
|
||||||
/*!40000 ALTER TABLE `table_stats` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `table_stats` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
LOCK TABLES `innodb_index_stats` WRITE;
|
LOCK TABLES `innodb_index_stats` WRITE;
|
||||||
/*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `innodb_index_stats` DISABLE KEYS */;
|
||||||
INSERT IGNORE INTO `innodb_index_stats` VALUES
|
INSERT IGNORE INTO `innodb_index_stats` VALUES
|
||||||
('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',5,1,'Time_zone_id'),
|
('test','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx01',5,1,'Time_zone_id'),
|
||||||
('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',394,1,'Time_zone_id,Transition_time'),
|
('test','tz','PRIMARY','2019-12-31 21:00:00','n_diff_pfx02',394,1,'Time_zone_id,Transition_time'),
|
||||||
('mysql','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),
|
('test','tz','PRIMARY','2019-12-31 21:00:00','n_leaf_pages',1,NULL,'Number of leaf pages in the index'),
|
||||||
('mysql','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index');
|
('test','tz','PRIMARY','2019-12-31 21:00:00','size',1,NULL,'Number of pages in the index');
|
||||||
/*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `innodb_index_stats` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
LOCK TABLES `innodb_table_stats` WRITE;
|
LOCK TABLES `innodb_table_stats` WRITE;
|
||||||
/*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */;
|
/*!40000 ALTER TABLE `innodb_table_stats` DISABLE KEYS */;
|
||||||
INSERT IGNORE INTO `innodb_table_stats` VALUES
|
INSERT IGNORE INTO `innodb_table_stats` VALUES
|
||||||
('mysql','tz','2019-12-31 21:00:00',394,1,0);
|
('test','tz','2019-12-31 21:00:00',394,1,0);
|
||||||
/*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */;
|
/*!40000 ALTER TABLE `innodb_table_stats` ENABLE KEYS */;
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
|
|
||||||
@ -1867,8 +1867,8 @@ mysql.time_zone_transition 3719776009
|
|||||||
mysql.plugin 1587119305
|
mysql.plugin 1587119305
|
||||||
mysql.servers 2079085450
|
mysql.servers 2079085450
|
||||||
mysql.func 3241572444
|
mysql.func 3241572444
|
||||||
mysql.innodb_table_stats 1285726777
|
mysql.innodb_table_stats 1972297402
|
||||||
mysql.table_stats 2836905944
|
mysql.table_stats 1911089388
|
||||||
# Opps....
|
# Opps....
|
||||||
CREATE USER mariadb_test_restore IDENTIFIED BY 'getitback';
|
CREATE USER mariadb_test_restore IDENTIFIED BY 'getitback';
|
||||||
GRANT ALL ON *.* TO mariadb_test_restore WITH GRANT OPTION;
|
GRANT ALL ON *.* TO mariadb_test_restore WITH GRANT OPTION;
|
||||||
@ -1902,16 +1902,16 @@ mysql.time_zone_transition 3719776009
|
|||||||
mysql.plugin 1587119305
|
mysql.plugin 1587119305
|
||||||
mysql.servers 2079085450
|
mysql.servers 2079085450
|
||||||
mysql.func 3241572444
|
mysql.func 3241572444
|
||||||
mysql.innodb_table_stats 1285726777
|
mysql.innodb_table_stats 1972297402
|
||||||
mysql.table_stats 2836905944
|
mysql.table_stats 1911089388
|
||||||
DROP FUNCTION IF EXISTS metaphon;
|
DROP FUNCTION IF EXISTS metaphon;
|
||||||
DROP SERVER s1;
|
DROP SERVER s1;
|
||||||
DELETE FROM mysql.column_stats WHERE db_name='mysql' and table_name in ('tz', 'gtid_slave_pos');
|
DELETE FROM mysql.column_stats WHERE db_name='mysql';
|
||||||
DELETE FROM mysql.index_stats WHERE db_name='mysql' and table_name in ('tz', 'gtid_slave_pos');
|
DELETE FROM mysql.index_stats WHERE db_name='mysql';
|
||||||
DELETE FROM mysql.table_stats WHERE db_name='mysql' and table_name in ('tz', 'gtid_slave_pos');
|
DELETE FROM mysql.table_stats WHERE db_name='mysql';
|
||||||
DELETE FROM mysql.innodb_index_stats WHERE database_name='mysql' and table_name in ('tz','gtid_slave_pos');
|
DELETE FROM mysql.innodb_index_stats WHERE database_name='test';
|
||||||
DELETE FROM mysql.innodb_table_stats WHERE database_name='mysql' and table_name in ('tz','gtid_slave_pos');
|
DELETE FROM mysql.innodb_table_stats WHERE database_name='mysql';
|
||||||
drop table mysql.tz;
|
drop table test.tz;
|
||||||
DROP ROLE role_2;
|
DROP ROLE role_2;
|
||||||
DROP ROLE role_1;
|
DROP ROLE role_1;
|
||||||
drop user foobar;
|
drop user foobar;
|
||||||
|
@ -39,18 +39,18 @@ ALTER TABLE mysql.roles_mapping ORDER BY Host, User, Role;
|
|||||||
# innodb and EITS tables statistics
|
# innodb and EITS tables statistics
|
||||||
#
|
#
|
||||||
set @save_innodb_stats_persistent= @@innodb_stats_persistent;
|
set @save_innodb_stats_persistent= @@innodb_stats_persistent;
|
||||||
create table mysql.tz like mysql.time_zone_transition;
|
create table test.tz like mysql.time_zone_transition;
|
||||||
alter table mysql.tz engine=innodb;
|
alter table test.tz engine=innodb;
|
||||||
insert into mysql.tz select * from mysql.time_zone_transition;
|
insert into test.tz select * from mysql.time_zone_transition;
|
||||||
set global innodb_stats_persistent=1;
|
set global innodb_stats_persistent=1;
|
||||||
set time_zone="+03:00";
|
set time_zone="+03:00";
|
||||||
SET TIMESTAMP= UNIX_TIMESTAMP('2022-01-07 07:07:00');
|
SET TIMESTAMP= UNIX_TIMESTAMP('2022-01-07 07:07:00');
|
||||||
ANALYZE TABLE mysql.tz PERSISTENT FOR ALL;
|
ANALYZE TABLE test.tz PERSISTENT FOR ALL;
|
||||||
# for predictable output in tests
|
# for predictable output in tests
|
||||||
delete from mysql.index_stats where prefix_arity!=1;
|
delete from mysql.index_stats where prefix_arity!=1;
|
||||||
delete from mysql.column_stats where column_name!='Time_zone_id';
|
delete from mysql.column_stats where column_name!='Time_zone_id';
|
||||||
update mysql.innodb_index_stats set last_update="2020-01-01" where database_name="mysql" and table_name="tz";
|
update mysql.innodb_index_stats set last_update="2020-01-01" where database_name="test" and table_name="tz";
|
||||||
update mysql.innodb_table_stats set last_update="2020-01-01" where database_name="mysql" and table_name="tz";
|
update mysql.innodb_table_stats set last_update="2020-01-01" where database_name="test" and table_name="tz";
|
||||||
update mysql.column_stats set histogram=json_replace(histogram, '$.collected_by', replace(json_value(histogram, '$.collected_by'), @@version, 'version'));
|
update mysql.column_stats set histogram=json_replace(histogram, '$.collected_by', replace(json_value(histogram, '$.collected_by'), @@version, 'version'));
|
||||||
set global innodb_stats_persistent= @save_innodb_stats_persistent;
|
set global innodb_stats_persistent= @save_innodb_stats_persistent;
|
||||||
alter table mysql.time_zone_name ORDER BY Name;
|
alter table mysql.time_zone_name ORDER BY Name;
|
||||||
@ -144,12 +144,12 @@ DROP FUNCTION IF EXISTS metaphon;
|
|||||||
DROP SERVER s1;
|
DROP SERVER s1;
|
||||||
|
|
||||||
# EITS && innodb stats
|
# EITS && innodb stats
|
||||||
DELETE FROM mysql.column_stats WHERE db_name='mysql' and table_name in ('tz', 'gtid_slave_pos');
|
DELETE FROM mysql.column_stats WHERE db_name='mysql';
|
||||||
DELETE FROM mysql.index_stats WHERE db_name='mysql' and table_name in ('tz', 'gtid_slave_pos');
|
DELETE FROM mysql.index_stats WHERE db_name='mysql';
|
||||||
DELETE FROM mysql.table_stats WHERE db_name='mysql' and table_name in ('tz', 'gtid_slave_pos');
|
DELETE FROM mysql.table_stats WHERE db_name='mysql';
|
||||||
DELETE FROM mysql.innodb_index_stats WHERE database_name='mysql' and table_name in ('tz','gtid_slave_pos');
|
DELETE FROM mysql.innodb_index_stats WHERE database_name='test';
|
||||||
DELETE FROM mysql.innodb_table_stats WHERE database_name='mysql' and table_name in ('tz','gtid_slave_pos');
|
DELETE FROM mysql.innodb_table_stats WHERE database_name='mysql';
|
||||||
drop table mysql.tz;
|
drop table test.tz;
|
||||||
|
|
||||||
DROP ROLE role_2;
|
DROP ROLE role_2;
|
||||||
DROP ROLE role_1;
|
DROP ROLE role_1;
|
||||||
|
@ -2145,11 +2145,8 @@ select Host, User from mysql.user limit 0;
|
|||||||
Host User
|
Host User
|
||||||
show open tables from mysql;
|
show open tables from mysql;
|
||||||
Database Table In_use Name_locked
|
Database Table In_use Name_locked
|
||||||
mysql column_stats 0 0
|
|
||||||
mysql general_log 0 0
|
mysql general_log 0 0
|
||||||
mysql global_priv 0 0
|
mysql global_priv 0 0
|
||||||
mysql index_stats 0 0
|
|
||||||
mysql table_stats 0 0
|
|
||||||
mysql user 0 0
|
mysql user 0 0
|
||||||
call proc_1();
|
call proc_1();
|
||||||
show open tables from mysql;
|
show open tables from mysql;
|
||||||
@ -2159,11 +2156,8 @@ select Host, User from mysql.user limit 0;
|
|||||||
Host User
|
Host User
|
||||||
show open tables from mysql;
|
show open tables from mysql;
|
||||||
Database Table In_use Name_locked
|
Database Table In_use Name_locked
|
||||||
mysql column_stats 0 0
|
|
||||||
mysql general_log 0 0
|
mysql general_log 0 0
|
||||||
mysql global_priv 0 0
|
mysql global_priv 0 0
|
||||||
mysql index_stats 0 0
|
|
||||||
mysql table_stats 0 0
|
|
||||||
mysql user 0 0
|
mysql user 0 0
|
||||||
call proc_1();
|
call proc_1();
|
||||||
show open tables from mysql;
|
show open tables from mysql;
|
||||||
@ -2173,11 +2167,8 @@ select Host, User from mysql.user limit 0;
|
|||||||
Host User
|
Host User
|
||||||
show open tables from mysql;
|
show open tables from mysql;
|
||||||
Database Table In_use Name_locked
|
Database Table In_use Name_locked
|
||||||
mysql column_stats 0 0
|
|
||||||
mysql general_log 0 0
|
mysql general_log 0 0
|
||||||
mysql global_priv 0 0
|
mysql global_priv 0 0
|
||||||
mysql index_stats 0 0
|
|
||||||
mysql table_stats 0 0
|
|
||||||
mysql user 0 0
|
mysql user 0 0
|
||||||
call proc_1();
|
call proc_1();
|
||||||
show open tables from mysql;
|
show open tables from mysql;
|
||||||
@ -2187,11 +2178,8 @@ select Host, User from mysql.user limit 0;
|
|||||||
Host User
|
Host User
|
||||||
show open tables from mysql;
|
show open tables from mysql;
|
||||||
Database Table In_use Name_locked
|
Database Table In_use Name_locked
|
||||||
mysql column_stats 0 0
|
|
||||||
mysql general_log 0 0
|
mysql general_log 0 0
|
||||||
mysql global_priv 0 0
|
mysql global_priv 0 0
|
||||||
mysql index_stats 0 0
|
|
||||||
mysql table_stats 0 0
|
|
||||||
mysql user 0 0
|
mysql user 0 0
|
||||||
flush tables;
|
flush tables;
|
||||||
create function func_1() returns int begin flush tables; return 1; end|
|
create function func_1() returns int begin flush tables; return 1; end|
|
||||||
@ -2206,11 +2194,8 @@ select Host, User from mysql.user limit 0;
|
|||||||
Host User
|
Host User
|
||||||
show open tables from mysql;
|
show open tables from mysql;
|
||||||
Database Table In_use Name_locked
|
Database Table In_use Name_locked
|
||||||
mysql column_stats 0 0
|
|
||||||
mysql general_log 0 0
|
mysql general_log 0 0
|
||||||
mysql global_priv 0 0
|
mysql global_priv 0 0
|
||||||
mysql index_stats 0 0
|
|
||||||
mysql table_stats 0 0
|
|
||||||
mysql user 0 0
|
mysql user 0 0
|
||||||
prepare abc from "flush tables";
|
prepare abc from "flush tables";
|
||||||
execute abc;
|
execute abc;
|
||||||
@ -2221,11 +2206,8 @@ select Host, User from mysql.user limit 0;
|
|||||||
Host User
|
Host User
|
||||||
show open tables from mysql;
|
show open tables from mysql;
|
||||||
Database Table In_use Name_locked
|
Database Table In_use Name_locked
|
||||||
mysql column_stats 0 0
|
|
||||||
mysql general_log 0 0
|
mysql general_log 0 0
|
||||||
mysql global_priv 0 0
|
mysql global_priv 0 0
|
||||||
mysql index_stats 0 0
|
|
||||||
mysql table_stats 0 0
|
|
||||||
mysql user 0 0
|
mysql user 0 0
|
||||||
execute abc;
|
execute abc;
|
||||||
show open tables from mysql;
|
show open tables from mysql;
|
||||||
@ -2235,11 +2217,8 @@ select Host, User from mysql.user limit 0;
|
|||||||
Host User
|
Host User
|
||||||
show open tables from mysql;
|
show open tables from mysql;
|
||||||
Database Table In_use Name_locked
|
Database Table In_use Name_locked
|
||||||
mysql column_stats 0 0
|
|
||||||
mysql general_log 0 0
|
mysql general_log 0 0
|
||||||
mysql global_priv 0 0
|
mysql global_priv 0 0
|
||||||
mysql index_stats 0 0
|
|
||||||
mysql table_stats 0 0
|
|
||||||
mysql user 0 0
|
mysql user 0 0
|
||||||
execute abc;
|
execute abc;
|
||||||
show open tables from mysql;
|
show open tables from mysql;
|
||||||
@ -2249,11 +2228,8 @@ select Host, User from mysql.user limit 0;
|
|||||||
Host User
|
Host User
|
||||||
show open tables from mysql;
|
show open tables from mysql;
|
||||||
Database Table In_use Name_locked
|
Database Table In_use Name_locked
|
||||||
mysql column_stats 0 0
|
|
||||||
mysql general_log 0 0
|
mysql general_log 0 0
|
||||||
mysql global_priv 0 0
|
mysql global_priv 0 0
|
||||||
mysql index_stats 0 0
|
|
||||||
mysql table_stats 0 0
|
|
||||||
mysql user 0 0
|
mysql user 0 0
|
||||||
flush tables;
|
flush tables;
|
||||||
deallocate prepare abc;
|
deallocate prepare abc;
|
||||||
|
@ -240,12 +240,18 @@ set @@global.general_log=@save_general_log;
|
|||||||
#
|
#
|
||||||
create function f() returns int return (select 1 from performance_schema.threads);
|
create function f() returns int return (select 1 from performance_schema.threads);
|
||||||
set global userstat= 1;
|
set global userstat= 1;
|
||||||
|
create table t1 (a int primary key);
|
||||||
|
insert into t1 values (1),(2);
|
||||||
|
select * from t1 where a=1;
|
||||||
|
a
|
||||||
|
1
|
||||||
select f() from information_schema.table_statistics;
|
select f() from information_schema.table_statistics;
|
||||||
ERROR 21000: Subquery returns more than 1 row
|
ERROR 21000: Subquery returns more than 1 row
|
||||||
select f() from information_schema.index_statistics;
|
select f() from information_schema.index_statistics;
|
||||||
ERROR 21000: Subquery returns more than 1 row
|
ERROR 21000: Subquery returns more than 1 row
|
||||||
set global userstat= 0;
|
set global userstat= 0;
|
||||||
drop function f;
|
drop function f;
|
||||||
|
drop table t1;
|
||||||
#
|
#
|
||||||
# End of 10.2 tests
|
# End of 10.2 tests
|
||||||
#
|
#
|
||||||
|
@ -122,12 +122,16 @@ set @@global.general_log=@save_general_log;
|
|||||||
--echo #
|
--echo #
|
||||||
create function f() returns int return (select 1 from performance_schema.threads);
|
create function f() returns int return (select 1 from performance_schema.threads);
|
||||||
set global userstat= 1;
|
set global userstat= 1;
|
||||||
|
create table t1 (a int primary key);
|
||||||
|
insert into t1 values (1),(2);
|
||||||
|
select * from t1 where a=1;
|
||||||
--error ER_SUBQUERY_NO_1_ROW
|
--error ER_SUBQUERY_NO_1_ROW
|
||||||
select f() from information_schema.table_statistics;
|
select f() from information_schema.table_statistics;
|
||||||
--error ER_SUBQUERY_NO_1_ROW
|
--error ER_SUBQUERY_NO_1_ROW
|
||||||
select f() from information_schema.index_statistics;
|
select f() from information_schema.index_statistics;
|
||||||
set global userstat= 0;
|
set global userstat= 0;
|
||||||
drop function f;
|
drop function f;
|
||||||
|
drop table t1;
|
||||||
--enable_ps2_protocol
|
--enable_ps2_protocol
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
@ -145,7 +149,9 @@ set global userstat= 1;
|
|||||||
create or replace table t1 (a int, key(a)) engine=MyISAM;
|
create or replace table t1 (a int, key(a)) engine=MyISAM;
|
||||||
insert into t1 values (1),(2),(3),(4);
|
insert into t1 values (1),(2),(3),(4);
|
||||||
flush index_statistics;
|
flush index_statistics;
|
||||||
|
--disable_ps2_protocol
|
||||||
select a from t1 where a in ( select a from t1 );
|
select a from t1 where a in ( select a from t1 );
|
||||||
|
--enable_ps2_protocol
|
||||||
show index_statistics;
|
show index_statistics;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
set global userstat=@save_userstat;
|
set global userstat=@save_userstat;
|
||||||
|
@ -2312,7 +2312,8 @@ retry_share:
|
|||||||
*/
|
*/
|
||||||
enum enum_mdl_type mdl_type= MDL_BACKUP_DML;
|
enum enum_mdl_type mdl_type= MDL_BACKUP_DML;
|
||||||
|
|
||||||
if (table->s->table_category != TABLE_CATEGORY_USER)
|
if (table->s->table_category != TABLE_CATEGORY_USER &&
|
||||||
|
table->s->table_category != TABLE_CATEGORY_MYSQL)
|
||||||
mdl_type= MDL_BACKUP_SYS_DML;
|
mdl_type= MDL_BACKUP_SYS_DML;
|
||||||
else if (table->s->online_backup)
|
else if (table->s->online_backup)
|
||||||
mdl_type= MDL_BACKUP_TRANS_DML;
|
mdl_type= MDL_BACKUP_TRANS_DML;
|
||||||
|
@ -324,6 +324,8 @@ TABLE_CATEGORY get_table_category(const Lex_ident_db &db,
|
|||||||
name.streq(SLOW_LOG_NAME) ||
|
name.streq(SLOW_LOG_NAME) ||
|
||||||
name.streq(TRANSACTION_REG_NAME))
|
name.streq(TRANSACTION_REG_NAME))
|
||||||
return TABLE_CATEGORY_LOG;
|
return TABLE_CATEGORY_LOG;
|
||||||
|
|
||||||
|
return TABLE_CATEGORY_MYSQL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TABLE_CATEGORY_USER;
|
return TABLE_CATEGORY_USER;
|
||||||
|
@ -490,6 +490,11 @@ enum enum_table_category
|
|||||||
*/
|
*/
|
||||||
TABLE_CATEGORY_LOG=5,
|
TABLE_CATEGORY_LOG=5,
|
||||||
|
|
||||||
|
/**
|
||||||
|
Other tables in the mysql schema, like global_priv and db
|
||||||
|
*/
|
||||||
|
TABLE_CATEGORY_MYSQL= 6,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Types below are read only tables, not affected by FLUSH TABLES or
|
Types below are read only tables, not affected by FLUSH TABLES or
|
||||||
MDL locks.
|
MDL locks.
|
||||||
@ -514,7 +519,7 @@ enum enum_table_category
|
|||||||
to I_S tables in the table cache, which should use
|
to I_S tables in the table cache, which should use
|
||||||
this table type.
|
this table type.
|
||||||
*/
|
*/
|
||||||
TABLE_CATEGORY_INFORMATION=6,
|
TABLE_CATEGORY_INFORMATION=7,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Performance schema tables.
|
Performance schema tables.
|
||||||
@ -536,7 +541,7 @@ enum enum_table_category
|
|||||||
The server implementation perform writes.
|
The server implementation perform writes.
|
||||||
Performance tables are cached in the table cache.
|
Performance tables are cached in the table cache.
|
||||||
*/
|
*/
|
||||||
TABLE_CATEGORY_PERFORMANCE=7
|
TABLE_CATEGORY_PERFORMANCE=8
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum enum_table_category TABLE_CATEGORY;
|
typedef enum enum_table_category TABLE_CATEGORY;
|
||||||
|
Reference in New Issue
Block a user