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

Merge 10.2 into 10.3

parents 7e4ea418 d9dcb8ba
......@@ -1548,6 +1548,7 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
{
my_fwrite(result_file, (const uchar *) tmp_str.str, tmp_str.length,
MYF(MY_NABP));
fflush(result_file);
my_free(tmp_str.str);
}
}
......
#
# suite.pm will make sure that all tests including this file
# will be skipped as needed
#
Windows bug: happens when a new line is exactly at the right offset.
Windows bug: new line disappears when it is exactly at the right offset.
The following options may be given as the first argument:
--print-defaults Print the program argument list and exit.
--no-defaults Don't read default options from any option file.
......
......@@ -42,7 +42,7 @@ perl;
$re2=join('|', @plugins);
$skip=0;
open(F, '<', "$ENV{MYSQL_TMP_DIR}/mysqld--help.txt") or die;
print "Windows bug: happens when a new line is exactly at the right offset.\n";
print "Windows bug: new line disappears when it is exactly at the right offset.\n";
while (<F>) {
next if 1../The following groups are read/;
# formatting, skip line consisting entirely of dashes and blanks
......
RESET MASTER;
include/stop_dump_threads.inc
# Step-1: Execute some dummy statements.
CREATE TABLE t1(i int);
INSERT INTO t1 values (1);
# Step-2: Disable binary log temporarily and drop the table 't1'.
set @@SESSION.SQL_LOG_BIN = 0;
DROP TABLE t1;
set @@SESSION.SQL_LOG_BIN = 1;
# Step-3: Execute MYSQL_BINLOG with --stop-never and source it to mysql client.
# Step-4: Wait till dump thread transfer is completed.
# Step-5: Check that the data is there.
# Step-6: Cleanup
# kill the dump thread serving the mysqlbinlog --stop-never process
include/stop_dump_threads.inc
DROP TABLE t1;
# ==== Purpose ====
#
# Test verifies that continuous streaming of binary log content using the
# "mysqlbinlog --stop-never" option and sourcing it to mysql client works
# fine.
#
# ==== Implementation ====
#
# Steps:
# 1 - Create a table on a server on which binary log is enabled and insert
# a row.
# 2 - Disable the binary log on the server and drop the table.
# 3 - Capture the binary log output using "mysqlbinlog --stop_never" option
# and source it to mysql client.
# 4 - Query the PROCESSLIST table to ensure that the dump thread which is
# serving "stop_never" option has read entire binlog.
# 5 - Verify that the table is populated on the server.
# 6 - Cleanup.
#
# ==== References ====
#
# MDEV-11154: Write_on_release_cache(log_event.cc) function will not write
# "COMMIT", if use "mysqlbinlog ... | mysql ..."
--source include/not_windows.inc
# Test is not specific to any binlog format. Hence Running only for 'row'.
--source include/have_binlog_format_row.inc
# binlog file name is needed in the test. To use master-bin.000001,
# RESET MASTER is needed.
RESET MASTER;
# kill the dump threads if there any dump threads (may be from previous test)
--source include/stop_dump_threads.inc
--echo # Step-1: Execute some dummy statements.
CREATE TABLE t1(i int);
INSERT INTO t1 values (1);
--echo # Step-2: Disable binary log temporarily and drop the table 't1'.
set @@SESSION.SQL_LOG_BIN = 0;
DROP TABLE t1;
set @@SESSION.SQL_LOG_BIN = 1;
--echo # Step-3: Execute MYSQL_BINLOG with --stop-never and source it to mysql client.
--write_file $MYSQL_TMP_DIR/mysqlbinlog_stop_never.sh
(`$MYSQL_BINLOG --read-from-remote-server --stop-never --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 | $MYSQL --user=root --protocol=tcp --host=127.0.0.1 --port=$MASTER_MYPORT`) < /dev/null > /dev/null 2>&1 &
EOF
--exec /bin/bash $MYSQL_TMP_DIR/mysqlbinlog_stop_never.sh
--echo # Step-4: Wait till dump thread transfer is completed.
let $wait_condition= SELECT id from information_schema.processlist where processlist.command like '%Binlog%' and state like '%Master has sent%';
--source include/wait_condition.inc
--echo # Step-5: Check that the data is there.
let $count= 1;
let $table= test.t1;
source include/wait_until_rows_count.inc;
--echo # Step-6: Cleanup
--echo # kill the dump thread serving the mysqlbinlog --stop-never process
--source include/stop_dump_threads.inc
DROP TABLE t1;
--remove_file $MYSQL_TMP_DIR/mysqlbinlog_stop_never.sh
--- check_ibd_filesize.result
+++ check_ibd_filesize.result,32k
@@ -3,18 +3,12 @@
# SPACE IN 5.7 THAN IN 5.6
#
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
-# bytes: 98304
+# bytes: 196608
INSERT INTO t1 SELECT * FROM seq_1_to_25000;
-# bytes: 9437184
+# bytes: 786432
DROP TABLE t1;
CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
-# bytes: 98304
+# bytes: 196608
INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
-# bytes: 4194304
-DROP TABLE t1;
-CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB)
-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-# bytes: 65536
-INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
-# bytes: 65536
+# bytes: 786432
DROP TABLE t1;
--- check_ibd_filesize.result
+++ check_ibd_filesize.result,4k
@@ -3,18 +3,18 @@
# SPACE IN 5.7 THAN IN 5.6
#
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
-# bytes: 98304
+# bytes: 24576
INSERT INTO t1 SELECT * FROM seq_1_to_25000;
# bytes: 9437184
DROP TABLE t1;
CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
-# bytes: 98304
+# bytes: 24576
INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
# bytes: 4194304
DROP TABLE t1;
CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-# bytes: 65536
+# bytes: 16384
INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
-# bytes: 65536
+# bytes: 25600
DROP TABLE t1;
--- check_ibd_filesize.result
+++ check_ibd_filesize.result,64k
@@ -3,18 +3,12 @@
# SPACE IN 5.7 THAN IN 5.6
#
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
-# bytes: 98304
+# bytes: 393216
INSERT INTO t1 SELECT * FROM seq_1_to_25000;
-# bytes: 9437184
+# bytes: 983040
DROP TABLE t1;
CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
-# bytes: 98304
+# bytes: 393216
INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
-# bytes: 4194304
-DROP TABLE t1;
-CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB)
-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-# bytes: 65536
-INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
-# bytes: 65536
+# bytes: 1572864
DROP TABLE t1;
--- check_ibd_filesize.result
+++ check_ibd_filesize.result,8k
@@ -3,18 +3,18 @@
# SPACE IN 5.7 THAN IN 5.6
#
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
-# bytes: 98304
+# bytes: 49152
INSERT INTO t1 SELECT * FROM seq_1_to_25000;
# bytes: 9437184
DROP TABLE t1;
CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
-# bytes: 98304
+# bytes: 49152
INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
# bytes: 4194304
DROP TABLE t1;
CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
-# bytes: 65536
+# bytes: 32768
INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
-# bytes: 65536
+# bytes: 32768
DROP TABLE t1;
#
# Bug #21950389 SMALL TABLESPACES WITH BLOBS TAKE UP TO 80 TIMES MORE
# SPACE IN 5.7 THAN IN 5.6
#
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
# bytes: 98304
INSERT INTO t1 SELECT * FROM seq_1_to_25000;
# bytes: 9437184
DROP TABLE t1;
CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
# bytes: 98304
INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
# bytes: 4194304
DROP TABLE t1;
CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
# bytes: 65536
INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
# bytes: 65536
DROP TABLE t1;
SELECT table_id INTO @table_stats_id FROM information_schema.innodb_sys_tables
WHERE name = 'mysql/innodb_table_stats';
SELECT table_id INTO @index_stats_id FROM information_schema.innodb_sys_tables
WHERE name = 'mysql/innodb_index_stats';
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE table_id NOT IN (@table_stats_id, @index_stats_id) ORDER BY table_id;
TABLE_ID NAME FLAG N_COLS SPACE ROW_FORMAT ZIP_PAGE_SIZE SPACE_TYPE
11 SYS_FOREIGN 0 7 0 Redundant 0 System
12 SYS_FOREIGN_COLS 0 7 0 Redundant 0 System
13 SYS_TABLESPACES 0 6 0 Redundant 0 System
14 SYS_DATAFILES 0 5 0 Redundant 0 System
15 SYS_VIRTUAL 0 6 0 Redundant 0 System
18 mysql/transaction_registry 33 8 3 Dynamic 0 Single
SELECT table_id,pos,mtype,prtype,len,name
FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS
WHERE table_id NOT IN (@table_stats_id, @index_stats_id)
ORDER BY table_id, pos;
table_id pos mtype prtype len name
11 0 1 524292 0 ID
11 1 1 524292 0 FOR_NAME
11 2 1 524292 0 REF_NAME
11 3 6 0 4 N_COLS
12 0 1 524292 0 ID
12 1 6 0 4 POS
12 2 1 524292 0 FOR_COL_NAME
12 3 1 524292 0 REF_COL_NAME
13 0 6 0 4 SPACE
13 1 1 524292 0 NAME
13 2 6 0 4 FLAGS
14 0 6 0 4 SPACE
14 1 1 524292 0 PATH
15 0 6 0 8 TABLE_ID
15 1 6 0 4 POS
15 2 6 0 4 BASE_POS
18 0 6 1800 8 transaction_id
18 1 6 1800 8 commit_id
18 2 3 526087 7 begin_timestamp
18 3 3 526087 7 commit_timestamp
18 4 6 1022 1 isolation_level
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES
WHERE table_id NOT IN (@table_stats_id, @index_stats_id) ORDER BY index_id;
INDEX_ID NAME TABLE_ID TYPE N_FIELDS PAGE_NO SPACE MERGE_THRESHOLD
# ID_IND # 3 1 # # 50
# FOR_IND # 0 1 # # 50
# REF_IND # 0 1 # # 50
# ID_IND # 3 2 # # 50
# SYS_TABLESPACES_SPACE # 3 1 # # 50
# SYS_DATAFILES_SPACE # 3 1 # # 50
# BASE_IDX # 3 3 # # 50
# PRIMARY # 3 1 # # 50
# commit_id # 2 1 # # 50
# begin_timestamp # 0 1 # # 50
# commit_timestamp # 0 2 # # 50
SELECT index_id,pos,name FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS
WHERE name NOT IN ('database_name', 'table_name', 'index_name', 'stat_name')
ORDER BY index_id, pos;
index_id pos name
11 0 ID
12 0 FOR_NAME
13 0 REF_NAME
14 0 ID
14 1 POS
15 0 SPACE
16 0 SPACE
17 0 TABLE_ID
17 1 POS
17 2 BASE_POS
20 0 transaction_id
21 0 commit_id
22 0 begin_timestamp
23 0 commit_timestamp
23 1 transaction_id
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
ID FOR_NAME REF_NAME N_COLS TYPE
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
ID FOR_COL_NAME REF_COL_NAME POS
CREATE TABLE t_redundant (a INT KEY, b TEXT) ROW_FORMAT=REDUNDANT ENGINE=innodb;
CREATE TABLE t_compact (a INT KEY, b TEXT) ROW_FORMAT=COMPACT ENGINE=innodb;
CREATE TABLE t_compressed (a INT KEY, b TEXT) ROW_FORMAT=COMPRESSED ENGINE=innodb KEY_BLOCK_SIZE=2;
CREATE TABLE t_dynamic (a INT KEY, b TEXT) ROW_FORMAT=DYNAMIC ENGINE=innodb;
=== information_schema.innodb_sys_tables and innodb_sys_tablespaces ===
Table Name Tablespace Table Flags Columns Row Format Zip Size Space Type
test/t_compact test/t_compact 1 5 Compact 0 Single
test/t_compressed test/t_compressed 37 5 Compressed 2048 Single
test/t_dynamic test/t_dynamic 33 5 Dynamic 0 Single
test/t_redundant test/t_redundant 0 5 Redundant 0 Single
=== information_schema.innodb_sys_tablespaces and innodb_sys_datafiles ===
Space_Name Space_Type Page_Size Zip_Size Formats_Permitted Path
test/t_redundant Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t_redundant.ibd
test/t_compact Single DEFAULT DEFAULT Compact or Redundant MYSQLD_DATADIR/test/t_compact.ibd
test/t_compressed Single DEFAULT 2048 Compressed MYSQLD_DATADIR/test/t_compressed.ibd
test/t_dynamic Single DEFAULT DEFAULT Dynamic MYSQLD_DATADIR/test/t_dynamic.ibd
DROP TABLE t_redundant, t_compact, t_compressed, t_dynamic;
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS;
count(*)
8
CREATE TABLE parent (id INT NOT NULL,
PRIMARY KEY (id)) ENGINE=INNODB;
CREATE TABLE child (id INT, parent_id INT,
INDEX par_ind (parent_id),
CONSTRAINT constraint_test
FOREIGN KEY (parent_id) REFERENCES parent(id)
ON DELETE CASCADE) ENGINE=INNODB;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
ID FOR_NAME REF_NAME N_COLS TYPE
test/constraint_test test/child test/parent 1 1
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
ID FOR_COL_NAME REF_COL_NAME POS
test/constraint_test parent_id id 0
INSERT INTO parent VALUES(1);
SELECT name, num_rows, ref_count
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name LIKE "%parent";
name num_rows ref_count
test/parent 1 1
SELECT NAME, FLAG, N_COLS FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name NOT LIKE 'sys/%';
NAME FLAG N_COLS
SYS_DATAFILES 0 5
SYS_FOREIGN 0 7
SYS_FOREIGN_COLS 0 7
SYS_TABLESPACES 0 6
SYS_VIRTUAL 0 6
mysql/innodb_index_stats 33 11
mysql/innodb_table_stats 33 9
mysql/transaction_registry 33 8
test/child 33 5
test/parent 33 4
SELECT name, n_fields
from INFORMATION_SCHEMA.INNODB_SYS_INDEXES
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%parent%");
name n_fields
PRIMARY 1
SELECT name, n_fields
from INFORMATION_SCHEMA.INNODB_SYS_INDEXES
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%child%");
name n_fields
GEN_CLUST_INDEX 0
par_ind 1
SELECT name, pos, mtype, len
from INFORMATION_SCHEMA.INNODB_SYS_COLUMNS
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%child%");
name pos mtype len
id 0 6 4
parent_id 1 6 4
DROP TABLE child;
DROP TABLE parent;
CREATE TABLE parent (id INT NOT NULL, newid INT NOT NULL,
PRIMARY KEY (id, newid)) ENGINE=INNODB;
CREATE TABLE child (id INT, parent_id INT,
INDEX par_ind (parent_id),
CONSTRAINT constraint_test
FOREIGN KEY (id, parent_id) REFERENCES parent(id, newid)
ON DELETE CASCADE) ENGINE=INNODB;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
ID FOR_NAME REF_NAME N_COLS TYPE
test/constraint_test test/child test/parent 2 1
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
ID FOR_COL_NAME REF_COL_NAME POS
test/constraint_test id id 0
test/constraint_test parent_id newid 1
INSERT INTO parent VALUES(1, 9);
SELECT * FROM parent WHERE id IN (SELECT id FROM parent);
id newid
1 9
SELECT name, num_rows, ref_count
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name LIKE "%parent";
name num_rows ref_count
test/parent 1 2
DROP TABLE child;
DROP TABLE parent;
call mtr.add_suppression("Cannot find space id [0-9]+ in the tablespace memory cache");
call mtr.add_suppression("Cannot rename table 'test/t1' to 'test/t2' since the dictionary cache already contains 'test/t2'.");
#
# WL5980 Remote tablespace debug error injection tests.
#
CREATE TABLE t1 (a int KEY, b text) ENGINE=Innodb DATA DIRECTORY='MYSQL_TMP_DIR/alt_dir' ;
INSERT INTO t1 VALUES (1, 'tablespace');
SELECT * FROM t1;
a b
1 tablespace
#
# Test the second injection point in fil_rename_tablespace().
# Make sure the table is useable after this failure.
#
SET @save_dbug=@@debug_dbug;
SET debug_dbug="+d,fil_rename_tablespace_failure_2";
RENAME TABLE t1 TO t2;
SET debug_dbug=@save_dbug;
INSERT INTO t1 VALUES (2, 'tablespace');
SELECT * FROM t1;
a b
1 tablespace
2 tablespace
#
# Cleanup
#
DROP TABLE t1;
#
# Bug #20445525 ADD A CONSISTENCY CHECK AGAINST DB_TRX_ID BEING
# IN THE FUTURE
#
CREATE TABLE t1(a INT) row_format=redundant engine=innoDB;
INSERT INTO t1 VALUES(1);
NOT FOUND /\[Warning\] InnoDB: A transaction id in a record of table `test`\.`t1` is newer than the system-wide maximum/ in mysqld.1.err
call mtr.add_suppression("\\[Warning\\] InnoDB: A transaction id in a record of table `test`\\.`t1` is newer than the system-wide maximum");
SELECT * FROM t1;
a
Warnings:
Warning 1642 InnoDB: Transaction id in a record of table `test`.`t1` is newer than system-wide maximum.
DROP TABLE t1;
--source include/innodb_page_size.inc
--source include/have_sequence.inc
--echo #
--echo # Bug #21950389 SMALL TABLESPACES WITH BLOBS TAKE UP TO 80 TIMES MORE
--echo # SPACE IN 5.7 THAN IN 5.6
--echo #
#
# Table 1: small rows
#
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
let MYSQLD_DATADIR=`select @@datadir`;
perl;
print "# bytes: ", (-s "$ENV{MYSQLD_DATADIR}/test/t1.ibd"), "\n";
EOF
INSERT INTO t1 SELECT * FROM seq_1_to_25000;
perl;
print "# bytes: ", (-s "$ENV{MYSQLD_DATADIR}/test/t1.ibd"), "\n";
EOF
DROP TABLE t1;
#
# Table 2: BLOB
#
CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
perl;
print "# bytes: ", (-s "$ENV{MYSQLD_DATADIR}/test/t1.ibd"), "\n";
EOF
INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
perl;
print "# bytes: ", (-s "$ENV{MYSQLD_DATADIR}/test/t1.ibd"), "\n";
EOF
DROP TABLE t1;
let $page_size=`SELECT @@innodb_page_size`;
if ($page_size < 32768)
{
#
# Table 3: compressed BLOB
#
CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB)
ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
perl;
print "# bytes: ", (-s "$ENV{MYSQLD_DATADIR}/test/t1.ibd"), "\n";
EOF
INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
perl;
print "# bytes: ", (-s "$ENV{MYSQLD_DATADIR}/test/t1.ibd"), "\n";
EOF
DROP TABLE t1;
}
--innodb
--innodb-sys-tablespaces
--innodb-sys-datafiles
--innodb-sys-tablestats
--innodb-sys-tables
--innodb-sys-columns
--innodb-sys-indexes
--innodb-sys-fields
--innodb-sys-foreign
--innodb-sys-foreign-cols
# This is the test for Information Schema System Table View
# that displays the InnoDB system table content through
# information schema tables.
--source include/innodb_page_size_small.inc
LET $MYSQLD_DATADIR = `select @@datadir`;
LET $INNODB_PAGE_SIZE = `select @@innodb_page_size`;
# The IDs of mysql.innodb_table_stats and mysql.innodb_index_stats may
# vary depending on whether the tables have been rebuilt
# by previously run tests.
SELECT table_id INTO @table_stats_id FROM information_schema.innodb_sys_tables
WHERE name = 'mysql/innodb_table_stats';
SELECT table_id INTO @index_stats_id FROM information_schema.innodb_sys_tables
WHERE name = 'mysql/innodb_index_stats';
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE table_id NOT IN (@table_stats_id, @index_stats_id) ORDER BY table_id;
SELECT table_id,pos,mtype,prtype,len,name
FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS
WHERE table_id NOT IN (@table_stats_id, @index_stats_id)
ORDER BY table_id, pos;
--replace_column 1 # 3 # 6 # 7 #
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES
WHERE table_id NOT IN (@table_stats_id, @index_stats_id) ORDER BY index_id;
SELECT index_id,pos,name FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS
WHERE name NOT IN ('database_name', 'table_name', 'index_name', 'stat_name')
ORDER BY index_id, pos;
--sorted_result
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
--sorted_result
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
CREATE TABLE t_redundant (a INT KEY, b TEXT) ROW_FORMAT=REDUNDANT ENGINE=innodb;
CREATE TABLE t_compact (a INT KEY, b TEXT) ROW_FORMAT=COMPACT ENGINE=innodb;
CREATE TABLE t_compressed (a INT KEY, b TEXT) ROW_FORMAT=COMPRESSED ENGINE=innodb KEY_BLOCK_SIZE=2;
CREATE TABLE t_dynamic (a INT KEY, b TEXT) ROW_FORMAT=DYNAMIC ENGINE=innodb;
--source suite/innodb/include/show_i_s_tables.inc
--source suite/innodb/include/show_i_s_tablespaces.inc
DROP TABLE t_redundant, t_compact, t_compressed, t_dynamic;
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS;
# Create a foreign key constraint, and verify the information
# in INFORMATION_SCHEMA.INNODB_SYS_FOREIGN and
# INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS
CREATE TABLE parent (id INT NOT NULL,
PRIMARY KEY (id)) ENGINE=INNODB;
CREATE TABLE child (id INT, parent_id INT,
INDEX par_ind (parent_id),
CONSTRAINT constraint_test
FOREIGN KEY (parent_id) REFERENCES parent(id)
ON DELETE CASCADE) ENGINE=INNODB;
--sorted_result
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
--sorted_result
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
# Insert a row in the table "parent", and see whether that reflected in
# INNODB_SYS_TABLESTATS
INSERT INTO parent VALUES(1);
--sorted_result
SELECT name, num_rows, ref_count
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name LIKE "%parent";
--sorted_result
SELECT NAME, FLAG, N_COLS FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name NOT LIKE 'sys/%';
--sorted_result
SELECT name, n_fields
from INFORMATION_SCHEMA.INNODB_SYS_INDEXES
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%parent%");
--sorted_result
SELECT name, n_fields
from INFORMATION_SCHEMA.INNODB_SYS_INDEXES
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%child%");
--sorted_result
SELECT name, pos, mtype, len
from INFORMATION_SCHEMA.INNODB_SYS_COLUMNS
WHERE table_id In (SELECT table_id from
INFORMATION_SCHEMA.INNODB_SYS_TABLES
WHERE name LIKE "%child%");
DROP TABLE child;
DROP TABLE parent;
# Create table with 2 columns in the foreign key constraint
CREATE TABLE parent (id INT NOT NULL, newid INT NOT NULL,
PRIMARY KEY (id, newid)) ENGINE=INNODB;
CREATE TABLE child (id INT, parent_id INT,
INDEX par_ind (parent_id),
CONSTRAINT constraint_test
FOREIGN KEY (id, parent_id) REFERENCES parent(id, newid)
ON DELETE CASCADE) ENGINE=INNODB;
--sorted_result
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
--sorted_result
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
INSERT INTO parent VALUES(1, 9);
# Nested query will open the table handle twice
--sorted_result
SELECT * FROM parent WHERE id IN (SELECT id FROM parent);
--sorted_result
SELECT name, num_rows, ref_count
FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
WHERE name LIKE "%parent";
DROP TABLE child;
DROP TABLE parent;
#
# This testcase is to check the various debug injection points
# to make sure error conditions react corectly and acheive
# better code coverage.
#
# Not supported in embedded
--source include/not_embedded.inc
--source include/have_debug.inc
--source include/have_innodb.inc
# These messages are expected in the log
call mtr.add_suppression("Cannot find space id [0-9]+ in the tablespace memory cache");
call mtr.add_suppression("Cannot rename table 'test/t1' to 'test/t2' since the dictionary cache already contains 'test/t2'.");
# Set up some variables
LET $MYSQL_DATA_DIR = `select @@datadir`;
LET $data_directory_clause = DATA DIRECTORY='$MYSQL_TMP_DIR/alt_dir';
--enable_query_log
--echo #
--echo # WL5980 Remote tablespace debug error injection tests.
--echo #
--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR
eval CREATE TABLE t1 (a int KEY, b text) ENGINE=Innodb $data_directory_clause ;
INSERT INTO t1 VALUES (1, 'tablespace');
SELECT * FROM t1;
--echo #
--echo # Test the second injection point in fil_rename_tablespace().
--echo # Make sure the table is useable after this failure.
--echo #
SET @save_dbug=@@debug_dbug;
SET debug_dbug="+d,fil_rename_tablespace_failure_2";
--disable_result_log
--error ER_ERROR_ON_RENAME
RENAME TABLE t1 TO t2;
--enable_result_log
SET debug_dbug=@save_dbug;
INSERT INTO t1 VALUES (2, 'tablespace');
SELECT * FROM t1;
--echo #
--echo # Cleanup
--echo #
DROP TABLE t1;
--rmdir $MYSQL_TMP_DIR/alt_dir/test
--rmdir $MYSQL_TMP_DIR/alt_dir
--echo #
--echo # Bug #20445525 ADD A CONSISTENCY CHECK AGAINST DB_TRX_ID BEING
--echo # IN THE FUTURE
--echo #
--source include/not_debug.inc
--source include/have_innodb.inc
--source include/not_embedded.inc
let PAGE_SIZE=`select @@innodb_page_size`;
CREATE TABLE t1(a INT) row_format=redundant engine=innoDB;
INSERT INTO t1 VALUES(1);
let MYSQLD_DATADIR=`select @@datadir`;
--source include/shutdown_mysqld.inc
perl;
do "$ENV{MTR_SUITE_DIR}/include/crc32.pl";
my $file = "$ENV{MYSQLD_DATADIR}/test/t1.ibd";
open(FILE, "+<", $file) || die "Unable to open $file";
binmode FILE;
#Seek the the infimum record and get the offset to next record
#Infimum record exist at offset 101 for redundant format
#And offset to the next record is present 2 bytes prior to
#infimum record
my $ps= $ENV{PAGE_SIZE};
my $page;
sysseek(FILE, 3*$ps, 0) || die "Unable to seek $file\n";
die "Unable to read $file" unless sysread(FILE, $page, $ps) == $ps;
#In this case the first record should be at offset 135
die unless unpack("n", substr($page, 99, 2)) == 135;
substr($page,135+6,6) = "\xff" x 6;
my $polynomial = 0x82f63b78; # CRC-32C
my $ck= pack("N",mycrc32(substr($page, 4, 22), 0, $polynomial) ^
mycrc32(substr($page, 38, $ps - 38 - 8), 0, $polynomial));
substr($page,0,4)=$ck;
substr($page,$ps-8,4)=$ck;
sysseek(FILE, 3*$ps, 0) || die "Unable to rewind $file\n";
syswrite(FILE, $page, $ps)==$ps || die "Unable to write $file\n";
close(FILE) || die "Unable to close $file";
EOF
--source include/start_mysqld.inc
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
let SEARCH_PATTERN= \[Warning\] InnoDB: A transaction id in a record of table `test`\.`t1` is newer than the system-wide maximum;
--source include/search_pattern_in_file.inc
call mtr.add_suppression("\\[Warning\\] InnoDB: A transaction id in a record of table `test`\\.`t1` is newer than the system-wide maximum");
SELECT * FROM t1;
DROP TABLE t1;
include/master-slave.inc
[connection master]
connection master;
create table t1 (a int) engine=innodb;
create table t2 (a int);
create table t3 (a int) engine=innodb;
include/save_master_gtid.inc
connection slave;
include/wait_for_slave_sql_error.inc [errno=1286]
Last_Error = 'Error 'Unknown storage engine 'innodb'' on query. Default database: 'test'. Query: 'create table t1 (a int) engine=innodb''
STOP SLAVE IO_THREAD;
include/wait_for_slave_to_stop.inc
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
include/start_slave.inc
include/sync_with_master_gtid.inc
show tables;
Tables_in_test
t2
show create table t2;
Table Create Table
t2 CREATE TABLE `t2` (
`a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
show create table t1;
ERROR 42S02: Table 'test.t1' doesn't exist
show create table t3;
ERROR 42S02: Table 'test.t3' doesn't exist
connection master;
drop table if exists t1;
drop table if exists t2;
drop table if exists t3;
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
CALL mtr.add_suppression('Slave: Unknown storage engine .* Error_code: 1286');
include/rpl_end.inc
--loose-disable-innodb --replicate-ignore-table=test.t3
--source include/master-slave.inc
--source include/have_innodb.inc
--connection master
create table t1 (a int) engine=innodb;
create table t2 (a int);
create table t3 (a int) engine=innodb;
--source include/save_master_gtid.inc
--connection slave
# Using ER_UNKNOWN_STORAGE_ENGINE wont work
let $slave_sql_errno= 1286;
--source include/wait_for_slave_sql_error.inc
--let $status_items= Last_Error
--source include/show_slave_status.inc
STOP SLAVE IO_THREAD;
source include/wait_for_slave_to_stop.inc;
SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
--source include/start_slave.inc
--source include/sync_with_master_gtid.inc
show tables;
show create table t2;
--error ER_NO_SUCH_TABLE
show create table t1;
--error ER_NO_SUCH_TABLE
show create table t3;
--connection master
drop table if exists t1;
drop table if exists t2;
drop table if exists t3;
--source include/save_master_gtid.inc
--connection slave
--source include/sync_with_master_gtid.inc
CALL mtr.add_suppression('Slave: Unknown storage engine .* Error_code: 1286');
--source include/rpl_end.inc
......@@ -298,7 +298,7 @@ class Write_on_release_cache
public:
enum flag
{
FLUSH_F
FLUSH_F= 1
};
typedef unsigned short flag_set;
......
......@@ -567,14 +567,14 @@ inline bool is_system_table_name(const char *name, size_t length)
SYNOPSIS
open_table_def()
thd Thread handler
thd Thread handler
share Fill this with table definition
db_flags Bit mask of the following flags: OPEN_VIEW
flags Bit mask of the following flags: OPEN_VIEW
NOTES
This function is called when the table definition is not cached in
table definition cache
The data is returned in 'share', which is alloced by
The data is returned in 'share', which is allocated by
alloc_table_share().. The code assumes that share is initialized.
*/
......
......@@ -118,7 +118,6 @@ IF(CONNECT_WITH_LIBXML2)
FIND_PACKAGE(LibXml2)
IF (LIBXML2_FOUND)
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
SET(ZLIB_LIBRARY "z") # see ZLIB_INCLUDE_DIR below
SET(XML_LIBRARY ${LIBXML2_LIBRARIES})
SET(CONNECT_SOURCES ${CONNECT_SOURCES} libdoc.cpp libdoc.h)
add_definitions(-DLIBXML2_SUPPORT)
......@@ -337,14 +336,6 @@ IF(NOT TARGET connect)
RETURN()
ENDIF()
# Don't link with bundled zlib and systel libxml2 at the same time.
# System libxml2 uses system zlib, might conflict with the bundled one.
IF (XML_LIBRARY AND BUILD_BUNDLED_ZLIB)
GET_PROPERTY(INCS TARGET connect PROPERTY INCLUDE_DIRECTORIES)
LIST(REMOVE_ITEM INCS ${ZLIB_INCLUDE_DIR})
SET_PROPERTY(TARGET connect PROPERTY INCLUDE_DIRECTORIES ${INCS})
ENDIF()
IF(WIN32)
IF (libmongoc-1.0_FOUND)
SET_TARGET_PROPERTIES(connect PROPERTIES LINK_FLAGS
......
......@@ -1109,26 +1109,26 @@ buf_page_is_corrupted(
the first page of each file of the system tablespace.
Ignore it for the system tablespace. */
if (!checksum_field1 && !checksum_field2) {
ulint i = 0;
do {
if (read_buf[i]) {
return true;
}
} while (++i < FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);
/* Checksum fields can have valid value as zero.
If the page is not empty then do the checksum
calculation for the page. */
bool all_zeroes = true;
for (size_t i = 0; i < srv_page_size; i++) {
#ifndef UNIV_INNOCHECKSUM
if (!space || !space->id) {
/* Skip FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
in the system tablespace. */
i += 8;
}
if (i == FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION
&& (!space || !space->id)) {
i += 8;
}
#endif
do {
if (read_buf[i]) {
return true;
all_zeroes = false;
break;
}
} while (++i < srv_page_size);
return false;
}
if (all_zeroes) {
return false;
}
}
switch (curr_algo) {
......
......@@ -2923,9 +2923,15 @@ fil_rename_tablespace(
space->n_pending_ops--;
ut_ad(space->name == old_space_name);
ut_ad(node->name == old_file_name);
bool success = os_file_rename(
innodb_data_file_key, old_file_name, new_file_name);
bool success;
DBUG_EXECUTE_IF("fil_rename_tablespace_failure_2",
goto skip_second_rename; );
success = os_file_rename(innodb_data_file_key,
old_file_name,
new_file_name);
DBUG_EXECUTE_IF("fil_rename_tablespace_failure_2",
skip_second_rename:
success = false; );
ut_ad(node->name == old_file_name);
......
......@@ -2559,6 +2559,7 @@ row_merge_read_clustered_index(
BTR_SEARCH_LEAF, &pcur,
&mtr);
buf = row_merge_buf_empty(buf);
merge_buf[i] = buf;
/* Restart the outer loop on the
record. We did not insert it
into any index yet. */
......@@ -2684,6 +2685,7 @@ row_merge_read_clustered_index(
}
}
merge_buf[i] = row_merge_buf_empty(buf);
buf = merge_buf[i];
if (UNIV_LIKELY(row != NULL)) {
/* Try writing the record again, now
......
......@@ -355,10 +355,12 @@ static PSI_file_info all_aria_files[]=
{ &key_file_control, "control", PSI_FLAG_GLOBAL}
};
# ifdef HAVE_PSI_STAGE_INTERFACE
static PSI_stage_info *all_aria_stages[]=
{
& stage_waiting_for_a_resource
};
# endif /* HAVE_PSI_STAGE_INTERFACE */
static void init_aria_psi_keys(void)
{
......@@ -379,9 +381,10 @@ static void init_aria_psi_keys(void)
count= array_elements(all_aria_files);
mysql_file_register(category, all_aria_files, count);
# ifdef HAVE_PSI_STAGE_INTERFACE
count= array_elements(all_aria_stages);
mysql_stage_register(category, all_aria_stages, count);
# endif /* HAVE_PSI_STAGE_INTERFACE */
}
#else
#define init_aria_psi_keys() /* no-op */
......
......@@ -66,13 +66,14 @@ id id2 value
2 1 2
truncate table t2;
connection con1;
set debug_sync='rocksdb.update_write_row_after_unique_check SIGNAL parked1 WAIT_FOR go1';
set debug_sync='rocksdb.update_write_row_after_unique_check SIGNAL parked1 WAIT_FOR go';
insert into t1 values (1,1);
connection default;
set debug_sync='now WAIT_FOR parked1';
connection con2;
set debug_sync='rocksdb.update_write_row_after_unique_check SIGNAL parked2 WAIT_FOR go2';
set debug_sync='rocksdb.update_write_row_after_unique_check SIGNAL parked2 WAIT_FOR go';
insert into t2 values (1,1,1);
connection default;
set debug_sync='now WAIT_FOR parked1';
set debug_sync='now WAIT_FOR parked2';
connection con3;
set session rocksdb_lock_wait_timeout=1;
......@@ -81,8 +82,7 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction
insert into t2 values (2,1,2);
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection default;
set debug_sync='now SIGNAL go1';
set debug_sync='now SIGNAL go2';
set debug_sync='now SIGNAL go';
connection con1;
connection con2;
connection default;
......
......@@ -38,7 +38,7 @@ rocksdb_read_free_rpl_stress : Read-Free replication is not supported
blind_delete_rr : Read-Free replication is not supported
blind_delete_rc : Read-Free replication is not supported
shutdown: requires support for SHUTDOWN statement which calls exit().
force_shutdown: requires support for SHUTDOWN statement which calls exit().
##
## Tests that do not fit MariaDB's test environment. Upstream seems to test
......@@ -70,6 +70,8 @@ gap_lock_raise_error: MDEV-11735: MyRocks: Gap Lock detector support
show_engine : MariaRocks: MariaDB doesnt support SHOW ENGINE rocksdb TRANSACTION STATUS
issue243_transactionStatus: MariaDB doesnt support SHOW ENGINE rocksdb TRANSACTION STATUS
rpl_row_not_found : MariaDB doesnt support slave_exec_mode='SEMI_STRICT'
rpl_row_not_found_rc : MariaDB doesnt support slave_exec_mode='SEMI_STRICT'
ddl_high_priority: Needs fractional @@lock_wait_timeout
deadlock_tracking : Needs SHOW ENGINE ROCKSDB TRANSACTION STATUS
bytes_written: Needs I_S.TABLE_STATISTICS.IO_WRITE_BYTES
......
......@@ -20,11 +20,13 @@ DROP TABLE IF EXISTS t1;
--replace_result error: error
--error ER_CANT_CREATE_TABLE
CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb DATA DIRECTORY = '/foo/bar/data';
--replace_result error: error
show warnings;
--replace_result error: error
--error ER_CANT_CREATE_TABLE
CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb INDEX DIRECTORY = '/foo/bar/index';
--replace_result error: error
show warnings;
#
......@@ -41,6 +43,7 @@ CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=rocksdb PARTITION BY RANGE
DATA DIRECTORY = '/foo/bar/data/',
PARTITION P2 VALUES LESS THAN (MAXVALUE)
);
--replace_result error: error
show warnings;
--replace_result error: error
......@@ -53,4 +56,5 @@ CREATE TABLE t1 (id int not null primary key) ENGINE=rocksdb PARTITION BY RANGE
INDEX DIRECTORY = '/foo/bar/data/',
PARTITION P2 VALUES LESS THAN (MAXVALUE)
);
--replace_result error: error
show warnings;
......@@ -102,15 +102,17 @@ truncate table t2;
# 4) simulating T1 GetForUpdate() -> T2 GetForUpdate(). T2 should fail with lock wait timeout.
connection con1;
set debug_sync='rocksdb.update_write_row_after_unique_check SIGNAL parked1 WAIT_FOR go1';
set debug_sync='rocksdb.update_write_row_after_unique_check SIGNAL parked1 WAIT_FOR go';
send insert into t1 values (1,1);
connection default;
set debug_sync='now WAIT_FOR parked1';
connection con2;
set debug_sync='rocksdb.update_write_row_after_unique_check SIGNAL parked2 WAIT_FOR go2';
set debug_sync='rocksdb.update_write_row_after_unique_check SIGNAL parked2 WAIT_FOR go';
send insert into t2 values (1,1,1);
connection default;
set debug_sync='now WAIT_FOR parked1';
set debug_sync='now WAIT_FOR parked2';
connection con3;
......@@ -121,8 +123,7 @@ insert into t1 values (1,2);
insert into t2 values (2,1,2);
connection default;
set debug_sync='now SIGNAL go1';
set debug_sync='now SIGNAL go2';
set debug_sync='now SIGNAL go';
connection con1;
reap;
......
......@@ -11,6 +11,8 @@ rpl_gtid_rocksdb_sys_header : MariaDB doesn't support printing "RocksDB: Last My
singledelete_idempotent_recovery: MariaDB doesn't support --slave-use-idempotent-for-recovery
rpl_mts_dependency_unique_key_conflicts: MariaDB doesn't support --slave-use-idempotent-for-recovery
rpl_missing_columns_sk_update : Uses log_column_names=ON feature which is only present in FB/MySQL
optimize_myrocks_replace_into: requires @@enable_blind_replace support.
rpl_gtid_crash_safe_optimized: requires slave_gtid_info=optimized
##
## Tests that do not fit MariaDB's test environment (Functional tests only,
......
......@@ -50,7 +50,7 @@ if [ $1 = 1 ] ; then
# Change permissions so that the user that will run the MySQL daemon
# owns all database files.
chown -R %{mysqld_user}:%{mysqld_group} $datadir
chown -R -f %{mysqld_user}:%{mysqld_group} $datadir
if [ ! -e $datadir/mysql ]; then
# Create data directory
......
......@@ -124,6 +124,8 @@ string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
ADD_CONVENIENCE_LIBRARY(zlib STATIC
${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
RESTRICT_SYMBOL_EXPORTS(zlib)
if(NOT CYGWIN)
# This property causes shared libraries on Linux to have the full version
......@@ -142,7 +144,4 @@ if(CMAKE_SYSTEM_NAME MATCHES "SunOS")
elseif(UNIX)
# On unix-like platforms the library is almost always called libz
set_target_properties(zlib PROPERTIES OUTPUT_NAME z)
if(NOT APPLE)
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
endif()
endif()
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