Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3

This commit is contained in:
Alexander Barkov 2017-05-07 23:51:18 +04:00
commit 314350a722
382 changed files with 13686 additions and 3236 deletions

View file

@ -114,7 +114,8 @@ static my_bool verbose= 0, opt_no_create_info= 0, opt_no_data= 0, opt_no_data_m
opt_slave_apply= 0,
opt_include_master_host_port= 0,
opt_events= 0, opt_comments_used= 0,
opt_alltspcs=0, opt_notspcs= 0, opt_logging;
opt_alltspcs=0, opt_notspcs= 0, opt_logging,
opt_drop_trigger= 0 ;
static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0;
static ulong opt_max_allowed_packet, opt_net_buffer_length;
static MYSQL mysql_connection,*mysql=0;
@ -233,6 +234,9 @@ static struct my_option my_long_options[] =
{"add-drop-table", OPT_DROP, "Add a DROP TABLE before each create.",
&opt_drop, &opt_drop, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
0},
{"add-drop-trigger", 0, "Add a DROP TRIGGER before each create.",
&opt_drop_trigger, &opt_drop_trigger, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0,
0},
{"add-locks", OPT_LOCKS, "Add locks around INSERT statements.",
&opt_lock, &opt_lock, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0,
0},
@ -3281,6 +3285,10 @@ static void dump_trigger_old(FILE *sql_file, MYSQL_RES *show_triggers_rs,
if (opt_compact)
fprintf(sql_file, "/*!50003 SET @OLD_SQL_MODE=@@SQL_MODE*/;\n");
if (opt_drop_trigger)
fprintf(sql_file, "/*!50032 DROP TRIGGER IF EXISTS %s */;\n",
(*show_trigger_row)[0]);
fprintf(sql_file,
"DELIMITER ;;\n"
"/*!50003 SET SESSION SQL_MODE=\"%s\" */;;\n"
@ -3361,6 +3369,10 @@ static int dump_trigger(FILE *sql_file, MYSQL_RES *show_create_trigger_rs,
switch_sql_mode(sql_file, ";", row[1]);
if (opt_drop_trigger)
fprintf(sql_file, "/*!50032 DROP TRIGGER IF EXISTS %s */;\n",
row[0]);
query_str= cover_definer_clause(row[2], strlen(row[2]),
C_STRING_WITH_LEN("50017"),
C_STRING_WITH_LEN("50003"),

View file

@ -15,12 +15,25 @@
# Symbols with information about the CPU.
FIND_PROGRAM(GETCONF getconf)
MARK_AS_ADVANCED(GETCONF)
IF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
FIND_PROGRAM(SYSCTL sysctl)
MARK_AS_ADVANCED(SYSCTL)
IF(GETCONF)
EXECUTE_PROCESS(
COMMAND ${GETCONF} LEVEL1_DCACHE_LINESIZE
OUTPUT_VARIABLE CPU_LEVEL1_DCACHE_LINESIZE
)
IF(SYSCTL)
EXECUTE_PROCESS(
COMMAND ${SYSCTL} -n hw.cachelinesize
OUTPUT_VARIABLE CPU_LEVEL1_DCACHE_LINESIZE
)
ENDIF()
ELSE()
FIND_PROGRAM(GETCONF getconf)
MARK_AS_ADVANCED(GETCONF)
IF(GETCONF)
EXECUTE_PROCESS(
COMMAND ${GETCONF} LEVEL1_DCACHE_LINESIZE
OUTPUT_VARIABLE CPU_LEVEL1_DCACHE_LINESIZE
)
ENDIF()
ENDIF()

View file

@ -188,7 +188,7 @@ MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE)
# binaries properly)
ADD_CUSTOM_COMMAND(TARGET ${TARGET} POST_BUILD
COMMAND rm ${TARGET_LOCATION}
COMMAND /usr/bin/libtool -static -o ${TARGET_LOCATION}
COMMAND libtool -static -o ${TARGET_LOCATION}
${STATIC_LIBS}
)
ELSE()

View file

@ -26,7 +26,7 @@ ENDIF()
OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" ${with_wsrep_default})
# Set the patch version
SET(WSREP_PATCH_VERSION "16")
SET(WSREP_PATCH_VERSION "19")
# Obtain wsrep API version
FILE(STRINGS "${MySQL_SOURCE_DIR}/wsrep/wsrep_api.h" WSREP_API_VERSION

View file

@ -56,7 +56,6 @@ usr/lib/mysql/plugin/semisync_slave.so
usr/lib/mysql/plugin/server_audit.so
usr/lib/mysql/plugin/simple_password_check.so
usr/lib/mysql/plugin/sql_errlog.so
usr/lib/mysql/plugin/user_variables.so
usr/lib/mysql/plugin/wsrep_info.so
usr/share/apport/package-hooks/source_mariadb-10.3.py
usr/share/doc/mariadb-server-10.3/mysqld.sym.gz

View file

@ -571,7 +571,6 @@ is_page_corrupted(
if (mach_read_from_4(buf+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) != 0) {
is_corrupted = fil_space_verify_crypt_checksum(
const_cast<byte*>(buf), page_size,
strict_verify, is_log_enabled ? log_file : NULL,
mach_read_from_4(buf
+ FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID),
cur_page_num);
@ -581,9 +580,7 @@ is_page_corrupted(
if (is_corrupted) {
is_corrupted = buf_page_is_corrupted(
true, buf, page_size, NULL,
cur_page_num, strict_verify,
is_log_enabled, log_file);
true, buf, page_size, NULL);
}
return(is_corrupted);

View file

@ -26,7 +26,7 @@ SET(MAN1_SERVER innochecksum.1 my_print_defaults.1 myisam_ftdump.1 myisamchk.1
mysqld_safe_helper.1 tokuftdump.1 wsrep_sst_common.1
wsrep_sst_mysqldump.1 wsrep_sst_rsync.1
wsrep_sst_xtrabackup-v2.1 wsrep_sst_xtrabackup.1
galera_recovery.1 galera_new_cluster.1)
galera_recovery.1 galera_new_cluster.1 tokuft_logdump.1)
SET(MAN8_SERVER mysqld.8)
SET(MAN1_CLIENT msql2mysql.1 mysql.1 mysql_find_rows.1 mysql_waitpid.1
mysqlaccess.1 mysqladmin.1 mysqlbinlog.1 mysqlcheck.1
@ -34,7 +34,7 @@ SET(MAN1_CLIENT msql2mysql.1 mysql.1 mysql_find_rows.1 mysql_waitpid.1
mysql_plugin.1)
SET(MAN1_DEVEL mysql_config.1)
SET(MAN1_TEST mysql-stress-test.pl.1 mysql-test-run.pl.1 mysql_client_test.1
mysqltest_embedded.1 mysql_client_test_embedded.1)
mysqltest_embedded.1 mysql_client_test_embedded.1 my_safe_process.1)
INSTALL(FILES ${MAN1_SERVER} DESTINATION ${INSTALL_MANDIR}/man1 COMPONENT ManPagesServer)
INSTALL(FILES ${MAN8_SERVER} DESTINATION ${INSTALL_MANDIR}/man8 COMPONENT ManPagesServer)

16
man/my_safe_process.1 Normal file
View file

@ -0,0 +1,16 @@
'\" t
.\"
.TH "\FBMY_SAFE_PROCESS\FR" "1" "29 March 2017" "MariaDB 10\&.1" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.SH NAME
my_safe_process \- Utility program that encapsulates process creation, monitoring and bulletproof process cleanup
.SH DESCRIPTION
Use: safe_process [options to safe_process] -- progname arg1 \.\.\. argn\.
.PP
For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/

16
man/tokuft_logdump.1 Normal file
View file

@ -0,0 +1,16 @@
'\" t
.\"
.TH "\FBTOKUFT_LOGPRINT\FR" "1" "27 March 2017" "MariaDB 10\&.1" "MariaDB Database System"
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.SH NAME
tokuft_logprint \- Dump the log from stdin to stdout
.SH DESCRIPTION
Use: Dump the log from stdin to stdout\.
.PP
For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/

View file

@ -0,0 +1,154 @@
# ==== Purpose ====
#
# Grep a file for a pattern, produce a single string out of the
# matching lines, and assert that the string matches a given regular
# expression.
#
# ==== Usage ====
#
# --let $assert_text= TEXT
# --let $assert_file= FILE
# --let $assert_select= REGEX
# [--let $assert_match= REGEX | --let $assert_count= NUMBER]
# [--let $assert_only_after= REGEX]
# --source include/assert_grep.inc
#
# Parameters:
#
# $assert_text
# Text that describes what is being checked. This text is written to
# the query log so it should not contain non-deterministic elements.
#
# $assert_file
# File to search.
#
# $assert_select
# All lines matching this text will be checked.
#
# $assert_match
# The script will find all lines that match $assert_select,
# concatenate them to a long string, and assert that it matches
# $assert_match.
#
# $assert_count
# Instead of asserting that the selected lines match
# $assert_match, assert that there were exactly $assert_count
# matching lines.
#
# $assert_only_after
# Reset all the lines matched and the counter when finding this pattern.
# It is useful for searching things in the mysqld.err log file just
# after the last server restart for example (discarding the log content
# of previous server executions).
if (!$assert_text)
{
--die !!!ERROR IN TEST: you must set $assert_text
}
if (!$assert_file)
{
--die !!!ERROR IN TEST: you must set $assert_file
}
if (!$assert_select)
{
--die !!!ERROR IN TEST: you must set $assert_select
}
if ($assert_match == '')
{
if ($assert_count == '')
{
--die !!!ERROR IN TEST: you must set either $assert_match or $assert_count
}
}
if ($assert_match != '')
{
if ($assert_count != '')
{
--echo assert_text='$assert_text' assert_count='$assert_count'
--die !!!ERROR IN TEST: you must set only one of $assert_match or $assert_count
}
}
--let $include_filename= assert_grep.inc [$assert_text]
--source include/begin_include_file.inc
--let _AG_ASSERT_TEXT= $assert_text
--let _AG_ASSERT_FILE= $assert_file
--let _AG_ASSERT_SELECT= $assert_select
--let _AG_ASSERT_MATCH= $assert_match
--let _AG_ASSERT_COUNT= $assert_count
--let _AG_OUT= `SELECT CONCAT('$MYSQLTEST_VARDIR/tmp/_ag_', UUID())`
--let _AG_ASSERT_ONLY_AFTER= $assert_only_after
--perl
use strict;
use warnings;
my $file= $ENV{'_AG_ASSERT_FILE'};
my $assert_select= $ENV{'_AG_ASSERT_SELECT'};
my $assert_match= $ENV{'_AG_ASSERT_MATCH'};
my $assert_count= $ENV{'_AG_ASSERT_COUNT'};
my $assert_only_after= $ENV{'_AG_ASSERT_ONLY_AFTER'};
my $out= $ENV{'_AG_OUT'};
my $result= '';
my $count= 0;
open(FILE, "$file") or die("Error $? opening $file: $!\n");
while (<FILE>) {
my $line = $_;
if ($assert_only_after && $line =~ /$assert_only_after/) {
$result = "";
$count = 0;
}
if ($line =~ /$assert_select/) {
if ($assert_count ne '') {
$count++;
}
else {
$result .= $line;
}
}
}
close(FILE) or die("Error $? closing $file: $!");
open OUT, "> $out" or die("Error $? opening $out: $!");
if ($assert_count ne '' && ($count != $assert_count)) {
print OUT ($count) or die("Error $? writing $out: $!");
}
elsif ($assert_count eq '' && $result !~ /$assert_match/) {
print OUT ($result) or die("Error $? writing $out: $!");
}
else {
print OUT ("assert_grep.inc ok");
}
close OUT or die("Error $? closing $out: $!");
EOF
--let $_ag_outcome= `SELECT LOAD_FILE('$_AG_OUT')`
if ($_ag_outcome != 'assert_grep.inc ok')
{
--source include/show_rpl_debug_info.inc
--echo include/assert_grep.inc failed!
--echo assert_text: '$assert_text'
--echo assert_file: '$assert_file'
--echo assert_select: '$assert_select'
--echo assert_match: '$assert_match'
--echo assert_count: '$assert_count'
--echo assert_only_after: '$assert_only_after'
if ($assert_match != '')
{
--echo matching lines: '$_ag_outcome'
}
if ($assert_count != '')
{
--echo number of matching lines: $_ag_outcome
}
--die assert_grep.inc failed.
}
--let $include_filename= include/assert_grep.inc [$assert_text]
--source include/end_include_file.inc

View file

@ -0,0 +1,67 @@
# ==== Purpose ====
#
# Check that two or more servers have identical databases; fail if not.
#
# ==== Usage ====
#
# --let $diff_servers= 1 2
# [--let $databases= db1 db2 ...]
# [--let $rpl_debug= 1]
# --source include/diff_servers.inc
# pretty-print header
--let $_ds_info= servers=$diff_servers
if ($databases != '')
{
--let $_ds_info= $_ds_info databases=$databases
}
--let $include_filename= diff_servers.inc [$_ds_info]
--source include/begin_include_file.inc
# get databases
--let $_ds_databases= $diff_database
if ($_ds_databases == '')
{
--let $_ds_databases= `SELECT GROUP_CONCAT(SCHEMA_NAME SEPARATOR ' ') FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('information_schema', 'mtr', 'mysql', 'performance_schema')`
}
# generate command line
--let $_ds_arg= --defaults-group-suffix=.
--let $_ds_number_pos= `SELECT LOCATE('$_ds_arg', '$MYSQL_DUMP') + LENGTH('$_ds_arg')`
--let $_ds_pre_command= `SELECT SUBSTR('$MYSQL_DUMP', 1, $_ds_number_pos - 1)`
--let $_ds_post_command= `SELECT SUBSTR('$MYSQL_DUMP', $_ds_number_pos + 1)`
--let $_ds_post_command= $_ds_post_command --compact --order-by-primary --skip-extended-insert --no-create-info --databases $_ds_databases
--let $_ds_prev_outfile=
# iterate over servers
--let $_ds_servers= $diff_servers
while ($_ds_servers != '')
{
--let $_ds_server_number= `SELECT SUBSTRING_INDEX('$_ds_servers', ' ', 1)`
--let $_ds_servers= `SELECT TRIM(SUBSTRING('$_ds_servers', 1 + LENGTH('_$ds_server_number')))`
--let $_ds_outfile= $MYSQLTEST_VARDIR/tmp/diff_servers_$_ds_server_number
if ($rpl_debug)
{
--echo generating dump from server '$_ds_server_number' using command '$_ds_pre_command$_ds_server_number $_ds_post_command > $_ds_outfile'
--echo remaining servers: '$_ds_servers'
}
--exec $_ds_pre_command$_ds_server_number $_ds_post_command > $_ds_outfile
if ($_ds_prev_outfile != '')
{
if ($rpl_debug)
{
--echo diffing files '$_ds_prev_outfile' and '$_ds_outfile'
}
--diff_files $_ds_prev_outfile $_ds_outfile
--remove_file $_ds_prev_outfile
}
--let $_ds_prev_outfile= $_ds_outfile
}
--remove_file $_ds_prev_outfile
--let $include_filename= diff_servers.inc [servers=$_ds_info]
--source include/end_include_file.inc

View file

@ -0,0 +1,2 @@
let $wait_condition = SELECT 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready' AND VARIABLE_VALUE = 'ON';
--source include/wait_condition.inc

View file

@ -0,0 +1,4 @@
if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_page_size' AND variable_value <= 16384`)
{
--skip Test requires InnoDB with page size not greater than 16k.
}

View file

@ -109,7 +109,7 @@ DROP DATABASE hotcopy_save;
--replace_result $MYSQLD_DATADIR MYSQLD_DATADIR
--list_files $MYSQLD_DATADIR/hotcopy_save
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
--error 1
--error 1,9,11,110,2304,255
--exec $MYSQLHOTCOPY --quiet -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save
--replace_result $MASTER_MYSOCK MASTER_MYSOCK
--exec $MYSQLHOTCOPY --quiet --allowold -S $MASTER_MYSOCK -u root hotcopy_test hotcopy_save

View file

@ -160,7 +160,7 @@ Note 1050 Table 'v1' already exists
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
Note 4067 Unknown VIEW: 'test.v1'
Note 4068 Unknown VIEW: 'test.v1'
SHOW BINLOG EVENTS;
Log_name Pos Event_type Server_id End_log_pos Info
# # Format_desc 1 # VER

View file

@ -55,5 +55,5 @@ id
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
Note 4067 Unknown VIEW: 'test.v1'
Note 4068 Unknown VIEW: 'test.v1'
DROP TABLE t1;

View file

@ -962,7 +962,7 @@ View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS with alias1 as (select 1 AS `one`), alias2 as (select 2 AS `two`)select `alias1`.`one` AS `one`,`alias2`.`two` AS `two` from (`alias1` join `alias2`) latin1 latin1_swedish_ci
drop view v1;
#
# MDEV-12440: the same CTE table is used in twice
# MDEV-12440: the same CTE table is used twice
#
create table t1 (a int, b varchar(32));
insert into t1 values
@ -984,3 +984,19 @@ select * from cte3;
a b
4 dd
drop table t1;
#
# MDEV-12558: CTE with the same name as temporary table
#
CREATE TABLE t ENGINE=MyISAM AS SELECT 1 AS i;
CREATE TEMPORARY TABLE cte ENGINE=MyISAM AS SELECT 2 AS f;
WITH cte AS ( SELECT i FROM t ) SELECT * FROM cte;
i
1
WITH cte AS ( SELECT i FROM t GROUP BY i) SELECT * FROM cte;
i
1
SELECT * FROM cte;
f
2
DROP TABLE cte;
DROP TABLE t;

View file

@ -2770,3 +2770,119 @@ set standard_compliant_cte=default;
select @@standard_compliant_cte;
@@standard_compliant_cte
1
#
# mdev-12554: impossible where in recursive select
#
CREATE TABLE t1 (i int);
INSERT INTO t1 VALUES (1),(2);
WITH RECURSIVE
cte(f) AS ( SELECT i FROM t1 UNION SELECT f FROM t1, cte WHERE 1=0 )
SELECT * FROM cte;
f
1
2
DROP TABLE t1;
#
# mdev-12556: recursive execution uses Aria temporary tables
#
CREATE TABLE t (c1 varchar(255), c2 tinytext);
INSERT INTO t VALUES ('a','a'),('b','b'),('c','c'),('d','d');
ANALYZE WITH RECURSIVE cte(f) AS (
SELECT c1 FROM t
UNION
SELECT c1 FROM t, cte
) SELECT COUNT(*) FROM cte;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
2 SUBQUERY t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
3 RECURSIVE UNION t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 Using join buffer (flat, BNL join)
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL 0.00 NULL NULL
WITH RECURSIVE cte(f) AS (
SELECT c1 FROM t
UNION
SELECT c1 FROM t, cte
) SELECT COUNT(*) FROM cte;
COUNT(*)
4
ANALYZE WITH RECURSIVE cte(f) AS (
SELECT c2 FROM t
UNION
SELECT c2 FROM t, cte
) SELECT COUNT(*) FROM cte;
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
1 PRIMARY <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
2 SUBQUERY t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
3 RECURSIVE UNION t ALL NULL NULL NULL NULL 4 4.00 100.00 100.00
3 RECURSIVE UNION <derived2> ALL NULL NULL NULL NULL 4 4.00 100.00 100.00 Using join buffer (flat, BNL join)
NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL 0.00 NULL NULL
WITH RECURSIVE cte(f) AS (
SELECT c2 FROM t
UNION
SELECT c2 FROM t, cte
) SELECT COUNT(*) FROM cte;
COUNT(*)
4
DROP TABLE t;
#
# mdev-12563: no recursive references on the top level of the CTE spec
#
CREATE TABLE t (i int);
INSERT INTO t VALUES (3), (1),(2);
SET standard_compliant_cte=0;
WITH RECURSIVE cte(f) AS (
SELECT i FROM t
UNION
SELECT i FROM t WHERE i NOT IN ( SELECT * FROM cte )
) SELECT * FROM cte;
f
3
1
2
WITH RECURSIVE cte(f) AS (
SELECT i FROM t
UNION
SELECT i FROM t WHERE i NOT IN ( SELECT * FROM cte WHERE i < 2 )
UNION
SELECT i FROM t WHERE i NOT IN ( SELECT * FROM cte WHERE i > 2 )
) SELECT * FROM cte;
f
3
1
2
WITH RECURSIVE cte(f) AS (
SELECT i FROM t
UNION
SELECT i FROM t
WHERE i NOT IN ( SELECT * FROM cte WHERE i < 2
UNION
SELECT * FROM cte WHERE i > 2)
) SELECT * FROM cte;
f
3
1
2
WITH RECURSIVE cte(f) AS (
SELECT i FROM t
UNION
SELECT i FROM t
WHERE i NOT IN ( SELECT * FROM t
WHERE i IN ( SELECT * FROM cte ) GROUP BY i )
) SELECT * FROM cte;
f
3
1
2
WITH RECURSIVE cte(f) AS (
SELECT i FROM t
UNION
SELECT i FROM t WHERE i NOT IN ( SELECT * FROM cte )
UNION
SELECT * FROM cte WHERE f > 2
) SELECT * FROM cte;
f
3
1
2
set standard_compliant_cte=default;
DROP TABLE t;

View file

@ -7134,7 +7134,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"const_condition": "2 < 2 or <in_optimizer>(2,<exists>(subquery#3))",
"const_condition": "0 or <in_optimizer>(2,<exists>(subquery#3))",
"table": {
"table_name": "t1",
"access_type": "system",
@ -7218,7 +7218,7 @@ EXPLAIN
{
"query_block": {
"select_id": 1,
"const_condition": "2 < 2 or <in_optimizer>(2,<exists>(subquery#3))",
"const_condition": "0 or <in_optimizer>(2,<exists>(subquery#3))",
"table": {
"table_name": "t1",
"access_type": "system",
@ -7684,7 +7684,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 2,
"filtered": 100,
"attached_condition": "v1.b = count(t2.c)",
"attached_condition": "v1.b = 2",
"materialized": {
"query_block": {
"select_id": 3,
@ -7741,7 +7741,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 2,
"filtered": 100,
"attached_condition": "v1.f = count(t.pk)",
"attached_condition": "v1.f = 2",
"materialized": {
"query_block": {
"select_id": 3,
@ -7761,7 +7761,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 2,
"filtered": 100,
"attached_condition": "v2.pk > count(t.pk)"
"attached_condition": "v2.pk > 2"
},
"buffer_type": "flat",
"buffer_size": "256Kb",
@ -7820,7 +7820,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 3,
"filtered": 100,
"attached_condition": "sq.i = min(t2.j)",
"attached_condition": "sq.i = 3",
"materialized": {
"query_block": {
"select_id": 2,
@ -7877,7 +7877,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 3,
"filtered": 100,
"attached_condition": "sq.i = min(t2.j)",
"attached_condition": "sq.i = 2.7100000381469727",
"materialized": {
"query_block": {
"select_id": 2,
@ -7929,7 +7929,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 3,
"filtered": 100,
"attached_condition": "sq.i = min(t2.j)",
"attached_condition": "sq.i = 3.21",
"materialized": {
"query_block": {
"select_id": 2,
@ -7981,7 +7981,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 3,
"filtered": 100,
"attached_condition": "sq.i = min(t2.j)",
"attached_condition": "sq.i = 'aa'",
"materialized": {
"query_block": {
"select_id": 2,
@ -8035,7 +8035,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 3,
"filtered": 100,
"attached_condition": "sq.i = min(t2.j)",
"attached_condition": "sq.i = '2007-05-28 00:00:00'",
"materialized": {
"query_block": {
"select_id": 2,
@ -8087,7 +8087,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 3,
"filtered": 100,
"attached_condition": "sq.i = min(t2.j)",
"attached_condition": "sq.i = '2007-05-28'",
"materialized": {
"query_block": {
"select_id": 2,
@ -8139,7 +8139,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 3,
"filtered": 100,
"attached_condition": "sq.i = min(t2.j)",
"attached_condition": "sq.i = '10:00:02'",
"materialized": {
"query_block": {
"select_id": 2,
@ -8230,7 +8230,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 2,
"filtered": 100,
"attached_condition": "v1.c = min(t2.c)",
"attached_condition": "v1.c = NULL",
"materialized": {
"query_block": {
"select_id": 3,
@ -8333,7 +8333,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 2,
"filtered": 100,
"attached_condition": "<in_optimizer>(1,<exists>(subquery#2)) or v1.c = 'foo'",
"attached_condition": "<cache>(<in_optimizer>(1,<exists>(subquery#2))) or v1.c = 'foo'",
"materialized": {
"query_block": {
"select_id": 3,
@ -8366,3 +8366,100 @@ DEALLOCATE PREPARE stmt1;
DEALLOCATE PREPARE stmt2;
DROP VIEW v1;
DROP TABLE t1,t2;
#
# MDEV-12373: pushdown into derived with side effects is prohibited
#
CREATE TABLE sales_documents (
id int NOT NULL AUTO_INCREMENT,
sale_id int NULL DEFAULT NULL,
type tinyint unsigned NULL DEFAULT NULL,
data text NULL DEFAULT NULL COLLATE 'utf8_unicode_ci',
date date NULL DEFAULT NULL,
order_number int unsigned NULL DEFAULT NULL,
created_at int NULL DEFAULT NULL,
updated_at int NULL DEFAULT NULL,
generated tinyint NOT NULL DEFAULT '0',
synced_at int NOT NULL DEFAULT '0',
sum decimal(13,2) NOT NULL DEFAULT '0',
PRIMARY KEY (id)
);
INSERT INTO sales_documents
(id, sale_id, type, order_number, data, created_at,
updated_at, date, generated, synced_at, sum)
VALUES
(555, 165, 3, 5, '{}', 1486538300, 1486722835, '2017-02-17', 0, 1486538313, 2320.00),
(556, 165, 2, 3, '{}', 1486538304, 1486563125, '2017-02-08', 1, 1486538302, 2320.00),
(557, 158, 2, 2, '{}', 1486538661, 1486538661, '2017-02-08', 0, 1486538660, 2320.00),
(558, 171, 1, 3, '{}', 1486539104, 1488203405, '2017-02-08', 1, 1486539102, 23230.00),
(559, 171, 2, 5, '{}', 1486549233, 1487146010, '2017-02-08', 1, 1486549225, 37690.00),
(560, 172, 1, 1, '{}', 1486658260, 1488203409, '2017-02-09', 1, 1486658256, 40312.00),
(561, 172, 2, 1, '{}', 1486711997, 1486711997, '2017-02-10', 1, 1486711996, 40312.00),
(562, 172, 3, 1, '{}', 1486712104, 1486721395, '2017-02-10', 1, 1486712101, 40312.00),
(563, 171, 3, 2, '{}', 1486712953, 1486720244, '2017-02-10', 1, 1486712910, 23230.00),
(564, 170, 1, 2, '{}', 1486715948, 1488203410, '2017-02-10', 1, 1486715930, 28873.00),
(565, 170, 3, 3, '{}', 1486716782, 1486717426, '2017-02-10', 1, 1486716779, 61948.00),
(566, 166, 3, 4, '{}', 1486720947, 1486720947, '2017-02-10', 1, 1486720945, 4640.00),
(567, 167, 3, 5, '{}', 1486722741, 1486722783, '2017-02-26', 0, 1486722738, 14755.00),
(568, 165, 1, 4, '{}', 1486722849, 1486722849, '2017-02-10', 0, 1486722846, 2320.00),
(569, 173, 2, 2, '{}', 1486723073, 1487071275, '2017-02-10', 1, 1486723071, 14282.00),
(570, 173, 1, 4, '{}', 1486723100, 1488203412, '2017-02-10', 1, 1486723099, 14282.00),
(571, 167, 2, 4, '{}', 1486730859, 1486730859, '2017-02-10', 1, 1486730856, 18655.00),
(572, 167, 1, 5, '{}', 1486730883, 1488203412, '2017-02-10', 1, 1486730877, 18655.00),
(573, 174, 2, 51, '{}', 1486731622, 1487060259, '2017-02-10', 1, 1486731620, 7140.00),
(574, 174, 3, 5, '{}', 1486993472, 1486993472, '2017-02-13', 1, 1488216147, 28020.00),
(575, 174, 1, 6, '{}', 1486993530, 1488203412, '2017-02-13', 1, 1486993505, 7140.00),
(576, 173, 3, 6, '{}', 1487071425, 1487071425, '2017-02-14', 0, 1487071422, 14282.00),
(577, 178, 2, 6, '{}', 1487327372, 1487327372, '2017-02-17', 1, 1487327370, 12321.00),
(578, 177, 2, 7, '{}', 1487327394, 1487327394, '2017-02-17', 0, 1487327391, 4270.00),
(579, 182, 3, 6, '{}', 1487750589, 1487751693, '2017-02-22', 1, 1487751688, 4270.00),
(580, 182, 2, 7, '{}', 1487750601, 1487750663, '2017-02-22', 1, 1487750598, 4270.00),
(581, 182, 1, 7, '{}', 1487750694, 1488203412, '2017-02-22', 1, 1487750692, 4270.00),
(582, 185, 3, 7, '{}', 1487774051, 1487774051, '2017-02-22', 0, 1487774043, 8913.00),
(583, 184, 3, 7, '{}', 1487774071, 1487774235, '2017-02-22', 0, 1487774093, 3285.00),
(584, 184, 2, 8, '{}', 1487774074, 1487774074, '2017-02-22', 0, 1487774073, 3285.00),
(585, 184, 1, 8, '{}', 1487774081, 1487774081, '2017-02-22', 0, 1487774075, 3285.00),
(586, 193, 2, 8, '{}', 1487955294, 1487955318, '2017-02-24', 0, 1487955311, 4270.00),
(587, 193, 1, 8, '{}', 1487955324, 1487955324, '2017-02-24', 0, 1487955320, 4270.00),
(588, 193, 3, 7, '{}', 1487955341, 1487955341, '2017-02-24', 0, 1487955325, 4270.00),
(589, 186, 1, 8, '{}', 1487957291, 1487957464, '2017-02-24', 0, 1487957459, 6960.00),
(590, 186, 2, 8, '{}', 1487957308, 1487957468, '2017-02-24', 0, 1487957465, 6960.00),
(591, 186, 3, 7, '{}', 1487957312, 1487957473, '2017-02-24', 0, 1487957469, 6960.00),
(592, 194, 1, 8, '{}', 1488193293, 1488203412, '2017-02-27', 1, 1488193280, 2320.00),
(593, 194, 2, 8, '{}', 1488193304, 1488193304, '2017-02-27', 1, 1488193303, 2320.00),
(594, 210, 1, 9, '{}', 1488198896, 1488198896, '2017-02-27', 0, 1488198885, 4270.00),
(595, 210, 2, 12, '{}', 1488198901, 1488198901, '2017-02-27', 1, 1488532585, 4270.00),
(596, 210, 3, 10, '{}', 1488198904, 1488198904, '2017-02-27', 1, 1488532565, 4270.00),
(597, 209, 2, 9, '{}', 1488200016, 1488450772, '2017-02-27', 1, 1488450449, 4270.00),
(598, 209, 1, 9, '{}', 1488200020, 1488200063, '2017-02-27', 1, 1488200017, 4271.00),
(599, 209, 3, 7, '{}', 1488200053, 1488200053, '2017-02-27', 0, 1488200021, 4271.00),
(600, 211, 2, 10, '{}', 1488216265, 1489402027, '2017-02-27', 1, 1488216264, 2320.00),
(601, 211, 3, 7, '{}', 1488216281, 1488216281, '2017-02-27', 1, 1488216276, 2320.00),
(602, 211, 1, 10, '{}', 1488216283, 1488216283, '2017-02-27', 1, 1488216282, 2320.00),
(603, 198, 2, 11, '{}', 1488280125, 1488280125, '2017-02-28', 0, 1488280095, 4270.00),
(604, 198, 1, 11, '{}', 1488280160, 1488280160, '2017-02-28', 0, 1488280126, 4270.00),
(605, 198, 3, 8, '{}', 1488280440, 1488280440, '2017-02-28', 0, 1488280435, 4270.00),
(606, 212, 1, 12, '{}', 1488286301, 1489402168, '2017-02-28', 1, 1488286295, 13825.00),
(607, 212, 3, 8, '{}', 1488289644, 1488289690, '2017-02-28', 1, 1488289642, 25295.00),
(608, 212, 2, 13, '{}', 1488290350, 1488290431, '2017-02-28', 1, 1488290347, 13133.75),
(609, 213, 1, 11, '{}', 1488529470, 1488529470, '2017-03-03', 1, 1488529461, 5660.00),
(610, 213, 2, 11, '{}', 1488529484, 1488529484, '2017-03-03', 1, 1488529479, 5660.00),
(611, 213, 3, 9, '{}', 1488529493, 1488529493, '2017-03-03', 1, 1488529489, 5660.00),
(612, 197, 2, 13, '{}', 1489400715, 1489400715, '2017-03-13', 0, 1489398959, 4270.00),
(613, 219, 3, 11, '{}', 1490084337, 1490181958, '2017-03-21', 1, 1490084334, 73526.00),
(614, 216, 3, 11, '{}', 1490085757, 1490086717, '2017-03-21', 0, 1490085755, 5377.00);
SELECT * FROM
(SELECT @row := @row + 1 as row, a.* from (
SELECT t.order_number
FROM sales_documents t
WHERE
t.type = 2 AND
t.date >= '2017-01-01' AND
t.date <= '2017-12-31' AND
t.order_number IS NOT NULL AND
t.generated = 1
GROUP BY t.order_number
) a, (SELECT @row := 0) r) t
WHERE row <> order_number;
row order_number
14 51
DROP TABLE sales_documents;

View file

@ -209,10 +209,10 @@ Note 1051 Unknown table 'test.table1'
Note 1051 Unknown table 'test.table2'
DROP VIEW IF EXISTS view1,view2,view3,view4;
Warnings:
Note 4067 Unknown VIEW: 'test.view1'
Note 4067 Unknown VIEW: 'test.view2'
Note 4067 Unknown VIEW: 'test.view3'
Note 4067 Unknown VIEW: 'test.view4'
Note 4068 Unknown VIEW: 'test.view1'
Note 4068 Unknown VIEW: 'test.view2'
Note 4068 Unknown VIEW: 'test.view3'
Note 4068 Unknown VIEW: 'test.view4'
# Test error message when trigger does not find table
CREATE TABLE table1(a int);

View file

@ -813,7 +813,7 @@ EXPLAIN
"ref": ["func"],
"rows": 2,
"filtered": 100,
"attached_condition": "trigcond(outer_t1.a = t1.a or t1.a is null)",
"attached_condition": "trigcond(<cache>(outer_t1.a) = t1.a or t1.a is null)",
"using_index": true
}
},
@ -827,7 +827,7 @@ EXPLAIN
"buffer_type": "flat",
"buffer_size": "256Kb",
"join_type": "BNL",
"attached_condition": "t2.b <> outer_t1.a and trigcond(outer_t1.a = t1.a or t1.a is null)"
"attached_condition": "t2.b <> outer_t1.a and trigcond(<cache>(outer_t1.a) = t1.a or t1.a is null)"
}
}
}
@ -1108,7 +1108,7 @@ EXPLAIN
"access_type": "ALL",
"rows": 2,
"filtered": 100,
"attached_condition": "(case when convert(t1.a using utf8) = _utf8'a' collate utf8_bin then NULL else t1.a end)"
"attached_condition": "(case when convert(t1.a using utf8) = <cache>(_utf8'a' collate utf8_bin) then NULL else t1.a end)"
}
}
}

View file

@ -173,29 +173,29 @@ SELECT DATE'2001-01-01' IN ('2001-01-01','2001-02-02');
DATE'2001-01-01' IN ('2001-01-01','2001-02-02')
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: [0] arg=1 handler=0 (date)
Note 1105 DBUG: [1] arg=2 handler=0 (date)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT DATE'2001-01-01' IN ('2001-01-01','2001-02-02',NULL);
DATE'2001-01-01' IN ('2001-01-01','2001-02-02',NULL)
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: [0] arg=1 handler=0 (date)
Note 1105 DBUG: [1] arg=2 handler=0 (date)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT DATE'2001-01-01' NOT IN ('2001-01-01','2001-02-02');
DATE'2001-01-01' NOT IN ('2001-01-01','2001-02-02')
0
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: [0] arg=1 handler=0 (date)
Note 1105 DBUG: [1] arg=2 handler=0 (date)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT DATE'2001-01-01' NOT IN ('2001-01-01','2001-02-02',NULL);
DATE'2001-01-01' NOT IN ('2001-01-01','2001-02-02',NULL)
0
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: [0] arg=1 handler=0 (date)
Note 1105 DBUG: [1] arg=2 handler=0 (date)
Note 1105 DBUG: types_compatible=yes bisect=yes
# Column predicant, compatible types, bisect
CREATE TABLE t1 (a INT UNSIGNED);
@ -354,38 +354,38 @@ CREATE TABLE t1 (a DATE);
SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0) FROM t1;
a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0)
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: [2] arg=3 handler=0 (datetime)
Note 1105 DBUG: [3] arg=4 handler=0 (datetime)
Note 1105 DBUG: [4] arg=5 handler=0 (datetime)
Note 1105 DBUG: [0] arg=1 handler=0 (date)
Note 1105 DBUG: [1] arg=2 handler=0 (date)
Note 1105 DBUG: [2] arg=3 handler=0 (date)
Note 1105 DBUG: [3] arg=4 handler=0 (date)
Note 1105 DBUG: [4] arg=5 handler=0 (date)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL) FROM t1;
a IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL)
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: [2] arg=3 handler=0 (datetime)
Note 1105 DBUG: [3] arg=4 handler=0 (datetime)
Note 1105 DBUG: [4] arg=5 handler=0 (datetime)
Note 1105 DBUG: [0] arg=1 handler=0 (date)
Note 1105 DBUG: [1] arg=2 handler=0 (date)
Note 1105 DBUG: [2] arg=3 handler=0 (date)
Note 1105 DBUG: [3] arg=4 handler=0 (date)
Note 1105 DBUG: [4] arg=5 handler=0 (date)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0) FROM t1;
a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0)
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: [2] arg=3 handler=0 (datetime)
Note 1105 DBUG: [3] arg=4 handler=0 (datetime)
Note 1105 DBUG: [4] arg=5 handler=0 (datetime)
Note 1105 DBUG: [0] arg=1 handler=0 (date)
Note 1105 DBUG: [1] arg=2 handler=0 (date)
Note 1105 DBUG: [2] arg=3 handler=0 (date)
Note 1105 DBUG: [3] arg=4 handler=0 (date)
Note 1105 DBUG: [4] arg=5 handler=0 (date)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL) FROM t1;
a NOT IN ('2001-01-01',DATE'2001-01-02',20010102,20010102.0,20010102e0,NULL)
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: [2] arg=3 handler=0 (datetime)
Note 1105 DBUG: [3] arg=4 handler=0 (datetime)
Note 1105 DBUG: [4] arg=5 handler=0 (datetime)
Note 1105 DBUG: [0] arg=1 handler=0 (date)
Note 1105 DBUG: [1] arg=2 handler=0 (date)
Note 1105 DBUG: [2] arg=3 handler=0 (date)
Note 1105 DBUG: [3] arg=4 handler=0 (date)
Note 1105 DBUG: [4] arg=5 handler=0 (date)
Note 1105 DBUG: types_compatible=yes bisect=yes
DROP TABLE t1;
CREATE TABLE t1 (a TIME);
@ -610,26 +610,26 @@ CREATE TABLE t1 (a DATE);
SELECT DATE'2001-01-01' IN (a,'2001-01-01') FROM t1;
DATE'2001-01-01' IN (a,'2001-01-01')
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: [0] arg=1 handler=0 (date)
Note 1105 DBUG: [1] arg=2 handler=0 (date)
Note 1105 DBUG: types_compatible=yes bisect=no
SELECT DATE'2001-01-01' IN (a,'2001-01-01',NULL) FROM t1;
DATE'2001-01-01' IN (a,'2001-01-01',NULL)
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: [0] arg=1 handler=0 (date)
Note 1105 DBUG: [1] arg=2 handler=0 (date)
Note 1105 DBUG: types_compatible=yes bisect=no
SELECT DATE'2001-01-01' NOT IN (a,'2001-01-01') FROM t1;
DATE'2001-01-01' NOT IN (a,'2001-01-01')
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: [0] arg=1 handler=0 (date)
Note 1105 DBUG: [1] arg=2 handler=0 (date)
Note 1105 DBUG: types_compatible=yes bisect=no
SELECT DATE'2001-01-01' NOT IN (a,'2001-01-01',NULL) FROM t1;
DATE'2001-01-01' NOT IN (a,'2001-01-01',NULL)
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (datetime)
Note 1105 DBUG: [1] arg=2 handler=0 (datetime)
Note 1105 DBUG: [0] arg=1 handler=0 (date)
Note 1105 DBUG: [1] arg=2 handler=0 (date)
Note 1105 DBUG: types_compatible=yes bisect=no
DROP TABLE t1;
CREATE TABLE t1 (a TIME);
@ -1147,25 +1147,25 @@ SELECT a IN (1,DATE'2001-01-01') FROM t1;
a IN (1,DATE'2001-01-01')
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (double)
Note 1105 DBUG: [1] arg=2 handler=1 (datetime)
Note 1105 DBUG: [1] arg=2 handler=1 (date)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a IN (1,DATE'2001-01-01',NULL) FROM t1;
a IN (1,DATE'2001-01-01',NULL)
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (double)
Note 1105 DBUG: [1] arg=2 handler=1 (datetime)
Note 1105 DBUG: [1] arg=2 handler=1 (date)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a NOT IN (1,DATE'2001-01-01') FROM t1;
a NOT IN (1,DATE'2001-01-01')
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (double)
Note 1105 DBUG: [1] arg=2 handler=1 (datetime)
Note 1105 DBUG: [1] arg=2 handler=1 (date)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a NOT IN (1,DATE'2001-01-01',NULL) FROM t1;
a NOT IN (1,DATE'2001-01-01',NULL)
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (double)
Note 1105 DBUG: [1] arg=2 handler=1 (datetime)
Note 1105 DBUG: [1] arg=2 handler=1 (date)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT a IN (1,TIMESTAMP'2001-01-01 10:20:30') FROM t1;
a IN (1,TIMESTAMP'2001-01-01 10:20:30')

View file

@ -629,3 +629,16 @@ j p json_remove(j, p)
{"a":1,"b":2,"c":3} $.b {"a": 1, "c": 3}
{"a":1,"b":2,"c":3} $.c {"a": 1, "b": 2}
drop table t1;
SET @str = 'bar', @path = '$';
SELECT JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path);
JSON_SEARCH('{"foo":"bar"}', 'all' , @str, '%', @path)
"$.foo"
SELECT JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]');
JSON_VALUE('[{"foo": 1},"bar"]', '$[*][0]')
bar
CREATE TABLE t1 (f INT NOT NULL);
INSERT INTO t1 VALUES (0);
SELECT JSON_KEYS(f) FROM t1 ORDER BY 1;
JSON_KEYS(f)
NULL
DROP TABLE t1;

View file

@ -51,7 +51,7 @@ count(*)
EXPLAIN SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 40))'));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range g g 34 NULL 1 Using where
1 SIMPLE t1 range g g 34 NULL 4 Using where
SELECT fid, AsText(g) FROM t1 WHERE ST_Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 40))'));
fid AsText(g)

View file

@ -301,7 +301,7 @@ count(*)
EXPLAIN SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range g g 34 NULL 1 Using where
1 SIMPLE t2 range g g 34 NULL 4 Using where
SELECT fid, AsText(g) FROM t2 WHERE Within(g,
GeomFromText('Polygon((40 40,60 40,60 60,40 60,40 40))'));
fid AsText(g)

View file

@ -1428,7 +1428,7 @@ Warnings:
Note 1305 FUNCTION test.test_function does not exist
drop view if exists v1;
Warnings:
Note 4067 Unknown VIEW: 'test.v1'
Note 4068 Unknown VIEW: 'test.v1'
create table test (col1 varchar(30));
create function test_function() returns varchar(30)
begin

View file

@ -0,0 +1,6 @@
create table t1 (f1 int not null, f2 int, f3 int, primary key (f1,f2), key(f2,f3)) engine=innodb;
create view v1 as select * from t1 where f2 = 1;
select distinct f1 from v1;
f1
drop view v1;
drop table t1;

View file

@ -123,3 +123,14 @@ col1 col2 col3
ABC DEF NULL
GHI NULL 123
DROP TABLE t1;
#
# MDEV-12696 Crash with LOAD XML and non-updatable VIEW column
#
CREATE TABLE t1 (c1 TEXT);
CREATE VIEW v1 AS SELECT CONCAT(c1,'') AS c1, NULL AS c2 FROM t1;
LOAD XML INFILE '../../std_data/loaddata/mdev12696.xml' INTO TABLE v1 (c1);
ERROR HY000: Invalid column reference (v1.c1) in LOAD DATA
LOAD XML INFILE '../../std_data/loaddata/mdev12696.xml' INTO TABLE v1 (c2);
ERROR HY000: Invalid column reference (v1.c2) in LOAD DATA
DROP VIEW v1;
DROP TABLE t1;

View file

@ -5534,3 +5534,52 @@ USE `db1`;
DROP DATABASE db1;
DROP DATABASE db2;
FOUND 1 /Database: mysql/ in bug11505.sql
#
# Test for --add-drop-trigger
#
use test;
CREATE TABLE t1 (a int, b int);
CREATE TRIGGER tt1_t1 BEFORE INSERT ON t1 FOR EACH ROW
SET NEW.b=NEW.a + 10;
INSERT INTO t1 (a) VALUES (1),(2),(3);
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `test`;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8 */ ;
/*!50003 SET character_set_results = utf8 */ ;
/*!50003 SET collation_connection = utf8_general_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = '' */ ;
/*!50032 DROP TRIGGER IF EXISTS tt1_t1 */;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER tt1_t1 BEFORE INSERT ON t1 FOR EACH ROW
SET NEW.b=NEW.a + 10 */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
DROP TABLE t1;

View file

@ -415,7 +415,7 @@ select @@profiling;
drop table if exists t1, t2, t3;
drop view if exists v1;
Warnings:
Note 4067 Unknown VIEW: 'test.v1'
Note 4068 Unknown VIEW: 'test.v1'
drop function if exists f1;
set session profiling = OFF;
set global profiling_history_size= @start_value;

View file

@ -2371,7 +2371,7 @@ EXPLAIN
"used_key_parts": ["a", "b"],
"rows": 7,
"filtered": 100,
"attached_condition": "(t1.a,t1.b) in ((2,3),(3,3),(8,8),(7,7))"
"attached_condition": "(t1.a,t1.b) in (<cache>((2,3)),<cache>((3,3)),<cache>((8,8)),<cache>((7,7)))"
}
}
}
@ -2431,7 +2431,7 @@ EXPLAIN
"used_key_parts": ["a"],
"rows": 5,
"filtered": 100,
"attached_condition": "(t1.a,t1.b + t1.a) in ((4,9),(8,8),(7,7))"
"attached_condition": "(t1.a,t1.b + t1.a) in (<cache>((4,9)),<cache>((8,8)),<cache>((7,7)))"
}
}
}
@ -2498,7 +2498,7 @@ EXPLAIN
"rows": 3,
"filtered": 100,
"index_condition": "t2.d is not null",
"attached_condition": "(t2.d,t2.e) in ((3,3),(7,7),(2,2))"
"attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((2,2)))"
},
"table": {
"table_name": "t1",
@ -2581,7 +2581,7 @@ EXPLAIN
"ref": ["test.t1.a"],
"rows": 12,
"filtered": 100,
"attached_condition": "(t1.a,t2.e) in ((3,3),(7,7),(8,8)) and length(t2.f) = 1"
"attached_condition": "(t1.a,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1"
}
}
}
@ -2666,7 +2666,7 @@ EXPLAIN
"used_key_parts": ["e"],
"rows": 6,
"filtered": 100,
"attached_condition": "(t2.d,t2.e) in ((4,4),(7,7),(8,8)) and length(t2.f) = 1 and t2.d is not null"
"attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1 and t2.d is not null"
},
"table": {
"table_name": "t1",
@ -2716,7 +2716,7 @@ EXPLAIN
"rows": 5,
"filtered": 100,
"index_condition": "t2.d is not null",
"attached_condition": "(t2.d,t2.e) in ((4,4),(7,7),(8,8)) and length(t2.f) = 1"
"attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1"
},
"table": {
"table_name": "t1",
@ -2830,7 +2830,7 @@ EXPLAIN
"ref": ["test.t1.a"],
"rows": 3,
"filtered": 100,
"attached_condition": "(t1.a,t2.e) in ((t2.e,t1.a + 1),(7,7),(8,8)) and length(t2.f) = 1"
"attached_condition": "(t1.a,t2.e) in ((t2.e,t1.a + 1),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1"
}
}
}
@ -2870,7 +2870,7 @@ EXPLAIN
"rows": 13,
"filtered": 100,
"index_condition": "t1.a is not null",
"attached_condition": "(t1.a,2) in ((2,2),(7,7),(8,8)) and length(t1.c) = 1"
"attached_condition": "(t1.a,2) in (<cache>((2,2)),<cache>((7,7)),<cache>((8,8))) and length(t1.c) = 1"
},
"table": {
"table_name": "t2",
@ -2958,7 +2958,7 @@ EXPLAIN
"rows": 13,
"filtered": 100,
"index_condition": "t1.a is not null",
"attached_condition": "(t1.a,1 + 1) in ((2,2),(7,7),(8,8)) and length(t1.c) = 1"
"attached_condition": "(t1.a,1 + 1) in (<cache>((2,2)),<cache>((7,7)),<cache>((8,8))) and length(t1.c) = 1"
},
"table": {
"table_name": "t2",

View file

@ -2373,7 +2373,7 @@ EXPLAIN
"used_key_parts": ["a", "b"],
"rows": 7,
"filtered": 100,
"attached_condition": "(t1.a,t1.b) in ((2,3),(3,3),(8,8),(7,7))",
"attached_condition": "(t1.a,t1.b) in (<cache>((2,3)),<cache>((3,3)),<cache>((8,8)),<cache>((7,7)))",
"mrr_type": "Rowid-ordered scan"
}
}
@ -2434,7 +2434,7 @@ EXPLAIN
"used_key_parts": ["a"],
"rows": 5,
"filtered": 100,
"attached_condition": "(t1.a,t1.b + t1.a) in ((4,9),(8,8),(7,7))",
"attached_condition": "(t1.a,t1.b + t1.a) in (<cache>((4,9)),<cache>((8,8)),<cache>((7,7)))",
"mrr_type": "Rowid-ordered scan"
}
}
@ -2503,7 +2503,7 @@ EXPLAIN
"rows": 3,
"filtered": 100,
"index_condition": "t2.d is not null",
"attached_condition": "(t2.d,t2.e) in ((3,3),(7,7),(2,2))",
"attached_condition": "(t2.d,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((2,2)))",
"mrr_type": "Rowid-ordered scan"
},
"table": {
@ -2588,7 +2588,7 @@ EXPLAIN
"ref": ["test.t1.a"],
"rows": 12,
"filtered": 100,
"attached_condition": "(t1.a,t2.e) in ((3,3),(7,7),(8,8)) and length(t2.f) = 1"
"attached_condition": "(t1.a,t2.e) in (<cache>((3,3)),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1"
}
}
}
@ -2673,7 +2673,7 @@ EXPLAIN
"used_key_parts": ["e"],
"rows": 6,
"filtered": 100,
"attached_condition": "(t2.d,t2.e) in ((4,4),(7,7),(8,8)) and length(t2.f) = 1 and t2.d is not null",
"attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1 and t2.d is not null",
"mrr_type": "Rowid-ordered scan"
},
"table": {
@ -2724,7 +2724,7 @@ EXPLAIN
"rows": 5,
"filtered": 100,
"index_condition": "t2.d is not null",
"attached_condition": "(t2.d,t2.e) in ((4,4),(7,7),(8,8)) and length(t2.f) = 1",
"attached_condition": "(t2.d,t2.e) in (<cache>((4,4)),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1",
"mrr_type": "Rowid-ordered scan"
},
"table": {
@ -2840,7 +2840,7 @@ EXPLAIN
"ref": ["test.t1.a"],
"rows": 3,
"filtered": 100,
"attached_condition": "(t1.a,t2.e) in ((t2.e,t1.a + 1),(7,7),(8,8)) and length(t2.f) = 1"
"attached_condition": "(t1.a,t2.e) in ((t2.e,t1.a + 1),<cache>((7,7)),<cache>((8,8))) and length(t2.f) = 1"
}
}
}
@ -2880,7 +2880,7 @@ EXPLAIN
"rows": 13,
"filtered": 100,
"index_condition": "t1.a is not null",
"attached_condition": "(t1.a,2) in ((2,2),(7,7),(8,8)) and length(t1.c) = 1",
"attached_condition": "(t1.a,2) in (<cache>((2,2)),<cache>((7,7)),<cache>((8,8))) and length(t1.c) = 1",
"mrr_type": "Rowid-ordered scan"
},
"table": {
@ -2969,7 +2969,7 @@ EXPLAIN
"rows": 13,
"filtered": 100,
"index_condition": "t1.a is not null",
"attached_condition": "(t1.a,1 + 1) in ((2,2),(7,7),(8,8)) and length(t1.c) = 1",
"attached_condition": "(t1.a,1 + 1) in (<cache>((2,2)),<cache>((7,7)),<cache>((8,8))) and length(t1.c) = 1",
"mrr_type": "Rowid-ordered scan"
},
"table": {

View file

@ -3,7 +3,7 @@ Warnings:
Note 1051 Unknown table 'test.t1'
drop view if exists view_t1;
Warnings:
Note 4067 Unknown VIEW: 'test.view_t1'
Note 4068 Unknown VIEW: 'test.view_t1'
SET sql_mode=ONLY_FULL_GROUP_BY;
CREATE TABLE t1 (
pk INT,

View file

@ -3211,7 +3211,7 @@ drop procedure bug10961|
DROP PROCEDURE IF EXISTS bug6866|
DROP VIEW IF EXISTS tv|
Warnings:
Note 4067 Unknown VIEW: 'test.tv'
Note 4068 Unknown VIEW: 'test.tv'
DROP TABLE IF EXISTS tt1,tt2,tt3|
Warnings:
Note 1051 Unknown table 'test.tt1'

View file

@ -7204,3 +7204,17 @@ f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
End of 10.1 tests
#
# MDEV-12564: IN TO EXISTS transformation for rows after
# conversion an outer join to inner join
#
CREATE TABLE t (
pk int PRIMARY KEY, i int NOT NULL, c varchar(8), KEY(c)
) ENGINE=MyISAM;
INSERT INTO t VALUES (1,10,'foo'),(2,20,'bar');
SELECT * FROM t t1 RIGHT JOIN t t2 ON (t2.pk = t1.pk)
WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo';
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
End of 10.2 tests

View file

@ -7204,6 +7204,20 @@ f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
End of 10.1 tests
#
# MDEV-12564: IN TO EXISTS transformation for rows after
# conversion an outer join to inner join
#
CREATE TABLE t (
pk int PRIMARY KEY, i int NOT NULL, c varchar(8), KEY(c)
) ENGINE=MyISAM;
INSERT INTO t VALUES (1,10,'foo'),(2,20,'bar');
SELECT * FROM t t1 RIGHT JOIN t t2 ON (t2.pk = t1.pk)
WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo';
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
End of 10.2 tests
set optimizer_switch=default;
select @@optimizer_switch like '%exists_to_in=off%';
@@optimizer_switch like '%exists_to_in=off%'

View file

@ -7197,6 +7197,20 @@ f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
End of 10.1 tests
#
# MDEV-12564: IN TO EXISTS transformation for rows after
# conversion an outer join to inner join
#
CREATE TABLE t (
pk int PRIMARY KEY, i int NOT NULL, c varchar(8), KEY(c)
) ENGINE=MyISAM;
INSERT INTO t VALUES (1,10,'foo'),(2,20,'bar');
SELECT * FROM t t1 RIGHT JOIN t t2 ON (t2.pk = t1.pk)
WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo';
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
End of 10.2 tests
set optimizer_switch=default;
select @@optimizer_switch like '%materialization=on%';
@@optimizer_switch like '%materialization=on%'

View file

@ -7195,4 +7195,18 @@ f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
End of 10.1 tests
#
# MDEV-12564: IN TO EXISTS transformation for rows after
# conversion an outer join to inner join
#
CREATE TABLE t (
pk int PRIMARY KEY, i int NOT NULL, c varchar(8), KEY(c)
) ENGINE=MyISAM;
INSERT INTO t VALUES (1,10,'foo'),(2,20,'bar');
SELECT * FROM t t1 RIGHT JOIN t t2 ON (t2.pk = t1.pk)
WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo';
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
End of 10.2 tests
set @optimizer_switch_for_subselect_test=null;

View file

@ -7210,6 +7210,20 @@ f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
End of 10.1 tests
#
# MDEV-12564: IN TO EXISTS transformation for rows after
# conversion an outer join to inner join
#
CREATE TABLE t (
pk int PRIMARY KEY, i int NOT NULL, c varchar(8), KEY(c)
) ENGINE=MyISAM;
INSERT INTO t VALUES (1,10,'foo'),(2,20,'bar');
SELECT * FROM t t1 RIGHT JOIN t t2 ON (t2.pk = t1.pk)
WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo';
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
End of 10.2 tests
set optimizer_switch=default;
select @@optimizer_switch like '%subquery_cache=on%';
@@optimizer_switch like '%subquery_cache=on%'

View file

@ -7195,5 +7195,19 @@ f1 f2 f3
DROP TABLE t1, t2;
SET NAMES default;
End of 10.1 tests
#
# MDEV-12564: IN TO EXISTS transformation for rows after
# conversion an outer join to inner join
#
CREATE TABLE t (
pk int PRIMARY KEY, i int NOT NULL, c varchar(8), KEY(c)
) ENGINE=MyISAM;
INSERT INTO t VALUES (1,10,'foo'),(2,20,'bar');
SELECT * FROM t t1 RIGHT JOIN t t2 ON (t2.pk = t1.pk)
WHERE (t2.i, t2.pk) NOT IN ( SELECT t3.i, t3.i FROM t t3, t t4 ) AND t1.c = 'foo';
pk i c pk i c
1 10 foo 1 10 foo
DROP TABLE t;
End of 10.2 tests
set @optimizer_switch_for_subselect_test=null;
set @join_cache_level_for_subselect_test=NULL;

View file

@ -429,17 +429,26 @@ select @a;
#
# BUG LP:1008487 virtual bool Item_cache::is_expensive(): Assertion `example' failed
#
SET TIMESTAMP=UNIX_TIMESTAMP('2017-01-03 00:00:00');
create table t1(a date,key(a));
insert into t1 values ('2012-01-01'),('2012-02-02');
explain
select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1_0 ref a a 4 const 0 Using where; Using index
1 SIMPLE t1_0 ref a a 4 const 1 Using where; Using index
1 SIMPLE t2 index NULL a 4 NULL 2 Using index; Using join buffer (flat, BNL join)
1 SIMPLE t1 index NULL a 4 NULL 2 Using index; Using join buffer (incremental, BNL join)
select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
1
SET TIMESTAMP=UNIX_TIMESTAMP('2012-01-03 00:00:01');
explain
select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
select 1 from t1 as t1_0 inner join t1 as t2 on (t1_0.a <=> now()) join t1 on 1;
1
drop table t1;
SET TIMESTAMP=DEFAULT;
#
# MDEV-9521 Least function returns 0000-00-00 for null date columns instead of null
# MDEV-9972 Least function retuns date in date time format
@ -845,3 +854,27 @@ DROP TABLE t1;
#
# End of 10.1 tests
#
#
# Start of 10.3 tests
#
#
# MDEV-12721 Wrong execution plan for WHERE (date_field <=> timestamp_expr AND TRUE)
#
CREATE TABLE t1(a DATE,KEY(a));
INSERT INTO t1 VALUES ('2012-01-01'),('2012-02-02');
EXPLAIN SELECT 1 FROM t1 WHERE t1.a <=> TIMESTAMP'2001-01-01 00:00:01' AND TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
EXPLAIN SELECT 1 FROM t1 WHERE t1.a <=> TIMESTAMP('2001-01-01', '00:00:01') AND TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
EXPLAIN SELECT 1 FROM t1 WHERE t1.a <=> TIMESTAMP'2001-01-01 00:00:00' AND TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 4 const 1 Using where; Using index
EXPLAIN SELECT 1 FROM t1 WHERE t1.a <=> TIMESTAMP('2001-01-01', '00:00:00') AND TRUE;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 4 const 1 Using where; Using index
DROP TABLE t1;
#
# End of 10.3 tests
#

View file

@ -5242,7 +5242,7 @@ CREATE TABLE t4 (i4 INT);
INSERT INTO t4 VALUES (1),(2);
DROP VIEW IF EXISTS v1;
Warnings:
Note 4067 Unknown VIEW: 'test.v1'
Note 4068 Unknown VIEW: 'test.v1'
CREATE VIEW v1 AS select coalesce(j1,i3) AS v1_field1 from t2 join t3 left join t1 on ( i1 = i2 );
CREATE VIEW v2 AS select v1_field1 from t4 join v1;
prepare my_stmt from "select v1_field1 from v2";

View file

@ -3055,3 +3055,33 @@ name row_cnt pct_of_total
Fred 2 66.67
Joe 1 33.33
drop table t1;
#
# MDEV-11990: window function over min/max aggregation
#
create table t1 (id int);
insert into t1 values (1), (2), (3), (2), (4), (2);
select sum(max(id)) over (order by max(id)) from t1;
sum(max(id)) over (order by max(id))
4
explain
select sum(max(id)) over (order by max(id)) from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary
create index idx on t1(id);
select sum(max(id)) over (order by max(id)) from t1;
sum(max(id)) over (order by max(id))
4
explain
select sum(max(id)) over (order by max(id)) from t1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
select sum(max(id)) over (order by max(id)) from t1 where id < 3;
sum(max(id)) over (order by max(id))
2
select count(max(id)) over (order by max(id)) from t1 where id < 3;
count(max(id)) over (order by max(id))
1
select max(id), rank() over (order by max(id)) from t1 where id < 3;
max(id) rank() over (order by max(id))
2 1
drop table t1;

View file

@ -0,0 +1,9 @@
<?xml version="1.0"?>
<resultset statement="SELECT 'test' AS c1, NULL AS c2
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<row>
<field name="c1">test</field>
<field name="c2" xsi:nil="true" />
</row>
</resultset>

View file

@ -502,4 +502,9 @@ a b
2 1
3 2
4 3
SET binlog_format=statement;
Warnings:
Warning 1105 MariaDB Galera and flashback do not support binlog format: STATEMENT
SET GLOBAL binlog_format=statement;
ERROR HY000: Flashback does not support binlog_format STATEMENT
DROP TABLE t1;

View file

@ -160,4 +160,8 @@ let $MYSQLD_DATADIR= `select @@datadir`;
SELECT * FROM t1;
SET binlog_format=statement;
--error ER_FLASHBACK_NOT_SUPPORTED
SET GLOBAL binlog_format=statement;
DROP TABLE t1;

View file

@ -4314,7 +4314,7 @@ CREATE VIEW v2 AS Select * from test.v1;
ERROR 42S02: Table 'test.v1' doesn't exist
DROP VIEW IF EXISTS v2;
Warnings:
Note 4067 Unknown VIEW: 'test.v2'
Note 4068 Unknown VIEW: 'test.v2'
Testcase 3.3.1.25
--------------------------------------------------------------------------------
@ -7566,7 +7566,7 @@ Call sp1() ;
ERROR 42000: PROCEDURE test.sp1 does not exist
Drop view if exists test.v1 ;
Warnings:
Note 4067 Unknown VIEW: 'test.v1'
Note 4068 Unknown VIEW: 'test.v1'
Drop procedure sp1 ;
ERROR 42000: PROCEDURE test.sp1 does not exist
@ -21312,7 +21312,7 @@ CREATE VIEW v1 AS SELECT f1 FROM t1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
Note 4067 Unknown VIEW: 'test.v1'
Note 4068 Unknown VIEW: 'test.v1'
Testcase 3.3.1.68
--------------------------------------------------------------------------------

View file

@ -4315,7 +4315,7 @@ CREATE VIEW v2 AS Select * from test.v1;
ERROR 42S02: Table 'test.v1' doesn't exist
DROP VIEW IF EXISTS v2;
Warnings:
Note 4067 Unknown VIEW: 'test.v2'
Note 4068 Unknown VIEW: 'test.v2'
Testcase 3.3.1.25
--------------------------------------------------------------------------------
@ -7567,7 +7567,7 @@ Call sp1() ;
ERROR 42000: PROCEDURE test.sp1 does not exist
Drop view if exists test.v1 ;
Warnings:
Note 4067 Unknown VIEW: 'test.v1'
Note 4068 Unknown VIEW: 'test.v1'
Drop procedure sp1 ;
ERROR 42000: PROCEDURE test.sp1 does not exist
@ -21314,7 +21314,7 @@ CREATE VIEW v1 AS SELECT f1 FROM t1;
DROP VIEW IF EXISTS v1;
DROP VIEW IF EXISTS v1;
Warnings:
Note 4067 Unknown VIEW: 'test.v1'
Note 4068 Unknown VIEW: 'test.v1'
Testcase 3.3.1.68
--------------------------------------------------------------------------------

View file

@ -36,3 +36,25 @@ galera_sst_xtrabackup-v2 : MDEV-11208
galera_sst_xtrabackup-v2_encrypt_with_key : MDEV-11208
mysql-wsrep#33 : TODO: investigate
galera_var_innodb_disallow_writes : MDEV-10949
MW-258 : MDEV-11229
galera_as_master : MDEV-11229
MW-44 : MDEV-11229
galera_gcs_fc_limit : MDEV-11229
galera_roles : MDEV-11229
galera_lock_table : MDEV-11229
GAL-480 : Investigate
galera_fk_no_pk :Investigate
galera_account_management : Investigate
galera.galera_var_retry_autocommit : MDEV-12319 #Sparodic Faliure
galera.galera_gcs_fc_limit : MDEV-12319 #Sparodic Faliure
galera.galera_toi_ddl_nonconflicting : MDEV-12319 #Sparodic Faliure
galera.mysql-wsrep#198 : MDEV-12319 #Sparodic Faliure
galera.galera_pc_ignore_sb : MDEV-12319 #Sparodic Faliure
galera.MW-329 : MDEV-12319 #Sparodic Faliure
galera.galera_ist_recv_bind : MDEV-12319 #Failed to start mysqld
galera.galera_ist_restart_joiner : MDEV-12319 #Failed to start mysqld
galera.galera_ssl_compression : MDEV-12319 #Failed to start mysqld
galera.galera_wan : MDEV-12319 #Failed to start mysqld
galera.rpl_row_annotate : MDEV-12319 #Failed to start mysqld
galera_restart_on_unknown_option : Solve
galera_kill_applier : Investigate; problem introduced in merge from 10.1

View file

@ -25,7 +25,14 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
#ist_port=@OPT.port
#sst_port=@OPT.port
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gcache.size=10M;evs.suspect_timeout=PT10S'
wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S'
# enforce read-committed characteristics across the cluster
wsrep_causal_reads=ON
wsrep_sync_wait = 7
wsrep_node_address=127.0.0.1
wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'

View file

@ -0,0 +1,83 @@
#
# Let's understand the topology.
# * Independent Master with server-id = 1
# * Galera cluster with 2 nodes: node#1 and node#2 with server-id = 2, 3
# node#1 act as slave to Independent Master with server-id = 1
# * Independent Slave with server-id = 4 replicating from galera node#2
#
# Use default setting for mysqld processes
!include include/default_mysqld.cnf
[mysqld]
log-slave-updates
log-bin=mysqld-bin
binlog-format=row
gtid-mode=on
enforce-gtid-consistency=true
[mysqld.1]
server-id=1
[mysqld.2]
server-id=2
wsrep_provider=@ENV.WSREP_PROVIDER
wsrep_cluster_address='gcomm://'
wsrep_provider_options='base_port=@mysqld.2.#galera_port;evs.install_timeout = PT15S; evs.max_install_timeouts=1;'
# enforce read-committed characteristics across the cluster
wsrep_causal_reads=ON
wsrep_sync_wait = 7
wsrep_node_address=127.0.0.1
wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
# Required for Galera
innodb_autoinc_lock_mode=2
innodb_flush_log_at_trx_commit=2
[mysqld.3]
server-id=3
wsrep_provider=@ENV.WSREP_PROVIDER
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.2.#galera_port'
wsrep_provider_options='base_port=@mysqld.3.#galera_port;evs.install_timeout = PT15S; evs.max_install_timeouts = 1;'
# enforce read-committed characteristics across the cluster
wsrep_causal_reads=ON
wsrep_sync_wait = 7
wsrep_node_address=127.0.0.1
wsrep_sst_receive_address=127.0.0.2:@mysqld.3.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port
# Required for Galera
innodb_autoinc_lock_mode=2
innodb_flush_log_at_trx_commit=2
[mysqld.4]
server-id=4
[ENV]
NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket
NODE_MYPORT_2= @mysqld.2.port
NODE_MYSOCK_2= @mysqld.2.socket
NODE_MYPORT_3= @mysqld.3.port
NODE_MYSOCK_3= @mysqld.3.socket
NODE_MYPORT_4= @mysqld.4.port
NODE_MYSOCK_4= @mysqld.4.socket
NODE_GALERAPORT_2= @mysqld.2.#galera_port
NODE_GALERAPORT_3= @mysqld.3.#galera_port
NODE_SSTPORT_2= @mysqld.2.#sst_port
NODE_SSTPORT_3= @mysqld.3.#sst_port

View file

@ -0,0 +1,87 @@
#
# This .cnf file creates a setup with a 2-node Galera cluster and one stand-alone MySQL server, to be used as a slave
#
# Use default setting for mysqld processes
!include include/default_mysqld.cnf
[mysqld]
default-storage-engine=InnoDB
[mysqld.1]
server-id=1
binlog-format=row
log-bin=mysqld-bin
log_slave_updates
gtid-mode=on
enforce-gtid-consistency=true
event-scheduler=1
wsrep_provider=@ENV.WSREP_PROVIDER
wsrep_cluster_address='gcomm://'
wsrep_provider_options='base_port=@mysqld.1.#galera_port'
# enforce read-committed characteristics across the cluster
wsrep_causal_reads=ON
wsrep_sync_wait = 7
wsrep_node_address=127.0.0.1
wsrep_sst_receive_address=127.0.0.2:@mysqld.1.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port
# Required for Galera
innodb_autoinc_lock_mode=2
innodb_flush_log_at_trx_commit=2
[mysqld.2]
server-id=2
binlog-format=row
log-bin=mysqld-bin
log_slave_updates
gtid-mode=on
enforce-gtid-consistency=true
event-scheduler=1
wsrep_provider=@ENV.WSREP_PROVIDER
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
wsrep_provider_options='base_port=@mysqld.2.#galera_port'
# enforce read-committed characteristics across the cluster
wsrep_causal_reads=ON
wsrep_sync_wait = 7
wsrep_node_address=127.0.0.1
wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
# Required for Galera
innodb_autoinc_lock_mode=2
innodb_flush_log_at_trx_commit=2
[mysqld.3]
server-id=3
replicate-ignore-db=test
replicate-wild-ignore-table=test.%
log-bin=mysqld-bin
log_slave_updates
gtid-mode=on
enforce-gtid-consistency=true
event-scheduler=1
[ENV]
NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket
NODE_MYPORT_2= @mysqld.2.port
NODE_MYSOCK_2= @mysqld.2.socket
NODE_MYPORT_3= @mysqld.3.port
NODE_MYSOCK_3= @mysqld.3.socket
NODE_GALERAPORT_1= @mysqld.1.#galera_port
NODE_GALERAPORT_2= @mysqld.2.#galera_port
NODE_SSTPORT_1= @mysqld.1.#sst_port
NODE_SSTPORT_2= @mysqld.2.#sst_port

View file

@ -0,0 +1,24 @@
SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
connection node_2;
SET @@global.wsrep_desync = 1;
SET SESSION wsrep_dirty_reads=1;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
connection node_2;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
SHOW STATUS LIKE 'wsrep_desync_count';
Variable_name Value
wsrep_desync_count 0
SET @@global.wsrep_desync = 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) NOT NULL,
`f2` char(1) DEFAULT NULL,
PRIMARY KEY (`f1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
CALL mtr.add_suppression("WSREP: Protocol violation. JOIN message sender (.*) is not in state transfer \\(SYNCED\\). Message ignored.");
connection node_1;
SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=false';

View file

@ -0,0 +1,4 @@
SET SESSION wsrep_sync_wait = 0;
Killing server ...
SET SESSION wsrep_sync_wait = 0;
Killing server ...

View file

@ -0,0 +1,39 @@
CREATE TABLE t1 (f1 CHAR(10), f0 integer) ENGINE=InnoDB;
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
ALTER TABLE t1 DROP COLUMN f1;
SET SESSION wsrep_osu_method='RSU';
ALTER TABLE t1 ADD COLUMN f1 CHAR(10);
ALTER TABLE t1 DROP COLUMN f1;
ALTER TABLE t1 ADD COLUMN f2 CHAR(10);
ALTER TABLE t1 DROP COLUMN f2;
ALTER TABLE t1 ADD COLUMN f3 CHAR(10);
ALTER TABLE t1 DROP COLUMN f3;
ALTER TABLE t1 ADD COLUMN f4 CHAR(10);
ALTER TABLE t1 DROP COLUMN f4;
ALTER TABLE t1 ADD COLUMN f5 CHAR(10);
ALTER TABLE t1 DROP COLUMN f5;
ALTER TABLE t1 ADD COLUMN f6 CHAR(10);
ALTER TABLE t1 DROP COLUMN f6;
ALTER TABLE t1 ADD COLUMN f7 CHAR(10);
ALTER TABLE t1 DROP COLUMN f7;
ALTER TABLE t1 ADD COLUMN f8 CHAR(10);
ALTER TABLE t1 DROP COLUMN f8;
ALTER TABLE t1 ADD COLUMN f9 CHAR(10);
ALTER TABLE t1 DROP COLUMN f9;
ALTER TABLE t1 ADD COLUMN f10 CHAR(10);
ALTER TABLE t1 DROP COLUMN f10;
ALTER TABLE t1 ADD COLUMN f11 CHAR(10);
ALTER TABLE t1 DROP COLUMN f11;
ALTER TABLE t1 ADD COLUMN f12 CHAR(10);
ALTER TABLE t1 DROP COLUMN f12;
ALTER TABLE t1 ADD COLUMN f13 CHAR(10);
ALTER TABLE t1 DROP COLUMN f13;
ALTER TABLE t1 ADD COLUMN f14 CHAR(10);
ALTER TABLE t1 DROP COLUMN f14;
ALTER TABLE t1 ADD COLUMN f15 CHAR(10);
ALTER TABLE t1 DROP COLUMN f15;
ALTER TABLE t1 ADD COLUMN f16 CHAR(10);
ALTER TABLE t1 DROP COLUMN f16;
SET SESSION wsrep_osu_method='TOI';
DROP TABLE t1;

View file

@ -0,0 +1,32 @@
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
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;
SET GLOBAL wsrep_max_ws_rows = 2;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
SELECT * FROM t1 GROUP BY f1;
f1
1
SELECT * FROM t1 GROUP BY f1;
f1
1
SELECT * FROM t1 GROUP BY f1;
f1
1
SHOW STATUS LIKE '%wsrep%';
INSERT INTO t1 SELECT * FROM t1;
ERROR HY000: wsrep_max_ws_rows exceeded
START TRANSACTION;
INSERT INTO t1 (f1) VALUES (1);
INSERT INTO t1 (f1) VALUES (2),(3),(4);
ERROR HY000: wsrep_max_ws_rows exceeded
ROLLBACK;
START TRANSACTION;
DELETE FROM t1;
ERROR HY000: wsrep_max_ws_rows exceeded
DROP TABLE t1;
SET GLOBAL wsrep_max_ws_rows = 0;

View file

@ -0,0 +1,27 @@
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB;
INSERT INTO t1 (f1) VALUES (1);
CREATE TABLE t2 (f1 CHAR(20)) ENGINE=InnoDB;
CREATE PROCEDURE proc_update ()
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET SESSION wsrep_sync_wait = 0;
WHILE 1 DO
UPDATE t1 SET f2 = LEFT(MD5(RAND()), 4);
END WHILE;
END|
connect node_1X, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1X;
CALL proc_update();;
connection node_2;
SET SESSION wsrep_retry_autocommit = 0;
have_successes
1
have_deadlocks
1
connection node_1;
connection node_1X;
Got one of the listed errors
connection node_1;
DROP PROCEDURE proc_update;
DROP TABLE t1, t2;
CALL mtr.add_suppression("conflict state 3 after post commit");

View file

@ -0,0 +1,23 @@
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB;
INSERT INTO t1 (f1) VALUES (1);
CREATE TABLE t2 (f1 CHAR(20)) ENGINE=InnoDB;
CREATE PROCEDURE proc_update ()
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET SESSION wsrep_sync_wait = 0;
WHILE 1 DO
UPDATE t1 SET f2 = LEFT(MD5(RAND()), 4);
END WHILE;
END|
connect node_1X, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1X;
CALL proc_update();;
connection node_2;
SET SESSION wsrep_retry_autocommit = 0;
connection node_1;
connection node_1X;
Got one of the listed errors
connection node_1;
DROP PROCEDURE proc_update;
DROP TABLE t1, t2;
CALL mtr.add_suppression("conflict state 3 after post commit");

View file

@ -0,0 +1,23 @@
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB;
INSERT INTO t1 (f1) VALUES (1);
CREATE TABLE t2 (f1 CHAR(20)) ENGINE=InnoDB;
CREATE PROCEDURE proc_update ()
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET SESSION wsrep_sync_wait = 0;
WHILE 1 DO
UPDATE t1 SET f2 = LEFT(MD5(RAND()), 4);
END WHILE;
END|
connect node_1X, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1X;
CALL proc_update();;
connection node_2;
SET SESSION wsrep_retry_autocommit = 10000;
connection node_1;
connection node_1X;
Got one of the listed errors
connection node_1;
DROP PROCEDURE proc_update;
DROP TABLE t1, t2;
CALL mtr.add_suppression("conflict state 3 after post commit");

View file

@ -0,0 +1,20 @@
CREATE TABLE t1 (i INT) ENGINE = InnoDB;
INSERT INTO t1 (i) VALUES(1);
CREATE TABLE t2 (i INT) ENGINE = InnoDB;
connection node_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
SELECT * FROM t1 WHERE i = 1 LOCK IN SHARE MODE;
i
1
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1a;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT IGNORE INTO t2 SELECT * FROM t1 WHERE i = 1 FOR UPDATE;;
connection node_1;
DELETE FROM t1 WHERE i = 1;
COMMIT;
connection node_1a;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
DROP TABLE t1, t2;

View file

@ -0,0 +1,20 @@
create table t1 (i int primary key, j int) engine=innodb;
create table t2 (i int primary key, j int) engine=innodb;
insert into t1 values (1,0);
insert into t2 values (2,0);
set autocommit=off;
start transaction;
update t1 set j=1 where i=1;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1a;
set autocommit=off;
start transaction;
begin;
update t2 set j=1 where i=2;
connection node_1;
insert into t1 select * from t2;;
connection node_1a;
insert into t2 select * from t1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection node_1;
DROP TABLE t1, t2;

View file

@ -0,0 +1,20 @@
CREATE TABLE t1 (f1 INTEGER, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB;
INSERT INTO t1 (f1) VALUES (1),(65535);
FLUSH STATUS;
SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays';
VARIABLE_VALUE = 0
1
CREATE PROCEDURE proc_insert ()
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET SESSION wsrep_sync_wait = 0;
WHILE 1 DO
INSERT INTO t1 (f1) VALUES (FLOOR( 1 + RAND( ) * 65535 ));
END WHILE;
END|
CALL proc_insert();;
SELECT VARIABLE_VALUE > 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays';
VARIABLE_VALUE > 0
1
DROP PROCEDURE proc_insert;
DROP TABLE t1;

View file

@ -0,0 +1,173 @@
connection node_1;
SAVEPOINT in a stored function should be forbidden
CREATE FUNCTION f1 () RETURNS INT BEGIN
SAVEPOINT s;
RETURN 1;
END|
SELECT f1();
f1()
1
DROP FUNCTION f1;
ROLLBACK TO SAVEPOINT in a stored function should be forbidden
CREATE FUNCTION f2 () RETURNS INT BEGIN
ROLLBACK TO SAVEPOINT s;
RETURN 1;
END|
BEGIN;
SAVEPOINT s;
SELECT f2();
ERROR 42000: SAVEPOINT s does not exist
COMMIT;
DROP FUNCTION f2;
BEGIN;
SAVEPOINT S;
ROLLBACK TO SAVEPOINT S;
COMMIT;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (a INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 values (110), (111), (112), (113), (114);
Direct SAVEPOINT in a trigger should be forbidden
connection node_2;
CREATE TRIGGER i1_t1 BEFORE INSERT ON t1 FOR EACH ROW SAVEPOINT s;
connection node_1;
INSERT INTO t1 VALUES (1);
DROP TRIGGER i1_t1;
CREATE TRIGGER i2_t1 AFTER INSERT ON t1 FOR EACH ROW SAVEPOINT s;
INSERT INTO t1 VALUES (2);
DROP TRIGGER i2_t1;
INSERT INTO t1 VALUES (3);
CREATE TRIGGER u1_t1 BEFORE UPDATE ON t1 FOR EACH ROW SAVEPOINT s;
UPDATE t1 SET a=4 WHERE a=3;
DROP TRIGGER u1_t1;
CREATE TRIGGER u2_t1 AFTER UPDATE ON t1 FOR EACH ROW SAVEPOINT s;
UPDATE t1 SET a=4 WHERE a=3;
DROP TRIGGER u2_t1;
CREATE TRIGGER d1_t1 BEFORE DELETE ON t1 FOR EACH ROW SAVEPOINT s;
DELETE FROM t1;
DROP TRIGGER d1_t1;
CREATE TRIGGER d1_t1 AFTER DELETE ON t1 FOR EACH ROW SAVEPOINT s;
DELETE FROM t1;
DROP TRIGGER d1_t1;
SAVEPOINT in a compound statement in a trigger should be forbidden
CREATE TRIGGER i3_t1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN
SAVEPOINT s;
END|
INSERT INTO t1 VALUES (5);
DROP TRIGGER i3_t1;
SAVEPOINT in a PS call in a trigger should be forbidden
CREATE TRIGGER i4_t1 BEFORE INSERT ON t1 FOR EACH ROW BEGIN
PREPARE set_savepoint FROM "SAVEPOINT s";
EXECUTE set_savepoint;
DEALLOCATE PREPARE set_savepoint;
END|
ERROR 0A000: Dynamic SQL is not allowed in stored function or trigger
connection node_2;
SAVEPOINT in SP called from a trigger should be forbidden
CREATE PROCEDURE p1() BEGIN
SAVEPOINT s;
END|
connection node_1;
CREATE TRIGGER i5_t1 BEFORE INSERT ON t1 FOR EACH ROW CALL p1;
INSERT INTO t1 VALUES (6);
DROP TRIGGER i5_t1;
SAVEPOINT in a SP called from a PS called from a trigger be forbidden
PREPARE call_p1 FROM "CALL p1";
CREATE TRIGGER i6_t1 BEFORE INSERT ON t1 FOR EACH ROW EXECUTE call_p1;
ERROR 0A000: Dynamic SQL is not allowed in stored function or trigger
SAVEPOINT in a function called from a trigger should be forbidden
CREATE FUNCTION f1 () RETURNS INT BEGIN
SAVEPOINT s;
RETURN 1;
END|
CREATE TRIGGER i7_t1 BEFORE INSERT ON t1 FOR EACH ROW SET @foo = f1();
INSERT INTO t1 VALUES (7);
DROP TRIGGER i7_t1;
SAVEPOINT in a SP called from a SP called from a trigger should be forbidden
CREATE PROCEDURE p2() BEGIN
CALL p1();
END|
CREATE TRIGGER i8_t1 BEFORE INSERT ON t1 FOR EACH ROW CALL p2;
INSERT INTO t1 VALUES (8);
DROP TRIGGER i8_t1;
SAVEPOINT in a SP called from a trigger called from a SP should be forbidden
CREATE TRIGGER i9_t1 BEFORE INSERT ON t1 FOR EACH ROW CALL p1;
CREATE PROCEDURE p3() BEGIN
INSERT INTO t1 VALUES (9);
END|
CALL p3();
DROP TRIGGER i9_t1;
ROLLBACK TO SAVEPOINT in trigger as a trivial statement should be forbidden
CREATE TRIGGER i4_t1 BEFORE INSERT ON t1 FOR EACH ROW ROLLBACK TO SAVEPOINT s;
BEGIN;
SAVEPOINT s;
INSERT INTO t1 VALUES (5);
ERROR 42000: SAVEPOINT s does not exist
COMMIT;
DROP TRIGGER i4_t1;
ROLLBACK TO SAVEPOINT in a trigger in a SP call should be forbidden
CREATE PROCEDURE p4() BEGIN
ROLLBACK TO SAVEPOINT s;
END|
CREATE TRIGGER i5_t1 BEFORE INSERT ON t1 FOR EACH ROW CALL p4;
BEGIN;
SAVEPOINT s;
INSERT INTO t1 VALUES (6);
ERROR 42000: SAVEPOINT s does not exist
COMMIT;
DROP TRIGGER i5_t1;
SAVEPOINT in a SP next to a trigger should work
CREATE TRIGGER i6_t1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a = NEW.a + 1;
CREATE PROCEDURE p5() BEGIN
SAVEPOINT s;
INSERT INTO t1 VALUES (10);
ROLLBACK TO SAVEPOINT s;
END|
BEGIN;
CALL p5();
COMMIT;
DROP TRIGGER i6_t1;
connection node_2;
create trigger t1 before insert on t1 for each row
begin
insert into t2 values (NULL);
end|
connection node_1;
INSERT INTO t1 VALUES (201), (202), (203);
connection node_1;
SELECT * FROM t1;
a
5
6
7
8
9
201
202
203
SELECT COUNT(*) FROM t2;
COUNT(*)
3
connection node_2;
SELECT * FROM t1;
a
5
6
7
8
9
201
202
203
SELECT COUNT(*) FROM t2;
COUNT(*)
3
connection node_1;
DEALLOCATE PREPARE call_p1;
connection node_2;
DROP TABLE t1, t2;
DROP PROCEDURE p1;
DROP PROCEDURE p2;
DROP PROCEDURE p3;
DROP PROCEDURE p4;
DROP PROCEDURE p5;
DROP FUNCTION f1;

View file

@ -5,6 +5,15 @@ SELECT COUNT(*) = 2 FROM mysql.user WHERE user IN ('user1', 'user2');
COUNT(*) = 2
1
connection node_1;
ALTER USER user1 PASSWORD EXPIRE;
SELECT password_expired = 'Y' FROM mysql.user WHERE user = 'user1';
password_expired = 'Y'
1
connection node_2;
SELECT password_expired = 'Y' FROM mysql.user WHERE user = 'user1';
password_expired = 'Y'
1
connection node_1;
RENAME USER user2 TO user3;
connection node_2;
SELECT COUNT(*) = 0 FROM mysql.user WHERE user = 'user2';

View file

@ -0,0 +1,56 @@
DROP TABLE IF EXISTS t1, t2;
DROP TABLE IF EXISTS x1, x2;
connection node_1;
CREATE TABLE t1 (f1 INTEGER);
CREATE TABLE t2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER);
SET GLOBAL wsrep_replicate_myisam = TRUE;
CREATE TABLE x1 (f1 INTEGER) ENGINE=MyISAM;
CREATE TABLE x2 (f1 INT PRIMARY KEY AUTO_INCREMENT, f2 INTEGER) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
INSERT INTO x1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
INSERT INTO t2 (f2) SELECT 1 FROM t1 AS a1, t1 AS a2, t1 AS a3, t1 AS a4;
INSERT INTO x2 (f2) VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
connection node_2;
# ANALYZE test
connection node_2;
connection node_1;
ANALYZE TABLE t1, t2;
Table Op Msg_type Msg_text
test.t1 analyze status OK
test.t2 analyze status OK
connection node_2;
# OPTIMIZE test
connection node_2;
connection node_1;
OPTIMIZE TABLE t1, t2;
Table Op Msg_type Msg_text
test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
test.t1 optimize status OK
test.t2 optimize note Table does not support optimize, doing recreate + analyze instead
test.t2 optimize status OK
connection node_2;
# REPAIR test
connection node_2;
connection node_1;
REPAIR TABLE x1, x2;
Table Op Msg_type Msg_text
test.x1 repair status OK
test.x2 repair status OK
connection node_2;
connection node_2;
SELECT COUNT(*) = 10 FROM t1;
COUNT(*) = 10
1
SELECT COUNT(*) = 10 FROM x1;
COUNT(*) = 10
1
SELECT COUNT(*) = 10000 FROM t2;
COUNT(*) = 10000
1
SELECT COUNT(*) = 10 FROM x2;
COUNT(*) = 10
1
connection node_1;
DROP TABLE t1, t2;
DROP TABLE x1, x2;
SET GLOBAL wsrep_replicate_myisam = FALSE;

View file

@ -1,9 +1,9 @@
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(6)) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
INSERT INTO t1 VALUES (1,'node_2');
INSERT INTO t1 VALUES (1,'node_1');
INSERT INTO t1 VALUES (2, 'node_2');
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
wsrep_local_aborts_increment
1

View file

@ -50,7 +50,7 @@ WSREP_SST_DONOR
WSREP_SST_DONOR_REJECTS_QUERIES OFF
WSREP_SST_METHOD rsync
WSREP_SYNC_WAIT 7
<BASE_DIR>; <BASE_HOST>; <BASE_PORT>; cert.log_conflicts = no; debug = no; evs.auto_evict = 0; evs.causal_keepalive_period = PT1S; evs.debug_log_mask = 0x1; evs.delay_margin = PT1S; evs.delayed_keep_period = PT30S; evs.inactive_check_period = PT0.5S; evs.inactive_timeout = PT15S; evs.info_log_mask = 0; evs.install_timeout = PT7.5S; evs.join_retrans_period = PT1S; evs.keepalive_period = PT1S; evs.max_install_timeouts = 3; evs.send_window = 4; evs.stats_report_period = PT1M; evs.suspect_timeout = PT10S; evs.use_aggregate = true; evs.user_send_window = 2; evs.version = 0; evs.view_forget_timeout = P1D; <GCACHE_DIR>; gcache.keep_pages_size = 0; gcache.mem_size = 0; <GCACHE_NAME>; gcache.page_size = 128M; gcache.size = 10M; gcomm.thread_prio = ; gcs.fc_debug = 0; gcs.fc_factor = 1.0; gcs.fc_limit = 16; gcs.fc_master_slave = no; gcs.max_packet_size = 64500; gcs.max_throttle = 0.25; <GCS_RECV_Q_HARD_LIMIT>; gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = no; <GMCAST_LISTEN_ADDR>; gmcast.mcast_addr = ; gmcast.mcast_ttl = 1; gmcast.peer_timeout = PT3S; gmcast.segment = 0; gmcast.time_wait = PT5S; gmcast.version = 0; <IST_RECV_ADDR>; pc.announce_timeout = PT3S; pc.checksum = false; pc.ignore_quorum = false; pc.ignore_sb = false; pc.linger = PT20S; pc.npvo = false; pc.recovery = true; pc.version = 0; pc.wait_prim = true; pc.wait_prim_timeout = P30S; pc.weight = 1; protonet.backend = asio; protonet.version = 0; repl.causal_read_timeout = PT90S; repl.commit_order = 3; repl.key_format = FLAT8; repl.max_ws_size = 2147483647; repl.proto_max = 7; socket.checksum = 2; socket.recv_buf_size = 212992;
<BASE_DIR>; <BASE_HOST>; <BASE_PORT>; cert.log_conflicts = no; debug = no; evs.auto_evict = 0; evs.causal_keepalive_period = PT1S; evs.debug_log_mask = 0x1; evs.delay_margin = PT1S; evs.delayed_keep_period = PT30S; evs.inactive_check_period = PT0.5S; evs.inactive_timeout = PT30S; evs.info_log_mask = 0; evs.install_timeout = PT15S; evs.join_retrans_period = PT1S; evs.keepalive_period = PT1S; evs.max_install_timeouts = 3; evs.send_window = 4; evs.stats_report_period = PT1M; evs.suspect_timeout = PT10S; evs.use_aggregate = true; evs.user_send_window = 2; evs.version = 0; evs.view_forget_timeout = P1D; <GCACHE_DIR>; gcache.keep_pages_size = 0; gcache.mem_size = 0; <GCACHE_NAME>; gcache.page_size = 128M; gcache.recover = no; gcache.size = 128M; gcomm.thread_prio = ; gcs.fc_debug = 0; gcs.fc_factor = 1.0; gcs.fc_limit = 16; gcs.fc_master_slave = no; gcs.max_packet_size = 64500; gcs.max_throttle = 0.25; <RECV_Q_HARD_LIMIT>;gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = no; <GMCAST_LISTEN_ADDR>; gmcast.mcast_addr = ; gmcast.mcast_ttl = 1; gmcast.peer_timeout = PT3S; gmcast.segment = 0; gmcast.time_wait = PT5S; gmcast.version = 0; <IST_RECV_ADDR>; pc.announce_timeout = PT3S; pc.checksum = false; pc.ignore_quorum = false; pc.ignore_sb = false; pc.linger = PT20S; pc.npvo = false; pc.recovery = true; pc.version = 0; pc.wait_prim = true; pc.wait_prim_timeout = PT30S; pc.weight = 1; protonet.backend = asio; protonet.version = 0; repl.causal_read_timeout = PT90S; repl.commit_order = 3; repl.key_format = FLAT8; repl.max_ws_size = 2147483647; repl.proto_max = 7; socket.checksum = 2; socket.recv_buf_size = 212992;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_STATUS
WHERE VARIABLE_NAME LIKE 'wsrep_%'
AND VARIABLE_NAME != 'wsrep_debug_sync_waiters';

View file

@ -0,0 +1,50 @@
connection node_1;
CREATE TABLE ten (f1 INTEGER);
INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
CREATE TABLE t1 (f1 INTEGER, PRIMARY KEY (f1)) Engine=InnoDB;
CREATE TABLE t2 (f1 INTEGER, PRIMARY KEY (f1)) Engine=InnoDB;
SET GLOBAL wsrep_desync = 1;
show status like 'wsrep_desync_count';
Variable_name Value
wsrep_desync_count 1
SET DEBUG_SYNC='before_execute_sql_command SIGNAL alter1 WAIT_FOR alter2';
INSERT INTO t1 (f1) SELECT 0000 + (100 * a1.f1) + (10 * a2.f1) + a3.f1 FROM ten AS a1, ten AS a2, ten AS a3;
connection node_1a;
SET GLOBAL wsrep_desync = 1;
Warnings:
Warning 1231 'wsrep_desync' is already ON.
show status like 'wsrep_desync_count';
Variable_name Value
wsrep_desync_count 1
SET DEBUG_SYNC='now WAIT_FOR alter1';
SET DEBUG_SYNC='before_execute_sql_command SIGNAL alter2';
INSERT INTO t2 (f1) SELECT 0000 + (100 * a1.f1) + (10 * a2.f1) + a3.f1 FROM ten AS a1, ten AS a2, ten AS a3;
connection node_1;
connection node_1a;
connection node_1;
SET DEBUG_SYNC='RESET';
SET GLOBAL wsrep_desync = 0;
show status like 'wsrep_desync_count';
Variable_name Value
wsrep_desync_count 0
SET GLOBAL wsrep_desync = 0;
Warnings:
Warning 1231 'wsrep_desync' is already OFF.
show status like 'wsrep_desync_count';
Variable_name Value
wsrep_desync_count 0
show status like 'wsrep_desync_count';
Variable_name Value
wsrep_desync_count 0
SET GLOBAL wsrep_desync = 0;
Warnings:
Warning 1231 'wsrep_desync' is already OFF.
SELECT COUNT(*) FROM t1;
COUNT(*)
1000
SELECT COUNT(*) FROM t2;
COUNT(*)
1000
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE ten;

View file

@ -0,0 +1,18 @@
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
SET SESSION wsrep_sync_wait = 0;
SET SESSION wsrep_sync_wait = 0;
Killing server ...
INSERT INTO t1 VALUES (2);
Killing server ...
Performing --wsrep-recover ...
Using --wsrep-start-position when starting mysqld ...
INSERT INTO t1 VALUES (3);
Performing --wsrep-recover ...
Using --wsrep-start-position when starting mysqld ...
include/diff_servers.inc [servers=1 2]
CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
include/assert_grep.inc [async IST sender starting to serve]
CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
include/assert_grep.inc [Recovering GCache ring buffer: found gapless sequence]
DROP TABLE t1;

View file

@ -0,0 +1,19 @@
SET SESSION wsrep_sync_wait = 0;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
SET SESSION wsrep_sync_wait = 0;
Killing server ...
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
Killing server ...
Performing --wsrep-recover ...
Using --wsrep-start-position when starting mysqld ...
Performing --wsrep-recover ...
Using --wsrep-start-position when starting mysqld ...
include/diff_servers.inc [servers=1 2]
DROP TABLE t1;
CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
include/assert_grep.inc [IST first seqno 2 not found from cache, falling back to SST]
CALL mtr.add_suppression("Skipped GCache ring buffer recovery");

View file

@ -0,0 +1,107 @@
SET SESSION wsrep_sync_wait = 0;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT, f2 LONGBLOB) ENGINE=InnoDB;
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE PROCEDURE insert_simple ()
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET SESSION wsrep_sync_wait = 0;
WHILE 1 DO
INSERT INTO t1 (f1, f2) VALUES (DEFAULT,'abcdef');
END WHILE;
END|
CREATE PROCEDURE insert_multi ()
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET SESSION wsrep_sync_wait = 0;
WHILE 1 DO
INSERT INTO t1 (f1) VALUES (DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT),(DEFAULT);
END WHILE;
END|
CREATE PROCEDURE insert_transaction ()
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET SESSION wsrep_sync_wait = 0;
SET AUTOCOMMIT = OFF;
WHILE 1 DO
START TRANSACTION;
INSERT INTO t1 (f1) VALUES (DEFAULT);
INSERT INTO t1 (f1) VALUES (DEFAULT);
INSERT INTO t1 (f1) VALUES (DEFAULT);
INSERT INTO t1 (f1) VALUES (DEFAULT);
INSERT INTO t1 (f1) VALUES (DEFAULT);
INSERT INTO t1 (f1) VALUES (DEFAULT);
INSERT INTO t1 (f1) VALUES (DEFAULT);
INSERT INTO t1 (f1) VALUES (DEFAULT);
INSERT INTO t1 (f1) VALUES (DEFAULT);
INSERT INTO t1 (f1) VALUES (DEFAULT);
COMMIT;
END WHILE;
END|
CREATE PROCEDURE update_simple ()
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET SESSION wsrep_sync_wait = 0;
WHILE 1 DO
UPDATE t1 SET f2 = CONCAT(f2,f2);
END WHILE;
END|
CREATE PROCEDURE insert_1k ()
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET SESSION wsrep_sync_wait = 0;
WHILE 1 DO
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024));
END WHILE;
END|
CREATE PROCEDURE insert_1m ()
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET SESSION wsrep_sync_wait = 0;
WHILE 1 DO
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024));
END WHILE;
END|
CREATE PROCEDURE insert_10m ()
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET SESSION wsrep_sync_wait = 0;
WHILE 1 DO
INSERT INTO t1 (f2) VALUES (REPEAT('x', 1024 * 1024 * 10));
END WHILE;
END|
CALL insert_simple();;
CALL insert_multi();;
CALL insert_transaction ();;
CALL update_simple ();;
CALL insert_1k ();;
CALL insert_1m ();;
CALL insert_10m ();;
SET SESSION wsrep_sync_wait = 0;
Killing server ...
Killing server ...
ERROR HY000: Lost connection to MySQL server during query
ERROR HY000: Lost connection to MySQL server during query
ERROR HY000: Lost connection to MySQL server during query
ERROR HY000: Lost connection to MySQL server during query
ERROR HY000: Lost connection to MySQL server during query
ERROR HY000: Lost connection to MySQL server during query
ERROR HY000: Lost connection to MySQL server during query
Performing --wsrep-recover ...
Using --wsrep-start-position when starting mysqld ...
Performing --wsrep-recover ...
Using --wsrep-start-position when starting mysqld ...
include/diff_servers.inc [servers=1 2]
DROP TABLE t1;
DROP TABLE ten;
DROP PROCEDURE insert_simple;
DROP PROCEDURE insert_multi;
DROP PROCEDURE insert_transaction;
DROP PROCEDURE update_simple;
DROP PROCEDURE insert_1k;
DROP PROCEDURE insert_1m;
CALL mtr.add_suppression("conflict state 7 after post commit");
CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
include/assert_grep.inc [async IST sender starting to serve]
CALL mtr.add_suppression("Skipped GCache ring buffer recovery");
include/assert_grep.inc [Recovering GCache ring buffer: found gapless sequence]

View file

@ -1,7 +1,7 @@
connection node_1;
connection node_2;
SELECT COUNT(*) = 900 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME LIKE 't%';
COUNT(*) = 900
SELECT COUNT(*) = 100 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME LIKE 't%';
COUNT(*) = 100
1
connection node_1;
SET AUTOCOMMIT=OFF;
@ -9,8 +9,8 @@ START TRANSACTION;
COMMIT;
connection node_2;
CREATE TABLE sum_table (f1 INTEGER);
SELECT SUM(f1) = 900 FROM sum_table;
SUM(f1) = 900
SELECT SUM(f1) = 100 FROM sum_table;
SUM(f1) = 100
1
connection node_1;
SET AUTOCOMMIT=OFF;
@ -18,11 +18,12 @@ START TRANSACTION;
connection node_2;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
UPDATE t900 SET f1 = 3;
UPDATE t100 SET f1 = 3;
connection node_1;
COMMIT;
connection node_2;
COMMIT;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
include/diff_servers.inc [servers=1 2]
DROP SCHEMA test;
CREATE SCHEMA test;

View file

@ -0,0 +1,40 @@
CALL mtr.add_suppression("Aborting");
CALL mtr.add_suppression("unknown option '--galera-unknown-option'");
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a');
SELECT * FROM t1;
f1 f2
1 a
2 a
3 a
Shutting down server ...
UPDATE t1 SET f2 = 'b' WHERE f1 > 1;
UPDATE t1 SET f2 = 'c' WHERE f1 > 2;
SELECT * FROM t1;
f1 f2
1 a
2 b
3 c
Starting server ...
Starting server ...
SELECT * FROM t1;
f1 f2
1 a
2 b
3 c
Shutting down server ...
UPDATE t1 SET f2 = 'd' WHERE f1 > 1;
UPDATE t1 SET f2 = 'd' WHERE f1 > 2;
SELECT * FROM t1;
f1 f2
1 a
2 d
3 d
Starting server ...
Starting server ...
SELECT * FROM t1;
f1 f2
1 a
2 d
3 d
DROP TABLE t1;

View file

@ -0,0 +1,23 @@
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE parent (
id INT PRIMARY KEY,
KEY (id)
) ENGINE=InnoDB;
CREATE TABLE child (
id INT PRIMARY KEY AUTO_INCREMENT,
parent_id INT
) ENGINE=InnoDB;
INSERT INTO parent VALUES (1);
INSERT INTO child (parent_id) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4;
ALTER TABLE child ADD FOREIGN KEY (parent_id) REFERENCES parent(id) ON UPDATE CASCADE;;
UPDATE parent SET id = 2 WHERE id = 1;;
SELECT COUNT(*) = 10000 FROM child WHERE parent_id = 2;
COUNT(*) = 10000
1
SELECT COUNT(*) = 10000 FROM child WHERE parent_id = 2;
COUNT(*) = 10000
1
DROP TABLE child;
DROP TABLE parent;
DROP TABLE ten;

View file

@ -0,0 +1,32 @@
connection node_1;
CREATE DATABASE database1;
USE database1;
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB;
SET SESSION wsrep_retry_autocommit = 0;
INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;;
connection node_1a;
USE database1;
SET SESSION wsrep_retry_autocommit = 0;
INSERT INTO t2 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;;
connection node_2;
DROP DATABASE database1;;
connection node_1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection node_1a;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection node_2;
connection node_1;
SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'database1';
COUNT(*) = 0
1
USE database1;
ERROR 42000: Unknown database 'database1'
connection node_2;
SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = 'database1';
COUNT(*) = 0
1
USE database1;
ERROR 42000: Unknown database 'database1'

View file

@ -0,0 +1,22 @@
connection node_1;
CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
connection node_2;
SET SESSION wsrep_retry_autocommit = 0;
INSERT INTO t1 (f1) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6;;
connection node_1;
TRUNCATE TABLE t1;;
connection node_1;
connection node_2;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection node_2;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
connection node_1;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
DROP TABLE t1;
DROP TABLE ten;

View file

@ -43,6 +43,7 @@ CALL mtr.add_suppression("failed to open gcomm backend connection: 110: failed t
CALL mtr.add_suppression("Failed to open backend connection: -110 \\(Connection timed out\\)");
CALL mtr.add_suppression("gcs connect failed: Connection timed out");
CALL mtr.add_suppression("WSREP: wsrep::connect\\(foo://\\) failed: 7");
CALL mtr.add_suppression("WSREP: wsrep::connect\\(gcomm://192.0.2.1\\) failed: 7");
disconnect node_2;
disconnect node_1;
# End of test

View file

@ -0,0 +1,32 @@
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB;
CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.f2 = SLEEP(5);
SET SESSION wsrep_retry_autocommit = 0;
INSERT INTO t1 (f1) VALUES (1),(2);;
TRUNCATE TABLE t1;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
SET SESSION wsrep_retry_autocommit = 1;
INSERT INTO t1 (f1) VALUES (3),(4);;
TRUNCATE TABLE t1;
SELECT * FROM test.t1;
f1 f2
3 0
4 0
CREATE PROCEDURE repeated_truncate ()
BEGIN
DECLARE i INT;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET i = 0;
WHILE i <= 1000 DO
TRUNCATE TABLE t1;
SET i = i + 1;
END WHILE;
END|
CALL repeated_truncate();
SET SESSION wsrep_retry_autocommit = 1;
INSERT INTO t1 (f1) VALUES (5),(6);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
SET SESSION wsrep_retry_autocommit = 1024;
INSERT INTO t1 (f1) VALUES (7),(8);;
include/diff_servers.inc [servers=1 2]
DROP TABLE t1;
DROP PROCEDURE repeated_truncate;

View file

@ -1,3 +1,4 @@
CALL mtr.add_suppression("WSREP: Refusing exit for the last slave thread.");
connection node_1;
CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB;
CREATE TABLE t2 (f1 INT AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB;

View file

@ -0,0 +1,25 @@
CREATE TABLE t1 (
f1 VARCHAR(255) PRIMARY KEY
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES ('abc');
connection node_2;
SELECT f1 = 'abc' FROM t1;
f1 = 'abc'
1
connection node_1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
UPDATE t1 SET f1 = 'klm';
connection node_2;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
UPDATE t1 SET f1 = 'xyz';
connection node_1;
COMMIT;
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2a;
connection node_2;
COMMIT;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
include/assert_grep.inc [cluster conflict due to high priority abort for threads]
DROP TABLE t1;

View file

@ -0,0 +1,5 @@
call mtr.add_suppression("WSREP\: Unknown parameter 'gmcasts\.segment'");
call mtr.add_suppression("WSREP\: Set options returned 7");
SET GLOBAL wsrep_provider_options="gmcasts.segment=1";
ERROR HY000: Incorrect arguments to SET
Unhandled exceptions: 0

View file

@ -0,0 +1,23 @@
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
FLUSH TABLES t1 FOR EXPORT;
connection node_1;
ALTER TABLE t1 ADD COLUMN f2 INTEGER;
INSERT INTO t1 VALUES (2,3);
connection node_2;
UNLOCK TABLES;
### t1 should have column f2
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`f2` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * from t1;
id f2
1 NULL
2 3
connection node_1;
DROP TABLE t1;

View file

@ -0,0 +1,27 @@
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
FLUSH TABLE WITH READ LOCK;
### This shouldn't block.
FLUSH TABLES t1 FOR EXPORT;
connection node_1;
ALTER TABLE t1 ADD COLUMN f2 INTEGER;
connection node_2;
UNLOCK TABLES;
### t1 should have column f2
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`f2` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
connection node_1;
INSERT INTO t1 VALUES (2,3);
connection node_2;
SELECT * from t1;
id f2
1 NULL
2 3
connection node_1;
DROP TABLE t1;

View file

@ -0,0 +1,47 @@
connection node_1;
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
SET session wsrep_sync_wait=0;
SET session wsrep_causal_reads=OFF;
Warnings:
Warning 1287 '@@wsrep_causal_reads' is deprecated and will be removed in a future release. Please use '@@wsrep_sync_wait=1' instead
FLUSH TABLE WITH READ LOCK;
connection node_1;
ALTER TABLE t1 ADD COLUMN f2 INTEGER;
INSERT INTO t1 VALUES (2,3);
connection node_2a;
SET session wsrep_sync_wait=0;
SET session wsrep_causal_reads=OFF;
Warnings:
Warning 1287 '@@wsrep_causal_reads' is deprecated and will be removed in a future release. Please use '@@wsrep_sync_wait=1' instead
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
FLUSH TABLES t1 WITH READ LOCK;;
connection node_2;
UNLOCK TABLES;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
connection node_2a;
UNLOCK TABLES;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`f2` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * from t1;
id f2
1 NULL
2 3
connection node_1;
DROP TABLE t1;

View file

@ -0,0 +1,23 @@
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
FLUSH TABLES t1 WITH READ LOCK;
connection node_1;
ALTER TABLE t1 ADD COLUMN f2 INTEGER;
INSERT INTO t1 VALUES (2,3);
connection node_2;
UNLOCK TABLES;
### t1 should have column f2
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) NOT NULL,
`f2` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
SELECT * from t1;
id f2
1 NULL
2 3
connection node_1;
DROP TABLE t1;

View file

@ -0,0 +1,42 @@
connection node_1;
set GLOBAL wsrep_slave_threads=26;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 (f1) SELECT * from t1 as x1;
connection node_2;
set GLOBAL wsrep_slave_threads=16;
SET GLOBAL wsrep_provider='none';
INSERT INTO t1 VALUES (2);
connection node_1;
INSERT INTO t1 VALUES (3);
connection node_2;
INSERT INTO t1 VALUES (4);
set GLOBAL wsrep_slave_threads=5;
SELECT COUNT(*) = 5 FROM t1;
COUNT(*) = 5
1
connection node_1;
set GLOBAL wsrep_slave_threads=12;
SELECT COUNT(*) = 4 FROM t1;
COUNT(*) = 4
1
INSERT INTO t1 VALUES (100), (101), (102);
connection node_2;
set GLOBAL wsrep_slave_threads=5;
INSERT INTO t1 (f1) SELECT * from t1 as x1;
show global variables like 'wsrep_slave_threads';
Variable_name Value
wsrep_slave_threads 5
SET GLOBAL wsrep_slave_threads = 1;
SELECT COUNT(*) FROM t1;
COUNT(*)
16
connection node_1;
SELECT COUNT(*) FROM t1;
COUNT(*)
15
show global variables like 'wsrep_slave_threads';
Variable_name Value
wsrep_slave_threads 12
SET GLOBAL wsrep_slave_threads = 1;
DROP TABLE t1;

View file

@ -0,0 +1,51 @@
# This tests proper desync counter cleanup when DONOR/DESYNC state is cleared.
--source include/galera_cluster.inc
--source include/have_innodb.inc
# Make node 1 tolerate split-brain
SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true';
# Desync and disconnect node 2 from the PC:
--connection node_2
SET @@global.wsrep_desync = 1;
SET SESSION wsrep_dirty_reads=1;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
# Wait until node 2 disappears from the PC:
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
# Modify app state to force node 2 into PRIMARY upon reconnection.
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1));
# Reconnect node 2 to the PC:
--connection node_2
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
# Must return 0:
SHOW STATUS LIKE 'wsrep_desync_count';
# Resync node_2, should pass:
SET @@global.wsrep_desync = 0;
--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
--source include/wait_condition.inc
SHOW CREATE TABLE t1;
DROP TABLE t1;
CALL mtr.add_suppression("WSREP: Protocol violation. JOIN message sender (.*) is not in state transfer \\(SYNCED\\). Message ignored.");
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=false';

View file

@ -0,0 +1,35 @@
#
# GAL-419 safe_to_bootstrap: boostrap using wsrep_cluster_address=gcomm:// not prevented
#
--source include/galera_cluster.inc
--source include/big_test.inc
--connection node_2
SET SESSION wsrep_sync_wait = 0;
--source include/kill_galera.inc
--connection node_1
SET SESSION wsrep_sync_wait = 0;
--source include/kill_galera.inc
--sleep 2
# Node #1 has wsrep_cluster_address=gcomm:// in my.cnf, so should fail to bootstrap
--error 1
--exec $MYSQLD --defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf | grep 'This node is not safe to bootstrap the cluster'
# Unless we remove grastate.dat
--remove_file $MYSQLTEST_VARDIR/mysqld.1/data/grastate.dat
--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
--connection node_1
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/start_mysqld.inc
--source include/wait_until_connected_again.inc
--connection node_2
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--source include/start_mysqld.inc

View file

@ -0,0 +1,46 @@
--source include/galera_cluster.inc
--connection node_1
CREATE TABLE t1 (f1 CHAR(10), f0 integer) ENGINE=InnoDB;
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
ALTER TABLE t1 DROP COLUMN f1;
SET SESSION wsrep_osu_method='RSU';
ALTER TABLE t1 ADD COLUMN f1 CHAR(10);
ALTER TABLE t1 DROP COLUMN f1;
ALTER TABLE t1 ADD COLUMN f2 CHAR(10);
ALTER TABLE t1 DROP COLUMN f2;
ALTER TABLE t1 ADD COLUMN f3 CHAR(10);
ALTER TABLE t1 DROP COLUMN f3;
ALTER TABLE t1 ADD COLUMN f4 CHAR(10);
ALTER TABLE t1 DROP COLUMN f4;
ALTER TABLE t1 ADD COLUMN f5 CHAR(10);
ALTER TABLE t1 DROP COLUMN f5;
ALTER TABLE t1 ADD COLUMN f6 CHAR(10);
ALTER TABLE t1 DROP COLUMN f6;
ALTER TABLE t1 ADD COLUMN f7 CHAR(10);
ALTER TABLE t1 DROP COLUMN f7;
ALTER TABLE t1 ADD COLUMN f8 CHAR(10);
ALTER TABLE t1 DROP COLUMN f8;
ALTER TABLE t1 ADD COLUMN f9 CHAR(10);
ALTER TABLE t1 DROP COLUMN f9;
ALTER TABLE t1 ADD COLUMN f10 CHAR(10);
ALTER TABLE t1 DROP COLUMN f10;
ALTER TABLE t1 ADD COLUMN f11 CHAR(10);
ALTER TABLE t1 DROP COLUMN f11;
ALTER TABLE t1 ADD COLUMN f12 CHAR(10);
ALTER TABLE t1 DROP COLUMN f12;
ALTER TABLE t1 ADD COLUMN f13 CHAR(10);
ALTER TABLE t1 DROP COLUMN f13;
ALTER TABLE t1 ADD COLUMN f14 CHAR(10);
ALTER TABLE t1 DROP COLUMN f14;
ALTER TABLE t1 ADD COLUMN f15 CHAR(10);
ALTER TABLE t1 DROP COLUMN f15;
ALTER TABLE t1 ADD COLUMN f16 CHAR(10);
ALTER TABLE t1 DROP COLUMN f16;
SET SESSION wsrep_osu_method='TOI';
DROP TABLE t1;

View file

@ -34,7 +34,7 @@ UNLOCK TABLES;
--connection node_1
--echo value after RSU:
--sleep 2
--sleep 3
SHOW STATUS LIKE 'wsrep_desync_count';
SHOW VARIABLES LIKE 'wsrep_desync';
SET GLOBAL wsrep_desync=0;

View file

@ -0,0 +1 @@
--log-bin --log-slave-updates

View file

@ -0,0 +1,51 @@
#
# MW-313 Enforce wsrep_max_ws_rows also when binlog is enabled
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_binlog_format_row.inc
# No error expected for SELECT and SHOW
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
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;
SET GLOBAL wsrep_max_ws_rows = 2;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
SELECT * FROM t1 GROUP BY f1;
SELECT * FROM t1 GROUP BY f1;
--error 0
SELECT * FROM t1 GROUP BY f1;
--disable_result_log
--error 0
SHOW STATUS LIKE '%wsrep%';
--enable_result_log
# Error expected for DML
--error ER_ERROR_DURING_COMMIT
INSERT INTO t1 SELECT * FROM t1;
START TRANSACTION;
INSERT INTO t1 (f1) VALUES (1);
--error ER_ERROR_DURING_COMMIT
INSERT INTO t1 (f1) VALUES (2),(3),(4);
ROLLBACK;
START TRANSACTION;
--error ER_ERROR_DURING_COMMIT
DELETE FROM t1;
DROP TABLE t1;
SET GLOBAL wsrep_max_ws_rows = 0;

View file

@ -0,0 +1,18 @@
#
# Cleanup for MW-328 tests
#
--connection node_1
--disable_query_log
--eval KILL CONNECTION $sp_connection_id
--enable_query_log
--connection node_1X
--error 2013,1317
--reap
--connection node_1
DROP PROCEDURE proc_update;
DROP TABLE t1, t2;
CALL mtr.add_suppression("conflict state 3 after post commit");

View file

@ -0,0 +1,29 @@
#
# Initialization for MW-328 tests
#
CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB;
INSERT INTO t1 (f1) VALUES (1);
CREATE TABLE t2 (f1 CHAR(20)) ENGINE=InnoDB;
#
# Have some random updates going on against t1
#
DELIMITER |;
CREATE PROCEDURE proc_update ()
BEGIN
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
SET SESSION wsrep_sync_wait = 0;
WHILE 1 DO
UPDATE t1 SET f2 = LEFT(MD5(RAND()), 4);
END WHILE;
END|
DELIMITER ;|
--connect node_1X, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connection node_1X
--let $sp_connection_id = `SELECT CONNECTION_ID()`
--send CALL proc_update();

View file

@ -0,0 +1,56 @@
#
# MW-328 Fix unnecessary/silent BF aborts
#
#
# Attempt to insert into t2 and check if insert actually inserted rows if
# a success was reported.
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source suite/galera/t/MW-328-header.inc
--connection node_2
--let $count = 100
--let $successes = 0
--let $deadlocks = 0
SET SESSION wsrep_retry_autocommit = 0;
--disable_query_log
while ($count)
{
TRUNCATE TABLE t2;
--error 0,1213
INSERT IGNORE INTO t2 SELECT f2 FROM t1;
if ($mysql_errno != 1213) {
--inc $successes
if (`SELECT COUNT(*) = 0 FROM t2`) {
--die No rows arrived in table t2
}
}
if ($mysql_errno == 1213) {
--inc $deadlocks
}
--dec $count
}
--enable_query_log
#
# Check that the test produced both deadlocks and successes
#
--disable_query_log
--eval SELECT $successes > 0 AS have_successes
--eval SELECT $deadlocks > 0 AS have_deadlocks
--enable_query_log
--source suite/galera/t/MW-328-footer.inc

View file

@ -0,0 +1,36 @@
#
# MW-328 Fix unnecessary/silent BF aborts
#
#
# Make sure an unrelated SELECT following a BF-aborted query never
# gets the deadlock error
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source suite/galera/t/MW-328-header.inc
--connection node_2
--let $count = 100
SET SESSION wsrep_retry_autocommit = 0;
--disable_query_log
while ($count)
{
--error 0,1213
INSERT IGNORE INTO t2 SELECT f2 FROM t1;
--disable_result_log
--error 0
SELECT 1 FROM DUAL;
--enable_result_log
--dec $count
}
--enable_query_log
--source suite/galera/t/MW-328-footer.inc

View file

@ -0,0 +1,36 @@
#
# MW-328 Fix unnecessary/silent BF aborts
#
#
# Make sure that a high value of wsrep_retry_autocommit
# masks all deadlock errors
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source suite/galera/t/MW-328-header.inc
--connection node_2
--let $count = 100
SET SESSION wsrep_retry_autocommit = 10000;
--disable_query_log
while ($count)
{
--error 0
INSERT IGNORE INTO t2 SELECT f2 FROM t1;
--disable_result_log
--error 0
SELECT 1 FROM DUAL;
--enable_result_log
--dec $count
}
--enable_query_log
--source suite/galera/t/MW-328-footer.inc

View file

@ -0,0 +1,40 @@
#
# MW-328 Fix unnecessary/silent BF aborts
#
#
# Test that non-Galera deadlock error still behaves as expected
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE TABLE t1 (i INT) ENGINE = InnoDB;
INSERT INTO t1 (i) VALUES(1);
CREATE TABLE t2 (i INT) ENGINE = InnoDB;
# Create a deadlock situation
--connection node_1
SET AUTOCOMMIT=OFF;
START TRANSACTION;
SELECT * FROM t1 WHERE i = 1 LOCK IN SHARE MODE;
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connection node_1a
SET AUTOCOMMIT=OFF;
START TRANSACTION;
--send INSERT IGNORE INTO t2 SELECT * FROM t1 WHERE i = 1 FOR UPDATE;
--connection node_1
--sleep 2
DELETE FROM t1 WHERE i = 1;
COMMIT;
# We expect that ER_LOCK_DEADLOCK will be delivered even though it was a INSERT INGORE statement
--connection node_1a
--error ER_LOCK_DEADLOCK
--reap
DROP TABLE t1, t2;

View file

@ -0,0 +1,41 @@
#
# MW-328 Fix unnecessary/silent BF aborts
#
#
# Test that non-Galera deadlock error still behaves as expected (case #2)
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
create table t1 (i int primary key, j int) engine=innodb;
create table t2 (i int primary key, j int) engine=innodb;
insert into t1 values (1,0);
insert into t2 values (2,0);
set autocommit=off;
start transaction;
update t1 set j=1 where i=1;
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connection node_1a
set autocommit=off;
start transaction;
begin;
update t2 set j=1 where i=2;
--connection node_1
# Hang expected here
--send insert into t1 select * from t2;
--sleep 2
--connection node_1a
--error ER_LOCK_DEADLOCK
insert into t2 select * from t1;
--connection node_1
--reap
DROP TABLE t1, t2;

View file

@ -0,0 +1 @@
--wsrep-retry-autocommit=0

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