Commit 0059a918 authored by Alice Sherepa's avatar Alice Sherepa

innodb_zip

parent dc2c77a6
if (`SELECT @@GLOBAL.innodb_checksum_algorithm like 'strict_%'`)
{
--skip This test cannot be run when innodb_checksum_algorithm is in strict mode
}
...@@ -5,24 +5,17 @@ ...@@ -5,24 +5,17 @@
--source include/not_embedded.inc --source include/not_embedded.inc
--source include/have_innodb.inc --source include/have_innodb.inc
--disable_query_log
# record the file format in order to restore in the end.
--let $file_format_save = `SELECT @@innodb_file_format`
--let $file_format_max_save = `SELECT @@innodb_file_format_max`
--let $simulate_comp_failures_save = `SELECT @@innodb_simulate_comp_failures` --let $simulate_comp_failures_save = `SELECT @@innodb_simulate_comp_failures`
--disable_warnings --disable_query_log
DROP TABLE IF EXISTS t1; call mtr.add_suppression("InnoDB: Simulating a compression failure for table `test`\\.`t1`");
SET GLOBAL INNODB_FILE_FORMAT='Barracuda';
--enable_warnings
# since this test generates lot of errors in log, suppress checking errors
call mtr.add_suppression(".*");
--enable_query_log --enable_query_log
# create the table with compressed pages of size 8K. # create the table with compressed pages of size 8K.
CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255), KEY msg_i(msg)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8; CREATE TABLE t1(id INT AUTO_INCREMENT PRIMARY KEY, msg VARCHAR(255), KEY msg_i(msg)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
SHOW CREATE TABLE t1;
# percentage of compressions that will be forced to fail # percentage of compressions that will be forced to fail
SET GLOBAL innodb_simulate_comp_failures = 25; SET GLOBAL innodb_simulate_comp_failures = 25;
...@@ -30,25 +23,30 @@ SET GLOBAL innodb_simulate_comp_failures = 25; ...@@ -30,25 +23,30 @@ SET GLOBAL innodb_simulate_comp_failures = 25;
--disable_result_log --disable_result_log
let $num_inserts_ind = $num_inserts; let $num_inserts_ind = $num_inserts;
let $commit_iterations=50;
while ($num_inserts_ind) while ($num_inserts_ind)
{ {
let $repeat = `select floor(rand() * 10)`; let $repeat = `select floor(rand() * 10)`;
eval eval INSERT INTO t1(id, msg)
INSERT INTO t1(id, msg) VALUES ($num_inserts_ind, REPEAT('abcdefghijklmnopqrstuvwxyz', $repeat));
VALUES ($num_inserts_ind, REPEAT('abcdefghijklmnopqrstuvwxyz', $repeat));
dec $num_inserts_ind; dec $num_inserts_ind;
} }
--enable_query_log --enable_query_log
--enable_result_log --enable_result_log
SELECT COUNT(*) FROM t1; COMMIT;
SELECT COUNT(id) FROM t1;
--disable_query_log --disable_query_log
--disable_result_log --disable_result_log
# do random ops, making sure that some pages will get fragmented and reorganized. # do random ops, making sure that some pages will get fragmented and reorganized.
let $num_ops_ind = $num_ops; let $num_ops_ind = $num_ops;
let $commit_count= $commit_iterations;
BEGIN;
while($num_ops_ind) while($num_ops_ind)
{ {
...@@ -133,15 +131,22 @@ while($num_ops_ind) ...@@ -133,15 +131,22 @@ while($num_ops_ind)
} }
} }
dec $commit_count;
if (!$commit_count)
{
let $commit_count= $commit_iterations;
COMMIT;
BEGIN;
}
dec $num_ops_ind; dec $num_ops_ind;
} }
COMMIT;
# final cleanup # final cleanup
DROP TABLE t1; DROP TABLE t1;
# restore innodb_file_format and innodb_file_format_max
eval SET GLOBAL innodb_file_format = \"$file_format_save\";
eval SET GLOBAL innodb_file_format_max = \"$file_format_max_save\";
eval SET GLOBAL innodb_simulate_comp_failures = $simulate_comp_failures_save; eval SET GLOBAL innodb_simulate_comp_failures = $simulate_comp_failures_save;
--enable_query_log --enable_query_log
#
-- echo =====
-- echo === Test ANALYZE behavior after default creation
-- echo =====
CREATE TABLE test_ps_flag (a INT) ENGINE=INNODB;
-- source suite/innodb/include/innodb_stats_table_flag_analyze.inc
DROP TABLE test_ps_flag;
CREATE TABLE test_ps_flag (a INT) ENGINE=INNODB STATS_PERSISTENT=default;
-- source suite/innodb/include/innodb_stats_table_flag_analyze.inc
DROP TABLE test_ps_flag;
#
-- echo =====
-- echo === Test ANALYZE behavior after creation with explicit PS=OFF
-- echo =====
CREATE TABLE test_ps_flag (a INT) ENGINE=INNODB STATS_PERSISTENT=0;
-- source suite/innodb/include/innodb_stats_table_flag_analyze.inc
DROP TABLE test_ps_flag;
#
-- echo =====
-- echo === Test ANALYZE behavior after creation with explicit PS=ON
-- echo =====
CREATE TABLE test_ps_flag (a INT) ENGINE=INNODB STATS_PERSISTENT=1;
-- source suite/innodb/include/innodb_stats_table_flag_analyze.inc
DROP TABLE test_ps_flag;
#
-- echo =====
-- echo === Test ANALYZE behavior after creation with explicit PS=OFF,
-- echo === then ALTER to ON, then ALTER to OFF, then ALTER to default
-- echo =====
CREATE TABLE test_ps_flag (a INT) ENGINE=INNODB STATS_PERSISTENT=0;
ALTER TABLE test_ps_flag STATS_PERSISTENT=1;
# also check that the change from the ALTER TABLE survives server restart
-- source include/restart_mysqld.inc
-- source suite/innodb/include/innodb_stats_table_flag_analyze.inc
ALTER TABLE test_ps_flag STATS_PERSISTENT=0;
-- source suite/innodb/include/innodb_stats_table_flag_analyze.inc
ALTER TABLE test_ps_flag STATS_PERSISTENT=default;
-- source suite/innodb/include/innodb_stats_table_flag_analyze.inc
DROP TABLE test_ps_flag;
#
-- echo =====
-- echo === Test ANALYZE behavior after creation with explicit PS=ON,
-- echo === then ALTER to OFF, then ALTER to ON, then ALTER to default
-- echo =====
CREATE TABLE test_ps_flag (a INT) ENGINE=INNODB STATS_PERSISTENT=1;
ALTER TABLE test_ps_flag STATS_PERSISTENT=0;
# also check that the change from the ALTER TABLE survives server restart
-- source include/restart_mysqld.inc
-- source suite/innodb/include/innodb_stats_table_flag_analyze.inc
ALTER TABLE test_ps_flag STATS_PERSISTENT=1;
-- source suite/innodb/include/innodb_stats_table_flag_analyze.inc
ALTER TABLE test_ps_flag STATS_PERSISTENT=default;
-- source suite/innodb/include/innodb_stats_table_flag_analyze.inc
DROP TABLE test_ps_flag;
SHOW CREATE TABLE test_ps_flag;
DELETE FROM mysql.innodb_index_stats WHERE table_name = 'test_ps_flag';
DELETE FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
# must be 0, we have just deleted the rows
SELECT COUNT(*) AS cnt_before FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
ANALYZE TABLE test_ps_flag;
# if the table is PS enabled, then this should be 1 and 0 otherwise
SELECT COUNT(*) AS cnt_after FROM mysql.innodb_table_stats WHERE table_name = 'test_ps_flag';
...@@ -62,7 +62,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); ...@@ -62,7 +62,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
select * from t; select * from t;
check table t; check table t;
# #
set session debug = "+d,ib_trunc_crash_while_writing_redo_log"; set session debug_dbug = "+d,ib_trunc_crash_while_writing_redo_log";
--source include/expect_crash.inc --source include/expect_crash.inc
--error 2013 --error 2013
truncate table t; truncate table t;
...@@ -92,7 +92,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); ...@@ -92,7 +92,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
select * from t; select * from t;
check table t; check table t;
# #
set session debug = "+d,ib_trunc_crash_after_redo_log_write_complete"; set session debug_dbug = "+d,ib_trunc_crash_after_redo_log_write_complete";
--source include/expect_crash.inc --source include/expect_crash.inc
--error 2013 --error 2013
truncate table t; truncate table t;
...@@ -124,7 +124,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); ...@@ -124,7 +124,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
select * from t; select * from t;
check table t; check table t;
# #
set session debug = "+d,ib_trunc_crash_on_drop_of_clust_index"; set session debug_dbug = "+d,ib_trunc_crash_on_drop_of_clust_index";
--source include/expect_crash.inc --source include/expect_crash.inc
--error 2013 --error 2013
truncate table t; truncate table t;
...@@ -152,7 +152,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); ...@@ -152,7 +152,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
select * from t; select * from t;
check table t; check table t;
# #
set session debug = "+d,ib_trunc_crash_on_drop_of_uniq_index"; set session debug_dbug = "+d,ib_trunc_crash_on_drop_of_uniq_index";
--source include/expect_crash.inc --source include/expect_crash.inc
--error 2013 --error 2013
truncate table t; truncate table t;
...@@ -181,7 +181,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); ...@@ -181,7 +181,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
select * from t; select * from t;
check table t; check table t;
# #
set session debug = "+d,ib_trunc_crash_on_drop_of_sec_index"; set session debug_dbug = "+d,ib_trunc_crash_on_drop_of_sec_index";
--source include/expect_crash.inc --source include/expect_crash.inc
--error 2013 --error 2013
truncate table t; truncate table t;
...@@ -215,7 +215,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); ...@@ -215,7 +215,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
select * from t; select * from t;
check table t; check table t;
# #
set session debug = "+d,ib_trunc_crash_drop_reinit_done_create_to_start"; set session debug_dbug = "+d,ib_trunc_crash_drop_reinit_done_create_to_start";
--source include/expect_crash.inc --source include/expect_crash.inc
--error 2013 --error 2013
truncate table t; truncate table t;
...@@ -247,7 +247,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); ...@@ -247,7 +247,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
select * from t; select * from t;
check table t; check table t;
# #
set session debug = "+d,ib_trunc_crash_on_create_of_clust_index"; set session debug_dbug = "+d,ib_trunc_crash_on_create_of_clust_index";
--source include/expect_crash.inc --source include/expect_crash.inc
--error 2013 --error 2013
truncate table t; truncate table t;
...@@ -275,7 +275,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); ...@@ -275,7 +275,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
select * from t; select * from t;
check table t; check table t;
# #
set session debug = "+d,ib_trunc_crash_on_create_of_uniq_index"; set session debug_dbug = "+d,ib_trunc_crash_on_create_of_uniq_index";
--source include/expect_crash.inc --source include/expect_crash.inc
--error 2013 --error 2013
truncate table t; truncate table t;
...@@ -303,7 +303,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); ...@@ -303,7 +303,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
select * from t; select * from t;
check table t; check table t;
# #
set session debug = "+d,ib_trunc_crash_on_create_of_sec_index"; set session debug_dbug = "+d,ib_trunc_crash_on_create_of_sec_index";
--source include/expect_crash.inc --source include/expect_crash.inc
--error 2013 --error 2013
truncate table t; truncate table t;
...@@ -336,7 +336,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); ...@@ -336,7 +336,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
select * from t; select * from t;
check table t; check table t;
# #
set session debug = "+d,ib_trunc_crash_on_updating_dict_sys_info"; set session debug_dbug = "+d,ib_trunc_crash_on_updating_dict_sys_info";
--source include/expect_crash.inc --source include/expect_crash.inc
--error 2013 --error 2013
truncate table t; truncate table t;
...@@ -368,7 +368,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); ...@@ -368,7 +368,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
select * from t; select * from t;
check table t; check table t;
# #
set session debug = "+d,ib_trunc_crash_before_log_removal"; set session debug_dbug = "+d,ib_trunc_crash_before_log_removal";
--source include/expect_crash.inc --source include/expect_crash.inc
--error 2013 --error 2013
truncate table t; truncate table t;
...@@ -395,7 +395,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); ...@@ -395,7 +395,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
select * from t; select * from t;
check table t; check table t;
# #
set session debug = "+d,ib_trunc_crash_after_truncate_done"; set session debug_dbug = "+d,ib_trunc_crash_after_truncate_done";
--source include/expect_crash.inc --source include/expect_crash.inc
--error 2013 --error 2013
truncate table t; truncate table t;
......
...@@ -56,7 +56,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); ...@@ -56,7 +56,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
select * from t; select * from t;
check table t; check table t;
# #
set session debug = "+d,ib_trunc_crash_drop_reinit_done_create_to_start"; set session debug_dbug = "+d,ib_trunc_crash_drop_reinit_done_create_to_start";
--source include/expect_crash.inc --source include/expect_crash.inc
--error 2013 --error 2013
truncate table t; truncate table t;
...@@ -83,7 +83,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); ...@@ -83,7 +83,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
select * from t; select * from t;
check table t; check table t;
# #
set session debug = "+d,ib_trunc_crash_on_updating_dict_sys_info"; set session debug_dbug = "+d,ib_trunc_crash_on_updating_dict_sys_info";
--source include/expect_crash.inc --source include/expect_crash.inc
--error 2013 --error 2013
truncate table t; truncate table t;
......
...@@ -6,26 +6,16 @@ ...@@ -6,26 +6,16 @@
source include/not_embedded.inc; source include/not_embedded.inc;
--disable_query_log --disable_query_log
call mtr.add_suppression("InnoDB: New log files created");
call mtr.add_suppression("InnoDB: Creating foreign key constraint system tables");
let $innodb_index_stats = query_get_value(show create table mysql.innodb_index_stats, Create Table, 1); let $innodb_index_stats = query_get_value(show create table mysql.innodb_index_stats, Create Table, 1);
let $innodb_table_stats = query_get_value(show create table mysql.innodb_table_stats, Create Table, 1); let $innodb_table_stats = query_get_value(show create table mysql.innodb_table_stats, Create Table, 1);
let $database=`select database()`; let $database=`select database()`;
drop table mysql.innodb_index_stats, mysql.innodb_table_stats; drop table mysql.innodb_index_stats, mysql.innodb_table_stats;
let $_server_id= `SELECT @@server_id`;
let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect;
let $datadir= `SELECT @@datadir`; let $datadir= `SELECT @@datadir`;
exec echo "wait" > $_expect_file_name; --source include/shutdown_mysqld.inc
shutdown_server; remove_files_wildcard $datadir ib_logfile*;
remove_file $datadir/ib_logfile0;
remove_file $datadir/ib_logfile1;
remove_file $datadir/ibdata1; remove_file $datadir/ibdata1;
exec echo "restart" > $_expect_file_name; --source include/start_mysqld.inc
enable_reconnect;
source include/wait_until_connected_again.inc;
disable_reconnect;
--disable_query_log --disable_query_log
use mysql; use mysql;
......
--echo =============== --echo # Create table & Index
--echo create table & Index
--echo ===============
eval CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB, eval CREATE TABLE tab5(col_1 TINYBLOB, col_2 TINYTEXT,col_3 BLOB,
col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT, col_4 TEXT,col_5 MEDIUMBLOB,col_6 MEDIUMTEXT,
......
--echo =============== --echo # Load the data
--echo Load the data
--echo ===============
SET @col_1 = repeat('a', 100); SET @col_1 = repeat('a', 100);
SET @col_2 = repeat('b', 100); SET @col_2 = repeat('b', 100);
......
--echo =============== --echo # Check the stats of the table
--echo Check the stats of the table --echo # Check the size of the ibd file
--echo Check the size of the ibd file
--echo ===============
-- echo # testcase : pass = 1 fail = 0 -- echo # testcase : pass = 1 fail = 0
SELECT count(*) > 0 as "compress_stat" SELECT count(*) > 0 as "compress_stat"
......
...@@ -65,7 +65,7 @@ check table t; ...@@ -65,7 +65,7 @@ check table t;
# #
set session debug_dbug = "+d,ib_trunc_crash_while_writing_redo_log"; set session debug_dbug = "+d,ib_trunc_crash_while_writing_redo_log";
--source include/expect_crash.inc --source include/expect_crash.inc
#--error 2013 --error 2013
truncate table t; truncate table t;
# #
--source include/start_mysqld.inc --source include/start_mysqld.inc
...@@ -96,7 +96,7 @@ check table t; ...@@ -96,7 +96,7 @@ check table t;
# #
set session debug_dbug = "+d,ib_trunc_crash_after_redo_log_write_complete"; set session debug_dbug = "+d,ib_trunc_crash_after_redo_log_write_complete";
--source include/expect_crash.inc --source include/expect_crash.inc
#--error 2013 --error 2013
truncate table t; truncate table t;
--source include/start_mysqld.inc --source include/start_mysqld.inc
...@@ -128,7 +128,7 @@ check table t; ...@@ -128,7 +128,7 @@ check table t;
# #
set session debug_dbug = "+d,ib_trunc_crash_on_drop_of_clust_index"; set session debug_dbug = "+d,ib_trunc_crash_on_drop_of_clust_index";
--source include/expect_crash.inc --source include/expect_crash.inc
#--error 2013 --error 2013
truncate table t; truncate table t;
# #
--source include/start_mysqld.inc --source include/start_mysqld.inc
...@@ -156,7 +156,7 @@ check table t; ...@@ -156,7 +156,7 @@ check table t;
# #
set session debug_dbug = "+d,ib_trunc_crash_on_drop_of_uniq_index"; set session debug_dbug = "+d,ib_trunc_crash_on_drop_of_uniq_index";
--source include/expect_crash.inc --source include/expect_crash.inc
#--error 2013 --error 2013
truncate table t; truncate table t;
# #
--source include/start_mysqld.inc --source include/start_mysqld.inc
...@@ -185,7 +185,7 @@ check table t; ...@@ -185,7 +185,7 @@ check table t;
# #
set session debug_dbug = "+d,ib_trunc_crash_on_drop_of_sec_index"; set session debug_dbug = "+d,ib_trunc_crash_on_drop_of_sec_index";
--source include/expect_crash.inc --source include/expect_crash.inc
#--error 2013 --error 2013
truncate table t; truncate table t;
# #
--source include/start_mysqld.inc --source include/start_mysqld.inc
......
...@@ -56,7 +56,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); ...@@ -56,7 +56,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
select * from t; select * from t;
check table t; check table t;
# #
set session debug = "+d,ib_trunc_crash_drop_reinit_done_create_to_start"; set session debug_dbug = "+d,ib_trunc_crash_drop_reinit_done_create_to_start";
--source include/expect_crash.inc --source include/expect_crash.inc
--error 2013 --error 2013
truncate table t; truncate table t;
...@@ -83,7 +83,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c'); ...@@ -83,7 +83,7 @@ insert into t values (1, 1.1, 'a'), (2, 2.2, 'b'), (3, 3.3, 'c');
select * from t; select * from t;
check table t; check table t;
# #
set session debug = "+d,ib_trunc_crash_on_updating_dict_sys_info"; set session debug_dbug = "+d,ib_trunc_crash_on_updating_dict_sys_info";
--source include/expect_crash.inc --source include/expect_crash.inc
--error 2013 --error 2013
truncate table t; truncate table t;
......
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