Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä 2020-09-24 10:21:26 +03:00
commit 6ce0a6f9ad
333 changed files with 7738 additions and 6232 deletions

View File

@ -12,8 +12,6 @@ cache:
timeout: 500
apt: true
ccache: true
directories:
- /usr/local/Cellar # Fails do to permission error: https://github.com/travis-ci/travis-ci/issues/8092
addons:
apt:
@ -155,7 +153,7 @@ jobs:
script: *deb-script
# Just one OS X build is enough
- os: osx
osx_image: xcode11.3
osx_image: xcode12u
compiler: clang
env: CC_VERSION=8 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main
# Some chosen ones with s390x and gcc

View File

@ -1182,7 +1182,7 @@ static int check_version_match(void)
extract_variable_from_show(&ds_version, version_str))
{
print_error("Version check failed. Got the following error when calling "
"the 'mysql' command line client", &ds_version);
"the 'mysql_upgrade' command line client", &ds_version);
dynstr_free(&ds_version);
return 1; /* Query failed */
}

View File

@ -975,8 +975,12 @@ static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
my_b_printf(body_cache, "'%s\n", print_event_info->delimiter);
// flush cache
if ((copy_event_cache_to_file_and_reinit(&print_event_info->head_cache, result_file) ||
copy_event_cache_to_file_and_reinit(&print_event_info->body_cache, result_file)))
if ((copy_event_cache_to_file_and_reinit(&print_event_info->head_cache,
result_file) ||
copy_event_cache_to_file_and_reinit(&print_event_info->body_cache,
result_file) ||
copy_event_cache_to_file_and_reinit(&print_event_info->tail_cache,
result_file)))
return 1;
}
}

View File

@ -42,8 +42,7 @@ ADD_SUBDIRECTORY(libmariadb)
IF(UNIX)
INSTALL(CODE "EXECUTE_PROCESS(
COMMAND ${CMAKE_COMMAND} -E make_directory ${INSTALL_BINDIR}
WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX})
COMMAND ${CMAKE_COMMAND} -E make_directory \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR})
EXECUTE_PROCESS(
COMMAND ${CMAKE_COMMAND} -E create_symlink mariadb_config ${INSTALL_BINDIR}/mariadb-config
WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX})"

View File

@ -102,12 +102,6 @@
/* Libraries */
#cmakedefine HAVE_LIBWRAP 1
#cmakedefine HAVE_SYSTEMD 1
#cmakedefine HAVE_CRC32_VPMSUM 1
/* Support ARMv8 crc + crypto */
#cmakedefine HAVE_ARMV8_CRC 1
#cmakedefine HAVE_ARMV8_CRYPTO 1
#cmakedefine HAVE_ARMV8_CRC_CRYPTO_INTRINSICS 1
/* Does "struct timespec" have a "sec" and "nsec" field? */
#cmakedefine HAVE_TIMESPEC_TS_SEC 1

View File

@ -73,20 +73,8 @@ IF(WITH_INNOBASE_STORAGE_ENGINE)
# We use the InnoDB code directly in case the code changes.
ADD_DEFINITIONS("-DUNIV_INNOCHECKSUM")
# Avoid generating Hardware Capabilities due to crc32 instructions
IF(CMAKE_SYSTEM_NAME MATCHES "SunOS" AND CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
MY_CHECK_CXX_COMPILER_FLAG("-Wa,-nH")
IF(have_CXX__Wa__nH)
ADD_COMPILE_FLAGS(
../storage/innobase/ut/ut0crc32.cc
COMPILE_FLAGS "-Wa,-nH"
)
ENDIF()
ENDIF()
SET(INNOBASE_SOURCES
../storage/innobase/buf/buf0checksum.cc
../storage/innobase/ut/ut0crc32.cc
../storage/innobase/ut/ut0ut.cc
../storage/innobase/buf/buf0buf.cc
../storage/innobase/page/page0zip.cc

View File

@ -1583,7 +1583,6 @@ int main(
/* enable when space_id of given file is zero. */
bool is_system_tablespace = false;
ut_crc32_init();
MY_INIT(argv[0]);
DBUG_ENTER("main");
DBUG_PROCESS(argv[0]);

View File

@ -1786,7 +1786,6 @@ copy_back()
srv_max_n_threads = 1000;
sync_check_init();
ut_crc32_init();
/* copy undo tablespaces */

View File

@ -1083,6 +1083,7 @@ write_slave_info(MYSQL *connection)
char *master = NULL;
char *filename = NULL;
char *gtid_executed = NULL;
char *using_gtid = NULL;
char *position = NULL;
char *gtid_slave_pos = NULL;
char *ptr;
@ -1093,6 +1094,7 @@ write_slave_info(MYSQL *connection)
{"Relay_Master_Log_File", &filename},
{"Exec_Master_Log_Pos", &position},
{"Executed_Gtid_Set", &gtid_executed},
{"Using_Gtid", &using_gtid},
{NULL, NULL}
};
@ -1133,7 +1135,8 @@ write_slave_info(MYSQL *connection)
ut_a(asprintf(&mysql_slave_position,
"master host '%s', purge list '%s'",
master, gtid_executed) != -1);
} else if (gtid_slave_pos && *gtid_slave_pos) {
} else if (gtid_slave_pos && *gtid_slave_pos &&
!(using_gtid && !strncmp(using_gtid, "No", 2))) {
/* MariaDB >= 10.0 with GTID enabled */
result = backup_file_printf(XTRABACKUP_SLAVE_INFO,
"SET GLOBAL gtid_slave_pos = '%s';\n"

View File

@ -28,7 +28,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
#include "write_filt.h"
#include "fil_cur.h"
#include "xtrabackup.h"
#include <os0proc.h>
/************************************************************************
Write-through page write filter. */

View File

@ -97,8 +97,6 @@ main(int argc, char **argv)
{
MY_INIT(argv[0]);
my_checksum_init();
if (get_options(&argc, &argv)) {
goto err;
}

View File

@ -2689,6 +2689,7 @@ static bool xtrabackup_copy_logfile(bool last = false)
ut_a(dst_log_file != NULL);
ut_ad(recv_sys.is_initialised());
bool overwritten_block = false;
lsn_t start_lsn;
lsn_t end_lsn;
@ -2714,6 +2715,11 @@ static bool xtrabackup_copy_logfile(bool last = false)
}
if (lsn == start_lsn) {
overwritten_block= !recv_sys.found_corrupt_log
&& log_block_calc_checksum_crc32(log_sys.buf) ==
log_block_get_checksum(log_sys.buf)
&& log_block_get_hdr_no(log_sys.buf) >
log_block_convert_lsn_to_no(start_lsn);
start_lsn = 0;
} else {
mutex_enter(&recv_sys.mutex);
@ -2724,9 +2730,13 @@ static bool xtrabackup_copy_logfile(bool last = false)
log_mutex_exit();
if (!start_lsn) {
die(recv_sys.found_corrupt_log
? "xtrabackup_copy_logfile() failed: corrupt log."
: "xtrabackup_copy_logfile() failed.");
const char *reason = recv_sys.found_corrupt_log
? "corrupt log."
: (overwritten_block
? "redo log block is overwritten, please increase redo log size with innodb_log_file_size parameter."
: "redo log block checksum does not match.");
die("xtrabackup_copy_logfile() failed: %s", reason);
return true;
}
} while (start_lsn == end_lsn);
@ -4002,9 +4012,6 @@ fail:
ut_d(sync_check_enable());
/* Reset the system variables in the recovery module. */
trx_pool_init();
ut_crc32_init();
my_checksum_init();
recv_sys.create();
#ifdef WITH_INNODB_DISALLOW_WRITES
@ -5377,7 +5384,6 @@ static bool xtrabackup_prepare_func(char** argv)
sync_check_init();
ut_d(sync_check_enable());
ut_crc32_init();
recv_sys.create();
log_sys.create();
recv_sys.recovery_on = true;

View File

@ -19,6 +19,8 @@ ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64")
MY_CHECK_C_COMPILER_FLAG(-maes)
MY_CHECK_C_COMPILER_FLAG(-msse4)
MY_CHECK_C_COMPILER_FLAG(-mpclmul)
MY_CHECK_C_COMPILER_FLAG(-mrdrnd)
MY_CHECK_C_COMPILER_FLAG(-mrdseed)
IF(have_C__maes AND have_C__msse4 AND have_C__mpclmul)
SET(WOLFSSL_INTELASM ON)
ENDIF()
@ -113,20 +115,27 @@ IF(WOLFSSL_INTELASM)
LIST(APPEND WOLFCRYPT_SOURCES ${WOLFCRYPT_SRCDIR}/cpuid.c)
IF(MSVC)
LIST(APPEND WOLFCRYPT_SOURCES ${WOLFCRYPT_SRCDIR}/aes_asm.asm)
SET(WOLFSSL_X86_64_BUILD 1)
SET(HAVE_INTEL_RDSEED 1)
SET(HAVE_INTEL_RDRAND 1)
IF(CMAKE_C_COMPILER_ID MATCHES Clang)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes")
ELSE()
SET(HAVE_INTEL_RDSEED 1)
SET(WOLFSSL_X86_64_BUILD 1)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes -msse4.2 -mpclmul -mrdrnd -mrdseed")
ENDIF()
ELSEIF(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64")
SET(HAVE_INTEL_RDSEED 1)
SET(USE_INTEL_SPEEDUP 1)
LIST(APPEND WOLFCRYPT_SOURCES
${WOLFCRYPT_SRCDIR}/aes_asm.S
${WOLFCRYPT_SRCDIR}/sha512_asm.S
${WOLFCRYPT_SRCDIR}/sha256_asm.S)
ADD_DEFINITIONS(-maes -msse4 -mpclmul)
IF(have_C__mrdrnd)
SET(HAVE_INTEL_RDRAND 1)
ADD_DEFINITIONS(-mrdrnd)
ENDIF()
IF(have_C__mrdseed)
SET(HAVE_INTEL_RDSEED 1)
ADD_DEFINITIONS(-mrdseed)
ENDIF()
ENDIF()
ENDIF()

View File

@ -32,6 +32,7 @@
#cmakedefine USE_FAST_MATH
#cmakedefine TFM_TIMING_RESISTANT
#cmakedefine HAVE_INTEL_RDSEED
#cmakedefine HAVE_INTEL_RDRAND
#cmakedefine USE_INTEL_SPEEDUP
#cmakedefine USE_FAST_MATH
#cmakedefine WOLFSSL_X86_64_BUILD

View File

@ -48,6 +48,8 @@ public:
{ return m.fetch_add(i, o); }
Type fetch_sub(const Type i, std::memory_order o= std::memory_order_relaxed)
{ return m.fetch_sub(i, o); }
Type fetch_xor(const Type i, std::memory_order o= std::memory_order_relaxed)
{ return m.fetch_xor(i, o); }
bool compare_exchange_strong(Type& i1, const Type i2,
std::memory_order o1= std::memory_order_relaxed,
std::memory_order o2= std::memory_order_relaxed)

View File

@ -53,6 +53,7 @@
#ifdef _WIN32
#elif defined HAVE_PAUSE_INSTRUCTION
#elif defined(_ARCH_PWR8)
#elif defined __GNUC__ && (defined __arm__ || defined __aarch64__)
#else
# include "my_global.h"
# include "my_atomic.h"
@ -81,6 +82,9 @@ static inline void MY_RELAX_CPU(void)
#endif
#elif defined(_ARCH_PWR8)
__ppc_get_timebase();
#elif defined __GNUC__ && (defined __arm__ || defined __aarch64__)
/* Mainly, prevent the compiler from optimizing away delay loops */
__asm__ __volatile__ ("":::"memory");
#else
int32 var, oldval = 0;
my_atomic_cas32_strong_explicit(&var, &oldval, 1, MY_MEMORY_ORDER_RELAXED,

View File

@ -905,18 +905,10 @@ extern int my_compress_buffer(uchar *dest, size_t *destLen,
extern int packfrm(const uchar *, size_t, uchar **, size_t *);
extern int unpackfrm(uchar **, size_t *, const uchar *);
void my_checksum_init(void);
#ifdef HAVE_CRC32_VPMSUM
extern ha_checksum my_checksum(ha_checksum, const void *, size_t);
#else
typedef ha_checksum (*my_crc32_t)(ha_checksum, const void *, size_t);
extern MYSQL_PLUGIN_IMPORT my_crc32_t my_checksum;
#endif
extern uint32 my_checksum(uint32, const void *, size_t);
extern uint32 my_crc32c(uint32, const void *, size_t);
#if defined(__GNUC__) && defined(HAVE_ARMV8_CRC)
int crc32_aarch64_available(void);
const char *crc32c_aarch64_available(void);
#endif
extern const char *my_crc32c_implementation();
#ifdef DBUG_ASSERT_EXISTS
extern void my_debug_put_break_here(void);

View File

@ -88,6 +88,8 @@ extern struct wsrep_service_st {
my_bool (*wsrep_thd_has_ignored_error_func)(const MYSQL_THD thd);
void (*wsrep_thd_set_ignored_error_func)(MYSQL_THD thd, my_bool val);
bool (*wsrep_thd_set_wsrep_aborter_func)(MYSQL_THD bf_thd, MYSQL_THD thd);
void (*wsrep_report_bf_lock_wait_func)(const MYSQL_THD thd,
unsigned long long trx_id);
} *wsrep_service;
#define MYSQL_SERVICE_WSREP_INCLUDED
@ -132,6 +134,7 @@ extern struct wsrep_service_st {
#define wsrep_thd_has_ignored_error(T) wsrep_service->wsrep_thd_has_ignored_error_func(T)
#define wsrep_thd_set_ignored_error(T,V) wsrep_service->wsrep_thd_set_ignored_error_func(T,V)
#define wsrep_thd_set_wsrep_aborter(T) wsrep_service->wsrep_thd_set_wsrep_aborter_func(T1, T2)
#define wsrep_report_bf_lock_wait(T,I) wsrep_service->wsrep_report_bf_lock_wait(T,I)
#else
#define MYSQL_SERVICE_WSREP_STATIC_INCLUDED
@ -229,5 +232,7 @@ extern "C" ulong wsrep_OSU_method_get(const MYSQL_THD thd);
extern "C" my_bool wsrep_thd_has_ignored_error(const MYSQL_THD thd);
extern "C" void wsrep_thd_set_ignored_error(MYSQL_THD thd, my_bool val);
extern "C" bool wsrep_thd_set_wsrep_aborter(MYSQL_THD bf_thd, MYSQL_THD victim_thd);
extern "C" void wsrep_report_bf_lock_wait(const THD *thd,
unsigned long long trx_id);
#endif
#endif /* MYSQL_SERVICE_WSREP_INCLUDED */

View File

@ -0,0 +1,5 @@
[covering]
innodb_prefix_index_cluster_optimization=on
[unoptimized]
innodb_prefix_index_cluster_optimization=off

View File

@ -0,0 +1 @@
--source include/have_innodb.inc

View File

@ -347,7 +347,7 @@ sub resolve_at_variable {
or croak "There is no group named '$group_name' that ",
"can be used to resolve '$option_name' for test '$self->{testname}'";
my $value= $from_group->value($option_name);
my $value= $from_group->value($option_name) || '';
$res .= $before.$value;
}
$res .= $after;

View File

@ -10537,6 +10537,18 @@ SELECT CONVERT(1, CHAR) IN ('100', '10', '1');
CONVERT(1, CHAR) IN ('100', '10', '1')
1
#
# MDEV-23535 SIGSEGV, SIGABRT and SIGILL in typeinfo for Item_func_set_collation (on optimized builds)
#
SET NAMES utf8;
CREATE OR REPLACE TABLE t1(a DATETIME) ENGINE=MYISAM;
INSERT INTO t1 VALUES ('2019-03-10 02:55:05');
CREATE OR REPLACE TABLE t2(a VARCHAR(50) CHARACTER SET latin1) ENGINE=MYISAM;
INSERT INTO t2 VALUES ('2019-03-10 02:55:05');
SELECT * FROM t1 WHERE (SELECT 1,CONCAT(a) FROM t1) = (SELECT 1,CONCAT(a) FROM t2);
a
2019-03-10 02:55:05
DROP TABLE t1, t2;
#
# End of 10.1 tests
#
#

View File

@ -2052,6 +2052,18 @@ SELECT CONVERT(1, CHAR) IN ('100', 10, '101');
SELECT CONVERT(1, CHAR) IN ('100', 10, '1');
SELECT CONVERT(1, CHAR) IN ('100', '10', '1');
--echo #
--echo # MDEV-23535 SIGSEGV, SIGABRT and SIGILL in typeinfo for Item_func_set_collation (on optimized builds)
--echo #
SET NAMES utf8;
CREATE OR REPLACE TABLE t1(a DATETIME) ENGINE=MYISAM;
INSERT INTO t1 VALUES ('2019-03-10 02:55:05');
CREATE OR REPLACE TABLE t2(a VARCHAR(50) CHARACTER SET latin1) ENGINE=MYISAM;
INSERT INTO t2 VALUES ('2019-03-10 02:55:05');
SELECT * FROM t1 WHERE (SELECT 1,CONCAT(a) FROM t1) = (SELECT 1,CONCAT(a) FROM t2);
DROP TABLE t1, t2;
--echo #
--echo # End of 10.1 tests

View File

@ -120,3 +120,12 @@ flush tables;
drop table t2;
ERROR 42S02: Unknown table 'test.t2'
db.opt
#
# MDEV-23549 CREATE fails after DROP without FRM
#
create table t1 (a int);
select * from t1;
a
drop table t1;
create table t1 (a int);
drop table t1;

View File

@ -213,3 +213,14 @@ flush tables;
--error ER_BAD_TABLE_ERROR
drop table t2;
--list_files $DATADIR/test/
--echo #
--echo # MDEV-23549 CREATE fails after DROP without FRM
--echo #
create table t1 (a int);
select * from t1;
--remove_file $datadir/test/t1.frm
drop table t1;
create table t1 (a int);
drop table t1;

View File

@ -1,4 +1,4 @@
drop table if exists prefixinno;
SET @save_opt= @@GLOBAL.innodb_prefix_index_cluster_optimization;
set global innodb_prefix_index_cluster_optimization = ON;
show variables like 'innodb_prefix_index_cluster_optimization';
Variable_name Value
@ -346,10 +346,10 @@ f1
🐱🌑
select @cluster_lookups;
@cluster_lookups
2
1
select @cluster_lookups_avoided;
@cluster_lookups_avoided
0
1
# Eligible - record length is shorter than prefix length
SELECT f1 FROM t1 FORCE INDEX (`f1`) WHERE f1 like '🌑%';
f1
@ -366,10 +366,10 @@ f1
🌒
select @cluster_lookups;
@cluster_lookups
1
0
select @cluster_lookups_avoided;
@cluster_lookups_avoided
1
2
DROP TABLE t1;
CREATE TABLE t1(
col1 INT,
@ -398,4 +398,60 @@ select @cluster_lookups_avoided;
@cluster_lookups_avoided
0
DROP TABLE t1;
set global innodb_prefix_index_cluster_optimization = OFF;
#
# MDEV-20464 Division by 0 in row_search_with_covering_prefix()
#
CREATE TABLE t1 (f1 INT, f2 INT AS (f1), f3 INT AS (f1), f4 INT AS (f1),
KEY (f1,f2,f3)) ENGINE=InnoDB;
INSERT INTO t1 (f1) VALUES (NULL),(0);
SELECT f1, MAX(f3), COUNT(f4) FROM t1 GROUP BY f1;
f1 MAX(f3) COUNT(f4)
NULL NULL 0
0 0 1
DROP TABLE t1;
#
# MDEV-23600 Division by 0 in row_search_with_covering_prefix()
#
CREATE TABLE t(c POINT UNIQUE) ENGINE=InnoDB;
INSERT t SET c=POINT(1,1);
SELECT * FROM t WHERE c > (SELECT MAX(c) FROM t);
c
DROP TABLE t;
#
# MDEV-12486 Wrong results with innodb_prefix_index_cluster_optimization
#
CREATE TABLE wp_blogs (
blog_id bigint(20) NOT NULL auto_increment,
site_id bigint(20) NOT NULL default '0',
domain varchar(200) NOT NULL default '',
path varchar(100) NOT NULL default '',
registered datetime NOT NULL default '0000-00-00 00:00:00',
last_updated datetime NOT NULL default '0000-00-00 00:00:00',
public tinyint(2) NOT NULL default '1',
archived tinyint(2) NOT NULL default '0',
mature tinyint(2) NOT NULL default '0',
spam tinyint(2) NOT NULL default '0',
deleted tinyint(2) NOT NULL default '0',
lang_id int(11) NOT NULL default '0',
PRIMARY KEY (blog_id),
KEY domain (domain(50),path(5)),
KEY lang_id (lang_id)
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
INSERT INTO wp_blogs (domain, path) VALUES
('domain.no', '/fondsinvesteringer/'), ('domain.no', '/'),
('foo', 'bar'), ('bar', 'foo'), ('foo', 'foo'), ('bar', 'bar'),
('foo', 'foobar'), ('bar', 'foobar'), ('foobar', 'foobar');
SET GLOBAL innodb_prefix_index_cluster_optimization=off;
SELECT blog_id FROM wp_blogs WHERE domain IN ('domain.no')
AND path IN ( '/fondsinvesteringer/', '/' );
blog_id
2
1
SET GLOBAL innodb_prefix_index_cluster_optimization=on;
SELECT blog_id FROM wp_blogs WHERE domain IN ('domain.no')
AND path IN ( '/fondsinvesteringer/', '/' );
blog_id
2
1
DROP TABLE wp_blogs;
SET GLOBAL innodb_prefix_index_cluster_optimization = @save_opt;

View File

@ -1,9 +1,6 @@
-- source include/have_innodb.inc
--disable_warnings
drop table if exists prefixinno;
--enable_warnings
SET @save_opt= @@GLOBAL.innodb_prefix_index_cluster_optimization;
set global innodb_prefix_index_cluster_optimization = ON;
show variables like 'innodb_prefix_index_cluster_optimization';
@ -665,4 +662,58 @@ select @cluster_lookups;
select @cluster_lookups_avoided;
DROP TABLE t1;
set global innodb_prefix_index_cluster_optimization = OFF;
--echo #
--echo # MDEV-20464 Division by 0 in row_search_with_covering_prefix()
--echo #
CREATE TABLE t1 (f1 INT, f2 INT AS (f1), f3 INT AS (f1), f4 INT AS (f1),
KEY (f1,f2,f3)) ENGINE=InnoDB;
INSERT INTO t1 (f1) VALUES (NULL),(0);
SELECT f1, MAX(f3), COUNT(f4) FROM t1 GROUP BY f1;
DROP TABLE t1;
--echo #
--echo # MDEV-23600 Division by 0 in row_search_with_covering_prefix()
--echo #
CREATE TABLE t(c POINT UNIQUE) ENGINE=InnoDB;
INSERT t SET c=POINT(1,1);
SELECT * FROM t WHERE c > (SELECT MAX(c) FROM t);
DROP TABLE t;
--echo #
--echo # MDEV-12486 Wrong results with innodb_prefix_index_cluster_optimization
--echo #
CREATE TABLE wp_blogs (
blog_id bigint(20) NOT NULL auto_increment,
site_id bigint(20) NOT NULL default '0',
domain varchar(200) NOT NULL default '',
path varchar(100) NOT NULL default '',
registered datetime NOT NULL default '0000-00-00 00:00:00',
last_updated datetime NOT NULL default '0000-00-00 00:00:00',
public tinyint(2) NOT NULL default '1',
archived tinyint(2) NOT NULL default '0',
mature tinyint(2) NOT NULL default '0',
spam tinyint(2) NOT NULL default '0',
deleted tinyint(2) NOT NULL default '0',
lang_id int(11) NOT NULL default '0',
PRIMARY KEY (blog_id),
KEY domain (domain(50),path(5)),
KEY lang_id (lang_id)
) ENGINE=InnoDB DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
INSERT INTO wp_blogs (domain, path) VALUES
('domain.no', '/fondsinvesteringer/'), ('domain.no', '/'),
('foo', 'bar'), ('bar', 'foo'), ('foo', 'foo'), ('bar', 'bar'),
('foo', 'foobar'), ('bar', 'foobar'), ('foobar', 'foobar');
SET GLOBAL innodb_prefix_index_cluster_optimization=off;
SELECT blog_id FROM wp_blogs WHERE domain IN ('domain.no')
AND path IN ( '/fondsinvesteringer/', '/' );
SET GLOBAL innodb_prefix_index_cluster_optimization=on;
SELECT blog_id FROM wp_blogs WHERE domain IN ('domain.no')
AND path IN ( '/fondsinvesteringer/', '/' );
DROP TABLE wp_blogs;
SET GLOBAL innodb_prefix_index_cluster_optimization = @save_opt;

View File

@ -3591,5 +3591,11 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2, t1;
#
# MDEV-23680 Assertion `data' failed in crcr32_calc_pclmulqdq
#
SELECT CRC32(ExtractValue('<a><b/></a>', '/a/b')) AS f;
f
0
#
# End of 10.5 tests
#

View File

@ -1883,6 +1883,11 @@ CREATE TABLE t2 AS SELECT UUID_SHORT() - a FROM t1;
SHOW CREATE TABLE t2;
DROP TABLE t2, t1;
--echo #
--echo # MDEV-23680 Assertion `data' failed in crcr32_calc_pclmulqdq
--echo #
SELECT CRC32(ExtractValue('<a><b/></a>', '/a/b')) AS f;
--echo #
--echo # End of 10.5 tests

View File

@ -0,0 +1,295 @@
@@ -9,7 +9,7 @@
explain
select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 const,const 1 Using index
+1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 const 5 Using where
flush status;
select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
count(*)
@@ -19,7 +19,7 @@
Handler_read_first 0
Handler_read_key 1
Handler_read_last 0
-Handler_read_next 1
+Handler_read_next 5
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
@@ -50,7 +50,7 @@
select count(*) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 NULL 1 Using where; Using index
+1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index
flush status;
select count(*) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
@@ -61,7 +61,7 @@
Handler_read_first 0
Handler_read_key 1
Handler_read_last 0
-Handler_read_next 1
+Handler_read_next 6
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
@@ -71,7 +71,7 @@
select l_orderkey, l_linenumber from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 8 NULL 3 Using where; Using index
+1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index
flush status;
select l_orderkey, l_linenumber from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
@@ -84,7 +84,7 @@
Handler_read_first 0
Handler_read_key 1
Handler_read_last 0
-Handler_read_next 3
+Handler_read_next 6
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
@@ -93,7 +93,7 @@
explain
select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+1 SIMPLE lineitem ref i_l_shipdate i_l_shipdate 4 const 6 Using index
flush status;
select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
min(l_orderkey)
@@ -103,7 +103,7 @@
Handler_read_first 0
Handler_read_key 1
Handler_read_last 0
-Handler_read_next 0
+Handler_read_next 6
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
@@ -113,7 +113,7 @@
select min(l_orderkey) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index
flush status;
select min(l_orderkey) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
@@ -124,7 +124,7 @@
Handler_read_first 0
Handler_read_key 1
Handler_read_last 0
-Handler_read_next 0
+Handler_read_next 6
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
@@ -134,7 +134,7 @@
select max(l_linenumber) from lineitem
where l_shipdate='1992-07-01' and l_orderkey=130;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
+1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 const 5 Using where
flush status;
select max(l_linenumber) from lineitem
where l_shipdate='1992-07-01' and l_orderkey=130;
@@ -145,7 +145,7 @@
Handler_read_first 0
Handler_read_key 1
Handler_read_last 0
-Handler_read_next 0
+Handler_read_next 5
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
@@ -157,7 +157,7 @@
where l_shipdate='1992-07-01' and l_orderkey=130
or l_receiptdate='1992-07-01' and l_orderkey=5603;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 8,8 NULL 2 Using union(i_l_shipdate,i_l_receiptdate); Using where
+1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 4,4 NULL 9 Using union(i_l_shipdate,i_l_receiptdate); Using where
flush status;
select l_orderkey, l_linenumber
from lineitem use index (i_l_shipdate, i_l_receiptdate)
@@ -171,10 +171,10 @@
Handler_read_first 0
Handler_read_key 2
Handler_read_last 0
-Handler_read_next 2
+Handler_read_next 9
Handler_read_prev 0
Handler_read_retry 0
-Handler_read_rnd 2
+Handler_read_rnd 9
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
explain
@@ -183,7 +183,7 @@
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 8,8 NULL 3 Using sort_union(i_l_shipdate,i_l_receiptdate); Using where
+1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 4,4 NULL 9 Using union(i_l_shipdate,i_l_receiptdate); Using where
flush status;
select l_orderkey, l_linenumber
from lineitem use index (i_l_shipdate, i_l_receiptdate)
@@ -198,10 +198,10 @@
Handler_read_first 0
Handler_read_key 2
Handler_read_last 0
-Handler_read_next 3
+Handler_read_next 9
Handler_read_prev 0
Handler_read_retry 0
-Handler_read_rnd 3
+Handler_read_rnd 9
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
explain
@@ -209,7 +209,7 @@
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE lineitem index_merge PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate,i_l_receiptdate 8,8 NULL 3 Using sort_union(i_l_shipdate,i_l_receiptdate); Using where
+1 SIMPLE lineitem index_merge PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate,PRIMARY,i_l_receiptdate,PRIMARY 4,4,4,4 NULL 2 Using union(intersect(i_l_shipdate,PRIMARY),intersect(i_l_receiptdate,PRIMARY)); Using where
flush status;
select l_orderkey, l_linenumber from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
@@ -223,7 +223,7 @@
Handler_read_first 0
Handler_read_key 2
Handler_read_last 0
-Handler_read_next 3
+Handler_read_next 9
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 3
@@ -233,7 +233,7 @@
select max(l_orderkey) from lineitem
where l_partkey between 1 and 10 group by l_partkey;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE lineitem range i_l_suppkey_partkey,i_l_partkey i_l_partkey 5 NULL # Using where; Using index for group-by
+1 SIMPLE lineitem range i_l_suppkey_partkey,i_l_partkey i_l_partkey 5 NULL # Using where; Using index
flush status;
select max(l_orderkey) from lineitem
where l_partkey between 1 and 10 group by l_partkey;
@@ -251,9 +251,9 @@
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
-Handler_read_key 21
-Handler_read_last 1
-Handler_read_next 0
+Handler_read_key 1
+Handler_read_last 0
+Handler_read_next 294
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
@@ -263,7 +263,7 @@
select max(l_orderkey) from lineitem
where l_suppkey in (1,4) group by l_suppkey;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE lineitem range i_l_suppkey i_l_suppkey 5 NULL # Using where; Using index for group-by
+1 SIMPLE lineitem range i_l_suppkey i_l_suppkey 5 NULL # Using where; Using index
flush status;
select max(l_orderkey) from lineitem
where l_suppkey in (1,4) group by l_suppkey;
@@ -273,9 +273,9 @@
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
-Handler_read_key 6
-Handler_read_last 1
-Handler_read_next 0
+Handler_read_key 2
+Handler_read_last 0
+Handler_read_next 1230
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
@@ -291,7 +291,7 @@
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE part range i_p_retailprice i_p_retailprice 9 NULL # Using where; Using index
1 SIMPLE orders ref PRIMARY,i_o_orderdate i_o_orderdate 4 const # Using index
-1 SIMPLE lineitem ref i_l_partkey i_l_partkey 9 dbt3_s001.part.p_partkey,dbt3_s001.orders.o_orderkey # Using index
+1 SIMPLE lineitem ref i_l_partkey i_l_partkey 5 dbt3_s001.part.p_partkey # Using where; Using index
flush status;
select o_orderkey, p_partkey
from part use index (i_p_retailprice),
@@ -305,7 +305,7 @@
Handler_read_first 0
Handler_read_key 3
Handler_read_last 0
-Handler_read_next 3
+Handler_read_next 26
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
@@ -322,8 +322,8 @@
select * from t0, part ignore index (primary)
where p_partkey=t0.a and p_size=1;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t0 ALL NULL NULL NULL NULL 5 Using where
-1 SIMPLE part eq_ref i_p_size i_p_size 9 const,dbt3_s001.t0.a 1
+1 SIMPLE t0 ALL NULL NULL NULL NULL 5
+1 SIMPLE part ref i_p_size i_p_size 5 const 5 Using index condition
select * from t0, part ignore index (primary)
where p_partkey=t0.a and p_size=1;
a p_partkey p_name p_mfgr p_brand p_type p_size p_container p_retailprice p_comment
@@ -502,7 +502,7 @@
select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where
-1 SIMPLE t3 ref PRIMARY,col1 col1 12 test.t1.a,test.t1.a,test.t1.a # Using index
+1 SIMPLE t3 ref PRIMARY,col1 col1 8 test.t1.a,test.t1.a # Using where; Using index
drop table t1,t2,t3;
#
# Bug mdev-4340: performance regression with extended_keys=on
@@ -722,13 +722,13 @@
select * from t1 force index(index_date_updated)
where index_date_updated= 10 and index_id < 800;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 range index_date_updated index_date_updated 13 NULL # Using index condition
+1 SIMPLE t1 ref index_date_updated index_date_updated 5 const # Using index condition
# This used to work from the start:
explain
select * from t2 force index(index_date_updated)
where index_date_updated= 10 and index_id < 800;
id select_type table type possible_keys key key_len ref rows Extra
-1 SIMPLE t2 range index_date_updated index_date_updated 13 NULL # Using index condition
+1 SIMPLE t2 ref index_date_updated index_date_updated 5 const # Using index condition
drop table t0,t1,t2;
#
# MDEV-11196: Error:Run-Time Check Failure #2 - Stack around the variable 'key_buff'
@@ -763,11 +763,12 @@
"select_id": 1,
"table": {
"table_name": "t1",
- "access_type": "range",
+ "access_type": "ref",
"possible_keys": ["f2"],
"key": "f2",
- "key_length": "3070",
- "used_key_parts": ["f2", "pk1"],
+ "key_length": "3066",
+ "used_key_parts": ["f2"],
+ "ref": ["const"],
"rows": 1,
"filtered": 100,
"index_condition": "t1.pk1 <= 5 and t1.pk2 <= 5 and t1.f2 = 'abc'",
@@ -796,8 +797,8 @@
"access_type": "range",
"possible_keys": ["k1"],
"key": "k1",
- "key_length": "3011",
- "used_key_parts": ["pk1", "f2", "pk2"],
+ "key_length": "3007",
+ "used_key_parts": ["pk1", "f2"],
"rows": 1,
"filtered": 100,
"index_condition": "t1.f2 <= 5 and t1.pk2 <= 5 and t1.pk1 = 'abc'",

View File

@ -0,0 +1,5 @@
[on]
optimizer_switch=extended_keys=on
[off]
optimizer_switch=extended_keys=off

View File

@ -1,5 +1,3 @@
DROP TABLE IF EXISTS t1,t2,t3,t4;
DROP DATABASE IF EXISTS dbt3_s001;
SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB';
set @innodb_stats_persistent_save= @@innodb_stats_persistent;
set @innodb_stats_persistent_sample_pages_save=
@ -8,28 +6,6 @@ set global innodb_stats_persistent= 1;
set global innodb_stats_persistent_sample_pages=100;
CREATE DATABASE dbt3_s001;
use dbt3_s001;
set @save_ext_key_optimizer_switch=@@optimizer_switch;
set optimizer_switch='extended_keys=off';
explain
select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 const 5 Using where
flush status;
select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
count(*)
1
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
Handler_read_last 0
Handler_read_next 5
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=on';
explain
select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
id select_type table type possible_keys key key_len ref rows Extra
@ -49,29 +25,6 @@ Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=off';
explain
select count(*) from lineitem
where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE lineitem const PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 8 const,const 1
flush status;
select count(*) from lineitem
where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
count(*)
1
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=on';
explain
select count(*) from lineitem
where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
@ -93,29 +46,6 @@ Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=off';
explain
select count(*) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index
flush status;
select count(*) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
count(*)
1
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
Handler_read_last 0
Handler_read_next 6
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=on';
explain
select count(*) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
@ -137,31 +67,6 @@ Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=off';
explain
select l_orderkey, l_linenumber from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index
flush status;
select l_orderkey, l_linenumber from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
l_orderkey l_linenumber
1088 3
1217 1
1221 3
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
Handler_read_last 0
Handler_read_next 6
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=on';
explain
select l_orderkey, l_linenumber from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
@ -185,27 +90,6 @@ Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=off';
explain
select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE lineitem ref i_l_shipdate i_l_shipdate 4 const 6 Using index
flush status;
select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
min(l_orderkey)
130
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
Handler_read_last 0
Handler_read_next 6
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=on';
explain
select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
id select_type table type possible_keys key key_len ref rows Extra
@ -225,29 +109,6 @@ Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=off';
explain
select min(l_orderkey) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 const 6 Using where; Using index
flush status;
select min(l_orderkey) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
min(l_orderkey)
1088
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
Handler_read_last 0
Handler_read_next 6
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=on';
explain
select min(l_orderkey) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
@ -269,29 +130,6 @@ Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=off';
explain
select max(l_linenumber) from lineitem
where l_shipdate='1992-07-01' and l_orderkey=130;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE lineitem ref PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 const 5 Using where
flush status;
select max(l_linenumber) from lineitem
where l_shipdate='1992-07-01' and l_orderkey=130;
max(l_linenumber)
2
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
Handler_read_last 0
Handler_read_next 5
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=on';
explain
select max(l_linenumber) from lineitem
where l_shipdate='1992-07-01' and l_orderkey=130;
@ -313,34 +151,6 @@ Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=off';
explain
select l_orderkey, l_linenumber
from lineitem use index (i_l_shipdate, i_l_receiptdate)
where l_shipdate='1992-07-01' and l_orderkey=130
or l_receiptdate='1992-07-01' and l_orderkey=5603;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 4,4 NULL 9 Using union(i_l_shipdate,i_l_receiptdate); Using where
flush status;
select l_orderkey, l_linenumber
from lineitem use index (i_l_shipdate, i_l_receiptdate)
where l_shipdate='1992-07-01' and l_orderkey=130
or l_receiptdate='1992-07-01' and l_orderkey=5603;
l_orderkey l_linenumber
130 2
5603 2
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
Handler_read_last 0
Handler_read_next 9
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 9
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=on';
explain
select l_orderkey, l_linenumber
from lineitem use index (i_l_shipdate, i_l_receiptdate)
@ -367,35 +177,6 @@ Handler_read_retry 0
Handler_read_rnd 2
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=off';
explain
select l_orderkey, l_linenumber
from lineitem use index (i_l_shipdate, i_l_receiptdate)
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE lineitem index_merge i_l_shipdate,i_l_receiptdate i_l_shipdate,i_l_receiptdate 4,4 NULL 9 Using union(i_l_shipdate,i_l_receiptdate); Using where
flush status;
select l_orderkey, l_linenumber
from lineitem use index (i_l_shipdate, i_l_receiptdate)
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
l_orderkey l_linenumber
130 2
5603 2
5959 3
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
Handler_read_last 0
Handler_read_next 9
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 9
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=on';
explain
select l_orderkey, l_linenumber
from lineitem use index (i_l_shipdate, i_l_receiptdate)
@ -423,33 +204,6 @@ Handler_read_retry 0
Handler_read_rnd 3
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=off';
explain
select l_orderkey, l_linenumber from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE lineitem index_merge PRIMARY,i_l_shipdate,i_l_receiptdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate,PRIMARY,i_l_receiptdate,PRIMARY 4,4,4,4 NULL 2 Using union(intersect(i_l_shipdate,PRIMARY),intersect(i_l_receiptdate,PRIMARY)); Using where
flush status;
select l_orderkey, l_linenumber from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
l_orderkey l_linenumber
130 2
5603 2
5959 3
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
Handler_read_last 0
Handler_read_next 9
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 3
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=on';
explain
select l_orderkey, l_linenumber from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
@ -475,38 +229,6 @@ Handler_read_retry 0
Handler_read_rnd 3
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=off';
explain
select max(l_orderkey) from lineitem
where l_partkey between 1 and 10 group by l_partkey;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE lineitem range i_l_suppkey_partkey,i_l_partkey i_l_partkey 5 NULL # Using where; Using index
flush status;
select max(l_orderkey) from lineitem
where l_partkey between 1 and 10 group by l_partkey;
max(l_orderkey)
5984
5957
5892
5856
5959
5957
5794
5894
5859
5632
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 1
Handler_read_last 0
Handler_read_next 294
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=on';
explain
select max(l_orderkey) from lineitem
where l_partkey between 1 and 10 group by l_partkey;
@ -537,30 +259,6 @@ Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=off';
explain
select max(l_orderkey) from lineitem
where l_suppkey in (1,4) group by l_suppkey;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE lineitem range i_l_suppkey i_l_suppkey 5 NULL # Using where; Using index
flush status;
select max(l_orderkey) from lineitem
where l_suppkey in (1,4) group by l_suppkey;
max(l_orderkey)
5988
5984
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 2
Handler_read_last 0
Handler_read_next 1230
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=on';
explain
select max(l_orderkey) from lineitem
where l_suppkey in (1,4) group by l_suppkey;
@ -584,37 +282,6 @@ Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
create index i_p_retailprice on part(p_retailprice);
set optimizer_switch='extended_keys=off';
explain
select o_orderkey, p_partkey
from part use index (i_p_retailprice),
lineitem use index (i_l_partkey), orders
where p_retailprice > 1100 and o_orderdate='1997-01-01'
and o_orderkey=l_orderkey and p_partkey=l_partkey;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE part range i_p_retailprice i_p_retailprice 9 NULL # Using where; Using index
1 SIMPLE orders ref PRIMARY,i_o_orderdate i_o_orderdate 4 const # Using index
1 SIMPLE lineitem ref i_l_partkey i_l_partkey 5 dbt3_s001.part.p_partkey # Using where; Using index
flush status;
select o_orderkey, p_partkey
from part use index (i_p_retailprice),
lineitem use index (i_l_partkey), orders
where p_retailprice > 1100 and o_orderdate='1997-01-01'
and o_orderkey=l_orderkey and p_partkey=l_partkey;
o_orderkey p_partkey
5895 200
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 3
Handler_read_last 0
Handler_read_next 26
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
set optimizer_switch='extended_keys=on';
explain
select o_orderkey, p_partkey
from part use index (i_p_retailprice),
@ -651,7 +318,6 @@ Handler_read_rnd_next 0
create table t0 (a int);
insert into t0 values (1), (2), (3), (4), (5);
create index i_p_size on part(p_size);
set optimizer_switch='extended_keys=on';
explain
select * from t0, part ignore index (primary)
where p_partkey=t0.a and p_size=1;
@ -672,7 +338,6 @@ use test;
#
set @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='materialization=on,semijoin=on';
SET optimizer_switch='extended_keys=on';
CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1), (2,2);
SELECT * FROM t1 WHERE 2 IN (SELECT MAX(s1.a) FROM t1 AS s1, t1 AS s2);
@ -693,9 +358,7 @@ set optimizer_switch=@save_optimizer_switch;
# + extended_keys = on
# (valgrinf complains fixed by the patch for bug #914560)
#
set @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch = 'derived_with_keys=on';
SET optimizer_switch = 'extended_keys=on';
CREATE TABLE t1 (a varchar(1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('j'), ('v');
CREATE TABLE t2 (b varchar(1)) ENGINE=MyISAM;
@ -725,8 +388,6 @@ c int NOT NULL PRIMARY KEY
INSERT INTO t2 VALUES
(10), (11), (12), (13), (14),
(15), (16), (17), (18), (19), (24);
set @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch = 'extended_keys=off';
EXPLAIN
SELECT a FROM t1 AS t, t2
WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
@ -739,20 +400,6 @@ SELECT a FROM t1 AS t, t2
WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
a
24
SET optimizer_switch = 'extended_keys=on';
EXPLAIN
SELECT a FROM t1 AS t, t2
WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t index a,b b 7 NULL 10 Using index
1 PRIMARY t1 ref b b 3 test.t.b 2 Using index; Start temporary
1 PRIMARY t2 index NULL PRIMARY 4 NULL 11 Using index; End temporary; Using join buffer (flat, BNL join)
1 PRIMARY t2 eq_ref PRIMARY PRIMARY 4 test.t.a 1 Using index
SELECT a FROM t1 AS t, t2
WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
a
24
set optimizer_switch=@save_optimizer_switch;
DROP TABLE t1,t2;
#
# LP Bug #923236: hash join + extended_keys = on
@ -761,12 +408,10 @@ CREATE TABLE t1 (a int) ENGINE=MyISAM;
CREATE TABLE t2 (b int) ENGINE=MyISAM;
INSERT INTO t1 (a) VALUES (4), (6);
INSERT INTO t2 (b) VALUES (0), (8);
set @save_optimizer_switch=@@optimizer_switch;
set @save_join_cache_level=@@join_cache_level;
SET join_cache_level=3;
SET optimizer_switch='join_cache_hashed=on';
SET optimizer_switch='join_cache_bka=on';
SET optimizer_switch='extended_keys=on';
EXPLAIN
SELECT * FROM t1, t2 WHERE b=a;
id select_type table type possible_keys key key_len ref rows Extra
@ -791,26 +436,16 @@ UNIQUE KEY uq (c2,c3),
KEY c3 (c3),
KEY c4 (c4)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
set @save_optimizer_switch=@@optimizer_switch;
set session optimizer_switch='extended_keys=off';
INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
DELETE FROM t1;
set session optimizer_switch='extended_keys=on';
INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
set optimizer_switch=@save_optimizer_switch;
DROP TABLE t1;
#
# Bug mdev-4220: using ref instead of eq_ref
# with extended_keys=on
# (performance regression introduced in the patch for mdev-3851)
#
set @save_optimizer_switch=@@optimizer_switch;
create table t1 (a int not null) engine=innodb;
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
create table t2 (
@ -820,29 +455,6 @@ insert into t2
select
A.a + 10 * B.a, A.a + 10 * B.a, A.a + 10 * B.a
from t1 A, t1 B;
set optimizer_switch='extended_keys=off';
explain
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL #
1 SIMPLE t2 eq_ref a a 4 test.t1.a # Using where
flush status;
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
a pk a b
0 0 0 0
1 1 1 1
show status like 'handler_read%';
Variable_name Value
Handler_read_first 0
Handler_read_key 10
Handler_read_last 0
Handler_read_next 0
Handler_read_prev 0
Handler_read_retry 0
Handler_read_rnd 0
Handler_read_rnd_deleted 0
Handler_read_rnd_next 11
set optimizer_switch='extended_keys=on';
explain
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
id select_type table type possible_keys key key_len ref rows Extra
@ -881,18 +493,6 @@ test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t3 analyze status Engine-independent statistics collected
test.t3 analyze status OK
set optimizer_switch='extended_keys=off';
explain
select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where
1 SIMPLE t3 ref col1 col1 8 test.t1.a,test.t1.a # Using index
explain
select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL # Using where
1 SIMPLE t3 ref PRIMARY,col1 col1 8 test.t1.a,test.t1.a # Using where; Using index
set optimizer_switch='extended_keys=on';
explain
select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a;
id select_type table type possible_keys key key_len ref rows Extra
@ -907,7 +507,6 @@ drop table t1,t2,t3;
#
# Bug mdev-4340: performance regression with extended_keys=on
#
set @save_optimizer_switch=@@optimizer_switch;
CREATE TABLE t1 (
page_id int(8) unsigned NOT NULL AUTO_INCREMENT,
page_namespace int(11) NOT NULL DEFAULT '0',
@ -1011,16 +610,6 @@ INSERT INTO t3 VALUES
(89,'text-8008',''),(90,'text-9008',''),(91,'text-9',''),(92,'text-1009',''),
(93,'text-2009',''),(94,'text-3009',''),(95,'text-4009',''),(96,'text-5009',''),
(97,'text-6009',''),(98,'text-7009',''),(99,'text-8009',''),(100,'text-9009','');
set optimizer_switch='extended_keys=off';
EXPLAIN
SELECT * FROM t1, t2 IGNORE INDEX (PRIMARY), t3
WHERE page_id=rev_page AND rev_text_id=old_id AND page_namespace=4 AND page_title='Sandbox'
ORDER BY rev_timestamp ASC LIMIT 10;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY,name_title name_title 261 const,const 1
1 SIMPLE t2 ref page_timestamp page_timestamp 4 const 10 Using where
1 SIMPLE t3 eq_ref PRIMARY PRIMARY 4 test.t2.rev_text_id 1
set optimizer_switch='extended_keys=on';
EXPLAIN
SELECT * FROM t1, t2 IGNORE INDEX (PRIMARY), t3
WHERE page_id=rev_page AND rev_text_id=old_id AND page_namespace=4 AND page_title='Sandbox'
@ -1044,7 +633,6 @@ test.t1 analyze status Engine-independent statistics collected
test.t1 analyze status OK
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
set optimizer_switch='extended_keys=on';
explain select a from t1 where b is null order by a desc limit 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 index b PRIMARY 8 NULL 2 Using where
@ -1059,14 +647,6 @@ select a from t2 where b is null order by a desc limit 2;
a
3
2
set optimizer_switch='extended_keys=off';
explain select a from t2 where b is null order by a desc limit 2;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range b b 9 NULL 3 Using where; Using filesort
select a from t2 where b is null order by a desc limit 2;
a
3
2
explain select a from t2 where b is null order by a desc;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 index b PRIMARY 8 NULL 3 Using where
@ -1084,7 +664,6 @@ a
2
1
drop table t1, t2;
set optimizer_switch=@save_optimizer_switch;
#
# MDEV-10325: Queries examines all rows of a tables when it should not
#

View File

@ -1,9 +1,4 @@
--source include/have_innodb.inc
--disable_warnings
DROP TABLE IF EXISTS t1,t2,t3,t4;
DROP DATABASE IF EXISTS dbt3_s001;
--enable_warnings
--source include/innodb_prefix_index_cluster_optimization.inc
SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB';
@ -26,32 +21,12 @@ use dbt3_s001;
--enable_result_log
--enable_query_log
set @save_ext_key_optimizer_switch=@@optimizer_switch;
set optimizer_switch='extended_keys=off';
explain
select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
flush status;
select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
show status like 'handler_read%';
set optimizer_switch='extended_keys=on';
explain
select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
flush status;
select count(*) from lineitem where l_orderkey=130 and l_shipdate='1992-07-01';
show status like 'handler_read%';
set optimizer_switch='extended_keys=off';
explain
select count(*) from lineitem
where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
flush status;
select count(*) from lineitem
where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
show status like 'handler_read%';
set optimizer_switch='extended_keys=on';
explain
select count(*) from lineitem
where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
@ -60,7 +35,6 @@ select count(*) from lineitem
where l_orderkey=130 and l_linenumber=2 and l_shipdate='1992-07-01';
show status like 'handler_read%';
set optimizer_switch='extended_keys=off';
explain
select count(*) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
@ -69,16 +43,6 @@ select count(*) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
show status like 'handler_read%';
set optimizer_switch='extended_keys=on';
explain
select count(*) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
flush status;
select count(*) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000;
show status like 'handler_read%';
set optimizer_switch='extended_keys=off';
explain
select l_orderkey, l_linenumber from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
@ -87,30 +51,12 @@ select l_orderkey, l_linenumber from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
show status like 'handler_read%';
set optimizer_switch='extended_keys=on';
explain
select l_orderkey, l_linenumber from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
flush status;
select l_orderkey, l_linenumber from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
show status like 'handler_read%';
set optimizer_switch='extended_keys=off';
explain
select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
flush status;
select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
show status like 'handler_read%';
set optimizer_switch='extended_keys=on';
explain
select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
flush status;
select min(l_orderkey) from lineitem where l_shipdate='1992-07-01';
show status like 'handler_read%';
set optimizer_switch='extended_keys=off';
explain
select min(l_orderkey) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
@ -119,16 +65,6 @@ select min(l_orderkey) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
show status like 'handler_read%';
set optimizer_switch='extended_keys=on';
explain
select min(l_orderkey) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
flush status;
select min(l_orderkey) from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1001 and 2000;
show status like 'handler_read%';
set optimizer_switch='extended_keys=off';
explain
select max(l_linenumber) from lineitem
where l_shipdate='1992-07-01' and l_orderkey=130;
@ -137,16 +73,6 @@ select max(l_linenumber) from lineitem
where l_shipdate='1992-07-01' and l_orderkey=130;
show status like 'handler_read%';
set optimizer_switch='extended_keys=on';
explain
select max(l_linenumber) from lineitem
where l_shipdate='1992-07-01' and l_orderkey=130;
flush status;
select max(l_linenumber) from lineitem
where l_shipdate='1992-07-01' and l_orderkey=130;
show status like 'handler_read%';
set optimizer_switch='extended_keys=off';
explain
select l_orderkey, l_linenumber
from lineitem use index (i_l_shipdate, i_l_receiptdate)
@ -159,20 +85,6 @@ select l_orderkey, l_linenumber
or l_receiptdate='1992-07-01' and l_orderkey=5603;
show status like 'handler_read%';
set optimizer_switch='extended_keys=on';
explain
select l_orderkey, l_linenumber
from lineitem use index (i_l_shipdate, i_l_receiptdate)
where l_shipdate='1992-07-01' and l_orderkey=130
or l_receiptdate='1992-07-01' and l_orderkey=5603;
flush status;
select l_orderkey, l_linenumber
from lineitem use index (i_l_shipdate, i_l_receiptdate)
where l_shipdate='1992-07-01' and l_orderkey=130
or l_receiptdate='1992-07-01' and l_orderkey=5603;
show status like 'handler_read%';
set optimizer_switch='extended_keys=off';
explain
select l_orderkey, l_linenumber
from lineitem use index (i_l_shipdate, i_l_receiptdate)
@ -185,20 +97,6 @@ select l_orderkey, l_linenumber
or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
show status like 'handler_read%';
set optimizer_switch='extended_keys=on';
explain
select l_orderkey, l_linenumber
from lineitem use index (i_l_shipdate, i_l_receiptdate)
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
flush status;
select l_orderkey, l_linenumber
from lineitem use index (i_l_shipdate, i_l_receiptdate)
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
show status like 'handler_read%';
set optimizer_switch='extended_keys=off';
explain
select l_orderkey, l_linenumber from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
@ -209,18 +107,6 @@ select l_orderkey, l_linenumber from lineitem
or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
show status like 'handler_read%';
set optimizer_switch='extended_keys=on';
explain
select l_orderkey, l_linenumber from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
flush status;
select l_orderkey, l_linenumber from lineitem
where l_shipdate='1992-07-01' and l_orderkey between 1 and 1000
or l_receiptdate='1992-07-01' and l_orderkey between 5001 and 6000;
show status like 'handler_read%';
set optimizer_switch='extended_keys=off';
--replace_column 9 #
explain
select max(l_orderkey) from lineitem
@ -230,27 +116,6 @@ select max(l_orderkey) from lineitem
where l_partkey between 1 and 10 group by l_partkey;
show status like 'handler_read%';
set optimizer_switch='extended_keys=on';
--replace_column 9 #
explain
select max(l_orderkey) from lineitem
where l_partkey between 1 and 10 group by l_partkey;
flush status;
select max(l_orderkey) from lineitem
where l_partkey between 1 and 10 group by l_partkey;
show status like 'handler_read%';
set optimizer_switch='extended_keys=off';
--replace_column 9 #
explain
select max(l_orderkey) from lineitem
where l_suppkey in (1,4) group by l_suppkey;
flush status;
select max(l_orderkey) from lineitem
where l_suppkey in (1,4) group by l_suppkey;
show status like 'handler_read%';
set optimizer_switch='extended_keys=on';
--replace_column 9 #
explain
select max(l_orderkey) from lineitem
@ -262,23 +127,6 @@ show status like 'handler_read%';
create index i_p_retailprice on part(p_retailprice);
set optimizer_switch='extended_keys=off';
--replace_column 9 #
explain
select o_orderkey, p_partkey
from part use index (i_p_retailprice),
lineitem use index (i_l_partkey), orders
where p_retailprice > 1100 and o_orderdate='1997-01-01'
and o_orderkey=l_orderkey and p_partkey=l_partkey;
flush status;
select o_orderkey, p_partkey
from part use index (i_p_retailprice),
lineitem use index (i_l_partkey), orders
where p_retailprice > 1100 and o_orderdate='1997-01-01'
and o_orderkey=l_orderkey and p_partkey=l_partkey;
show status like 'handler_read%';
set optimizer_switch='extended_keys=on';
--replace_column 9 #
explain
select o_orderkey, p_partkey
@ -303,8 +151,6 @@ create table t0 (a int);
insert into t0 values (1), (2), (3), (4), (5);
create index i_p_size on part(p_size);
set optimizer_switch='extended_keys=on';
explain
select * from t0, part ignore index (primary)
where p_partkey=t0.a and p_size=1;
@ -327,7 +173,6 @@ use test;
set @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch='materialization=on,semijoin=on';
SET optimizer_switch='extended_keys=on';
CREATE TABLE t1 (a int, b int) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,1), (2,2);
@ -346,10 +191,7 @@ set optimizer_switch=@save_optimizer_switch;
--echo # (valgrinf complains fixed by the patch for bug #914560)
--echo #
set @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch = 'derived_with_keys=on';
SET optimizer_switch = 'extended_keys=on';
CREATE TABLE t1 (a varchar(1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES ('j'), ('v');
@ -389,24 +231,12 @@ INSERT INTO t2 VALUES
(10), (11), (12), (13), (14),
(15), (16), (17), (18), (19), (24);
set @save_optimizer_switch=@@optimizer_switch;
SET optimizer_switch = 'extended_keys=off';
EXPLAIN
SELECT a FROM t1 AS t, t2
WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
SELECT a FROM t1 AS t, t2
WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
SET optimizer_switch = 'extended_keys=on';
EXPLAIN
SELECT a FROM t1 AS t, t2
WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
SELECT a FROM t1 AS t, t2
WHERE c = a AND b IN (SELECT b FROM t1, t2 WHERE b = t.b);
set optimizer_switch=@save_optimizer_switch;
DROP TABLE t1,t2;
--echo #
@ -420,13 +250,11 @@ CREATE TABLE t2 (b int) ENGINE=MyISAM;
INSERT INTO t1 (a) VALUES (4), (6);
INSERT INTO t2 (b) VALUES (0), (8);
set @save_optimizer_switch=@@optimizer_switch;
set @save_join_cache_level=@@join_cache_level;
SET join_cache_level=3;
SET optimizer_switch='join_cache_hashed=on';
SET optimizer_switch='join_cache_bka=on';
SET optimizer_switch='extended_keys=on';
EXPLAIN
SELECT * FROM t1, t2 WHERE b=a;
@ -455,24 +283,11 @@ KEY c4 (c4)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
set @save_optimizer_switch=@@optimizer_switch;
set session optimizer_switch='extended_keys=off';
INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
DELETE FROM t1;
set session optimizer_switch='extended_keys=on';
INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
INSERT INTO t1 (c2, c3, c4) VALUES (58291525, 2580, 'foobar')
ON DUPLICATE KEY UPDATE c4 = VALUES(c4);
set optimizer_switch=@save_optimizer_switch;
DROP TABLE t1;
--echo #
@ -481,8 +296,6 @@ DROP TABLE t1;
--echo # (performance regression introduced in the patch for mdev-3851)
--echo #
set @save_optimizer_switch=@@optimizer_switch;
create table t1 (a int not null) engine=innodb;
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
@ -496,15 +309,6 @@ select
A.a + 10 * B.a, A.a + 10 * B.a, A.a + 10 * B.a
from t1 A, t1 B;
set optimizer_switch='extended_keys=off';
--replace_column 9 #
explain
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
flush status;
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
show status like 'handler_read%';
set optimizer_switch='extended_keys=on';
--replace_column 9 #
explain
select * from t1, t2 where t2.a=t1.a and t2.b < 2;
@ -531,15 +335,6 @@ alter table t3 add primary key (pk1, pk2);
alter table t3 add key (col1, col2);
analyze table t1,t3;
set optimizer_switch='extended_keys=off';
--replace_column 9 #
explain
select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a;
--replace_column 9 #
explain
select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a and t3.pk1=t1.a;
set optimizer_switch='extended_keys=on';
--replace_column 9 #
explain
select * from t1, t3 where t3.col1=t1.a and t3.col2=t1.a;
@ -553,8 +348,6 @@ drop table t1,t2,t3;
--echo # Bug mdev-4340: performance regression with extended_keys=on
--echo #
set @save_optimizer_switch=@@optimizer_switch;
CREATE TABLE t1 (
page_id int(8) unsigned NOT NULL AUTO_INCREMENT,
page_namespace int(11) NOT NULL DEFAULT '0',
@ -662,13 +455,6 @@ INSERT INTO t3 VALUES
(97,'text-6009',''),(98,'text-7009',''),(99,'text-8009',''),(100,'text-9009','');
set optimizer_switch='extended_keys=off';
EXPLAIN
SELECT * FROM t1, t2 IGNORE INDEX (PRIMARY), t3
WHERE page_id=rev_page AND rev_text_id=old_id AND page_namespace=4 AND page_title='Sandbox'
ORDER BY rev_timestamp ASC LIMIT 10;
set optimizer_switch='extended_keys=on';
EXPLAIN
SELECT * FROM t1, t2 IGNORE INDEX (PRIMARY), t3
WHERE page_id=rev_page AND rev_text_id=old_id AND page_namespace=4 AND page_title='Sandbox'
@ -689,14 +475,10 @@ insert into t2 (b) values (null), (null), (null);
analyze table t1,t2;
set optimizer_switch='extended_keys=on';
explain select a from t1 where b is null order by a desc limit 2;
select a from t1 where b is null order by a desc limit 2;
explain select a from t2 where b is null order by a desc limit 2;
select a from t2 where b is null order by a desc limit 2;
set optimizer_switch='extended_keys=off';
explain select a from t2 where b is null order by a desc limit 2;
select a from t2 where b is null order by a desc limit 2;
explain select a from t2 where b is null order by a desc;
select a from t2 where b is null order by a desc;
@ -706,8 +488,6 @@ select a from t2 where b is null order by a desc,a,a;
drop table t1, t2;
set optimizer_switch=@save_optimizer_switch;
--echo #
--echo # MDEV-10325: Queries examines all rows of a tables when it should not
--echo #

View File

@ -621,3 +621,9 @@ a b
1 3
2 4
drop table t1;
#
# MDEV-23467 SIGSEGV in fill_record/fill_record_n_invoke_before_triggers on INSERT DELAYED
#
create table t1 (a int, b int invisible);
insert delayed into t1 values (1);
drop table t1;

View File

@ -271,3 +271,11 @@ select a,b from t1;
#cleanup
drop table t1;
--echo #
--echo # MDEV-23467 SIGSEGV in fill_record/fill_record_n_invoke_before_triggers on INSERT DELAYED
--echo #
create table t1 (a int, b int invisible);
insert delayed into t1 values (1);
# cleanup
drop table t1;

View File

@ -145,7 +145,7 @@ test
Phase 7/7: Running 'FLUSH PRIVILEGES'
OK
DROP USER mysqltest1@'%';
Version check failed. Got the following error when calling the 'mysql' command line client
Version check failed. Got the following error when calling the 'mysql_upgrade' command line client
ERROR 1045 (28000): Access denied for user 'mysqltest1'@'localhost' (using password: YES)
FATAL ERROR: Upgrade failed
Run mysql_upgrade with a non existing server socket
@ -412,7 +412,7 @@ OK
# Bug #21489398: MYSQL_UPGRADE: FATAL ERROR: UPGRADE FAILED - IMPROVE ERROR
#
Run mysql_upgrade with unauthorized access
Version check failed. Got the following error when calling the 'mysql' command line client
Version check failed. Got the following error when calling the 'mysql_upgrade' command line client
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
FATAL ERROR: Upgrade failed
#

View File

@ -327,6 +327,24 @@ ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
DROP TABLE t1,t2;
#
# MDEV-16372 ER_BASE64_DECODE_ERROR upon replaying binary log with system table
#
FLUSH BINARY LOGS;
CREATE TABLE t1 (pk INT PRIMARY KEY);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1), (2) ON DUPLICATE KEY UPDATE pk= pk + 10;
FLUSH BINARY LOGS;
Proof: two subsequent patterns must be found
FOUND 1 /### UPDATE `test`.`t1`/ in mysqlbinlog.sql
FOUND 2 /### INSERT INTO `test`.`t1`/ in mysqlbinlog.sql
DROP TABLE t1;
SELECT * FROM t1;
pk
2
11
# Cleanup
DROP TABLE t1;
CREATE TABLE `t1` (
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`is_deleted` BIT(1) DEFAULT b'0',
@ -351,23 +369,23 @@ FLUSH BINARY LOGS;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
DELIMITER /*!*/;
# at 387
#<date> server id 1 end_log_pos 429 CRC32 XXX GTID 0-1-16
# at POS
#<date> server id 1 end_log_pos END_LOG_POS CRC32 XXX GTID D-S-N
/*!100101 SET @@session.skip_parallel_replication=0*//*!*/;
/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
/*!100001 SET @@session.server_id=1*//*!*/;
/*!100001 SET @@session.gtid_seq_no=16*//*!*/;
/*!100001 SET @@session.gtid_seq_no=21*//*!*/;
START TRANSACTION
/*!*/;
# at 429
# at 543
#<date> server id 1 end_log_pos 543 CRC32 XXX Annotate_rows:
# at POS
# at POS
#<date> server id 1 end_log_pos END_LOG_POS CRC32 XXX Annotate_rows:
#Q> UPDATE t1 t1 INNER JOIN t2 t2 ON t1.ref_id = t2.id
#Q> SET t1.is_deleted = TRUE
#Q> WHERE t1.id =
#<date> server id 1 end_log_pos 594 CRC32 XXX Table_map: `test`.`t1` mapped to number 35
# at 594
#<date> server id 1 end_log_pos 643 CRC32 XXX Update_rows: table id 35 flags: STMT_END_F
#<date> server id 1 end_log_pos END_LOG_POS CRC32 XXX Table_map: `test`.`t1` mapped to number TID
# at POS
#<date> server id 1 end_log_pos END_LOG_POS CRC32 XXX Update_rows: table id TID flags: STMT_END_F
### UPDATE `test`.`t1`
### WHERE
### @1=1 /* LONGINT meta=0 nullable=0 is_null=0 */
@ -375,10 +393,10 @@ START TRANSACTION
### @2=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
### @3=X /* TIMESTAMP(0) meta=0 nullable=0 is_null=0 */
# Number of rows: 1
# at 643
#<date> server id 1 end_log_pos 725 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
# at POS
#<date> server id 1 end_log_pos END_LOG_POS CRC32 XXX Query thread_id=TID exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
SET @@session.pseudo_thread_id=5/*!*/;
SET @@session.pseudo_thread_id=TID/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1, @@session.sql_if_exists=0/*!*/;
SET @@session.sql_mode=#/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
@ -388,8 +406,6 @@ SET @@session.lc_time_names=0/*!*/;
SET @@session.collation_database=DEFAULT/*!*/;
COMMIT
/*!*/;
# at 725
#<date> server id 1 end_log_pos 773 CRC32 XXX Rotate to master-bin.000004 pos: 4
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;

View File

@ -33,6 +33,33 @@ FLUSH BINARY LOGS;
DROP TABLE t1,t2;
--echo #
--echo # MDEV-16372 ER_BASE64_DECODE_ERROR upon replaying binary log with system table
--echo #
FLUSH BINARY LOGS;
CREATE TABLE t1 (pk INT PRIMARY KEY);
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (1), (2) ON DUPLICATE KEY UPDATE pk= pk + 10;
--let $binlog = query_get_value(SHOW MASTER STATUS, File, 1)
FLUSH BINARY LOGS;
--exec $MYSQL_BINLOG --verbose $datadir/$binlog > $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
--echo Proof: two subsequent patterns must be found
--let SEARCH_PATTERN= ### UPDATE `test`.`t1`
--let SEARCH_FILE= $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN= ### INSERT INTO `test`.`t1`
--let SEARCH_FILE= $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
--source include/search_pattern_in_file.inc
DROP TABLE t1;
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
SELECT * FROM t1;
--echo # Cleanup
DROP TABLE t1;
--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
#
# MDEV-14605 ON UPDATE CURRENT_TIMESTAMP fields by multi-table UPDATE are not logged with binlog_row_image=MINIMAL
#
@ -64,11 +91,12 @@ UPDATE t1 t1 INNER JOIN t2 t2 ON t1.ref_id = t2.id
WHERE t1.id = 1;
--let $binlog = query_get_value(SHOW MASTER STATUS, File, 1)
--let $binlog_end= query_get_value(SHOW MASTER STATUS, Position, 1)
FLUSH BINARY LOGS;
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /\d{6} *\d*:\d\d:\d\d/<date>/ /SET TIMESTAMP=\d*/SET TIMESTAMP=X/ /exec_time=\d*/exec_time=x/ /@3=\d*/@3=X/ /CRC32 0x[0-9a-f]+/CRC32 XXX/ /@@session.sql_mode=\d+/@@session.sql_mode=#/ /collation_server=\d+/collation_server=#/
--exec $MYSQL_BINLOG --verbose --verbose --base64-output=DECODE-ROWS $datadir/$binlog --start-position=$binlog_pos
--replace_regex /table id \d*/table id TID/ /mapped to number \d*/mapped to number TID/ /at \d*/at POS/ /end_log_pos \d*/end_log_pos END_LOG_POS/ /GTID \d*-\d*-\d*/GTID D-S-N/ /\d{6} *\d*:\d\d:\d\d/<date>/ /SET TIMESTAMP=\d*/SET TIMESTAMP=X/ /exec_time=\d*/exec_time=x/ /@3=\d*/@3=X/ /CRC32 0x[0-9a-f]+/CRC32 XXX/ /@@session.sql_mode=\d+/@@session.sql_mode=#/ /collation_server=\d+/collation_server=#/ /thread_id=\d*/thread_id=TID/
--exec $MYSQL_BINLOG --verbose --verbose --base64-output=DECODE-ROWS $datadir/$binlog --start-position=$binlog_pos --stop-position=$binlog_end
DROP TABLE t1,t2;

View File

@ -8684,5 +8684,103 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.mark_join_nest_as_const'))
}
]
drop table t0, t1, t2, t3;
#
# MDEV-23767: IN-to-subquery conversion is not visible in optimizer trace
#
create table t0 (a int);
INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
set @tmp=@@in_predicate_conversion_threshold;
set in_predicate_conversion_threshold=3;
explain select * from t0 where a in (1,2,3,4,5,6);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t0 ALL NULL NULL NULL NULL 10 Using where
1 PRIMARY <derived3> ref key0 key0 4 test.t0.a 2 FirstMatch(t0)
3 DERIVED NULL NULL NULL NULL NULL NULL NULL No tables used
select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion'))
from information_schema.optimizer_trace;
json_detailed(json_extract(trace, '$**.in_to_subquery_conversion'))
[
{
"item": "t0.a in (1,2,3,4,5,6)",
"conversion":
[
{
"join_preparation":
{
"select_id": 2,
"steps":
[
{
"derived":
{
"table": "tvc_0",
"select_id": 3,
"algorithm": "materialized"
}
},
{
"transformation":
{
"select_id": 2,
"from": "IN (SELECT)",
"to": "materialization",
"sjm_scan_allowed": true,
"possible": true
}
},
{
"transformation":
{
"select_id": 2,
"from": "IN (SELECT)",
"to": "semijoin",
"chosen": true
}
},
{
"expanded_query": "/* select#2 */ select tvc_0._col_1 from (values (1),(2),(3),(4),(5),(6)) tvc_0"
}
]
}
}
]
}
]
explain select * from t0 where a in (1,2,3,4,5,a+1);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where
select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion'))
from information_schema.optimizer_trace;
json_detailed(json_extract(trace, '$**.in_to_subquery_conversion'))
[
{
"item": "t0.a in (1,2,3,4,5,t0.a + 1)",
"done": false,
"reason": "non-constant element in the IN-list"
}
]
explain select * from t0 where a in ('1','2','3','4','5','6');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t0 ALL NULL NULL NULL NULL 10 Using where
select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion'))
from information_schema.optimizer_trace;
json_detailed(json_extract(trace, '$**.in_to_subquery_conversion'))
[
{
"item": "t0.a in ('1','2','3','4','5','6')",
"done": false,
"reason": "type mismatch"
}
]
set in_predicate_conversion_threshold=@tmp;
drop table t0;
# End of 10.5 tests
set optimizer_trace='enabled=off';

View File

@ -654,5 +654,31 @@ from information_schema.optimizer_trace;
drop table t0, t1, t2, t3;
--echo #
--echo # MDEV-23767: IN-to-subquery conversion is not visible in optimizer trace
--echo #
create table t0 (a int);
INSERT INTO t0 VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
set @tmp=@@in_predicate_conversion_threshold;
set in_predicate_conversion_threshold=3;
explain select * from t0 where a in (1,2,3,4,5,6);
select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion'))
from information_schema.optimizer_trace;
explain select * from t0 where a in (1,2,3,4,5,a+1);
select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion'))
from information_schema.optimizer_trace;
explain select * from t0 where a in ('1','2','3','4','5','6');
select json_detailed(json_extract(trace, '$**.in_to_subquery_conversion'))
from information_schema.optimizer_trace;
set in_predicate_conversion_threshold=@tmp;
drop table t0;
--echo # End of 10.5 tests
set optimizer_trace='enabled=off';

View File

@ -3433,6 +3433,22 @@ SET sort_buffer_size= @save_sort_buffer_size;
SET max_length_for_sort_data= @save_max_length_for_sort_data;
DROP TABLE t1;
#
# MDEV-23596: Assertion `tab->ref.use_count' failed in join_read_key_unlock_row
#
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, KEY(b));
INSERT INTO t1 VALUES (0, 1),(1, 2);
CREATE TABLE t2 SELECT * FROM t1;
EXPLAIN SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.b ORDER BY t1.b LIMIT 1) AS c FROM t2;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t2 ALL NULL NULL NULL NULL 2
2 DEPENDENT SUBQUERY t1 index PRIMARY b 5 NULL 1 Using where
SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.b ORDER BY t1.b LIMIT 1) AS c FROM t2;
c
1
NULL
DROP TABLE t1,t2;
# end of 10.1 tests
#
# MDEV-13994: Bad join results with orderby_uses_equalities=on
#
CREATE TABLE books (

View File

@ -2202,6 +2202,21 @@ SET sort_buffer_size= @save_sort_buffer_size;
SET max_length_for_sort_data= @save_max_length_for_sort_data;
DROP TABLE t1;
--echo #
--echo # MDEV-23596: Assertion `tab->ref.use_count' failed in join_read_key_unlock_row
--echo #
CREATE TABLE t1 (a INT PRIMARY KEY, b INT, KEY(b));
INSERT INTO t1 VALUES (0, 1),(1, 2);
CREATE TABLE t2 SELECT * FROM t1;
EXPLAIN SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.b ORDER BY t1.b LIMIT 1) AS c FROM t2;
SELECT (SELECT 1 FROM t1 WHERE t1.a=t2.b ORDER BY t1.b LIMIT 1) AS c FROM t2;
DROP TABLE t1,t2;
--echo # end of 10.1 tests
--echo #
--echo # MDEV-13994: Bad join results with orderby_uses_equalities=on
--echo #

View File

@ -1945,6 +1945,95 @@ KILL ( SELECT 1 ) + LASTVAL(s);
ERROR 42000: KILL does not support subqueries or stored functions
KILL LASTVAL(s);
ERROR 42000: KILL does not support subqueries or stored functions
#
# MDEV-23094: Multiple calls to a Stored Procedure from another
# Stored Procedure crashes server
#
create table t1 (id1 int primary key, data1 int);
create table t2 (id2 int primary key, data2 int);
create procedure p1(IN id int, IN dt int)
begin
if (exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt))
then
select 1;
end if;
end //
call p1(1,2);
1
1
call p1(1,2);
1
1
drop procedure p1;
create procedure p1(IN id int, IN dt int)
begin
case (exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt))
when 1 then
select 1;
else
select 0;
end case;
end //
call p1(1,2);
1
1
call p1(1,2);
1
1
drop procedure p1;
create procedure p1(IN id int, IN dt int)
begin
declare wcont int default 1;
while (exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt)) and wcont
do
select 1;
set wcont=0;
end while;
end //
call p1(1,2);
1
1
call p1(1,2);
1
1
drop procedure p1;
create procedure p1(IN id int, IN dt int)
begin
declare count int default 1;
repeat
select 1;
set count=count+1;
until (exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt)) and
count < 3
end repeat;
end //
call p1(1,2);
1
1
call p1(1,2);
1
1
drop procedure p1;
create procedure p1(IN id int, IN dt int)
begin
for i in 1..(exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt))
do
select 1;
end for;
end //
call p1(1,2);
1
1
call p1(1,2);
1
1
drop procedure p1;
drop table t1,t2;
# End of 10.4 tests
#
# Start of 10.5 tests

View File

@ -1698,6 +1698,103 @@ KILL ( SELECT 1 ) + LASTVAL(s);
--error ER_SUBQUERIES_NOT_SUPPORTED
KILL LASTVAL(s);
--echo #
--echo # MDEV-23094: Multiple calls to a Stored Procedure from another
--echo # Stored Procedure crashes server
--echo #
create table t1 (id1 int primary key, data1 int);
create table t2 (id2 int primary key, data2 int);
delimiter //;
create procedure p1(IN id int, IN dt int)
begin
if (exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt))
then
select 1;
end if;
end //
delimiter ;//
call p1(1,2);
call p1(1,2);
drop procedure p1;
delimiter //;
create procedure p1(IN id int, IN dt int)
begin
case (exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt))
when 1 then
select 1;
else
select 0;
end case;
end //
delimiter ;//
call p1(1,2);
call p1(1,2);
drop procedure p1;
delimiter //;
create procedure p1(IN id int, IN dt int)
begin
declare wcont int default 1;
while (exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt)) and wcont
do
select 1;
set wcont=0;
end while;
end //
delimiter ;//
call p1(1,2);
call p1(1,2);
drop procedure p1;
delimiter //;
create procedure p1(IN id int, IN dt int)
begin
declare count int default 1;
repeat
select 1;
set count=count+1;
until (exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt)) and
count < 3
end repeat;
end //
delimiter ;//
call p1(1,2);
call p1(1,2);
drop procedure p1;
delimiter //;
create procedure p1(IN id int, IN dt int)
begin
for i in 1..(exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt))
do
select 1;
end for;
end //
delimiter ;//
call p1(1,2);
call p1(1,2);
drop procedure p1;
drop table t1,t2;
--echo # End of 10.4 tests

View File

@ -2165,6 +2165,12 @@ A.a+1000*B.a + 10000,
'filler-data-filler-data'
from
t11 A, t10 B;
analyze table t1 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze Warning Engine-independent statistics are not collected for column 'el_index'
test.t1 analyze Warning Engine-independent statistics are not collected for column 'filler'
test.t1 analyze status Table is already up to date
# This must not use rowid_filter with key=el_index|el_index_60:
explain
select * from t1

View File

@ -377,6 +377,7 @@ select
'filler-data-filler-data'
from
t11 A, t10 B;
analyze table t1 persistent for all;
--echo # This must not use rowid_filter with key=el_index|el_index_60:
explain

View File

@ -2114,6 +2114,12 @@ A.a+1000*B.a + 10000,
'filler-data-filler-data'
from
t11 A, t10 B;
analyze table t1 persistent for all;
Table Op Msg_type Msg_text
test.t1 analyze status Engine-independent statistics collected
test.t1 analyze Warning Engine-independent statistics are not collected for column 'el_index'
test.t1 analyze Warning Engine-independent statistics are not collected for column 'filler'
test.t1 analyze status OK
# This must not use rowid_filter with key=el_index|el_index_60:
explain
select * from t1

View File

@ -2686,6 +2686,37 @@ SELECT * FROM t2;
f
bar
DROP TABLE t1, t2;
#
# MDEV-18335: Assertion `!error || error == 137' failed in subselect_rowid_merge_engine::init
#
CREATE TABLE t1 (i1 int,v1 varchar(1),KEY (v1,i1));
INSERT INTO t1 VALUES
(9,'y'),(4,'q'),(0,null),(0,'p'),(null,'j');
CREATE TABLE t2 (pk int);
INSERT INTO t2 VALUES (1),(2);
CREATE TABLE t3 (v2 varchar(1));
INSERT INTO t3 VALUES
('p'),('j'),('y'),('q');
CREATE TABLE t4 (v2 varchar(1));
INSERT INTO t4 VALUES
('a'),('a'),('b'),('b'),('c'),('c'),
('d'),('d'),('e'),('e'),('f'),('f'),
('g'),('g'),('h'),('h'),('i'),('i'),
('j'),('j'),('k'),('k'),('l'),('l'),
('m'),('m'),('n'),('n'),('o'),('o'),
('p'),('p'),('q'),('q'),('r'),('r'),
('s'),('s'),('t'),('t'),('u'),('u'),('v'),('v'),
('w'),('w'),('x'),('x'), (NULL),(NULL);
SET @save_join_cache_level=@@join_cache_level;
SET join_cache_level=0;
select 1
from t2 join t1 on
('i','w') not in (select t1.v1,t4.v2 from t4,t1,t3 where t3.v2 = t1.v1) LIMIT ROWS EXAMINED 500;
1
Warnings:
Warning 1931 Query execution was interrupted. The query examined at least 3020 rows, which exceeds LIMIT ROWS EXAMINED (500). The query result may be incomplete
SET join_cache_level= @save_join_cache_level;
DROP TABLE t1,t2,t3,t4;
# End of 10.2 tests
#
# MDEV-19134: EXISTS() slower if ORDER BY is defined

View File

@ -2201,6 +2201,42 @@ SELECT * FROM t2;
DROP TABLE t1, t2;
--echo #
--echo # MDEV-18335: Assertion `!error || error == 137' failed in subselect_rowid_merge_engine::init
--echo #
CREATE TABLE t1 (i1 int,v1 varchar(1),KEY (v1,i1));
INSERT INTO t1 VALUES
(9,'y'),(4,'q'),(0,null),(0,'p'),(null,'j');
CREATE TABLE t2 (pk int);
INSERT INTO t2 VALUES (1),(2);
CREATE TABLE t3 (v2 varchar(1));
INSERT INTO t3 VALUES
('p'),('j'),('y'),('q');
CREATE TABLE t4 (v2 varchar(1));
INSERT INTO t4 VALUES
('a'),('a'),('b'),('b'),('c'),('c'),
('d'),('d'),('e'),('e'),('f'),('f'),
('g'),('g'),('h'),('h'),('i'),('i'),
('j'),('j'),('k'),('k'),('l'),('l'),
('m'),('m'),('n'),('n'),('o'),('o'),
('p'),('p'),('q'),('q'),('r'),('r'),
('s'),('s'),('t'),('t'),('u'),('u'),('v'),('v'),
('w'),('w'),('x'),('x'), (NULL),(NULL);
SET @save_join_cache_level=@@join_cache_level;
SET join_cache_level=0;
select 1
from t2 join t1 on
('i','w') not in (select t1.v1,t4.v2 from t4,t1,t3 where t3.v2 = t1.v1) LIMIT ROWS EXAMINED 500;
SET join_cache_level= @save_join_cache_level;
DROP TABLE t1,t2,t3,t4;
--echo # End of 10.2 tests
--echo #

View File

@ -615,6 +615,20 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
Warnings:
Note 1003 select `test`.`t1`.`f1` AS `f1`,`test`.`t2`.`f2` AS `f2`,`test`.`t3`.`f3` AS `f3` from `test`.`t1` join `test`.`t2` semi join (`test`.`t4`) join `test`.`t3` where `test`.`t4`.`f4` = 1 and `test`.`t1`.`f1` >= `test`.`t2`.`f2`
DROP TABLE t1,t2,t3,t4;
#
# MDEV-23535: SIGSEGV, SIGABRT and SIGILL in typeinfo for Item_func_set_collation (on optimized builds)
#
set @save_character_set_connection=@@character_set_connection;
set character_set_connection='utf8';
CREATE TABLE t1(a DATETIME, b VARCHAR(50)) ENGINE=INNODB;
INSERT INTO t1 VALUES ('2019-03-10 02:55:05', '2019-03-10 02:55:05');
CREATE TABLE t2(a VARCHAR(50)) ENGINE=INNODB;
INSERT INTO t2 VALUES ('2019-03-10 02:55:05');
SELECT * FROM t1 WHERE (SELECT 1,CONCAT(a) FROM t1) = (SELECT 1,CONCAT(a) FROM t2);
a b
2019-03-10 02:55:05 2019-03-10 02:55:05
DROP TABLE t1,t2;
set character_set_connection=@save_character_set_connection;
#
# MDEV-17362: SIGSEGV in JOIN::optimize_inner or Assertion `fixed == 0'
# failed in Item_equal::fix_fields, server crashes after 2nd execution
@ -648,3 +662,4 @@ a b
execute stmt;
a b
drop table t1,t2;
# End of 10.4 tests

View File

@ -611,6 +611,23 @@ FROM t1
DROP TABLE t1,t2,t3,t4;
--echo #
--echo # MDEV-23535: SIGSEGV, SIGABRT and SIGILL in typeinfo for Item_func_set_collation (on optimized builds)
--echo #
set @save_character_set_connection=@@character_set_connection;
set character_set_connection='utf8';
CREATE TABLE t1(a DATETIME, b VARCHAR(50)) ENGINE=INNODB;
INSERT INTO t1 VALUES ('2019-03-10 02:55:05', '2019-03-10 02:55:05');
CREATE TABLE t2(a VARCHAR(50)) ENGINE=INNODB;
INSERT INTO t2 VALUES ('2019-03-10 02:55:05');
SELECT * FROM t1 WHERE (SELECT 1,CONCAT(a) FROM t1) = (SELECT 1,CONCAT(a) FROM t2);
DROP TABLE t1,t2;
set character_set_connection=@save_character_set_connection;
--echo #
--echo # MDEV-17362: SIGSEGV in JOIN::optimize_inner or Assertion `fixed == 0'
--echo # failed in Item_equal::fix_fields, server crashes after 2nd execution
@ -643,3 +660,5 @@ execute stmt;
execute stmt;
drop table t1,t2;
--echo # End of 10.4 tests

View File

@ -0,0 +1,13 @@
create table d1 (a int);
create temporary table t1 (a int);
create temporary table t2 (a int);
Got one of the listed errors
create temporary table t3 (a int) engine=Aria;
Got one of the listed errors
select * from information_schema.columns where table_schema='test';
Got one of the listed errors
flush tables;
select * from d1;
a
drop temporary table t1;
drop table d1;

View File

@ -0,0 +1,33 @@
source include/not_windows.inc;
#
# MDEV-23569 temporary tables can overwrite existing files
#
let datadir=`select @@datadir`;
create table d1 (a int);
create temporary table t1 (a int);
perl;
chdir "$ENV{MYSQL_TMP_DIR}/mysqld.1/";
for (<#sql*.MYI>) {
/^(#sql-temptable-[0-9a-f]+)(-[0-9a-f]+-)([0-9a-f]+)\.MYI$/ or die $_;
symlink "$ENV{datadir}/test/d1.MYI", sprintf "$1$2%x.MYI", hex($3)+1;
symlink "$ENV{datadir}/test/d1.MYI", sprintf "$1$2%x.MAI", hex($3)+1;
symlink "$ENV{datadir}/test/d1.MYI", sprintf "$1$2%x.MAI", hex($3)+2;
symlink "$ENV{datadir}/test/d1.MYI", sprintf "$1$2%x.MAI", hex($3)+3;
symlink "$ENV{datadir}/test/d1.MYI", "$1-0.MAI";
}
EOF
error 1,1030;
create temporary table t2 (a int);
error 1,1030;
create temporary table t3 (a int) engine=Aria;
error 1,1030;
select * from information_schema.columns where table_schema='test';
flush tables;
select * from d1;
drop temporary table t1;
remove_files_wildcard $MYSQL_TMP_DIR/mysqld.1 *sql*;
drop table d1;

View File

@ -0,0 +1,4 @@
# mdev-23741 sharing violation when renaming .frm file in ALTER
CREATE TABLE t(i int);
SET STATEMENT debug_dbug='+d,rename_sharing_violation' FOR ALTER TABLE t ADD PRIMARY KEY (i);
DROP TABLE t;

View File

@ -0,0 +1,11 @@
# Windows-specific tests , debug mode
--source include/have_debug.inc
--source include/windows.inc
--echo # mdev-23741 sharing violation when renaming .frm file in ALTER
CREATE TABLE t(i int);
SET STATEMENT debug_dbug='+d,rename_sharing_violation' FOR ALTER TABLE t ADD PRIMARY KEY (i);
DROP TABLE t;
#End of 10.3 tests

View File

@ -5356,7 +5356,5 @@ START TRANSACTION
#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Table_map: `test`.`t1dec102` mapped to number #
# at #
#010909 4:46:40 server id 1 end_log_pos # CRC32 XXX Write_rows: table id # flags: STMT_END_F
### INSERT INTO `test`.`t1dec102`
### SET
### @1=
Error: Found Old DECIMAL (mysql-4.1 or earlier). Not enough metadata to display the value.

View File

@ -449,7 +449,6 @@ START TRANSACTION
### DELETE FROM `test1`.`t1`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
'/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;
@ -1073,7 +1072,6 @@ START TRANSACTION
### DELETE FROM `test1`.`t1`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
'/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;

View File

@ -9,4 +9,7 @@ INSERT INTO t1 VALUES (repeat('a', 255), repeat('a', 255),repeat('a', 255),repea
INSERT INTO t1 VALUES (repeat('a', 255), repeat('a', 255),repeat('a', 255),repeat('a', 255),repeat('a', 255));
UPDATE t1 SET c1=repeat('b',255);
INSERT INTO t1 VALUES (repeat('a', 255), repeat('a', 255),repeat('a', 255),repeat('a', 255),repeat('a', 255));
SHOW BINLOG EVENTS FROM POS;
ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Invalid pos specified. Requested from pos:POS is greater than actual file size:MAX_POS
DROP TABLE t1;

View File

@ -11,8 +11,7 @@ SELECT a into @a from t;
FLUSH LOGS;
DELETE FROM t;
# Todo: MDEV-10362 to test multi-row Rows_log_event:s in verbose mode
--exec $MYSQL_BINLOG -vv --debug-binlog-row-event-max-encoded-size=256 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
--exec $MYSQL_BINLOG --verbose --debug-binlog-row-event-max-encoded-size=256 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
--let SEARCH_PATTERN= BINLOG @binlog_fragment_0, @binlog_fragment_1
--let SEARCH_FILE= $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql

View File

@ -34,4 +34,9 @@ while ($pos <= $max_pos)
--enable_query_log
}
# Testing a case where input position is greater than actual binlog file size.
--replace_result $pos POS $max_pos MAX_POS
--error 1220
eval SHOW BINLOG EVENTS FROM $pos;
DROP TABLE t1;

View File

@ -456,7 +456,6 @@ START TRANSACTION
### DELETE FROM `test1`.`t1`
### WHERE
### @1=3 /* INT meta=0 nullable=1 is_null=0 */
'/*!*/;
# at #
#010909 4:46:40 server id # end_log_pos # Query thread_id=# exec_time=# error_code=0
SET TIMESTAMP=1000000000/*!*/;

View File

@ -644,6 +644,121 @@ END;
# End of 10.3 tests
#
#
# MDEV-21998: Server crashes in st_select_lex::add_table_to_list
# upon mix of KILL and sequences
#
KILL ( SELECT 1 ) + LASTVAL(s);
ERROR 42000: KILL does not support subqueries or stored functions
KILL LASTVAL(s);
ERROR 42000: KILL does not support subqueries or stored functions
#
# MDEV-23094: Multiple calls to a Stored Procedure from another
# Stored Procedure crashes server
#
create table t1 (id1 int primary key, data1 int);
create table t2 (id2 int primary key, data2 int);
create procedure p1(id int,dt int) as
begin
if (exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt))
then
select 1;
end if;
end //
call p1(1,2);
1
1
call p1(1,2);
1
1
drop procedure p1;
create procedure p1(id int, dt int) as
begin
case (exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt))
when 1 then
select 1;
else
select 0;
end case;
end //
call p1(1,2);
1
1
call p1(1,2);
1
1
drop procedure p1;
create procedure p1(id int, dt int) as
begin
declare wcont int default 1;
begin
while (exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt)) and wcont
loop
select 1;
set wcont=0;
end loop;
end;
end //
call p1(1,2);
1
1
call p1(1,2);
1
1
drop procedure p1;
create procedure p1(id int, dt int) as
begin
declare count int default 1;
begin
repeat
select 1;
set count=count+1;
until (exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt)) and
count < 3
end repeat;
end;
end //
call p1(1,2);
1
1
call p1(1,2);
1
1
drop procedure p1;
create procedure p1(id int, dt int) as
begin
for i in 1..(exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt))
loop
select 1;
end loop;
end //
call p1(1,2);
1
1
call p1(1,2);
1
1
drop procedure p1;
set sql_mode=ORACLE;
create or replace procedure p1(id int, dt int) as
begin
while (1)
loop
exit when (exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt));
end loop;
end;
//
call p1(1,2);
call p1(1,2);
drop procedure p1;
drop table t1,t2;
# End of 10.4 tests
#
# Start of 10.5 tests
#
#

View File

@ -461,6 +461,137 @@ DELIMITER ;//
--echo #
--echo #
--echo # MDEV-21998: Server crashes in st_select_lex::add_table_to_list
--echo # upon mix of KILL and sequences
--echo #
--error ER_SUBQUERIES_NOT_SUPPORTED
KILL ( SELECT 1 ) + LASTVAL(s);
--error ER_SUBQUERIES_NOT_SUPPORTED
KILL LASTVAL(s);
--echo #
--echo # MDEV-23094: Multiple calls to a Stored Procedure from another
--echo # Stored Procedure crashes server
--echo #
create table t1 (id1 int primary key, data1 int);
create table t2 (id2 int primary key, data2 int);
delimiter //;
create procedure p1(id int,dt int) as
begin
if (exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt))
then
select 1;
end if;
end //
delimiter ;//
call p1(1,2);
call p1(1,2);
drop procedure p1;
delimiter //;
create procedure p1(id int, dt int) as
begin
case (exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt))
when 1 then
select 1;
else
select 0;
end case;
end //
delimiter ;//
call p1(1,2);
call p1(1,2);
drop procedure p1;
delimiter //;
create procedure p1(id int, dt int) as
begin
declare wcont int default 1;
begin
while (exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt)) and wcont
loop
select 1;
set wcont=0;
end loop;
end;
end //
delimiter ;//
call p1(1,2);
call p1(1,2);
drop procedure p1;
delimiter //;
create procedure p1(id int, dt int) as
begin
declare count int default 1;
begin
repeat
select 1;
set count=count+1;
until (exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt)) and
count < 3
end repeat;
end;
end //
delimiter ;//
call p1(1,2);
call p1(1,2);
drop procedure p1;
delimiter //;
create procedure p1(id int, dt int) as
begin
for i in 1..(exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt))
loop
select 1;
end loop;
end //
delimiter ;//
call p1(1,2);
call p1(1,2);
drop procedure p1;
delimiter //;
set sql_mode=ORACLE;
create or replace procedure p1(id int, dt int) as
begin
while (1)
loop
exit when (exists(select * from t1 where id1 = id and data1 = dt) or
not exists (select * from t2 where id2 = id and data2 = dt));
end loop;
end;
//
delimiter ;//
call p1(1,2);
call p1(1,2);
drop procedure p1;
drop table t1,t2;
--echo # End of 10.4 tests
--echo #
--echo # Start of 10.5 tests
--echo #

View File

@ -1,8 +1,5 @@
SET @save_threads = @@GLOBAL.innodb_encryption_threads;
SET default_storage_engine = InnoDB;
CREATE TABLE t1 (pk INT PRIMARY KEY, c VARCHAR(256));
CREATE TABLE t2 AS SELECT * FROM t1;
drop table t1,t2;
SET GLOBAL innodb_encryption_threads = 0;
SET GLOBAL innodb_encryption_threads = 4;
CREATE TABLE `table10_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int, key (`col_int_key` ),primary key (pk)) engine=innodb;
INSERT /*! IGNORE */ INTO table10_int_autoinc VALUES (NULL, NULL, -474021888) , (1, NULL, NULL) , (1141047296, NULL, NULL) , (NULL, NULL, NULL) , (NULL, NULL, 1) , (NULL, NULL, 9) , (0, NULL, 1225785344) , (NULL, NULL, 1574174720) , (2, NULL, NULL) , (6, NULL, 3);
@ -14,14 +11,9 @@ INSERT IGNORE INTO `table1_int_autoinc` ( `col_int` ) VALUES ( 1 ), ( 0 ), ( 7 )
INSERT IGNORE INTO `table10_int_autoinc` ( `col_int` ) VALUES ( 6 ), ( 2 ), ( 3 ), ( 6 );
connect con1,localhost,root,,test;
connect con2,localhost,root,,test;
connection default;
drop table if exists create_or_replace_t, table1_int_autoinc, table0_int_autoinc, table10_int_autoinc;
disconnect con1;
disconnect con2;
SET GLOBAL innodb_encrypt_tables = OFF;
SET GLOBAL innodb_encryption_threads = 4;
# Wait max 10 min for key encryption threads to decrypt all spaces
# Success!
SET GLOBAL innodb_encryption_threads = 0;
SET GLOBAL innodb_encrypt_tables = OFF;
# restart
connection default;
drop table create_or_replace_t, table1_int_autoinc, table0_int_autoinc,
table10_int_autoinc;
SET GLOBAL innodb_encryption_threads = @save_threads;

View File

@ -0,0 +1,20 @@
SET default_storage_engine = InnoDB;
CREATE TABLE t1 (pk INT PRIMARY KEY, c VARCHAR(256));
CREATE TABLE t2 AS SELECT * FROM t1;
drop table t1,t2;
SET GLOBAL innodb_encryption_threads = 0;
SET GLOBAL innodb_encryption_threads = 4;
CREATE TABLE `table10_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int, key (`col_int_key` ),primary key (pk)) engine=innodb;
INSERT /*! IGNORE */ INTO table10_int_autoinc VALUES (NULL, NULL, -474021888) , (1, NULL, NULL) , (1141047296, NULL, NULL) , (NULL, NULL, NULL) , (NULL, NULL, 1) , (NULL, NULL, 9) , (0, NULL, 1225785344) , (NULL, NULL, 1574174720) , (2, NULL, NULL) , (6, NULL, 3);
CREATE TABLE `table1_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int,key (`col_int_key` ), primary key (pk)) engine=innodb;
CREATE TABLE `table0_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int, key (`col_int_key` ),primary key (pk)) engine=innodb;
INSERT /*! IGNORE */ INTO table1_int_autoinc VALUES (4, NULL, NULL);
INSERT IGNORE INTO `table0_int_autoinc` ( `col_int_key` ) VALUES ( 1 ), ( 3 ), ( 4 ), ( 1 );
INSERT IGNORE INTO `table1_int_autoinc` ( `col_int` ) VALUES ( 1 ), ( 0 ), ( 7 ), ( 9 );
INSERT IGNORE INTO `table10_int_autoinc` ( `col_int` ) VALUES ( 6 ), ( 2 ), ( 3 ), ( 6 );
# Wait max 10 min for key encryption threads to decrypt all spaces
# Success!
SET GLOBAL innodb_encryption_threads = 0;
SET GLOBAL innodb_encrypt_tables = OFF;
DROP TABLE table0_int_autoinc, table1_int_autoinc, table10_int_autoinc;
# restart

View File

@ -1 +1 @@
--innodb-tablespaces-encryption
--innodb-encrypt-tables

View File

@ -1,42 +1,11 @@
--source include/have_innodb.inc
--source include/have_file_key_management_plugin.inc
--source include/not_embedded.inc
# This is needed for longer testcase timeout at least P7/P8
--source include/big_test.inc
--source include/count_sessions.inc
SET @save_threads = @@GLOBAL.innodb_encryption_threads;
#
# MDEV-8164: Server crashes in pfs_mutex_enter_func after fil_crypt_is_closing or alike
#
SET default_storage_engine = InnoDB;
CREATE TABLE t1 (pk INT PRIMARY KEY, c VARCHAR(256));
CREATE TABLE t2 AS SELECT * FROM t1;
--disable_abort_on_error
--disable_warnings
--disable_query_log
let $i = 40;
while ($i)
{
SET GLOBAL innodb_encrypt_tables = ON;
SET GLOBAL innodb_encryption_threads = 1;
CREATE OR REPLACE TABLE t1 AS SELECT * FROM t2;
CREATE OR REPLACE TABLE t2 AS SELECT * FROM t1;
SET GLOBAL innodb_encryption_rotation_iops = 100;
SET GLOBAL innodb_encrypt_tables = OFF;
CREATE OR REPLACE TABLE t2 AS SELECT * FROM t1;
CREATE OR REPLACE TABLE t1 AS SELECT * FROM t2;
dec $i;
}
--enable_abort_on_error
--enable_warnings
--enable_query_log
drop table t1,t2;
SET GLOBAL innodb_encryption_threads = 0;
#
# MDEV-8173: InnoDB; Failing assertion: crypt_data->type == 1
#
@ -58,11 +27,9 @@ INSERT IGNORE INTO `table10_int_autoinc` ( `col_int` ) VALUES ( 6 ), ( 2 ), ( 3
--connect (con1,localhost,root,,test)
--connect (con2,localhost,root,,test)
--disable_abort_on_error
--disable_warnings
--disable_query_log
let $i = 500;
let $i = 100;
while ($i)
{
connection con1;
@ -101,42 +68,11 @@ dec $i;
}
--enable_query_log
disconnect con1;
disconnect con2;
connection default;
drop table if exists create_or_replace_t, table1_int_autoinc, table0_int_autoinc, table10_int_autoinc;
--disconnect con1
--disconnect con2
--enable_abort_on_error
--enable_warnings
drop table create_or_replace_t, table1_int_autoinc, table0_int_autoinc,
table10_int_autoinc;
SET GLOBAL innodb_encrypt_tables = OFF;
SET GLOBAL innodb_encryption_threads = 4;
--echo # Wait max 10 min for key encryption threads to decrypt all spaces
let $cnt=600;
while ($cnt)
{
let $success=`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0`;
if ($success)
{
let $cnt=0;
}
if (!$success)
{
real_sleep 1;
dec $cnt;
}
}
if (!$success)
{
SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
SHOW STATUS LIKE 'innodb_encryption%';
-- die Timeout waiting for encryption threads
}
--echo # Success!
SET GLOBAL innodb_encryption_threads = 0;
SET GLOBAL innodb_encrypt_tables = OFF;
# Make sure that all dirty pages are flushed
-- source include/restart_mysqld.inc
SET GLOBAL innodb_encryption_threads = @save_threads;
--source include/wait_until_count_sessions.inc

View File

@ -0,0 +1 @@
--innodb-tablespaces-encryption

View File

@ -0,0 +1,86 @@
--source include/have_innodb.inc
--source include/have_file_key_management_plugin.inc
--source include/not_embedded.inc
# This is needed for longer testcase timeout at least P7/P8
--source include/big_test.inc
#
# MDEV-8164: Server crashes in pfs_mutex_enter_func after fil_crypt_is_closing or alike
#
SET default_storage_engine = InnoDB;
CREATE TABLE t1 (pk INT PRIMARY KEY, c VARCHAR(256));
CREATE TABLE t2 AS SELECT * FROM t1;
--disable_abort_on_error
--disable_warnings
--disable_query_log
let $i = 40;
while ($i)
{
SET GLOBAL innodb_encrypt_tables = ON;
SET GLOBAL innodb_encryption_threads = 1;
CREATE OR REPLACE TABLE t1 AS SELECT * FROM t2;
CREATE OR REPLACE TABLE t2 AS SELECT * FROM t1;
SET GLOBAL innodb_encryption_rotation_iops = 100;
SET GLOBAL innodb_encrypt_tables = OFF;
CREATE OR REPLACE TABLE t2 AS SELECT * FROM t1;
CREATE OR REPLACE TABLE t1 AS SELECT * FROM t2;
dec $i;
}
--enable_abort_on_error
--enable_warnings
--enable_query_log
drop table t1,t2;
SET GLOBAL innodb_encryption_threads = 0;
#
# MDEV-8173: InnoDB; Failing assertion: crypt_data->type == 1
#
SET GLOBAL innodb_encryption_threads = 4;
CREATE TABLE `table10_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int, key (`col_int_key` ),primary key (pk)) engine=innodb;
INSERT /*! IGNORE */ INTO table10_int_autoinc VALUES (NULL, NULL, -474021888) , (1, NULL, NULL) , (1141047296, NULL, NULL) , (NULL, NULL, NULL) , (NULL, NULL, 1) , (NULL, NULL, 9) , (0, NULL, 1225785344) , (NULL, NULL, 1574174720) , (2, NULL, NULL) , (6, NULL, 3);
CREATE TABLE `table1_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int,key (`col_int_key` ), primary key (pk)) engine=innodb;
CREATE TABLE `table0_int_autoinc` (`col_int_key` int, pk int auto_increment, `col_int` int, key (`col_int_key` ),primary key (pk)) engine=innodb;
INSERT /*! IGNORE */ INTO table1_int_autoinc VALUES (4, NULL, NULL);
INSERT IGNORE INTO `table0_int_autoinc` ( `col_int_key` ) VALUES ( 1 ), ( 3 ), ( 4 ), ( 1 );
INSERT IGNORE INTO `table1_int_autoinc` ( `col_int` ) VALUES ( 1 ), ( 0 ), ( 7 ), ( 9 );
INSERT IGNORE INTO `table10_int_autoinc` ( `col_int` ) VALUES ( 6 ), ( 2 ), ( 3 ), ( 6 );
--echo # Wait max 10 min for key encryption threads to decrypt all spaces
let $cnt=600;
while ($cnt)
{
let $success=`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0`;
if ($success)
{
let $cnt=0;
}
if (!$success)
{
real_sleep 1;
dec $cnt;
}
}
if (!$success)
{
SELECT * FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION;
SHOW STATUS LIKE 'innodb_encryption%';
-- die Timeout waiting for encryption threads
}
--echo # Success!
SET GLOBAL innodb_encryption_threads = 0;
SET GLOBAL innodb_encrypt_tables = OFF;
DROP TABLE table0_int_autoinc, table1_int_autoinc, table10_int_autoinc;
-- source include/restart_mysqld.inc

View File

@ -16,6 +16,7 @@ MDEV-16509 : MDEV-21523 galera.MDEV-16509
MDEV-20225 : MDEV-20886 galera.MDEV-20225
MW-286 : MDEV-18464 Killing thread can cause mutex deadlock if done concurrently with Galera/replication victim kill
MW-328A : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002
MW-328B : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002
MW-329 : MDEV-19962 Galera test failure on MW-329
galera.galera_defaults : MDEV-21494 Galera test sporadic failure on galera.galera_defaults
galera_as_slave_replication_bundle : MDEV-15785 OPTION_GTID_BEGIN is set in Gtid_log_event::do_apply_event()

View File

@ -0,0 +1,18 @@
connection node_2;
connection node_1;
ROLLBACK AND CHAIN;
CREATE TABLE t1(a int not null primary key) engine=innodb;
INSERT INTO t1 values (1);
BEGIN;
INSERT INTO t1 values (2);
ROLLBACK AND CHAIN;
SELECT * FROM t1;
a
1
connection node_2;
SET SESSION wsrep_sync_wait=15;
SELECT * FROM t1;
a
1
connection node_1;
DROP TABLE t1;

View File

@ -4,48 +4,45 @@ connection node_1;
connection node_2;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
CREATE PROCEDURE p1 ()
BEGIN
DECLARE x INT DEFAULT 1;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
WHILE 1 DO
INSERT INTO t1 VALUES (DEFAULT);
COMMIT;
END WHILE;
END|
CALL p1();;
connection node_2;
CALL p1();;
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2a;
Killing server ...
INSERT INTO t1 VALUES (DEFAULT);
connection node_1;
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
connection node_2a;
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1a;
INSERT INTO t1 VALUES (DEFAULT);
connection node_1;
Got one of the listed errors
connection node_2;
Got one of the listed errors
connection node_1a;
SELECT COUNT(*) FROM t1;
COUNT(*)
132
connection node_2a;
count_equal
1
CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member 0");
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE
2
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
connection node_1a;
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE
2
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
1
DROP PROCEDURE p1;
SELECT COUNT(*) FROM t1;
COUNT(*)
132
connection node_1;
DROP TABLE t1;
CALL mtr.add_suppression("gcs_caused\\(\\) returned -1 \\(Operation not permitted\\)");
CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member 0");
disconnect node_1a;
disconnect node_2a;

View File

@ -1,5 +1,10 @@
connection node_2;
connection node_1;
#
# test phase with cascading foreign key through 3 tables
#
connection node_1;
set wsrep_sync_wait=0;
CREATE TABLE grandparent (
id INT NOT NULL PRIMARY KEY
) ENGINE=InnoDB;
@ -21,14 +26,15 @@ INSERT INTO grandparent VALUES (1),(2);
INSERT INTO parent VALUES (1,1), (2,2);
INSERT INTO child VALUES (1,1), (2,2);
connection node_2;
set wsrep_sync_wait=0;
DELETE FROM grandparent WHERE id = 1;
connection node_1;
SELECT COUNT(*) = 0 FROM parent WHERE grandparent_id = 1;
COUNT(*) = 0
1
SELECT COUNT(*) = 0 FROM child WHERE parent_id = 1;
COUNT(*) = 0
1
SELECT COUNT(*), COUNT(*) = 0 FROM parent WHERE grandparent_id = 1;
COUNT(*) COUNT(*) = 0
0 1
SELECT COUNT(*), COUNT(*) = 0 FROM child WHERE parent_id = 1;
COUNT(*) COUNT(*) = 0
0 1
DROP TABLE child;
DROP TABLE parent;
DROP TABLE grandparent;

View File

@ -0,0 +1,70 @@
connection node_2;
connection node_1;
#
# test phase with foreign key of varchar type
#
connection node_1;
CREATE TABLE parent (
`id` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE child (
`id` int NOT NULL,
`parent_id` varchar(36) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `parent_id` (`parent_id`),
CONSTRAINT `ipallocations_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO parent VALUES ('row one'), ('row two');
INSERT INTO child VALUES (1,'row one'), (2,'row two');
connection node_2;
DELETE FROM parent;
connection node_1;
SELECT COUNT(*), COUNT(*) = 0 FROM parent;
COUNT(*) COUNT(*) = 0
0 1
SELECT COUNT(*), COUNT(*) = 0 FROM child;
COUNT(*) COUNT(*) = 0
0 1
DROP TABLE child;
DROP TABLE parent;
#
# test phase with MM conflict in FK cascade
#
connection node_1;
set wsrep_retry_autocommit=0;
CREATE TABLE parent (
id INT NOT NULL PRIMARY KEY
) ENGINE=InnoDB;
CREATE TABLE child (
id INT NOT NULL PRIMARY KEY,
j int default 0,
parent_id INT,
FOREIGN KEY (parent_id)
REFERENCES parent(id)
ON DELETE CASCADE
) ENGINE=InnoDB;
INSERT INTO parent VALUES (1);
INSERT INTO child VALUES (1,0,1);
connection node_2;
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
connection node_2;
DELETE FROM parent;
connection node_1a;
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
connection node_1;
update child set j=2;;
connection node_1a;
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
SET GLOBAL debug_dbug = "";
SET DEBUG_SYNC = "RESET";
connection node_1;
SELECT COUNT(*), COUNT(*) = 0 FROM parent;
COUNT(*) COUNT(*) = 0
0 1
SELECT COUNT(*), COUNT(*) = 0 FROM child;
COUNT(*) COUNT(*) = 0
0 1
DROP TABLE child;
DROP TABLE parent;

View File

@ -0,0 +1,78 @@
connection node_2;
connection node_1;
CREATE TABLE IF NOT EXISTS t1 (id int(10) not null primary key) engine=innodb;
CREATE OR REPLACE TRIGGER tr1
BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
SET NEW.id = 100;
END|
INSERT INTO t1 VALUES (1);
SELECT * from t1;
id
100
CREATE OR REPLACE TRIGGER tr1
BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
SET NEW.id = 200;
END|
connection node_2;
SET SESSION wsrep_sync_wait=15;
SELECT * FROM t1;
id
100
INSERT INTO t1 values (2);
SELECT * FROM t1;
id
100
200
connection node_1;
SELECT * FROM t1;
id
100
200
DROP TRIGGER tr1;
DROP TABLE t1;
connection node_1;
CREATE TABLE t1(id int not null auto_increment, value int not null, primary key (id)) engine=innodb;
CREATE TABLE t2(id int not null auto_increment, tbl varchar(64) not null, action varchar(64) not null, primary key (id));
create trigger log_insert after insert on t1
for each row begin
insert into t2(tbl, action) values ('t1', 'INSERT');
end|
insert into t1(value) values (1);
insert into t1(value) values (2);
connection node_2;
set session wsrep_sync_wait=15;
insert into t1(value) values (3);
insert into t1(value) values (4);
select * from t2;
id tbl action
1 t1 INSERT
3 t1 INSERT
4 t1 INSERT
6 t1 INSERT
connection node_1;
drop trigger if exists log_insert;
insert into t1(value) values (5);
select * from t2;
id tbl action
1 t1 INSERT
3 t1 INSERT
4 t1 INSERT
6 t1 INSERT
connection node_2;
insert into t1(value) values (6);
select * from t2;
id tbl action
1 t1 INSERT
3 t1 INSERT
4 t1 INSERT
6 t1 INSERT
connection node_1;
select * from t2;
id tbl action
1 t1 INSERT
3 t1 INSERT
4 t1 INSERT
6 t1 INSERT
drop table t1, t2;

View File

@ -6,11 +6,11 @@ connection node_1;
connection node_2;
connection node_3;
connection node_4;
SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 4
1
SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
EXPECT_4
4
connection node_1;
CREATE TABLE t1 (f1 INTEGER);
CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=INNODB;
INSERT INTO t1 VALUES (1);
connection node_2;
INSERT INTO t1 VALUES (2);
@ -22,60 +22,78 @@ connection node_3;
INSERT INTO t1 VALUES (13);
Shutting down server ...
connection node_1;
SELECT VARIABLE_VALUE AS EXPECT_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
EXPECT_3
3
INSERT INTO t1 VALUES (11);
connection node_2;
INSERT INTO t1 VALUES (12);
connection node_4;
INSERT INTO t1 VALUES (14);
connection node_3;
SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
EXPECT_4
4
INSERT INTO t1 VALUES (131);
connection node_2;
INSERT INTO t1 VALUES (22);
Shutting down server ...
connection node_1;
SELECT VARIABLE_VALUE AS EXPECT_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
EXPECT_3
3
INSERT INTO t1 VALUES (21);
connection node_3;
INSERT INTO t1 VALUES (23);
connection node_4;
INSERT INTO t1 VALUES (24);
connection node_2;
SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
EXPECT_4
4
INSERT INTO t1 VALUES (221);
connection node_4;
INSERT INTO t1 VALUES (34);
Shutting down server ...
connection node_1;
SELECT VARIABLE_VALUE AS EXPECT_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
EXPECT_3
3
INSERT INTO t1 VALUES (31);
connection node_2;
INSERT INTO t1 VALUES (32);
connection node_3;
INSERT INTO t1 VALUES (33);
connection node_4;
SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
EXPECT_4
4
INSERT INTO t1 VALUES (341);
connection node_1;
SELECT COUNT(*) = 19 FROM t1;
COUNT(*) = 19
1
SELECT COUNT(*) AS EXPECT_19 FROM t1;
EXPECT_19
19
connection node_2;
SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 4
1
SELECT COUNT(*) = 19 FROM t1;
COUNT(*) = 19
1
SELECT COUNT(*) AS EXPECT_19 FROM t1;
EXPECT_19
19
connection node_3;
SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 4
1
SELECT COUNT(*) = 19 FROM t1;
COUNT(*) = 19
1
SELECT COUNT(*) AS EXPECT_19 FROM t1;
EXPECT_19
19
connection node_4;
SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 4
1
SELECT COUNT(*) = 19 FROM t1;
COUNT(*) = 19
1
SELECT COUNT(*) AS EXPECT_19 FROM t1;
EXPECT_19
19
connection node_1;
DROP TABLE t1;
CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside");
@ -86,5 +104,6 @@ CALL mtr.add_suppression("There are no nodes in the same segment that will ever
CALL mtr.add_suppression("Action message in non-primary configuration from member 0");
connection node_4;
CALL mtr.add_suppression("Action message in non-primary configuration from member 0");
disconnect node_2;
disconnect node_1;
connection node_1;
disconnect node_3;
disconnect node_4;

View File

@ -0,0 +1,19 @@
--source include/galera_cluster.inc
ROLLBACK AND CHAIN;
CREATE TABLE t1(a int not null primary key) engine=innodb;
INSERT INTO t1 values (1);
BEGIN;
INSERT INTO t1 values (2);
ROLLBACK AND CHAIN;
SELECT * FROM t1;
--connection node_2
SET SESSION wsrep_sync_wait=15;
SELECT * FROM t1;
--connection node_1
DROP TABLE t1;

View File

@ -2,93 +2,62 @@
# Test that autoincrement works correctly while the cluster membership
# is changing and SST takes place.
#
--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_mariabackup.inc
--source include/force_restart.inc
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--connection node_1
--let $connection_id = `SELECT CONNECTION_ID()`
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
# Issue an endless stream of autoincrement inserts
DELIMITER |;
CREATE PROCEDURE p1 ()
BEGIN
DECLARE x INT DEFAULT 1;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
WHILE 1 DO
INSERT INTO t1 VALUES (DEFAULT);
COMMIT;
END WHILE;
END|
DELIMITER ;|
--send CALL p1();
--sleep 1
--connection node_2
--send CALL p1();
--sleep 1
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
# Kill and restart node #2
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--connection node_2a
--source include/kill_galera.inc
--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
--connection node_1
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
--connection node_2a
--source include/start_mysqld.inc
--source include/wait_until_connected_again.inc
INSERT INTO t1 VALUES (DEFAULT);
# Terminate the stored procedure
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
INSERT INTO t1 VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
--connection node_1a
--disable_query_log
--eval KILL CONNECTION $connection_id
--enable_query_log
INSERT INTO t1 VALUES (DEFAULT);
--connection node_1
# CR_SERVER_LOST
--error 2013,2006
--reap
--connection node_2
# CR_SERVER_LOST
--error 2013,2006
--reap
# Confirm that the count is correct and that the cluster is intact
--connection node_1a
--let $count = `SELECT COUNT(*) FROM t1`
SELECT COUNT(*) FROM t1;
--connection node_2a
--disable_query_log
--eval SELECT COUNT(*) = $count AS count_equal FROM t1
--enable_query_log
SELECT COUNT(*) FROM t1;
CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member 0");
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--connection node_1a
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
DROP PROCEDURE p1;
--connection node_1
DROP TABLE t1;
CALL mtr.add_suppression("gcs_caused\\(\\) returned -1 \\(Operation not permitted\\)");
@ -97,3 +66,6 @@ CALL mtr.add_suppression("WSREP: Action message in non-primary configuration fro
--let $node_1=node_1a
--let $node_2=node_2a
--source include/auto_increment_offset_restore.inc
--disconnect node_1a
--disconnect node_2a

View File

@ -3,7 +3,13 @@
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--echo #
--echo # test phase with cascading foreign key through 3 tables
--echo #
--connection node_1
set wsrep_sync_wait=0;
CREATE TABLE grandparent (
id INT NOT NULL PRIMARY KEY
@ -30,11 +36,17 @@ INSERT INTO parent VALUES (1,1), (2,2);
INSERT INTO child VALUES (1,1), (2,2);
--connection node_2
set wsrep_sync_wait=0;
--let $wait_condition = SELECT COUNT(*) = 2 FROM child;
--source include/wait_condition.inc
DELETE FROM grandparent WHERE id = 1;
--connection node_1
SELECT COUNT(*) = 0 FROM parent WHERE grandparent_id = 1;
SELECT COUNT(*) = 0 FROM child WHERE parent_id = 1;
--let $wait_condition = SELECT COUNT(*) = 1 FROM child;
--source include/wait_condition.inc
SELECT COUNT(*), COUNT(*) = 0 FROM parent WHERE grandparent_id = 1;
SELECT COUNT(*), COUNT(*) = 0 FROM child WHERE parent_id = 1;
DROP TABLE child;
DROP TABLE parent;

View File

@ -0,0 +1,99 @@
--source include/galera_cluster.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--echo #
--echo # test phase with foreign key of varchar type
--echo #
--connection node_1
CREATE TABLE parent (
`id` varchar(36) COLLATE utf8_unicode_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE child (
`id` int NOT NULL,
`parent_id` varchar(36) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `parent_id` (`parent_id`),
CONSTRAINT `ipallocations_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO parent VALUES ('row one'), ('row two');
INSERT INTO child VALUES (1,'row one'), (2,'row two');
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 2 FROM child;
--source include/wait_condition.inc
DELETE FROM parent;
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 0 FROM child;
--source include/wait_condition.inc
SELECT COUNT(*), COUNT(*) = 0 FROM parent;
SELECT COUNT(*), COUNT(*) = 0 FROM child;
DROP TABLE child;
DROP TABLE parent;
--echo #
--echo # test phase with MM conflict in FK cascade
--echo #
--connection node_1
set wsrep_retry_autocommit=0;
CREATE TABLE parent (
id INT NOT NULL PRIMARY KEY
) ENGINE=InnoDB;
CREATE TABLE child (
id INT NOT NULL PRIMARY KEY,
j int default 0,
parent_id INT,
FOREIGN KEY (parent_id)
REFERENCES parent(id)
ON DELETE CASCADE
) ENGINE=InnoDB;
INSERT INTO parent VALUES (1);
INSERT INTO child VALUES (1,0,1);
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM child;
--source include/wait_condition.inc
# block applier before applying
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
--connection node_2
DELETE FROM parent;
--connection node_1a
# wait until applier has reached the sync point
SET SESSION DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
--connection node_1
# issue conflicting write to child table, it should fail in certification
--error ER_LOCK_DEADLOCK
--send update child set j=2;
--connection node_1a
# release the applier
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
SET GLOBAL debug_dbug = "";
SET DEBUG_SYNC = "RESET";
--connection node_1
--reap
--let $wait_condition = SELECT COUNT(*) = 0 FROM child;
--source include/wait_condition.inc
SELECT COUNT(*), COUNT(*) = 0 FROM parent;
SELECT COUNT(*), COUNT(*) = 0 FROM child;
DROP TABLE child;
DROP TABLE parent;

View File

@ -0,0 +1,72 @@
--source include/galera_cluster.inc
#
# MDEV-21578 CREATE OR REPLACE TRIGGER in Galera cluster not replicating
#
CREATE TABLE IF NOT EXISTS t1 (id int(10) not null primary key) engine=innodb;
--delimiter |
CREATE OR REPLACE TRIGGER tr1
BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
SET NEW.id = 100;
END|
--delimiter ;
INSERT INTO t1 VALUES (1);
SELECT * from t1;
--delimiter |
CREATE OR REPLACE TRIGGER tr1
BEFORE INSERT ON t1 FOR EACH ROW
BEGIN
SET NEW.id = 200;
END|
--delimiter ;
--connection node_2
SET SESSION wsrep_sync_wait=15;
SELECT * FROM t1;
INSERT INTO t1 values (2);
SELECT * FROM t1;
--connection node_1
SELECT * FROM t1;
DROP TRIGGER tr1;
DROP TABLE t1;
#
# MDEV-23638 : DROP TRIGGER in Galera Cluster not replicating
#
--connection node_1
CREATE TABLE t1(id int not null auto_increment, value int not null, primary key (id)) engine=innodb;
CREATE TABLE t2(id int not null auto_increment, tbl varchar(64) not null, action varchar(64) not null, primary key (id));
--delimiter |
create trigger log_insert after insert on t1
for each row begin
insert into t2(tbl, action) values ('t1', 'INSERT');
end|
--delimiter ;
insert into t1(value) values (1);
insert into t1(value) values (2);
--connection node_2
set session wsrep_sync_wait=15;
insert into t1(value) values (3);
insert into t1(value) values (4);
select * from t2;
--connection node_1
drop trigger if exists log_insert;
insert into t1(value) values (5);
select * from t2;
--connection node_2
insert into t1(value) values (6);
select * from t2;
--connection node_1
select * from t2;
drop table t1, t2;

View File

@ -10,7 +10,7 @@
--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/force_restart.inc
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
@ -22,10 +22,13 @@
--let $node_4=node_4
--source include/auto_increment_offset_save.inc
SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--connection node_1
CREATE TABLE t1 (f1 INTEGER);
CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=INNODB;
INSERT INTO t1 VALUES (1);
--connection node_2
@ -46,9 +49,13 @@ INSERT INTO t1 VALUES (13);
--echo Shutting down server ...
--source include/shutdown_mysqld.inc
--sleep 5
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
SELECT VARIABLE_VALUE AS EXPECT_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
INSERT INTO t1 VALUES (11);
--connection node_2
@ -59,9 +66,12 @@ INSERT INTO t1 VALUES (14);
--connection node_3
--source include/start_mysqld.inc
--sleep 5
--source include/wait_until_connected_again.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
INSERT INTO t1 VALUES (131);
#
@ -73,9 +83,12 @@ INSERT INTO t1 VALUES (22);
--echo Shutting down server ...
--source include/shutdown_mysqld.inc
--sleep 5
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
SELECT VARIABLE_VALUE AS EXPECT_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
INSERT INTO t1 VALUES (21);
--connection node_3
@ -86,9 +99,12 @@ INSERT INTO t1 VALUES (24);
--connection node_2
--source include/start_mysqld.inc
--sleep 5
--source include/wait_until_connected_again.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
INSERT INTO t1 VALUES (221);
#
@ -100,9 +116,12 @@ INSERT INTO t1 VALUES (34);
--echo Shutting down server ...
--source include/shutdown_mysqld.inc
--sleep 5
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
SELECT VARIABLE_VALUE AS EXPECT_3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
INSERT INTO t1 VALUES (31);
--connection node_2
@ -113,9 +132,12 @@ INSERT INTO t1 VALUES (33);
--connection node_4
--source include/start_mysqld.inc
--sleep 5
--source include/wait_until_connected_again.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
INSERT INTO t1 VALUES (341);
@ -124,22 +146,44 @@ INSERT INTO t1 VALUES (341);
#
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 19 FROM t1
--source include/wait_condition.inc
SELECT COUNT(*) = 19 FROM t1;
SELECT COUNT(*) AS EXPECT_19 FROM t1;
--connection node_2
--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
SELECT COUNT(*) = 19 FROM t1;
--let $wait_condition = SELECT COUNT(*) = 19 FROM t1
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_19 FROM t1;
--connection node_3
--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
SELECT COUNT(*) = 19 FROM t1;
--let $wait_condition = SELECT COUNT(*) = 19 FROM t1
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_19 FROM t1;
--connection node_4
--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
SELECT COUNT(*) = 19 FROM t1;
--let $wait_condition = SELECT COUNT(*) = 19 FROM t1
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_19 FROM t1;
--connection node_1
DROP TABLE t1;
@ -158,4 +202,6 @@ CALL mtr.add_suppression("Action message in non-primary configuration from membe
# Restore original auto_increment_offset values.
--source include/auto_increment_offset_restore.inc
--source include/galera_end.inc
--connection node_1
--disconnect node_3
--disconnect node_4

View File

@ -5,15 +5,15 @@
--source include/galera_cluster.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--let $node_1 = node_1
--let $node_2 = node_2
--source include/auto_increment_offset_save.inc
--let $galera_connection_name = node_1_ctrl
--let $galera_server_number = 1
--source include/galera_connect.inc
#
# Run UPDATE on node_1 and make it block before table locks are taken.
# This should block FTWRL.
@ -23,10 +23,10 @@ CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT);
INSERT INTO t1 VALUES (1, 1);
SET DEBUG_SYNC = "before_lock_tables_takes_lock SIGNAL sync_point_reached WAIT_FOR sync_point_continue";
--send UPDATE t1 SET f2 = 2 WHERE f1 = 1
--connection node_1_ctrl
SET DEBUG_SYNC = "now WAIT_FOR sync_point_reached";
#
# Restart node_2, force SST.
#
@ -40,19 +40,19 @@ SET DEBUG_SYNC = "now WAIT_FOR sync_point_reached";
# If the bug is present, FTWRL times out on node_1 in couple of
# seconds and node_2 fails to join.
--sleep 10
--connection node_1_ctrl
SET DEBUG_SYNC = "now SIGNAL sync_point_continue";
--connection node_1
--reap
SET DEBUG_SYNC = "RESET";
--connection node_2
--enable_reconnect
--source include/wait_until_connected_again.inc
--connection node_1
DROP TABLE t1;
--source include/auto_increment_offset_restore.inc

View File

@ -1,2 +1,16 @@
##############################################################################
#
# List the test cases that are to be disabled temporarily.
#
# Separate the test case name and the comment with ':'.
#
# <testcasename> : MDEV-<xxxx> <comment>
#
# Do not use any TAB characters for whitespace.
#
##############################################################################
galera_gtid_2_cluster : MDEV-23775 Galera test failure on galera_3nodes.galera_gtid_2_cluster
galera_ist_gcache_rollover : MDEV-23578 WSREP: exception caused by message: {v=0,t=1,ut=255,o=4,s=0,sr=0,as=1,f=6,src=50524cfe,srcvid=view_id(REG,50524cfe,4),insvid=view_id(UNKNOWN,00000000,0),ru=00000000,r=[-1,-1],fs=75,nl=(}
galera_slave_options_do :MDEV-8798
galera_slave_options_ignore : MDEV-8798

View File

@ -10,11 +10,11 @@ VARIABLE_VALUE = 3
connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
SELECT COUNT(*) AS EXPECT_1 FROM t1;
EXPECT_1
1
DROP TABLE t1;

View File

@ -1,17 +1,18 @@
connection node_2;
connection node_1;
connection node_2;
SET wsrep_on=OFF;
DROP SCHEMA test;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connection node_3;
connection node_1;
connection node_2;
connection node_3;
connection node_2;
SET wsrep_on=OFF;
CREATE TABLE test.t1 (f1 INTEGER);
DROP SCHEMA test;
connection node_3;
SET SESSION wsrep_on=OFF;
CREATE TABLE test.t1 (f1 INTEGER) engine=innodb;
connection node_1;
CREATE TABLE test.t1 (f1 INTEGER);
CREATE TABLE test.t1 (f1 INTEGER) engine=innodb;
SHOW STATUS LIKE 'wsrep_cluster_status';
Variable_name Value
wsrep_cluster_status Primary

View File

@ -1,20 +0,0 @@
connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_3;
connection node_1;
CREATE TABLE t1 (f1 INTEGER);
INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
connection node_2;
SELECT COUNT(*) = 10 FROM t1;
COUNT(*) = 10
1
Killing server ...
connection node_1;
INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
# restart
SELECT COUNT(*) = 20 FROM t1;
COUNT(*) = 20
1
DROP TABLE t1;

View File

@ -9,16 +9,16 @@ VARIABLE_VALUE = 3
connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
SELECT COUNT(*) AS EXPECT_1 FROM t1;
EXPECT_1
1
DROP TABLE t1;
connection node_1;
include/assert_grep.inc [Streaming the backup to joiner at \[::1\]]
include/assert_grep.inc [async IST sender starting to serve tcp://\[::1\]:]
include/assert_grep.inc [IST receiver addr using tcp://\[::1\]]
include/assert_grep.inc [Prepared IST receiver for 3-6, listening at: tcp://\[::1\]]
include/assert_grep.inc [, listening at: tcp://\[::1\]]

View File

@ -9,12 +9,12 @@ VARIABLE_VALUE = 3
connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
SELECT COUNT(*) AS EXPECT_1 FROM t1;
EXPECT_1
1
DROP TABLE t1;
connection node_1;
@ -22,4 +22,4 @@ include/assert_grep.inc [Streaming the backup to joiner at \[::1\]]
include/assert_grep.inc [async IST sender starting to serve tcp://\[::1\]:]
connection node_2;
include/assert_grep.inc [IST receiver addr using tcp://\[::1\]]
include/assert_grep.inc [Prepared IST receiver for 3-6, listening at: tcp://\[::1\]]
include/assert_grep.inc [, listening at: tcp://\[::1\]]

View File

@ -14,12 +14,12 @@ SET GLOBAL wsrep_sst_method = 'mysqldump';
Shutting down server ...
connection node_1;
Cleaning var directory ...
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
Starting server ...
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
SELECT COUNT(*) AS EXPECT_1 FROM t1;
EXPECT_1
1
DROP TABLE t1;
SELECT VARIABLE_VALUE LIKE '%[::1]%' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_incoming_addresses';

View File

@ -9,11 +9,11 @@ VARIABLE_VALUE = 3
connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
SELECT COUNT(*) AS EXPECT_1 FROM t1;
EXPECT_1
1
DROP TABLE t1;

View File

@ -9,11 +9,11 @@ VARIABLE_VALUE = 3
connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
SELECT COUNT(*) = 1 FROM t1;
COUNT(*) = 1
SELECT COUNT(*) AS EXPECT_1 FROM t1;
EXPECT_1
1
DROP TABLE t1;

View File

@ -4,7 +4,8 @@ connection node_1;
connection node_2;
connection node_3;
connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
include/assert_grep.inc [grastate.dat does not have 'safe_to_bootstrap: 0']
@ -62,6 +63,7 @@ CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg()");
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL
`f1` int(11) NOT NULL,
PRIMARY KEY (`f1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;

View File

@ -4,7 +4,7 @@ connection node_1;
connection node_2;
connection node_3;
connection node_1;
CREATE TABLE t1 (f1 INTEGER);
CREATE TABLE t1 (f1 INTEGER) ENGINE=INNODB;
INSERT INTO t1 VALUES (1);
connection node_2;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';

View File

@ -17,7 +17,6 @@ push @::global_suppressions,
qr(WSREP:.*down context.*),
qr(WSREP: Failed to send state UUID:),
qr(WSREP: last inactive check more than .* skipping check),
qr(WSREP: SQL statement was ineffective),
qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned.),
qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|,
qr(WSREP: Quorum: No node with complete state),
@ -31,14 +30,34 @@ push @::global_suppressions,
qr(WSREP: user message in state LEAVING),
qr(WSREP: .* sending install message failed: Transport endpoint is not connected),
qr(WSREP: .* sending install message failed: Resource temporarily unavailable),
qr(WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\). Will retry in new primary component.),
qr(WSREP: Maximum writeset size exceeded by .*),
qr(WSREP: transaction size exceeded.*),
qr(WSREP: RBR event .*),
qr(WSREP: Ignoring error for TO isolated action: .*),
qr(WSREP: transaction size limit .*),
qr(WSREP: rbr write fail, .*),
qr(WSREP: .*Backend not supported: foo.*),
qr(WSREP: .*Failed to initialize backend using .*),
qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*),
qr(WSREP: gcs connect failed: Socket type not supported),
qr(WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 .*),
qr(WSREP: .*Failed to open backend connection: -110 .*),
qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*),
qr(WSREP: gcs connect failed: Connection timed out),
qr|WSREP: wsrep::connect\(.*\) failed: 7|,
qr(WSREP: SYNC message from member .* in non-primary configuration. Ignored.),
qr(WSREP: Could not find peer:),
qr(WSREP: TO isolation failed for: .*),
qr|WSREP: gcs_caused\(\) returned .*|,
qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored.|,
qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored.|,
qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled. Expect abort.|,
qr(WSREP: Action message in non-primary configuration from member [0-9]*),
qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*),
qr(WSREP: discarding established .*),
qr|WSREP: .*core_handle_uuid_msg.*|,
qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0. WSREP_SYNC_WAIT_BEFORE_READ is on),
qr(WSREP: JOIN message from member .* in non-primary configuration. Ignored.),
qr|WSREP: JOIN message from member .* in non-primary configuration. Ignored.|,
qr|Query apply failed:*|,
qr(WSREP: Ignoring error*),
qr(WSREP: Failed to remove page file .*),

View File

@ -10,6 +10,7 @@ wsrep_node_address=[::1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]'
wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port'
wsrep_node_incoming_address='[::1]:@mysqld.1.port'
bind-address=::
[mysqld.2]
wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port'
@ -17,6 +18,7 @@ wsrep_node_address=[::1]
wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]'
wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port'
wsrep_node_incoming_address='[::1]:@mysqld.2.port'
bind-address=::
[mysqld.3]
wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port'
@ -24,3 +26,4 @@ wsrep_node_address=[::1]
wsrep_provider_options='base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]'
wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port'
wsrep_node_incoming_address='[::1]:@mysqld.3.port'
bind-address=::

View File

@ -1 +0,0 @@
--bind-address=::

View File

@ -6,6 +6,7 @@
--source include/galera_cluster.inc
--source include/check_ipv6.inc
--source include/force_restart.inc
--let $galera_connection_name = node_3
--let $galera_server_number = 3
@ -27,7 +28,7 @@ SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
--connection node_2
@ -39,6 +40,6 @@ SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
SELECT COUNT(*) = 1 FROM t1;
SELECT COUNT(*) AS EXPECT_1 FROM t1;
DROP TABLE t1;

View File

@ -1,11 +1,5 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
#
# 1. Create different inconsistencies on nodes 2 and 3
#
--connection node_2
SET wsrep_on=OFF;
DROP SCHEMA test;
--source include/force_restart.inc
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_3
@ -16,15 +10,23 @@ DROP SCHEMA test;
--let $node_3=node_3
--source ../galera/include/auto_increment_offset_save.inc
#
# 1. Create different inconsistencies on nodes 2 and 3
#
--connection node_2
SET wsrep_on=OFF;
CREATE TABLE test.t1 (f1 INTEGER);
DROP SCHEMA test;
--connection node_3
SET SESSION wsrep_on=OFF;
CREATE TABLE test.t1 (f1 INTEGER) engine=innodb;
#
# 2. The following should generate different errors on nodes 2 and 3 and
# trigger voting with 3 different votes. node_1 should remain alone
# in the cluster.
#
--connection node_1
CREATE TABLE test.t1 (f1 INTEGER);
CREATE TABLE test.t1 (f1 INTEGER) engine=innodb;
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc

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