Commit a584366a authored by unknown's avatar unknown

Merge XtraDB from Percona Server 5.1.49-12 into MariaDB.

parents 544cdf76 49915031
SELECT c.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as not_zero_region_count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count > 0;
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
SELECT SLEEP(0.31);
SELECT SLEEP(0.32);
SELECT SLEEP(0.33);
SELECT SLEEP(0.34);
SELECT SLEEP(0.35);
SELECT SLEEP(0.36);
SELECT SLEEP(0.37);
SELECT SLEEP(0.38);
SELECT SLEEP(0.39);
SELECT SLEEP(0.40);
SELECT SLEEP(1.1);
SELECT SLEEP(1.2);
SELECT SLEEP(1.3);
SELECT SLEEP(1.5);
SELECT SLEEP(1.4);
SELECT SLEEP(0.5);
SELECT SLEEP(2.1);
SELECT SLEEP(2.3);
SELECT SLEEP(2.5);
......@@ -66,6 +66,7 @@ INNODB_LOCKS
INNODB_LOCK_WAITS
INNODB_RSEG
INNODB_SYS_INDEXES
INNODB_SYS_STATS
INNODB_SYS_TABLES
INNODB_TABLE_STATS
INNODB_TRX
......@@ -859,7 +860,6 @@ TABLE_NAME COLUMN_NAME PRIVILEGES
COLUMNS TABLE_NAME select
COLUMN_PRIVILEGES TABLE_NAME select
FILES TABLE_NAME select
INNODB_BUFFER_POOL_PAGES_INDEX table_name select
INNODB_INDEX_STATS table_name select
INNODB_TABLE_STATS table_name select
KEY_COLUMN_USAGE TABLE_NAME select
......
......@@ -39,13 +39,14 @@ XTRADB_ADMIN_COMMAND
INNODB_TRX
INNODB_SYS_TABLES
INNODB_LOCK_WAITS
INNODB_CMPMEM_RESET
INNODB_SYS_STATS
INNODB_LOCKS
INNODB_CMPMEM
INNODB_TABLE_STATS
INNODB_SYS_INDEXES
INNODB_CMP_RESET
INNODB_BUFFER_POOL_PAGES_BLOB
INNODB_CMPMEM_RESET
INNODB_INDEX_STATS
SELECT t.table_name, c1.column_name
FROM information_schema.tables t
......@@ -95,18 +96,19 @@ PBXT_STATISTICS ID
INNODB_CMP page_size
INNODB_RSEG rseg_id
XTRADB_ENHANCEMENTS name
INNODB_BUFFER_POOL_PAGES_INDEX schema_name
INNODB_BUFFER_POOL_PAGES_INDEX index_id
XTRADB_ADMIN_COMMAND result_message
INNODB_TRX trx_id
INNODB_SYS_TABLES SCHEMA
INNODB_LOCK_WAITS requesting_trx_id
INNODB_CMPMEM_RESET page_size
INNODB_SYS_STATS INDEX_ID
INNODB_LOCKS lock_id
INNODB_CMPMEM page_size
INNODB_TABLE_STATS table_schema
INNODB_SYS_INDEXES TABLE_ID
INNODB_CMP_RESET page_size
INNODB_BUFFER_POOL_PAGES_BLOB space_id
INNODB_CMPMEM_RESET page_size
INNODB_INDEX_STATS table_schema
SELECT t.table_name, c1.column_name
FROM information_schema.tables t
......@@ -156,18 +158,19 @@ PBXT_STATISTICS ID
INNODB_CMP page_size
INNODB_RSEG rseg_id
XTRADB_ENHANCEMENTS name
INNODB_BUFFER_POOL_PAGES_INDEX schema_name
INNODB_BUFFER_POOL_PAGES_INDEX index_id
XTRADB_ADMIN_COMMAND result_message
INNODB_TRX trx_id
INNODB_SYS_TABLES SCHEMA
INNODB_LOCK_WAITS requesting_trx_id
INNODB_CMPMEM_RESET page_size
INNODB_SYS_STATS INDEX_ID
INNODB_LOCKS lock_id
INNODB_CMPMEM page_size
INNODB_TABLE_STATS table_schema
INNODB_SYS_INDEXES TABLE_ID
INNODB_CMP_RESET page_size
INNODB_BUFFER_POOL_PAGES_BLOB space_id
INNODB_CMPMEM_RESET page_size
INNODB_INDEX_STATS table_schema
select 1 as f1 from information_schema.tables where "CHARACTER_SETS"=
(select cast(table_name as char) from information_schema.tables
......@@ -212,6 +215,7 @@ INNODB_LOCKS information_schema.INNODB_LOCKS 1
INNODB_LOCK_WAITS information_schema.INNODB_LOCK_WAITS 1
INNODB_RSEG information_schema.INNODB_RSEG 1
INNODB_SYS_INDEXES information_schema.INNODB_SYS_INDEXES 1
INNODB_SYS_STATS information_schema.INNODB_SYS_STATS 1
INNODB_SYS_TABLES information_schema.INNODB_SYS_TABLES 1
INNODB_TABLE_STATS information_schema.INNODB_TABLE_STATS 1
INNODB_TRX information_schema.INNODB_TRX 1
......@@ -277,13 +281,14 @@ Database: information_schema
| INNODB_TRX |
| INNODB_SYS_TABLES |
| INNODB_LOCK_WAITS |
| INNODB_CMPMEM_RESET |
| INNODB_SYS_STATS |
| INNODB_LOCKS |
| INNODB_CMPMEM |
| INNODB_TABLE_STATS |
| INNODB_SYS_INDEXES |
| INNODB_CMP_RESET |
| INNODB_BUFFER_POOL_PAGES_BLOB |
| INNODB_CMPMEM_RESET |
| INNODB_INDEX_STATS |
+---------------------------------------+
Database: INFORMATION_SCHEMA
......@@ -328,13 +333,14 @@ Database: INFORMATION_SCHEMA
| INNODB_TRX |
| INNODB_SYS_TABLES |
| INNODB_LOCK_WAITS |
| INNODB_CMPMEM_RESET |
| INNODB_SYS_STATS |
| INNODB_LOCKS |
| INNODB_CMPMEM |
| INNODB_TABLE_STATS |
| INNODB_SYS_INDEXES |
| INNODB_CMP_RESET |
| INNODB_BUFFER_POOL_PAGES_BLOB |
| INNODB_CMPMEM_RESET |
| INNODB_INDEX_STATS |
+---------------------------------------+
Wildcard: inf_rmation_schema
......@@ -345,5 +351,5 @@ Wildcard: inf_rmation_schema
+--------------------+
SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') AND table_name<>'ndb_binlog_index' AND table_name<>'ndb_apply_status' GROUP BY TABLE_SCHEMA;
table_schema count(*)
information_schema 46
information_schema 47
mysql 22
......@@ -11,5 +11,4 @@
##############################################################################
#innodb : Bug#53306 2010-04-30 VasilDimov valgrind warnings
innodb_bug48024 : Waiting for merge with Percona Server; bug fixed in innodb_plugin in MySQL 5.1.48
innodb_bug53756 : Waiting for merge with Percona Server; bug fixed in innodb_plugin in MySQL 5.1.50
......@@ -10,11 +10,3 @@
#
##############################################################################
innodb_bug48024 : Waiting for merge/fix from XtraDB
innodb_bug53590 : Waiting for merge/fix from XtraDB
innodb_bug53591 : Waiting for merge/fix from XtraDB
innodb_bug53592 : Waiting for merge/fix from XtraDB
innodb-use-sys-malloc : Waiting for bugfix from Percona for LP#612600
innodb_bug53290 : Waiting for merge/fix from XtraDB
innodb_bug54679 : Waiting for merge/fix from XtraDB
innodb_bug52745 : Waiting for merge/fix from XtraDB
......@@ -8,6 +8,15 @@ percona_query_cache_with_comments_prepared_statements: Feature not merged int
percona_show_temp_tables: Feature not merged into MariaDB
percona_slow_query_log-use_global_long_query_time: Feature not merged into MariaDB
percona_query_cache_with_comments_disable: Feature not merged into MariaDB
percona_log_connection_error: Feature not merged into MariaDB
percona_query_response_time: Feature not merged into MariaDB
percona_query_response_time-stored: Feature not merged into MariaDB
percona_sql_no_fcache: Feature not merged into MariaDB
percona_status_wait_query_cache_mutex: Feature not merged into MariaDB
percona_slave_innodb_stats: Feature not merged into MariaDB
percona_query_response_time-replication: Feature not merged into MariaDB
percona_server_variables: Feature not merged into MariaDB
percona_slow_query_log-log_slow_verbosity: InnoDB filtering information not fully merged into MariaDB
percona_innodb_buffer_pool_shm: Requires big shmmax not default on many systems
show variables like 'innodb_buffer_pool_shm%';
Variable_name Value
innodb_buffer_pool_shm_key 123456
show variables like 'innodb_buffer_pool_shm%';
Variable_name Value
innodb_buffer_pool_shm_key 123456
--source include/have_innodb.inc
show variables like 'innodb_buffer_pool_shm%';
#clean shutdown (restart_mysqld.inc is not clean if over 10 sec...)
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
wait
EOF
shutdown_server 120;
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
restart
EOF
--enable_reconnect
--source include/wait_until_connected_again.inc
--disable_reconnect
show variables like 'innodb_buffer_pool_shm%';
--sleep 1
--system ipcrm -M 123456
show variables like 'innodb_use_sys_stats%';
Variable_name Value
innodb_use_sys_stats_table ON
--source include/have_innodb.inc
show variables like 'innodb_use_sys_stats%';
SET @old_max_connections = @@max_connections;
SET @old_log_warnings = @@log_warnings;
SET GLOBAL max_connections=2;
SET GLOBAL LOG_WARNINGS = 0;
connect(localhost,root,,test,port,socket);
ERROR HY000: Too many connections
SET GLOBAL LOG_WARNINGS = 1;
connect(localhost,root,,test,port,socket);
ERROR HY000: Too many connections
SET GLOBAL LOG_WARNINGS = 0;
connect(localhost,root,,test,port,socket);
ERROR HY000: Too many connections
SET GLOBAL max_connections = @old_max_connections;
SET GLOBAL log_warnings = @old_log_warnings;
1
--source include/not_embedded.inc
connect (main,localhost,root,,);
connection main;
SET @old_max_connections = @@max_connections;
SET @old_log_warnings = @@log_warnings;
SET GLOBAL max_connections=2;
let $port=`SELECT Variable_value FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE Variable_name LIKE 'port'`;
let $socket=`SELECT Variable_value FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE Variable_name LIKE 'socket'`;
SET GLOBAL LOG_WARNINGS = 0;
--connect (conn0,localhost,root,,)
connection conn0;
replace_result $port port $socket socket;
--error 1040
--connect(conn1,localhost,root,,)
disconnect conn0;
SLEEP 0.1; # tsarev: hack, but i don't know (and didn't find) how right
connection main;
SET GLOBAL LOG_WARNINGS = 1;
--connect (conn1,localhost,root,,)
replace_result $port port $socket socket;
--error 1040
--connect (conn0,localhost,root,,)
disconnect conn1;
SLEEP 0.1; # tsarev: hack, but i don't know (and didn't find) how right
connection main;
SET GLOBAL LOG_WARNINGS = 0;
--connect (conn0,localhost,root,,)
replace_result $port port $socket socket;
--error 1040
--connect(conn1,localhost,root,,)
disconnect conn0;
SLEEP 0.1; # tsarev: hack, but i don't know (and didn't find) how right
connection main;
SET GLOBAL max_connections = @old_max_connections;
SET GLOBAL log_warnings = @old_log_warnings;
let $log_error_= `SELECT @@GLOBAL.log_error`;
if(!`select LENGTH('$log_error_')`)
{
# MySQL Server on windows is started with --console and thus
# does not know the location of its .err log, use default location
let $log_error_ = $MYSQLTEST_VARDIR/log/mysqld.1.err;
}
# Assign env variable LOG_ERROR
let LOG_ERROR=$log_error_;
let cmd=cat $log_error | grep "Too many connections" | wc -l;
exec $cmd;
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
DROP TABLE IF EXISTS t;
CREATE TABLE t(id INT);
SELECT * from t;
id
SELECT * from t;
id
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1;
Warnings:
Warning 1292 Truncated incorrect query_response_time_range_base value: '1'
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 2
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 10
FLUSH QUERY_RESPONSE_TIME;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=ON;
INSERT INTO t VALUES(0);
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count)
0
INSERT INTO t VALUES(1);
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count)
0
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count)
2
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count)
3
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 2;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 2
FLUSH QUERY_RESPONSE_TIME;
INSERT INTO t VALUES(0);
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count)
0
INSERT INTO t VALUES(1);
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count)
0
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count)
2
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count)
3
DROP TABLE IF EXISTS t;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=OFF;
--source include/master-slave.inc
connection master;
-- disable_warnings
DROP TABLE IF EXISTS t;
-- enable_warnings
CREATE TABLE t(id INT);
SELECT * from t;
sync_slave_with_master;
connection slave;
SELECT * from t;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=ON;
connection master;
INSERT INTO t VALUES(0);
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
INSERT INTO t VALUES(1);
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
sync_slave_with_master;
connection slave;
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 2;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
connection master;
INSERT INTO t VALUES(0);
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
INSERT INTO t VALUES(1);
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
sync_slave_with_master;
connection slave;
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
SELECT SUM(INFORMATION_SCHEMA.QUERY_RESPONSE_TIME.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
connection master;
DROP TABLE IF EXISTS t;
sync_slave_with_master;
connection slave;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=OFF;
CREATE FUNCTION test_f()
RETURNS CHAR(30) DETERMINISTIC
BEGIN
DECLARE first VARCHAR(5);
DECLARE second VARCHAR(5);
DECLARE result VARCHAR(20);
SELECT SLEEP(1.11) INTO first;
SET first= 'Hello';
SET second=', ';
SET result= CONCAT(first,second);
SET result= CONCAT(result,'world!');
RETURN result;
END/
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1;
Warnings:
Warning 1292 Truncated incorrect query_response_time_range_base value: '1'
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 2
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 2;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 2
FLUSH QUERY_RESPONSE_TIME;
SELECT c.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as not_zero_region_count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count > 0;
count query_count not_zero_region_count region_count
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
44
SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time
0.000001
0.000003
0.000007
0.000015
0.000030
0.000061
0.000122
0.000244
0.000488
0.000976
0.001953
0.003906
0.007812
0.015625
0.031250
0.062500
0.125000
0.250000
0.500000
1.000000
2.000000
4.000000
8.000000
16.000000
32.000000
64.000000
128.000000
256.000000
512.000000
1024.000000
2048.000000
4096.000000
8192.000000
16384.000000
32768.000000
65536.000000
131072.000000
262144.000000
524288.000000
1048576.00000
2097152.00000
4194304.00000
8388608.00000
TOO LONG QUERY
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
test_f()
Hello, world!
SELECT test_f();
test_f()
Hello, world!
SELECT test_f();
test_f()
Hello, world!
SELECT test_f();
test_f()
Hello, world!
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
SELECT c.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as not_zero_region_count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count > 0;
count query_count not_zero_region_count region_count
1 5 2 44
4 5 2 44
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
44
SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time
0.000001
0.000003
0.000007
0.000015
0.000030
0.000061
0.000122
0.000244
0.000488
0.000976
0.001953
0.003906
0.007812
0.015625
0.031250
0.062500
0.125000
0.250000
0.500000
1.000000
2.000000
4.000000
8.000000
16.000000
32.000000
64.000000
128.000000
256.000000
512.000000
1024.000000
2048.000000
4096.000000
8192.000000
16384.000000
32768.000000
65536.000000
131072.000000
262144.000000
524288.000000
1048576.00000
2097152.00000
4194304.00000
8388608.00000
TOO LONG QUERY
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 2
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 10
FLUSH QUERY_RESPONSE_TIME;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
test_f()
Hello, world!
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
SELECT c.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as not_zero_region_count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count > 0;
count query_count not_zero_region_count region_count
1 2 2 14
1 2 2 14
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
14
SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time
0.000001
0.000010
0.000100
0.001000
0.010000
0.100000
1.000000
10.000000
100.000000
1000.000000
10000.000000
100000.000000
1000000.00000
TOO LONG QUERY
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 10
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 7;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 7
FLUSH QUERY_RESPONSE_TIME;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
test_f()
Hello, world!
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
SELECT c.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as not_zero_region_count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count > 0;
count query_count not_zero_region_count region_count
1 2 2 17
1 2 2 17
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
17
SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time
0.000001
0.000008
0.000059
0.000416
0.002915
0.020408
0.142857
1.000000
7.000000
49.000000
343.000000
2401.000000
16807.000000
117649.000000
823543.000000
5764801.00000
TOO LONG QUERY
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 7
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 156;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 156
FLUSH QUERY_RESPONSE_TIME;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
test_f()
Hello, world!
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
SELECT c.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as not_zero_region_count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count > 0;
count query_count not_zero_region_count region_count
1 2 2 7
1 2 2 7
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
7
SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time
0.000041
0.006410
1.000000
156.000000
24336.000000
3796416.00000
TOO LONG QUERY
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 156
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1000;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 1000
FLUSH QUERY_RESPONSE_TIME;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
test_f()
Hello, world!
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
SELECT c.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as not_zero_region_count,
(SELECT COUNT(*) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count > 0;
count query_count not_zero_region_count region_count
1 2 2 6
1 2 2 6
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
6
SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time
0.000001
0.001000
1.000000
1000.000000
1000000.00000
TOO LONG QUERY
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 1000
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1001;
Warnings:
Warning 1292 Truncated incorrect query_response_time_range_base value: '1001'
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 1000
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE =10;
DROP FUNCTION test_f;
source include/have_innodb.inc;
delimiter /;
CREATE FUNCTION test_f()
RETURNS CHAR(30) DETERMINISTIC
BEGIN
DECLARE first VARCHAR(5);
DECLARE second VARCHAR(5);
DECLARE result VARCHAR(20);
SELECT SLEEP(1.11) INTO first;
SET first= 'Hello';
SET second=', ';
SET result= CONCAT(first,second);
SET result= CONCAT(result,'world!');
RETURN result;
END/
delimiter ;/
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 2;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
source include/percona_query_response_time_show.inc;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
SELECT test_f();
SELECT test_f();
SELECT test_f();
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
source include/percona_query_response_time_show.inc;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
source include/percona_query_response_time_show.inc;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 7;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
source include/percona_query_response_time_show.inc;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 156;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
source include/percona_query_response_time_show.inc;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1000;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
source include/percona_query_response_time_show.inc;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1001;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE =10;
DROP FUNCTION test_f;
\ No newline at end of file
This diff is collapsed.
source include/have_innodb.inc;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 2;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
source include/percona_query_response_time_show.inc;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
source include/percona_query_response_time_sleep.inc;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
source include/percona_query_response_time_show.inc;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
source include/percona_query_response_time_sleep.inc;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
source include/percona_query_response_time_show.inc;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 7;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
source include/percona_query_response_time_sleep.inc;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
source include/percona_query_response_time_show.inc;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 156;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
source include/percona_query_response_time_sleep.inc;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
source include/percona_query_response_time_show.inc;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1000;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
source include/percona_query_response_time_flush.inc;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
source include/percona_query_response_time_sleep.inc;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
source include/percona_query_response_time_show.inc;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1001;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE =10;
show variables;
Variable_name Value
auto_increment_increment Value
auto_increment_offset Value
autocommit Value
automatic_sp_privileges Value
back_log Value
basedir Value
big_tables Value
binlog_cache_size Value
binlog_direct_non_transactional_updates Value
binlog_format Value
bulk_insert_buffer_size Value
character_set_client Value
character_set_connection Value
character_set_database Value
character_set_filesystem Value
character_set_results Value
character_set_server Value
character_set_system Value
character_sets_dir Value
collation_connection Value
collation_database Value
collation_server Value
completion_type Value
concurrent_insert Value
connect_timeout Value
datadir Value
date_format Value
datetime_format Value
debug Value
debug_sync Value
default_week_format Value
delay_key_write Value
delayed_insert_limit Value
delayed_insert_timeout Value
delayed_queue_size Value
div_precision_increment Value
enable_query_response_time_stats Value
engine_condition_pushdown Value
error_count Value
event_scheduler Value
expire_logs_days Value
fast_index_creation Value
flush Value
flush_time Value
foreign_key_checks Value
ft_boolean_syntax Value
ft_max_word_len Value
ft_min_word_len Value
ft_query_expansion_limit Value
ft_stopword_file Value
general_log Value
general_log_file Value
group_concat_max_len Value
have_community_features Value
have_compress Value
have_crypt Value
have_csv Value
have_dynamic_loading Value
have_geometry Value
have_innodb Value
have_ndbcluster Value
have_openssl Value
have_partitioning Value
have_query_cache Value
have_rtree_keys Value
have_ssl Value
have_symlink Value
hostname Value
identity Value
ignore_builtin_innodb Value
init_connect Value
init_file Value
init_slave Value
innodb_adaptive_checkpoint Value
innodb_adaptive_flushing Value
innodb_adaptive_hash_index Value
innodb_additional_mem_pool_size Value
innodb_autoextend_increment Value
innodb_autoinc_lock_mode Value
innodb_buffer_pool_shm_key Value
innodb_buffer_pool_size Value
innodb_change_buffering Value
innodb_checkpoint_age_target Value
innodb_checksums Value
innodb_commit_concurrency Value
innodb_concurrency_tickets Value
innodb_data_file_path Value
innodb_data_home_dir Value
innodb_dict_size_limit Value
innodb_doublewrite Value
innodb_doublewrite_file Value
innodb_enable_unsafe_group_commit Value
innodb_expand_import Value
innodb_extra_rsegments Value
innodb_extra_undoslots Value
innodb_fast_checksum Value
innodb_fast_recovery Value
innodb_fast_shutdown Value
innodb_file_format Value
innodb_file_format_check Value
innodb_file_per_table Value
innodb_flush_log_at_trx_commit Value
innodb_flush_log_at_trx_commit_session Value
innodb_flush_method Value
innodb_flush_neighbor_pages Value
innodb_force_recovery Value
innodb_ibuf_accel_rate Value
innodb_ibuf_active_contract Value
innodb_ibuf_max_size Value
innodb_io_capacity Value
innodb_lock_wait_timeout Value
innodb_locks_unsafe_for_binlog Value
innodb_log_buffer_size Value
innodb_log_file_size Value
innodb_log_files_in_group Value
innodb_log_group_home_dir Value
innodb_max_dirty_pages_pct Value
innodb_max_purge_lag Value
innodb_mirrored_log_groups Value
innodb_old_blocks_pct Value
innodb_old_blocks_time Value
innodb_open_files Value
innodb_overwrite_relay_log_info Value
innodb_page_size Value
innodb_pass_corrupt_table Value
innodb_read_ahead Value
innodb_read_ahead_threshold Value
innodb_read_io_threads Value
innodb_recovery_stats Value
innodb_replication_delay Value
innodb_rollback_on_timeout Value
innodb_show_locks_held Value
innodb_show_verbose_locks Value
innodb_spin_wait_delay Value
innodb_stats_auto_update Value
innodb_stats_method Value
innodb_stats_on_metadata Value
innodb_stats_sample_pages Value
innodb_stats_update_need_lock Value
innodb_strict_mode Value
innodb_support_xa Value
innodb_sync_spin_loops Value
innodb_table_locks Value
innodb_thread_concurrency Value
innodb_thread_concurrency_timer_based Value
innodb_thread_sleep_delay Value
innodb_use_purge_thread Value
innodb_use_sys_malloc Value
innodb_use_sys_stats_table Value
innodb_version Value
innodb_write_io_threads Value
insert_id Value
interactive_timeout Value
join_buffer_size Value
keep_files_on_create Value
key_buffer_size Value
key_cache_age_threshold Value
key_cache_block_size Value
key_cache_division_limit Value
language Value
large_files_support Value
large_page_size Value
large_pages Value
last_insert_id Value
lc_time_names Value
license Value
local_infile Value
locked_in_memory Value
log Value
log_bin Value
log_bin_trust_function_creators Value
log_bin_trust_routine_creators Value
log_error Value
log_output Value
log_queries_not_using_indexes Value
log_slave_updates Value
log_slow_filter Value
log_slow_queries Value
log_slow_rate_limit Value
log_slow_slave_statements Value
log_slow_sp_statements Value
log_slow_timestamp_every Value
log_slow_verbosity Value
log_warnings Value
long_query_time Value
low_priority_updates Value
lower_case_file_system Value
lower_case_table_names Value
max_allowed_packet Value
max_binlog_cache_size Value
max_binlog_size Value
max_connect_errors Value
max_connections Value
max_delayed_threads Value
max_error_count Value
max_heap_table_size Value
max_insert_delayed_threads Value
max_join_size Value
max_length_for_sort_data Value
max_prepared_stmt_count Value
max_relay_log_size Value
max_seeks_for_key Value
max_sort_length Value
max_sp_recursion_depth Value
max_tmp_tables Value
max_user_connections Value
max_write_lock_count Value
min_examined_row_limit Value
multi_range_count Value
myisam_data_pointer_size Value
myisam_max_sort_file_size Value
myisam_mmap_size Value
myisam_recover_options Value
myisam_repair_threads Value
myisam_sort_buffer_size Value
myisam_stats_method Value
myisam_use_mmap Value
net_buffer_length Value
net_read_timeout Value
net_retry_count Value
net_write_timeout Value
new Value
old Value
old_alter_table Value
old_passwords Value
open_files_limit Value
optimizer_fix Value
optimizer_prune_level Value
optimizer_search_depth Value
optimizer_switch Value
pid_file Value
plugin_dir Value
port Value
preload_buffer_size Value
profiling Value
profiling_history_size Value
profiling_server Value
profiling_use_getrusage Value
protocol_version Value
pseudo_thread_id Value
query_alloc_block_size Value
query_cache_limit Value
query_cache_min_res_unit Value
query_cache_size Value
query_cache_strip_comments Value
query_cache_type Value
query_cache_wlock_invalidate Value
query_prealloc_size Value
query_response_time_range_base Value
rand_seed1 Value
rand_seed2 Value
range_alloc_block_size Value
read_buffer_size Value
read_only Value
read_rnd_buffer_size Value
relay_log Value
relay_log_index Value
relay_log_info_file Value
relay_log_purge Value
relay_log_space_limit Value
report_host Value
report_password Value
report_port Value
report_user Value
rpl_recovery_rank Value
secure_auth Value
secure_file_priv Value
server_id Value
skip_external_locking Value
skip_name_resolve Value
skip_networking Value
skip_show_database Value
slave_compressed_protocol Value
slave_exec_mode Value
slave_load_tmpdir Value
slave_net_timeout Value
slave_skip_errors Value
slave_transaction_retries Value
slow_launch_time Value
slow_query_log Value
slow_query_log_file Value
slow_query_log_microseconds_timestamp Value
socket Value
sort_buffer_size Value
sql_auto_is_null Value
sql_big_selects Value
sql_big_tables Value
sql_buffer_result Value
sql_log_bin Value
sql_log_off Value
sql_log_update Value
sql_low_priority_updates Value
sql_max_join_size Value
sql_mode Value
sql_notes Value
sql_quote_show_create Value
sql_safe_updates Value
sql_select_limit Value
sql_slave_skip_counter Value
sql_warnings Value
ssl_ca Value
ssl_capath Value
ssl_cert Value
ssl_cipher Value
ssl_key Value
storage_engine Value
suppress_log_warning_1592 Value
sync_binlog Value
sync_frm Value
system_time_zone Value
table_definition_cache Value
table_lock_wait_timeout Value
table_open_cache Value
table_type Value
thread_cache_size Value
thread_handling Value
thread_stack Value
thread_statistics Value
time_format Value
time_zone Value
timed_mutexes Value
timestamp Value
tmp_table_size Value
tmpdir Value
transaction_alloc_block_size Value
transaction_prealloc_size Value
tx_isolation Value
unique_checks Value
updatable_views_with_limit Value
use_global_log_slow_control Value
use_global_long_query_time Value
userstat_running Value
version Value
version_comment Value
version_compile_machine Value
version_compile_os Value
wait_timeout Value
warning_count Value
--source include/have_innodb.inc
--source include/have_debug.inc
#check the list of variable names
--replace_column 2 Value
show variables;
--long_query_time=0 --log_slow_verbosity=innodb --log_slow_slave_statements
--long_query_time=0 --log_slow_verbosity=innodb --log_slow_slave_statements
stop slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
reset master;
reset slave;
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
start slave;
DROP TABLE IF EXISTS t;
CREATE TABLE t(id INT,data CHAR(30)) ENGINE=InnoDB;
INSERT INTO t VALUES
(1,"aaaaabbbbbcccccdddddeeeeefffff"),
(2,"aaaaabbbbbcccccdddddeeeeefffff"),
(3,"aaaaabbbbbcccccdddddeeeeefffff"),
(4,"aaaaabbbbbcccccdddddeeeeefffff"),
(5,"aaaaabbbbbcccccdddddeeeeefffff");
INSERT INTO t SELECT t2.id,t2.data from t as t1, t as t2;
INSERT INTO t SELECT t2.id,t2.data from t as t1, t as t2;
STOP SLAVE;
START SLAVE;
INSERT INTO t SELECT t.id,t.data from t;
DROP TABLE IF EXISTS t;
4
source include/have_innodb.inc;
source include/master-slave.inc;
connection master;
-- disable_warnings
DROP TABLE IF EXISTS t;
-- enable_warnings
CREATE TABLE t(id INT,data CHAR(30)) ENGINE=InnoDB;
INSERT INTO t VALUES
(1,"aaaaabbbbbcccccdddddeeeeefffff"),
(2,"aaaaabbbbbcccccdddddeeeeefffff"),
(3,"aaaaabbbbbcccccdddddeeeeefffff"),
(4,"aaaaabbbbbcccccdddddeeeeefffff"),
(5,"aaaaabbbbbcccccdddddeeeeefffff");
INSERT INTO t SELECT t2.id,t2.data from t as t1, t as t2;
INSERT INTO t SELECT t2.id,t2.data from t as t1, t as t2;
sync_slave_with_master;
connection slave;
STOP SLAVE;
-- source include/wait_for_slave_to_stop.inc
--write_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
wait
EOF
--shutdown_server 10
--source include/wait_until_disconnected.inc
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
restart
EOF
--enable_reconnect
--source include/wait_until_connected_again.inc
START SLAVE;
-- source include/wait_for_slave_to_start.inc
connection master;
INSERT INTO t SELECT t.id,t.data from t;
sync_slave_with_master;
connection master;
DROP TABLE IF EXISTS t;
sync_slave_with_master;
exec cat var/mysqld.2/mysqld-slow.log | grep InnoDB_IO_r_ops | wc -l;
......@@ -22,3 +22,38 @@ set global long_query_time=2;
set global use_global_long_query_time=0;
cat MYSQLD_DATADIR/percona_slow_query_log-use_global_long_query_time.log | grep -c Query_time
3
show global variables like 'use_global_log_slow_control';
Variable_name Value
use_global_log_slow_control none
show global variables like 'use_global_long_query_time';
Variable_name Value
use_global_long_query_time OFF
set global use_global_log_slow_control = long_query_time;
show global variables like 'use_global_log_slow_control';
Variable_name Value
use_global_log_slow_control long_query_time
show global variables like 'use_global_long_query_time';
Variable_name Value
use_global_long_query_time ON
set global use_global_log_slow_control = log_slow_filter;
show global variables like 'use_global_log_slow_control';
Variable_name Value
use_global_log_slow_control log_slow_filter
show global variables like 'use_global_long_query_time';
Variable_name Value
use_global_long_query_time OFF
set global use_global_long_query_time = ON;
show global variables like 'use_global_log_slow_control';
Variable_name Value
use_global_log_slow_control log_slow_filter,long_query_time
show global variables like 'use_global_long_query_time';
Variable_name Value
use_global_long_query_time ON
set global use_global_long_query_time = OFF;
show global variables like 'use_global_log_slow_control';
Variable_name Value
use_global_log_slow_control log_slow_filter
show global variables like 'use_global_long_query_time';
Variable_name Value
use_global_long_query_time OFF
set global use_global_log_slow_control = none;
......@@ -20,3 +20,24 @@ let $cmd = cat $MYSQLD_DATADIR/percona_slow_query_log-use_global_long_query_time
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
exec echo '$cmd';
exec $cmd;
show global variables like 'use_global_log_slow_control';
show global variables like 'use_global_long_query_time';
set global use_global_log_slow_control = long_query_time;
show global variables like 'use_global_log_slow_control';
show global variables like 'use_global_long_query_time';
set global use_global_log_slow_control = log_slow_filter;
show global variables like 'use_global_log_slow_control';
show global variables like 'use_global_long_query_time';
set global use_global_long_query_time = ON;
show global variables like 'use_global_log_slow_control';
show global variables like 'use_global_long_query_time';
set global use_global_long_query_time = OFF;
show global variables like 'use_global_log_slow_control';
show global variables like 'use_global_long_query_time';
set global use_global_log_slow_control = none;
drop table if exists t1;
create table t (a int not null);
insert into t values (1),(2),(3);
SELECT SQL_NO_FCACHE SLEEP(0);
SLEEP(0)
0
SELECT /*!40001 SQL_NO_CACHE */ /*!50084 SQL_NO_FCACHE */ * FROM t;
a
1
2
3
DROP TABLE t;
--disable_warnings
drop table if exists t1;
--enable_warnings
create table t (a int not null);
insert into t values (1),(2),(3);
SELECT SQL_NO_FCACHE SLEEP(0);
SELECT /*!40001 SQL_NO_CACHE */ /*!50084 SQL_NO_FCACHE */ * FROM t;
DROP TABLE t;
\ No newline at end of file
set GLOBAL query_cache_size=1355776;
flush query cache;
flush query cache;
reset query cache;
flush status;
DROP TABLE IF EXISTS t;
CREATE TABLE t(id INT, number INT);
INSERT INTO t VALUES (0,1);
INSERT INTO t VALUES (1,2);
INSERT INTO t VALUES (2,3);
SELECT number from t where id > 0;
number
2
3
SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
SELECT number from t where id > 0;
SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
SELECT number from t where id > 0;
SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
SHOW PROCESSLIST;
Id User Host db Command Time State Info
Id root localhost test Sleep Time NULL
Id root localhost test Query Time Waiting on query cache mutex SELECT number from t where id > 0
Id root localhost test Query Time Waiting on query cache mutex SELECT number from t where id > 0
Id root localhost test Query Time NULL SHOW PROCESSLIST
DROP TABLE t;
set GLOBAL query_cache_size=0;
--source include/have_query_cache.inc
--source include/have_debug.inc
set GLOBAL query_cache_size=1355776;
--source include/percona_query_cache_with_comments_clear.inc
-- disable_warnings
DROP TABLE IF EXISTS t;
-- enable_warnings
CREATE TABLE t(id INT, number INT);
INSERT INTO t VALUES (0,1);
INSERT INTO t VALUES (1,2);
INSERT INTO t VALUES (2,3);
SELECT number from t where id > 0;
--connect (conn0,localhost,root,,)
--connect (conn1,localhost,root,,)
--connect (conn2,localhost,root,,)
--connection conn0
--error 0, ER_UNKNOWN_SYSTEM_VARIABLE
SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
SEND SELECT number from t where id > 0;
SLEEP 1.0;
--connection conn1
--error 0, ER_UNKNOWN_SYSTEM_VARIABLE
SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
SEND SELECT number from t where id > 0;
SLEEP 1.0;
--connection conn2
--error 0, ER_UNKNOWN_SYSTEM_VARIABLE
SET SESSION debug="+d,status_wait_query_cache_mutex_sleep";
--replace_column 1 Id 6 Time
SHOW PROCESSLIST;
DROP TABLE t;
set GLOBAL query_cache_size=0;
\ No newline at end of file
......@@ -22,15 +22,18 @@ CREATE PROCEDURE insert_many(p1 int)
BEGIN
SET @x = 0;
SET @y = 0;
start transaction;
REPEAT
insert into test1 set b=1;
SET @x = @x + 1;
SET @y = @y + 1;
IF @y >= 1000 THEN
commit;
start transaction;
SET @y = 0;
END IF;
UNTIL @x >= p1 END REPEAT;
commit;
END|
delimiter ;|
call insert_many(100000);
......
2010-06-24 The InnoDB Team
* handler/ha_innodb.cc:
Fix Bug#54679 alter table causes compressed row_format to revert
to compact
2010-06-22 The InnoDB Team
* dict/dict0dict.c, dict/dict0mem.c, include/dict0mem.h,
include/univ.i, page/page0zip.c, row/row0merge.c:
Fix Bug#47991 InnoDB Dictionary Cache memory usage increases
indefinitely when renaming tables
2010-06-22 The InnoDB Team
* handler/ha_innodb.cc:
Fix Bug#54686: "field->col->mtype == type" assertion error at
row/row0sel.c
2010-06-22 The InnoDB Team
* handler/ha_innodb.cc, innodb_bug54044.result, innodb_bug54044.test:
Fix Bug#54044 Create temporary tables and using innodb crashes.
2010-06-21 The InnoDB Team
* dict/dict0load.c, fil/fil0fil.c:
Fix Bug#54658: InnoDB: Warning: allocated tablespace %lu,
old maximum was 0 (introduced in Bug #53578 fix)
2010-06-16 The InnoDB Team
* row/row0merge.c:
Fix Bug#54330 Broken fast index creation
2010-06-10 The InnoDB Team
* include/log0log.ic, row/row0ins.c, row/row0purge.c,
row/row0uins.c, row/row0umod.c, row/row0upd.c:
Fix Bug#39168 ERROR: the age of the last checkpoint ... exceeds
the log group capacity
2010-06-08 The InnoDB Team
* dict/dict0load.c:
Fix Bug#54009 Server crashes when data is selected from non backed
up table for InnoDB plugin
2010-06-02 The InnoDB Team
* include/db0err.h, include/lock0lock.h, include/row0mysql.h,
lock/lock0lock.c, row/row0ins.c, row/row0mysql.c, row/row0sel.c:
Fix Bug#53674 InnoDB: Error: unlock row could not find a
4 mode lock on the record
2010-06-01 The InnoDB Team
* include/sync0rw.h, sync/sync0rw.c:
Fix Bug#48197 Concurrent rw_lock_free may cause assertion failure
2010-06-01 The InnoDB Team
* row/row0umod.c:
Fix Bug#53812 assert row/row0umod.c line 660 in txn rollback
after crash recovery
2010-05-25 The InnoDB Team
* handler/ha_innodb.cc, include/row0mysql.h, row/row0mysql.c:
Fix Bug#53592: crash replacing duplicates into table after fast
alter table added unique key
2010-05-24 The InnoDB Team
* dict/dict0boot.c, dict/dict0crea.c, fil/fil0fil.c,
include/dict0boot.h, include/fil0fil.h, row/row0mysql.c:
Fix Bug#53578: assert on invalid page access, in fil_io()
2010-05-14 The InnoDB Team
* mysql-test/innodb_bug48024.test, mysql-test/innodb_bug48024.result,
dict/dict0dict.c, handler/ha_innodb.cc, handler/ha_innodb.h,
include/dict0dict.h, include/ha_prototypes.h, include/row0mysql.h,
include/trx0trx.h, row/row0mysql.c, trx/trx0i_s.c, trx/trx0trx.c:
Fix Bug#48024 Innodb doesn't work with multi-statements
Fix Bug#53644 InnoDB thinks that /*/ starts and ends a comment
2010-05-12 The InnoDB Team
* handler/handler0alter.cc:
Fix Bug#53591 crash with fast alter table and text/blob prefix
primary key
2010-05-12 The InnoDB Team
* row/row0merge.c:
Fix Bug#53471 row_merge_drop_temp_indexes() refers freed memory, SEGVs
2010-05-11 The InnoDB Team
* mysql-test/innodb_bug53290.test, mysql-test/innodb_bug53290.result,
include/rem0cmp.h, rem/rem0cmp.c, row/row0merge.c:
Fix Bug#53290 wrong duplicate key error when adding a unique index
via fast alter table
2010-05-11 The InnoDB Team
* buf/buf0lru.c, include/buf0buf.ic:
Fix Bug#53307 valgrind: warnings in main.partition_innodb_plugin
2010-05-05 The InnoDB Team
* row/row0merge.c:
Fix Bug#53256 in a stress test, assert dict/dict0dict.c:815
table2 == NULL
2010-05-05 The InnoDB Team
* handler/ha_innodb.cc:
Fix Bug#53165 Setting innodb_change_buffering=DEFAULT produces
incorrect result
2010-05-04 The InnoDB Team
* fsp/fsp0fsp.c:
Fix Bug#53306 valgrind: warnings in innodb.innodb
2010-05-03 The InnoDB Team
* buf0buf.c:
......@@ -48,12 +173,6 @@
Only check the record size at index creation time when
innodb_strict_mode is set or when ROW_FORMAT is DYNAMIC or COMPRESSED.
2010-04-20 The InnoDB Team
* btr/btr0btr.c, include/univ.i:
Implement UNIV_BTR_AVOID_COPY, for avoiding writes when a B-tree
node is split at the first or last record.
2010-04-15 The InnoDB Team
* trx/trx0rec.c:
......@@ -72,6 +191,10 @@
* mysql-test/innodb_bug38231.test:
Remove non-determinism in the test case.
2010-03-29 The InnoDB Team
InnoDB Plugin 1.0.7 released
2010-03-18 The InnoDB Team
* CMakeLists.txt:
......@@ -194,6 +317,14 @@
Fix Bug#49497 Error 1467 (ER_AUTOINC_READ_FAILED) on inserting
a negative value
2010-01-28 The InnoDB Team
* handler/ha_innodb.h, handler/ha_innodb.cc,
handler/handler0alter.cc,
mysql-test/innodb_bug47622.test,
mysql-test/innodb_bug47622.result:
Fix Bug#47622 the new index is added before the existing ones
in MySQL, but after one in SE
2010-01-27 The InnoDB Team
* include/row0mysql.h, log/log0recv.c, row/row0mysql.c:
......
......@@ -2030,6 +2030,7 @@ func_start:
goto insert_empty;
}
} else if (UNIV_UNLIKELY(insert_left)) {
ut_a(n_iterations > 0);
first_rec = page_rec_get_next(page_get_infimum_rec(page));
move_limit = page_rec_get_next(btr_cur_get_rec(cursor));
} else {
......@@ -2076,17 +2077,7 @@ insert_empty:
}
/* 5. Move then the records to the new page */
if (direction == FSP_DOWN
#ifdef UNIV_BTR_AVOID_COPY
&& page_rec_is_supremum(move_limit)) {
/* Instead of moving all records, make the new page
the empty page. */
left_block = block;
right_block = new_block;
} else if (direction == FSP_DOWN
#endif /* UNIV_BTR_AVOID_COPY */
) {
if (direction == FSP_DOWN) {
/* fputs("Split left\n", stderr); */
if (0
......@@ -2129,14 +2120,6 @@ insert_empty:
right_block = block;
lock_update_split_left(right_block, left_block);
#ifdef UNIV_BTR_AVOID_COPY
} else if (!split_rec) {
/* Instead of moving all records, make the new page
the empty page. */
left_block = new_block;
right_block = block;
#endif /* UNIV_BTR_AVOID_COPY */
} else {
/* fputs("Split right\n", stderr); */
......
......@@ -2136,9 +2136,8 @@ any_extern:
err = btr_cur_upd_lock_and_undo(flags, cursor, update, cmpl_info,
thr, mtr, &roll_ptr);
if (err != DB_SUCCESS) {
err_exit:
mem_heap_free(heap);
return(err);
goto err_exit;
}
/* Ok, we may do the replacement. Store on the page infimum the
......@@ -2184,9 +2183,10 @@ err_exit:
page_cur_move_to_next(page_cursor);
err = DB_SUCCESS;
err_exit:
mem_heap_free(heap);
return(DB_SUCCESS);
return(err);
}
/*************************************************************//**
......@@ -4259,6 +4259,8 @@ btr_store_big_rec_extern_fields(
field_ref += local_len;
}
extern_len = big_rec_vec->fields[i].len;
UNIV_MEM_ASSERT_RW(big_rec_vec->fields[i].data,
extern_len);
ut_a(extern_len > 0);
......@@ -4895,6 +4897,7 @@ btr_copy_blob_prefix(
mtr_commit(&mtr);
if (page_no == FIL_NULL || copy_len != part_len) {
UNIV_MEM_ASSERT_RW(buf, copied_len);
return(copied_len);
}
......@@ -5078,6 +5081,7 @@ btr_copy_externally_stored_field_prefix_low(
space_id, page_no, offset);
inflateEnd(&d_stream);
mem_heap_free(heap);
UNIV_MEM_ASSERT_RW(buf, d_stream.total_out);
return(d_stream.total_out);
} else {
return(btr_copy_blob_prefix(buf, len, space_id,
......
......@@ -182,6 +182,7 @@ void
btr_search_sys_free(void)
/*=====================*/
{
rw_lock_free(&btr_search_latch);
mem_free(btr_search_latch_temp);
btr_search_latch_temp = NULL;
mem_heap_free(btr_search_sys->hash_index->heap);
......
......@@ -490,11 +490,15 @@ buf_buddy_relocate(
pool), so there is nothing wrong about this. The
mach_read_from_4() calls here will only trigger bogus
Valgrind memcheck warnings in UNIV_DEBUG_VALGRIND builds. */
bpage = buf_page_hash_get(
mach_read_from_4((const byte*) src
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID),
mach_read_from_4((const byte*) src
+ FIL_PAGE_OFFSET));
ulint space = mach_read_from_4(
(const byte*) src + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
ulint page_no = mach_read_from_4(
(const byte*) src + FIL_PAGE_OFFSET);
/* Suppress Valgrind warnings about conditional jump
on uninitialized value. */
UNIV_MEM_VALID(&space, sizeof space);
UNIV_MEM_VALID(&page_no, sizeof page_no);
bpage = buf_page_hash_get(space, page_no);
if (!bpage || bpage->zip.data != src) {
/* The block has probably been freshly
......
This diff is collapsed.
......@@ -257,6 +257,17 @@ buf_flush_insert_into_flush_list(
ut_d(block->page.in_flush_list = TRUE);
UT_LIST_ADD_FIRST(flush_list, buf_pool->flush_list, &block->page);
#ifdef UNIV_DEBUG_VALGRIND
{
ulint zip_size = buf_block_get_zip_size(block);
if (UNIV_UNLIKELY(zip_size)) {
UNIV_MEM_ASSERT_RW(block->page.zip.data, zip_size);
} else {
UNIV_MEM_ASSERT_RW(block->frame, UNIV_PAGE_SIZE);
}
}
#endif /* UNIV_DEBUG_VALGRIND */
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
ut_a(buf_flush_validate_low());
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
......@@ -286,6 +297,18 @@ buf_flush_insert_sorted_into_flush_list(
ut_ad(!block->page.in_flush_list);
ut_d(block->page.in_flush_list = TRUE);
#ifdef UNIV_DEBUG_VALGRIND
{
ulint zip_size = buf_block_get_zip_size(block);
if (UNIV_UNLIKELY(zip_size)) {
UNIV_MEM_ASSERT_RW(block->page.zip.data, zip_size);
} else {
UNIV_MEM_ASSERT_RW(block->frame, UNIV_PAGE_SIZE);
}
}
#endif /* UNIV_DEBUG_VALGRIND */
prev_b = NULL;
/* For the most part when this function is called the flush_rbt
......@@ -830,6 +853,7 @@ try_again:
zip_size = buf_page_get_zip_size(bpage);
if (UNIV_UNLIKELY(zip_size)) {
UNIV_MEM_ASSERT_RW(bpage->zip.data, zip_size);
/* Copy the compressed page and clear the rest. */
memcpy(trx_doublewrite->write_buf
+ UNIV_PAGE_SIZE * trx_doublewrite->first_free,
......@@ -839,6 +863,8 @@ try_again:
+ zip_size, 0, UNIV_PAGE_SIZE - zip_size);
} else {
ut_a(buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE);
UNIV_MEM_ASSERT_RW(((buf_block_t*) bpage)->frame,
UNIV_PAGE_SIZE);
memcpy(trx_doublewrite->write_buf
+ UNIV_PAGE_SIZE * trx_doublewrite->first_free,
......@@ -1533,6 +1559,7 @@ retry:
} else if (!have_LRU_mutex) {
/* confirm it again with LRU_mutex for exactness */
have_LRU_mutex = TRUE;
distance = 0;
goto retry;
}
......
......@@ -1455,7 +1455,7 @@ buf_LRU_make_block_old(
Try to free a block. If bpage is a descriptor of a compressed-only
page, the descriptor object will be freed as well.
NOTE: If this function returns BUF_LRU_FREED, it will not temporarily
NOTE: If this function returns BUF_LRU_FREED, it will temporarily
release buf_pool_mutex. Furthermore, the page frame will no longer be
accessible via bpage.
......
......@@ -62,32 +62,47 @@ dict_hdr_get(
}
/**********************************************************************//**
Returns a new table, index, or tree id.
@return the new id */
Returns a new table, index, or space id. */
UNIV_INTERN
dulint
void
dict_hdr_get_new_id(
/*================*/
ulint type) /*!< in: DICT_HDR_ROW_ID, ... */
dulint* table_id, /*!< out: table id (not assigned if NULL) */
dulint* index_id, /*!< out: index id (not assigned if NULL) */
ulint* space_id) /*!< out: space id (not assigned if NULL) */
{
dict_hdr_t* dict_hdr;
dulint id;
mtr_t mtr;
ut_ad((type == DICT_HDR_TABLE_ID) || (type == DICT_HDR_INDEX_ID));
mtr_start(&mtr);
dict_hdr = dict_hdr_get(&mtr);
id = mtr_read_dulint(dict_hdr + type, &mtr);
if (table_id) {
id = mtr_read_dulint(dict_hdr + DICT_HDR_TABLE_ID, &mtr);
id = ut_dulint_add(id, 1);
mlog_write_dulint(dict_hdr + DICT_HDR_TABLE_ID, id, &mtr);
*table_id = id;
}
mlog_write_dulint(dict_hdr + type, id, &mtr);
if (index_id) {
id = mtr_read_dulint(dict_hdr + DICT_HDR_INDEX_ID, &mtr);
id = ut_dulint_add(id, 1);
mlog_write_dulint(dict_hdr + DICT_HDR_INDEX_ID, id, &mtr);
*index_id = id;
}
mtr_commit(&mtr);
if (space_id) {
*space_id = mtr_read_ulint(dict_hdr + DICT_HDR_MAX_SPACE_ID,
MLOG_4BYTES, &mtr);
if (fil_assign_new_space_id(space_id)) {
mlog_write_ulint(dict_hdr + DICT_HDR_MAX_SPACE_ID,
*space_id, MLOG_4BYTES, &mtr);
}
}
return(id);
mtr_commit(&mtr);
}
/**********************************************************************//**
......@@ -151,9 +166,12 @@ dict_hdr_create(
mlog_write_dulint(dict_header + DICT_HDR_INDEX_ID,
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
/* Obsolete, but we must initialize it to 0 anyway. */
mlog_write_dulint(dict_header + DICT_HDR_MIX_ID,
ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
mlog_write_ulint(dict_header + DICT_HDR_MAX_SPACE_ID,
0, MLOG_4BYTES, mtr);
/* Obsolete, but we must initialize it anyway. */
mlog_write_ulint(dict_header + DICT_HDR_MIX_ID_LOW,
DICT_HDR_FIRST_ID, MLOG_4BYTES, mtr);
/* Create the B-tree roots for the clustered indexes of the basic
system tables */
......@@ -245,6 +263,29 @@ dict_boot(void)
/* Get the dictionary header */
dict_hdr = dict_hdr_get(&mtr);
if (ut_dulint_cmp(mtr_read_dulint(dict_hdr + DICT_HDR_XTRADB_MARK, &mtr),
DICT_HDR_XTRADB_FLAG) != 0) {
/* not extended yet by XtraDB, need to be extended */
ulint root_page_no;
root_page_no = btr_create(DICT_CLUSTERED | DICT_UNIQUE,
DICT_HDR_SPACE, 0, DICT_STATS_ID,
dict_ind_redundant, &mtr);
if (root_page_no == FIL_NULL) {
fprintf(stderr, "InnoDB: Warning: failed to create SYS_STATS btr.\n");
srv_use_sys_stats_table = FALSE;
} else {
mlog_write_ulint(dict_hdr + DICT_HDR_STATS, root_page_no,
MLOG_4BYTES, &mtr);
mlog_write_dulint(dict_hdr + DICT_HDR_XTRADB_MARK,
DICT_HDR_XTRADB_FLAG, &mtr);
}
mtr_commit(&mtr);
/* restart mtr */
mtr_start(&mtr);
dict_hdr = dict_hdr_get(&mtr);
}
/* Because we only write new row ids to disk-based data structure
(dictionary header) when it is divisible by
DICT_HDR_ROW_ID_WRITE_MARGIN, in recovery we will not recover
......@@ -406,7 +447,7 @@ dict_boot(void)
table->id = DICT_FIELDS_ID;
dict_table_add_to_cache(table, heap);
dict_sys->sys_fields = table;
mem_heap_free(heap);
mem_heap_empty(heap);
index = dict_mem_index_create("SYS_FIELDS", "CLUST_IND",
DICT_HDR_SPACE,
......@@ -423,6 +464,41 @@ dict_boot(void)
FALSE);
ut_a(error == DB_SUCCESS);
/*-------------------------*/
table = dict_mem_table_create("SYS_STATS", DICT_HDR_SPACE, 3, 0);
table->n_mysql_handles_opened = 1; /* for pin */
dict_mem_table_add_col(table, heap, "INDEX_ID", DATA_BINARY, 0, 0);
dict_mem_table_add_col(table, heap, "KEY_COLS", DATA_INT, 0, 4);
dict_mem_table_add_col(table, heap, "DIFF_VALS", DATA_BINARY, 0, 0);
/* The '+ 2' below comes from the fields DB_TRX_ID, DB_ROLL_PTR */
#if DICT_SYS_STATS_DIFF_VALS_FIELD != 2 + 2
#error "DICT_SYS_STATS_DIFF_VALS_FIELD != 2 + 2"
#endif
table->id = DICT_STATS_ID;
dict_table_add_to_cache(table, heap);
dict_sys->sys_stats = table;
mem_heap_empty(heap);
index = dict_mem_index_create("SYS_STATS", "CLUST_IND",
DICT_HDR_SPACE,
DICT_UNIQUE | DICT_CLUSTERED, 2);
dict_mem_index_add_field(index, "INDEX_ID", 0);
dict_mem_index_add_field(index, "KEY_COLS", 0);
index->id = DICT_STATS_ID;
error = dict_index_add_to_cache(table, index,
mtr_read_ulint(dict_hdr
+ DICT_HDR_STATS,
MLOG_4BYTES, &mtr),
FALSE);
ut_a(error == DB_SUCCESS);
mem_heap_free(heap);
mtr_commit(&mtr);
/*-------------------------*/
......@@ -436,6 +512,7 @@ dict_boot(void)
dict_load_sys_table(dict_sys->sys_columns);
dict_load_sys_table(dict_sys->sys_indexes);
dict_load_sys_table(dict_sys->sys_fields);
dict_load_sys_table(dict_sys->sys_stats);
mutex_exit(&(dict_sys->mutex));
}
......
......@@ -239,16 +239,34 @@ dict_build_table_def_step(
const char* path_or_name;
ibool is_path;
mtr_t mtr;
ulint space = 0;
ibool file_per_table;
ut_ad(mutex_own(&(dict_sys->mutex)));
table = node->table;
table->id = dict_hdr_get_new_id(DICT_HDR_TABLE_ID);
/* Cache the global variable "srv_file_per_table" to
a local variable before using it. Please note
"srv_file_per_table" is not under dict_sys mutex
protection, and could be changed while executing
this function. So better to cache the current value
to a local variable, and all future reference to
"srv_file_per_table" should use this local variable. */
file_per_table = srv_file_per_table;
dict_hdr_get_new_id(&table->id, NULL, NULL);
thr_get_trx(thr)->table_id = table->id;
if (srv_file_per_table) {
if (file_per_table) {
/* Get a new space id if srv_file_per_table is set */
dict_hdr_get_new_id(NULL, NULL, &space);
if (UNIV_UNLIKELY(space == ULINT_UNDEFINED)) {
return(DB_ERROR);
}
/* We create a new single-table tablespace for the table.
We initially let it be 4 pages:
- page 0 is the fsp header and an extent descriptor page,
......@@ -257,8 +275,6 @@ dict_build_table_def_step(
- page 3 will contain the root of the clustered index of the
table we create here. */
ulint space = 0; /* reset to zero for the call below */
if (table->dir_path_of_temp_table) {
/* We place tables created with CREATE TEMPORARY
TABLE in the tmp dir of mysqld server */
......@@ -276,7 +292,7 @@ dict_build_table_def_step(
flags = table->flags & ~(~0 << DICT_TF_BITS);
error = fil_create_new_single_table_tablespace(
&space, path_or_name, is_path,
space, path_or_name, is_path,
flags == DICT_TF_COMPACT ? 0 : flags,
FIL_IBD_FILE_INITIAL_SIZE);
table->space = (unsigned int) space;
......@@ -491,6 +507,51 @@ dict_create_sys_fields_tuple(
return(entry);
}
/*****************************************************************//**
Based on an index object, this function builds the entry to be inserted
in the SYS_STATS system table.
@return the tuple which should be inserted */
static
dtuple_t*
dict_create_sys_stats_tuple(
/*========================*/
const dict_index_t* index,
ulint i,
mem_heap_t* heap)
{
dict_table_t* sys_stats;
dtuple_t* entry;
dfield_t* dfield;
byte* ptr;
ut_ad(index);
ut_ad(heap);
sys_stats = dict_sys->sys_stats;
entry = dtuple_create(heap, 3 + DATA_N_SYS_COLS);
dict_table_copy_types(entry, sys_stats);
/* 0: INDEX_ID -----------------------*/
dfield = dtuple_get_nth_field(entry, 0/*INDEX_ID*/);
ptr = mem_heap_alloc(heap, 8);
mach_write_to_8(ptr, index->id);
dfield_set_data(dfield, ptr, 8);
/* 1: KEY_COLS -----------------------*/
dfield = dtuple_get_nth_field(entry, 1/*KEY_COLS*/);
ptr = mem_heap_alloc(heap, 4);
mach_write_to_4(ptr, i);
dfield_set_data(dfield, ptr, 4);
/* 4: DIFF_VALS ----------------------*/
dfield = dtuple_get_nth_field(entry, 2/*DIFF_VALS*/);
ptr = mem_heap_alloc(heap, 8);
mach_write_to_8(ptr, ut_dulint_zero); /* initial value is 0 */
dfield_set_data(dfield, ptr, 8);
return(entry);
}
/*****************************************************************//**
Creates the tuple with which the index entry is searched for writing the index
tree root page number, if such a tree is created.
......@@ -561,7 +622,7 @@ dict_build_index_def_step(
ut_ad((UT_LIST_GET_LEN(table->indexes) > 0)
|| dict_index_is_clust(index));
index->id = dict_hdr_get_new_id(DICT_HDR_INDEX_ID);
dict_hdr_get_new_id(NULL, &index->id, NULL);
/* Inherit the space id from the table; we store all indexes of a
table in the same tablespace */
......@@ -600,6 +661,27 @@ dict_build_field_def_step(
return(DB_SUCCESS);
}
/***************************************************************//**
Builds a row for storing stats to insert.
@return DB_SUCCESS */
static
ulint
dict_build_stats_def_step(
/*======================*/
ind_node_t* node)
{
dict_index_t* index;
dtuple_t* row;
index = node->index;
row = dict_create_sys_stats_tuple(index, node->stats_no, node->heap);
ins_node_set_new_row(node->stats_def, row);
return(DB_SUCCESS);
}
/***************************************************************//**
Creates an index tree for the index if it is not a member of a cluster.
@return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */
......@@ -924,6 +1006,49 @@ ind_create_graph_create(
dict_sys->sys_fields, heap);
node->field_def->common.parent = node;
if (srv_use_sys_stats_table) {
node->stats_def = ins_node_create(INS_DIRECT,
dict_sys->sys_stats, heap);
node->stats_def->common.parent = node;
} else {
node->stats_def = NULL;
}
node->commit_node = commit_node_create(heap);
node->commit_node->common.parent = node;
return(node);
}
/*********************************************************************//**
*/
UNIV_INTERN
ind_node_t*
ind_insert_stats_graph_create(
/*==========================*/
dict_index_t* index,
mem_heap_t* heap)
{
ind_node_t* node;
node = mem_heap_alloc(heap, sizeof(ind_node_t));
node->common.type = QUE_NODE_INSERT_STATS;
node->index = index;
node->state = INDEX_BUILD_STATS_COLS;
node->page_no = FIL_NULL;
node->heap = mem_heap_create(256);
node->ind_def = NULL;
node->field_def = NULL;
node->stats_def = ins_node_create(INS_DIRECT,
dict_sys->sys_stats, heap);
node->stats_def->common.parent = node;
node->stats_no = 0;
node->commit_node = commit_node_create(heap);
node->commit_node->common.parent = node;
......@@ -1074,6 +1199,7 @@ dict_create_index_step(
node->state = INDEX_BUILD_FIELD_DEF;
node->field_no = 0;
node->stats_no = 0;
thr->run_node = node->ind_def;
......@@ -1119,8 +1245,32 @@ dict_create_index_step(
goto function_exit;
}
if (srv_use_sys_stats_table) {
node->state = INDEX_BUILD_STATS_COLS;
} else {
node->state = INDEX_CREATE_INDEX_TREE;
}
}
if (node->state == INDEX_BUILD_STATS_COLS) {
if (node->stats_no <= dict_index_get_n_unique(node->index)) {
err = dict_build_stats_def_step(node);
if (err != DB_SUCCESS) {
goto function_exit;
}
node->stats_no++;
thr->run_node = node->stats_def;
return(thr);
} else {
node->state = INDEX_CREATE_INDEX_TREE;
}
}
if (node->state == INDEX_CREATE_INDEX_TREE) {
......@@ -1170,6 +1320,66 @@ function_exit:
return(thr);
}
/****************************************************************//**
*/
UNIV_INTERN
que_thr_t*
dict_insert_stats_step(
/*===================*/
que_thr_t* thr) /*!< in: query thread */
{
ind_node_t* node;
ulint err = DB_ERROR;
trx_t* trx;
ut_ad(thr);
trx = thr_get_trx(thr);
node = thr->run_node;
if (thr->prev_node == que_node_get_parent(node)) {
node->state = INDEX_BUILD_STATS_COLS;
}
if (node->state == INDEX_BUILD_STATS_COLS) {
if (node->stats_no <= dict_index_get_n_unique(node->index)) {
err = dict_build_stats_def_step(node);
if (err != DB_SUCCESS) {
goto function_exit;
}
node->stats_no++;
thr->run_node = node->stats_def;
return(thr);
} else {
node->state = INDEX_COMMIT_WORK;
}
}
if (node->state == INDEX_COMMIT_WORK) {
/* do not commit transaction here for now */
}
function_exit:
trx->error_state = err;
if (err == DB_SUCCESS) {
} else {
return(NULL);
}
thr->run_node = que_node_get_parent(node);
return(thr);
}
/****************************************************************//**
Creates the foreign key constraints system tables inside InnoDB
at database creation or database start if they are not found or are
......
This diff is collapsed.
......@@ -223,7 +223,7 @@ loop:
is no index */
if (srv_stats_auto_update && dict_table_get_first_index(table)) {
dict_update_statistics_low(table, TRUE);
dict_update_statistics_low(table, TRUE, FALSE);
}
dict_table_print_low(table);
......@@ -317,7 +317,7 @@ dict_check_tablespaces_and_store_max_id(
dict_index_t* sys_index;
btr_pcur_t pcur;
const rec_t* rec;
ulint max_space_id = 0;
ulint max_space_id;
mtr_t mtr;
mutex_enter(&(dict_sys->mutex));
......@@ -328,6 +328,11 @@ dict_check_tablespaces_and_store_max_id(
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
ut_a(!dict_table_is_comp(sys_tables));
max_space_id = mtr_read_ulint(dict_hdr_get(&mtr)
+ DICT_HDR_MAX_SPACE_ID,
MLOG_4BYTES, &mtr);
fil_set_max_space_id_if_bigger(max_space_id);
btr_pcur_open_at_index_side(TRUE, sys_index, BTR_SEARCH_LEAF, &pcur,
TRUE, &mtr);
loop:
......@@ -974,6 +979,7 @@ err_exit:
/* Try to open the tablespace */
if (!fil_open_single_table_tablespace(
TRUE, space,
flags == DICT_TF_COMPACT ? 0 :
flags & ~(~0 << DICT_TF_BITS), name)) {
/* We failed to find a sensible
tablespace file */
......
......@@ -68,7 +68,8 @@ dict_mem_table_create(
table->heap = heap;
table->flags = (unsigned int) flags;
table->name = mem_heap_strdup(heap, name);
table->name = ut_malloc(strlen(name) + 1);
memcpy(table->name, name, strlen(name) + 1);
table->space = (unsigned int) space;
table->n_cols = (unsigned int) (n_cols + DATA_N_SYS_COLS);
......@@ -108,6 +109,7 @@ dict_mem_table_free(
#ifndef UNIV_HOTBACKUP
mutex_free(&(table->autoinc_mutex));
#endif /* UNIV_HOTBACKUP */
ut_free(table->name);
mem_heap_free(table->heap);
}
......
......@@ -43,8 +43,8 @@ Created 10/25/1995 Heikki Tuuri
#include "trx0trx.h"
#include "trx0sys.h"
#include "pars0pars.h"
#include "row0row.h"
#include "row0mysql.h"
#include "row0row.h"
#include "que0que.h"
#ifndef UNIV_HOTBACKUP
# include "buf0lru.h"
......@@ -286,6 +286,10 @@ struct fil_system_struct {
request */
UT_LIST_BASE_NODE_T(fil_space_t) space_list;
/*!< list of all file spaces */
ibool space_id_reuse_warned;
/* !< TRUE if fil_space_create()
has issued a warning about
potential space_id reuse */
};
/** The tablespace memory cache. This variable is NULL before the module is
......@@ -1200,7 +1204,19 @@ try_again:
space->tablespace_version = fil_system->tablespace_version;
space->mark = FALSE;
if (purpose == FIL_TABLESPACE && id > fil_system->max_assigned_id) {
if (UNIV_LIKELY(purpose == FIL_TABLESPACE && !recv_recovery_on)
&& UNIV_UNLIKELY(id > fil_system->max_assigned_id)) {
if (!fil_system->space_id_reuse_warned) {
fil_system->space_id_reuse_warned = TRUE;
ut_print_timestamp(stderr);
fprintf(stderr,
" InnoDB: Warning: allocated tablespace %lu,"
" old maximum was %lu\n",
(ulong) id,
(ulong) fil_system->max_assigned_id);
}
fil_system->max_assigned_id = id;
}
......@@ -1240,19 +1256,25 @@ try_again:
Assigns a new space id for a new single-table tablespace. This works simply by
incrementing the global counter. If 4 billion id's is not enough, we may need
to recycle id's.
@return new tablespace id; ULINT_UNDEFINED if could not assign an id */
static
ulint
fil_assign_new_space_id(void)
/*=========================*/
@return TRUE if assigned, FALSE if not */
UNIV_INTERN
ibool
fil_assign_new_space_id(
/*====================*/
ulint* space_id) /*!< in/out: space id */
{
ulint id;
ibool success;
mutex_enter(&fil_system->mutex);
fil_system->max_assigned_id++;
id = *space_id;
if (id < fil_system->max_assigned_id) {
id = fil_system->max_assigned_id;
}
id++;
if (id > (SRV_LOG_SPACE_FIRST_ID / 2) && (id % 1000000UL == 0)) {
ut_print_timestamp(stderr);
......@@ -1268,7 +1290,11 @@ fil_assign_new_space_id(void)
(ulong) SRV_LOG_SPACE_FIRST_ID);
}
if (id >= SRV_LOG_SPACE_FIRST_ID) {
success = (id < SRV_LOG_SPACE_FIRST_ID);
if (success) {
*space_id = fil_system->max_assigned_id = id;
} else {
ut_print_timestamp(stderr);
fprintf(stderr,
"InnoDB: You have run out of single-table"
......@@ -1278,14 +1304,12 @@ fil_assign_new_space_id(void)
" have to dump all your tables and\n"
"InnoDB: recreate the whole InnoDB installation.\n",
(ulong) id);
fil_system->max_assigned_id--;
id = ULINT_UNDEFINED;
*space_id = ULINT_UNDEFINED;
}
mutex_exit(&fil_system->mutex);
return(id);
return(success);
}
/*******************************************************************//**
......@@ -1521,7 +1545,7 @@ fil_init(
ut_a(hash_size > 0);
ut_a(max_n_open > 0);
fil_system = mem_alloc(sizeof(fil_system_t));
fil_system = mem_zalloc(sizeof(fil_system_t));
mutex_create(&fil_system->mutex, SYNC_ANY_LATCH);
......@@ -1530,16 +1554,9 @@ fil_init(
UT_LIST_INIT(fil_system->LRU);
fil_system->n_open = 0;
fil_system->max_n_open = max_n_open;
fil_system->modification_counter = 0;
fil_system->max_assigned_id = TRX_SYS_SPACE_MAX;
fil_system->tablespace_version = 0;
UT_LIST_INIT(fil_system->unflushed_spaces);
UT_LIST_INIT(fil_system->space_list);
}
/*******************************************************************//**
......@@ -2124,7 +2141,7 @@ fil_op_log_parse_or_replay(
fil_create_directory_for_tablename(name);
if (fil_create_new_single_table_tablespace(
&space_id, name, FALSE, flags,
space_id, name, FALSE, flags,
FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
ut_error;
}
......@@ -2571,9 +2588,7 @@ UNIV_INTERN
ulint
fil_create_new_single_table_tablespace(
/*===================================*/
ulint* space_id, /*!< in/out: space id; if this is != 0,
then this is an input parameter,
otherwise output */
ulint space_id, /*!< in: space id */
const char* tablename, /*!< in: the table name in the usual
databasename/tablename format
of InnoDB, or a dir path to a temp
......@@ -2593,6 +2608,8 @@ fil_create_new_single_table_tablespace(
ibool success;
char* path;
ut_a(space_id > 0);
ut_a(space_id < SRV_LOG_SPACE_FIRST_ID);
ut_a(size >= FIL_IBD_FILE_INITIAL_SIZE);
/* The tablespace flags (FSP_SPACE_FLAGS) should be 0 for
ROW_FORMAT=COMPACT
......@@ -2649,38 +2666,21 @@ fil_create_new_single_table_tablespace(
return(DB_ERROR);
}
buf2 = ut_malloc(3 * UNIV_PAGE_SIZE);
/* Align the memory for file i/o if we might have O_DIRECT set */
page = ut_align(buf2, UNIV_PAGE_SIZE);
ret = os_file_set_size(path, file, size * UNIV_PAGE_SIZE, 0);
if (!ret) {
ut_free(buf2);
os_file_close(file);
os_file_delete(path);
mem_free(path);
return(DB_OUT_OF_FILE_SPACE);
}
if (*space_id == 0) {
*space_id = fil_assign_new_space_id();
}
/* printf("Creating tablespace %s id %lu\n", path, *space_id); */
if (*space_id == ULINT_UNDEFINED) {
ut_free(buf2);
err = DB_OUT_OF_FILE_SPACE;
error_exit:
os_file_close(file);
error_exit2:
os_file_delete(path);
mem_free(path);
return(DB_ERROR);
return(err);
}
/* printf("Creating tablespace %s id %lu\n", path, space_id); */
/* We have to write the space id to the file immediately and flush the
file to disk. This is because in crash recovery we must be aware what
tablespaces exist and what are their space id's, so that we can apply
......@@ -2690,10 +2690,14 @@ error_exit2:
with zeros from the call of os_file_set_size(), until a buffer pool
flush would write to it. */
buf2 = ut_malloc(3 * UNIV_PAGE_SIZE);
/* Align the memory for file i/o if we might have O_DIRECT set */
page = ut_align(buf2, UNIV_PAGE_SIZE);
memset(page, '\0', UNIV_PAGE_SIZE);
fsp_header_init_fields(page, *space_id, flags);
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, *space_id);
fsp_header_init_fields(page, space_id, flags);
mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, space_id);
if (!(flags & DICT_TF_ZSSIZE_MASK)) {
buf_flush_init_for_writing(page, NULL, 0);
......@@ -2724,6 +2728,7 @@ error_exit2:
" to tablespace ", stderr);
ut_print_filename(stderr, path);
putc('\n', stderr);
err = DB_ERROR;
goto error_exit;
}
......@@ -2733,22 +2738,20 @@ error_exit2:
fputs("InnoDB: Error: file flush of tablespace ", stderr);
ut_print_filename(stderr, path);
fputs(" failed\n", stderr);
err = DB_ERROR;
goto error_exit;
}
os_file_close(file);
if (*space_id == ULINT_UNDEFINED) {
goto error_exit2;
}
success = fil_space_create(path, *space_id, flags, FIL_TABLESPACE);
success = fil_space_create(path, space_id, flags, FIL_TABLESPACE);
if (!success) {
err = DB_ERROR;
goto error_exit2;
}
fil_node_create(path, size, *space_id, FALSE);
fil_node_create(path, size, space_id, FALSE);
#ifndef UNIV_HOTBACKUP
{
......@@ -2759,7 +2762,7 @@ error_exit2:
fil_op_write_log(flags
? MLOG_FILE_CREATE2
: MLOG_FILE_CREATE,
*space_id,
space_id,
is_temp ? MLOG_FILE_FLAG_TEMP : 0,
flags,
tablename, NULL, &mtr);
......@@ -3124,7 +3127,7 @@ fil_open_single_table_tablespace(
for (i = 0; i < n_index; i++) {
new_id[i] =
dict_table_get_index_on_name(table,
(page + (i + 1) * 512 + 12))->id;
(char*)(page + (i + 1) * 512 + 12))->id;
old_id[i] = mach_read_from_8(page + (i + 1) * 512);
root_page[i] = mach_read_from_4(page + (i + 1) * 512 + 8);
}
......@@ -3148,7 +3151,7 @@ skip_info:
/* over write space id of all pages */
rec_offs_init(offsets_);
fprintf(stderr, "%s", "InnoDB: Progress in %:");
fprintf(stderr, "InnoDB: Progress in %%:");
for (offset = 0; offset < size_bytes; offset += UNIV_PAGE_SIZE) {
ulint checksum_field;
......@@ -3890,39 +3893,6 @@ next_datadir_item:
return(err);
}
/********************************************************************//**
If we need crash recovery, and we have called
fil_load_single_table_tablespaces() and dict_load_single_table_tablespaces(),
we can call this function to print an error message of orphaned .ibd files
for which there is not a data dictionary entry with a matching table name
and space id. */
UNIV_INTERN
void
fil_print_orphaned_tablespaces(void)
/*================================*/
{
fil_space_t* space;
mutex_enter(&fil_system->mutex);
space = UT_LIST_GET_FIRST(fil_system->space_list);
while (space) {
if (space->purpose == FIL_TABLESPACE && !trx_sys_sys_space(space->id)
&& !space->mark) {
fputs("InnoDB: Warning: tablespace ", stderr);
ut_print_filename(stderr, space->name);
fprintf(stderr, " of id %lu has no matching table in\n"
"InnoDB: the InnoDB data dictionary.\n",
(ulong) space->id);
}
space = UT_LIST_GET_NEXT(space_list, space);
}
mutex_exit(&fil_system->mutex);
}
/*******************************************************************//**
Returns TRUE if a single-table tablespace does not exist in the memory cache,
or is being deleted there.
......
......@@ -127,6 +127,70 @@ hash_create(
return(table);
}
/*************************************************************//**
*/
UNIV_INTERN
ulint
hash_create_needed(
/*===============*/
ulint n)
{
ulint prime;
ulint offset;
prime = ut_find_prime(n);
offset = (sizeof(hash_table_t) + 7) / 8;
offset *= 8;
return(offset + sizeof(hash_cell_t) * prime);
}
UNIV_INTERN
void
hash_create_init(
/*=============*/
hash_table_t* table,
ulint n)
{
ulint prime;
ulint offset;
prime = ut_find_prime(n);
offset = (sizeof(hash_table_t) + 7) / 8;
offset *= 8;
table->array = (hash_cell_t*)(((void*)table) + offset);
table->n_cells = prime;
# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
table->adaptive = FALSE;
# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
table->n_mutexes = 0;
table->mutexes = NULL;
table->heaps = NULL;
table->heap = NULL;
ut_d(table->magic_n = HASH_TABLE_MAGIC_N);
/* Initialize the cell array */
hash_table_clear(table);
}
UNIV_INTERN
void
hash_create_reuse(
/*==============*/
hash_table_t* table)
{
ulint offset;
offset = (sizeof(hash_table_t) + 7) / 8;
offset *= 8;
table->array = (hash_cell_t*)(((void*)table) + offset);
ut_ad(table->magic_n == HASH_TABLE_MAGIC_N);
}
/*************************************************************//**
Frees a hash table. */
UNIV_INTERN
......
This diff is collapsed.
......@@ -233,7 +233,11 @@ the definitions are bracketed with #ifdef INNODB_COMPATIBILITY_HOOKS */
extern "C" {
struct charset_info_st *thd_charset(MYSQL_THD thd);
#if MYSQL_VERSION_ID >= 50142
LEX_STRING *thd_query_string(MYSQL_THD thd);
#else
char **thd_query(MYSQL_THD thd);
#endif
/** Get the file name of the MySQL binlog.
* @return the name of the binlog file
......
......@@ -894,6 +894,8 @@ error:
prebuilt->trx->error_info = NULL;
/* fall through */
default:
trx->error_state = DB_SUCCESS;
if (new_primary) {
if (indexed_table != innodb_table) {
row_merge_drop_table(trx, indexed_table);
......
This diff is collapsed.
......@@ -43,5 +43,6 @@ extern struct st_mysql_plugin i_s_innodb_index_stats;
extern struct st_mysql_plugin i_s_innodb_admin_command;
extern struct st_mysql_plugin i_s_innodb_sys_tables;
extern struct st_mysql_plugin i_s_innodb_sys_indexes;
extern struct st_mysql_plugin i_s_innodb_sys_stats;
#endif /* i_s_h */
......@@ -47,5 +47,6 @@ struct innodb_enhancement {
{"innodb_fast_checksum","Using the checksum on 32bit-unit calculation","incompatible for unpatched ver.","http://www.percona.com/docs/wiki/percona-xtradb"},
{"innodb_files_extend","allow >4GB transaction log files, and can vary universal page size of datafiles","incompatible for unpatched ver.","http://www.percona.com/docs/wiki/percona-xtradb"},
{"innodb_sys_tables_sys_indexes","Expose InnoDB SYS_TABLES and SYS_INDEXES schema tables","","http://www.percona.com/docs/wiki/percona-xtradb"},
{"innodb_buffer_pool_shm","Put buffer pool contents to shared memory segment and reuse it at clean restart [experimental]","","http://www.percona.com/docs/wiki/percona-xtradb"},
{NULL, NULL, NULL, NULL}
};
......@@ -36,6 +36,7 @@ Created 11/5/1995 Heikki Tuuri
#include "ut0rbt.h"
#ifndef UNIV_HOTBACKUP
#include "os0proc.h"
#include "srv0srv.h"
/** @name Modes for buf_page_get_gen */
/* @{ */
......@@ -1301,11 +1302,23 @@ struct buf_block_struct{
/**********************************************************************//**
Compute the hash fold value for blocks in buf_pool->zip_hash. */
/* @{ */
#define BUF_POOL_ZIP_FOLD_PTR(ptr) ((ulint) (ptr) / UNIV_PAGE_SIZE)
/* the fold should be relative when srv_buffer_pool_shm_key is enabled */
#define BUF_POOL_ZIP_FOLD_PTR(ptr) (!srv_buffer_pool_shm_key\
?((ulint) (ptr) / UNIV_PAGE_SIZE)\
:((ulint) ((void*)ptr - (void*)(buf_pool->chunks->blocks->frame)) / UNIV_PAGE_SIZE))
#define BUF_POOL_ZIP_FOLD(b) BUF_POOL_ZIP_FOLD_PTR((b)->frame)
#define BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b))
/* @} */
/** A chunk of buffers. The buffer pool is allocated in chunks. */
struct buf_chunk_struct{
ulint mem_size; /*!< allocated size of the chunk */
ulint size; /*!< size of frames[] and blocks[] */
void* mem; /*!< pointer to the memory area which
was allocated for the frames */
buf_block_t* blocks; /*!< array of buffer control blocks */
};
/** @brief The buffer pool statistics structure. */
struct buf_pool_stat_struct{
ulint n_page_gets; /*!< number of page gets performed;
......
......@@ -96,7 +96,7 @@ buf_LRU_insert_zip_clean(
Try to free a block. If bpage is a descriptor of a compressed-only
page, the descriptor object will be freed as well.
NOTE: If this function returns BUF_LRU_FREED, it will not temporarily
NOTE: If this function returns BUF_LRU_FREED, it will temporarily
release buf_pool_mutex. Furthermore, the page frame will no longer be
accessible via bpage.
......
......@@ -158,8 +158,7 @@ buf_read_recv_pages(
/** The size in pages of the area which the read-ahead algorithms read if
invoked */
#define BUF_READ_AHEAD_AREA \
ut_min(64, ut_2_power_up(buf_pool->curr_size / 32))
#define BUF_READ_AHEAD_AREA 64
/** @name Modes used in read-ahead @{ */
/** read only pages belonging to the insert buffer tree */
......
......@@ -28,6 +28,8 @@ Created 5/24/1996 Heikki Tuuri
enum db_err {
DB_SUCCESS_LOCKED_REC = 9, /*!< like DB_SUCCESS, but a new
explicit record lock was created */
DB_SUCCESS = 10,
/* The following are error codes */
......
......@@ -46,13 +46,14 @@ dict_hdr_get(
/*=========*/
mtr_t* mtr); /*!< in: mtr */
/**********************************************************************//**
Returns a new row, table, index, or tree id.
@return the new id */
Returns a new table, index, or space id. */
UNIV_INTERN
dulint
void
dict_hdr_get_new_id(
/*================*/
ulint type); /*!< in: DICT_HDR_ROW_ID, ... */
dulint* table_id, /*!< out: table id (not assigned if NULL) */
dulint* index_id, /*!< out: index id (not assigned if NULL) */
ulint* space_id); /*!< out: space id (not assigned if NULL) */
/**********************************************************************//**
Returns a new row id.
@return the new id */
......@@ -100,6 +101,7 @@ dict_create(void);
#define DICT_COLUMNS_ID ut_dulint_create(0, 2)
#define DICT_INDEXES_ID ut_dulint_create(0, 3)
#define DICT_FIELDS_ID ut_dulint_create(0, 4)
#define DICT_STATS_ID ut_dulint_create(0, 6)
/* The following is a secondary index on SYS_TABLES */
#define DICT_TABLE_IDS_ID ut_dulint_create(0, 5)
......@@ -119,17 +121,21 @@ dict_create(void);
#define DICT_HDR_ROW_ID 0 /* The latest assigned row id */
#define DICT_HDR_TABLE_ID 8 /* The latest assigned table id */
#define DICT_HDR_INDEX_ID 16 /* The latest assigned index id */
#define DICT_HDR_MIX_ID 24 /* Obsolete, always 0. */
#define DICT_HDR_MAX_SPACE_ID 24 /* The latest assigned space id, or 0*/
#define DICT_HDR_MIX_ID_LOW 28 /* Obsolete,always DICT_HDR_FIRST_ID */
#define DICT_HDR_TABLES 32 /* Root of the table index tree */
#define DICT_HDR_TABLE_IDS 36 /* Root of the table index tree */
#define DICT_HDR_COLUMNS 40 /* Root of the column index tree */
#define DICT_HDR_INDEXES 44 /* Root of the index index tree */
#define DICT_HDR_FIELDS 48 /* Root of the index field
index tree */
#define DICT_HDR_STATS 52 /* Root of the stats tree */
#define DICT_HDR_FSEG_HEADER 56 /* Segment header for the tablespace
segment into which the dictionary
header is created */
#define DICT_HDR_XTRADB_MARK 256 /* Flag to distinguish expansion of XtraDB */
/*-------------------------------------------------------------*/
/* The field number of the page number field in the sys_indexes table
......@@ -139,11 +145,15 @@ clustered index */
#define DICT_SYS_INDEXES_TYPE_FIELD 6
#define DICT_SYS_INDEXES_NAME_FIELD 4
#define DICT_SYS_STATS_DIFF_VALS_FIELD 4
/* When a row id which is zero modulo this number (which must be a power of
two) is assigned, the field DICT_HDR_ROW_ID on the dictionary header page is
updated */
#define DICT_HDR_ROW_ID_WRITE_MARGIN 256
#define DICT_HDR_XTRADB_FLAG ut_dulint_create(0x58545241UL,0x44425F31UL) /* "XTRADB_1" */
#ifndef UNIV_NONINL
#include "dict0boot.ic"
#endif
......
This diff is collapsed.
......@@ -352,6 +352,7 @@ dict_create_foreign_constraints(
name before it: test.table2; the
default database id the database of
parameter name */
size_t sql_length, /*!< in: length of sql_string */
const char* name, /*!< in: table full name in the
normalized form
database_name/table_name */
......@@ -1039,8 +1040,9 @@ void
dict_update_statistics_low(
/*=======================*/
dict_table_t* table, /*!< in/out: table */
ibool has_dict_mutex);/*!< in: TRUE if the caller has the
ibool has_dict_mutex, /*!< in: TRUE if the caller has the
dictionary mutex */
ibool sync);
/*********************************************************************//**
Calculates new estimates for table and index statistics. The statistics
are used in query optimization. */
......@@ -1048,7 +1050,8 @@ UNIV_INTERN
void
dict_update_statistics(
/*===================*/
dict_table_t* table); /*!< in/out: table */
dict_table_t* table, /*!< in/out: table */
ibool sync);
/********************************************************************//**
Reserves the dictionary system mutex for MySQL. */
UNIV_INTERN
......@@ -1159,6 +1162,7 @@ struct dict_sys_struct{
dict_table_t* sys_columns; /*!< SYS_COLUMNS table */
dict_table_t* sys_indexes; /*!< SYS_INDEXES table */
dict_table_t* sys_fields; /*!< SYS_FIELDS table */
dict_table_t* sys_stats; /*!< SYS_STATS table */
};
#endif /* !UNIV_HOTBACKUP */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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