1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge 10.4 into 10.5

This commit is contained in:
Marko Mäkelä
2019-10-11 08:41:36 +03:00
161 changed files with 1476 additions and 1018 deletions

View File

@@ -341,11 +341,9 @@ static bool page_is_corrupted(const byte *page, ulint page_no,
memcpy(tmp_page, page, page_size); memcpy(tmp_page, page, page_size);
bool decrypted = false;
if (!space->crypt_data if (!space->crypt_data
|| space->crypt_data->type == CRYPT_SCHEME_UNENCRYPTED || space->crypt_data->type == CRYPT_SCHEME_UNENCRYPTED
|| !fil_space_decrypt(space, tmp_frame, tmp_page, || !fil_space_decrypt(space, tmp_frame, tmp_page)) {
&decrypted)) {
return true; return true;
} }

View File

@@ -1523,7 +1523,8 @@ static int prepare_export()
" --defaults-extra-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=." " --defaults-extra-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=."
" --innodb --innodb-fast-shutdown=0 --loose-partition" " --innodb --innodb-fast-shutdown=0 --loose-partition"
" --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu" " --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu"
" --console --skip-log-error --bootstrap < " BOOTSTRAP_FILENAME IF_WIN("\"",""), " --console --skip-log-error --skip-log-bin --bootstrap < "
BOOTSTRAP_FILENAME IF_WIN("\"",""),
mariabackup_exe, mariabackup_exe,
orig_argv1, (my_defaults_group_suffix?my_defaults_group_suffix:""), orig_argv1, (my_defaults_group_suffix?my_defaults_group_suffix:""),
xtrabackup_use_memory); xtrabackup_use_memory);
@@ -1535,7 +1536,8 @@ static int prepare_export()
" --defaults-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=." " --defaults-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=."
" --innodb --innodb-fast-shutdown=0 --loose-partition" " --innodb --innodb-fast-shutdown=0 --loose-partition"
" --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu" " --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu"
" --console --log-error= --bootstrap < " BOOTSTRAP_FILENAME IF_WIN("\"",""), " --console --log-error= --skip-log-bin --bootstrap < "
BOOTSTRAP_FILENAME IF_WIN("\"",""),
mariabackup_exe, mariabackup_exe,
(my_defaults_group_suffix?my_defaults_group_suffix:""), (my_defaults_group_suffix?my_defaults_group_suffix:""),
xtrabackup_use_memory); xtrabackup_use_memory);

View File

@@ -440,6 +440,20 @@ C_MODE_END
#if HAVE_MADVISE && !HAVE_DECL_MADVISE && defined(__cplusplus) #if HAVE_MADVISE && !HAVE_DECL_MADVISE && defined(__cplusplus)
extern "C" int madvise(void *addr, size_t len, int behav); extern "C" int madvise(void *addr, size_t len, int behav);
#endif #endif
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
/** FreeBSD equivalent */
#if defined(MADV_CORE) && !defined(MADV_DODUMP)
#define MADV_DODUMP MADV_CORE
#define MADV_DONTDUMP MADV_NOCORE
#define DODUMP_STR "MADV_CORE"
#define DONTDUMP_STR "MADV_NOCORE"
#else
#define DODUMP_STR "MADV_DODUMP"
#define DONTDUMP_STR "MADV_DONTDUMP"
#endif
#define QUOTE_ARG(x) #x /* Quote argument (before cpp) */ #define QUOTE_ARG(x) #x /* Quote argument (before cpp) */
#define STRINGIFY_ARG(x) QUOTE_ARG(x) /* Quote argument, after cpp */ #define STRINGIFY_ARG(x) QUOTE_ARG(x) /* Quote argument, after cpp */

View File

@@ -965,8 +965,6 @@ extern ulonglong my_getcputime(void);
#endif #endif
#ifdef HAVE_SYS_MMAN_H #ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#ifndef MAP_NOSYNC #ifndef MAP_NOSYNC
#define MAP_NOSYNC 0 #define MAP_NOSYNC 0
#endif #endif

View File

@@ -5,6 +5,10 @@
--echo # UNINSTALL IF EXISTS PLUGIN|SONAME name --echo # UNINSTALL IF EXISTS PLUGIN|SONAME name
--echo # --echo #
if (!$HA_EXAMPLE_SO) {
skip Needs ha_example plugin;
}
select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%'; select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';
INSTALL PLUGIN IF NOT EXISTS example SONAME 'ha_example'; INSTALL PLUGIN IF NOT EXISTS example SONAME 'ha_example';
select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%'; select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%';

View File

@@ -238,3 +238,23 @@ delete from t1 where a=32767;
--error HA_ERR_AUTOINC_ERANGE --error HA_ERR_AUTOINC_ERANGE
insert into t1 values(NULL); insert into t1 values(NULL);
drop table t1; drop table t1;
--echo #
--echo # MDEV-17333 Assertion in update_auto_increment() upon exotic LOAD
--echo #
--source include/have_partition.inc
let $mysqld_datadir= `select @@datadir`;
--write_file $mysqld_datadir/test/load.data
1 1
0 2
3 3
4 1
0 1
6 6
EOF
create or replace table t1 (pk int auto_increment, x int, primary key(pk), unique key(x))
with system versioning partition by system_time interval 2 day
(partition p1 history, partition pn current);
load data infile 'load.data' ignore into table t1;
--remove_file $mysqld_datadir/test/load.data
drop table t1;

View File

@@ -264,6 +264,17 @@ delete from t1 where a=32767;
insert into t1 values(NULL); insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1 ERROR 22003: Out of range value for column 'a' at row 1
drop table t1; drop table t1;
#
# MDEV-17333 Assertion in update_auto_increment() upon exotic LOAD
#
create or replace table t1 (pk int auto_increment, x int, primary key(pk), unique key(x))
with system versioning partition by system_time interval 2 day
(partition p1 history, partition pn current);
load data infile 'load.data' ignore into table t1;
Warnings:
Warning 1062 Duplicate entry '1' for key 'x'
Warning 1062 Duplicate entry '1' for key 'x'
drop table t1;
create table t1 (pk int auto_increment primary key, f varchar(20)); create table t1 (pk int auto_increment primary key, f varchar(20));
insert t1 (f) values ('a'), ('b'), ('c'), ('d'); insert t1 (f) values ('a'), ('b'), ('c'), ('d');
select null, f into outfile 'load.data' from t1 limit 1; select null, f into outfile 'load.data' from t1 limit 1;

View File

@@ -270,3 +270,14 @@ delete from t1 where a=32767;
insert into t1 values(NULL); insert into t1 values(NULL);
ERROR 22003: Out of range value for column 'a' at row 1 ERROR 22003: Out of range value for column 'a' at row 1
drop table t1; drop table t1;
#
# MDEV-17333 Assertion in update_auto_increment() upon exotic LOAD
#
create or replace table t1 (pk int auto_increment, x int, primary key(pk), unique key(x))
with system versioning partition by system_time interval 2 day
(partition p1 history, partition pn current);
load data infile 'load.data' ignore into table t1;
Warnings:
Warning 1062 Duplicate entry '1' for key 'x'
Warning 1062 Duplicate entry '1' for key 'x'
drop table t1;

View File

@@ -470,17 +470,17 @@ EXPLAIN
SELECT * FROM City SELECT * FROM City
WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%'; WHERE ID BETWEEN 501 AND 1000 AND Population > 700000 AND Country LIKE 'C%';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Country,Population 4,7,4 NULL # Using sort_intersect(PRIMARY,Country,Population); Using where 1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where
EXPLAIN EXPLAIN
SELECT * FROM City SELECT * FROM City
WHERE ID BETWEEN 1 AND 500 AND Population > 700000 AND Country LIKE 'C%'; WHERE ID BETWEEN 1 AND 500 AND Population > 700000 AND Country LIKE 'C%';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Country,Population 4,7,4 NULL # Using sort_intersect(PRIMARY,Country,Population); Using where 1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where
EXPLAIN EXPLAIN
SELECT * FROM City SELECT * FROM City
WHERE ID BETWEEN 2001 AND 2500 AND Population > 300000 AND Country LIKE 'H%'; WHERE ID BETWEEN 2001 AND 2500 AND Population > 300000 AND Country LIKE 'H%';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Country 4,7 NULL # Using sort_intersect(PRIMARY,Country); Using where 1 SIMPLE City range PRIMARY,Population,Country Country 7 NULL # Using index condition; Using where
EXPLAIN EXPLAIN
SELECT * FROM City SELECT * FROM City
WHERE ID BETWEEN 3701 AND 4000 AND Population > 1000000 WHERE ID BETWEEN 3701 AND 4000 AND Population > 1000000
@@ -724,7 +724,7 @@ EXPLAIN
SELECT * FROM City SELECT * FROM City
WHERE ID BETWEEN 1 AND 500 AND Population > 700000 AND Country LIKE 'C%'; WHERE ID BETWEEN 1 AND 500 AND Population > 700000 AND Country LIKE 'C%';
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Country,Population 4,7,4 NULL # Using sort_intersect(PRIMARY,Country,Population); Using where 1 SIMPLE City index_merge PRIMARY,Population,Country PRIMARY,Population,Country 4,4,7 NULL # Using sort_intersect(PRIMARY,Population,Country); Using where
EXPLAIN EXPLAIN
SELECT * FROM City SELECT * FROM City
WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000 WHERE ID BETWEEN 3001 AND 4000 AND Population > 600000

Binary file not shown.

View File

@@ -0,0 +1,27 @@
include/master-slave.inc
[connection master]
connection slave;
include/stop_slave.inc
connection master;
include/rpl_stop_server.inc [server_number=1]
# Data in binlog
# CREATE TABLE t1 (a INT);
# INSERT INTO t1 VALUES (1),(2),(3);
# REPLACE INTO t1 VALUES (4);
include/rpl_start_server.inc [server_number=1]
connection slave;
RESET SLAVE;
RESET MASTER;
CHANGE MASTER TO master_host='127.0.0.1', master_port=SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
include/start_slave.inc
DESC t1;
Field Type Null Key Default Extra
a int(11) YES NULL
SELECT * FROM t1 ORDER BY a;
a
1
2
3
4
DROP TABLE t1;
include/rpl_end.inc

View File

@@ -0,0 +1,46 @@
# MDEV-20574 Position of events reported by mysqlbinlog is wrong with encrypted binlogs, SHOW BINLOG EVENTS reports the correct one.
# Test replicating off old master.
# Test case Desc:- When new server reads the data from old server binlog which
# does not send START_ENCRYPTION_EVENT to slave.
# We simulate old master by copying in pre-generated binlog files from earlier
# server versions with encrypted binlog.
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
--source include/have_innodb.inc
--connection slave
--source include/stop_slave.inc
--connection master
--let $datadir= `SELECT @@datadir`
--let $rpl_server_number= 1
--source include/rpl_stop_server.inc
--remove_file $datadir/master-bin.000001
--remove_file $datadir/master-bin.state
--echo # Data in binlog
--echo # CREATE TABLE t1 (a INT);
--echo # INSERT INTO t1 VALUES (1),(2),(3);
--echo # REPLACE INTO t1 VALUES (4);
--copy_file $MYSQL_TEST_DIR/std_data/binlog_before_20574.bin $datadir/master-bin.000001
--let $rpl_server_number= 1
--source include/rpl_start_server.inc
--source include/wait_until_connected_again.inc
--save_master_pos
--connection slave
RESET SLAVE;
RESET MASTER;
--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1
eval CHANGE MASTER TO master_host='127.0.0.1', master_port=$SERVER_MYPORT_1, master_user='root', master_log_file='master-bin.000001', master_log_pos=4;
--source include/start_slave.inc
--sync_with_master
DESC t1;
SELECT * FROM t1 ORDER BY a;
DROP TABLE t1;
--source include/rpl_end.inc

View File

@@ -104,6 +104,9 @@ DELIMITER /*!*/;
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup #010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/; ROLLBACK/*!*/;
# at # # at #
#010909 4:46:40 server id # end_log_pos # Ignorable
# Ignorable event type 164 (Start_encryption)
# at #
#010909 4:46:40 server id # end_log_pos # Gtid list [] #010909 4:46:40 server id # end_log_pos # Gtid list []
# at # # at #
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001 #010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
@@ -342,6 +345,9 @@ DELIMITER /*!*/;
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup #010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/; ROLLBACK/*!*/;
# at # # at #
#010909 4:46:40 server id # end_log_pos # Ignorable
# Ignorable event type 164 (Start_encryption)
# at #
#010909 4:46:40 server id # end_log_pos # Gtid list [] #010909 4:46:40 server id # end_log_pos # Gtid list []
# at # # at #
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001 #010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001
@@ -502,6 +508,9 @@ DELIMITER /*!*/;
#010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup #010909 4:46:40 server id # end_log_pos # Start: binlog v 4, server v #.##.## created 010909 4:46:40 at startup
ROLLBACK/*!*/; ROLLBACK/*!*/;
# at # # at #
#010909 4:46:40 server id # end_log_pos # Ignorable
# Ignorable event type 164 (Start_encryption)
# at #
#010909 4:46:40 server id # end_log_pos # Gtid list [] #010909 4:46:40 server id # end_log_pos # Gtid list []
# at # # at #
#010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001 #010909 4:46:40 server id # end_log_pos # Binlog checkpoint master-bin.000001

View File

@@ -4,3 +4,4 @@ INSERT INTO t1 VALUES (1),(2),(3);
REPLACE INTO t1 VALUES (4); REPLACE INTO t1 VALUES (4);
DROP TABLE t1; DROP TABLE t1;
FLUSH LOGS; FLUSH LOGS;
FOUND 1 /Ignorable event type 164.*/ in binlog_enc.sql

View File

@@ -17,5 +17,8 @@ let outfile=$MYSQLTEST_VARDIR/tmp/binlog_enc.sql;
exec $MYSQL_BINLOG $local > $outfile; exec $MYSQL_BINLOG $local > $outfile;
exec $MYSQL_BINLOG $local --force-read >> $outfile; exec $MYSQL_BINLOG $local --force-read >> $outfile;
exec $MYSQL_BINLOG $remote >> $outfile; exec $MYSQL_BINLOG $remote >> $outfile;
--let SEARCH_FILE= $outfile
--let SEARCH_PATTERN= Ignorable event type 164.*
--source include/search_pattern_in_file.inc
remove_file $outfile; remove_file $outfile;

View File

@@ -6,6 +6,7 @@ call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; key_version=1"); call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; key_version=1");
call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` is corrupted"); call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` is corrupted");
call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found"); call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space=");
# Start server with keys2.txt # Start server with keys2.txt
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt # restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_file_per_table = ON;

View File

@@ -6,6 +6,7 @@ call mtr.add_suppression("InnoDB: Tablespace for table \`test\`.\`t1\` is set as
call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted"); call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted");
call mtr.add_suppression("InnoDB: Cannot delete tablespace .* because it is not found in the tablespace memory cache"); call mtr.add_suppression("InnoDB: Cannot delete tablespace .* because it is not found in the tablespace memory cache");
call mtr.add_suppression("InnoDB: ALTER TABLE `test`\\.`t1` DISCARD TABLESPACE failed to find tablespace"); call mtr.add_suppression("InnoDB: ALTER TABLE `test`\\.`t1` DISCARD TABLESPACE failed to find tablespace");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space=");
# restart: --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt # restart: --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_file_per_table = ON;
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB

View File

@@ -3,6 +3,7 @@ call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page n
call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]");
call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted"); call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space=");
# restart: --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt # restart: --plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_file_per_table = ON;
CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB CREATE TABLE t1 (pk INT PRIMARY KEY, f VARCHAR(8)) ENGINE=InnoDB

View File

@@ -7,6 +7,7 @@ call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed f
call mtr.add_suppression("InnoDB: Failed to read file '.*' at offset .*"); call mtr.add_suppression("InnoDB: Failed to read file '.*' at offset .*");
call mtr.add_suppression("InnoDB: Plugin initialization aborted"); call mtr.add_suppression("InnoDB: Plugin initialization aborted");
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed"); call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space=");
# restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt # restart: --file-key-management-filename=MYSQL_TEST_DIR/std_data/keys2.txt
# Wait max 10 min for key encryption threads to encrypt all spaces # Wait max 10 min for key encryption threads to encrypt all spaces
SET GLOBAL innodb_file_per_table = ON; SET GLOBAL innodb_file_per_table = ON;

View File

@@ -0,0 +1,5 @@
[strict_crc32]
--innodb-checksum-algorithm=strict_crc32
[strict_full_crc32]
--innodb-checksum-algorithm=strict_full_crc32

View File

@@ -16,6 +16,8 @@ call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]
call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; key_version=1"); call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; key_version=1");
call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` is corrupted"); call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` is corrupted");
call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found"); call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found");
# for innodb_checksum_algorithm=full_crc32 only
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space=");
--echo # Start server with keys2.txt --echo # Start server with keys2.txt
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt

View File

@@ -0,0 +1,5 @@
[strict_crc32]
--innodb-checksum-algorithm=strict_crc32
[strict_full_crc32]
--innodb-checksum-algorithm=strict_full_crc32

View File

@@ -17,6 +17,8 @@ call mtr.add_suppression("InnoDB: Tablespace for table \`test\`.\`t1\` is set as
call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted"); call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted");
call mtr.add_suppression("InnoDB: Cannot delete tablespace .* because it is not found in the tablespace memory cache"); call mtr.add_suppression("InnoDB: Cannot delete tablespace .* because it is not found in the tablespace memory cache");
call mtr.add_suppression("InnoDB: ALTER TABLE `test`\\.`t1` DISCARD TABLESPACE failed to find tablespace"); call mtr.add_suppression("InnoDB: ALTER TABLE `test`\\.`t1` DISCARD TABLESPACE failed to find tablespace");
# for innodb_checksum_algorithm=full_crc32 only
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space=");
--let $restart_parameters=--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt --let $restart_parameters=--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
--source include/restart_mysqld.inc --source include/restart_mysqld.inc

View File

@@ -0,0 +1,5 @@
[strict_crc32]
--innodb-checksum-algorithm=strict_crc32
[strict_full_crc32]
--innodb-checksum-algorithm=strict_full_crc32

View File

@@ -0,0 +1,5 @@
[strict_crc32]
--innodb-checksum-algorithm=strict_crc32
[strict_full_crc32]
--innodb-checksum-algorithm=strict_full_crc32

View File

@@ -13,6 +13,8 @@ call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]
# Suppression for builds where file_key_management plugin is linked statically # Suppression for builds where file_key_management plugin is linked statically
call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); call mtr.add_suppression("Couldn't load plugins from 'file_key_management");
call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted"); call mtr.add_suppression("InnoDB: Table `test`\\.`t1` is corrupted");
# for innodb_checksum_algorithm=full_crc32 only
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space=");
--let $restart_parameters=--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt --let $restart_parameters=--plugin-load-add=file_key_management.so --file-key-management --file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
--source include/restart_mysqld.inc --source include/restart_mysqld.inc

View File

@@ -0,0 +1,5 @@
[strict_crc32]
--innodb-checksum-algorithm=strict_crc32
[strict_full_crc32]
--innodb-checksum-algorithm=strict_full_crc32

View File

@@ -12,6 +12,8 @@ call mtr.add_suppression("InnoDB: Database page corruption on disk or a failed f
call mtr.add_suppression("InnoDB: Failed to read file '.*' at offset .*"); call mtr.add_suppression("InnoDB: Failed to read file '.*' at offset .*");
call mtr.add_suppression("InnoDB: Plugin initialization aborted"); call mtr.add_suppression("InnoDB: Plugin initialization aborted");
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed"); call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed");
# for innodb_checksum_algorithm=full_crc32 only
call mtr.add_suppression("\\[ERROR\\] InnoDB: Cannot decrypt \\[page id: space=");
-- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt
-- source include/restart_mysqld.inc -- source include/restart_mysqld.inc

View File

@@ -4,14 +4,14 @@ row_start SYS_TYPE as row start invisible,
row_end SYS_TYPE as row end invisible, row_end SYS_TYPE as row end invisible,
period for system_time (row_start, row_end)) period for system_time (row_start, row_end))
with system versioning; with system versioning;
create or replace table tf engine=FEDERATED connection='mysql://root@127.0.0.1:MASTER_MYPORT/test2/t1'; create or replace table tf engine=FEDERATED connection='mysql://root@127.0.0.1:MASTER_MYPORT/test/t1';
show create table tf; show create table tf;
Table Create Table Table Create Table
tf CREATE TABLE `tf` ( tf CREATE TABLE `tf` (
`x` int(11) DEFAULT NULL, `x` int(11) DEFAULT NULL,
`row_start` SYS_TYPE NOT NULL INVISIBLE DEFAULT 0, `row_start` SYS_TYPE NOT NULL INVISIBLE DEFAULT 0,
`row_end` SYS_TYPE NOT NULL INVISIBLE DEFAULT 0 `row_end` SYS_TYPE NOT NULL INVISIBLE DEFAULT 0
) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:MASTER_MYPORT/test2/t1' ) ENGINE=FEDERATED DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:MASTER_MYPORT/test/t1'
# INSERT # INSERT
insert into t1 values (1); insert into t1 values (1);
select * from tf; select * from tf;
@@ -61,7 +61,7 @@ row_start SYS_TYPE as row start invisible,
row_end SYS_TYPE as row end invisible, row_end SYS_TYPE as row end invisible,
period for system_time (row_start, row_end)) period for system_time (row_start, row_end))
with system versioning; with system versioning;
create or replace table t2f engine=FEDERATED connection='mysql://root@127.0.0.1:MASTER_MYPORT/test2/t2'; create or replace table t2f engine=FEDERATED connection='mysql://root@127.0.0.1:MASTER_MYPORT/test/t2';
insert t2f (id, y) values (1, 2); insert t2f (id, y) values (1, 2);
replace t2f (id, y) values (1, 3); replace t2f (id, y) values (1, 3);
select *, check_row(row_start, row_end) from t2 for system_time all select *, check_row(row_start, row_end) from t2 for system_time all
@@ -102,3 +102,5 @@ order by y;
id y check_row(row_start, row_end) id y check_row(row_start, row_end)
2 2 HISTORICAL ROW 2 2 HISTORICAL ROW
2 22 CURRENT ROW 2 22 CURRENT ROW
drop view vt1;
drop tables t1, t2, t2f, tf;

View File

@@ -11,7 +11,7 @@ eval create or replace table t1 (
period for system_time (row_start, row_end)) period for system_time (row_start, row_end))
with system versioning; with system versioning;
--replace_result $MASTER_MYPORT MASTER_MYPORT --replace_result $MASTER_MYPORT MASTER_MYPORT
eval create or replace table tf engine=FEDERATED connection='mysql://root@127.0.0.1:$MASTER_MYPORT/test2/t1'; eval create or replace table tf engine=FEDERATED connection='mysql://root@127.0.0.1:$MASTER_MYPORT/test/t1';
--replace_result $MASTER_MYPORT MASTER_MYPORT $sys_datatype_expl SYS_TYPE "'0000-00-00 00:00:00.000000'" 0 --replace_result $MASTER_MYPORT MASTER_MYPORT $sys_datatype_expl SYS_TYPE "'0000-00-00 00:00:00.000000'" 0
show create table tf; show create table tf;
--echo # INSERT --echo # INSERT
@@ -50,7 +50,7 @@ eval create or replace table t2 (
period for system_time (row_start, row_end)) period for system_time (row_start, row_end))
with system versioning; with system versioning;
--replace_result $MASTER_MYPORT MASTER_MYPORT --replace_result $MASTER_MYPORT MASTER_MYPORT
eval create or replace table t2f engine=FEDERATED connection='mysql://root@127.0.0.1:$MASTER_MYPORT/test2/t2'; eval create or replace table t2f engine=FEDERATED connection='mysql://root@127.0.0.1:$MASTER_MYPORT/test/t2';
insert t2f (id, y) values (1, 2); insert t2f (id, y) values (1, 2);
replace t2f (id, y) values (1, 3); replace t2f (id, y) values (1, 3);
select *, check_row(row_start, row_end) from t2 for system_time all select *, check_row(row_start, row_end) from t2 for system_time all
@@ -79,4 +79,7 @@ order by x;
select *, check_row(row_start, row_end) from t2 for system_time all select *, check_row(row_start, row_end) from t2 for system_time all
order by y; order by y;
drop view vt1;
drop tables t1, t2, t2f, tf;
--source suite/versioning/common_finish.inc --source suite/versioning/common_finish.inc

View File

@@ -3,11 +3,11 @@ connection node_1;
CREATE TABLE t1 (id INT) ENGINE=InnoDB; CREATE TABLE t1 (id INT) ENGINE=InnoDB;
CREATE TABLE t2 (id INT) ENGINE=InnoDB; CREATE TABLE t2 (id INT) ENGINE=InnoDB;
connection node_2; connection node_2;
SET GLOBAL wsrep_slave_threads = 2;
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%'; SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
NAME NAME
test/t1 test/t1
test/t2 test/t2
SET GLOBAL wsrep_slave_threads = 2;
LOCK TABLE t1 WRITE; LOCK TABLE t1 WRITE;
connection node_1; connection node_1;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
@@ -20,18 +20,20 @@ INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1); INSERT INTO t2 VALUES (1);
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1); INSERT INTO t2 VALUES (1);
INSERT INTO t1 VALUES (1); INSERT INTO t1 select * from t1;
INSERT INTO t2 VALUES (1); INSERT INTO t2 select * from t2;
INSERT INTO t1 select * from t1;
INSERT INTO t2 select * from t2;
connection node_2; connection node_2;
SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_sync_wait = 0;
UNLOCK TABLES; UNLOCK TABLES;
SET SESSION wsrep_sync_wait = 15; SET SESSION wsrep_sync_wait = 15;
SELECT COUNT(*) = 10 FROM t1; SELECT COUNT(*) as expect_20 FROM t1;
COUNT(*) = 10 expect_20
0 20
SELECT COUNT(*) = 10 FROM t2; SELECT COUNT(*) as expect_20 FROM t2;
COUNT(*) = 10 expect_20
0 20
SET GLOBAL wsrep_slave_threads = 1;; SET GLOBAL wsrep_slave_threads = 1;;
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;

View File

@@ -7,60 +7,27 @@ SET GLOBAL wsrep_on = OFF;
CREATE TABLE t1 (f1 INTEGER); CREATE TABLE t1 (f1 INTEGER);
SET GLOBAL wsrep_on = ON; SET GLOBAL wsrep_on = ON;
DROP TABLE t1; DROP TABLE t1;
connection node_2;
SHOW TABLES;
Tables_in_test
connection node_1;
SET GLOBAL wsrep_on = OFF; SET GLOBAL wsrep_on = OFF;
CREATE SCHEMA s1; CREATE SCHEMA s1;
SET GLOBAL wsrep_on = ON; SET GLOBAL wsrep_on = ON;
DROP SCHEMA s1; DROP SCHEMA s1;
connection node_2;
SHOW SCHEMAS;
Database
information_schema
mtr
mysql
performance_schema
test
connection node_1;
CREATE TABLE t1 (f1 INTEGER); CREATE TABLE t1 (f1 INTEGER);
SET GLOBAL wsrep_on = OFF; SET GLOBAL wsrep_on = OFF;
CREATE INDEX idx1 ON t1 (f1); CREATE INDEX idx1 ON t1 (f1);
SET GLOBAL wsrep_on = ON; SET GLOBAL wsrep_on = ON;
DROP INDEX idx1 ON t1; DROP INDEX idx1 ON t1;
connection node_2;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1; DROP TABLE t1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER); CREATE TABLE t1 (f1 INTEGER);
SET GLOBAL wsrep_on = OFF; SET GLOBAL wsrep_on = OFF;
CREATE INDEX idx1 ON t1 (f1); CREATE INDEX idx1 ON t1 (f1);
SET GLOBAL wsrep_on = ON; SET GLOBAL wsrep_on = ON;
ALTER TABLE t1 DROP INDEX idx1; ALTER TABLE t1 DROP INDEX idx1;
connection node_2;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1; DROP TABLE t1;
connection node_1;
CREATE TABLE t1 (f1 INTEGER); CREATE TABLE t1 (f1 INTEGER);
SET GLOBAL wsrep_on = OFF; SET GLOBAL wsrep_on = OFF;
ALTER TABLE t1 ADD COLUMN f2 INTEGER; ALTER TABLE t1 ADD COLUMN f2 INTEGER;
SET GLOBAL wsrep_on = ON; SET GLOBAL wsrep_on = ON;
ALTER TABLE t1 DROP COLUMN f2; ALTER TABLE t1 DROP COLUMN f2;
connection node_2;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1; DROP TABLE t1;
connection node_2; connection node_2;
SET GLOBAL wsrep_ignore_apply_errors = 2; SET GLOBAL wsrep_ignore_apply_errors = 2;
@@ -70,11 +37,12 @@ SET GLOBAL wsrep_on = OFF;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
SET GLOBAL wsrep_on = ON; SET GLOBAL wsrep_on = ON;
DELETE FROM t1 WHERE f1 = 1; DELETE FROM t1 WHERE f1 = 1;
SELECT COUNT(*) AS expect_0 FROM t1; connection node_1;
SELECT COUNT(*) as expect_0 FROM t1;
expect_0 expect_0
0 0
connection node_2; connection node_2;
SELECT COUNT(*) AS expect_0 FROM t1; SELECT COUNT(*) as expect_0 FROM t1;
expect_0 expect_0
0 0
DROP TABLE t1; DROP TABLE t1;
@@ -89,11 +57,12 @@ INSERT INTO t1 VALUES (3);
DELETE FROM t1 WHERE f1 = 1; DELETE FROM t1 WHERE f1 = 1;
DELETE FROM t1 WHERE f1 = 2; DELETE FROM t1 WHERE f1 = 2;
COMMIT; COMMIT;
SELECT COUNT(*) AS expect_1 FROM t1; connection node_1;
SELECT COUNT(*) as expect_1 FROM t1;
expect_1 expect_1
1 1
connection node_2; connection node_2;
SELECT COUNT(*) AS expect_1 FROM t1; SELECT COUNT(*) as expect_1 FROM t1;
expect_1 expect_1
1 1
DROP TABLE t1; DROP TABLE t1;
@@ -106,14 +75,14 @@ DELETE FROM t1 WHERE f1 = 3;
SET SESSION wsrep_on = ON; SET SESSION wsrep_on = ON;
connection node_1; connection node_1;
DELETE FROM t1; DELETE FROM t1;
SELECT COUNT(*) AS expect_0 FROM t1; SELECT COUNT(*) as expect_0 FROM t1;
expect_0 expect_0
0 0
connection node_2; connection node_2;
SELECT VARIABLE_VALUE expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
expect_Primary VARIABLE_VALUE = 'Primary'
Primary 1
SELECT COUNT(*) AS expect_0 FROM t1; SELECT COUNT(*) as expect_0 FROM t1;
expect_0 expect_0
0 0
DROP TABLE t1; DROP TABLE t1;
@@ -134,14 +103,14 @@ DELETE FROM t1 WHERE f1 = 4;
DELETE FROM t1 WHERE f1 = 5; DELETE FROM t1 WHERE f1 = 5;
COMMIT; COMMIT;
SET AUTOCOMMIT=ON; SET AUTOCOMMIT=ON;
SELECT COUNT(*) AS expect_0 FROM t1; SELECT COUNT(*) as expect_0 FROM t1;
expect_0 expect_0
0 0
connection node_2; connection node_2;
SELECT VARIABLE_VALUE expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
expect_Primary VARIABLE_VALUE = 'Primary'
Primary 1
SELECT COUNT(*) AS expect_0 FROM t1; SELECT COUNT(*) as expect_0 FROM t1;
expect_0 expect_0
0 0
DROP TABLE t1; DROP TABLE t1;
@@ -157,14 +126,14 @@ DELETE FROM t1 WHERE f1 = 3;
SET SESSION wsrep_on = ON; SET SESSION wsrep_on = ON;
connection node_1; connection node_1;
DELETE t1, t2 FROM t1 JOIN t2 WHERE t1.f1 = t2.f1; DELETE t1, t2 FROM t1 JOIN t2 WHERE t1.f1 = t2.f1;
SELECT COUNT(*) expect_0 FROM t1; SELECT COUNT(*) as expect_0 FROM t1;
expect_0 expect_0
0 0
connection node_2; connection node_2;
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
VARIABLE_VALUE = 'Primary' VARIABLE_VALUE = 'Primary'
1 1
SELECT COUNT(*) expect_0 FROM t1; SELECT COUNT(*) as expect_0 FROM t1;
expect_0 expect_0
0 0
DROP TABLE t1,t2; DROP TABLE t1,t2;
@@ -179,20 +148,20 @@ DELETE FROM child WHERE parent_id = 2;
SET SESSION wsrep_on = ON; SET SESSION wsrep_on = ON;
connection node_1; connection node_1;
DELETE FROM parent; DELETE FROM parent;
SELECT COUNT(*) AS expect_0 FROM parent; SELECT COUNT(*) as expect_0 FROM parent;
expect_0 expect_0
0 0
SELECT COUNT(*) AS expect_0 FROM child; SELECT COUNT(*) as expect_0 FROM child;
expect_0 expect_0
0 0
connection node_2; connection node_2;
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
VARIABLE_VALUE = 'Primary' VARIABLE_VALUE = 'Primary'
1 1
SELECT COUNT(*) AS expect_0 FROM parent; SELECT COUNT(*) as expect_0 FROM parent;
expect_0 expect_0
0 0
SELECT COUNT(*) AS expect_0 FROM child; SELECT COUNT(*) as expect_0 FROM child;
expect_0 expect_0
0 0
DROP TABLE child, parent; DROP TABLE child, parent;
@@ -206,8 +175,6 @@ connection node_1;
CREATE TABLE t1 (f1 INTEGER, f2 INTEGER); CREATE TABLE t1 (f1 INTEGER, f2 INTEGER);
DROP TABLE t1; DROP TABLE t1;
connection node_2; connection node_2;
SELECT * FROM t1;
ERROR 42S02: Table 'test.t1' doesn't exist
SET GLOBAL wsrep_ignore_apply_errors = 7; SET GLOBAL wsrep_ignore_apply_errors = 7;
CALL mtr.add_suppression("Can't find record in 't.*'"); CALL mtr.add_suppression("Can't find record in 't.*'");
CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows event"); CALL mtr.add_suppression("Slave SQL: Could not execute Delete_rows event");

View File

@@ -12,7 +12,6 @@ CREATE TABLE t1 (id INT) ENGINE=InnoDB;
CREATE TABLE t2 (id INT) ENGINE=InnoDB; CREATE TABLE t2 (id INT) ENGINE=InnoDB;
--connection node_2 --connection node_2
SET GLOBAL wsrep_slave_threads = 2;
# Wait until above DDL's are replicated # Wait until above DDL's are replicated
--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%'; --let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
@@ -20,6 +19,8 @@ SET GLOBAL wsrep_slave_threads = 2;
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%'; SELECT NAME FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE 'test/t%';
SET GLOBAL wsrep_slave_threads = 2;
LOCK TABLE t1 WRITE; LOCK TABLE t1 WRITE;
--connection node_1 --connection node_1
@@ -38,8 +39,11 @@ INSERT INTO t2 VALUES (1);
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
INSERT INTO t2 VALUES (1); INSERT INTO t2 VALUES (1);
INSERT INTO t1 VALUES (1); INSERT INTO t1 select * from t1;
INSERT INTO t2 VALUES (1); INSERT INTO t2 select * from t2;
INSERT INTO t1 select * from t1;
INSERT INTO t2 select * from t2;
--connection node_2 --connection node_2
SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_sync_wait = 0;
@@ -54,8 +58,8 @@ UNLOCK TABLES;
SET SESSION wsrep_sync_wait = 15; SET SESSION wsrep_sync_wait = 15;
SELECT COUNT(*) = 10 FROM t1; SELECT COUNT(*) as expect_20 FROM t1;
SELECT COUNT(*) = 10 FROM t2; SELECT COUNT(*) as expect_20 FROM t2;
--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; --eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig;

View File

@@ -5,6 +5,7 @@
--source include/galera_cluster.inc --source include/galera_cluster.inc
--source include/have_innodb.inc --source include/have_innodb.inc
# #
# Ignore reconciling DDL errors on node_2 # Ignore reconciling DDL errors on node_2
# #
@@ -17,55 +18,41 @@ SET GLOBAL wsrep_ignore_apply_errors = 1;
SET GLOBAL wsrep_on = OFF; SET GLOBAL wsrep_on = OFF;
CREATE TABLE t1 (f1 INTEGER); CREATE TABLE t1 (f1 INTEGER);
SET GLOBAL wsrep_on = ON; SET GLOBAL wsrep_on = ON;
--source include/galera_wait_ready.inc
DROP TABLE t1; DROP TABLE t1;
--connection node_2
SHOW TABLES;
# Drop schema that does not exist # Drop schema that does not exist
--connection node_1
SET GLOBAL wsrep_on = OFF; SET GLOBAL wsrep_on = OFF;
CREATE SCHEMA s1; CREATE SCHEMA s1;
SET GLOBAL wsrep_on = ON; SET GLOBAL wsrep_on = ON;
--source include/galera_wait_ready.inc
DROP SCHEMA s1; DROP SCHEMA s1;
--connection node_2
SHOW SCHEMAS;
# Drop index that does not exist using DROP INDEX # Drop index that does not exist using DROP INDEX
--connection node_1
CREATE TABLE t1 (f1 INTEGER); CREATE TABLE t1 (f1 INTEGER);
SET GLOBAL wsrep_on = OFF; SET GLOBAL wsrep_on = OFF;
CREATE INDEX idx1 ON t1 (f1); CREATE INDEX idx1 ON t1 (f1);
SET GLOBAL wsrep_on = ON; SET GLOBAL wsrep_on = ON;
--source include/galera_wait_ready.inc
DROP INDEX idx1 ON t1; DROP INDEX idx1 ON t1;
--connection node_2
SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
# Drop index that does not exist using ALTER TABLE # Drop index that does not exist using ALTER TABLE
--connection node_1
CREATE TABLE t1 (f1 INTEGER); CREATE TABLE t1 (f1 INTEGER);
SET GLOBAL wsrep_on = OFF; SET GLOBAL wsrep_on = OFF;
CREATE INDEX idx1 ON t1 (f1); CREATE INDEX idx1 ON t1 (f1);
SET GLOBAL wsrep_on = ON; SET GLOBAL wsrep_on = ON;
--source include/galera_wait_ready.inc
ALTER TABLE t1 DROP INDEX idx1; ALTER TABLE t1 DROP INDEX idx1;
--connection node_2
SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
# Drop column that does not exist # Drop column that does not exist
--connection node_1
CREATE TABLE t1 (f1 INTEGER); CREATE TABLE t1 (f1 INTEGER);
SET GLOBAL wsrep_on = OFF; SET GLOBAL wsrep_on = OFF;
ALTER TABLE t1 ADD COLUMN f2 INTEGER; ALTER TABLE t1 ADD COLUMN f2 INTEGER;
SET GLOBAL wsrep_on = ON; SET GLOBAL wsrep_on = ON;
--source include/galera_wait_ready.inc
ALTER TABLE t1 DROP COLUMN f2; ALTER TABLE t1 DROP COLUMN f2;
--connection node_2
SHOW CREATE TABLE t1;
DROP TABLE t1; DROP TABLE t1;
@@ -82,11 +69,14 @@ CREATE TABLE t1 (f1 INTEGER);
SET GLOBAL wsrep_on = OFF; SET GLOBAL wsrep_on = OFF;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
SET GLOBAL wsrep_on = ON; SET GLOBAL wsrep_on = ON;
--source include/galera_wait_ready.inc
DELETE FROM t1 WHERE f1 = 1; DELETE FROM t1 WHERE f1 = 1;
SELECT COUNT(*) AS expect_0 FROM t1;
--connection node_1
SELECT COUNT(*) as expect_0 FROM t1;
--connection node_2 --connection node_2
SELECT COUNT(*) AS expect_0 FROM t1; SELECT COUNT(*) as expect_0 FROM t1;
DROP TABLE t1; DROP TABLE t1;
# Delete row that does not exist in a multi statement transaction # Delete row that does not exist in a multi statement transaction
@@ -96,15 +86,18 @@ INSERT INTO t1 VALUES (2);
SET GLOBAL wsrep_on = OFF; SET GLOBAL wsrep_on = OFF;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
SET GLOBAL wsrep_on = ON; SET GLOBAL wsrep_on = ON;
--source include/galera_wait_ready.inc
START TRANSACTION; START TRANSACTION;
INSERT INTO t1 VALUES (3); INSERT INTO t1 VALUES (3);
DELETE FROM t1 WHERE f1 = 1; DELETE FROM t1 WHERE f1 = 1;
DELETE FROM t1 WHERE f1 = 2; DELETE FROM t1 WHERE f1 = 2;
COMMIT; COMMIT;
SELECT COUNT(*) AS expect_1 FROM t1;
--connection node_1
SELECT COUNT(*) as expect_1 FROM t1;
--connection node_2 --connection node_2
SELECT COUNT(*) AS expect_1 FROM t1; SELECT COUNT(*) as expect_1 FROM t1;
DROP TABLE t1; DROP TABLE t1;
# #
@@ -121,16 +114,14 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
SET SESSION wsrep_on = OFF; SET SESSION wsrep_on = OFF;
DELETE FROM t1 WHERE f1 = 3; DELETE FROM t1 WHERE f1 = 3;
SET SESSION wsrep_on = ON; SET SESSION wsrep_on = ON;
--source include/galera_wait_ready.inc
--connection node_1 --connection node_1
DELETE FROM t1; DELETE FROM t1;
SELECT COUNT(*) AS expect_0 FROM t1;
SELECT COUNT(*) as expect_0 FROM t1;
--connection node_2 --connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM t1; SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc SELECT COUNT(*) as expect_0 FROM t1;
SELECT VARIABLE_VALUE expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
SELECT COUNT(*) AS expect_0 FROM t1;
DROP TABLE t1; DROP TABLE t1;
# #
@@ -147,8 +138,10 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
SET SESSION wsrep_on = OFF; SET SESSION wsrep_on = OFF;
DELETE FROM t1 WHERE f1 = 3; DELETE FROM t1 WHERE f1 = 3;
SET SESSION wsrep_on = ON; SET SESSION wsrep_on = ON;
--source include/galera_wait_ready.inc
--connection node_1 --connection node_1
SET AUTOCOMMIT=OFF; SET AUTOCOMMIT=OFF;
START TRANSACTION; START TRANSACTION;
DELETE FROM t1 WHERE f1 = 1; DELETE FROM t1 WHERE f1 = 1;
@@ -158,13 +151,11 @@ DELETE FROM t1 WHERE f1 = 4;
DELETE FROM t1 WHERE f1 = 5; DELETE FROM t1 WHERE f1 = 5;
COMMIT; COMMIT;
SET AUTOCOMMIT=ON; SET AUTOCOMMIT=ON;
SELECT COUNT(*) AS expect_0 FROM t1;
SELECT COUNT(*) as expect_0 FROM t1;
--connection node_2 --connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM t1; SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc SELECT COUNT(*) as expect_0 FROM t1;
SELECT VARIABLE_VALUE expect_Primary FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
SELECT COUNT(*) AS expect_0 FROM t1;
DROP TABLE t1; DROP TABLE t1;
# #
@@ -185,16 +176,15 @@ SET SESSION wsrep_on = OFF;
DELETE FROM t2 WHERE f1 = 2; DELETE FROM t2 WHERE f1 = 2;
DELETE FROM t1 WHERE f1 = 3; DELETE FROM t1 WHERE f1 = 3;
SET SESSION wsrep_on = ON; SET SESSION wsrep_on = ON;
--source include/galera_wait_ready.inc
--connection node_1 --connection node_1
DELETE t1, t2 FROM t1 JOIN t2 WHERE t1.f1 = t2.f1; DELETE t1, t2 FROM t1 JOIN t2 WHERE t1.f1 = t2.f1;
SELECT COUNT(*) expect_0 FROM t1; SELECT COUNT(*) as expect_0 FROM t1;
--connection node_2 --connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM t1;
--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
SELECT COUNT(*) expect_0 FROM t1; SELECT COUNT(*) as expect_0 FROM t1;
DROP TABLE t1,t2; DROP TABLE t1,t2;
# #
@@ -214,18 +204,17 @@ INSERT INTO child VALUES (1,1),(2,2),(3,3);
SET SESSION wsrep_on = OFF; SET SESSION wsrep_on = OFF;
DELETE FROM child WHERE parent_id = 2; DELETE FROM child WHERE parent_id = 2;
SET SESSION wsrep_on = ON; SET SESSION wsrep_on = ON;
--source include/galera_wait_ready.inc
--connection node_1 --connection node_1
DELETE FROM parent; DELETE FROM parent;
SELECT COUNT(*) AS expect_0 FROM parent; SELECT COUNT(*) as expect_0 FROM parent;
SELECT COUNT(*) AS expect_0 FROM child; SELECT COUNT(*) as expect_0 FROM child;
--connection node_2 --connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM child;
--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
SELECT COUNT(*) AS expect_0 FROM parent; SELECT COUNT(*) as expect_0 FROM parent;
SELECT COUNT(*) AS expect_0 FROM child; SELECT COUNT(*) as expect_0 FROM child;
DROP TABLE child, parent; DROP TABLE child, parent;
# #
@@ -240,14 +229,13 @@ SET GLOBAL wsrep_ignore_apply_errors = 4;
SET GLOBAL wsrep_on = OFF; SET GLOBAL wsrep_on = OFF;
CREATE TABLE t1 (f1 INTEGER); CREATE TABLE t1 (f1 INTEGER);
SET GLOBAL wsrep_on = ON; SET GLOBAL wsrep_on = ON;
--source include/galera_wait_ready.inc
--connection node_1 --connection node_1
CREATE TABLE t1 (f1 INTEGER, f2 INTEGER); CREATE TABLE t1 (f1 INTEGER, f2 INTEGER);
DROP TABLE t1; DROP TABLE t1;
--connection node_2 --connection node_2
--error ER_NO_SUCH_TABLE
SELECT * FROM t1;
SET GLOBAL wsrep_ignore_apply_errors = 7; SET GLOBAL wsrep_ignore_apply_errors = 7;
CALL mtr.add_suppression("Can't find record in 't.*'"); CALL mtr.add_suppression("Can't find record in 't.*'");

View File

@@ -12,17 +12,18 @@ INSERT INTO t1 VALUES (4);
INSERT INTO t1 VALUES (5); INSERT INTO t1 VALUES (5);
connection node_2; connection node_2;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
COUNT(*) > 0 SELECT COUNT(*) as expect_5 FROM mysql.wsrep_streaming_log;
1 expect_5
5
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
ALTER TABLE t1 ADD COLUMN f2 INTEGER; ALTER TABLE t1 ADD COLUMN f2 INTEGER;
connection node_1; connection node_1;
INSERT INTO t1 VALUES (6); INSERT INTO t1 VALUES (6);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log;
COUNT(*) = 0 expect_0
1 0
ROLLBACK; ROLLBACK;
START TRANSACTION; START TRANSACTION;
INSERT INTO t1 (f1) VALUES (1); INSERT INTO t1 (f1) VALUES (1);
@@ -32,17 +33,34 @@ INSERT INTO t1 (f1) VALUES (4);
INSERT INTO t1 (f1) VALUES (5); INSERT INTO t1 (f1) VALUES (5);
INSERT INTO t1 (f1) VALUES (6); INSERT INTO t1 (f1) VALUES (6);
COMMIT; COMMIT;
SELECT COUNT(*) = 6 FROM t1; SELECT COUNT(*) as expect_6 FROM t1;
COUNT(*) = 6 expect_6
1 6
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; SELECT * FROM t1;
COUNT(*) = 0 f1 f2
1 1 NULL
2 NULL
3 NULL
4 NULL
5 NULL
6 NULL
SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log;
expect_0
0
connection node_2; connection node_2;
SELECT COUNT(*) = 6 FROM t1; set global wsrep_sync_wait=15;
COUNT(*) = 6 SELECT COUNT(*) as expect_6 FROM t1;
1 expect_6
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; 6
COUNT(*) = 0 SELECT * FROM t1;
1 f1 f2
1 NULL
2 NULL
3 NULL
4 NULL
5 NULL
6 NULL
SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log;
expect_0
0
DROP TABLE t1; DROP TABLE t1;

View File

@@ -27,10 +27,11 @@ INSERT INTO t1 VALUES (5);
--connection node_2 --connection node_2
# SR replication is triggered and rows have been delivered to the slave # SR replication is triggered and rows have been delivered to the slave
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
--let $wait_condition = SELECT COUNT(*) > 0 FROM t1; --let $wait_condition = SELECT COUNT(*) = 5 FROM t1;
--source include/wait_condition.inc --source include/wait_condition.inc
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; SELECT COUNT(*) as expect_5 FROM mysql.wsrep_streaming_log;
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
ALTER TABLE t1 ADD COLUMN f2 INTEGER; ALTER TABLE t1 ADD COLUMN f2 INTEGER;
@@ -39,7 +40,7 @@ ALTER TABLE t1 ADD COLUMN f2 INTEGER;
--error ER_LOCK_DEADLOCK --error ER_LOCK_DEADLOCK
INSERT INTO t1 VALUES (6); INSERT INTO t1 VALUES (6);
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log;
# Check that the transaction thus aborted could be reissued # Check that the transaction thus aborted could be reissued
@@ -53,11 +54,14 @@ INSERT INTO t1 (f1) VALUES (5);
INSERT INTO t1 (f1) VALUES (6); INSERT INTO t1 (f1) VALUES (6);
COMMIT; COMMIT;
SELECT COUNT(*) = 6 FROM t1; SELECT COUNT(*) as expect_6 FROM t1;
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; SELECT * FROM t1;
SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log;
--connection node_2 --connection node_2
SELECT COUNT(*) = 6 FROM t1; set global wsrep_sync_wait=15;
SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; SELECT COUNT(*) as expect_6 FROM t1;
SELECT * FROM t1;
SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log;
DROP TABLE t1; DROP TABLE t1;

View File

@@ -85,3 +85,4 @@ SET SESSION wsrep_trx_fragment_size=0;
# Restore original auto_increment_offset values. # Restore original auto_increment_offset values.
--source ../galera/include/auto_increment_offset_restore.inc --source ../galera/include/auto_increment_offset_restore.inc

View File

@@ -12,7 +12,7 @@ CREATE TABLE t2(i int) ENGINE INNODB;
echo # xtrabackup backup; echo # xtrabackup backup;
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; let targetdir=$MYSQLTEST_VARDIR/tmp/backup;
--disable_result_log --disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup "--tables=test.*1" --target-dir=$targetdir; exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup "--tables=test.*1" --target-dir=$targetdir;
--enable_result_log --enable_result_log
@@ -25,13 +25,27 @@ EOF
write_file $targetdir/test/junk.frm; write_file $targetdir/test/junk.frm;
EOF EOF
let server_cnf=$targetdir/server.cnf;
copy_file $MYSQLTEST_VARDIR/my.cnf $server_cnf;
# Emulate server config file turnes on binary logs
perl;
my $binlog_path="$ENV{'targetdir'}/mysqld-bin";
my $config_path=$ENV{'server_cnf'};
open(my $fd, '>>', "$config_path");
print $fd "\n[mysqld]\n";
print $fd "log-bin=$binlog_path\n";
close $fd;
EOF
echo # xtrabackup prepare; echo # xtrabackup prepare;
--disable_result_log --disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.1 --prepare --export --target-dir=$targetdir; exec $XTRABACKUP --defaults-file=$server_cnf --defaults-group-suffix=.1 --prepare --export --target-dir=$targetdir;
--enable_result_log --enable_result_log
list_files $targetdir/test *.cfg; list_files $targetdir/test *.cfg;
# There must not be binary logs created on --prepare step
list_files $targetdir/ mysqld-bin.*;
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;
ALTER TABLE t1 DISCARD TABLESPACE; ALTER TABLE t1 DISCARD TABLESPACE;

View File

@@ -1,4 +1,8 @@
if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'feedback' and plugin_status='active' and @@feedback_url <> ""`) if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'feedback' and plugin_status='active'`)
{
--skip Feedback plugin is not active
}
if (`select @@feedback_url = ""`)
{ {
--skip Feedback plugin is not active --skip Feedback plugin is not active
} }

View File

@@ -431,5 +431,7 @@ call mtr.add_suppression("Can't generate a unique log-filename .*");
-- source include/stop_slave_sql.inc -- source include/stop_slave_sql.inc
RESET SLAVE; RESET SLAVE;
RESET MASTER; RESET MASTER;
--remove_file $load_file
--remove_file $load_file2
--let $rpl_only_running_threads= 1 --let $rpl_only_running_threads= 1
--source include/rpl_end.inc --source include/rpl_end.inc

View File

@@ -1,15 +1,13 @@
include/master-slave.inc include/master-slave.inc
[connection master] [connection master]
connection slave;
connection master;
create table t1 (n int); create table t1 (n int);
insert into t1 values(1); insert into t1 values(1);
connection slave; connection slave;
show global status like 'com_insert'; # Com_insert = 1
Variable_name Value
Com_insert 1
stop slave; stop slave;
show global status like 'com_insert'; # Com_insert = 1
Variable_name Value
Com_insert 1
include/wait_for_slave_to_stop.inc include/wait_for_slave_to_stop.inc
start slave; start slave;
include/wait_for_slave_to_start.inc include/wait_for_slave_to_start.inc

View File

@@ -64,3 +64,5 @@ Master-Host: 127.0.0.1
change master to master_host='0:0:0:0:0:0:0:1'; change master to master_host='0:0:0:0:0:0:0:1';
Master-Host: 0:0:0:0:0:0:0:1 Master-Host: 0:0:0:0:0:0:0:1
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root'; CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root';
connection slave;
reset slave all;

View File

@@ -64,3 +64,5 @@ Master-Host: 127.0.0.1
change master to master_host='0:0:0:0:0:0:0:1'; change master to master_host='0:0:0:0:0:0:0:1';
Master-Host: 0:0:0:0:0:0:0:1 Master-Host: 0:0:0:0:0:0:0:1
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root'; CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root';
connection slave;
reset slave all;

View File

@@ -128,4 +128,6 @@ show binlog events in '';
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Could not find target log
purge master logs before now(); purge master logs before now();
End of 5.0 tests End of 5.0 tests
#cleanup
include/stop_slave.inc include/stop_slave.inc
reset slave all;

View File

@@ -15,7 +15,8 @@ DELETE FROM t1;
DROP TABLE t1; DROP TABLE t1;
connection slave; connection slave;
# Check if any note related to long DELETE_ROWS and UPDATE_ROWS appears in the error log # Check if any note related to long DELETE_ROWS and UPDATE_ROWS appears in the error log
Occurrences: update=1, delete=1 FOUND 1 /The slave is applying a ROW event on behalf of an UPDATE statement on table t1 and is currently taking a considerable amount/ in mysqld.2.err
FOUND 1 /The slave is applying a ROW event on behalf of a DELETE statement on table t1 and is currently taking a considerable amount/ in mysqld.2.err
include/stop_slave.inc include/stop_slave.inc
SET GLOBAL debug_dbug = ''; SET GLOBAL debug_dbug = '';
SET GLOBAL log_warnings = 2; SET GLOBAL log_warnings = 2;

View File

@@ -1,5 +1,7 @@
include/master-slave.inc include/master-slave.inc
[connection master] [connection master]
connection slave;
connection master;
==== Test Without sql_mode=strict_trans_tables ==== ==== Test Without sql_mode=strict_trans_tables ====
create table t1 (n int not null primary key); create table t1 (n int not null primary key);
connection slave; connection slave;
@@ -105,9 +107,7 @@ t2 CREATE TABLE `t2` (
`data` int(11) DEFAULT NULL, `data` int(11) DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
show global status like 'slave_skipped_errors'; # Slave_skipped_errros = 4
Variable_name Value
Slave_skipped_errors 4
connection master; connection master;
INSERT INTO t2 VALUES(1, 1); INSERT INTO t2 VALUES(1, 1);
INSERT INTO t2 VALUES(2, 1); INSERT INTO t2 VALUES(2, 1);
@@ -119,9 +119,7 @@ SET SQL_LOG_BIN=1;
UPDATE t2 SET id= id + 3, data = 2; UPDATE t2 SET id= id + 3, data = 2;
connection slave; connection slave;
show global status like 'slave_skipped_errors'; # Slave_skipped_errros = 5
Variable_name Value
Slave_skipped_errors 5
**** We cannot execute a select as there are differences in the **** We cannot execute a select as there are differences in the
**** behavior between STMT and RBR. **** behavior between STMT and RBR.
==== Clean Up ==== ==== Clean Up ====

View File

@@ -5,19 +5,19 @@
# #
source include/master-slave.inc; source include/master-slave.inc;
--connection slave
let $initial_com_insert= query_get_value(show global status like "Com_insert", Value, 1);
--connection master
create table t1 (n int); create table t1 (n int);
insert into t1 values(1); insert into t1 values(1);
sync_slave_with_master; sync_slave_with_master;
show global status like 'com_insert'; let $current_com_insert= query_get_value(show global status like "Com_insert", Value, 1);
--let $delta_com_insert= `select $current_com_insert - $initial_com_insert from dual`
--echo # Com_insert = $delta_com_insert
stop slave; stop slave;
# Temporary work-around for bug MDEV-8301. There is a small window during let $current_com_insert= query_get_value(show global status like "Com_insert", Value, 1);
# thread exit where the local status values of a thread are counted twice --let $delta_com_insert= `select $current_com_insert - $initial_com_insert from dual`
# in the global status. Remove this wait_condition.inc once MDEV-8301 is --echo # Com_insert = $delta_com_insert
# fixed.
--let $wait_condition= SELECT variable_value=1 FROM information_schema.global_status WHERE variable_name="Com_insert";
--source include/wait_condition.inc
show global status like 'com_insert';
--source include/wait_for_slave_to_stop.inc --source include/wait_for_slave_to_stop.inc
start slave; start slave;
--source include/wait_for_slave_to_start.inc --source include/wait_for_slave_to_start.inc

View File

@@ -44,3 +44,5 @@ let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
# clean up # clean up
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root'; CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root';
--connection slave
reset slave all;

View File

@@ -45,3 +45,5 @@ let $master_host= query_get_value(SHOW SLAVE STATUS, Master_Host, 1);
# clean up # clean up
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root'; CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root';
connection slave;
reset slave all;

View File

@@ -193,4 +193,8 @@ show binlog events in '';
purge master logs before now(); purge master logs before now();
--echo End of 5.0 tests --echo End of 5.0 tests
--echo #cleanup
--remove_file $MYSQLD_SLAVE_DATADIR/master.info
--source include/stop_slave.inc --source include/stop_slave.inc
reset slave all;

View File

@@ -42,16 +42,11 @@ DROP TABLE t1;
--sync_slave_with_master --sync_slave_with_master
--echo # Check if any note related to long DELETE_ROWS and UPDATE_ROWS appears in the error log --echo # Check if any note related to long DELETE_ROWS and UPDATE_ROWS appears in the error log
perl; --let SEARCH_FILE=$log_error_
use strict; --let SEARCH_PATTERN=The slave is applying a ROW event on behalf of an UPDATE statement on table t1 and is currently taking a considerable amount
my $log_error= $ENV{'LOG_ERROR'} or die "LOG_ERROR not set"; --source include/search_pattern_in_file.inc
open(FILE, "$log_error") or die("Unable to open $log_error: $!\n"); --let SEARCH_PATTERN=The slave is applying a ROW event on behalf of a DELETE statement on table t1 and is currently taking a considerable amount
my $upd_count = () = grep(/The slave is applying a ROW event on behalf of an UPDATE statement on table t1 and is currently taking a considerable amount/g,<FILE>); --source include/search_pattern_in_file.inc
seek(FILE, 0, 0) or die "Can't seek to beginning of file: $!";
my $del_count = () = grep(/The slave is applying a ROW event on behalf of a DELETE statement on table t1 and is currently taking a considerable amount/g,<FILE>);
print "Occurrences: update=$upd_count, delete=$del_count\n";
close(FILE);
EOF
# cleanup # cleanup
--source include/stop_slave.inc --source include/stop_slave.inc

View File

@@ -26,6 +26,10 @@
source include/have_innodb.inc; source include/have_innodb.inc;
source include/master-slave.inc; source include/master-slave.inc;
--connection slave
let $initial_skipped_error= query_get_value(show global status like "Slave_skipped_errors", Value, 1);
connection master;
--echo ==== Test Without sql_mode=strict_trans_tables ==== --echo ==== Test Without sql_mode=strict_trans_tables ====
create table t1 (n int not null primary key); create table t1 (n int not null primary key);
@@ -133,8 +137,9 @@ connection slave;
CREATE TABLE t2(id INT NOT NULL PRIMARY KEY, data INT) Engine=MyIsam; CREATE TABLE t2(id INT NOT NULL PRIMARY KEY, data INT) Engine=MyIsam;
SHOW CREATE TABLE t2; SHOW CREATE TABLE t2;
show global status like 'slave_skipped_errors'; let $current_skipped_error= query_get_value(show global status like "Slave_skipped_errors", Value, 1);
--let $delta_skipped_error= `select $current_skipped_error - $initial_skipped_error from dual`
--echo # Slave_skipped_errros = $delta_skipped_error
connection master; connection master;
INSERT INTO t2 VALUES(1, 1); INSERT INTO t2 VALUES(1, 1);
@@ -151,7 +156,10 @@ sync_slave_with_master;
let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1); let $error= query_get_value("SHOW SLAVE STATUS", Last_SQL_Error, 1);
echo $error; echo $error;
show global status like 'slave_skipped_errors';
let $current_skipped_error= query_get_value(show global status like "Slave_skipped_errors", Value, 1);
--let $delta_skipped_error= `select $current_skipped_error - $initial_skipped_error from dual`
--echo # Slave_skipped_errros = $delta_skipped_error
--echo **** We cannot execute a select as there are differences in the --echo **** We cannot execute a select as there are differences in the
--echo **** behavior between STMT and RBR. --echo **** behavior between STMT and RBR.

View File

@@ -4,8 +4,6 @@ if (!$TEST_VERSIONING_SO)
--skip needs test_versioning plugin --skip needs test_versioning plugin
} }
source include/have_innodb.inc; source include/have_innodb.inc;
create database test2 character set latin1;
use test2;
set @@session.time_zone='+00:00'; set @@session.time_zone='+00:00';
select ifnull(max(transaction_id), 0) into @start_trx_id from mysql.transaction_registry; select ifnull(max(transaction_id), 0) into @start_trx_id from mysql.transaction_registry;

View File

@@ -5,7 +5,4 @@ drop procedure if exists verify_trt_dummy;
drop function if exists current_row; drop function if exists current_row;
drop function if exists check_row; drop function if exists check_row;
--enable_warnings --enable_warnings
use test;
drop database test2;
--enable_query_log --enable_query_log

View File

@@ -0,0 +1,3 @@
[unique]
[pk]
[sec]

View File

@@ -0,0 +1,14 @@
--disable_query_log
if ($MTR_COMBINATION_UNIQUE)
{
let $KEY_TYPE= unique;
}
if ($MTR_COMBINATION_PK)
{
let $KEY_TYPE= primary key;
}
if ($MTR_COMBINATION_SEC)
{
let $KEY_TYPE= key;
}
--enable_query_log

View File

@@ -18,13 +18,13 @@ t CREATE TABLE `t` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING ) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
alter table t add column y int; alter table t add column y int;
ERROR HY000: Not allowed for system-versioned `test2`.`t`. Change @@system_versioning_alter_history to proceed with ALTER. ERROR HY000: Not allowed for system-versioned `test`.`t`. Change @@system_versioning_alter_history to proceed with ALTER.
alter table t add primary key (a); alter table t add primary key (a);
ERROR HY000: Not allowed for system-versioned `test2`.`t`. Change @@system_versioning_alter_history to proceed with ALTER. ERROR HY000: Not allowed for system-versioned `test`.`t`. Change @@system_versioning_alter_history to proceed with ALTER.
alter table t add unique key (a); alter table t add unique key (a);
ERROR HY000: Not allowed for system-versioned `test2`.`t`. Change @@system_versioning_alter_history to proceed with ALTER. ERROR HY000: Not allowed for system-versioned `test`.`t`. Change @@system_versioning_alter_history to proceed with ALTER.
alter table t engine innodb; alter table t engine innodb;
ERROR HY000: Not allowed for system-versioned `test2`.`t`. Change to/from native system versioning engine is not supported. ERROR HY000: Not allowed for system-versioned `test`.`t`. Change to/from native system versioning engine is not supported.
alter table t drop system versioning; alter table t drop system versioning;
show create table t; show create table t;
Table Create Table Table Create Table
@@ -80,13 +80,17 @@ t CREATE TABLE `t` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
alter table t add column trx_start timestamp(6) as row start; alter table t add column trx_start timestamp(6) as row start;
ERROR HY000: Table `t` is not system-versioned ERROR HY000: Duplicate ROW START column `trx_start`
alter table t add system versioning; alter table t add system versioning;
show create table t; show create table t;
Table Create Table Table Create Table
t CREATE TABLE `t` ( t CREATE TABLE `t` (
`a` int(11) DEFAULT NULL `a` int(11) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING ) ENGINE=MyISAM DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
alter table t add column trx_start timestamp(6) as row start;
ERROR HY000: Duplicate ROW START column `trx_start`
alter table t modify a int as row start;
ERROR HY000: Duplicate ROW START column `a`
alter table t add column b int; alter table t add column b int;
show create table t; show create table t;
Table Create Table Table Create Table
@@ -533,7 +537,7 @@ use test;
# MDEV-15956 Strange ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN upon ALTER on versioning column # MDEV-15956 Strange ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN upon ALTER on versioning column
create or replace table t1 (i int, j int as (i), s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning; create or replace table t1 (i int, j int as (i), s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning;
alter table t1 modify s timestamp(6) as row start; alter table t1 modify s timestamp(6) as row start;
ERROR HY000: Can not change system versioning field `s` ERROR HY000: Duplicate ROW START column `s`
# ignore CHECK for historical rows # ignore CHECK for historical rows
create or replace table t (a int) with system versioning; create or replace table t (a int) with system versioning;
insert into t values (0), (1); insert into t values (0), (1);
@@ -682,5 +686,4 @@ alter table t
add column c int without system versioning, add column c int without system versioning,
change column c c int, change column c c int,
change column b b int without system versioning; change column b b int without system versioning;
drop database test; drop table t;
create database test;

View File

@@ -15,7 +15,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING ) ENGINE=DEFAULT_ENGINE DEFAULT CHARSET=latin1 WITH SYSTEM VERSIONING
select table_catalog,table_schema,table_name,table_type,version,table_rows,data_free,auto_increment,check_time,table_collation,checksum,create_options,table_comment from information_schema.tables where table_name='t1'; select table_catalog,table_schema,table_name,table_type,version,table_rows,data_free,auto_increment,check_time,table_collation,checksum,create_options,table_comment from information_schema.tables where table_name='t1';
table_catalog def table_catalog def
table_schema test2 table_schema test
table_name t1 table_name t1
table_type SYSTEM VERSIONED table_type SYSTEM VERSIONED
version 10 version 10
@@ -29,7 +29,7 @@ create_options
table_comment table_comment
select table_catalog,table_schema,table_name,column_name,ordinal_position,column_default,character_maximum_length,character_octet_length,character_set_name,collation_name,column_key,extra,column_comment,is_generated,generation_expression from information_schema.columns where table_name='t1'; select table_catalog,table_schema,table_name,column_name,ordinal_position,column_default,character_maximum_length,character_octet_length,character_set_name,collation_name,column_key,extra,column_comment,is_generated,generation_expression from information_schema.columns where table_name='t1';
table_catalog def table_catalog def
table_schema test2 table_schema test
table_name t1 table_name t1
column_name x1 column_name x1
ordinal_position 1 ordinal_position 1
@@ -44,7 +44,7 @@ column_comment
is_generated NEVER is_generated NEVER
generation_expression NULL generation_expression NULL
table_catalog def table_catalog def
table_schema test2 table_schema test
table_name t1 table_name t1
column_name Sys_start column_name Sys_start
ordinal_position 2 ordinal_position 2
@@ -59,7 +59,7 @@ column_comment start
is_generated ALWAYS is_generated ALWAYS
generation_expression ROW START generation_expression ROW START
table_catalog def table_catalog def
table_schema test2 table_schema test
table_name t1 table_name t1
column_name Sys_end column_name Sys_end
ordinal_position 3 ordinal_position 3
@@ -235,7 +235,7 @@ tt1 CREATE TABLE `tt1` (
drop table tt1; drop table tt1;
create temporary table tt1 like t1; create temporary table tt1 like t1;
Warnings: Warnings:
Warning 1105 System versioning is stripped from temporary `test2.tt1` Warning 1105 System versioning is stripped from temporary `test.tt1`
# Temporary is stripped from versioning # Temporary is stripped from versioning
show create table tt1; show create table tt1;
Table Create Table Table Create Table
@@ -535,5 +535,4 @@ create or replace table t1 (x int without system versioning)
with system versioning with system versioning
select 1 as x; select 1 as x;
ERROR HY000: Table `t1` must have at least one versioned column ERROR HY000: Table `t1` must have at least one versioned column
drop database test; drop tables t0, t1, t2, t3;
create database test;

View File

@@ -115,3 +115,4 @@ select x from t1 for system_time all;
x x
2 2
1 1
drop table t1;

View File

@@ -2,7 +2,8 @@
# Test RESTRICT # # Test RESTRICT #
################# #################
create table parent( create table parent(
id int unique key id int,
KEY_TYPE (id)
) engine innodb; ) engine innodb;
create table child( create table child(
parent_id int, parent_id int,
@@ -16,13 +17,13 @@ on update restrict
insert into parent values(1); insert into parent values(1);
insert into child values(1); insert into child values(1);
delete from parent where id = 1; delete from parent where id = 1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test2`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)) ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))
delete from child where parent_id = 1; delete from child where parent_id = 1;
delete from parent where id = 1; delete from parent where id = 1;
insert into parent values(1); insert into parent values(1);
insert into child values(1); insert into child values(1);
update parent set id=id+1; update parent set id=id+1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test2`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)) ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))
delete from child; delete from child;
update parent set id=id+1; update parent set id=id+1;
select * from child for system_time all; select * from child for system_time all;
@@ -35,7 +36,8 @@ drop table parent;
# Test when clustered index is a foreign key # # Test when clustered index is a foreign key #
############################################## ##############################################
create table parent( create table parent(
id int(10) unsigned unique key id int(10) unsigned,
KEY_TYPE (id)
) engine innodb; ) engine innodb;
create table child( create table child(
parent_id int(10) unsigned primary key, parent_id int(10) unsigned primary key,
@@ -47,14 +49,15 @@ foreign key(parent_id) references parent(id)
insert into parent values(1); insert into parent values(1);
insert into child values(1); insert into child values(1);
delete from parent where id = 1; delete from parent where id = 1;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test2`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)) ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))
drop table child; drop table child;
drop table parent; drop table parent;
################ ################
# Test CASCADE # # Test CASCADE #
################ ################
create table parent( create table parent(
id int unique key id int,
KEY_TYPE (id)
) engine innodb; ) engine innodb;
create table child( create table child(
parent_id int, parent_id int,
@@ -87,7 +90,8 @@ parent_id
drop table child; drop table child;
drop table parent; drop table parent;
create or replace table parent ( create or replace table parent (
id int primary key, id int,
KEY_TYPE(id),
sys_start SYS_DATATYPE as row start invisible, sys_start SYS_DATATYPE as row start invisible,
sys_end SYS_DATATYPE as row end invisible, sys_end SYS_DATATYPE as row end invisible,
period for system_time(sys_start, sys_end) period for system_time(sys_start, sys_end)
@@ -110,7 +114,8 @@ x parent_id
drop table child; drop table child;
drop table parent; drop table parent;
create or replace table parent ( create or replace table parent (
id int primary key id int,
KEY_TYPE(id)
) )
engine innodb; engine innodb;
create or replace table child ( create or replace table child (
@@ -138,8 +143,9 @@ drop table parent;
################# #################
# Test SET NULL # # Test SET NULL #
################# #################
create or replace table parent( create table parent(
id int unique key id int,
KEY_TYPE (id)
) engine innodb; ) engine innodb;
create or replace table child( create or replace table child(
parent_id int, parent_id int,
@@ -183,7 +189,8 @@ drop table parent;
# Parent table is foreign # # Parent table is foreign #
########################### ###########################
create or replace table parent( create or replace table parent(
id int unique key, id int,
KEY_TYPE (id),
sys_start SYS_DATATYPE as row start invisible, sys_start SYS_DATATYPE as row start invisible,
sys_end SYS_DATATYPE as row end invisible, sys_end SYS_DATATYPE as row end invisible,
period for system_time(sys_start, sys_end) period for system_time(sys_start, sys_end)
@@ -195,26 +202,27 @@ foreign key(parent_id) references parent(id)
insert into parent values(1); insert into parent values(1);
insert into child values(1); insert into child values(1);
delete from parent; delete from parent;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test2`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)) ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))
update parent set id=2; update parent set id=2;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test2`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)) ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))
delete from child; delete from child;
delete from parent; delete from parent;
insert into child values(1); insert into child values(1);
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test2`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)) ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))
insert into parent values(1); insert into parent values(1);
insert into child values(1); insert into child values(1);
delete from parent; delete from parent;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test2`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)) ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))
update parent set id=2; update parent set id=2;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test2`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)) ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))
drop table child; drop table child;
drop table parent; drop table parent;
################### ###################
# crash on DELETE # # crash on DELETE #
################### ###################
create or replace table a ( create or replace table a (
cola int(10) primary key, cola int(10),
KEY_TYPE (cola),
v_cola int(10) as (cola mod 10) virtual, v_cola int(10) as (cola mod 10) virtual,
sys_start SYS_DATATYPE as row start invisible, sys_start SYS_DATATYPE as row start invisible,
sys_end SYS_DATATYPE as row end invisible, sys_end SYS_DATATYPE as row end invisible,
@@ -233,7 +241,7 @@ foreign key (v_cola) references a (v_cola);
insert into a(cola) values (12); insert into a(cola) values (12);
insert into b(cola, v_cola) values (10,2); insert into b(cola, v_cola) values (10,2);
delete from a; delete from a;
ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test2`.`b`, CONSTRAINT `v_cola_fk` FOREIGN KEY (`v_cola`) REFERENCES `a` (`v_cola`)) ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`b`, CONSTRAINT `v_cola_fk` FOREIGN KEY (`v_cola`) REFERENCES `a` (`v_cola`))
drop table b, a; drop table b, a;
############################################### ###############################################
# CASCADE UPDATE foreign not system versioned # # CASCADE UPDATE foreign not system versioned #
@@ -292,15 +300,18 @@ select count(*) from subchild;
count(*) count(*)
0 0
drop table subchild, child, parent; drop table subchild, child, parent;
CREATE TABLE t1 (f1 INT, KEY(f1)) ENGINE=InnoDB; #
CREATE TABLE t2 (f2 INT, FOREIGN KEY (f2) REFERENCES t1 (f1)) ENGINE=InnoDB WITH SYSTEM VERSIONING; # MDEV-18057 Assertion `(node->state == 5) || (node->state == 6)' failed in row_upd_sec_step upon DELETE after UPDATE failed due to FK violation
SET FOREIGN_KEY_CHECKS= OFF; #
INSERT IGNORE INTO t2 VALUES (1); create or replace table t1 (f1 int, key(f1)) engine=innodb;
SET FOREIGN_KEY_CHECKS= ON; create or replace table t2 (f2 int, foreign key (f2) references t1 (f1)) engine=innodb with system versioning;
UPDATE t2 SET f2= 2; set foreign_key_checks= off;
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test2`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`)) insert ignore into t2 values (1);
DELETE FROM t2; set foreign_key_checks= on;
DROP TABLE t2, t1; update t2 set f2= 2;
ERROR 23000: Cannot add or update a child row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`f2`) REFERENCES `t1` (`f1`))
delete from t2;
drop table t2, t1;
# #
# MDEV-18879 Corrupted record inserted by FOREIGN KEY operation # MDEV-18879 Corrupted record inserted by FOREIGN KEY operation
# #

View File

@@ -90,13 +90,13 @@ period for system_time(row_start, row_end)
insert into t values (1, 1); insert into t values (1, 1);
select c.prtype from information_schema.innodb_sys_columns as c select c.prtype from information_schema.innodb_sys_columns as c
join information_schema.innodb_sys_tables as t on c.table_id=t.table_id join information_schema.innodb_sys_tables as t on c.table_id=t.table_id
where t.name='test2/t' and c.name='b'; where t.name='test/t' and c.name='b';
prtype prtype
50179 50179
set @@system_versioning_alter_history=keep; set @@system_versioning_alter_history=keep;
select c.prtype from information_schema.innodb_sys_columns as c select c.prtype from information_schema.innodb_sys_columns as c
join information_schema.innodb_sys_tables as t on c.table_id=t.table_id join information_schema.innodb_sys_tables as t on c.table_id=t.table_id
where t.name='test2/t' and c.name='b'; where t.name='test/t' and c.name='b';
prtype prtype
50179 50179
show create table t; show create table t;
@@ -156,5 +156,4 @@ v int as (x) virtual,
y int y int
) with system versioning; ) with system versioning;
alter table t1 drop system versioning; alter table t1 drop system versioning;
drop database test; drop tables t, t1;
create database test;

View File

@@ -46,7 +46,7 @@ period for system_time(row_start, row_end))
engine=DEFAULT_ENGINE engine=DEFAULT_ENGINE
with system versioning partition by hash(i); with system versioning partition by hash(i);
alter table t1 engine=NON_DEFAULT_ENGINE; alter table t1 engine=NON_DEFAULT_ENGINE;
ERROR HY000: Not allowed for system-versioned `test2`.`t1`. Change to/from native system versioning engine is not supported. ERROR HY000: Not allowed for system-versioned `test`.`t1`. Change to/from native system versioning engine is not supported.
## CREATE TABLE ## CREATE TABLE
create or replace table t1 (x int) create or replace table t1 (x int)
partition by system_time ( partition by system_time (
@@ -266,11 +266,11 @@ x
6 6
insert into t1 values (7), (8); insert into t1 values (7), (8);
Warnings: Warnings:
Warning 4114 Versioned table `test2`.`t1`: partition `p1` is full, add more HISTORY partitions Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
### warn about full partition ### warn about full partition
delete from t1; delete from t1;
Warnings: Warnings:
Warning 4114 Versioned table `test2`.`t1`: partition `p1` is full, add more HISTORY partitions Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
select * from t1 partition (p1) order by x; select * from t1 partition (p1) order by x;
x x
4 4
@@ -441,16 +441,16 @@ create or replace table t1 (i int) with system versioning
partition by system_time interval 1 hour ( partition by system_time interval 1 hour (
partition p0 history, partition pn current); partition p0 history, partition pn current);
set @ts=(select partition_description from information_schema.partitions set @ts=(select partition_description from information_schema.partitions
where table_schema='test2' and table_name='t1' and partition_name='p0'); where table_schema='test' and table_name='t1' and partition_name='p0');
alter table t1 add column b int; alter table t1 add column b int;
select partition_name,partition_ordinal_position,partition_method,timediff(partition_description, @ts) from information_schema.partitions where table_schema='test2' and table_name='t1'; select partition_name,partition_ordinal_position,partition_method,timediff(partition_description, @ts) from information_schema.partitions where table_schema='test' and table_name='t1';
partition_name partition_ordinal_position partition_method timediff(partition_description, @ts) partition_name partition_ordinal_position partition_method timediff(partition_description, @ts)
p0 1 SYSTEM_TIME 00:00:00.000000 p0 1 SYSTEM_TIME 00:00:00.000000
pn 2 SYSTEM_TIME NULL pn 2 SYSTEM_TIME NULL
Warnings: Warnings:
Warning 1292 Incorrect time value: 'CURRENT' Warning 1292 Incorrect time value: 'CURRENT'
alter table t1 add partition (partition p1 history, partition p2 history); alter table t1 add partition (partition p1 history, partition p2 history);
select partition_name,partition_ordinal_position,partition_method,timediff(partition_description, @ts) from information_schema.partitions where table_schema='test2' and table_name='t1'; select partition_name,partition_ordinal_position,partition_method,timediff(partition_description, @ts) from information_schema.partitions where table_schema='test' and table_name='t1';
partition_name partition_ordinal_position partition_method timediff(partition_description, @ts) partition_name partition_ordinal_position partition_method timediff(partition_description, @ts)
p0 1 SYSTEM_TIME 00:00:00.000000 p0 1 SYSTEM_TIME 00:00:00.000000
p1 2 SYSTEM_TIME 01:00:00.000000 p1 2 SYSTEM_TIME 01:00:00.000000
@@ -459,7 +459,7 @@ pn 4 SYSTEM_TIME NULL
Warnings: Warnings:
Warning 1292 Incorrect time value: 'CURRENT' Warning 1292 Incorrect time value: 'CURRENT'
alter table t1 drop partition p0; alter table t1 drop partition p0;
select partition_name,partition_ordinal_position,partition_method,timediff(partition_description, @ts) from information_schema.partitions where table_schema='test2' and table_name='t1'; select partition_name,partition_ordinal_position,partition_method,timediff(partition_description, @ts) from information_schema.partitions where table_schema='test' and table_name='t1';
partition_name partition_ordinal_position partition_method timediff(partition_description, @ts) partition_name partition_ordinal_position partition_method timediff(partition_description, @ts)
p1 1 SYSTEM_TIME 01:00:00.000000 p1 1 SYSTEM_TIME 01:00:00.000000
p2 2 SYSTEM_TIME 02:00:00.000000 p2 2 SYSTEM_TIME 02:00:00.000000
@@ -468,7 +468,7 @@ Warnings:
Warning 1292 Incorrect time value: 'CURRENT' Warning 1292 Incorrect time value: 'CURRENT'
alter table t1 drop partition p2; alter table t1 drop partition p2;
ERROR HY000: Can only drop oldest partitions when rotating by INTERVAL ERROR HY000: Can only drop oldest partitions when rotating by INTERVAL
select partition_name,partition_ordinal_position,partition_method,timediff(partition_description, @ts) from information_schema.partitions where table_schema='test2' and table_name='t1'; select partition_name,partition_ordinal_position,partition_method,timediff(partition_description, @ts) from information_schema.partitions where table_schema='test' and table_name='t1';
partition_name partition_ordinal_position partition_method timediff(partition_description, @ts) partition_name partition_ordinal_position partition_method timediff(partition_description, @ts)
p1 1 SYSTEM_TIME 01:00:00.000000 p1 1 SYSTEM_TIME 01:00:00.000000
p2 2 SYSTEM_TIME 02:00:00.000000 p2 2 SYSTEM_TIME 02:00:00.000000
@@ -564,7 +564,7 @@ insert into t1 values (0), (1), (2), (3);
delete from t1 where x < 3; delete from t1 where x < 3;
delete from t1; delete from t1;
Warnings: Warnings:
Warning 4114 Versioned table `test2`.`t1`: partition `p1` is full, add more HISTORY partitions Warning 4114 Versioned table `test`.`t1`: partition `p1` is full, add more HISTORY partitions
unlock tables; unlock tables;
# #
# MDEV-20336 Assertion bitmap_is_set(read_partitions) upon SELECT FOR UPDATE from versioned table # MDEV-20336 Assertion bitmap_is_set(read_partitions) upon SELECT FOR UPDATE from versioned table
@@ -572,4 +572,5 @@ unlock tables;
create or replace table t1 (pk int primary key) with system versioning partition by system_time limit 100 (partition p1 history, partition pn current); create or replace table t1 (pk int primary key) with system versioning partition by system_time limit 100 (partition p1 history, partition pn current);
execute immediate 'select * from t1 for update'; execute immediate 'select * from t1 for update';
pk pk
drop table t1; drop view v1;
drop tables t, t1, t2, t3, t4;

View File

@@ -21,6 +21,7 @@ partition p0 history,
partition pn current partition pn current
); );
ERROR HY000: `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1` ERROR HY000: `row_start` must be of type TIMESTAMP(6) for system-versioned table `t1`
drop table t1;
create or replace table t ( create or replace table t (
a int primary key, a int primary key,
row_start bigint unsigned as row start invisible, row_start bigint unsigned as row start invisible,

View File

@@ -1,9 +1,10 @@
create table t ( create or replace table t(
id int primary key, id int,
KEY_TYPE(id),
x int, x int,
row_start SYS_DATATYPE as row start invisible, row_start SYS_DATATYPE as row start invisible,
row_end SYS_DATATYPE as row end invisible, row_end SYS_DATATYPE as row end invisible,
period for system_time (row_start, row_end) period for system_time(row_start, row_end)
) with system versioning; ) with system versioning;
insert t values (1, 2); insert t values (1, 2);
replace t values (1, 3); replace t values (1, 3);
@@ -32,7 +33,8 @@ insert into t1 values (1,1);
create or replace table t2 (c int); create or replace table t2 (c int);
create or replace view v as select t1.* from t1 join t2; create or replace view v as select t1.* from t1 join t2;
replace into v (a, b) select a, b from t1; replace into v (a, b) select a, b from t1;
drop table t1; drop view v;
drop tables t1, t2;
CREATE TABLE t1 ( CREATE TABLE t1 (
pk INT AUTO_INCREMENT, pk INT AUTO_INCREMENT,
f INT, f INT,

View File

@@ -155,21 +155,21 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings: Warnings:
Note 1003 select `test2`.`t1`.`x` AS `IJ2_x1`,`test2`.`t1`.`y` AS `y1`,`test2`.`t2`.`x` AS `x2`,`test2`.`t2`.`y` AS `y2` from `test2`.`t1` FOR SYSTEM_TIME ALL join `test2`.`t2` FOR SYSTEM_TIME ALL where `test2`.`t1`.`x` = `test2`.`t2`.`x` and `test2`.`t2`.`row_end` > @`t0` and `test2`.`t2`.`row_start` <= @`t0` and `test2`.`t1`.`row_end` > @`t0` and `test2`.`t1`.`row_start` <= @`t0` Note 1003 select `test`.`t1`.`x` AS `IJ2_x1`,`test`.`t1`.`y` AS `y1`,`test`.`t2`.`x` AS `x2`,`test`.`t2`.`y` AS `y2` from `test`.`t1` FOR SYSTEM_TIME ALL join `test`.`t2` FOR SYSTEM_TIME ALL where `test`.`t1`.`x` = `test`.`t2`.`x` and `test`.`t2`.`row_end` > @`t0` and `test`.`t2`.`row_start` <= @`t0` and `test`.`t1`.`row_end` > @`t0` and `test`.`t1`.`row_start` <= @`t0`
explain extended select * from (select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x) explain extended select * from (select t1.x as LJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 left join t2 on t1.x = t2.x)
for system_time as of timestamp @t0 as t; for system_time as of timestamp @t0 as t;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
Warnings: Warnings:
Note 1003 select `test2`.`t1`.`x` AS `LJ2_x1`,`test2`.`t1`.`y` AS `y1`,`test2`.`t2`.`x` AS `x2`,`test2`.`t2`.`y` AS `y2` from `test2`.`t1` FOR SYSTEM_TIME ALL left join `test2`.`t2` FOR SYSTEM_TIME ALL on(`test2`.`t2`.`x` = `test2`.`t1`.`x` and `test2`.`t2`.`row_end` > @`t0` and `test2`.`t2`.`row_start` <= @`t0`) where `test2`.`t1`.`row_end` > @`t0` and `test2`.`t1`.`row_start` <= @`t0` Note 1003 select `test`.`t1`.`x` AS `LJ2_x1`,`test`.`t1`.`y` AS `y1`,`test`.`t2`.`x` AS `x2`,`test`.`t2`.`y` AS `y2` from `test`.`t1` FOR SYSTEM_TIME ALL left join `test`.`t2` FOR SYSTEM_TIME ALL on(`test`.`t2`.`x` = `test`.`t1`.`x` and `test`.`t2`.`row_end` > @`t0` and `test`.`t2`.`row_start` <= @`t0`) where `test`.`t1`.`row_end` > @`t0` and `test`.`t1`.`row_start` <= @`t0`
explain extended select * from (select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x) explain extended select * from (select t1.x as RJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 right join t2 on t1.x = t2.x)
for system_time as of timestamp @t0 as t; for system_time as of timestamp @t0 as t;
id select_type table type possible_keys key key_len ref rows filtered Extra id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where
1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join) 1 SIMPLE t1 ALL NULL NULL NULL NULL 5 100.00 Using where; Using join buffer (flat, BNL join)
Warnings: Warnings:
Note 1003 select `test2`.`t1`.`x` AS `RJ2_x1`,`test2`.`t1`.`y` AS `y1`,`test2`.`t2`.`x` AS `x2`,`test2`.`t2`.`y` AS `y2` from `test2`.`t2` FOR SYSTEM_TIME ALL left join `test2`.`t1` FOR SYSTEM_TIME ALL on(`test2`.`t1`.`x` = `test2`.`t2`.`x` and `test2`.`t1`.`row_end` > @`t0` and `test2`.`t1`.`row_start` <= @`t0`) where `test2`.`t2`.`row_end` > @`t0` and `test2`.`t2`.`row_start` <= @`t0` Note 1003 select `test`.`t1`.`x` AS `RJ2_x1`,`test`.`t1`.`y` AS `y1`,`test`.`t2`.`x` AS `x2`,`test`.`t2`.`y` AS `y2` from `test`.`t2` FOR SYSTEM_TIME ALL left join `test`.`t1` FOR SYSTEM_TIME ALL on(`test`.`t1`.`x` = `test`.`t2`.`x` and `test`.`t1`.`row_end` > @`t0` and `test`.`t1`.`row_start` <= @`t0`) where `test`.`t2`.`row_end` > @`t0` and `test`.`t2`.`row_start` <= @`t0`
select * from (select t1.x as IJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x) select * from (select t1.x as IJ2_x1, t1.y as y1, t2.x as x2, t2.y as y2 from t1 inner join t2 on t1.x = t2.x)
for system_time as of timestamp @t0 as t; for system_time as of timestamp @t0 as t;
IJ2_x1 y1 x2 y2 IJ2_x1 y1 x2 y2
@@ -330,7 +330,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) 1 SIMPLE t2 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join)
1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (incremental, BNL join)
Warnings: Warnings:
Note 1003 select `test2`.`t1`.`a` AS `a`,`test2`.`t2`.`a` AS `a` from `test2`.`t1` FOR SYSTEM_TIME ALL left join (`test2`.`t1` FOR SYSTEM_TIME ALL `t2` left join `test2`.`t1` FOR SYSTEM_TIME ALL `t3` on(`test2`.`t3`.`a` = `test2`.`t2`.`a` and `test2`.`t3`.`row_end` = TIMESTAMP'2038-01-19 03:14:07.999999')) on(`test2`.`t2`.`row_end` = TIMESTAMP'2038-01-19 03:14:07.999999' and `test2`.`t1`.`a` > 1) where `test2`.`t1`.`row_end` = TIMESTAMP'2038-01-19 03:14:07.999999' Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`a` AS `a` from `test`.`t1` FOR SYSTEM_TIME ALL left join (`test`.`t1` FOR SYSTEM_TIME ALL `t2` left join `test`.`t1` FOR SYSTEM_TIME ALL `t3` on(`test`.`t3`.`a` = `test`.`t2`.`a` and `test`.`t3`.`row_end` = TIMESTAMP'2038-01-19 03:14:07.999999')) on(`test`.`t2`.`row_end` = TIMESTAMP'2038-01-19 03:14:07.999999' and `test`.`t1`.`a` > 1) where `test`.`t1`.`row_end` = TIMESTAMP'2038-01-19 03:14:07.999999'
select * from t1 left outer join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1; select * from t1 left outer join (t1 as t2 left join t1 as t3 using (a)) on t1.a>1;
a a a a
2 1 2 1
@@ -546,7 +546,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t3 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t4 ALL NULL NULL NULL NULL 2 100.00 Using where; Using join buffer (incremental, BNL join)
Warnings: Warnings:
Note 1003 select `test2`.`t1`.`f1` AS `f1` from `test2`.`t1` FOR SYSTEM_TIME ALL join `test2`.`t2` left join (`test2`.`t3` left join `test2`.`t4` FOR SYSTEM_TIME ALL on(`test2`.`t4`.`f4` = `test2`.`t2`.`f2` and `test2`.`t4`.`row_end` = TIMESTAMP'2038-01-19 03:14:07.999999')) on(`test2`.`t3`.`f3` = `test2`.`t2`.`f2`) where `test2`.`t1`.`row_end` = TIMESTAMP'2038-01-19 03:14:07.999999' Note 1003 select `test`.`t1`.`f1` AS `f1` from `test`.`t1` FOR SYSTEM_TIME ALL join `test`.`t2` left join (`test`.`t3` left join `test`.`t4` FOR SYSTEM_TIME ALL on(`test`.`t4`.`f4` = `test`.`t2`.`f2` and `test`.`t4`.`row_end` = TIMESTAMP'2038-01-19 03:14:07.999999')) on(`test`.`t3`.`f3` = `test`.`t2`.`f2`) where `test`.`t1`.`row_end` = TIMESTAMP'2038-01-19 03:14:07.999999'
drop view v1; drop view v1;
drop table t1, t2, t3, t4; drop table t1, t2, t3, t4;
# #

View File

@@ -93,7 +93,7 @@ drop view v;
create or replace table t (i int); create or replace table t (i int);
create or replace view v as select * from t; create or replace view v as select * from t;
drop table v; drop table v;
ERROR 42S02: 'test2.v' is a view ERROR 42S02: 'test.v' is a view
lock table v write; lock table v write;
delete history from v before system_time now(6); delete history from v before system_time now(6);
ERROR 42S02: 'v' is a view ERROR 42S02: 'v' is a view
@@ -130,6 +130,7 @@ truncate t1;
truncate t2; truncate t2;
ERROR HY000: System-versioned tables do not support TRUNCATE TABLE ERROR HY000: System-versioned tables do not support TRUNCATE TABLE
unlock tables; unlock tables;
drop table t2;
# #
# MDEV-19814 Assertion `update->n_fields < ulint(table->n_cols + table->n_v_cols)' on DELETE HISTORY # MDEV-19814 Assertion `update->n_fields < ulint(table->n_cols + table->n_v_cols)' on DELETE HISTORY
# #

View File

@@ -197,9 +197,7 @@ Warning 1287 '<select expression> INTO <destination>;' is deprecated and will be
select trt_begin_ts(@trx_id) <= @ts1 as BEGIN_TS_GOOD; select trt_begin_ts(@trx_id) <= @ts1 as BEGIN_TS_GOOD;
BEGIN_TS_GOOD BEGIN_TS_GOOD
1 1
drop database test; drop table t1;
create database test;
use test;
# #
# MDEV-16100 FOR SYSTEM_TIME erroneously resolves string user variables as transaction IDs # MDEV-16100 FOR SYSTEM_TIME erroneously resolves string user variables as transaction IDs
# #

View File

@@ -12,7 +12,7 @@ insert into t1 select * from t1;
insert into t1 select * from t1; insert into t1 select * from t1;
insert into t1 select * from t1; insert into t1 select * from t1;
insert into t1 select * from t1; insert into t1 select * from t1;
connect con1,localhost,root,,test2; connect con1,localhost,root,,test;
alter table t1 add system versioning; alter table t1 add system versioning;
connection default; connection default;
update t1 set a= 7 where a = 3; update t1 set a= 7 where a = 3;

View File

@@ -241,3 +241,38 @@ B2 salary
1 2500 1 2500
drop table t1; drop table t1;
drop table t2; drop table t2;
### Issue tempesta-tech/mariadb#365, bug 7 (duplicate of historical row)
create or replace table t1 (a int primary key, b int)
with system versioning engine myisam;
insert into t1 (a) values (1);
replace t1 values (1,2),(1,3),(2,4);
#
# MDEV-14829 Assertion `0' failed in Protocol::end_statement upon concurrent UPDATE
#
create or replace table t1 (pk int, a char(3), b char(3), primary key(pk))
engine=innodb with system versioning;
insert into t1 (pk) values (1);
connect con1,localhost,root,,test;
start transaction;
select * from t1 for update;
pk a b
1 NULL NULL
connection default;
update t1 set b = 'foo';
connection con1;
update t1 set a = 'bar';
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
disconnect con1;
connection default;
drop table t1;
#
# MDEV-19406 Assertion on updating view of join with versioned table
#
create or replace table t1 (pk int primary key, a date, b int, index(b)) engine=innodb with system versioning;
create or replace table t2 (c int);
create or replace view v as select * from t1 join t2;
insert into t1 (pk) values (1);
update t1 set a= '2012-12-12';
update v set a= '2000-01-01' order by b limit 1;
drop view v;
drop table t1, t2;

View File

@@ -1,21 +0,0 @@
### Issue #365, bug 7 (duplicate of historical row)
create or replace table t1 (a int primary key, b int)
with system versioning engine myisam;
insert into t1 (a) values (1);
replace t1 values (1,2),(1,3),(2,4);
create or replace table t1 (pk int, a char(3), b char(3), primary key(pk))
engine=innodb with system versioning;
insert into t1 (pk) values (1);
connect con1,localhost,root,,test;
start transaction;
select * from t1 for update;
pk a b
1 NULL NULL
connection default;
update t1 set b = 'foo';
connection con1;
update t1 set a = 'bar';
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
disconnect con1;
connection default;
drop table t1;

View File

@@ -118,9 +118,8 @@ execute stmt;
a a
execute stmt; execute stmt;
a a
drop database test2; drop view v1;
create database test2; drop tables t1, t2;
use test2;
# #
# MDEV-15146 SQLError[4122]: View is not system versioned # MDEV-15146 SQLError[4122]: View is not system versioned
# #
@@ -148,5 +147,5 @@ create or replace view v1 as select * from t1 for system_time as of date_sub(now
show create view v1; show create view v1;
View Create View character_set_client collation_connection View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` FOR SYSTEM_TIME AS OF TIMESTAMP current_timestamp() - interval 6 second latin1 latin1_swedish_ci v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select `t1`.`i` AS `i` from `t1` FOR SYSTEM_TIME AS OF TIMESTAMP current_timestamp() - interval 6 second latin1 latin1_swedish_ci
drop view v1; drop view v1, vt1, vt12;
drop table t1; drop tables t1, t3;

View File

@@ -68,12 +68,17 @@ select row_start from t;
alter table t drop system versioning; alter table t drop system versioning;
show create table t; show create table t;
--error ER_VERS_NOT_VERSIONED --error ER_VERS_DUPLICATE_ROW_START_END
alter table t add column trx_start timestamp(6) as row start; alter table t add column trx_start timestamp(6) as row start;
alter table t add system versioning; alter table t add system versioning;
show create table t; show create table t;
--error ER_VERS_DUPLICATE_ROW_START_END
alter table t add column trx_start timestamp(6) as row start;
--error ER_VERS_DUPLICATE_ROW_START_END
alter table t modify a int as row start;
alter table t add column b int; alter table t add column b int;
show create table t; show create table t;
@@ -457,7 +462,7 @@ use test;
--echo # MDEV-15956 Strange ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN upon ALTER on versioning column --echo # MDEV-15956 Strange ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN upon ALTER on versioning column
create or replace table t1 (i int, j int as (i), s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning; create or replace table t1 (i int, j int as (i), s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning;
--error ER_VERS_ALTER_SYSTEM_FIELD --error ER_VERS_DUPLICATE_ROW_START_END
alter table t1 modify s timestamp(6) as row start; alter table t1 modify s timestamp(6) as row start;
--echo # ignore CHECK for historical rows --echo # ignore CHECK for historical rows
@@ -575,5 +580,4 @@ alter table t
change column c c int, change column c c int,
change column b b int without system versioning; change column b b int without system versioning;
drop database test; drop table t;
create database test;

View File

@@ -405,5 +405,4 @@ create or replace table t1 (x int without system versioning)
with system versioning with system versioning
select 1 as x; select 1 as x;
drop database test; drop tables t0, t1, t2, t3;
create database test;

View File

@@ -81,5 +81,6 @@ insert into t1 values (1);
update t1 set x= 2; update t1 set x= 2;
delete from t1; delete from t1;
select x from t1 for system_time all; select x from t1 for system_time all;
drop table t1;
--source suite/versioning/common_finish.inc --source suite/versioning/common_finish.inc

View File

@@ -1,8 +0,0 @@
[timestamp]
default-storage-engine=innodb
[trx_id]
default-storage-engine=innodb
[myisam]
default-storage-engine=myisam

View File

@@ -1,11 +1,14 @@
--source suite/versioning/key_type.inc
--source suite/versioning/common.inc --source suite/versioning/common.inc
--echo ################# --echo #################
--echo # Test RESTRICT # --echo # Test RESTRICT #
--echo ################# --echo #################
create table parent( --replace_result "$KEY_TYPE" KEY_TYPE
id int unique key eval create table parent(
id int,
$KEY_TYPE (id)
) engine innodb; ) engine innodb;
--replace_result $sys_datatype_expl SYS_DATATYPE --replace_result $sys_datatype_expl SYS_DATATYPE
@@ -42,8 +45,10 @@ drop table parent;
--echo # Test when clustered index is a foreign key # --echo # Test when clustered index is a foreign key #
--echo ############################################## --echo ##############################################
create table parent( --replace_result "$KEY_TYPE" KEY_TYPE
id int(10) unsigned unique key eval create table parent(
id int(10) unsigned,
$KEY_TYPE (id)
) engine innodb; ) engine innodb;
--replace_result $sys_datatype_expl SYS_DATATYPE --replace_result $sys_datatype_expl SYS_DATATYPE
@@ -68,8 +73,10 @@ drop table parent;
--echo # Test CASCADE # --echo # Test CASCADE #
--echo ################ --echo ################
create table parent( --replace_result "$KEY_TYPE" KEY_TYPE
id int unique key eval create table parent(
id int,
$KEY_TYPE (id)
) engine innodb; ) engine innodb;
--replace_result $sys_datatype_expl SYS_DATATYPE --replace_result $sys_datatype_expl SYS_DATATYPE
@@ -99,9 +106,10 @@ select * from child for system_time all;
drop table child; drop table child;
drop table parent; drop table parent;
--replace_result $sys_datatype_expl SYS_DATATYPE --replace_result $sys_datatype_expl SYS_DATATYPE "$KEY_TYPE" KEY_TYPE
eval create or replace table parent ( eval create or replace table parent (
id int primary key, id int,
$KEY_TYPE(id),
sys_start $sys_datatype_expl as row start invisible, sys_start $sys_datatype_expl as row start invisible,
sys_end $sys_datatype_expl as row end invisible, sys_end $sys_datatype_expl as row end invisible,
period for system_time(sys_start, sys_end) period for system_time(sys_start, sys_end)
@@ -126,8 +134,10 @@ select * from child;
drop table child; drop table child;
drop table parent; drop table parent;
create or replace table parent ( --replace_result "$KEY_TYPE" KEY_TYPE
id int primary key eval create or replace table parent (
id int,
$KEY_TYPE(id)
) )
engine innodb; engine innodb;
@@ -158,8 +168,10 @@ drop table parent;
--echo # Test SET NULL # --echo # Test SET NULL #
--echo ################# --echo #################
create or replace table parent( --replace_result "$KEY_TYPE" KEY_TYPE
id int unique key eval create table parent(
id int,
$KEY_TYPE (id)
) engine innodb; ) engine innodb;
--replace_result $sys_datatype_expl SYS_DATATYPE --replace_result $sys_datatype_expl SYS_DATATYPE
@@ -196,9 +208,10 @@ drop table parent;
--echo # Parent table is foreign # --echo # Parent table is foreign #
--echo ########################### --echo ###########################
--replace_result $sys_datatype_expl SYS_DATATYPE --replace_result $sys_datatype_expl SYS_DATATYPE "$KEY_TYPE" KEY_TYPE
eval create or replace table parent( eval create or replace table parent(
id int unique key, id int,
$KEY_TYPE (id),
sys_start $sys_datatype_expl as row start invisible, sys_start $sys_datatype_expl as row start invisible,
sys_end $sys_datatype_expl as row end invisible, sys_end $sys_datatype_expl as row end invisible,
period for system_time(sys_start, sys_end) period for system_time(sys_start, sys_end)
@@ -236,9 +249,10 @@ drop table parent;
--echo # crash on DELETE # --echo # crash on DELETE #
--echo ################### --echo ###################
--replace_result $sys_datatype_expl SYS_DATATYPE --replace_result $sys_datatype_expl SYS_DATATYPE "$KEY_TYPE" KEY_TYPE
eval create or replace table a ( eval create or replace table a (
cola int(10) primary key, cola int(10),
$KEY_TYPE (cola),
v_cola int(10) as (cola mod 10) virtual, v_cola int(10) as (cola mod 10) virtual,
sys_start $sys_datatype_expl as row start invisible, sys_start $sys_datatype_expl as row start invisible,
sys_end $sys_datatype_expl as row end invisible, sys_end $sys_datatype_expl as row end invisible,
@@ -316,19 +330,21 @@ select count(*) from subchild;
drop table subchild, child, parent; drop table subchild, child, parent;
--echo #
--echo # MDEV-18057 Assertion `(node->state == 5) || (node->state == 6)' failed in row_upd_sec_step upon DELETE after UPDATE failed due to FK violation
--echo #
create or replace table t1 (f1 int, key(f1)) engine=innodb;
create or replace table t2 (f2 int, foreign key (f2) references t1 (f1)) engine=innodb with system versioning;
CREATE TABLE t1 (f1 INT, KEY(f1)) ENGINE=InnoDB; set foreign_key_checks= off;
CREATE TABLE t2 (f2 INT, FOREIGN KEY (f2) REFERENCES t1 (f1)) ENGINE=InnoDB WITH SYSTEM VERSIONING; insert ignore into t2 values (1);
SET FOREIGN_KEY_CHECKS= OFF; set foreign_key_checks= on;
INSERT IGNORE INTO t2 VALUES (1);
SET FOREIGN_KEY_CHECKS= ON;
--error ER_NO_REFERENCED_ROW_2 --error ER_NO_REFERENCED_ROW_2
UPDATE t2 SET f2= 2; update t2 set f2= 2;
DELETE FROM t2; delete from t2;
DROP TABLE t2, t1; drop table t2, t1;
--echo # --echo #
--echo # MDEV-18879 Corrupted record inserted by FOREIGN KEY operation --echo # MDEV-18879 Corrupted record inserted by FOREIGN KEY operation
@@ -406,8 +422,8 @@ REPLACE INTO t2 SELECT * FROM t2;
# Cleanup # Cleanup
DROP TABLE t1, t2; DROP TABLE t1, t2;
--let $datadir= `select @@datadir` --let $datadir= `select @@datadir`
--remove_file $datadir/test2/t1.data --remove_file $datadir/test/t1.data
--remove_file $datadir/test2/t1.data.2 --remove_file $datadir/test/t1.data.2
--remove_file $datadir/test2/t2.data --remove_file $datadir/test/t2.data
--source suite/versioning/common_finish.inc --source suite/versioning/common_finish.inc

View File

@@ -107,7 +107,7 @@ insert into t values (1, 1);
select c.prtype from information_schema.innodb_sys_columns as c select c.prtype from information_schema.innodb_sys_columns as c
join information_schema.innodb_sys_tables as t on c.table_id=t.table_id join information_schema.innodb_sys_tables as t on c.table_id=t.table_id
where t.name='test2/t' and c.name='b'; where t.name='test/t' and c.name='b';
set @@system_versioning_alter_history=keep; set @@system_versioning_alter_history=keep;
@@ -125,7 +125,7 @@ set debug_dbug= default;
select c.prtype from information_schema.innodb_sys_columns as c select c.prtype from information_schema.innodb_sys_columns as c
join information_schema.innodb_sys_tables as t on c.table_id=t.table_id join information_schema.innodb_sys_tables as t on c.table_id=t.table_id
where t.name='test2/t' and c.name='b'; where t.name='test/t' and c.name='b';
--replace_result $sys_datatype_expl SYS_DATATYPE --replace_result $sys_datatype_expl SYS_DATATYPE
show create table t; show create table t;
@@ -193,7 +193,6 @@ create or replace table t1 (
) with system versioning; ) with system versioning;
alter table t1 drop system versioning; alter table t1 drop system versioning;
drop database test; drop tables t, t1;
create database test;
--source suite/versioning/common_finish.inc --source suite/versioning/common_finish.inc

View File

@@ -393,17 +393,17 @@ partition by system_time interval 1 hour (
partition p0 history, partition pn current); partition p0 history, partition pn current);
set @ts=(select partition_description from information_schema.partitions set @ts=(select partition_description from information_schema.partitions
where table_schema='test2' and table_name='t1' and partition_name='p0'); where table_schema='test' and table_name='t1' and partition_name='p0');
alter table t1 add column b int; alter table t1 add column b int;
select partition_name,partition_ordinal_position,partition_method,timediff(partition_description, @ts) from information_schema.partitions where table_schema='test2' and table_name='t1'; select partition_name,partition_ordinal_position,partition_method,timediff(partition_description, @ts) from information_schema.partitions where table_schema='test' and table_name='t1';
alter table t1 add partition (partition p1 history, partition p2 history); alter table t1 add partition (partition p1 history, partition p2 history);
select partition_name,partition_ordinal_position,partition_method,timediff(partition_description, @ts) from information_schema.partitions where table_schema='test2' and table_name='t1'; select partition_name,partition_ordinal_position,partition_method,timediff(partition_description, @ts) from information_schema.partitions where table_schema='test' and table_name='t1';
alter table t1 drop partition p0; alter table t1 drop partition p0;
select partition_name,partition_ordinal_position,partition_method,timediff(partition_description, @ts) from information_schema.partitions where table_schema='test2' and table_name='t1'; select partition_name,partition_ordinal_position,partition_method,timediff(partition_description, @ts) from information_schema.partitions where table_schema='test' and table_name='t1';
--error ER_VERS_DROP_PARTITION_INTERVAL --error ER_VERS_DROP_PARTITION_INTERVAL
alter table t1 drop partition p2; alter table t1 drop partition p2;
select partition_name,partition_ordinal_position,partition_method,timediff(partition_description, @ts) from information_schema.partitions where table_schema='test2' and table_name='t1'; select partition_name,partition_ordinal_position,partition_method,timediff(partition_description, @ts) from information_schema.partitions where table_schema='test' and table_name='t1';
--echo # --echo #
--echo # MDEV-15103 Assertion in ha_partition::part_records() for updating VIEW --echo # MDEV-15103 Assertion in ha_partition::part_records() for updating VIEW
@@ -504,6 +504,8 @@ unlock tables;
--echo # --echo #
create or replace table t1 (pk int primary key) with system versioning partition by system_time limit 100 (partition p1 history, partition pn current); create or replace table t1 (pk int primary key) with system versioning partition by system_time limit 100 (partition p1 history, partition pn current);
execute immediate 'select * from t1 for update'; execute immediate 'select * from t1 for update';
drop table t1;
drop view v1;
drop tables t, t1, t2, t3, t4;
--source suite/versioning/common_finish.inc --source suite/versioning/common_finish.inc

View File

@@ -28,6 +28,8 @@ alter table t1 partition by system_time (
partition pn current partition pn current
); );
drop table t1;
--error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED --error ER_VERS_TRX_PART_HISTORIC_ROW_NOT_SUPPORTED
create or replace table t ( create or replace table t (
a int primary key, a int primary key,

View File

@@ -1,13 +1,19 @@
--source suite/versioning/key_type.inc
if ($MTR_COMBINATION_SEC)
{
--skip pk or unique only
}
--source suite/versioning/common.inc --source suite/versioning/common.inc
--source suite/versioning/engines.inc --source suite/versioning/engines.inc
--replace_result $sys_datatype_expl SYS_DATATYPE --replace_result $sys_datatype_expl SYS_DATATYPE "$KEY_TYPE" KEY_TYPE
eval create table t ( eval create or replace table t(
id int primary key, id int,
$KEY_TYPE(id),
x int, x int,
row_start $sys_datatype_expl as row start invisible, row_start $sys_datatype_expl as row start invisible,
row_end $sys_datatype_expl as row end invisible, row_end $sys_datatype_expl as row end invisible,
period for system_time (row_start, row_end) period for system_time(row_start, row_end)
) with system versioning; ) with system versioning;
insert t values (1, 2); insert t values (1, 2);
@@ -35,7 +41,8 @@ insert into t1 values (1,1);
create or replace table t2 (c int); create or replace table t2 (c int);
create or replace view v as select t1.* from t1 join t2; create or replace view v as select t1.* from t1 join t2;
replace into v (a, b) select a, b from t1; replace into v (a, b) select a, b from t1;
drop table t1; drop view v;
drop tables t1, t2;
--replace_result $sys_datatype_expl SYS_DATATYPE --replace_result $sys_datatype_expl SYS_DATATYPE
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (

View File

@@ -144,6 +144,7 @@ truncate t1;
truncate t2; truncate t2;
unlock tables; unlock tables;
drop table t2;
--echo # --echo #
--echo # MDEV-19814 Assertion `update->n_fields < ulint(table->n_cols + table->n_v_cols)' on DELETE HISTORY --echo # MDEV-19814 Assertion `update->n_fields < ulint(table->n_cols + table->n_v_cols)' on DELETE HISTORY

View File

@@ -173,10 +173,7 @@ commit;
select row_start from t1 into @trx_id; select row_start from t1 into @trx_id;
select trt_begin_ts(@trx_id) <= @ts1 as BEGIN_TS_GOOD; select trt_begin_ts(@trx_id) <= @ts1 as BEGIN_TS_GOOD;
drop database test; drop table t1;
create database test;
use test;
--echo # --echo #
--echo # MDEV-16100 FOR SYSTEM_TIME erroneously resolves string user variables as transaction IDs --echo # MDEV-16100 FOR SYSTEM_TIME erroneously resolves string user variables as transaction IDs

View File

@@ -17,7 +17,7 @@ insert into t1 select * from t1;
insert into t1 select * from t1; insert into t1 select * from t1;
insert into t1 select * from t1; insert into t1 select * from t1;
--connect (con1,localhost,root,,test2) --connect (con1,localhost,root,,test)
alter table t1 add system versioning; alter table t1 add system versioning;
--connection default --connection default

View File

@@ -147,4 +147,49 @@ select @tmp2 = sys_trx_start as B2, salary from t2;
drop table t1; drop table t1;
drop table t2; drop table t2;
--echo ### Issue tempesta-tech/mariadb#365, bug 7 (duplicate of historical row)
create or replace table t1 (a int primary key, b int)
with system versioning engine myisam;
insert into t1 (a) values (1);
replace t1 values (1,2),(1,3),(2,4);
--echo #
--echo # MDEV-14829 Assertion `0' failed in Protocol::end_statement upon concurrent UPDATE
--echo #
create or replace table t1 (pk int, a char(3), b char(3), primary key(pk))
engine=innodb with system versioning;
insert into t1 (pk) values (1);
connect (con1,localhost,root,,test);
start transaction;
select * from t1 for update;
connection default;
send update t1 set b = 'foo';
connection con1;
let $wait_condition= select count(*) from information_schema.innodb_lock_waits;
source include/wait_condition.inc;
error ER_LOCK_DEADLOCK;
update t1 set a = 'bar';
disconnect con1;
connection default;
reap;
drop table t1;
--echo #
--echo # MDEV-19406 Assertion on updating view of join with versioned table
--echo #
--disable_warnings
create or replace table t1 (pk int primary key, a date, b int, index(b)) engine=innodb with system versioning;
create or replace table t2 (c int);
create or replace view v as select * from t1 join t2;
insert into t1 (pk) values (1);
update t1 set a= '2012-12-12';
update v set a= '2000-01-01' order by b limit 1; # point of failure
drop view v;
drop table t1, t2;
--enable_warnings
source suite/versioning/common_finish.inc; source suite/versioning/common_finish.inc;

View File

@@ -1,31 +0,0 @@
source include/have_innodb.inc;
echo ### Issue #365, bug 7 (duplicate of historical row);
create or replace table t1 (a int primary key, b int)
with system versioning engine myisam;
insert into t1 (a) values (1);
replace t1 values (1,2),(1,3),(2,4);
#
# MDEV-14829 Assertion `0' failed in Protocol::end_statement upon concurrent UPDATE
#
create or replace table t1 (pk int, a char(3), b char(3), primary key(pk))
engine=innodb with system versioning;
insert into t1 (pk) values (1);
connect (con1,localhost,root,,test);
start transaction;
select * from t1 for update;
connection default;
send update t1 set b = 'foo';
connection con1;
let $wait_condition= select count(*) from information_schema.innodb_lock_waits;
source include/wait_condition.inc;
error ER_LOCK_DEADLOCK;
update t1 set a = 'bar';
disconnect con1;
connection default;
reap;
drop table t1;

View File

@@ -98,9 +98,8 @@ create or replace table t2 (b int) with system versioning;
prepare stmt from 'select a from v1 inner join t2 group by a order by a'; prepare stmt from 'select a from v1 inner join t2 group by a order by a';
execute stmt; execute stmt;
execute stmt; execute stmt;
drop database test2; drop view v1;
create database test2; drop tables t1, t2;
use test2;
--echo # --echo #
--echo # MDEV-15146 SQLError[4122]: View is not system versioned --echo # MDEV-15146 SQLError[4122]: View is not system versioned
@@ -122,7 +121,7 @@ select * from t1 for system_time as of now() - interval 6 second;
create or replace view v1 as select * from t1 for system_time as of date_sub(now(), interval 6 second); create or replace view v1 as select * from t1 for system_time as of date_sub(now(), interval 6 second);
show create view v1; show create view v1;
drop view v1; drop view v1, vt1, vt12;
drop table t1; drop tables t1, t3;
--source suite/versioning/common_finish.inc --source suite/versioning/common_finish.inc

View File

@@ -12,5 +12,6 @@ eval SET @@global.wsrep_provider='$WSREP_PROVIDER';
--enable_query_log --enable_query_log
SHOW STATUS LIKE 'wsrep_ready'; SHOW STATUS LIKE 'wsrep_ready';
SET @@global.wsrep_cluster_address='gcomm://'; SET @@global.wsrep_cluster_address='gcomm://';
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
--echo # End of test. --echo # End of test.

View File

@@ -20,7 +20,6 @@
#include <my_list.h> #include <my_list.h>
#ifdef HAVE_MLOCK #ifdef HAVE_MLOCK
#include <sys/mman.h>
struct st_mem_list struct st_mem_list
{ {

View File

@@ -221,6 +221,6 @@ maria_declare_plugin(pam)
NULL, NULL,
vars, vars,
"2.0", "2.0",
MariaDB_PLUGIN_MATURITY_GAMMA MariaDB_PLUGIN_MATURITY_STABLE
} }
maria_declare_plugin_end; maria_declare_plugin_end;

View File

@@ -28,11 +28,6 @@
There is no reference counting and no unloading either. There is no reference counting and no unloading either.
*/ */
#if defined(_MSC_VER)
/* Silence warnings about variable 'unused' being used. */
#define FORCE_INIT_OF_VARS 1
#endif
#include <my_global.h> #include <my_global.h>
#include "mysql.h" #include "mysql.h"
#include <my_sys.h> #include <my_sys.h>
@@ -243,12 +238,12 @@ int mysql_client_plugin_init()
struct st_mysql_client_plugin **builtin; struct st_mysql_client_plugin **builtin;
va_list unused; va_list unused;
DBUG_ENTER("mysql_client_plugin_init"); DBUG_ENTER("mysql_client_plugin_init");
LINT_INIT_STRUCT(unused);
if (initialized) if (initialized)
DBUG_RETURN(0); DBUG_RETURN(0);
bzero(&mysql, sizeof(mysql)); /* dummy mysql for set_mysql_extended_error */ bzero(&mysql, sizeof(mysql)); /* dummy mysql for set_mysql_extended_error */
bzero(&unused, sizeof unused);
mysql_mutex_init(0, &LOCK_load_client_plugin, MY_MUTEX_INIT_SLOW); mysql_mutex_init(0, &LOCK_load_client_plugin, MY_MUTEX_INIT_SLOW);
init_alloc_root(&mem_root, "client_plugin", 128, 128, MYF(0)); init_alloc_root(&mem_root, "client_plugin", 128, 128, MYF(0));
@@ -306,9 +301,7 @@ struct st_mysql_client_plugin *
mysql_client_register_plugin(MYSQL *mysql, mysql_client_register_plugin(MYSQL *mysql,
struct st_mysql_client_plugin *plugin) struct st_mysql_client_plugin *plugin)
{ {
va_list unused;
DBUG_ENTER("mysql_client_register_plugin"); DBUG_ENTER("mysql_client_register_plugin");
LINT_INIT_STRUCT(unused);
if (is_not_initialized(mysql, plugin->name)) if (is_not_initialized(mysql, plugin->name))
DBUG_RETURN(NULL); DBUG_RETURN(NULL);
@@ -324,7 +317,11 @@ mysql_client_register_plugin(MYSQL *mysql,
plugin= NULL; plugin= NULL;
} }
else else
{
va_list unused;
bzero(&unused, sizeof unused);
plugin= add_plugin(mysql, plugin, 0, 0, unused); plugin= add_plugin(mysql, plugin, 0, 0, unused);
}
mysql_mutex_unlock(&LOCK_load_client_plugin); mysql_mutex_unlock(&LOCK_load_client_plugin);
DBUG_RETURN(plugin); DBUG_RETURN(plugin);

View File

@@ -92,6 +92,7 @@ public:
bool auto_inc_initialized; bool auto_inc_initialized;
mysql_mutex_t auto_inc_mutex; /**< protecting auto_inc val */ mysql_mutex_t auto_inc_mutex; /**< protecting auto_inc val */
ulonglong next_auto_inc_val; /**< first non reserved value */ ulonglong next_auto_inc_val; /**< first non reserved value */
ulonglong prev_auto_inc_val; /**< stored next_auto_inc_val */
/** /**
Hash of partition names. Initialized in the first ha_partition::open() Hash of partition names. Initialized in the first ha_partition::open()
for the table_share. After that it is read-only, i.e. no locking required. for the table_share. After that it is read-only, i.e. no locking required.
@@ -103,6 +104,7 @@ public:
Partition_share() Partition_share()
: auto_inc_initialized(false), : auto_inc_initialized(false),
next_auto_inc_val(0), next_auto_inc_val(0),
prev_auto_inc_val(0),
partition_name_hash_initialized(false), partition_name_hash_initialized(false),
partition_names(NULL) partition_names(NULL)
{ {
@@ -371,6 +373,24 @@ private:
MY_BITMAP m_locked_partitions; MY_BITMAP m_locked_partitions;
/** Stores shared auto_increment etc. */ /** Stores shared auto_increment etc. */
Partition_share *part_share; Partition_share *part_share;
/** Fix spurious -Werror=overloaded-virtual in GCC 9 */
virtual void restore_auto_increment(ulonglong prev_insert_id)
{
handler::restore_auto_increment(prev_insert_id);
}
/** Store and restore next_auto_inc_val over duplicate key errors. */
virtual void store_auto_increment()
{
DBUG_ASSERT(part_share);
part_share->prev_auto_inc_val= part_share->next_auto_inc_val;
handler::store_auto_increment();
}
virtual void restore_auto_increment()
{
DBUG_ASSERT(part_share);
part_share->next_auto_inc_val= part_share->prev_auto_inc_val;
handler::restore_auto_increment();
}
/** Temporary storage for new partitions Handler_shares during ALTER */ /** Temporary storage for new partitions Handler_shares during ALTER */
List<Parts_share_refs> m_new_partitions_share_refs; List<Parts_share_refs> m_new_partitions_share_refs;
/** Sorted array of partition ids in descending order of number of rows. */ /** Sorted array of partition ids in descending order of number of rows. */

View File

@@ -7464,13 +7464,15 @@ bool Vers_parse_info::fix_alter_info(THD *thd, Alter_info *alter_info,
return false; return false;
} }
if (!(alter_info->flags & ALTER_ADD_SYSTEM_VERSIONING))
{ {
List_iterator_fast<Create_field> it(alter_info->create_list); List_iterator_fast<Create_field> it(alter_info->create_list);
while (Create_field *f= it++) while (Create_field *f= it++)
{ {
if (f->change.length && f->flags & VERS_SYSTEM_FIELD) if (f->flags & VERS_SYSTEM_FIELD)
{ {
my_error(ER_VERS_ALTER_SYSTEM_FIELD, MYF(0), f->field_name.str); my_error(ER_VERS_DUPLICATE_ROW_START_END, MYF(0),
f->flags & VERS_SYS_START_FLAG ? "START" : "END", f->field_name.str);
return true; return true;
} }
} }

View File

@@ -3119,6 +3119,10 @@ private:
*/ */
Handler_share **ha_share; Handler_share **ha_share;
/** Stores next_insert_id for handling duplicate key errors. */
ulonglong m_prev_insert_id;
public: public:
handler(handlerton *ht_arg, TABLE_SHARE *share_arg) handler(handlerton *ht_arg, TABLE_SHARE *share_arg)
:table_share(share_arg), table(0), :table_share(share_arg), table(0),
@@ -3143,7 +3147,7 @@ public:
auto_inc_intervals_count(0), auto_inc_intervals_count(0),
m_psi(NULL), set_top_table_fields(FALSE), top_table(0), m_psi(NULL), set_top_table_fields(FALSE), top_table(0),
top_table_field(0), top_table_fields(0), top_table_field(0), top_table_fields(0),
m_lock_type(F_UNLCK), ha_share(NULL) m_lock_type(F_UNLCK), ha_share(NULL), m_prev_insert_id(0)
{ {
DBUG_PRINT("info", DBUG_PRINT("info",
("handler created F_UNLCK %d F_RDLCK %d F_WRLCK %d", ("handler created F_UNLCK %d F_RDLCK %d F_WRLCK %d",
@@ -3806,7 +3810,7 @@ public:
DBUG_PRINT("info",("auto_increment: next value %lu", (ulong)id)); DBUG_PRINT("info",("auto_increment: next value %lu", (ulong)id));
next_insert_id= id; next_insert_id= id;
} }
void restore_auto_increment(ulonglong prev_insert_id) virtual void restore_auto_increment(ulonglong prev_insert_id)
{ {
/* /*
Insertion of a row failed, re-use the lastly generated auto_increment Insertion of a row failed, re-use the lastly generated auto_increment
@@ -3822,6 +3826,16 @@ public:
insert_id_for_cur_row; insert_id_for_cur_row;
} }
/** Store and restore next_insert_id over duplicate key errors. */
virtual void store_auto_increment()
{
m_prev_insert_id= next_insert_id;
}
virtual void restore_auto_increment()
{
restore_auto_increment(m_prev_insert_id);
}
virtual void update_create_info(HA_CREATE_INFO *create_info) {} virtual void update_create_info(HA_CREATE_INFO *create_info) {}
int check_old_types(); int check_old_types();
virtual int assign_to_keycache(THD* thd, HA_CHECK_OPT* check_opt) virtual int assign_to_keycache(THD* thd, HA_CHECK_OPT* check_opt)

View File

@@ -1110,6 +1110,19 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
alg != BINLOG_CHECKSUM_ALG_OFF)) alg != BINLOG_CHECKSUM_ALG_OFF))
event_len= event_len - BINLOG_CHECKSUM_LEN; event_len= event_len - BINLOG_CHECKSUM_LEN;
/*
Create an object of Ignorable_log_event for unrecognized sub-class.
So that SLAVE SQL THREAD will only update the position and continue.
We should look for this flag first instead of judging by event_type
Any event can be Ignorable_log_event if it has this flag on.
look into @note of Ignorable_log_event
*/
if (uint2korr(buf + FLAGS_OFFSET) & LOG_EVENT_IGNORABLE_F)
{
ev= new Ignorable_log_event(buf, fdle,
get_type_str((Log_event_type) event_type));
goto exit;
}
switch(event_type) { switch(event_type) {
case QUERY_EVENT: case QUERY_EVENT:
ev = new Query_log_event(buf, event_len, fdle, QUERY_EVENT); ev = new Query_log_event(buf, event_len, fdle, QUERY_EVENT);
@@ -1236,24 +1249,13 @@ Log_event* Log_event::read_log_event(const char* buf, uint event_len,
ev = new Start_encryption_log_event(buf, event_len, fdle); ev = new Start_encryption_log_event(buf, event_len, fdle);
break; break;
default: default:
/* DBUG_PRINT("error",("Unknown event code: %d",
Create an object of Ignorable_log_event for unrecognized sub-class. (uchar) buf[EVENT_TYPE_OFFSET]));
So that SLAVE SQL THREAD will only update the position and continue. ev= NULL;
*/ break;
if (uint2korr(buf + FLAGS_OFFSET) & LOG_EVENT_IGNORABLE_F)
{
ev= new Ignorable_log_event(buf, fdle,
get_type_str((Log_event_type) event_type));
}
else
{
DBUG_PRINT("error",("Unknown event code: %d",
(uchar) buf[EVENT_TYPE_OFFSET]));
ev= NULL;
break;
}
} }
} }
exit:
if (ev) if (ev)
{ {

View File

@@ -1284,16 +1284,18 @@ static size_t calc_field_event_length(const uchar *ptr, uint type, uint meta)
case MYSQL_TYPE_SET: case MYSQL_TYPE_SET:
return meta & 0xFF; return meta & 0xFF;
case MYSQL_TYPE_BLOB: case MYSQL_TYPE_BLOB:
if (meta > 4 ) switch (meta) {
default:
return 0; return 0;
if (meta == 1) case 1:
return *ptr + 1; return *ptr + 1;
if (meta == 2) case 2:
return uint2korr(ptr) + 2; return uint2korr(ptr) + 2;
if (meta == 3) case 3:
return uint3korr(ptr) + 3; return uint3korr(ptr) + 3;
if (meta == 4) case 4:
return uint4korr(ptr) + 4; return uint4korr(ptr) + 4;
}
case MYSQL_TYPE_VARCHAR: case MYSQL_TYPE_VARCHAR:
case MYSQL_TYPE_VAR_STRING: case MYSQL_TYPE_VAR_STRING:
length= meta; length= meta;

View File

@@ -7047,6 +7047,7 @@ Rows_log_event::write_row(rpl_group_info *rgi,
{ {
ulong sec_part; ulong sec_part;
bitmap_set_bit(table->read_set, table->vers_start_field()->field_index); bitmap_set_bit(table->read_set, table->vers_start_field()->field_index);
table->file->column_bitmaps_signal();
// Check whether a row came from unversioned table and fix vers fields. // Check whether a row came from unversioned table and fix vers fields.
if (table->vers_start_field()->get_timestamp(&sec_part) == 0 && sec_part == 0) if (table->vers_start_field()->get_timestamp(&sec_part) == 0 && sec_part == 0)
table->vers_update_fields(); table->vers_update_fields();
@@ -7573,6 +7574,7 @@ int Rows_log_event::find_row(rpl_group_info *rgi)
table->vers_end_field()->set_max(); table->vers_end_field()->set_max();
m_vers_from_plain= true; m_vers_from_plain= true;
} }
table->file->column_bitmaps_signal();
} }
DBUG_PRINT("info",("looking for the following record")); DBUG_PRINT("info",("looking for the following record"));

View File

@@ -163,16 +163,11 @@ extern "C" { // Because of SCO 3.2V4.2
#include <my_libwrap.h> #include <my_libwrap.h>
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
#endif
#ifdef __WIN__ #ifdef __WIN__
#include <crtdbg.h> #include <crtdbg.h>
#endif #endif
#ifdef HAVE_SOLARIS_LARGE_PAGES #ifdef HAVE_SOLARIS_LARGE_PAGES
#include <sys/mman.h>
#if defined(__sun__) && defined(__GNUC__) && defined(__cplusplus) \ #if defined(__sun__) && defined(__GNUC__) && defined(__cplusplus) \
&& defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE)
extern int getpagesizes(size_t *, int); extern int getpagesizes(size_t *, int);

View File

@@ -315,7 +315,7 @@ public:
*/ */
key_map possible_keys; key_map possible_keys;
longlong baseflag; longlong baseflag;
uint max_key_part, range_count; uint max_key_parts, range_count;
bool quick; // Don't calulate possible keys bool quick; // Don't calulate possible keys
@@ -7397,7 +7397,7 @@ static TRP_RANGE *get_key_scans_params(PARAM *param, SEL_TREE *tree,
index_scan->idx= idx; index_scan->idx= idx;
index_scan->keynr= keynr; index_scan->keynr= keynr;
index_scan->key_info= &param->table->key_info[keynr]; index_scan->key_info= &param->table->key_info[keynr];
index_scan->used_key_parts= param->max_key_part+1; index_scan->used_key_parts= param->max_key_parts;
index_scan->range_count= param->range_count; index_scan->range_count= param->range_count;
index_scan->records= found_records; index_scan->records= found_records;
index_scan->sel_arg= key; index_scan->sel_arg= key;
@@ -11036,7 +11036,7 @@ ha_rows check_quick_select(PARAM *param, uint idx, bool index_only,
seq.start= tree; seq.start= tree;
param->range_count=0; param->range_count=0;
param->max_key_part=0; param->max_key_parts=0;
seq.is_ror_scan= TRUE; seq.is_ror_scan= TRUE;
if (file->index_flags(keynr, 0, TRUE) & HA_KEY_SCAN_NOT_ROR) if (file->index_flags(keynr, 0, TRUE) & HA_KEY_SCAN_NOT_ROR)
@@ -11049,9 +11049,13 @@ ha_rows check_quick_select(PARAM *param, uint idx, bool index_only,
*mrr_flags|= HA_MRR_NO_ASSOCIATION | HA_MRR_SORTED; *mrr_flags|= HA_MRR_NO_ASSOCIATION | HA_MRR_SORTED;
bool pk_is_clustered= file->primary_key_is_clustered(); bool pk_is_clustered= file->primary_key_is_clustered();
// TODO: param->max_key_parts holds 0 now, and not the #keyparts used.
// Passing wrong second argument to index_flags() makes no difference for
// most storage engines but might be an issue for MyRocks with certain
// datatypes.
if (index_only && if (index_only &&
(file->index_flags(keynr, param->max_key_part, 1) & HA_KEYREAD_ONLY) && (file->index_flags(keynr, param->max_key_parts, 1) & HA_KEYREAD_ONLY) &&
!(file->index_flags(keynr, param->max_key_part, 1) & HA_CLUSTERED_INDEX)) !(file->index_flags(keynr, param->max_key_parts, 1) & HA_CLUSTERED_INDEX))
*mrr_flags |= HA_MRR_INDEX_ONLY; *mrr_flags |= HA_MRR_INDEX_ONLY;
if (param->thd->lex->sql_command != SQLCOM_SELECT) if (param->thd->lex->sql_command != SQLCOM_SELECT)
@@ -11082,7 +11086,7 @@ ha_rows check_quick_select(PARAM *param, uint idx, bool index_only,
if (update_tbl_stats) if (update_tbl_stats)
{ {
param->table->quick_keys.set_bit(keynr); param->table->quick_keys.set_bit(keynr);
param->table->quick_key_parts[keynr]= param->max_key_part+1; param->table->quick_key_parts[keynr]= param->max_key_parts;
param->table->quick_n_ranges[keynr]= param->range_count; param->table->quick_n_ranges[keynr]= param->range_count;
param->table->quick_condition_rows= param->table->quick_condition_rows=
MY_MIN(param->table->quick_condition_rows, rows); MY_MIN(param->table->quick_condition_rows, rows);

View File

@@ -247,6 +247,7 @@ walk_up_n_right:
uint min_key_length= (uint)(cur->min_key - seq->param->min_key); uint min_key_length= (uint)(cur->min_key - seq->param->min_key);
range->ptr= (char*)(intptr)(key_tree->part); range->ptr= (char*)(intptr)(key_tree->part);
uint max_key_parts;
if (cur->min_key_flag & GEOM_FLAG) if (cur->min_key_flag & GEOM_FLAG)
{ {
range->range_flag= cur->min_key_flag; range->range_flag= cur->min_key_flag;
@@ -256,9 +257,11 @@ walk_up_n_right:
range->start_key.length= min_key_length; range->start_key.length= min_key_length;
range->start_key.keypart_map= make_prev_keypart_map(cur->min_key_parts); range->start_key.keypart_map= make_prev_keypart_map(cur->min_key_parts);
range->start_key.flag= (ha_rkey_function) (cur->min_key_flag ^ GEOM_FLAG); range->start_key.flag= (ha_rkey_function) (cur->min_key_flag ^ GEOM_FLAG);
max_key_parts= cur->min_key_parts;
} }
else else
{ {
max_key_parts= MY_MAX(cur->min_key_parts, cur->max_key_parts);
range->range_flag= cur->min_key_flag | cur->max_key_flag; range->range_flag= cur->min_key_flag | cur->max_key_flag;
range->start_key.key= seq->param->min_key; range->start_key.key= seq->param->min_key;
@@ -336,7 +339,7 @@ walk_up_n_right:
} }
} }
seq->param->range_count++; seq->param->range_count++;
seq->param->max_key_part=MY_MAX(seq->param->max_key_part,key_tree->part); seq->param->max_key_parts= MY_MAX(seq->param->max_key_parts, max_key_parts);
return 0; return 0;
} }

Some files were not shown because too many files have changed in this diff Show More