Merge branch '10.4' into 10.5

This commit is contained in:
Oleksandr Byelkin 2020-03-11 17:52:49 +01:00
commit fad47df995
132 changed files with 2878 additions and 2138 deletions

View File

@ -147,11 +147,10 @@ FUNCTION(DTRACE_INSTRUMENT target)
# Note: DTrace probes in static libraries are unusable currently
# (see explanation for DTRACE_INSTRUMENT_STATIC_LIBS below)
# but maybe one day this will be fixed.
GET_TARGET_PROPERTY(target_location ${target} LOCATION)
ADD_CUSTOM_COMMAND(
TARGET ${target} POST_BUILD
COMMAND ${CMAKE_AR} r ${target_location} ${outfile}
COMMAND ${CMAKE_RANLIB} ${target_location}
COMMAND ${CMAKE_AR} r $<TARGET_FILE:${target}> ${outfile}
COMMAND ${CMAKE_RANLIB} $<TARGET_FILE:${target}>
)
# Used in DTRACE_INSTRUMENT_WITH_STATIC_LIBS
SET(TARGET_OBJECT_DIRECTORY_${target} ${objdir} CACHE INTERNAL "")

View File

@ -174,7 +174,7 @@ SET(INSTALL_SCRIPTDIR_DEB "bin")
SET(INSTALL_SYSCONFDIR_DEB "/etc")
SET(INSTALL_SYSCONF2DIR_DEB "/etc/mysql/conf.d")
#
SET(INSTALL_LIBDIR_DEB "lib")
SET(INSTALL_LIBDIR_DEB "lib/${CMAKE_CXX_LIBRARY_ARCHITECTURE}")
SET(INSTALL_PLUGINDIR_DEB "lib/mysql/plugin")
#
SET(INSTALL_INCLUDEDIR_DEB "include/mariadb")
@ -186,7 +186,7 @@ SET(INSTALL_INFODIR_DEB "share/info")
#
SET(INSTALL_SHAREDIR_DEB "share")
SET(INSTALL_MYSQLSHAREDIR_DEB "share/mysql")
SET(INSTALL_MYSQLTESTDIR_DEB "mysql-test")
SET(INSTALL_MYSQLTESTDIR_DEB "share/mysql/mysql-test")
SET(INSTALL_SQLBENCHDIR_DEB ".")
SET(INSTALL_SUPPORTFILESDIR_DEB "share/mysql")
#
@ -196,11 +196,7 @@ SET(INSTALL_UNIX_ADDRDIR_DEB "/var/run/mysqld/mysqld.sock")
SET(INSTALL_SYSTEMD_UNITDIR_DEB "/lib/systemd/system")
SET(INSTALL_SYSTEMD_SYSUSERSDIR_DEB "/usr/lib/sysusers.d")
SET(INSTALL_SYSTEMD_TMPFILESDIR_DEB "/usr/lib/tmpfiles.d")
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
SET(INSTALL_PAMDIR_DEB "/lib/x86_64-linux-gnu/security")
ELSE()
SET(INSTALL_PAMDIR_DEB "/lib/i386-linux-gnu/security")
ENDIF()
SET(INSTALL_PAMDIR_DEB "/lib/${CMAKE_CXX_LIBRARY_ARCHITECTURE}/security")
#
# SVR4 layout

View File

@ -261,93 +261,6 @@ GET_FILENAME_COMPONENT(BINARY_PARENTDIR ${CMAKE_BINARY_DIR} PATH)
SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/debug" CACHE INTERNAL "Directory of debug build")
FUNCTION(INSTALL_DEBUG_TARGET target)
RETURN() # XXX unused?
CMAKE_PARSE_ARGUMENTS(ARG
""
"DESTINATION;RENAME;PDB_DESTINATION;COMPONENT"
""
${ARGN}
)
GET_TARGET_PROPERTY(target_type ${target} TYPE)
IF(ARG_RENAME)
SET(RENAME_PARAM RENAME ${ARG_RENAME}${CMAKE_${target_type}_SUFFIX})
ELSE()
SET(RENAME_PARAM)
ENDIF()
IF(NOT ARG_DESTINATION)
MESSAGE(FATAL_ERROR "Need DESTINATION parameter for INSTALL_DEBUG_TARGET")
ENDIF()
GET_TARGET_PROPERTY(target_location ${target} LOCATION)
IF(CMAKE_GENERATOR MATCHES "Makefiles|Ninja")
STRING(REPLACE "${CMAKE_BINARY_DIR}" "${DEBUGBUILDDIR}" debug_target_location "${target_location}")
ELSE()
STRING(REPLACE "${CMAKE_CFG_INTDIR}" "Debug" debug_target_location "${target_location}" )
ENDIF()
IF(NOT ARG_COMPONENT)
SET(ARG_COMPONENT DebugBinaries)
ENDIF()
# Define permissions
# For executable files
SET(PERMISSIONS_EXECUTABLE
PERMISSIONS
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE)
# Permissions for shared library (honors CMAKE_INSTALL_NO_EXE which is
# typically set on Debian)
IF(CMAKE_INSTALL_SO_NO_EXE)
SET(PERMISSIONS_SHARED_LIBRARY
PERMISSIONS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
ELSE()
SET(PERMISSIONS_SHARED_LIBRARY ${PERMISSIONS_EXECUTABLE})
ENDIF()
# Shared modules get the same permissions as shared libraries
SET(PERMISSIONS_MODULE_LIBRARY ${PERMISSIONS_SHARED_LIBRARY})
# Define permissions for static library
SET(PERMISSIONS_STATIC_LIBRARY
PERMISSIONS
OWNER_READ OWNER_WRITE
GROUP_READ
WORLD_READ)
INSTALL(FILES ${debug_target_location}
DESTINATION ${ARG_DESTINATION}
${RENAME_PARAM}
${PERMISSIONS_${target_type}}
CONFIGURATIONS Release RelWithDebInfo
COMPONENT ${ARG_COMPONENT}
OPTIONAL)
IF(MSVC)
GET_FILENAME_COMPONENT(ext ${debug_target_location} EXT)
STRING(REPLACE "${ext}" ".pdb" debug_pdb_target_location "${debug_target_location}" )
IF (RENAME_PARAM)
IF(NOT ARG_PDB_DESTINATION)
STRING(REPLACE "${ext}" ".pdb" "${ARG_RENAME}" pdb_rename)
SET(PDB_RENAME_PARAM RENAME "${pdb_rename}")
ENDIF()
ENDIF()
IF(NOT ARG_PDB_DESTINATION)
SET(ARG_PDB_DESTINATION "${ARG_DESTINATION}")
ENDIF()
INSTALL(FILES ${debug_pdb_target_location}
DESTINATION ${ARG_PDB_DESTINATION}
${PDB_RENAME_PARAM}
CONFIGURATIONS Release RelWithDebInfo
COMPONENT ${ARG_COMPONENT}
OPTIONAL)
ENDIF()
ENDFUNCTION()
FUNCTION(INSTALL_MYSQL_TEST from to)
IF(INSTALL_MYSQLTESTDIR)
INSTALL(

View File

@ -123,6 +123,7 @@ SET(HAVE_PTHREAD_ATTR_GETSTACKSIZE CACHE INTERNAL "")
SET(HAVE_PTHREAD_ATTR_SETSCOPE CACHE INTERNAL "")
SET(HAVE_PTHREAD_ATTR_SETSTACKSIZE CACHE INTERNAL "")
SET(HAVE_PTHREAD_CONDATTR_CREATE CACHE INTERNAL "")
SET(HAVE_PTHREAD_GETAFFINITY_NP CACHE INTERNAL "")
SET(HAVE_PTHREAD_INIT CACHE INTERNAL "")
SET(HAVE_PTHREAD_KEY_DELETE CACHE INTERNAL "")
SET(HAVE_PTHREAD_RWLOCK_RDLOCK CACHE INTERNAL "")

View File

@ -263,7 +263,6 @@ MACRO(MYSQL_ADD_PLUGIN)
SET(ARG_COMPONENT Server)
ENDIF()
MYSQL_INSTALL_TARGETS(${target} DESTINATION ${INSTALL_PLUGINDIR} COMPONENT ${ARG_COMPONENT})
#INSTALL_DEBUG_TARGET(${target} DESTINATION ${INSTALL_PLUGINDIR}/debug COMPONENT ${ARG_COMPONENT})
ENDIF()
GET_FILENAME_COMPONENT(subpath ${CMAKE_CURRENT_SOURCE_DIR} NAME)

View File

@ -140,6 +140,7 @@ MACRO (MYSQL_CHECK_SSL)
SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
SET(CMAKE_REQUIRED_LIBRARIES ${SSL_LIBRARIES})
SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
CHECK_SYMBOL_EXISTS(ERR_remove_thread_state "openssl/err.h"
HAVE_ERR_remove_thread_state)
CHECK_SYMBOL_EXISTS(EVP_aes_128_ctr "openssl/evp.h"

View File

@ -196,6 +196,7 @@
#cmakedefine HAVE_PTHREAD_ATTR_SETSCOPE 1
#cmakedefine HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
#cmakedefine HAVE_PTHREAD_CONDATTR_CREATE 1
#cmakedefine HAVE_PTHREAD_GETAFFINITY_NP 1
#cmakedefine HAVE_PTHREAD_KEY_DELETE 1
#cmakedefine HAVE_PTHREAD_KILL 1
#cmakedefine HAVE_PTHREAD_RWLOCK_RDLOCK 1

View File

@ -379,6 +379,7 @@ CHECK_FUNCTION_EXISTS (pthread_attr_setscope HAVE_PTHREAD_ATTR_SETSCOPE)
CHECK_FUNCTION_EXISTS (pthread_attr_getguardsize HAVE_PTHREAD_ATTR_GETGUARDSIZE)
CHECK_FUNCTION_EXISTS (pthread_attr_setstacksize HAVE_PTHREAD_ATTR_SETSTACKSIZE)
CHECK_FUNCTION_EXISTS (pthread_condattr_create HAVE_PTHREAD_CONDATTR_CREATE)
CHECK_FUNCTION_EXISTS (pthread_getaffinity_np HAVE_PTHREAD_GETAFFINITY_NP)
CHECK_FUNCTION_EXISTS (pthread_key_delete HAVE_PTHREAD_KEY_DELETE)
CHECK_FUNCTION_EXISTS (pthread_rwlock_rdlock HAVE_PTHREAD_RWLOCK_RDLOCK)
CHECK_FUNCTION_EXISTS (pthread_sigmask HAVE_PTHREAD_SIGMASK)

View File

@ -77,7 +77,6 @@ fi
if ! apt-cache madison libzstd-dev | grep 'libzstd-dev' >/dev/null 2>&1
then
sed '/libzstd-dev/d' -i debian/control
sed '/libzstd1/d' -i debian/control
fi
# If rocksdb-tools is not available (before Debian Buster and Ubuntu Disco)

1
debian/control vendored
View File

@ -7,6 +7,7 @@ Build-Depends: bison,
cmake (>= 2.7),
debhelper (>= 9),
dh-apparmor,
dh-exec,
dh-systemd,
gdb,
libaio-dev [linux-any],

View File

@ -1,3 +1,4 @@
#!/usr/bin/dh-exec
usr/bin/mariadb_config usr/bin/mysql_config
usr/include/mariadb usr/include/mysql
usr/share/pkgconfig/mariadb.pc usr/share/pkgconfig/mysqlclient.pc
usr/lib/${DEB_HOST_MULTIARCH}/pkgconfig/mariadb.pc usr/lib/${DEB_HOST_MULTIARCH}/pkgconfig/mysqlclient.pc

View File

@ -4,6 +4,6 @@ usr/lib/*/libmariadb.so
usr/lib/*/libmariadbclient.a
usr/lib/*/libmariadbclient.so
usr/lib/*/libmysqlservices.a
usr/lib/*/pkgconfig/mariadb.pc
usr/share/aclocal/mysql.m4
usr/share/man/man1/mysql_config.1
usr/share/pkgconfig/mariadb.pc

View File

@ -3,4 +3,3 @@ usr/lib/mysql/plugin/client_ed25519.so
usr/lib/mysql/plugin/dialog.so
usr/lib/mysql/plugin/mysql_clear_password.so
usr/lib/mysql/plugin/sha256_password.so
usr/lib/mysql/plugin/client_ed25519.so

View File

@ -5,8 +5,8 @@ debian/additions/mysql.init usr/share/mysql
debian/additions/mysqld_safe_syslog.cnf etc/mysql/conf.d
etc/apparmor.d/usr.sbin.mysqld
etc/security/user_map.conf
lib/systemd/system/mariadb@bootstrap.service.d/use_galera_new_cluster.conf
lib/*/security/pam_user_map.so
lib/systemd/system/mariadb@bootstrap.service.d/use_galera_new_cluster.conf
usr/bin/aria_chk
usr/bin/aria_dump_log
usr/bin/aria_ftdump

3
debian/rules vendored
View File

@ -86,9 +86,6 @@ endif
-DSYSTEM_TYPE="debian-$(DEB_HOST_GNU_SYSTEM)" \
-DCMAKE_SYSTEM_PROCESSOR=$(DEB_HOST_ARCH) \
-DBUILD_CONFIG=mysql_release \
-DINSTALL_LIBDIR=lib/$(DEB_HOST_MULTIARCH) \
-DINSTALL_PLUGINDIR=lib/mysql/plugin \
-DINSTALL_MYSQLTESTDIR=share/mysql/mysql-test \
-DPLUGIN_AWS_KEY_MANAGEMENT=NO \
-DDEB=$(DEB_VENDOR) ..'

View File

@ -3092,13 +3092,13 @@ xb_load_single_table_tablespace(
}
}
ut_free(name);
delete file;
if (err != DB_SUCCESS && xtrabackup_backup && !is_empty_file) {
die("Failed to not validate first page of the file %s, error %d",name, (int)err);
}
ut_free(name);
}
/** Scan the database directories under the MySQL datadir, looking for

View File

@ -1084,13 +1084,6 @@ extern void thd_increment_net_big_packet_count(void *thd, size_t length);
#ifdef _WIN32
/* implemented in my_windac.c */
int my_security_attr_create(SECURITY_ATTRIBUTES **psa, const char **perror,
DWORD owner_rights, DWORD everybody_rights);
void my_security_attr_free(SECURITY_ATTRIBUTES *sa);
/* implemented in my_conio.c */
char* my_cgets(char *string, size_t clen, size_t* plen);

View File

@ -36,11 +36,103 @@ insert into t3 select
123456
from t1 A, t1 B;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='mrr=on';
--replace_column 9 #
explain
select * from t3 force index (key_col) where key_col < 3;
select * from t3 force index (key_col) where key_col < 3;
set optimizer_switch=@save_optimizer_switch;
drop table t1,t3;
--echo #
--echo # MDEV-21544: partitioned table is joined with BKA+MRR
--echo #
set @save_join_cache_level=@@join_cache_level;
set @save_optimizer_switch=@@optimizer_switch;
create table t0 (
tp int, a int, b int not null, c varchar(12), index idx (a,b)
);
insert into t0 values
(1,3,30,'yyzy'), (1,3,30,'yxxyy'), (1,3,30,'yyxy'), (1,3,30,'xxyy'),
(1,3,30,'yyxz'), (1,3,30,'yyzz'), (1,3,30,'xxyzy'), (1,3,30,'yyyy'),
(1,3,30,'yzzy'), (1,93,30,'zzzy'),
(2,3,40,'yxx'), (2,4,40,'xx'), (2,3,10,'zxz'),
(2,3,40,'yyx'), (2,4,40,'xxx'), (2,3,10,'zyyz'),
(2,3,40,'xzzzz'), (2,4,40,'yyyxx'), (2,3,10,'zyz'),
(2,3,40,'xxx'), (2,4,40,'xx'), (2,3,10,'zzz'),
(2,3,40,'yyxzx'), (2,4,40,'xyx'), (2,3,10,'xzz'),
(2,3,40,'xxxzz'), (2,4,40,'xxz'), (2,3,10,'zzzy'),
(2,3,40,'zzxxx'), (2,4,40,'zxx'), (2,3,10,'yzzz'),
(2,3,40,'xyyxx'), (2,4,40,'xzzzx'), (2,3,10,'zzxxz'),
(2,3,40,'yzxxx'), (2,4,40,'xxzy'), (2,3,10,'zzzyx'),
(2,93,40,'xzx'), (2,94,40,'xz'), (2,93,10,'zyyyz'),
(3,4,30,'yx'), (3,4,30,'yyxxx'), (3,4,30,'zzyy'), (3,4,30,'zxyy'),
(3,4,30,'xxyy'), (3,4,30,'yyzx'), (3,4,30,'zyyy'), (3,4,30,'yzy'),
(3,4,30,'zzzyy'), (3,94,30,'yyz');
create table t1 (
tp int, a int, b int not null, c varchar(12), index idx (a,b)
)
partition by list (tp)
( partition p1 values in (1),
partition p2 values in (2),
partition p3 values in (3));
insert into t1 select * from t0;
# tables t0 and t1 contain the same set of records.
create table t2 (a int, index idx(a));
insert into t2 values
(1), (2), (3), (4), (5);
insert into t2 select a+10 from t2;
insert into t2 select a+20 from t2;
analyze table t0,t1,t2;
set join_cache_level=6;
set optimizer_switch='mrr=on';
let $q1=
select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = t2.a-1;
eval explain extended $q1;
eval $q1;
let $q2=
select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = t2.a-1;
eval explain extended $q2;
eval $q2;
let $q1=
select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = 4;
eval explain extended $q1;
eval $q1;
let $q2=
select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = 4;
eval explain extended $q2;
eval $q2;
insert into t2 values
(3), (4), (5);
analyze table t2;
let $q1=
select * from t2 left join t0 on t2.a=t0.a where t2.a in (3,4) and t0.b is null;
eval explain extended $q1;
eval $q1;
let $q2=
select * from t2 left join t1 on t2.a=t1.a where t2.a in (3,4) and t1.b is null;
eval explain extended $q2;
eval $q2;
set join_cache_level=@save_join_cache_level;
set optimizer_switch=@save_optimizer_switch;
drop table t0,t1,t2;

View File

@ -48,7 +48,7 @@ SET GLOBAL read_only = @start_read_only;
alter user boo;
ERROR HY000: Operation ALTER USER failed for 'boo'
#--warning ER_CANNOT_USER
alter if exists user boo;
alter user if exists boo;
Warnings:
Error 1133 Can't find any matching row in the user table
Note 1396 Operation ALTER USER failed for 'boo'

View File

@ -50,7 +50,7 @@ SET GLOBAL read_only = @start_read_only;
--error ER_CANNOT_USER
alter user boo;
--echo #--warning ER_CANNOT_USER
alter if exists user boo;
alter user if exists boo;
--echo #

View File

@ -521,26 +521,8 @@ BACKUP STAGE END;
CREATE OR REPLACE TABLE t1 (pk INT PRIMARY KEY, f INT);
BACKUP STAGE START;
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
BACKUP STAGE END;
DROP TABLE t1;
CREATE TABLE t1 (a INT);
BACKUP STAGE START;
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
connect con1,localhost,root,,test;
BACKUP STAGE START;
connection default;
BACKUP STAGE END;
connection con1;
BACKUP STAGE END;
disconnect con1;
connection default;
DROP TABLE t1;
CREATE TABLE t1 (a INT);
BACKUP STAGE START;
FLUSH TABLES t1 WITH READ LOCK;
UNLOCK TABLES;
BACKUP STAGE BLOCK_COMMIT;
ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
FLUSH TABLE t1 WITH READ LOCK;
ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
BACKUP STAGE END;
DROP TABLE t1;

View File

@ -509,30 +509,9 @@ BACKUP STAGE END;
CREATE OR REPLACE TABLE t1 (pk INT PRIMARY KEY, f INT);
BACKUP STAGE START;
--error ER_BACKUP_LOCK_IS_ACTIVE
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
BACKUP STAGE END;
DROP TABLE t1;
CREATE TABLE t1 (a INT);
BACKUP STAGE START;
FLUSH TABLE t1 FOR EXPORT;
UNLOCK TABLES;
--connect (con1,localhost,root,,test)
--send BACKUP STAGE START
--connection default
BACKUP STAGE END;
--connection con1
reap;
BACKUP STAGE END;
--disconnect con1
--connection default
DROP TABLE t1;
CREATE TABLE t1 (a INT);
BACKUP STAGE START;
FLUSH TABLES t1 WITH READ LOCK;
UNLOCK TABLES;
BACKUP STAGE BLOCK_COMMIT;
--error ER_BACKUP_LOCK_IS_ACTIVE
FLUSH TABLE t1 WITH READ LOCK;
BACKUP STAGE END;
DROP TABLE t1;

View File

@ -14,8 +14,6 @@ events_time_zone : Test is not predictable as it depends on precise timi
read_many_rows_innodb : Bug#11748886 2010-11-15 mattiasj report already exists
mysql_embedded : Bug#12561297 2011-05-14 Anitha Dependent on PB2 changes - eventum#41836
#show_explain : Psergey: random timeout in range-checked-for-each record query.
innodb-wl5522-debug-zip : broken upstream
innodb_bug12902967 : broken upstream
file_contents : MDEV-6526 these files are not installed anymore
max_statement_time : cannot possibly work, depends on timing
partition_open_files_limit : open_files_limit check broken by MDEV-18360

View File

@ -145,8 +145,8 @@ teststring
teststring
select * from t1 where text1='teststring' or text1 >= 'teststring\t';
text1
teststring
teststring
teststring
select * from t1 order by text1;
text1
nothing

View File

@ -113,3 +113,32 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E
test e1 root@localhost SYSTEM RECURRING # 1 SECOND # # DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
DROP EVENT e1;
# end test for bug#11748899
#
# Test for MDEV-21758 Events switched randomly to SLAVESIDE_DISABLED
#
create event ev on schedule every 1 minute do set @a= 1;
select name, originator, status from mysql.event;
name originator status
ev 1 ENABLED
#
# Restarting server with server_id=100
#
# restart: --server-id=100
select @@global.server_id;
@@global.server_id
100
select name, originator, status from mysql.event;
name originator status
ev 1 ENABLED
set global server_id= 1;
#
# Restarting server with the original server_id=1
#
# restart
select @@global.server_id;
@@global.server_id
1
select name, originator, status from mysql.event;
name originator status
ev 1 ENABLED
drop event ev;

View File

@ -141,3 +141,34 @@ SHOW EVENTS;
DROP EVENT e1;
--echo # end test for bug#11748899
--echo #
--echo # Test for MDEV-21758 Events switched randomly to SLAVESIDE_DISABLED
--echo #
create event ev on schedule every 1 minute do set @a= 1;
select name, originator, status from mysql.event;
--let $server_id= `SELECT @@global.server_id`
--echo #
--echo # Restarting server with server_id=100
--echo #
--let $restart_parameters= --server-id=100
--source include/restart_mysqld.inc
select @@global.server_id;
select name, originator, status from mysql.event;
--eval set global server_id= $server_id
--echo #
--echo # Restarting server with the original server_id=$server_id
--echo #
--let $restart_parameters=
--source include/restart_mysqld.inc
select @@global.server_id;
select name, originator, status from mysql.event;
# Cleanup
drop event ev;

View File

@ -5159,6 +5159,21 @@ DROP TABLE t1, t2;
# Start of 10.4 tests
#
#
# MDEV-21841 CONV() function truncates the result type to 21 symbol.
#
CREATE TABLE t1(i BIGINT);
INSERT INTO t1 VALUES (-1);
CREATE TABLE t2 AS SELECT conv(i,16,2) from t1;
SELECT * FROM t2;
conv(i,16,2)
1111111111111111111111111111111111111111111111111111111111111111
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`conv(i,16,2)` varchar(64) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2;
#
# MDEV-18205 Assertion `str_length < len' failed in Binary_string::realloc_raw
#
SELECT GROUP_CONCAT( UpdateXML( '<a>new year</a>', '/a', '2019-01-01 00:00:00' ), ENCODE('text','pass') ) AS f;

View File

@ -2099,6 +2099,17 @@ DROP TABLE t1, t2;
--echo # Start of 10.4 tests
--echo #
--echo #
--echo # MDEV-21841 CONV() function truncates the result type to 21 symbol.
--echo #
CREATE TABLE t1(i BIGINT);
INSERT INTO t1 VALUES (-1);
CREATE TABLE t2 AS SELECT conv(i,16,2) from t1;
SELECT * FROM t2;
SHOW CREATE TABLE t2;
DROP TABLE t1,t2;
--echo #
--echo # MDEV-18205 Assertion `str_length < len' failed in Binary_string::realloc_raw
--echo #

View File

@ -608,7 +608,7 @@ Create temporary tables Databases To use CREATE TEMPORARY TABLE
Create view Tables To create new views
Create user Server Admin To create new users
Delete Tables To delete existing rows
Delete versioning rows Tables To delete versioning table historical rows
Delete history Tables To delete versioning table historical rows
Drop Databases,Tables To drop databases, tables, and views
Event Server Admin To create, alter, drop and execute events
Execute Functions,Procedures To execute stored routines

View File

@ -31,7 +31,7 @@ alter user user1@localhost account unlock;
#
alter user inexistentUser@localhost account lock;
ERROR HY000: Operation ALTER USER failed for 'inexistentUser'@'localhost'
alter if exists user inexistentUser@localhost account lock;
alter user if exists inexistentUser@localhost account lock;
Warnings:
Error 1133 Can't find any matching row in the user table
Note 1396 Operation ALTER USER failed for 'inexistentUser'@'localhost'

View File

@ -44,7 +44,7 @@ alter user user1@localhost account unlock;
--error ER_CANNOT_USER
alter user inexistentUser@localhost account lock;
alter if exists user inexistentUser@localhost account lock;
alter user if exists inexistentUser@localhost account lock;
--echo #
--echo # Passing an existing user to CREATE should not be allowed

View File

@ -27,6 +27,8 @@ SELECT 2;
--connection default
SELECT 0;
let $count_sessions=11;
--source include/wait_until_count_sessions.inc
show status like "Threads_connected";
SET GLOBAL log_warnings=@save_log_warnings;

View File

@ -2,8 +2,6 @@
-- source include/not_embedded.inc
# need to have the dynamic loading turned on for the client plugin tests
--source include/have_plugin_auth.inc
# This test is slow on buildbot.
--source include/big_test.inc
# Run test with default character set
--source include/default_charset.inc

View File

@ -10,3 +10,13 @@ Could not open required defaults file: MYSQL_TEST_DIR/with.ext
Fatal error in defaults handling. Program aborted
Could not open required defaults file: MYSQL_TEST_DIR/no_extension
Fatal error in defaults handling. Program aborted
#
# MDEV-21374: When "--help --verbose" prints out configuration file paths,
# the --defaults-file option is not considered
#
# Test on `defaults-file`
Default options are read from the following files in the given order:
MYSQLTEST_VARDIR/my.cnf
# Test on `defaults-extra-file`
Default options are read from the following files in the given order:
<first-defaults> MYSQLTEST_VARDIR/my_test.cnf ~/.my.cnf

View File

@ -31,3 +31,19 @@ exec $MYSQLD --defaults-file=with.ext --print-defaults 2>&1;
--error 1
exec $MYSQLD --defaults-file=no_extension --print-defaults 2>&1;
--echo #
--echo # MDEV-21374: When "--help --verbose" prints out configuration file paths,
--echo # the --defaults-file option is not considered
--echo #
--echo # Test on `defaults-file`
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
exec $MYSQLD --defaults-file=$MYSQLTEST_VARDIR/my.cnf --help --verbose | grep -A 1 'Default options are read';
--echo # Test on `defaults-extra-file`
# <first-defaults> = `/etc/my.cnf /etc/mysql/my.cnf`
# Using sysconfdir configuration, we don't always have `/etc/mysql/my.cnf`, so replace them with a regex as well.
copy_file $MYSQLTEST_VARDIR/my.cnf $MYSQLTEST_VARDIR/my_test.cnf;
--replace_regex /.*my_test.cnf/<first-defaults> MYSQLTEST_VARDIR\/my_test.cnf/
exec $MYSQLD --defaults-extra-file=$MYSQLTEST_VARDIR/my_test.cnf --help --verbose | grep -A 1 'Default options are read';
remove_file $MYSQLTEST_VARDIR/my_test.cnf;

View File

@ -1807,6 +1807,42 @@ Field Type Null Key Default Extra
a int(11) YES NULL
drop table t1;
SET STATEMENT max_statement_time=0 FOR do 1;
set @save_sql_mode=@@SQL_MODE;
set SQL_MODE=ORACLE;
create table t1 (a int);
SET STATEMENT max_statement_time=0 FOR desc t1;
Field Type Null Key Default Extra
a int(11) YES NULL
drop table t1;
SET STATEMENT max_statement_time=0 FOR do 1;
set SQL_MODE=@save_sql_mode;
#
# MDEV-21684: mysqld crash with signal 11 when renaming
# table+max_statement_time
#
SET STATEMENT max_statement_time=180 FOR RENAME TABLE bleh TO blah;
ERROR 42S02: Table 'test.bleh' doesn't exist
SET STATEMENT max_statement_time=180 FOR load index into cache t1_base;
Table Op Msg_type Msg_text
test.t1_base preload_keys Error Table 'test.t1_base' doesn't exist
test.t1_base preload_keys status Operation failed
SET STATEMENT max_statement_time=180 FOR DROP INDEX i1 ON t1;
ERROR 42S02: Table 'test.t1' doesn't exist
SET STATEMENT max_statement_time=180 FOR BACKUP LOCK test.t1;
SET STATEMENT max_statement_time=180 FOR BACKUP UNLOCK;
set @save_sql_mode=@@SQL_MODE;
set SQL_MODE=ORACLE;
SET STATEMENT max_statement_time=180 FOR RENAME TABLE bleh TO blah;
ERROR 42S02: Table 'test.bleh' doesn't exist
SET STATEMENT max_statement_time=180 FOR load index into cache t1_base;
Table Op Msg_type Msg_text
test.t1_base preload_keys Error Table 'test.t1_base' doesn't exist
test.t1_base preload_keys status Operation failed
SET STATEMENT max_statement_time=180 FOR DROP INDEX i1 ON t1;
ERROR 42S02: Table 'test.t1' doesn't exist
SET STATEMENT max_statement_time=180 FOR BACKUP LOCK test.t1;
SET STATEMENT max_statement_time=180 FOR BACKUP UNLOCK;
set SQL_MODE=@save_sql_mode;
# End of 10.4 tests
#
# Start of 10.5 tests

View File

@ -1575,6 +1575,39 @@ SET STATEMENT max_statement_time=0 FOR desc t1;
drop table t1;
SET STATEMENT max_statement_time=0 FOR do 1;
set @save_sql_mode=@@SQL_MODE;
set SQL_MODE=ORACLE;
create table t1 (a int);
SET STATEMENT max_statement_time=0 FOR desc t1;
drop table t1;
SET STATEMENT max_statement_time=0 FOR do 1;
set SQL_MODE=@save_sql_mode;
--echo #
--echo # MDEV-21684: mysqld crash with signal 11 when renaming
--echo # table+max_statement_time
--echo #
--error ER_NO_SUCH_TABLE
SET STATEMENT max_statement_time=180 FOR RENAME TABLE bleh TO blah;
SET STATEMENT max_statement_time=180 FOR load index into cache t1_base;
--error ER_NO_SUCH_TABLE
SET STATEMENT max_statement_time=180 FOR DROP INDEX i1 ON t1;
SET STATEMENT max_statement_time=180 FOR BACKUP LOCK test.t1;
SET STATEMENT max_statement_time=180 FOR BACKUP UNLOCK;
set @save_sql_mode=@@SQL_MODE;
set SQL_MODE=ORACLE;
--error ER_NO_SUCH_TABLE
SET STATEMENT max_statement_time=180 FOR RENAME TABLE bleh TO blah;
SET STATEMENT max_statement_time=180 FOR load index into cache t1_base;
--error ER_NO_SUCH_TABLE
SET STATEMENT max_statement_time=180 FOR DROP INDEX i1 ON t1;
SET STATEMENT max_statement_time=180 FOR BACKUP LOCK test.t1;
SET STATEMENT max_statement_time=180 FOR BACKUP UNLOCK;
set SQL_MODE=@save_sql_mode;
--echo # End of 10.4 tests

View File

@ -395,33 +395,33 @@ DROP TABLE t1;
create table t1 (a int) engine=innodb partition by hash(a) ;
show table status like 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
t1 InnoDB 10 Dynamic 2 8192 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned 0 N
t1 InnoDB 10 Dynamic 2 8192 16384 0 0 0 NULL # NULL NULL latin1_swedish_ci NULL partitioned 0 N
drop table t1;
create table t1 (a int)
engine = innodb
partition by key (a);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
t1 InnoDB 10 Dynamic 2 8192 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned 0 N
t1 InnoDB 10 Dynamic 2 8192 16384 0 0 0 NULL Create_time NULL NULL latin1_swedish_ci NULL partitioned 0 N
insert into t1 values (0), (1), (2), (3);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
t1 InnoDB 10 Dynamic 4 4096 16384 0 0 # NULL # NULL NULL latin1_swedish_ci NULL partitioned 0 N
t1 InnoDB 10 Dynamic 4 4096 16384 0 0 0 NULL Create_time Update_time NULL latin1_swedish_ci NULL partitioned 0 N
drop table t1;
create table t1 (a int auto_increment primary key)
engine = innodb
partition by key (a);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
t1 InnoDB 10 Dynamic 2 8192 16384 0 0 # 1 # NULL NULL latin1_swedish_ci NULL partitioned 0 N
t1 InnoDB 10 Dynamic 2 8192 16384 0 0 0 1 Create_time NULL NULL latin1_swedish_ci NULL partitioned 0 N
insert into t1 values (NULL), (NULL), (NULL), (NULL);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
t1 InnoDB 10 Dynamic 4 4096 16384 0 0 # 5 # NULL NULL latin1_swedish_ci NULL partitioned 0 N
t1 InnoDB 10 Dynamic 4 4096 16384 0 0 0 5 Create_time Update_time NULL latin1_swedish_ci NULL partitioned 0 N
insert into t1 values (NULL), (NULL), (NULL), (NULL);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment Max_index_length Temporary
t1 InnoDB 10 Dynamic 8 2048 16384 0 0 # 9 # NULL NULL latin1_swedish_ci NULL partitioned 0 N
t1 InnoDB 10 Dynamic 8 2048 16384 0 0 0 9 Create_time Update_time NULL latin1_swedish_ci NULL partitioned 0 N
drop table t1;
create table t1 (a int)
partition by key (a)

View File

@ -411,9 +411,7 @@ DROP TABLE t1;
# Bug #14673: Wrong InnoDB default row format
#
create table t1 (a int) engine=innodb partition by hash(a) ;
# Data_free for InnoDB tablespace varies depending on which
# tests have been run before this one
--replace_column 10 # 12 #
--replace_column 12 #
show table status like 't1';
drop table t1;
@ -423,33 +421,23 @@ drop table t1;
create table t1 (a int)
engine = innodb
partition by key (a);
# Data_free for InnoDB tablespace varies depending on which
# tests have been run before this one
--replace_column 10 # 12 #
--replace_column 12 Create_time
show table status;
insert into t1 values (0), (1), (2), (3);
# Data_free for InnoDB tablespace varies depending on which
# tests have been run before this one
--replace_column 10 # 12 #
--replace_column 12 Create_time 13 Update_time
show table status;
drop table t1;
create table t1 (a int auto_increment primary key)
engine = innodb
partition by key (a);
# Data_free for InnoDB tablespace varies depending on which
# tests have been run before this one
--replace_column 10 # 12 #
--replace_column 12 Create_time
show table status;
insert into t1 values (NULL), (NULL), (NULL), (NULL);
# Data_free for InnoDB tablespace varies depending on which
# tests have been run before this one
--replace_column 10 # 12 #
--replace_column 12 Create_time 13 Update_time
show table status;
insert into t1 values (NULL), (NULL), (NULL), (NULL);
# Data_free for InnoDB tablespace varies depending on which
# tests have been run before this one
--replace_column 10 # 12 #
--replace_column 12 Create_time 13 Update_time
show table status;
drop table t1;

View File

@ -39,6 +39,7 @@ A.a,
B.a,
123456
from t1 A, t1 B;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='mrr=on';
explain
select * from t3 force index (key_col) where key_col < 3;
@ -76,4 +77,164 @@ ID part_id key_col col2
27 7 2 123456
28 8 2 123456
29 9 2 123456
set optimizer_switch=@save_optimizer_switch;
drop table t1,t3;
#
# MDEV-21544: partitioned table is joined with BKA+MRR
#
set @save_join_cache_level=@@join_cache_level;
set @save_optimizer_switch=@@optimizer_switch;
create table t0 (
tp int, a int, b int not null, c varchar(12), index idx (a,b)
);
insert into t0 values
(1,3,30,'yyzy'), (1,3,30,'yxxyy'), (1,3,30,'yyxy'), (1,3,30,'xxyy'),
(1,3,30,'yyxz'), (1,3,30,'yyzz'), (1,3,30,'xxyzy'), (1,3,30,'yyyy'),
(1,3,30,'yzzy'), (1,93,30,'zzzy'),
(2,3,40,'yxx'), (2,4,40,'xx'), (2,3,10,'zxz'),
(2,3,40,'yyx'), (2,4,40,'xxx'), (2,3,10,'zyyz'),
(2,3,40,'xzzzz'), (2,4,40,'yyyxx'), (2,3,10,'zyz'),
(2,3,40,'xxx'), (2,4,40,'xx'), (2,3,10,'zzz'),
(2,3,40,'yyxzx'), (2,4,40,'xyx'), (2,3,10,'xzz'),
(2,3,40,'xxxzz'), (2,4,40,'xxz'), (2,3,10,'zzzy'),
(2,3,40,'zzxxx'), (2,4,40,'zxx'), (2,3,10,'yzzz'),
(2,3,40,'xyyxx'), (2,4,40,'xzzzx'), (2,3,10,'zzxxz'),
(2,3,40,'yzxxx'), (2,4,40,'xxzy'), (2,3,10,'zzzyx'),
(2,93,40,'xzx'), (2,94,40,'xz'), (2,93,10,'zyyyz'),
(3,4,30,'yx'), (3,4,30,'yyxxx'), (3,4,30,'zzyy'), (3,4,30,'zxyy'),
(3,4,30,'xxyy'), (3,4,30,'yyzx'), (3,4,30,'zyyy'), (3,4,30,'yzy'),
(3,4,30,'zzzyy'), (3,94,30,'yyz');
create table t1 (
tp int, a int, b int not null, c varchar(12), index idx (a,b)
)
partition by list (tp)
( partition p1 values in (1),
partition p2 values in (2),
partition p3 values in (3));
insert into t1 select * from t0;
create table t2 (a int, index idx(a));
insert into t2 values
(1), (2), (3), (4), (5);
insert into t2 select a+10 from t2;
insert into t2 select a+20 from t2;
analyze table t0,t1,t2;
Table Op Msg_type Msg_text
test.t0 analyze status Engine-independent statistics collected
test.t0 analyze status OK
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 join_cache_level=6;
set optimizer_switch='mrr=on';
explain extended select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = t2.a-1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index
1 SIMPLE t0 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t0`.`tp` AS `tp`,`test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t0` join `test`.`t2` where `test`.`t0`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t0`.`b` / 10 = `test`.`t2`.`a` - 1
select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = t2.a-1;
tp a b c a
3 4 30 yx 4
3 4 30 yyxxx 4
3 4 30 zzyy 4
3 4 30 zxyy 4
3 4 30 xxyy 4
3 4 30 yyzx 4
3 4 30 zyyy 4
3 4 30 yzy 4
3 4 30 zzzyy 4
explain extended select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = t2.a-1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index
1 SIMPLE t1 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t1`.`tp` AS `tp`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t1`.`b` / 10 = `test`.`t2`.`a` - 1
select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = t2.a-1;
tp a b c a
3 4 30 yx 4
3 4 30 yyxxx 4
3 4 30 zzyy 4
3 4 30 zxyy 4
3 4 30 xxyy 4
3 4 30 yyzx 4
3 4 30 zyyy 4
3 4 30 yzy 4
3 4 30 zzzyy 4
explain extended select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = 4;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index
1 SIMPLE t0 ref idx idx 5 test.t2.a 12 100.00 Using index condition; Using join buffer (flat, BKA join); Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t0`.`tp` AS `tp`,`test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t0` join `test`.`t2` where `test`.`t0`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t0`.`b` / 10 = 4
select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = 4;
tp a b c a
2 3 40 yxx 3
2 4 40 xx 4
2 3 40 yyx 3
2 4 40 xxx 4
2 3 40 xzzzz 3
2 4 40 yyyxx 4
2 3 40 xxx 3
2 4 40 xx 4
2 3 40 yyxzx 3
2 4 40 xyx 4
2 3 40 xxxzz 3
2 4 40 xxz 4
2 3 40 zzxxx 3
2 4 40 zxx 4
2 3 40 xyyxx 3
2 4 40 xzzzx 4
2 3 40 yzxxx 3
2 4 40 xxzy 4
explain extended select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = 4;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index
1 SIMPLE t1 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t1`.`tp` AS `tp`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t1`.`b` / 10 = 4
select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = 4;
tp a b c a
2 3 40 yxx 3
2 4 40 xx 4
2 3 40 yyx 3
2 4 40 xxx 4
2 3 40 xzzzz 3
2 4 40 yyyxx 4
2 3 40 xxx 3
2 4 40 xx 4
2 3 40 yyxzx 3
2 4 40 xyx 4
2 3 40 xxxzz 3
2 4 40 xxz 4
2 3 40 zzxxx 3
2 4 40 zxx 4
2 3 40 xyyxx 3
2 4 40 xzzzx 4
2 3 40 yzxxx 3
2 4 40 xxzy 4
insert into t2 values
(3), (4), (5);
analyze table t2;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
explain extended select * from t2 left join t0 on t2.a=t0.a where t2.a in (3,4) and t0.b is null;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range idx idx 5 NULL 4 100.00 Using where; Using index
1 SIMPLE t0 ref idx idx 5 test.t2.a 12 100.00 Using where; Not exists; Using join buffer (flat, BKA join); Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t0`.`tp` AS `tp`,`test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c` from `test`.`t2` left join `test`.`t0` on(`test`.`t0`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` is not null) where `test`.`t2`.`a` in (3,4) and `test`.`t0`.`b` is null
select * from t2 left join t0 on t2.a=t0.a where t2.a in (3,4) and t0.b is null;
a tp a b c
explain extended select * from t2 left join t1 on t2.a=t1.a where t2.a in (3,4) and t1.b is null;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range idx idx 5 NULL 4 100.00 Using where; Using index
1 SIMPLE t1 ref idx idx 5 test.t2.a 12 100.00 Using where; Not exists; Using join buffer (flat, BKA join); Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t1`.`tp` AS `tp`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t2` left join `test`.`t1` on(`test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` is not null) where `test`.`t2`.`a` in (3,4) and `test`.`t1`.`b` is null
select * from t2 left join t1 on t2.a=t1.a where t2.a in (3,4) and t1.b is null;
a tp a b c
set join_cache_level=@save_join_cache_level;
set optimizer_switch=@save_optimizer_switch;
drop table t0,t1,t2;

View File

@ -39,6 +39,7 @@ A.a,
B.a,
123456
from t1 A, t1 B;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='mrr=on';
explain
select * from t3 force index (key_col) where key_col < 3;
@ -76,4 +77,164 @@ ID part_id key_col col2
27 7 2 123456
28 8 2 123456
29 9 2 123456
set optimizer_switch=@save_optimizer_switch;
drop table t1,t3;
#
# MDEV-21544: partitioned table is joined with BKA+MRR
#
set @save_join_cache_level=@@join_cache_level;
set @save_optimizer_switch=@@optimizer_switch;
create table t0 (
tp int, a int, b int not null, c varchar(12), index idx (a,b)
);
insert into t0 values
(1,3,30,'yyzy'), (1,3,30,'yxxyy'), (1,3,30,'yyxy'), (1,3,30,'xxyy'),
(1,3,30,'yyxz'), (1,3,30,'yyzz'), (1,3,30,'xxyzy'), (1,3,30,'yyyy'),
(1,3,30,'yzzy'), (1,93,30,'zzzy'),
(2,3,40,'yxx'), (2,4,40,'xx'), (2,3,10,'zxz'),
(2,3,40,'yyx'), (2,4,40,'xxx'), (2,3,10,'zyyz'),
(2,3,40,'xzzzz'), (2,4,40,'yyyxx'), (2,3,10,'zyz'),
(2,3,40,'xxx'), (2,4,40,'xx'), (2,3,10,'zzz'),
(2,3,40,'yyxzx'), (2,4,40,'xyx'), (2,3,10,'xzz'),
(2,3,40,'xxxzz'), (2,4,40,'xxz'), (2,3,10,'zzzy'),
(2,3,40,'zzxxx'), (2,4,40,'zxx'), (2,3,10,'yzzz'),
(2,3,40,'xyyxx'), (2,4,40,'xzzzx'), (2,3,10,'zzxxz'),
(2,3,40,'yzxxx'), (2,4,40,'xxzy'), (2,3,10,'zzzyx'),
(2,93,40,'xzx'), (2,94,40,'xz'), (2,93,10,'zyyyz'),
(3,4,30,'yx'), (3,4,30,'yyxxx'), (3,4,30,'zzyy'), (3,4,30,'zxyy'),
(3,4,30,'xxyy'), (3,4,30,'yyzx'), (3,4,30,'zyyy'), (3,4,30,'yzy'),
(3,4,30,'zzzyy'), (3,94,30,'yyz');
create table t1 (
tp int, a int, b int not null, c varchar(12), index idx (a,b)
)
partition by list (tp)
( partition p1 values in (1),
partition p2 values in (2),
partition p3 values in (3));
insert into t1 select * from t0;
create table t2 (a int, index idx(a));
insert into t2 values
(1), (2), (3), (4), (5);
insert into t2 select a+10 from t2;
insert into t2 select a+20 from t2;
analyze table t0,t1,t2;
Table Op Msg_type Msg_text
test.t0 analyze status Engine-independent statistics collected
test.t0 analyze status OK
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 join_cache_level=6;
set optimizer_switch='mrr=on';
explain extended select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = t2.a-1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index
1 SIMPLE t0 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t0`.`tp` AS `tp`,`test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t0` join `test`.`t2` where `test`.`t0`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t0`.`b` / 10 = `test`.`t2`.`a` - 1
select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = t2.a-1;
tp a b c a
3 4 30 yx 4
3 4 30 yyxxx 4
3 4 30 zzyy 4
3 4 30 zxyy 4
3 4 30 xxyy 4
3 4 30 yyzx 4
3 4 30 zyyy 4
3 4 30 yzy 4
3 4 30 zzzyy 4
explain extended select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = t2.a-1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index
1 SIMPLE t1 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t1`.`tp` AS `tp`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t1`.`b` / 10 = `test`.`t2`.`a` - 1
select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = t2.a-1;
tp a b c a
3 4 30 yx 4
3 4 30 yyxxx 4
3 4 30 zzyy 4
3 4 30 zxyy 4
3 4 30 xxyy 4
3 4 30 yyzx 4
3 4 30 zyyy 4
3 4 30 yzy 4
3 4 30 zzzyy 4
explain extended select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = 4;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index
1 SIMPLE t0 ref idx idx 5 test.t2.a 12 100.00 Using index condition; Using join buffer (flat, BKA join); Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t0`.`tp` AS `tp`,`test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t0` join `test`.`t2` where `test`.`t0`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t0`.`b` / 10 = 4
select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = 4;
tp a b c a
2 3 40 yxx 3
2 4 40 xx 4
2 3 40 yyx 3
2 4 40 xxx 4
2 3 40 xzzzz 3
2 4 40 yyyxx 4
2 3 40 xxx 3
2 4 40 xx 4
2 3 40 yyxzx 3
2 4 40 xyx 4
2 3 40 xxxzz 3
2 4 40 xxz 4
2 3 40 zzxxx 3
2 4 40 zxx 4
2 3 40 xyyxx 3
2 4 40 xzzzx 4
2 3 40 yzxxx 3
2 4 40 xxzy 4
explain extended select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = 4;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index
1 SIMPLE t1 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t1`.`tp` AS `tp`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t1`.`b` / 10 = 4
select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = 4;
tp a b c a
2 3 40 yxx 3
2 4 40 xx 4
2 3 40 yyx 3
2 4 40 xxx 4
2 3 40 xzzzz 3
2 4 40 yyyxx 4
2 3 40 xxx 3
2 4 40 xx 4
2 3 40 yyxzx 3
2 4 40 xyx 4
2 3 40 xxxzz 3
2 4 40 xxz 4
2 3 40 zzxxx 3
2 4 40 zxx 4
2 3 40 xyyxx 3
2 4 40 xzzzx 4
2 3 40 yzxxx 3
2 4 40 xxzy 4
insert into t2 values
(3), (4), (5);
analyze table t2;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
explain extended select * from t2 left join t0 on t2.a=t0.a where t2.a in (3,4) and t0.b is null;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range idx idx 5 NULL 4 100.00 Using where; Using index
1 SIMPLE t0 ref idx idx 5 test.t2.a 12 100.00 Using where; Not exists; Using join buffer (flat, BKA join); Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t0`.`tp` AS `tp`,`test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c` from `test`.`t2` left join `test`.`t0` on(`test`.`t0`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` is not null) where `test`.`t2`.`a` in (3,4) and `test`.`t0`.`b` is null
select * from t2 left join t0 on t2.a=t0.a where t2.a in (3,4) and t0.b is null;
a tp a b c
explain extended select * from t2 left join t1 on t2.a=t1.a where t2.a in (3,4) and t1.b is null;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range idx idx 5 NULL 4 100.00 Using where; Using index
1 SIMPLE t1 ref idx idx 5 test.t2.a 12 100.00 Using where; Not exists; Using join buffer (flat, BKA join); Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t1`.`tp` AS `tp`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t2` left join `test`.`t1` on(`test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` is not null) where `test`.`t2`.`a` in (3,4) and `test`.`t1`.`b` is null
select * from t2 left join t1 on t2.a=t1.a where t2.a in (3,4) and t1.b is null;
a tp a b c
set join_cache_level=@save_join_cache_level;
set optimizer_switch=@save_optimizer_switch;
drop table t0,t1,t2;

View File

@ -39,6 +39,7 @@ A.a,
B.a,
123456
from t1 A, t1 B;
set @save_optimizer_switch=@@optimizer_switch;
set optimizer_switch='mrr=on';
explain
select * from t3 force index (key_col) where key_col < 3;
@ -76,4 +77,223 @@ ID part_id key_col col2
27 7 2 123456
28 8 2 123456
29 9 2 123456
set optimizer_switch=@save_optimizer_switch;
drop table t1,t3;
#
# MDEV-21544: partitioned table is joined with BKA+MRR
#
set @save_join_cache_level=@@join_cache_level;
set @save_optimizer_switch=@@optimizer_switch;
create table t0 (
tp int, a int, b int not null, c varchar(12), index idx (a,b)
);
insert into t0 values
(1,3,30,'yyzy'), (1,3,30,'yxxyy'), (1,3,30,'yyxy'), (1,3,30,'xxyy'),
(1,3,30,'yyxz'), (1,3,30,'yyzz'), (1,3,30,'xxyzy'), (1,3,30,'yyyy'),
(1,3,30,'yzzy'), (1,93,30,'zzzy'),
(2,3,40,'yxx'), (2,4,40,'xx'), (2,3,10,'zxz'),
(2,3,40,'yyx'), (2,4,40,'xxx'), (2,3,10,'zyyz'),
(2,3,40,'xzzzz'), (2,4,40,'yyyxx'), (2,3,10,'zyz'),
(2,3,40,'xxx'), (2,4,40,'xx'), (2,3,10,'zzz'),
(2,3,40,'yyxzx'), (2,4,40,'xyx'), (2,3,10,'xzz'),
(2,3,40,'xxxzz'), (2,4,40,'xxz'), (2,3,10,'zzzy'),
(2,3,40,'zzxxx'), (2,4,40,'zxx'), (2,3,10,'yzzz'),
(2,3,40,'xyyxx'), (2,4,40,'xzzzx'), (2,3,10,'zzxxz'),
(2,3,40,'yzxxx'), (2,4,40,'xxzy'), (2,3,10,'zzzyx'),
(2,93,40,'xzx'), (2,94,40,'xz'), (2,93,10,'zyyyz'),
(3,4,30,'yx'), (3,4,30,'yyxxx'), (3,4,30,'zzyy'), (3,4,30,'zxyy'),
(3,4,30,'xxyy'), (3,4,30,'yyzx'), (3,4,30,'zyyy'), (3,4,30,'yzy'),
(3,4,30,'zzzyy'), (3,94,30,'yyz');
create table t1 (
tp int, a int, b int not null, c varchar(12), index idx (a,b)
)
partition by list (tp)
( partition p1 values in (1),
partition p2 values in (2),
partition p3 values in (3));
insert into t1 select * from t0;
create table t2 (a int, index idx(a));
insert into t2 values
(1), (2), (3), (4), (5);
insert into t2 select a+10 from t2;
insert into t2 select a+20 from t2;
analyze table t0,t1,t2;
Table Op Msg_type Msg_text
test.t0 analyze status Engine-independent statistics collected
test.t0 analyze status OK
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 join_cache_level=6;
set optimizer_switch='mrr=on';
explain extended select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = t2.a-1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index
1 SIMPLE t0 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t0`.`tp` AS `tp`,`test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t0` join `test`.`t2` where `test`.`t0`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t0`.`b` / 10 = `test`.`t2`.`a` - 1
select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = t2.a-1;
tp a b c a
3 4 30 yx 4
3 4 30 yyxxx 4
3 4 30 zzyy 4
3 4 30 zxyy 4
3 4 30 xxyy 4
3 4 30 yyzx 4
3 4 30 zyyy 4
3 4 30 yzy 4
3 4 30 zzzyy 4
explain extended select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = t2.a-1;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index
1 SIMPLE t1 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t1`.`tp` AS `tp`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t1`.`b` / 10 = `test`.`t2`.`a` - 1
select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = t2.a-1;
tp a b c a
3 4 30 yx 4
3 4 30 yyxxx 4
3 4 30 zzyy 4
3 4 30 zxyy 4
3 4 30 xxyy 4
3 4 30 yyzx 4
3 4 30 zyyy 4
3 4 30 yzy 4
3 4 30 zzzyy 4
explain extended select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = 4;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index
1 SIMPLE t0 ref idx idx 5 test.t2.a 12 100.00 Using index condition; Using join buffer (flat, BKA join); Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t0`.`tp` AS `tp`,`test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t0` join `test`.`t2` where `test`.`t0`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t0`.`b` / 10 = 4
select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = 4;
tp a b c a
2 3 40 yxx 3
2 4 40 xx 4
2 3 40 yyx 3
2 4 40 xxx 4
2 3 40 xzzzz 3
2 4 40 yyyxx 4
2 3 40 xxx 3
2 4 40 xx 4
2 3 40 yyxzx 3
2 4 40 xyx 4
2 3 40 xxxzz 3
2 4 40 xxz 4
2 3 40 zzxxx 3
2 4 40 zxx 4
2 3 40 xyyxx 3
2 4 40 xzzzx 4
2 3 40 yzxxx 3
2 4 40 xxzy 4
explain extended select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = 4;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range idx idx 5 NULL 2 100.00 Using where; Using index
1 SIMPLE t1 ref idx idx 5 test.t2.a 12 100.00 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t1`.`tp` AS `tp`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c`,`test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` in (3,4) and `test`.`t1`.`b` / 10 = 4
select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = 4;
tp a b c a
2 3 40 yxx 3
2 4 40 xx 4
2 3 40 yyx 3
2 4 40 xxx 4
2 3 40 xzzzz 3
2 4 40 yyyxx 4
2 3 40 xxx 3
2 4 40 xx 4
2 3 40 yyxzx 3
2 4 40 xyx 4
2 3 40 xxxzz 3
2 4 40 xxz 4
2 3 40 zzxxx 3
2 4 40 zxx 4
2 3 40 xyyxx 3
2 4 40 xzzzx 4
2 3 40 yzxxx 3
2 4 40 xxzy 4
insert into t2 values
(3), (4), (5);
analyze table t2;
Table Op Msg_type Msg_text
test.t2 analyze status Engine-independent statistics collected
test.t2 analyze status OK
explain extended select * from t2 left join t0 on t2.a=t0.a where t2.a in (3,4) and t0.b is null;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range idx idx 5 NULL 4 100.00 Using where; Using index
1 SIMPLE t0 ref idx idx 5 test.t2.a 12 100.00 Using where; Not exists; Using join buffer (flat, BKA join); Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t0`.`tp` AS `tp`,`test`.`t0`.`a` AS `a`,`test`.`t0`.`b` AS `b`,`test`.`t0`.`c` AS `c` from `test`.`t2` left join `test`.`t0` on(`test`.`t0`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` is not null) where `test`.`t2`.`a` in (3,4) and `test`.`t0`.`b` is null
select * from t2 left join t0 on t2.a=t0.a where t2.a in (3,4) and t0.b is null;
a tp a b c
explain extended select * from t2 left join t1 on t2.a=t1.a where t2.a in (3,4) and t1.b is null;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t2 range idx idx 5 NULL 4 100.00 Using where; Using index
1 SIMPLE t1 ref idx idx 5 test.t2.a 12 100.00 Using where; Not exists; Using join buffer (flat, BKA join); Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t1`.`tp` AS `tp`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t2` left join `test`.`t1` on(`test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t2`.`a` is not null) where `test`.`t2`.`a` in (3,4) and `test`.`t1`.`b` is null
select * from t2 left join t1 on t2.a=t1.a where t2.a in (3,4) and t1.b is null;
a tp a b c
set join_cache_level=@save_join_cache_level;
set optimizer_switch=@save_optimizer_switch;
drop table t0,t1,t2;
#
# MDEV-21628: Index condition pushdown for a simple condition over
# index fields is not used for ref access of partitioned tables when employing BKA
#
create table t0 (
tp int, a int, b int, c varchar(12), index idx (a,b)
);
insert into t0 values
(1,3,30,'yyzy'), (1,3,30,'yxxyy'), (1,3,30,'yyxy'), (1,3,30,'xxyy'),
(1,3,30,'yyxz'), (1,3,30,'yyzz'), (1,3,30,'xxyzy'), (1,3,30,'yyyy'),
(1,3,30,'yzzy'), (1,93,30,'zzzy'),
(2,3,40,'yxx'), (2,4,40,'xx'), (2,3,10,'zxz'),
(2,3,40,'yyx'), (2,4,40,'xxx'), (2,3,10,'zyyz'),
(2,3,40,'xzzzz'), (2,4,40,'yyyxx'), (2,3,10,'zyz'),
(2,3,40,'xxx'), (2,4,40,'xx'), (2,3,10,'zzz'),
(2,3,40,'yyxzx'), (2,4,40,'xyx'), (2,3,10,'xzz'),
(2,3,40,'xxxzz'), (2,4,40,'xxz'), (2,3,10,'zzzy'),
(2,3,40,'zzxxx'), (2,4,40,'zxx'), (2,3,10,'yzzz'),
(2,3,40,'xyyxx'), (2,4,40,'xzzzx'), (2,3,10,'zzxxz'),
(2,3,40,'yzxxx'), (2,4,40,'xxzy'), (2,3,10,'zzzyx'),
(2,93,40,'xzx'), (2,94,40,'xz'), (2,93,10,'zyyyz'),
(3,4,30,'yx'), (3,4,30,'yyxxx'), (3,4,30,'zzyy'), (3,4,30,'zxyy'),
(3,4,30,'xxyy'), (3,4,30,'yyzx'), (3,4,30,'zyyy'), (3,4,30,'yzy'),
(3,4,30,'zzzyy'), (3,94,30,'yyz');
create table t1 (
tp int, a int, b int, c varchar(12), index idx (a,b)
) engine=myisam
partition by list (tp)
( partition p1 values in (1),
partition p2 values in (2),
partition p3 values in (3));
insert into t1 select * from t0;
create table t2 (a int, index idx(a)) engine=myisam;
insert into t2 values (1), (2), (3), (4), (5);
insert into t2 select a+10 from t2;
insert into t2 select a+20 from t2;
analyze table t0,t1,t2;
Table Op Msg_type Msg_text
test.t0 analyze status Engine-independent statistics collected
test.t0 analyze status OK
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 @tmp1=@@join_cache_level, @tmp2=@@optimizer_switch;
set join_cache_level=6, optimizer_switch='mrr=on';
explain
select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = 4;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range idx idx 5 NULL 2 Using where; Using index
1 SIMPLE t0 ref idx idx 5 test.t2.a 12 Using index condition; Using join buffer (flat, BKA join); Rowid-ordered scan
# This will use "Using index condition(BKA)"
explain
select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = 4;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 range idx idx 5 NULL 2 Using where; Using index
1 SIMPLE t1 ref idx idx 5 test.t2.a 12 Using index condition(BKA); Using join buffer (flat, BKA join); Rowid-ordered scan
set join_cache_level=@tmp1, optimizer_switch=@tmp2;
drop table t0,t1,t2;

View File

@ -1,3 +1,62 @@
let $engine_type= myisam;
--source include/partition_mrr.inc
--echo #
--echo # MDEV-21628: Index condition pushdown for a simple condition over
--echo # index fields is not used for ref access of partitioned tables when employing BKA
--echo #
create table t0 (
tp int, a int, b int, c varchar(12), index idx (a,b)
);
insert into t0 values
(1,3,30,'yyzy'), (1,3,30,'yxxyy'), (1,3,30,'yyxy'), (1,3,30,'xxyy'),
(1,3,30,'yyxz'), (1,3,30,'yyzz'), (1,3,30,'xxyzy'), (1,3,30,'yyyy'),
(1,3,30,'yzzy'), (1,93,30,'zzzy'),
(2,3,40,'yxx'), (2,4,40,'xx'), (2,3,10,'zxz'),
(2,3,40,'yyx'), (2,4,40,'xxx'), (2,3,10,'zyyz'),
(2,3,40,'xzzzz'), (2,4,40,'yyyxx'), (2,3,10,'zyz'),
(2,3,40,'xxx'), (2,4,40,'xx'), (2,3,10,'zzz'),
(2,3,40,'yyxzx'), (2,4,40,'xyx'), (2,3,10,'xzz'),
(2,3,40,'xxxzz'), (2,4,40,'xxz'), (2,3,10,'zzzy'),
(2,3,40,'zzxxx'), (2,4,40,'zxx'), (2,3,10,'yzzz'),
(2,3,40,'xyyxx'), (2,4,40,'xzzzx'), (2,3,10,'zzxxz'),
(2,3,40,'yzxxx'), (2,4,40,'xxzy'), (2,3,10,'zzzyx'),
(2,93,40,'xzx'), (2,94,40,'xz'), (2,93,10,'zyyyz'),
(3,4,30,'yx'), (3,4,30,'yyxxx'), (3,4,30,'zzyy'), (3,4,30,'zxyy'),
(3,4,30,'xxyy'), (3,4,30,'yyzx'), (3,4,30,'zyyy'), (3,4,30,'yzy'),
(3,4,30,'zzzyy'), (3,94,30,'yyz');
create table t1 (
tp int, a int, b int, c varchar(12), index idx (a,b)
) engine=myisam
partition by list (tp)
( partition p1 values in (1),
partition p2 values in (2),
partition p3 values in (3));
insert into t1 select * from t0;
create table t2 (a int, index idx(a)) engine=myisam;
insert into t2 values (1), (2), (3), (4), (5);
insert into t2 select a+10 from t2;
insert into t2 select a+20 from t2;
analyze table t0,t1,t2;
set @tmp1=@@join_cache_level, @tmp2=@@optimizer_switch;
set join_cache_level=6, optimizer_switch='mrr=on';
explain
select * from t0,t2 where t2.a in (3,4) and t0.a=t2.a and (t0.b / 10) = 4;
--echo # This will use "Using index condition(BKA)"
explain
select * from t1,t2 where t2.a in (3,4) and t1.a=t2.a and (t1.b / 10) = 4;
set join_cache_level=@tmp1, optimizer_switch=@tmp2;
drop table t0,t1,t2;

View File

@ -2548,3 +2548,339 @@ id select_type table type possible_keys key key_len ref rows r_rows filtered r_f
1 SIMPLE t1 index a,b PRIMARY 4 NULL 3008 3008.00 1.36 0.00 Using where
DROP TABLE t1;
SET global innodb_stats_persistent= @stats.save;
#
# MDEV-21610: Using rowid filter with BKA+MRR
#
set @stats.save= @@innodb_stats_persistent;
set global innodb_stats_persistent=on;
CREATE TABLE acli (
id bigint(20) NOT NULL,
rid varchar(255) NOT NULL,
tp smallint(6) NOT NULL DEFAULT 0,
PRIMARY KEY (id),
KEY acli_rid (rid),
KEY acli_tp (tp)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
insert into acli(id,rid,tp) values
(184929059698905997,'ABABABABABABABABAB',103),
(184929059698905998,'ABABABABABABABABAB',121),
(283586039035985921,'00000000000000000000000000000000',103),
(2216474704108064678,'020BED6D07B741CE9B10AB2200FEF1DF',103),
(2216474704108064679,'020BED6D07B741CE9B10AB2200FEF1DF',121),
(3080602882609775593,'B5FCC8C7111E4E3CBC21AAF5012F59C2',103),
(3080602882609775594,'B5FCC8C7111E4E3CBC21AAF5012F59C2',121),
(3080602882609776594,'B5FCC8C7111E4E3CBC21AAF5012F59C2',121),
(3080602882609777595,'B5FCC8C7111E4E3CBC21AAF5012F59C2',121),
(4269412446747236214,'SCSCSCSCSCSCSCSC',103),
(4269412446747236215,'SCSCSCSCSCSCSCSC',121),
(6341490487802728356,'6072D47E513F4A4794BBAB2200FDB67D',103),
(6341490487802728357,'6072D47E513F4A4794BBAB2200FDB67D',121);
CREATE TABLE acei (
id bigint(20) NOT NULL,
aclid bigint(20) NOT NULL DEFAULT 0,
atp smallint(6) NOT NULL DEFAULT 0,
clus smallint(6) NOT NULL DEFAULT 0,
PRIMARY KEY (id),
KEY acei_aclid (aclid),
KEY acei_clus (clus)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
insert into acei(id,aclid,atp,clus) values
(184929059698905999,184929059698905997,0,1),
(184929059698906000,184929059698905997,0,1),
(184929059698906001,184929059698905997,1,1),
(184929059698906002,184929059698905998,1,1),
(283586039035985922,283586039035985921,1,1),
(2216474704108064684,2216474704108064678,0,1),
(2216474704108064685,2216474704108064678,0,1),
(2216474704108064686,2216474704108064678,1,1),
(2216474704108064687,2216474704108064679,1,1),
(3080602882609775595,3080602882609775593,0,1),
(3080602882609775596,3080602882609775593,0,1),
(3080602882609775597,3080602882609775593,1,1),
(3080602882609775598,3080602882609775594,1,1),
(3080602882609776595,3080602882609776594,1,1),
(3080602882609777596,3080602882609777595,1,1),
(4269412446747236216,4269412446747236214,0,1),
(4269412446747236217,4269412446747236214,0,1),
(4269412446747236218,4269412446747236214,1,1),
(4269412446747236219,4269412446747236215,1,1),
(6341490487802728358,6341490487802728356,0,1),
(6341490487802728359,6341490487802728356,0,1),
(6341490487802728360,6341490487802728356,1,1),
(6341490487802728361,6341490487802728357,1,1);
CREATE TABLE filt (
id bigint(20) NOT NULL,
aceid bigint(20) NOT NULL DEFAULT 0,
clid smallint(6) NOT NULL DEFAULT 0,
fh bigint(20) NOT NULL DEFAULT 0,
PRIMARY KEY (id),
KEY filt_aceid (aceid),
KEY filt_clid (clid),
KEY filt_fh (fh)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
insert into filt(id,aceid,clid,fh) values
(184929059698905999,184929059698905999,1,8948400944397203540),
(184929059698906000,184929059698906000,1,-3516039679025944536),
(184929059698906001,184929059698906001,1,-3516039679025944536),
(184929059698906002,184929059698906001,1,2965370193075218252),
(184929059698906003,184929059698906001,1,8948400944397203540),
(184929059698906004,184929059698906002,1,2478709353550777738),
(283586039035985922,283586039035985922,1,5902600816362013271),
(2216474704108064686,2216474704108064684,1,8948400944397203540),
(2216474704108064687,2216474704108064685,1,-7244708939311117030),
(2216474704108064688,2216474704108064686,1,-7244708939311117030),
(2216474704108064689,2216474704108064686,1,7489060986210282479),
(2216474704108064690,2216474704108064686,1,8948400944397203540),
(2216474704108064691,2216474704108064687,1,-3575268945274980038),
(3080602882609775595,3080602882609775595,1,8948400944397203540),
(3080602882609775596,3080602882609775596,1,-5420422472375069774),
(3080602882609775597,3080602882609775597,1,-5420422472375069774),
(3080602882609775598,3080602882609775597,1,8518228073041491534),
(3080602882609775599,3080602882609775597,1,8948400944397203540),
(3080602882609775600,3080602882609775598,1,6311439873746261694),
(3080602882609775601,3080602882609775598,1,6311439873746261694),
(3080602882609776595,3080602882609776595,1,-661101805245999843),
(3080602882609777596,3080602882609777596,1,-661101805245999843),
(3080602882609777597,3080602882609777596,1,2216865386202464067),
(4269412446747236216,4269412446747236216,1,8948400944397203540),
(4269412446747236217,4269412446747236217,1,-1143096194892676000),
(4269412446747236218,4269412446747236218,1,-1143096194892676000),
(4269412446747236219,4269412446747236218,1,5313391811364818290),
(4269412446747236220,4269412446747236218,1,8948400944397203540),
(4269412446747236221,4269412446747236219,1,7624499822621753835),
(6341490487802728358,6341490487802728358,1,8948400944397203540),
(6341490487802728359,6341490487802728359,1,8141092449587136068),
(6341490487802728360,6341490487802728360,1,8141092449587136068),
(6341490487802728361,6341490487802728360,1,1291319099896431785),
(6341490487802728362,6341490487802728360,1,8948400944397203540),
(6341490487802728363,6341490487802728361,1,6701841652906431497);
analyze table filt, acei, acli;
Table Op Msg_type Msg_text
test.filt analyze status Engine-independent statistics collected
test.filt analyze status OK
test.acei analyze status Engine-independent statistics collected
test.acei analyze status OK
test.acli analyze status Engine-independent statistics collected
test.acli analyze status OK
set @save_optimizer_switch=@@optimizer_switch;
set @save_join_cache_level=@@join_cache_level;
set optimizer_switch='mrr=off';
set join_cache_level=2;
set statement optimizer_switch='rowid_filter=off' for explain extended select t.id, fi.*
from (acli t inner join acei a on a.aclid = t.id)
inner join filt fi on a.id = fi.aceid
where
t.rid = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and
t.tp = 121 and
a.atp = 1 and
fi.fh in (6311439873746261694,-397087483897438286,
8518228073041491534,-5420422472375069774);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t index_merge PRIMARY,acli_rid,acli_tp acli_tp,acli_rid 2,767 NULL 2 100.00 Using intersect(acli_tp,acli_rid); Using where; Using index
1 SIMPLE a ref PRIMARY,acei_aclid acei_aclid 8 test.t.id 1 100.00 Using where
1 SIMPLE fi ref filt_aceid,filt_fh filt_aceid 8 test.a.id 1 17.14 Using where
Warnings:
Note 1003 select `test`.`t`.`id` AS `id`,`test`.`fi`.`id` AS `id`,`test`.`fi`.`aceid` AS `aceid`,`test`.`fi`.`clid` AS `clid`,`test`.`fi`.`fh` AS `fh` from `test`.`acli` `t` join `test`.`acei` `a` join `test`.`filt` `fi` where `test`.`t`.`tp` = 121 and `test`.`a`.`atp` = 1 and `test`.`fi`.`aceid` = `test`.`a`.`id` and `test`.`a`.`aclid` = `test`.`t`.`id` and `test`.`t`.`rid` = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and `test`.`fi`.`fh` in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774)
set statement optimizer_switch='rowid_filter=off' for select t.id, fi.*
from (acli t inner join acei a on a.aclid = t.id)
inner join filt fi on a.id = fi.aceid
where
t.rid = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and
t.tp = 121 and
a.atp = 1 and
fi.fh in (6311439873746261694,-397087483897438286,
8518228073041491534,-5420422472375069774);
id id aceid clid fh
3080602882609775594 3080602882609775600 3080602882609775598 1 6311439873746261694
3080602882609775594 3080602882609775601 3080602882609775598 1 6311439873746261694
set statement optimizer_switch='rowid_filter=on' for explain extended select t.id, fi.*
from (acli t inner join acei a on a.aclid = t.id)
inner join filt fi on a.id = fi.aceid
where
t.rid = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and
t.tp = 121 and
a.atp = 1 and
fi.fh in (6311439873746261694,-397087483897438286,
8518228073041491534,-5420422472375069774);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t index_merge PRIMARY,acli_rid,acli_tp acli_tp,acli_rid 2,767 NULL 2 100.00 Using intersect(acli_tp,acli_rid); Using where; Using index
1 SIMPLE a ref PRIMARY,acei_aclid acei_aclid 8 test.t.id 1 100.00 Using where
1 SIMPLE fi ref|filter filt_aceid,filt_fh filt_aceid|filt_fh 8|8 test.a.id 1 (17%) 17.14 Using where; Using rowid filter
Warnings:
Note 1003 select `test`.`t`.`id` AS `id`,`test`.`fi`.`id` AS `id`,`test`.`fi`.`aceid` AS `aceid`,`test`.`fi`.`clid` AS `clid`,`test`.`fi`.`fh` AS `fh` from `test`.`acli` `t` join `test`.`acei` `a` join `test`.`filt` `fi` where `test`.`t`.`tp` = 121 and `test`.`a`.`atp` = 1 and `test`.`fi`.`aceid` = `test`.`a`.`id` and `test`.`a`.`aclid` = `test`.`t`.`id` and `test`.`t`.`rid` = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and `test`.`fi`.`fh` in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774)
set statement optimizer_switch='rowid_filter=on' for select t.id, fi.*
from (acli t inner join acei a on a.aclid = t.id)
inner join filt fi on a.id = fi.aceid
where
t.rid = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and
t.tp = 121 and
a.atp = 1 and
fi.fh in (6311439873746261694,-397087483897438286,
8518228073041491534,-5420422472375069774);
id id aceid clid fh
3080602882609775594 3080602882609775600 3080602882609775598 1 6311439873746261694
3080602882609775594 3080602882609775601 3080602882609775598 1 6311439873746261694
set optimizer_switch='mrr=on';
set join_cache_level=6;
set statement optimizer_switch='rowid_filter=off' for explain extended select t.id, fi.*
from (acli t inner join acei a on a.aclid = t.id)
inner join filt fi on a.id = fi.aceid
where
t.rid = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and
t.tp = 121 and
a.atp = 1 and
fi.fh in (6311439873746261694,-397087483897438286,
8518228073041491534,-5420422472375069774);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t index_merge PRIMARY,acli_rid,acli_tp acli_tp,acli_rid 2,767 NULL 2 100.00 Using intersect(acli_tp,acli_rid); Using where; Using index
1 SIMPLE a ref PRIMARY,acei_aclid acei_aclid 8 test.t.id 1 100.00 Using where; Using join buffer (flat, BKA join); Rowid-ordered scan
1 SIMPLE fi ref filt_aceid,filt_fh filt_aceid 8 test.a.id 1 17.14 Using where; Using join buffer (incremental, BKA join); Rowid-ordered scan
Warnings:
Note 1003 select `test`.`t`.`id` AS `id`,`test`.`fi`.`id` AS `id`,`test`.`fi`.`aceid` AS `aceid`,`test`.`fi`.`clid` AS `clid`,`test`.`fi`.`fh` AS `fh` from `test`.`acli` `t` join `test`.`acei` `a` join `test`.`filt` `fi` where `test`.`t`.`tp` = 121 and `test`.`a`.`atp` = 1 and `test`.`fi`.`aceid` = `test`.`a`.`id` and `test`.`a`.`aclid` = `test`.`t`.`id` and `test`.`t`.`rid` = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and `test`.`fi`.`fh` in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774)
set statement optimizer_switch='rowid_filter=off' for select t.id, fi.*
from (acli t inner join acei a on a.aclid = t.id)
inner join filt fi on a.id = fi.aceid
where
t.rid = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and
t.tp = 121 and
a.atp = 1 and
fi.fh in (6311439873746261694,-397087483897438286,
8518228073041491534,-5420422472375069774);
id id aceid clid fh
3080602882609775594 3080602882609775600 3080602882609775598 1 6311439873746261694
3080602882609775594 3080602882609775601 3080602882609775598 1 6311439873746261694
set statement optimizer_switch='rowid_filter=on' for explain extended select t.id, fi.*
from (acli t inner join acei a on a.aclid = t.id)
inner join filt fi on a.id = fi.aceid
where
t.rid = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and
t.tp = 121 and
a.atp = 1 and
fi.fh in (6311439873746261694,-397087483897438286,
8518228073041491534,-5420422472375069774);
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t index_merge PRIMARY,acli_rid,acli_tp acli_tp,acli_rid 2,767 NULL 2 100.00 Using intersect(acli_tp,acli_rid); Using where; Using index
1 SIMPLE a ref PRIMARY,acei_aclid acei_aclid 8 test.t.id 1 100.00 Using where; Using join buffer (flat, BKA join); Rowid-ordered scan
1 SIMPLE fi ref|filter filt_aceid,filt_fh filt_aceid|filt_fh 8|8 test.a.id 1 (17%) 17.14 Using where; Using join buffer (incremental, BKA join); Rowid-ordered scan; Using rowid filter
Warnings:
Note 1003 select `test`.`t`.`id` AS `id`,`test`.`fi`.`id` AS `id`,`test`.`fi`.`aceid` AS `aceid`,`test`.`fi`.`clid` AS `clid`,`test`.`fi`.`fh` AS `fh` from `test`.`acli` `t` join `test`.`acei` `a` join `test`.`filt` `fi` where `test`.`t`.`tp` = 121 and `test`.`a`.`atp` = 1 and `test`.`fi`.`aceid` = `test`.`a`.`id` and `test`.`a`.`aclid` = `test`.`t`.`id` and `test`.`t`.`rid` = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and `test`.`fi`.`fh` in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774)
set statement optimizer_switch='rowid_filter=on' for select t.id, fi.*
from (acli t inner join acei a on a.aclid = t.id)
inner join filt fi on a.id = fi.aceid
where
t.rid = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and
t.tp = 121 and
a.atp = 1 and
fi.fh in (6311439873746261694,-397087483897438286,
8518228073041491534,-5420422472375069774);
id id aceid clid fh
3080602882609775594 3080602882609775600 3080602882609775598 1 6311439873746261694
3080602882609775594 3080602882609775601 3080602882609775598 1 6311439873746261694
set statement optimizer_switch='rowid_filter=on' for analyze format=json select t.id, fi.*
from (acli t inner join acei a on a.aclid = t.id)
inner join filt fi on a.id = fi.aceid
where
t.rid = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and
t.tp = 121 and
a.atp = 1 and
fi.fh in (6311439873746261694,-397087483897438286,
8518228073041491534,-5420422472375069774);
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t",
"access_type": "index_merge",
"possible_keys": ["PRIMARY", "acli_rid", "acli_tp"],
"key_length": "2,767",
"index_merge": {
"intersect": {
"range": {
"key": "acli_tp",
"used_key_parts": ["tp"]
},
"range": {
"key": "acli_rid",
"used_key_parts": ["rid"]
}
}
},
"r_loops": 1,
"rows": 2,
"r_rows": 3,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100,
"attached_condition": "t.tp = 121 and t.rid = 'B5FCC8C7111E4E3CBC21AAF5012F59C2'",
"using_index": true
},
"block-nl-join": {
"table": {
"table_name": "a",
"access_type": "ref",
"possible_keys": ["PRIMARY", "acei_aclid"],
"key": "acei_aclid",
"key_length": "8",
"used_key_parts": ["aclid"],
"ref": ["test.t.id"],
"r_loops": 1,
"rows": 1,
"r_rows": 3,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100
},
"buffer_type": "flat",
"buffer_size": "8Kb",
"join_type": "BKA",
"mrr_type": "Rowid-ordered scan",
"attached_condition": "a.atp = 1",
"r_filtered": 100
},
"block-nl-join": {
"table": {
"table_name": "fi",
"access_type": "ref",
"possible_keys": ["filt_aceid", "filt_fh"],
"key": "filt_aceid",
"key_length": "8",
"used_key_parts": ["aceid"],
"ref": ["test.a.id"],
"rowid_filter": {
"range": {
"key": "filt_fh",
"used_key_parts": ["fh"]
},
"rows": 6,
"selectivity_pct": 17.143,
"r_rows": 5,
"r_selectivity_pct": 40,
"r_buffer_size": "REPLACED",
"r_filling_time_ms": "REPLACED"
},
"r_loops": 1,
"rows": 1,
"r_rows": 2,
"r_table_time_ms": "REPLACED",
"r_other_time_ms": "REPLACED",
"filtered": 17.143,
"r_filtered": 100
},
"buffer_type": "incremental",
"buffer_size": "603",
"join_type": "BKA",
"mrr_type": "Rowid-ordered scan",
"attached_condition": "fi.fh in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774)",
"r_filtered": 100
}
}
}
set optimizer_switch=@save_optimizer_switch;
set join_cache_level=@save_join_cache_level;
drop table filt, acei, acli;
set global innodb_stats_persistent= @stats.save;

View File

@ -381,3 +381,156 @@ ORDER BY pk LIMIT 1;
DROP TABLE t1;
SET global innodb_stats_persistent= @stats.save;
--echo #
--echo # MDEV-21610: Using rowid filter with BKA+MRR
--echo #
set @stats.save= @@innodb_stats_persistent;
set global innodb_stats_persistent=on;
CREATE TABLE acli (
id bigint(20) NOT NULL,
rid varchar(255) NOT NULL,
tp smallint(6) NOT NULL DEFAULT 0,
PRIMARY KEY (id),
KEY acli_rid (rid),
KEY acli_tp (tp)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
insert into acli(id,rid,tp) values
(184929059698905997,'ABABABABABABABABAB',103),
(184929059698905998,'ABABABABABABABABAB',121),
(283586039035985921,'00000000000000000000000000000000',103),
(2216474704108064678,'020BED6D07B741CE9B10AB2200FEF1DF',103),
(2216474704108064679,'020BED6D07B741CE9B10AB2200FEF1DF',121),
(3080602882609775593,'B5FCC8C7111E4E3CBC21AAF5012F59C2',103),
(3080602882609775594,'B5FCC8C7111E4E3CBC21AAF5012F59C2',121),
(3080602882609776594,'B5FCC8C7111E4E3CBC21AAF5012F59C2',121),
(3080602882609777595,'B5FCC8C7111E4E3CBC21AAF5012F59C2',121),
(4269412446747236214,'SCSCSCSCSCSCSCSC',103),
(4269412446747236215,'SCSCSCSCSCSCSCSC',121),
(6341490487802728356,'6072D47E513F4A4794BBAB2200FDB67D',103),
(6341490487802728357,'6072D47E513F4A4794BBAB2200FDB67D',121);
CREATE TABLE acei (
id bigint(20) NOT NULL,
aclid bigint(20) NOT NULL DEFAULT 0,
atp smallint(6) NOT NULL DEFAULT 0,
clus smallint(6) NOT NULL DEFAULT 0,
PRIMARY KEY (id),
KEY acei_aclid (aclid),
KEY acei_clus (clus)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
insert into acei(id,aclid,atp,clus) values
(184929059698905999,184929059698905997,0,1),
(184929059698906000,184929059698905997,0,1),
(184929059698906001,184929059698905997,1,1),
(184929059698906002,184929059698905998,1,1),
(283586039035985922,283586039035985921,1,1),
(2216474704108064684,2216474704108064678,0,1),
(2216474704108064685,2216474704108064678,0,1),
(2216474704108064686,2216474704108064678,1,1),
(2216474704108064687,2216474704108064679,1,1),
(3080602882609775595,3080602882609775593,0,1),
(3080602882609775596,3080602882609775593,0,1),
(3080602882609775597,3080602882609775593,1,1),
(3080602882609775598,3080602882609775594,1,1),
(3080602882609776595,3080602882609776594,1,1),
(3080602882609777596,3080602882609777595,1,1),
(4269412446747236216,4269412446747236214,0,1),
(4269412446747236217,4269412446747236214,0,1),
(4269412446747236218,4269412446747236214,1,1),
(4269412446747236219,4269412446747236215,1,1),
(6341490487802728358,6341490487802728356,0,1),
(6341490487802728359,6341490487802728356,0,1),
(6341490487802728360,6341490487802728356,1,1),
(6341490487802728361,6341490487802728357,1,1);
CREATE TABLE filt (
id bigint(20) NOT NULL,
aceid bigint(20) NOT NULL DEFAULT 0,
clid smallint(6) NOT NULL DEFAULT 0,
fh bigint(20) NOT NULL DEFAULT 0,
PRIMARY KEY (id),
KEY filt_aceid (aceid),
KEY filt_clid (clid),
KEY filt_fh (fh)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
insert into filt(id,aceid,clid,fh) values
(184929059698905999,184929059698905999,1,8948400944397203540),
(184929059698906000,184929059698906000,1,-3516039679025944536),
(184929059698906001,184929059698906001,1,-3516039679025944536),
(184929059698906002,184929059698906001,1,2965370193075218252),
(184929059698906003,184929059698906001,1,8948400944397203540),
(184929059698906004,184929059698906002,1,2478709353550777738),
(283586039035985922,283586039035985922,1,5902600816362013271),
(2216474704108064686,2216474704108064684,1,8948400944397203540),
(2216474704108064687,2216474704108064685,1,-7244708939311117030),
(2216474704108064688,2216474704108064686,1,-7244708939311117030),
(2216474704108064689,2216474704108064686,1,7489060986210282479),
(2216474704108064690,2216474704108064686,1,8948400944397203540),
(2216474704108064691,2216474704108064687,1,-3575268945274980038),
(3080602882609775595,3080602882609775595,1,8948400944397203540),
(3080602882609775596,3080602882609775596,1,-5420422472375069774),
(3080602882609775597,3080602882609775597,1,-5420422472375069774),
(3080602882609775598,3080602882609775597,1,8518228073041491534),
(3080602882609775599,3080602882609775597,1,8948400944397203540),
(3080602882609775600,3080602882609775598,1,6311439873746261694),
(3080602882609775601,3080602882609775598,1,6311439873746261694),
(3080602882609776595,3080602882609776595,1,-661101805245999843),
(3080602882609777596,3080602882609777596,1,-661101805245999843),
(3080602882609777597,3080602882609777596,1,2216865386202464067),
(4269412446747236216,4269412446747236216,1,8948400944397203540),
(4269412446747236217,4269412446747236217,1,-1143096194892676000),
(4269412446747236218,4269412446747236218,1,-1143096194892676000),
(4269412446747236219,4269412446747236218,1,5313391811364818290),
(4269412446747236220,4269412446747236218,1,8948400944397203540),
(4269412446747236221,4269412446747236219,1,7624499822621753835),
(6341490487802728358,6341490487802728358,1,8948400944397203540),
(6341490487802728359,6341490487802728359,1,8141092449587136068),
(6341490487802728360,6341490487802728360,1,8141092449587136068),
(6341490487802728361,6341490487802728360,1,1291319099896431785),
(6341490487802728362,6341490487802728360,1,8948400944397203540),
(6341490487802728363,6341490487802728361,1,6701841652906431497);
analyze table filt, acei, acli;
let $q=
select t.id, fi.*
from (acli t inner join acei a on a.aclid = t.id)
inner join filt fi on a.id = fi.aceid
where
t.rid = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and
t.tp = 121 and
a.atp = 1 and
fi.fh in (6311439873746261694,-397087483897438286,
8518228073041491534,-5420422472375069774);
set @save_optimizer_switch=@@optimizer_switch;
set @save_join_cache_level=@@join_cache_level;
set optimizer_switch='mrr=off';
set join_cache_level=2;
eval $without_filter explain extended $q;
eval $without_filter $q;
eval $with_filter explain extended $q;
eval $with_filter $q;
set optimizer_switch='mrr=on';
set join_cache_level=6;
eval $without_filter explain extended $q;
eval $without_filter $q;
eval $with_filter explain extended $q;
eval $with_filter $q;
--source include/analyze-format.inc
eval $with_filter analyze format=json $q;
set optimizer_switch=@save_optimizer_switch;
set join_cache_level=@save_join_cache_level;
drop table filt, acei, acli;
set global innodb_stats_persistent= @stats.save;

View File

@ -19,7 +19,6 @@ MW-328A : MDEV-21483 galera.MW-328A galera.MW-328B
MW-328B : MDEV-21483 galera.MW-328A galera.MW-328B
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_gtid_replicate_do_db_cc : MDEV-21796 Crash on galera.galera_as_slave_gtid_replicate_do_db_cc
galera_as_slave_replication_bundle : MDEV-15785 OPTION_GTID_BEGIN is set in Gtid_log_event::do_apply_event()
galera_autoinc_sst_mariabackup : Known issue, may require porting MDEV-17458 from later versions
galera_bf_abort_group_commit : MDEV-18282 Galera test failure on galera.galera_bf_abort_group_commit
@ -27,7 +26,6 @@ galera_binlog_stmt_autoinc : MDEV-19959 Galera test failure on galera_binlog_stm
galera_encrypt_tmp_files : Get error failed to enable encryption of temporary files
galera_ftwrl : MDEV-21525 galera.galera_ftwrl
galera_gcache_recover_manytrx : MDEV-18834 Galera test failure
galera_ist_mariabackup : MDEV-18829 test leaves port open
galera_ist_progress : MDEV-15236 fails when trying to read transfer status
galera_kill_largechanges : MDEV-18179 Galera test failure on galera.galera_kill_largechanges
galera_kill_nochanges : MDEV-18280 Galera test failure on galera_split_brain and galera_kill_nochanges
@ -45,12 +43,13 @@ galera_sst_mariabackup_table_options: MDEV-19741 Galera test failure on galera.g
galera_toi_ddl_nonconflicting : MDEV-21518 galera.galera_toi_ddl_nonconflicting
galera_var_innodb_disallow_writes : MDEV-20928 galera.galera_var_innodb_disallow_writes
galera_var_node_address : MDEV-20485 Galera test failure
galera_var_notify_cmd : MDEV-21488,MDEV-20600
galera_var_notify_cmd : MDEV-21905 Galera test galera_var_notify_cmd causes hang
galera_var_reject_queries : assertion in inline_mysql_socket_send
galera_var_retry_autocommit: MDEV-18181 Galera test failure on galera.galera_var_retry_autocommit
galera_wan : MDEV-17259 Test failure on galera.galera_wan
galera_wsrep_new_cluster : MDEV-21515 galera.galera_wsrep_new_cluster
mysql-wsrep#198 : MDEV-18935 Galera test mysql-wsrep#198 sporaric assertion transaction.cpp:362: int wsrep::transaction::before_commit(): Assertion `state() == s_executing || state() == s_committing || state() == s_must_abort || state() == s_replaying' failed.
lp1376747-4 : MDEV-21911 Galera test failure on lp1376747-4
partition : MDEV-19958 Galera test failure on galera.partition
query_cache: MDEV-15805 Test failure on galera.query_cache
sql_log_bin : MDEV-21491 galera.sql_log_bin

View File

@ -1,29 +0,0 @@
connection node_2;
connection node_1;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
START SLAVE;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
SELECT @@global.gtid_binlog_pos;
@@global.gtid_binlog_pos
100-1-2
connection node_2;
INSERT INTO t1 VALUES(2);
gtid_do_not_match
1
connection node_3;
gtid_do_not_match
1
connection node_1;
DROP TABLE t1;
connection node_3;
connection node_1;
connection node_2;
gtid_executed_equal
1
connection node_3;
gtid_executed_equal
1
STOP SLAVE;
RESET SLAVE ALL;

View File

@ -1,31 +0,0 @@
connection node_2;
connection node_1;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
START SLAVE;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
connection node_2;
INSERT INTO t1 VALUES(2);
connection node_3;
STOP SLAVE;
START SLAVE;
connection node_1;
INSERT INTO t1 VALUES(3);
connection node_2;
INSERT INTO t1 VALUES(4);
connection node_3;
connection node_1;
DROP TABLE t1;
connection node_3;
STOP SLAVE;
RESET SLAVE ALL;
RESET MASTER;
connection node_2;
SET GLOBAL wsrep_on=OFF;
RESET MASTER;
SET GLOBAL wsrep_on=ON;
connection node_1;
SET GLOBAL wsrep_on=OFF;
RESET MASTER;
SET GLOBAL wsrep_on=ON;

View File

@ -1,5 +1,8 @@
connection node_2;
connection node_1;
SELECT @@WSREP_ON;
@@WSREP_ON
1
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
SELECT @@wsrep_on;
@@wsrep_on

View File

@ -1,168 +0,0 @@
connection node_2;
connection node_1;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connection node_1;
SET global wsrep_on=OFF;
RESET MASTER;
SET global wsrep_on=ON;
connection node_3;
RESET MASTER;
connection node_2;
SET global wsrep_on=OFF;
RESET MASTER;
SET global wsrep_on=ON;
START SLAVE;
connection node_3;
CREATE SCHEMA test1;
CREATE SCHEMA test2;
USE test1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY,f2 CHAR(5) DEFAULT 'abc') ENGINE=InnoDB;
USE test2;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY,f2 CHAR(5) DEFAULT 'abc') ENGINE=InnoDB;
INSERT INTO test1.t1 (f1) VALUES (1);
INSERT INTO test2.t1 (f1) VALUES (1);
INSERT INTO test1.t1 (f1) VALUES (2);
INSERT INTO test2.t1 (f1) VALUES (2);
INSERT INTO test1.t1 (f1) VALUES (3);
INSERT INTO test2.t1 (f1) VALUES (3);
UPDATE test2.t1 SET test2.t1.f2 = 'cde';
UPDATE test1.t1, test2.t1 SET test1.t1.f2 = 'klm', test2.t1.f2 = 'xyz';
DELETE test1.t1, test2.t1 FROM test1.t1 INNER JOIN test2.t1 WHERE test1.t1.f1 = test2.t1.f1 AND test1.t1.f1 = 3;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO test2.t1 (f1) VALUES (999);
INSERT INTO test2.t1 (f1) VALUES (9999);
COMMIT;
START TRANSACTION;
INSERT INTO test1.t1 (f1) VALUES (111);
INSERT INTO test1.t1 (f1) VALUES (222);
COMMIT;
START TRANSACTION;
INSERT INTO test1.t1 (f1) VALUES (333);
INSERT INTO test2.t1 (f1) VALUES (99999);
COMMIT;
connection node_2;
SHOW BINLOG EVENTS IN 'master-bin.000001' FROM 256;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 256 Gtid_list 2 285 []
master-bin.000001 285 Binlog_checkpoint 2 329 master-bin.000001
master-bin.000001 329 Gtid 3 371 GTID 0-3-1
master-bin.000001 371 Query 3 458 CREATE SCHEMA test1
master-bin.000001 458 Gtid 3 500 GTID 0-3-3
master-bin.000001 500 Query 3 647 use `test1`; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY,f2 CHAR(5) DEFAULT 'abc') ENGINE=InnoDB
master-bin.000001 647 Gtid 3 689 BEGIN GTID 0-3-5
master-bin.000001 689 Annotate_rows 3 748 INSERT INTO test1.t1 (f1) VALUES (1)
master-bin.000001 748 Table_map 3 797 table_id: ### (test1.t1)
master-bin.000001 797 Write_rows_v1 3 839 table_id: ### flags: STMT_END_F
master-bin.000001 839 Xid 3 870 COMMIT /* xid=### */
master-bin.000001 870 Gtid 3 912 BEGIN GTID 0-3-7
master-bin.000001 912 Annotate_rows 3 971 INSERT INTO test1.t1 (f1) VALUES (2)
master-bin.000001 971 Table_map 3 1020 table_id: ### (test1.t1)
master-bin.000001 1020 Write_rows_v1 3 1062 table_id: ### flags: STMT_END_F
master-bin.000001 1062 Xid 3 1093 COMMIT /* xid=### */
master-bin.000001 1093 Gtid 3 1135 BEGIN GTID 0-3-9
master-bin.000001 1135 Annotate_rows 3 1194 INSERT INTO test1.t1 (f1) VALUES (3)
master-bin.000001 1194 Table_map 3 1243 table_id: ### (test1.t1)
master-bin.000001 1243 Write_rows_v1 3 1285 table_id: ### flags: STMT_END_F
master-bin.000001 1285 Xid 3 1316 COMMIT /* xid=### */
master-bin.000001 1316 Gtid 3 1358 BEGIN GTID 0-3-12
master-bin.000001 1358 Annotate_rows 3 1451 UPDATE test1.t1, test2.t1 SET test1.t1.f2 = 'klm', test2.t1.f2 = 'xyz'
master-bin.000001 1451 Table_map 3 1500 table_id: ### (test1.t1)
master-bin.000001 1500 Update_rows_v1 3 1588 table_id: ### flags: STMT_END_F
master-bin.000001 1588 Xid 3 1619 COMMIT /* xid=### */
master-bin.000001 1619 Gtid 3 1661 BEGIN GTID 0-3-13
master-bin.000001 1661 Annotate_rows 3 1795 DELETE test1.t1, test2.t1 FROM test1.t1 INNER JOIN test2.t1 WHERE test1.t1.f1 = test2.t1.f1 AND test1.t1.f1 = 3
master-bin.000001 1795 Table_map 3 1844 table_id: ### (test1.t1)
master-bin.000001 1844 Delete_rows_v1 3 1886 table_id: ### flags: STMT_END_F
master-bin.000001 1886 Xid 3 1917 COMMIT /* xid=### */
master-bin.000001 1917 Gtid 3 1959 BEGIN GTID 0-3-15
master-bin.000001 1959 Annotate_rows 3 2020 INSERT INTO test1.t1 (f1) VALUES (111)
master-bin.000001 2020 Table_map 3 2069 table_id: ### (test1.t1)
master-bin.000001 2069 Write_rows_v1 3 2111 table_id: ### flags: STMT_END_F
master-bin.000001 2111 Annotate_rows 3 2172 INSERT INTO test1.t1 (f1) VALUES (222)
master-bin.000001 2172 Table_map 3 2221 table_id: ### (test1.t1)
master-bin.000001 2221 Write_rows_v1 3 2263 table_id: ### flags: STMT_END_F
master-bin.000001 2263 Xid 3 2294 COMMIT /* xid=### */
master-bin.000001 2294 Gtid 3 2336 BEGIN GTID <effective_uuid>
master-bin.000001 2336 Annotate_rows 3 2397 INSERT INTO test1.t1 (f1) VALUES (333)
master-bin.000001 2397 Table_map 3 2446 table_id: ### (test1.t1)
master-bin.000001 2446 Write_rows_v1 3 2488 table_id: ### flags: STMT_END_F
master-bin.000001 2488 Xid 3 2519 COMMIT /* xid=### */
connection node_1;
gtid_executed_equal
0
SHOW BINLOG EVENTS IN 'master-bin.000001' FROM 256;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 256 Gtid_list 1 285 []
master-bin.000001 285 Binlog_checkpoint 1 329 master-bin.000001
master-bin.000001 329 Gtid 3 371 GTID 0-3-1
master-bin.000001 371 Query 3 458 CREATE SCHEMA test1
master-bin.000001 458 Gtid 3 500 GTID 0-3-3
master-bin.000001 500 Query 3 647 use `test1`; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY,f2 CHAR(5) DEFAULT 'abc') ENGINE=InnoDB
master-bin.000001 647 Gtid 3 689 BEGIN GTID 0-3-5
master-bin.000001 689 Annotate_rows 3 748 INSERT INTO test1.t1 (f1) VALUES (1)
master-bin.000001 748 Table_map 3 797 table_id: ### (test1.t1)
master-bin.000001 797 Write_rows_v1 3 839 table_id: ### flags: STMT_END_F
master-bin.000001 839 Xid 3 870 COMMIT /* xid=### */
master-bin.000001 870 Gtid 3 912 BEGIN GTID 0-3-7
master-bin.000001 912 Annotate_rows 3 971 INSERT INTO test1.t1 (f1) VALUES (2)
master-bin.000001 971 Table_map 3 1020 table_id: ### (test1.t1)
master-bin.000001 1020 Write_rows_v1 3 1062 table_id: ### flags: STMT_END_F
master-bin.000001 1062 Xid 3 1093 COMMIT /* xid=### */
master-bin.000001 1093 Gtid 3 1135 BEGIN GTID 0-3-9
master-bin.000001 1135 Annotate_rows 3 1194 INSERT INTO test1.t1 (f1) VALUES (3)
master-bin.000001 1194 Table_map 3 1243 table_id: ### (test1.t1)
master-bin.000001 1243 Write_rows_v1 3 1285 table_id: ### flags: STMT_END_F
master-bin.000001 1285 Xid 3 1316 COMMIT /* xid=### */
master-bin.000001 1316 Gtid 3 1358 BEGIN GTID 0-3-12
master-bin.000001 1358 Annotate_rows 3 1451 UPDATE test1.t1, test2.t1 SET test1.t1.f2 = 'klm', test2.t1.f2 = 'xyz'
master-bin.000001 1451 Table_map 3 1500 table_id: ### (test1.t1)
master-bin.000001 1500 Update_rows_v1 3 1588 table_id: ### flags: STMT_END_F
master-bin.000001 1588 Xid 3 1619 COMMIT /* xid=### */
master-bin.000001 1619 Gtid 3 1661 BEGIN GTID 0-3-13
master-bin.000001 1661 Annotate_rows 3 1795 DELETE test1.t1, test2.t1 FROM test1.t1 INNER JOIN test2.t1 WHERE test1.t1.f1 = test2.t1.f1 AND test1.t1.f1 = 3
master-bin.000001 1795 Table_map 3 1844 table_id: ### (test1.t1)
master-bin.000001 1844 Delete_rows_v1 3 1886 table_id: ### flags: STMT_END_F
master-bin.000001 1886 Xid 3 1917 COMMIT /* xid=### */
master-bin.000001 1917 Gtid 3 1959 BEGIN GTID 0-3-15
master-bin.000001 1959 Annotate_rows 3 2020 INSERT INTO test1.t1 (f1) VALUES (111)
master-bin.000001 2020 Table_map 3 2069 table_id: ### (test1.t1)
master-bin.000001 2069 Write_rows_v1 3 2111 table_id: ### flags: STMT_END_F
master-bin.000001 2111 Annotate_rows 3 2172 INSERT INTO test1.t1 (f1) VALUES (222)
master-bin.000001 2172 Table_map 3 2221 table_id: ### (test1.t1)
master-bin.000001 2221 Write_rows_v1 3 2263 table_id: ### flags: STMT_END_F
master-bin.000001 2263 Xid 3 2294 COMMIT /* xid=### */
master-bin.000001 2294 Gtid 3 2336 BEGIN GTID <effective_uuid>
master-bin.000001 2336 Annotate_rows 3 2397 INSERT INTO test1.t1 (f1) VALUES (333)
master-bin.000001 2397 Table_map 3 2446 table_id: ### (test1.t1)
master-bin.000001 2446 Write_rows_v1 3 2488 table_id: ### flags: STMT_END_F
master-bin.000001 2488 Xid 3 2519 COMMIT /* xid=### */
include/diff_servers.inc [servers=1 2]
connection node_1;
SELECT COUNT(*) = 2 FROM test1.t1 WHERE f1 IN (1,2);
COUNT(*) = 2
1
SELECT COUNT(*) = 3 FROM test1.t1 WHERE f1 IN (111,222,333);
COUNT(*) = 3
1
SELECT COUNT(*) = 2 FROM test1.t1 WHERE f2 = 'klm';
COUNT(*) = 2
1
USE test2;
ERROR 42000: Unknown database 'test2'
connection node_3;
DROP SCHEMA test1;
DROP SCHEMA test2;
connection node_1;
connection node_2;
STOP SLAVE;
RESET SLAVE ALL;
SET GLOBAL wsrep_on=OFF;
RESET MASTER;
SET GLOBAL wsrep_on=ON;
connection node_1;
SET GLOBAL wsrep_on=OFF;
RESET MASTER;
SET GLOBAL wsrep_on=ON;
connection node_3;
RESET MASTER;

View File

@ -1,321 +0,0 @@
connection node_2;
connection node_1;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connection node_1;
SET global wsrep_on=OFF;
RESET MASTER;
SET global wsrep_on=ON;
connection node_3;
RESET MASTER;
connection node_2;
SET global wsrep_on=OFF;
RESET MASTER;
SET global wsrep_on=ON;
START SLAVE USER='root';
Warnings:
Note 1759 Sending passwords in plain text without SSL/TLS is extremely insecure.
CREATE SCHEMA test1;
CREATE SCHEMA test2;
USE test1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
USE test2;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO test1.t1 (f1) VALUES (1);
INSERT INTO test2.t1 (f1) VALUES (1);
INSERT INTO test1.t1 (f1) VALUES (2);
INSERT INTO test2.t1 (f1) VALUES (2);
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
INSERT INTO test1.t1 (f1) VALUES (3);
INSERT INTO test2.t1 (f1) VALUES (3);
INSERT INTO test1.t1 (f1) VALUES (3);
INSERT INTO test2.t1 (f1) VALUES (3);
INSERT INTO test1.t1 (f1) VALUES (3);
INSERT INTO test2.t1 (f1) VALUES (3);
INSERT INTO test1.t1 (f1) VALUES (3);
INSERT INTO test2.t1 (f1) VALUES (3);
SET SESSION wsrep_on=OFF;
include/wait_for_slave_sql_error.inc [errno=1047]
INSERT INTO test1.t1 (f1) VALUES (4);
INSERT INTO test2.t1 (f1) VALUES (4);
INSERT INTO test1.t1 (f1) VALUES (4);
INSERT INTO test2.t1 (f1) VALUES (4);
INSERT INTO test1.t1 (f1) VALUES (4);
INSERT INTO test2.t1 (f1) VALUES (4);
INSERT INTO test1.t1 (f1) VALUES (4);
INSERT INTO test2.t1 (f1) VALUES (4);
INSERT INTO test1.t1 (f1) VALUES (4);
INSERT INTO test2.t1 (f1) VALUES (4);
SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
INSERT INTO test1.t1 (f1) VALUES (5);
INSERT INTO test2.t1 (f1) VALUES (5);
SET SESSION wsrep_on=ON;
INSERT INTO test1.t1 (f1) VALUES (6);
INSERT INTO test2.t1 (f1) VALUES (6);
START SLAVE;
SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120;
Log_name Pos Event_type Server_id End_log_pos Info
mysqld-bin.000001 120 Previous_gtids 2 151
mysqld-bin.000001 151 Gtid 1 199 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:1'
mysqld-bin.000001 199 Query 1 294 CREATE SCHEMA test1
mysqld-bin.000001 294 Gtid 1 342 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:2'
mysqld-bin.000001 342 Query 1 415 BEGIN
mysqld-bin.000001 415 Query 1 489 COMMIT
mysqld-bin.000001 489 Gtid 1 537 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:3'
mysqld-bin.000001 537 Query 1 655 use `test1`; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB
mysqld-bin.000001 655 Gtid 1 703 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:4'
mysqld-bin.000001 703 Query 1 776 BEGIN
mysqld-bin.000001 776 Query 1 850 COMMIT
mysqld-bin.000001 850 Gtid 1 898 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:5'
mysqld-bin.000001 898 Query 1 961 BEGIN
mysqld-bin.000001 961 Table_map 1 1007 table_id: ### (test1.t1)
mysqld-bin.000001 1007 Write_rows 1 1047 table_id: ### flags: STMT_END_F
mysqld-bin.000001 1047 Xid 1 1078 COMMIT /* xid=### */
mysqld-bin.000001 1078 Gtid 1 1126 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:6'
mysqld-bin.000001 1126 Query 1 1189 BEGIN
mysqld-bin.000001 1189 Query 1 1253 COMMIT
mysqld-bin.000001 1253 Gtid 1 1301 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:7'
mysqld-bin.000001 1301 Query 1 1364 BEGIN
mysqld-bin.000001 1364 Table_map 1 1410 table_id: ### (test1.t1)
mysqld-bin.000001 1410 Write_rows 1 1450 table_id: ### flags: STMT_END_F
mysqld-bin.000001 1450 Xid 1 1481 COMMIT /* xid=### */
mysqld-bin.000001 1481 Gtid 1 1529 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:8'
mysqld-bin.000001 1529 Query 1 1592 BEGIN
mysqld-bin.000001 1592 Query 1 1656 COMMIT
mysqld-bin.000001 1656 Gtid 2 1704 SET @@SESSION.GTID_NEXT= '<effective_uuid_2>:12'
mysqld-bin.000001 1704 Query 2 1772 BEGIN
mysqld-bin.000001 1772 Ignorable 2 1795 # Unrecognized ignorable event
mysqld-bin.000001 1795 Query 2 1864 COMMIT
mysqld-bin.000001 1864 Gtid 2 1912 SET @@SESSION.GTID_NEXT= '<effective_uuid_2>:13'
mysqld-bin.000001 1912 Query 2 1980 BEGIN
mysqld-bin.000001 1980 Ignorable 2 2003 # Unrecognized ignorable event
mysqld-bin.000001 2003 Query 2 2072 COMMIT
mysqld-bin.000001 2072 Gtid 1 2120 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:9'
mysqld-bin.000001 2120 Query 1 2183 BEGIN
mysqld-bin.000001 2183 Table_map 1 2229 table_id: ### (test1.t1)
mysqld-bin.000001 2229 Write_rows 1 2269 table_id: ### flags: STMT_END_F
mysqld-bin.000001 2269 Xid 1 2300 COMMIT /* xid=### */
mysqld-bin.000001 2300 Gtid 1 2348 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:10'
mysqld-bin.000001 2348 Query 1 2411 BEGIN
mysqld-bin.000001 2411 Query 1 2475 COMMIT
mysqld-bin.000001 2475 Gtid 1 2523 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:11'
mysqld-bin.000001 2523 Query 1 2586 BEGIN
mysqld-bin.000001 2586 Table_map 1 2632 table_id: ### (test1.t1)
mysqld-bin.000001 2632 Write_rows 1 2672 table_id: ### flags: STMT_END_F
mysqld-bin.000001 2672 Xid 1 2703 COMMIT /* xid=### */
mysqld-bin.000001 2703 Gtid 1 2751 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:12'
mysqld-bin.000001 2751 Query 1 2814 BEGIN
mysqld-bin.000001 2814 Query 1 2878 COMMIT
mysqld-bin.000001 2878 Gtid 1 2926 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:13'
mysqld-bin.000001 2926 Query 1 2989 BEGIN
mysqld-bin.000001 2989 Table_map 1 3035 table_id: ### (test1.t1)
mysqld-bin.000001 3035 Write_rows 1 3075 table_id: ### flags: STMT_END_F
mysqld-bin.000001 3075 Xid 1 3106 COMMIT /* xid=### */
mysqld-bin.000001 3106 Gtid 1 3154 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:14'
mysqld-bin.000001 3154 Query 1 3217 BEGIN
mysqld-bin.000001 3217 Query 1 3281 COMMIT
mysqld-bin.000001 3281 Gtid 1 3329 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:15'
mysqld-bin.000001 3329 Query 1 3392 BEGIN
mysqld-bin.000001 3392 Table_map 1 3438 table_id: ### (test1.t1)
mysqld-bin.000001 3438 Write_rows 1 3478 table_id: ### flags: STMT_END_F
mysqld-bin.000001 3478 Xid 1 3509 COMMIT /* xid=### */
mysqld-bin.000001 3509 Gtid 1 3557 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:16'
mysqld-bin.000001 3557 Query 1 3620 BEGIN
mysqld-bin.000001 3620 Query 1 3684 COMMIT
mysqld-bin.000001 3684 Gtid 1 3732 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:17'
mysqld-bin.000001 3732 Query 1 3795 BEGIN
mysqld-bin.000001 3795 Table_map 1 3841 table_id: ### (test1.t1)
mysqld-bin.000001 3841 Write_rows 1 3881 table_id: ### flags: STMT_END_F
mysqld-bin.000001 3881 Xid 1 3912 COMMIT /* xid=### */
mysqld-bin.000001 3912 Gtid 1 3960 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:18'
mysqld-bin.000001 3960 Query 1 4023 BEGIN
mysqld-bin.000001 4023 Query 1 4087 COMMIT
mysqld-bin.000001 4087 Gtid 1 4135 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:19'
mysqld-bin.000001 4135 Query 1 4198 BEGIN
mysqld-bin.000001 4198 Table_map 1 4244 table_id: ### (test1.t1)
mysqld-bin.000001 4244 Write_rows 1 4284 table_id: ### flags: STMT_END_F
mysqld-bin.000001 4284 Xid 1 4315 COMMIT /* xid=### */
mysqld-bin.000001 4315 Gtid 1 4363 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:20'
mysqld-bin.000001 4363 Query 1 4426 BEGIN
mysqld-bin.000001 4426 Query 1 4490 COMMIT
mysqld-bin.000001 4490 Gtid 1 4538 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:21'
mysqld-bin.000001 4538 Query 1 4601 BEGIN
mysqld-bin.000001 4601 Table_map 1 4647 table_id: ### (test1.t1)
mysqld-bin.000001 4647 Write_rows 1 4687 table_id: ### flags: STMT_END_F
mysqld-bin.000001 4687 Xid 1 4718 COMMIT /* xid=### */
mysqld-bin.000001 4718 Gtid 1 4766 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:22'
mysqld-bin.000001 4766 Query 1 4829 BEGIN
mysqld-bin.000001 4829 Query 1 4893 COMMIT
mysqld-bin.000001 4893 Gtid 1 4941 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:23'
mysqld-bin.000001 4941 Query 1 5004 BEGIN
mysqld-bin.000001 5004 Table_map 1 5050 table_id: ### (test1.t1)
mysqld-bin.000001 5050 Write_rows 1 5090 table_id: ### flags: STMT_END_F
mysqld-bin.000001 5090 Xid 1 5121 COMMIT /* xid=### */
mysqld-bin.000001 5121 Gtid 1 5169 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:24'
mysqld-bin.000001 5169 Query 1 5232 BEGIN
mysqld-bin.000001 5232 Query 1 5296 COMMIT
mysqld-bin.000001 5296 Gtid 1 5344 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:25'
mysqld-bin.000001 5344 Query 1 5407 BEGIN
mysqld-bin.000001 5407 Table_map 1 5453 table_id: ### (test1.t1)
mysqld-bin.000001 5453 Write_rows 1 5493 table_id: ### flags: STMT_END_F
mysqld-bin.000001 5493 Xid 1 5524 COMMIT /* xid=### */
mysqld-bin.000001 5524 Gtid 1 5572 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:26'
mysqld-bin.000001 5572 Query 1 5635 BEGIN
mysqld-bin.000001 5635 Query 1 5699 COMMIT
mysqld-bin.000001 5699 Gtid 1 5747 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:27'
mysqld-bin.000001 5747 Query 1 5810 BEGIN
mysqld-bin.000001 5810 Table_map 1 5856 table_id: ### (test1.t1)
mysqld-bin.000001 5856 Write_rows 1 5896 table_id: ### flags: STMT_END_F
mysqld-bin.000001 5896 Xid 1 5927 COMMIT /* xid=### */
mysqld-bin.000001 5927 Gtid 1 5975 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:28'
mysqld-bin.000001 5975 Query 1 6038 BEGIN
mysqld-bin.000001 6038 Query 1 6102 COMMIT
mysqld-bin.000001 6102 Gtid 1 6150 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:29'
mysqld-bin.000001 6150 Query 1 6213 BEGIN
mysqld-bin.000001 6213 Table_map 1 6259 table_id: ### (test1.t1)
mysqld-bin.000001 6259 Write_rows 1 6299 table_id: ### flags: STMT_END_F
mysqld-bin.000001 6299 Xid 1 6330 COMMIT /* xid=### */
mysqld-bin.000001 6330 Gtid 1 6378 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:30'
mysqld-bin.000001 6378 Query 1 6441 BEGIN
mysqld-bin.000001 6441 Query 1 6505 COMMIT
USE test2;
ERROR 42000: Unknown database 'test2'
gtid_executed_equal
1
USE test2;
ERROR 42000: Unknown database 'test2'
SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120;
Log_name Pos Event_type Server_id End_log_pos Info
mysqld-bin.000001 120 Previous_gtids 4 151
mysqld-bin.000001 151 Gtid 1 199 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:1'
mysqld-bin.000001 199 Query 1 294 CREATE SCHEMA test1
mysqld-bin.000001 294 Gtid 1 342 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:2'
mysqld-bin.000001 342 Query 1 415 BEGIN
mysqld-bin.000001 415 Query 1 489 COMMIT
mysqld-bin.000001 489 Gtid 1 537 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:3'
mysqld-bin.000001 537 Query 1 655 use `test1`; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB
mysqld-bin.000001 655 Gtid 1 703 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:4'
mysqld-bin.000001 703 Query 1 776 BEGIN
mysqld-bin.000001 776 Query 1 850 COMMIT
mysqld-bin.000001 850 Gtid 1 898 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:5'
mysqld-bin.000001 898 Query 1 961 BEGIN
mysqld-bin.000001 961 Table_map 1 1007 table_id: ### (test1.t1)
mysqld-bin.000001 1007 Write_rows 1 1047 table_id: ### flags: STMT_END_F
mysqld-bin.000001 1047 Xid 1 1078 COMMIT /* xid=### */
mysqld-bin.000001 1078 Gtid 1 1126 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:6'
mysqld-bin.000001 1126 Query 1 1189 BEGIN
mysqld-bin.000001 1189 Query 1 1253 COMMIT
mysqld-bin.000001 1253 Gtid 1 1301 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:7'
mysqld-bin.000001 1301 Query 1 1364 BEGIN
mysqld-bin.000001 1364 Table_map 1 1410 table_id: ### (test1.t1)
mysqld-bin.000001 1410 Write_rows 1 1450 table_id: ### flags: STMT_END_F
mysqld-bin.000001 1450 Xid 1 1481 COMMIT /* xid=### */
mysqld-bin.000001 1481 Gtid 1 1529 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:8'
mysqld-bin.000001 1529 Query 1 1592 BEGIN
mysqld-bin.000001 1592 Query 1 1656 COMMIT
mysqld-bin.000001 1656 Gtid 4 1704 SET @@SESSION.GTID_NEXT= '<effective_uuid_2>:12'
mysqld-bin.000001 1704 Query 4 1772 BEGIN
mysqld-bin.000001 1772 Ignorable 4 1795 # Unrecognized ignorable event
mysqld-bin.000001 1795 Query 4 1864 COMMIT
mysqld-bin.000001 1864 Gtid 4 1912 SET @@SESSION.GTID_NEXT= '<effective_uuid_2>:13'
mysqld-bin.000001 1912 Query 4 1980 BEGIN
mysqld-bin.000001 1980 Ignorable 4 2003 # Unrecognized ignorable event
mysqld-bin.000001 2003 Query 4 2072 COMMIT
mysqld-bin.000001 2072 Gtid 1 2120 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:9'
mysqld-bin.000001 2120 Query 1 2183 BEGIN
mysqld-bin.000001 2183 Table_map 1 2229 table_id: ### (test1.t1)
mysqld-bin.000001 2229 Write_rows 1 2269 table_id: ### flags: STMT_END_F
mysqld-bin.000001 2269 Xid 1 2300 COMMIT /* xid=### */
mysqld-bin.000001 2300 Gtid 1 2348 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:10'
mysqld-bin.000001 2348 Query 1 2411 BEGIN
mysqld-bin.000001 2411 Query 1 2475 COMMIT
mysqld-bin.000001 2475 Gtid 1 2523 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:11'
mysqld-bin.000001 2523 Query 1 2586 BEGIN
mysqld-bin.000001 2586 Table_map 1 2632 table_id: ### (test1.t1)
mysqld-bin.000001 2632 Write_rows 1 2672 table_id: ### flags: STMT_END_F
mysqld-bin.000001 2672 Xid 1 2703 COMMIT /* xid=### */
mysqld-bin.000001 2703 Gtid 1 2751 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:12'
mysqld-bin.000001 2751 Query 1 2814 BEGIN
mysqld-bin.000001 2814 Query 1 2878 COMMIT
mysqld-bin.000001 2878 Gtid 1 2926 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:13'
mysqld-bin.000001 2926 Query 1 2989 BEGIN
mysqld-bin.000001 2989 Table_map 1 3035 table_id: ### (test1.t1)
mysqld-bin.000001 3035 Write_rows 1 3075 table_id: ### flags: STMT_END_F
mysqld-bin.000001 3075 Xid 1 3106 COMMIT /* xid=### */
mysqld-bin.000001 3106 Gtid 1 3154 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:14'
mysqld-bin.000001 3154 Query 1 3217 BEGIN
mysqld-bin.000001 3217 Query 1 3281 COMMIT
mysqld-bin.000001 3281 Gtid 1 3329 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:15'
mysqld-bin.000001 3329 Query 1 3392 BEGIN
mysqld-bin.000001 3392 Table_map 1 3438 table_id: ### (test1.t1)
mysqld-bin.000001 3438 Write_rows 1 3478 table_id: ### flags: STMT_END_F
mysqld-bin.000001 3478 Xid 1 3509 COMMIT /* xid=### */
mysqld-bin.000001 3509 Gtid 1 3557 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:16'
mysqld-bin.000001 3557 Query 1 3620 BEGIN
mysqld-bin.000001 3620 Query 1 3684 COMMIT
mysqld-bin.000001 3684 Gtid 1 3732 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:17'
mysqld-bin.000001 3732 Query 1 3795 BEGIN
mysqld-bin.000001 3795 Table_map 1 3841 table_id: ### (test1.t1)
mysqld-bin.000001 3841 Write_rows 1 3881 table_id: ### flags: STMT_END_F
mysqld-bin.000001 3881 Xid 1 3912 COMMIT /* xid=### */
mysqld-bin.000001 3912 Gtid 1 3960 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:18'
mysqld-bin.000001 3960 Query 1 4023 BEGIN
mysqld-bin.000001 4023 Query 1 4087 COMMIT
mysqld-bin.000001 4087 Gtid 1 4135 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:19'
mysqld-bin.000001 4135 Query 1 4198 BEGIN
mysqld-bin.000001 4198 Table_map 1 4244 table_id: ### (test1.t1)
mysqld-bin.000001 4244 Write_rows 1 4284 table_id: ### flags: STMT_END_F
mysqld-bin.000001 4284 Xid 1 4315 COMMIT /* xid=### */
mysqld-bin.000001 4315 Gtid 1 4363 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:20'
mysqld-bin.000001 4363 Query 1 4426 BEGIN
mysqld-bin.000001 4426 Query 1 4490 COMMIT
mysqld-bin.000001 4490 Gtid 1 4538 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:21'
mysqld-bin.000001 4538 Query 1 4601 BEGIN
mysqld-bin.000001 4601 Table_map 1 4647 table_id: ### (test1.t1)
mysqld-bin.000001 4647 Write_rows 1 4687 table_id: ### flags: STMT_END_F
mysqld-bin.000001 4687 Xid 1 4718 COMMIT /* xid=### */
mysqld-bin.000001 4718 Gtid 1 4766 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:22'
mysqld-bin.000001 4766 Query 1 4829 BEGIN
mysqld-bin.000001 4829 Query 1 4893 COMMIT
mysqld-bin.000001 4893 Gtid 1 4941 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:23'
mysqld-bin.000001 4941 Query 1 5004 BEGIN
mysqld-bin.000001 5004 Table_map 1 5050 table_id: ### (test1.t1)
mysqld-bin.000001 5050 Write_rows 1 5090 table_id: ### flags: STMT_END_F
mysqld-bin.000001 5090 Xid 1 5121 COMMIT /* xid=### */
mysqld-bin.000001 5121 Gtid 1 5169 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:24'
mysqld-bin.000001 5169 Query 1 5232 BEGIN
mysqld-bin.000001 5232 Query 1 5296 COMMIT
mysqld-bin.000001 5296 Gtid 1 5344 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:25'
mysqld-bin.000001 5344 Query 1 5407 BEGIN
mysqld-bin.000001 5407 Table_map 1 5453 table_id: ### (test1.t1)
mysqld-bin.000001 5453 Write_rows 1 5493 table_id: ### flags: STMT_END_F
mysqld-bin.000001 5493 Xid 1 5524 COMMIT /* xid=### */
mysqld-bin.000001 5524 Gtid 1 5572 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:26'
mysqld-bin.000001 5572 Query 1 5635 BEGIN
mysqld-bin.000001 5635 Query 1 5699 COMMIT
mysqld-bin.000001 5699 Gtid 1 5747 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:27'
mysqld-bin.000001 5747 Query 1 5810 BEGIN
mysqld-bin.000001 5810 Table_map 1 5856 table_id: ### (test1.t1)
mysqld-bin.000001 5856 Write_rows 1 5896 table_id: ### flags: STMT_END_F
mysqld-bin.000001 5896 Xid 1 5927 COMMIT /* xid=### */
mysqld-bin.000001 5927 Gtid 1 5975 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:28'
mysqld-bin.000001 5975 Query 1 6038 BEGIN
mysqld-bin.000001 6038 Query 1 6102 COMMIT
mysqld-bin.000001 6102 Gtid 1 6150 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:29'
mysqld-bin.000001 6150 Query 1 6213 BEGIN
mysqld-bin.000001 6213 Table_map 1 6259 table_id: ### (test1.t1)
mysqld-bin.000001 6259 Write_rows 1 6299 table_id: ### flags: STMT_END_F
mysqld-bin.000001 6299 Xid 1 6330 COMMIT /* xid=### */
mysqld-bin.000001 6330 Gtid 1 6378 SET @@SESSION.GTID_NEXT= '<effective_uuid_1>:30'
mysqld-bin.000001 6378 Query 1 6441 BEGIN
mysqld-bin.000001 6441 Query 1 6505 COMMIT
DROP SCHEMA test1;
DROP SCHEMA test2;
STOP SLAVE;
RESET SLAVE ALL;
CALL mtr.add_suppression("GTID replication failed");
CALL mtr.add_suppression("Slave SQL: Error in Xid_log_event: Commit could not be completed");
CALL mtr.add_suppression("Slave SQL: Node has dropped from cluster, Error_code: 1047");
CALL mtr.add_suppression("TO isolation failed for");
CALL mtr.add_suppression("Slave SQL: Error 'Deadlock found when trying to get lock; try restarting transaction' on query");
CALL mtr.add_suppression("Slave SQL: Error 'WSREP has not yet prepared node for application use' on query");
CALL mtr.add_suppression("Slave: WSREP has not yet prepared node for application use Error_code: 1047");

View File

@ -11,19 +11,19 @@ SET SESSION wsrep_OSU_method = "RSU";
ALTER TABLE t1 ADD PRIMARY KEY (f1);
SET SESSION wsrep_OSU_method = "TOI";
INSERT INTO t1 (f1) SELECT 200000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
SELECT COUNT(*) = 300000 FROM t1;
COUNT(*) = 300000
1
SELECT MAX(f1) = 299999 FROM t1;
MAX(f1) = 299999
1
SELECT COUNT(*) AS EXPECT_300000 FROM t1;
EXPECT_300000
300000
SELECT MAX(f1) AS EXPECT_299999 FROM t1;
EXPECT_299999
299999
connection node_1;
SELECT COUNT(*) = 300000 FROM t1;
COUNT(*) = 300000
1
SELECT MAX(f1) = 299999 FROM t1;
MAX(f1) = 299999
1
SELECT COUNT(*) AS EXPECT_300000 FROM t1;
EXPECT_300000
300000
SELECT MAX(f1) AS EXPECT_299999 FROM t1;
EXPECT_299999
299999
SET SESSION wsrep_OSU_method = "RSU";
ALTER TABLE t1 ADD PRIMARY KEY (f1);
SET SESSION wsrep_OSU_method = "TOI";

View File

@ -0,0 +1,101 @@
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2a;
connection node_2;
connection node_1;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connection node_3;
SET GLOBAL wsrep_on=OFF;
RESET MASTER;
SET GLOBAL wsrep_on=ON;
connection node_2a;
START SLAVE;
connection node_3;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) engine=innodb;
INSERT INTO t1 VALUES (1, 'a');
INSERT INTO t1 VALUES (3, 'a');
set binlog_format=STATEMENT;
SET AUTOCOMMIT=ON;
START TRANSACTION;
SELECT * FROM t1 FOR UPDATE;
f1 f2
1 a
3 a
UPDATE t1 SET f2 = 'c' WHERE f1 > 1;
connection node_2a;
SET SESSION wsrep_sync_wait = 0;
connection node_1;
SET SESSION wsrep_sync_wait = 0;
connection node_2a;
SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
connection node_1;
INSERT INTO test.t1 VALUES (2, 'b');
connection node_3;
COMMIT;
connection node_2a;
SET SESSION wsrep_on = 0;
SET SESSION wsrep_on = 1;
SET GLOBAL debug_dbug = "";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
connection node_2a;
SET GLOBAL wsrep_provider_options = 'dbug=';
SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
connection node_3;
SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'a';
COUNT(*) = 1
1
SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
COUNT(*) = 1
1
SELECT * FROM t1;
f1 f2
1 a
3 c
connection node_2a;
set session wsrep_sync_wait=15;
set session wsrep_sync_wait=0;
wsrep_local_replays
1
SELECT * FROM t1;
f1 f2
1 a
2 b
3 c
SET DEBUG_SYNC = "RESET";
#
# test phase with real abort
#
connection node_3;
set binlog_format=ROW;
insert into t1 values (4, 'd');
SET AUTOCOMMIT=ON;
START TRANSACTION;
UPDATE t1 SET f2 = 'd' WHERE f1 = 3;
connection node_2a;
SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync';
SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
connection node_3;
UPDATE test.t1 SET f2 = 'e' WHERE f1 = 3;
connection node_3;
COMMIT;
connection node_2a;
SET GLOBAL debug_dbug = "";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
connection node_2a;
SET GLOBAL wsrep_provider_options = 'dbug=';
SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync';
SET DEBUG_SYNC = "RESET";
connection node_2a;
set session wsrep_sync_wait=15;
SELECT COUNT(*) = 1 FROM test.t1 WHERE f2 = 'e';
COUNT(*) = 1
1
set session wsrep_sync_wait=0;
STOP SLAVE;
RESET SLAVE;
DROP TABLE t1;
connection node_3;
DROP TABLE t1;
SET GLOBAL wsrep_on=OFF;
RESET MASTER;
SET GLOBAL wsrep_on=ON;

View File

@ -1,11 +1,11 @@
connection node_1;
SET SESSION wsrep_sync_wait=15;
SELECT COUNT(DISTINCT uuid) FROM mtr_wsrep_notify.membership;
COUNT(DISTINCT uuid)
SELECT COUNT(DISTINCT uuid) AS EXPECT_2 FROM mtr_wsrep_notify.membership;
EXPECT_2
2
SELECT MAX(size) FROM mtr_wsrep_notify.status;
MAX(size)
SELECT MAX(size) AS EXPECT_2 FROM mtr_wsrep_notify.status;
EXPECT_2
2
SELECT COUNT(DISTINCT idx) FROM mtr_wsrep_notify.status;
COUNT(DISTINCT idx)
1
SELECT COUNT(DISTINCT idx) AS EXPECT_2 FROM mtr_wsrep_notify.status;
EXPECT_2
2
DROP SCHEMA mtr_wsrep_notify;

View File

@ -27,7 +27,7 @@ VARIABLE_VALUE = 'ON'
1
SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
VARIABLE_VALUE = 0
0
1
SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
VARIABLE_VALUE = 'ON'
1

View File

@ -5,18 +5,13 @@ CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
connection node_2;
SET session wsrep_sync_wait=0;
SET session wsrep_causal_reads=OFF;
Warnings:
Warning 1287 '@@wsrep_causal_reads' is deprecated and will be removed in a future release. Please use '@@wsrep_sync_wait=1' instead
FLUSH TABLE WITH READ LOCK;
connection node_1;
ALTER TABLE t1 ADD COLUMN f2 INTEGER;
INSERT INTO t1 VALUES (2,3);
connection node_2a;
SET session wsrep_sync_wait=0;
SET session wsrep_causal_reads=OFF;
Warnings:
Warning 1287 '@@wsrep_causal_reads' is deprecated and will be removed in a future release. Please use '@@wsrep_sync_wait=1' instead
# node_1 DDL should not yet be applied
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -26,6 +21,7 @@ t1 CREATE TABLE `t1` (
FLUSH TABLES t1 WITH READ LOCK;;
connection node_2;
UNLOCK TABLES;
# node_1 DDL should not yet be applied 2
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
@ -34,6 +30,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
connection node_2a;
UNLOCK TABLES;
# node_1 DDL should be applied 2
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (

View File

@ -1,15 +0,0 @@
!include ../galera_2nodes_as_master.cnf
[mysqld]
log-bin=mysqld-bin
log-slave-updates
binlog-format=ROW
[mysqld.1]
gtid-domain-id=1
wsrep_gtid_mode=1
wsrep_gtid_domain_id=100
[mysqld.2]
gtid-domain-id=1
wsrep_gtid_mode=1
[mysqld.3]
gtid-domain-id=2

View File

@ -1,65 +0,0 @@
#
# Test Galera as a master to a MySQL slave with GTID
#
# The galera/galera_2node_master.cnf describes the setup of the nodes
#
# We check that all transactions originating from within Galera use a UUID that is
# different from the server_uuid of either node
#
#
--source include/have_innodb.inc
--source include/have_log_bin.inc
--source include/galera_cluster.inc
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--disable_query_log
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1;
--enable_query_log
START SLAVE;
--connection node_1
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
SELECT @@global.gtid_binlog_pos;
--let $effective_gtid = @@global.gtid_binlog_pos
--connection node_2
INSERT INTO t1 VALUES(2);
--disable_query_log
--eval SELECT '$effective_gtid' != @@global.gtid_binlog_pos AS gtid_do_not_match;
--enable_query_log
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
--source include/wait_condition.inc
--disable_query_log
--eval SELECT '$effective_gtid' != @@global.gtid_binlog_pos AS gtid_do_not_match;
--enable_query_log
--connection node_1
DROP TABLE t1;
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--connection node_1
--let $gtid_executed_node1 = `SELECT @@global.gtid_binlog_pos;`
--connection node_2
--disable_query_log
--eval SELECT '$gtid_executed_node1' = @@global.gtid_binlog_pos AS gtid_executed_equal
--enable_query_log
--connection node_3
--disable_query_log
--eval SELECT '$gtid_executed_node1' = @@global.gtid_binlog_pos AS gtid_executed_equal
--enable_query_log
STOP SLAVE;
RESET SLAVE ALL;

View File

@ -1,6 +0,0 @@
!include ../galera_2nodes_as_master.cnf
[mysqld]
log-bin=mysqld-bin
log-slave-updates
binlog-format=ROW

View File

@ -1,67 +0,0 @@
#
# Test that a MySQL slave can use CHANGE MASTER MASTER_AUTO_POSITION to begin replicating
# from another Galera node
#
# The galera/galera_2node_master.cnf describes the setup of the nodes
#
#
--source include/have_innodb.inc
--source include/have_log_bin.inc
--source include/galera_cluster.inc
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--disable_query_log
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1;
--enable_query_log
START SLAVE;
--connection node_1
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
--connection node_2
INSERT INTO t1 VALUES(2);
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
STOP SLAVE;
--disable_query_log
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_2, MASTER_USER='root';
--enable_query_log
START SLAVE;
--connection node_1
INSERT INTO t1 VALUES(3);
--connection node_2
INSERT INTO t1 VALUES(4);
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 4 FROM t1;
--source include/wait_condition.inc
--connection node_1
DROP TABLE t1;
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
STOP SLAVE;
RESET SLAVE ALL;
RESET MASTER;
--connection node_2
SET GLOBAL wsrep_on=OFF;
RESET MASTER;
SET GLOBAL wsrep_on=ON;
--connection node_1
SET GLOBAL wsrep_on=OFF;
RESET MASTER;
SET GLOBAL wsrep_on=ON;

View File

@ -14,6 +14,7 @@
--source include/have_innodb.inc
--source include/have_log_bin.inc
--source include/galera_cluster.inc
SELECT @@WSREP_ON;
# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
# we open the node_3 connection here

View File

@ -1,17 +0,0 @@
!include ../galera_2nodes_as_slave.cnf
[mysqld]
#gtid-mode=ON
log-bin=master-bin
log-bin-index=master-bin
log-slave-updates
#enforce-gtid-consistency
binlog-format=ROW
[mysqld.2]
replicate-do-db=test1
replicate-wild-do-table=test1.%
[mysqld.3]
replicate-do-db=test1
replicate-wild-do-table=test1.%

View File

@ -1,161 +0,0 @@
#
# Test Galera as a slave to a MySQL master using GTIDs
#
--source include/have_innodb.inc
--source include/galera_cluster.inc
--source include/have_log_bin.inc
# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
# we open the node_3 connection here
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_1
SET global wsrep_on=OFF;
RESET MASTER;
SET global wsrep_on=ON;
--connection node_3
RESET MASTER;
--connection node_2
SET global wsrep_on=OFF;
RESET MASTER;
SET global wsrep_on=ON;
--disable_query_log
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_3, MASTER_USER='root';
--enable_query_log
START SLAVE;
--connection node_3
CREATE SCHEMA test1;
CREATE SCHEMA test2;
USE test1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY,f2 CHAR(5) DEFAULT 'abc') ENGINE=InnoDB;
USE test2;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY,f2 CHAR(5) DEFAULT 'abc') ENGINE=InnoDB;
#
# First , some autocommit stuff
#
# Simple inserts
INSERT INTO test1.t1 (f1) VALUES (1);
INSERT INTO test2.t1 (f1) VALUES (1);
INSERT INTO test1.t1 (f1) VALUES (2);
INSERT INTO test2.t1 (f1) VALUES (2);
INSERT INTO test1.t1 (f1) VALUES (3);
INSERT INTO test2.t1 (f1) VALUES (3);
# Update that only covers test2.t1
UPDATE test2.t1 SET test2.t1.f2 = 'cde';
# Multi-table UPDATE
UPDATE test1.t1, test2.t1 SET test1.t1.f2 = 'klm', test2.t1.f2 = 'xyz';
# Multi-table DELETE
DELETE test1.t1, test2.t1 FROM test1.t1 INNER JOIN test2.t1 WHERE test1.t1.f1 = test2.t1.f1 AND test1.t1.f1 = 3;
#
# Multi-statement transactions
#
# Transaction which is not replicated at all
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO test2.t1 (f1) VALUES (999);
INSERT INTO test2.t1 (f1) VALUES (9999);
COMMIT;
# Transaction that is completely replicated
START TRANSACTION;
INSERT INTO test1.t1 (f1) VALUES (111);
INSERT INTO test1.t1 (f1) VALUES (222);
COMMIT;
# Transaction that is partially replicated
START TRANSACTION;
INSERT INTO test1.t1 (f1) VALUES (333);
INSERT INTO test2.t1 (f1) VALUES (99999);
COMMIT;
#
# Make sure binary logs and gtid_executed strings are equal
#
--sleep 2
--connection node_2
--let $effective_uuid = `SELECT LEFT(@@global.gtid_current_pos, 36)`
--let $gtid_executed_node2 = `SELECT @@global.gtid_current_pos;`
--replace_result $effective_uuid <effective_uuid>
--replace_regex /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/
SHOW BINLOG EVENTS IN 'master-bin.000001' FROM 256;
--connection node_1
--disable_query_log
--eval SELECT '$gtid_executed_node2' = @@global.gtid_current_pos AS gtid_executed_equal;
--enable_query_log
--replace_result $effective_uuid <effective_uuid>
--replace_regex /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/
SHOW BINLOG EVENTS IN 'master-bin.000001' FROM 256;
#
# Final consistency checks
#
--let $diff_servers = 1 2
--source include/diff_servers.inc
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
SELECT COUNT(*) = 2 FROM test1.t1 WHERE f1 IN (1,2);
SELECT COUNT(*) = 3 FROM test1.t1 WHERE f1 IN (111,222,333);
SELECT COUNT(*) = 2 FROM test1.t1 WHERE f2 = 'klm';
--error 1049
USE test2;
#
# Cleanup
#
--connection node_3
DROP SCHEMA test1;
DROP SCHEMA test2;
--sleep 1
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
STOP SLAVE;
RESET SLAVE ALL;
SET GLOBAL wsrep_on=OFF;
RESET MASTER;
SET GLOBAL wsrep_on=ON;
--connection node_1
SET GLOBAL wsrep_on=OFF;
RESET MASTER;
SET GLOBAL wsrep_on=ON;
--connection node_3
RESET MASTER;

View File

@ -1,159 +0,0 @@
#
# Test the case where a Galera slave to async replication goes non-prim while
# a stream of replication events including filtered events is arriving
#
--source include/have_innodb.inc
--source include/have_log_bin.inc
--source include/big_test.inc
--source include/galera_cluster.inc
# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
# we open the node_3 connection here
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
SELECT @@wsrep_on;
RESET MASTER;
--connection node_1
# make sure gtid_slave_pos is of innodb engine, mtr does not currently provide that
ALTER TABLE mysql.gtid_slave_pos engine = InnoDB;
--connection node_1
--disable_query_log
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3;
--enable_query_log
START SLAVE;
--connection node_3
CREATE SCHEMA test1;
CREATE SCHEMA test2;
USE test1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
USE test2;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
INSERT INTO test1.t1 (f1) VALUES (1);
INSERT INTO test2.t1 (f1) VALUES (1);
INSERT INTO test1.t1 (f1) VALUES (2);
INSERT INTO test2.t1 (f1) VALUES (2);
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM test1.t1;
--source include/wait_condition.inc
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
--connection node_3
INSERT INTO test1.t1 (f1) VALUES (3);
INSERT INTO test2.t1 (f1) VALUES (3);
INSERT INTO test1.t1 (f1) VALUES (3);
INSERT INTO test2.t1 (f1) VALUES (3);
INSERT INTO test1.t1 (f1) VALUES (3);
INSERT INTO test2.t1 (f1) VALUES (3);
INSERT INTO test1.t1 (f1) VALUES (3);
INSERT INTO test2.t1 (f1) VALUES (3);
--connection node_1
SET SESSION wsrep_on=OFF;
--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_cluster_status';
--source include/wait_condition.inc
--let $slave_sql_errno = 1047
--source include/wait_for_slave_sql_error.inc
--connection node_3
INSERT INTO test1.t1 (f1) VALUES (4);
INSERT INTO test2.t1 (f1) VALUES (4);
INSERT INTO test1.t1 (f1) VALUES (4);
INSERT INTO test2.t1 (f1) VALUES (4);
INSERT INTO test1.t1 (f1) VALUES (4);
INSERT INTO test2.t1 (f1) VALUES (4);
INSERT INTO test1.t1 (f1) VALUES (4);
INSERT INTO test2.t1 (f1) VALUES (4);
INSERT INTO test1.t1 (f1) VALUES (4);
INSERT INTO test2.t1 (f1) VALUES (4);
--connection node_1
SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
--connection node_3
INSERT INTO test1.t1 (f1) VALUES (5);
INSERT INTO test2.t1 (f1) VALUES (5);
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_cluster_status';
--source include/wait_condition.inc
SET SESSION wsrep_on=ON;
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_ready';
--source include/wait_condition.inc
--connection node_3
INSERT INTO test1.t1 (f1) VALUES (6);
INSERT INTO test2.t1 (f1) VALUES (6);
--connection node_1
START SLAVE;
#
# Consistency checks
#
--connection node_1
--let $wait_condition = SELECT COUNT(DISTINCT f1) = 6 FROM test1.t1;
--source include/wait_condition.inc
--connection node_2
--let $wait_condition = SELECT COUNT(DISTINCT f1) = 6 FROM test1.t1;
--source include/wait_condition.inc
--connection node_1
SELECT LENGTH(@@global.gtid_binlog_state) > 1;
SELECT @@global.gtid_binlog_state;
--let $gtid_binlog_state_node1 = `SELECT @@global.gtid_binlog_state;`
--error 1049
USE test2;
--connection node_3
SELECT @@global.gtid_binlog_state;
--disable_query_log
--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
--enable_query_log
--error 1049
USE test2;
--replace_result $effective_uuid_1 <effective_uuid_1> $effective_uuid_2 <effective_uuid_2>
--replace_regex /xid=[0-9]+/xid=###/ /table_id: [0-9]+/table_id: ###/
SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 120;
#
# Cleanup
#
--connection node_3
DROP SCHEMA test1;
DROP SCHEMA test2;
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--connection node_1
STOP SLAVE;
RESET SLAVE ALL;
CALL mtr.add_suppression("GTID replication failed");
CALL mtr.add_suppression("Slave SQL: Error in Xid_log_event: Commit could not be completed");
CALL mtr.add_suppression("Slave SQL: Node has dropped from cluster, Error_code: 1047");
CALL mtr.add_suppression("TO isolation failed for");
CALL mtr.add_suppression("Slave SQL: Error 'Deadlock found when trying to get lock; try restarting transaction' on query");
CALL mtr.add_suppression("Slave SQL: Error 'WSREP has not yet prepared node for application use' on query");
CALL mtr.add_suppression("Slave: WSREP has not yet prepared node for application use Error_code: 1047");

View File

@ -26,14 +26,20 @@ SET SESSION wsrep_OSU_method = "TOI";
# Insert values after the ALTER
INSERT INTO t1 (f1) SELECT 200000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;
--let $wait_condition = SELECT COUNT(*) = 300000 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) = 300000 FROM t1;
SELECT MAX(f1) = 299999 FROM t1;
SELECT COUNT(*) AS EXPECT_300000 FROM t1;
SELECT MAX(f1) AS EXPECT_299999 FROM t1;
--connection node_1
--reap
SELECT COUNT(*) = 300000 FROM t1;
SELECT MAX(f1) = 299999 FROM t1;
--let $wait_condition = SELECT COUNT(*) = 300000 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_300000 FROM t1;
SELECT MAX(f1) AS EXPECT_299999 FROM t1;
SET SESSION wsrep_OSU_method = "RSU";
ALTER TABLE t1 ADD PRIMARY KEY (f1);

View File

@ -0,0 +1,203 @@
#
# This test tests the operation of transaction replay for async replication slave.
# If a potentially conflicting galera transaction arrives at
# just the right time during the commit and has lock conflict with async replication transaction
# applied by slave SQL thread, then the async replication transaction should either abort
# or rollback and replay (depending on the nature of lock conflict).
#
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--connection node_2a
--source include/galera_cluster.inc
--source include/galera_have_debug_sync.inc
#
# node 3 is native MariaDB server operating as async replication master
#
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_3
SET GLOBAL wsrep_on=OFF;
RESET MASTER;
SET GLOBAL wsrep_on=ON;
--connection node_2a
#
# count the number of wsrep replay's done in the node
#
--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
#
# nodes 1 and 2 form a galera cluster, node 2 operates as slave for native MariaDB naster in node 3
#
--disable_query_log
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3;
--enable_query_log
START SLAVE;
--connection node_3
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)) engine=innodb;
INSERT INTO t1 VALUES (1, 'a');
INSERT INTO t1 VALUES (3, 'a');
#
# use statement format replication to cause a false positive conflict with async replication transaction
# and galera replication. The conflict will be on GAP lock, and slave SQL thread should rollback
# and replay
#
set binlog_format=STATEMENT;
SET AUTOCOMMIT=ON;
START TRANSACTION;
SELECT * FROM t1 FOR UPDATE;
UPDATE t1 SET f2 = 'c' WHERE f1 > 1;
--connection node_2a
# wait for create table and inserts to be replicated from master
SET SESSION wsrep_sync_wait = 0;
--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
--source include/wait_condition.inc
# wait for create table and inserts to be replicated in cluster
--connection node_1
SET SESSION wsrep_sync_wait = 0;
--let $wait_condition = SELECT COUNT(*) = 2 FROM test.t1;
--source include/wait_condition.inc
--connection node_2a
# Block the future commit of async replication
--let $galera_sync_point = commit_monitor_master_enter_sync
--source include/galera_set_sync_point.inc
# block also the applier before applying begins
SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
#
# now inject a conflicting insert from node 1, it will replicate with
# earlier seqno (than async transaction) and pause before applying in node 2
#
--connection node_1
INSERT INTO test.t1 VALUES (2, 'b');
#
# send the update from master, this will succeed here, beceuase of async replication.
# async replication will apply this in node 2 and pause before commit phase,
--connection node_3
--error 0
COMMIT;
# Wait until async slave commit is blocked in node_2
--connection node_2a
--source include/galera_wait_sync_point.inc
#
# release the applier
# note: have to clear wsrep_apply_cb sync point first, as async replication will go for replay
# and as this sync point, after BF applier is released to progress
#
SET GLOBAL debug_dbug = "";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
# Unblock the async slave commit
--connection node_2a
--source include/galera_clear_sync_point.inc
--source include/galera_signal_sync_point.inc
--connection node_3
SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'a';
SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c';
SELECT * FROM t1;
--connection node_2a
# wsrep_local_replays has increased by 1
set session wsrep_sync_wait=15;
--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'`
set session wsrep_sync_wait=0;
--disable_query_log
--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 1 AS wsrep_local_replays;
--enable_query_log
#
# replaying of async transaction should be effective, and row 3 having 'c' in f2
#
SELECT * FROM t1;
SET DEBUG_SYNC = "RESET";
#********************************************************************************
# test phase 2
#********************************************************************************
--echo #
--echo # test phase with real abort
--echo #
--connection node_3
set binlog_format=ROW;
insert into t1 values (4, 'd');
SET AUTOCOMMIT=ON;
START TRANSACTION;
UPDATE t1 SET f2 = 'd' WHERE f1 = 3;
--connection node_2a
# wait for the last insert to be replicated from master
--let $wait_condition = SELECT COUNT(*) = 4 FROM test.t1;
--source include/wait_condition.inc
# Block the commit
--let $galera_sync_point = commit_monitor_master_enter_sync
--source include/galera_set_sync_point.inc
# block applier
SET GLOBAL debug_dbug = "d,sync.wsrep_apply_cb";
# Inject a conflicting update from node 3
--connection node_3
UPDATE test.t1 SET f2 = 'e' WHERE f1 = 3;
# send the update from master
--connection node_3
--error 0
COMMIT;
--connection node_2a
# release the applier
SET GLOBAL debug_dbug = "";
SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
# Unblock the async slave commit
--connection node_2a
--source include/galera_clear_sync_point.inc
--source include/galera_signal_sync_point.inc
SET DEBUG_SYNC = "RESET";
--connection node_2a
set session wsrep_sync_wait=15;
SELECT COUNT(*) = 1 FROM test.t1 WHERE f2 = 'e';
set session wsrep_sync_wait=0;
STOP SLAVE;
RESET SLAVE;
DROP TABLE t1;
--connection node_3
DROP TABLE t1;
SET GLOBAL wsrep_on=OFF;
RESET MASTER;
SET GLOBAL wsrep_on=ON;

View File

@ -0,0 +1 @@
--wsrep_notify_cmd=$MYSQL_TEST_DIR/std_data/wsrep_notify.sh --wsrep-sync-wait=0

View File

@ -1,13 +0,0 @@
!include ../galera_2nodes.cnf
[mysqld.1]
wsrep_notify_cmd=$MYSQL_TEST_DIR/std_data/wsrep_notify.sh
wsrep-sync-wait=0
[mysqld.2]

View File

@ -4,9 +4,15 @@
#
--source include/galera_cluster.inc
--source include/force_restart.inc
--connection node_1
SET SESSION wsrep_sync_wait=15;
SELECT COUNT(DISTINCT uuid) FROM mtr_wsrep_notify.membership;
SELECT MAX(size) FROM mtr_wsrep_notify.status;
SELECT COUNT(DISTINCT idx) FROM mtr_wsrep_notify.status;
--let $wait_condition = SELECT COUNT(DISTINCT uuid) = 2 FROM mtr_wsrep_notify.membership;
--source include/wait_condition.inc
SELECT COUNT(DISTINCT uuid) AS EXPECT_2 FROM mtr_wsrep_notify.membership;
SELECT MAX(size) AS EXPECT_2 FROM mtr_wsrep_notify.status;
SELECT COUNT(DISTINCT idx) AS EXPECT_2 FROM mtr_wsrep_notify.status;
# CLEANUP
DROP SCHEMA mtr_wsrep_notify;

View File

@ -0,0 +1 @@
--wsrep-new-cluster

View File

@ -1,10 +0,0 @@
!include ../galera_2nodes.cnf
[mysqld.1]
wsrep-new-cluster
[mysqld.2]

View File

@ -6,6 +6,19 @@
--source include/galera_cluster.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'on' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
@ -15,6 +28,19 @@ SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VAR
--connection node_2
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'on' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment';
--source include/wait_condition.inc
SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected';
SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';

View File

@ -17,7 +17,6 @@ INSERT INTO t1 VALUES (1);
--connection node_2
SET session wsrep_sync_wait=0;
SET session wsrep_causal_reads=OFF;
FLUSH TABLE WITH READ LOCK;
--connection node_1
@ -26,26 +25,32 @@ INSERT INTO t1 VALUES (2,3);
--connection node_2a
SET session wsrep_sync_wait=0;
SET session wsrep_causal_reads=OFF;
--echo # node_1 DDL should not yet be applied
SHOW CREATE TABLE t1;
--sleep 1
--send FLUSH TABLES t1 WITH READ LOCK;
--connection node_2
# let the flush table wait in pause state before we unlock
# table otherwise there is window where-in flush table is
# yet to wait in pause and unlock allows alter table to proceed.
# this is because send in asynchronous.
--sleep 3
# this will release existing lock but will not resume
# the cluster as there is new FTRL that is still pausing it.
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%committed%';
--source include/wait_condition.inc
UNLOCK TABLES;
--echo # node_1 DDL should not yet be applied 2
SHOW CREATE TABLE t1;
--connection node_2a
--reap
UNLOCK TABLES;
--sleep 2
--let $wait_condition = SELECT COUNT(*) = 2 FROM t1;
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'test' AND TABLE_NAME = 't1';
--source include/wait_condition.inc
--echo # node_1 DDL should be applied 2
SHOW CREATE TABLE t1;
SELECT * from t1;

View File

@ -59,10 +59,10 @@ a
869751
select * from t1 where a in (869751,736494,226312,802616);
a
869751
736494
226312
736494
802616
869751
alter table t1 engine=myisam;
explain select * from t1 where a in (869751,736494,226312,802616);
id select_type table type possible_keys key key_len ref rows Extra
@ -178,7 +178,7 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range btn btn 10 NULL 1 Using where
explain select * from t1 where btn like "h%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL btn NULL NULL NULL # Using where
1 SIMPLE t1 range btn btn 10 NULL # Using where
explain select * from t1 where btn like "a%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range btn btn 10 NULL 1 Using where
@ -350,11 +350,11 @@ insert into t1 values (869751),(736494),(226312),(802616),(728912);
alter table t1 add unique uniq_id using BTREE (a);
select 0+a from t1 where a > 736494;
0+a
869751
802616
869751
explain select 0+a from t1 where a > 736494;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL uniq_id NULL NULL NULL 5 Using where
1 SIMPLE t1 range uniq_id uniq_id 8 NULL 3 Using where
select 0+a from t1 where a = 736494;
0+a
736494
@ -370,13 +370,13 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uniq_id uniq_id 8 NULL 2 Using where
select 0+a from t1 where a in (869751,736494,226312,802616);
0+a
869751
736494
226312
736494
802616
869751
explain select 0+a from t1 where a in (869751,736494,226312,802616);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL uniq_id NULL NULL NULL 5 Using where
1 SIMPLE t1 range uniq_id uniq_id 8 NULL 4 Using where
drop table t1;
End of 5.3 tests
create table t1 (id int, a varchar(300) not null, key using btree(a)) engine=heap;

View File

@ -428,14 +428,14 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range uniq_id uniq_id 8 NULL 2 Using where
select 0+a from t1 where a in (869751,736494,226312,802616,728912);
0+a
869751
736494
226312
802616
728912
736494
802616
869751
explain select 0+a from t1 where a in (869751,736494,226312,802616,728912);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL uniq_id NULL NULL NULL 5 Using where
1 SIMPLE t1 range uniq_id uniq_id 8 NULL 5 Using where
drop table t1;
End of 5.3 tests
#

View File

@ -1918,3 +1918,14 @@ check table t;
Table Op Msg_type Msg_text
test.t check status OK
drop table t;
#
# MDEV-20726: InnoDB: Assertion failure in file data0type.cc line 67
#
CREATE TABLE t (
id int(10) unsigned NOT NULL PRIMARY KEY,
a text CHARSET utf8mb3,
KEY a_idx(a(1))
) ENGINE=InnoDB;
INSERT INTO t VALUES (1, 'something in the air');
ALTER TABLE t MODIFY a text CHARSET utf8mb4;
DROP TABLE t;

View File

@ -74,7 +74,6 @@ select @a_key_returns_id = get_index_id(@table_id, 'a_key_returns'),
@a_key_returns_id = get_index_id(@table_id, 'a_key_returns') @b_key_id = get_index_id(@table_id, 'b_key') @c_key_id = get_index_id(@table_id, 'c_key2') @primary_id = get_index_id(@table_id, 'primary')
1 1 1 1
drop table t;
drop function get_index_id;
create table errors (
a int,
unique key a_key (a),
@ -183,3 +182,19 @@ CREATE TABLE t1 (f1 INT, f2 INT, f3 INT);
ALTER TABLE t1 ADD FOREIGN KEY f (f2) REFERENCES xx(f2);
ALTER TABLE t1 ADD FOREIGN KEY (f2) REFERENCES t1(f2), ADD KEY (f3), ADD KEY (f1);
DROP TABLE t1;
#
# MDEV-21669 InnoDB: Table ... contains <n> indexes inside InnoDB, which is different from the number of indexes <n> defined in the MariaDB
#
CREATE TABLE t1 (col_int INTEGER, col_char CHAR(20), col_varchar VARCHAR(500)) ENGINE=InnoDB;
SET @table_id = (SELECT table_id FROM information_schema.innodb_sys_tables WHERE name='test/t1');
ALTER TABLE t1 ADD KEY idx3 (col_varchar(9)), ADD KEY idX2 (col_char(9));
SET @idx3_key_id = get_index_id(@table_id, 'iDx3');
ALTER TABLE t1 DROP KEY iDx3, ADD KEY Idx3 (col_varchar(9));
SELECT @idx3_key_id = get_index_id(@table_id, 'Idx3');
@idx3_key_id = get_index_id(@table_id, 'Idx3')
1
CHECK TABLE t1 EXTENDED ;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
DROP FUNCTION get_index_id;

View File

@ -715,3 +715,18 @@ alter table t modify c varchar(10) collate latin1_general_cs, algorithm=instant;
check table t;
drop table t;
--echo #
--echo # MDEV-20726: InnoDB: Assertion failure in file data0type.cc line 67
--echo #
CREATE TABLE t (
id int(10) unsigned NOT NULL PRIMARY KEY,
a text CHARSET utf8mb3,
KEY a_idx(a(1))
) ENGINE=InnoDB;
INSERT INTO t VALUES (1, 'something in the air');
ALTER TABLE t MODIFY a text CHARSET utf8mb4;
DROP TABLE t;

View File

@ -73,7 +73,6 @@ select @a_key_returns_id = get_index_id(@table_id, 'a_key_returns'),
@primary_id = get_index_id(@table_id, 'primary');
drop table t;
drop function get_index_id;
create table errors (
a int,
@ -194,3 +193,17 @@ CREATE TABLE t1 (f1 INT, f2 INT, f3 INT);
ALTER TABLE t1 ADD FOREIGN KEY f (f2) REFERENCES xx(f2);
ALTER TABLE t1 ADD FOREIGN KEY (f2) REFERENCES t1(f2), ADD KEY (f3), ADD KEY (f1);
DROP TABLE t1;
--echo #
--echo # MDEV-21669 InnoDB: Table ... contains <n> indexes inside InnoDB, which is different from the number of indexes <n> defined in the MariaDB
--echo #
CREATE TABLE t1 (col_int INTEGER, col_char CHAR(20), col_varchar VARCHAR(500)) ENGINE=InnoDB;
SET @table_id = (SELECT table_id FROM information_schema.innodb_sys_tables WHERE name='test/t1');
ALTER TABLE t1 ADD KEY idx3 (col_varchar(9)), ADD KEY idX2 (col_char(9));
SET @idx3_key_id = get_index_id(@table_id, 'iDx3');
ALTER TABLE t1 DROP KEY iDx3, ADD KEY Idx3 (col_varchar(9));
SELECT @idx3_key_id = get_index_id(@table_id, 'Idx3');
CHECK TABLE t1 EXTENDED ;
DROP TABLE t1;
DROP FUNCTION get_index_id;

View File

@ -1,4 +1,5 @@
call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded");
call mtr.add_suppression("InnoDB: Table '.*' tablespace is set as discarded.");
call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded.");
CREATE TABLE mdev21563(f1 VARCHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB;
set debug_dbug="+d,fts_instrument_sync_request";
INSERT INTO mdev21563 VALUES('This is a test');

View File

@ -1,7 +1,8 @@
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/not_embedded.inc
call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded");
call mtr.add_suppression("InnoDB: Table '.*' tablespace is set as discarded.");
call mtr.add_suppression("InnoDB: Tablespace for table .* is set as discarded.");
CREATE TABLE mdev21563(f1 VARCHAR(100), FULLTEXT idx(f1))ENGINE=InnoDB;
set debug_dbug="+d,fts_instrument_sync_request";

View File

@ -327,3 +327,11 @@ disconnect con3;
disconnect con2;
disconnect con1;
connection default;
CREATE TABLE t1(
f1 INT, f2 VARCHAR(10) CHARSET ascii,
f3 CHAR(150) CHARSET ascii,
f4 TEXT CHARSET ascii)ENGINE=InnoDB
PARTITION BY RANGE(f1) (PARTITION p1 VALUES LESS THAN(10),
PARTITION p2 VALUES LESS THAN (100));
ALTER TABLE t1 convert to charset ascii collate ascii_bin, ALGORITHM=INSTANT;
DROP TABLE t1;

View File

@ -205,3 +205,13 @@ DROP TABLE t4;
--disconnect con1
--connection default
# End of Test #3
# MDEV-21693 ALGORITHM=INSTANT does not work for partitioned tables
CREATE TABLE t1(
f1 INT, f2 VARCHAR(10) CHARSET ascii,
f3 CHAR(150) CHARSET ascii,
f4 TEXT CHARSET ascii)ENGINE=InnoDB
PARTITION BY RANGE(f1) (PARTITION p1 VALUES LESS THAN(10),
PARTITION p2 VALUES LESS THAN (100));
ALTER TABLE t1 convert to charset ascii collate ascii_bin, ALGORITHM=INSTANT;
DROP TABLE t1;

View File

@ -53,7 +53,6 @@ IF (WIN32)
my_wincond.c
my_winerr.c
my_winfile.c
my_windac.c
my_conio.c
my_win_popen.cc)
ENDIF()
@ -103,7 +102,3 @@ SET_TARGET_PROPERTIES(thr_timer PROPERTIES COMPILE_FLAGS "-DMAIN")
ADD_EXECUTABLE(test_hash hash.c)
TARGET_LINK_LIBRARIES(test_hash mysys)
SET_TARGET_PROPERTIES(test_hash PROPERTIES COMPILE_FLAGS "-DMAIN")
IF(MSVC)
INSTALL_DEBUG_TARGET(mysys DESTINATION ${INSTALL_LIBDIR}/debug)
ENDIF()

View File

@ -56,6 +56,18 @@ static ElfW(Addr) offset= 0;
#define offset 0
#endif
#ifndef bfd_get_section_flags
#define bfd_get_section_flags(H, S) bfd_section_flags(S)
#endif /* bfd_get_section_flags */
#ifndef bfd_get_section_size
#define bfd_get_section_size(S) bfd_section_size(S)
#endif /* bfd_get_section_size */
#ifndef bfd_get_section_vma
#define bfd_get_section_vma(H, S) bfd_section_vma(S)
#endif /* bfd_get_section_vma */
/**
finds a file name, a line number, and a function name corresponding to addr.

View File

@ -873,6 +873,11 @@ void my_print_default_files(const char *conf_file)
char name[FN_REFLEN], **ext;
puts("\nDefault options are read from the following files in the given order:");
if (my_defaults_file)
{
puts(my_defaults_file);
return;
}
if (dirname_length(conf_file))
fputs(conf_file,stdout);
@ -897,7 +902,12 @@ void my_print_default_files(const char *conf_file)
if (**dirs)
pos= *dirs;
else if (my_defaults_extra_file)
{
pos= my_defaults_extra_file;
fputs(pos, stdout);
fputs(" ", stdout);
continue;
}
else
continue;
end= convert_dirname(name, pos, NullS);

View File

@ -21,30 +21,61 @@
#include <unistd.h>
#endif
#if defined(__FreeBSD__) && defined(HAVE_PTHREAD_GETAFFINITY_NP)
#include <pthread_np.h>
#include <sys/cpuset.h>
#endif
static int ncpus=0;
int my_getncpus()
int my_getncpus(void)
{
if (!ncpus)
{
/*
First attempt to get the total number of available cores. sysconf is
the fallback, but it can return a larger number. It will return the
total number of cores, not the ones available to the process - as
configured via core affinity.
*/
#if (defined(__linux__) || defined(__FreeBSD__)) && defined(HAVE_PTHREAD_GETAFFINITY_NP)
cpu_set_t set;
if (pthread_getaffinity_np(pthread_self(), sizeof(set), &set) == 0)
{
#ifdef CPU_COUNT
/* CPU_COUNT was introduced with glibc 2.6. */
ncpus= CPU_COUNT(&set);
#else
/* Implementation for platforms with glibc < 2.6 */
size_t i;
for (i= 0; i < CPU_SETSIZE; i++)
if (CPU_ISSET(i, &set))
ncpus++;
#endif
return ncpus;
}
#endif /* (__linux__ || __FreeBSD__) && HAVE_PTHREAD_GETAFFINITY_NP */
#ifdef _SC_NPROCESSORS_ONLN
ncpus= sysconf(_SC_NPROCESSORS_ONLN);
#elif defined(__WIN__)
SYSTEM_INFO sysinfo;
/*
* We are not calling GetNativeSystemInfo here because (1) we
* don't believe that they return different values for number
* of processors and (2) if WOW64 limits processors for Win32
* then we don't want to try to override that.
We are not calling GetNativeSystemInfo here because (1) we
don't believe that they return different values for number
of processors and (2) if WOW64 limits processors for Win32
then we don't want to try to override that.
*/
GetSystemInfo(&sysinfo);
ncpus= sysinfo.dwNumberOfProcessors;
#else
/* unknown so play safe: assume SMP and forbid uniprocessor build */
/* Unknown so play safe: assume SMP and forbid uniprocessor build */
ncpus= 2;
#endif
}
return ncpus;
}

View File

@ -1,202 +0,0 @@
/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
#include "mysys_priv.h"
#include "m_string.h"
#ifdef __WIN__
/*
Auxiliary structure to store pointers to the data which we need to keep
around while SECURITY_ATTRIBUTES is in use.
*/
typedef struct st_my_security_attr
{
PSID everyone_sid;
PACL dacl;
} My_security_attr;
/*
Allocate and initialize SECURITY_ATTRIBUTES setting up access
rights for the owner and group `Everybody'.
SYNOPSIS
my_security_attr_create()
psa [OUT] pointer to store the pointer to SA in
perror [OUT] pointer to store error message if there was an
error
owner_rights [IN] access rights for the owner
everyone_rights [IN] access rights for group Everybody
DESCRIPTION
Set up the security attributes to provide clients with sufficient
access rights to a kernel object. We need this function
because if we simply grant all access to everybody (by installing
a NULL DACL) a mailicious user can attempt a denial of service
attack by taking ownership over the kernel object. Upon successful
return `psa' contains a pointer to SECUIRITY_ATTRIBUTES that can be used
to create kernel objects with proper access rights.
RETURN
0 success, psa is 0 or points to a valid SA structure,
perror is left intact
!0 error, SA is set to 0, error message is stored in perror
*/
int my_security_attr_create(SECURITY_ATTRIBUTES **psa, const char **perror,
DWORD owner_rights, DWORD everyone_rights)
{
/* Top-level SID authority */
SID_IDENTIFIER_AUTHORITY world_auth= SECURITY_WORLD_SID_AUTHORITY;
PSID everyone_sid= 0;
HANDLE htoken= 0;
SECURITY_ATTRIBUTES *sa= 0;
PACL dacl= 0;
DWORD owner_token_length, dacl_length;
SECURITY_DESCRIPTOR *sd;
PTOKEN_USER owner_token;
PSID owner_sid;
My_security_attr *attr;
/*
Get SID of Everyone group. Easier to retrieve all SIDs each time
this function is called than worry about thread safety.
*/
if (! AllocateAndInitializeSid(&world_auth, 1, SECURITY_WORLD_RID,
0, 0, 0, 0, 0, 0, 0, &everyone_sid))
{
*perror= "Failed to retrieve the SID of Everyone group";
goto error;
}
/*
Get SID of the owner. Using GetSecurityInfo this task can be done
in just one call instead of five, but GetSecurityInfo declared in
aclapi.h, so I hesitate to use it.
SIC: OpenThreadToken works only if there is an active impersonation
token, hence OpenProcessToken is used.
*/
if (! OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &htoken))
{
*perror= "Failed to retrieve thread access token";
goto error;
}
GetTokenInformation(htoken, TokenUser, 0, 0, &owner_token_length);
if (! my_multi_malloc(MYF(MY_WME), PSI_INSTRUMENT_ME,
&sa, ALIGN_SIZE(sizeof(SECURITY_ATTRIBUTES)) +
sizeof(My_security_attr),
&sd, sizeof(SECURITY_DESCRIPTOR),
&owner_token, owner_token_length,
0))
{
*perror= "Failed to allocate memory for SECURITY_ATTRIBUTES";
goto error;
}
bzero(owner_token, owner_token_length);
if (! GetTokenInformation(htoken, TokenUser, owner_token,
owner_token_length, &owner_token_length))
{
*perror= "GetTokenInformation failed";
goto error;
}
owner_sid= owner_token->User.Sid;
if (! IsValidSid(owner_sid))
{
*perror= "IsValidSid failed";
goto error;
}
/* Calculate the amount of memory that must be allocated for the DACL */
dacl_length= sizeof(ACL) + (sizeof(ACCESS_ALLOWED_ACE)-sizeof(DWORD)) * 2 +
GetLengthSid(everyone_sid) + GetLengthSid(owner_sid);
/* Create an ACL */
if (! (dacl= (PACL) my_malloc(PSI_INSTRUMENT_ME, dacl_length, MYF(MY_ZEROFILL|MY_WME))))
{
*perror= "Failed to allocate memory for DACL";
goto error;
}
if (! InitializeAcl(dacl, dacl_length, ACL_REVISION))
{
*perror= "Failed to initialize DACL";
goto error;
}
if (! AddAccessAllowedAce(dacl, ACL_REVISION, everyone_rights, everyone_sid))
{
*perror= "Failed to set up DACL";
goto error;
}
if (! AddAccessAllowedAce(dacl, ACL_REVISION, owner_rights, owner_sid))
{
*perror= "Failed to set up DACL";
goto error;
}
if (! InitializeSecurityDescriptor(sd, SECURITY_DESCRIPTOR_REVISION))
{
*perror= "Could not initialize security descriptor";
goto error;
}
if (! SetSecurityDescriptorDacl(sd, TRUE, dacl, FALSE))
{
*perror= "Failed to install DACL";
goto error;
}
sa->nLength= sizeof(*sa);
sa->bInheritHandle= TRUE;
sa->lpSecurityDescriptor= sd;
/* Save pointers to everyone_sid and dacl to be able to clean them up */
attr= (My_security_attr*) (((char*) sa) + ALIGN_SIZE(sizeof(*sa)));
attr->everyone_sid= everyone_sid;
attr->dacl= dacl;
*psa= sa;
CloseHandle(htoken);
return 0;
error:
if (everyone_sid)
FreeSid(everyone_sid);
if (htoken)
CloseHandle(htoken);
my_free(sa);
my_free(dacl);
*psa= 0;
return 1;
}
/*
Cleanup security attributes freeing used memory.
SYNOPSIS
my_security_attr_free()
sa security attributes
*/
void my_security_attr_free(SECURITY_ATTRIBUTES *sa)
{
if (sa)
{
My_security_attr *attr= (My_security_attr*)
(((char*)sa) + ALIGN_SIZE(sizeof(*sa)));
FreeSid(attr->everyone_sid);
my_free(attr->dacl);
my_free(sa);
}
}
#endif /* __WIN__ */

View File

@ -1,10 +1,24 @@
INCLUDE (CheckIncludeFiles)
INCLUDE (CheckFunctionExists)
CHECK_INCLUDE_FILES (security/pam_ext.h HAVE_PAM_EXT_H)
CHECK_INCLUDE_FILES (security/pam_appl.h HAVE_PAM_APPL_H)
CHECK_FUNCTION_EXISTS (strndup HAVE_STRNDUP)
SET(CMAKE_REQUIRED_LIBRARIES pam)
CHECK_FUNCTION_EXISTS(pam_syslog HAVE_PAM_SYSLOG)
SET(CMAKE_REQUIRED_LIBRARIES)
IF(HAVE_PAM_SYSLOG)
ADD_DEFINITIONS(-DHAVE_PAM_SYSLOG)
ENDIF()
IF(HAVE_PAM_EXT_H)
ADD_DEFINITIONS(-DHAVE_PAM_EXT_H)
ENDIF()
IF(HAVE_PAM_APPL_H)
ADD_DEFINITIONS(-DHAVE_PAM_APPL_H)
IF(HAVE_STRNDUP)
ADD_DEFINITIONS(-DHAVE_STRNDUP)
ENDIF(HAVE_STRNDUP)

View File

@ -2,7 +2,7 @@
Pam module to change user names arbitrarily in the pam stack.
Compile as
gcc pam_user_map.c -shared -lpam -fPIC -o pam_user_map.so
Install as appropriate (for example, in /lib/security/).
@ -39,14 +39,36 @@ and usually end up in /var/log/secure file.
#include <grp.h>
#include <pwd.h>
#ifdef HAVE_PAM_EXT_H
#include <security/pam_ext.h>
#endif
#ifdef HAVE_PAM_APPL_H
#include <unistd.h>
#include <security/pam_appl.h>
#endif
#include <security/pam_modules.h>
#ifndef HAVE_PAM_SYSLOG
#include <stdarg.h>
static void
pam_syslog (const pam_handle_t *pamh, int priority,
const char *fmt, ...)
{
va_list args;
va_start (args, fmt);
vsyslog (priority, fmt, args);
va_end (args);
}
#endif
#define FILENAME "/etc/security/user_map.conf"
#define skip(what) while (*s && (what)) s++
#define SYSLOG_DEBUG if (mode_debug) pam_syslog
#define GROUP_BUFFER_SIZE 100
static const char debug_keyword[]= "debug";
static int populate_user_groups(const char *user, gid_t **groups)
{
@ -128,10 +150,6 @@ static void print_groups(pam_handle_t *pamh, const gid_t *user_groups, int ng)
ng, (ng == 1) ? "group" : "groups", buf+1);
}
static const char debug_keyword[]= "debug";
#define SYSLOG_DEBUG if (mode_debug) pam_syslog
int pam_sm_authenticate(pam_handle_t *pamh, int flags,
int argc, const char *argv[])
{

View File

@ -31,7 +31,4 @@ IF(WIN32)
LINK_LIBRARIES Secur32
MODULE_ONLY COMPONENT ClientPlugins)
#IF(MSVC)
# INSTALL_DEBUG_TARGET(auth_win_client DESTINATION ${INSTALL_LIBDIR}/debug)
#ENDIF()
ENDIF(WIN32)

View File

@ -1218,9 +1218,9 @@ Events::load_events_from_db(THD *thd)
#ifdef WITH_WSREP
/**
IF SST is done from a galera node that is also acting as MASTER
newly synced node in galera eco-system will also copy-over the event state
enabling duplicate event in galera eco-system.
If SST is done from a galera node that is also acting as MASTER
newly synced node in galera eco-system will also copy-over the
event state enabling duplicate event in galera eco-system.
DISABLE such events if the current node is not event orginator.
(Also, make sure you skip disabling it if is already disabled to avoid
creation of redundant action)
@ -1230,7 +1230,7 @@ Events::load_events_from_db(THD *thd)
Infact, based on galera use-case it seems like it recommends to have each
node with different server-id.
*/
if (et->originator != thd->variables.server_id)
if (WSREP(thd) && et->originator != thd->variables.server_id)
{
if (et->status == Event_parse_data::SLAVESIDE_DISABLED)
continue;

View File

@ -6317,9 +6317,10 @@ static bool partition_multi_range_key_skip_record(range_seq_t seq,
{
PARTITION_PART_KEY_MULTI_RANGE_HLD *hld=
(PARTITION_PART_KEY_MULTI_RANGE_HLD *)seq;
PARTITION_KEY_MULTI_RANGE *pkmr= (PARTITION_KEY_MULTI_RANGE *)range_info;
DBUG_ENTER("partition_multi_range_key_skip_record");
DBUG_RETURN(hld->partition->m_seq_if->skip_record(hld->partition->m_seq,
range_info, rowid));
pkmr->ptr, rowid));
}
@ -6328,9 +6329,10 @@ static bool partition_multi_range_key_skip_index_tuple(range_seq_t seq,
{
PARTITION_PART_KEY_MULTI_RANGE_HLD *hld=
(PARTITION_PART_KEY_MULTI_RANGE_HLD *)seq;
PARTITION_KEY_MULTI_RANGE *pkmr= (PARTITION_KEY_MULTI_RANGE *)range_info;
DBUG_ENTER("partition_multi_range_key_skip_index_tuple");
DBUG_RETURN(hld->partition->m_seq_if->skip_index_tuple(hld->partition->m_seq,
range_info));
pkmr->ptr));
}
ha_rows ha_partition::multi_range_read_info_const(uint keyno,
@ -11802,6 +11804,40 @@ void ha_partition::clear_top_table_fields()
DBUG_VOID_RETURN;
}
bool
ha_partition::can_convert_string(const Field_string* field,
const Column_definition& new_type) const
{
for (uint index= 0; index < m_tot_parts; index++)
{
if (!m_file[index]->can_convert_string(field, new_type))
return false;
}
return true;
}
bool
ha_partition::can_convert_varstring(const Field_varstring* field,
const Column_definition& new_type) const{
for (uint index= 0; index < m_tot_parts; index++)
{
if (!m_file[index]->can_convert_varstring(field, new_type))
return false;
}
return true;
}
bool
ha_partition::can_convert_blob(const Field_blob* field,
const Column_definition& new_type) const
{
for (uint index= 0; index < m_tot_parts; index++)
{
if (!m_file[index]->can_convert_blob(field, new_type))
return false;
}
return true;
}
struct st_mysql_storage_engine partition_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };

View File

@ -3,7 +3,7 @@
/*
Copyright (c) 2005, 2012, Oracle and/or its affiliates.
Copyright (c) 2009, 2013, Monty Program Ab & SkySQL Ab.
Copyright (c) 2009, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -224,7 +224,7 @@ typedef struct st_partition_key_multi_range
/*
List of ranges to be scanned in a certain [sub]partition.
List of ranges to be scanned in a certain [sub]partition
The idea is that there's a list of ranges to be scanned in the table
(formed by PARTITION_KEY_MULTI_RANGE structures),
@ -260,10 +260,10 @@ typedef struct st_partition_part_key_multi_range_hld
/* Owner object */
ha_partition *partition;
// id of the the partition this structure is for
/* id of the the partition this structure is for */
uint32 part_id;
// Current range we're iterating through.
/* Current range we're iterating through */
PARTITION_PART_KEY_MULTI_RANGE *partition_part_key_multi_range;
} PARTITION_PART_KEY_MULTI_RANGE_HLD;
@ -431,18 +431,18 @@ private:
/** Stores shared auto_increment etc. */
Partition_share *part_share;
/** Fix spurious -Werror=overloaded-virtual in GCC 9 */
virtual void restore_auto_increment(ulonglong prev_insert_id)
virtual void restore_auto_increment(ulonglong prev_insert_id) override
{
handler::restore_auto_increment(prev_insert_id);
}
/** Store and restore next_auto_inc_val over duplicate key errors. */
virtual void store_auto_increment()
void store_auto_increment() override
{
DBUG_ASSERT(part_share);
part_share->prev_auto_inc_val= part_share->next_auto_inc_val;
handler::store_auto_increment();
}
virtual void restore_auto_increment()
void restore_auto_increment() override
{
DBUG_ASSERT(part_share);
part_share->next_auto_inc_val= part_share->prev_auto_inc_val;
@ -450,7 +450,7 @@ private:
}
void sum_copy_info(handler *file);
void sum_copy_infos();
void reset_copy_info();
void reset_copy_info() override;
/** Temporary storage for new partitions Handler_shares during ALTER */
List<Parts_share_refs> m_new_partitions_share_refs;
/** Sorted array of partition ids in descending order of number of rows. */
@ -483,16 +483,16 @@ public:
return NO_CURRENT_PART_ID;
}
Partition_share *get_part_share() { return part_share; }
handler *clone(const char *name, MEM_ROOT *mem_root);
virtual void set_part_info(partition_info *part_info)
handler *clone(const char *name, MEM_ROOT *mem_root) override;
virtual void set_part_info(partition_info *part_info) override
{
m_part_info= part_info;
m_is_sub_partitioned= part_info->is_sub_partitioned();
}
virtual void return_record_by_parent();
void return_record_by_parent() override;
virtual bool vers_can_native(THD *thd)
bool vers_can_native(THD *thd) override
{
if (thd->lex->part_info)
{
@ -551,31 +551,30 @@ public:
object needed in opening the object in openfrm
-------------------------------------------------------------------------
*/
virtual int delete_table(const char *from);
virtual int rename_table(const char *from, const char *to);
virtual int create(const char *name, TABLE *form,
HA_CREATE_INFO *create_info);
virtual int create_partitioning_metadata(const char *name,
const char *old_name, int action_flag);
virtual void update_create_info(HA_CREATE_INFO *create_info);
virtual char *update_table_comment(const char *comment);
virtual int change_partitions(HA_CREATE_INFO *create_info,
const char *path,
ulonglong * const copied,
ulonglong * const deleted,
const uchar *pack_frm_data,
size_t pack_frm_len);
virtual int drop_partitions(const char *path);
virtual int rename_partitions(const char *path);
bool get_no_parts(const char *name, uint *num_parts)
int delete_table(const char *from) override;
int rename_table(const char *from, const char *to) override;
int create(const char *name, TABLE *form,
HA_CREATE_INFO *create_info) override;
int create_partitioning_metadata(const char *name,
const char *old_name, int action_flag)
override;
void update_create_info(HA_CREATE_INFO *create_info) override;
char *update_table_comment(const char *comment) override;
int change_partitions(HA_CREATE_INFO *create_info, const char *path,
ulonglong * const copied, ulonglong * const deleted,
const uchar *pack_frm_data, size_t pack_frm_len)
override;
int drop_partitions(const char *path) override;
int rename_partitions(const char *path) override;
bool get_no_parts(const char *, uint *num_parts) override
{
DBUG_ENTER("ha_partition::get_no_parts");
*num_parts= m_tot_parts;
DBUG_RETURN(0);
}
virtual void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share);
virtual bool check_if_incompatible_data(HA_CREATE_INFO *create_info,
uint table_changes);
void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) override;
bool check_if_incompatible_data(HA_CREATE_INFO *create_info,
uint table_changes) override;
void update_part_create_info(HA_CREATE_INFO *create_info, uint part_id)
{
m_file[part_id]->update_create_info(create_info);
@ -614,7 +613,7 @@ private:
bool is_subpart);
bool populate_partition_name_hash();
Partition_share *get_share();
bool set_ha_share_ref(Handler_share **ha_share);
bool set_ha_share_ref(Handler_share **ha_share) override;
void fix_data_dir(char* path);
bool init_partition_bitmaps();
void free_partition_bitmaps();
@ -634,8 +633,8 @@ public:
being used for normal queries (not before meta-data changes always.
If the object was opened it will also be closed before being deleted.
*/
virtual int open(const char *name, int mode, uint test_if_locked);
virtual int close(void);
int open(const char *name, int mode, uint test_if_locked) override;
int close() override;
/*
-------------------------------------------------------------------------
@ -650,31 +649,31 @@ public:
and these go directly to the handlers supporting transactions
-------------------------------------------------------------------------
*/
virtual THR_LOCK_DATA **store_lock(THD * thd, THR_LOCK_DATA ** to,
enum thr_lock_type lock_type);
virtual int external_lock(THD * thd, int lock_type);
LEX_CSTRING *engine_name() { return hton_name(partition_ht()); }
THR_LOCK_DATA **store_lock(THD * thd, THR_LOCK_DATA ** to,
enum thr_lock_type lock_type) override;
int external_lock(THD * thd, int lock_type) override;
LEX_CSTRING *engine_name() override { return hton_name(partition_ht()); }
/*
When table is locked a statement is started by calling start_stmt
instead of external_lock
*/
virtual int start_stmt(THD * thd, thr_lock_type lock_type);
int start_stmt(THD * thd, thr_lock_type lock_type) override;
/*
Lock count is number of locked underlying handlers (I assume)
*/
virtual uint lock_count(void) const;
uint lock_count() const override;
/*
Call to unlock rows not to be updated in transaction
*/
virtual void unlock_row();
void unlock_row() override;
/*
Check if semi consistent read
*/
virtual bool was_semi_consistent_read();
bool was_semi_consistent_read() override;
/*
Call to hint about semi consistent read
*/
virtual void try_semi_consistent_read(bool);
void try_semi_consistent_read(bool) override;
/*
NOTE: due to performance and resource issues with many partitions,
@ -708,28 +707,28 @@ public:
start_bulk_insert and end_bulk_insert is called before and after a
number of calls to write_row.
*/
virtual int write_row(const uchar * buf);
virtual bool start_bulk_update();
virtual int exec_bulk_update(ha_rows *dup_key_found);
virtual int end_bulk_update();
virtual int bulk_update_row(const uchar *old_data, const uchar *new_data,
ha_rows *dup_key_found);
virtual int update_row(const uchar * old_data, const uchar * new_data);
virtual int direct_update_rows_init(List<Item> *update_fields);
virtual int pre_direct_update_rows_init(List<Item> *update_fields);
virtual int direct_update_rows(ha_rows *update_rows, ha_rows *found_rows);
virtual int pre_direct_update_rows();
virtual bool start_bulk_delete();
virtual int end_bulk_delete();
virtual int delete_row(const uchar * buf);
virtual int direct_delete_rows_init();
virtual int pre_direct_delete_rows_init();
virtual int direct_delete_rows(ha_rows *delete_rows);
virtual int pre_direct_delete_rows();
virtual int delete_all_rows(void);
virtual int truncate();
virtual void start_bulk_insert(ha_rows rows, uint flags);
virtual int end_bulk_insert();
int write_row(const uchar * buf) override;
bool start_bulk_update() override;
int exec_bulk_update(ha_rows *dup_key_found) override;
int end_bulk_update() override;
int bulk_update_row(const uchar *old_data, const uchar *new_data,
ha_rows *dup_key_found) override;
int update_row(const uchar * old_data, const uchar * new_data) override;
int direct_update_rows_init(List<Item> *update_fields) override;
int pre_direct_update_rows_init(List<Item> *update_fields) override;
int direct_update_rows(ha_rows *update_rows, ha_rows *found_rows) override;
int pre_direct_update_rows() override;
bool start_bulk_delete() override;
int end_bulk_delete() override;
int delete_row(const uchar * buf) override;
int direct_delete_rows_init() override;
int pre_direct_delete_rows_init() override;
int direct_delete_rows(ha_rows *delete_rows) override;
int pre_direct_delete_rows() override;
int delete_all_rows() override;
int truncate() override;
void start_bulk_insert(ha_rows rows, uint flags) override;
int end_bulk_insert() override;
private:
ha_rows guess_bulk_insert_rows();
void start_part_bulk_insert(THD *thd, uint part_id);
@ -745,7 +744,7 @@ public:
*/
int truncate_partition(Alter_info *, bool *binlog_stmt);
virtual bool is_fatal_error(int error, uint flags)
bool is_fatal_error(int error, uint flags) override
{
if (!handler::is_fatal_error(error, flags) ||
error == HA_ERR_NO_PARTITION_FOUND ||
@ -780,12 +779,12 @@ public:
position it to the start of the table, no need to deallocate
and allocate it again
*/
virtual int rnd_init(bool scan);
virtual int rnd_end();
virtual int rnd_next(uchar * buf);
virtual int rnd_pos(uchar * buf, uchar * pos);
virtual int rnd_pos_by_record(uchar *record);
virtual void position(const uchar * record);
int rnd_init(bool scan) override;
int rnd_end() override;
int rnd_next(uchar * buf) override;
int rnd_pos(uchar * buf, uchar * pos) override;
int rnd_pos_by_record(uchar *record) override;
void position(const uchar * record) override;
/*
-------------------------------------------------------------------------
@ -819,11 +818,11 @@ public:
index_init initializes an index before using it and index_end does
any end processing needed.
*/
virtual int index_read_map(uchar * buf, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag);
virtual int index_init(uint idx, bool sorted);
virtual int index_end();
int index_read_map(uchar * buf, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag) override;
int index_init(uint idx, bool sorted) override;
int index_end() override;
/**
@breif
@ -831,36 +830,36 @@ public:
row if available. If the key value is null, begin at first key of the
index.
*/
virtual int index_read_idx_map(uchar *buf, uint index, const uchar *key,
key_part_map keypart_map,
enum ha_rkey_function find_flag);
int index_read_idx_map(uchar *buf, uint index, const uchar *key,
key_part_map keypart_map,
enum ha_rkey_function find_flag) override;
/*
These methods are used to jump to next or previous entry in the index
scan. There are also methods to jump to first and last entry.
*/
virtual int index_next(uchar * buf);
virtual int index_prev(uchar * buf);
virtual int index_first(uchar * buf);
virtual int index_last(uchar * buf);
virtual int index_next_same(uchar * buf, const uchar * key, uint keylen);
int index_next(uchar * buf) override;
int index_prev(uchar * buf) override;
int index_first(uchar * buf) override;
int index_last(uchar * buf) override;
int index_next_same(uchar * buf, const uchar * key, uint keylen) override;
int index_read_last_map(uchar *buf,
const uchar *key,
key_part_map keypart_map);
key_part_map keypart_map) override;
/*
read_first_row is virtual method but is only implemented by
handler.cc, no storage engine has implemented it so neither
will the partition handler.
virtual int read_first_row(uchar *buf, uint primary_key);
int read_first_row(uchar *buf, uint primary_key) override;
*/
virtual int read_range_first(const key_range * start_key,
const key_range * end_key,
bool eq_range, bool sorted);
virtual int read_range_next();
int read_range_first(const key_range * start_key,
const key_range * end_key,
bool eq_range, bool sorted) override;
int read_range_next() override;
HANDLER_BUFFER *m_mrr_buffer;
@ -870,28 +869,31 @@ public:
uint m_mrr_new_full_buffer_size;
MY_BITMAP m_mrr_used_partitions;
uint *m_stock_range_seq;
// not used: uint m_current_range_seq;
/* not used: uint m_current_range_seq; */
// Value of mrr_mode passed to ha_partition::multi_range_read_init
/* Value of mrr_mode passed to ha_partition::multi_range_read_init */
uint m_mrr_mode;
// Value of n_ranges passed to ha_partition::multi_range_read_init
/* Value of n_ranges passed to ha_partition::multi_range_read_init */
uint m_mrr_n_ranges;
/*
Ordered MRR mode: m_range_info[N] has the range_id of the last record that
we've got from partition N.
we've got from partition N
*/
range_id_t *m_range_info;
// TRUE <=> This ha_partition::multi_range_read_next() call is the first one
/*
TRUE <=> This ha_partition::multi_range_read_next() call is the first one
*/
bool m_multi_range_read_first;
// not used: uint m_mrr_range_init_flags;
/* not used: uint m_mrr_range_init_flags; */
/* Number of elements in the list pointed by m_mrr_range_first. Not used */
uint m_mrr_range_length;
// Linked list of ranges to scan
/* Linked list of ranges to scan */
PARTITION_KEY_MULTI_RANGE *m_mrr_range_first;
PARTITION_KEY_MULTI_RANGE *m_mrr_range_current;
@ -900,41 +902,39 @@ public:
*/
uint *m_part_mrr_range_length;
/*
For each partition: List of ranges to scan in this partition.
*/
/* For each partition: List of ranges to scan in this partition */
PARTITION_PART_KEY_MULTI_RANGE **m_part_mrr_range_first;
PARTITION_PART_KEY_MULTI_RANGE **m_part_mrr_range_current;
PARTITION_PART_KEY_MULTI_RANGE_HLD *m_partition_part_key_multi_range_hld;
/*
Sequence of ranges to be scanned (TODO: why not stores this in
Sequence of ranges to be scanned (TODO: why not store this in
handler::mrr_{iter,funcs}?)
*/
range_seq_t m_seq;
RANGE_SEQ_IF *m_seq_if;
// Range iterator structure to be supplied to partitions
/* Range iterator structure to be supplied to partitions */
RANGE_SEQ_IF m_part_seq_if;
virtual int multi_range_key_create_key(
RANGE_SEQ_IF *seq,
range_seq_t seq_it
);
virtual ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
void *seq_init_param,
uint n_ranges, uint *bufsz,
uint *mrr_mode,
Cost_estimate *cost);
virtual ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys,
uint key_parts, uint *bufsz,
uint *mrr_mode, Cost_estimate *cost);
virtual int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
uint n_ranges, uint mrr_mode,
HANDLER_BUFFER *buf);
virtual int multi_range_read_next(range_id_t *range_info);
virtual int multi_range_read_explain_info(uint mrr_mode, char *str,
size_t size);
ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq,
void *seq_init_param,
uint n_ranges, uint *bufsz,
uint *mrr_mode,
Cost_estimate *cost) override;
ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys,
uint key_parts, uint *bufsz,
uint *mrr_mode, Cost_estimate *cost) override;
int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param,
uint n_ranges, uint mrr_mode,
HANDLER_BUFFER *buf) override;
int multi_range_read_next(range_id_t *range_info) override;
int multi_range_read_explain_info(uint mrr_mode, char *str, size_t size)
override;
uint last_part() { return m_last_part; }
private:
@ -962,21 +962,20 @@ public:
purposes.
-------------------------------------------------------------------------
*/
virtual int info(uint);
void get_dynamic_partition_info(PARTITION_STATS *stat_info,
uint part_id);
void set_partitions_to_open(List<String> *partition_names);
int change_partitions_to_open(List<String> *partition_names);
int info(uint) override;
void get_dynamic_partition_info(PARTITION_STATS *stat_info, uint part_id)
override;
void set_partitions_to_open(List<String> *partition_names) override;
int change_partitions_to_open(List<String> *partition_names) override;
int open_read_partitions(char *name_buff, size_t name_buff_size);
virtual int extra(enum ha_extra_function operation);
virtual int extra_opt(enum ha_extra_function operation, ulong arg);
virtual int reset(void);
virtual uint count_query_cache_dependant_tables(uint8 *tables_type);
virtual my_bool
register_query_cache_dependant_tables(THD *thd,
Query_cache *cache,
Query_cache_block_table **block,
uint *n);
int extra(enum ha_extra_function operation) override;
int extra_opt(enum ha_extra_function operation, ulong arg) override;
int reset() override;
uint count_query_cache_dependant_tables(uint8 *tables_type) override;
my_bool register_query_cache_dependant_tables(THD *thd,
Query_cache *cache,
Query_cache_block_table **block,
uint *n) override;
private:
typedef int handler_callback(handler *, void *);
@ -1031,40 +1030,40 @@ public:
index-only scanning when performing an ORDER BY query.
Only called from one place in sql_select.cc
*/
virtual const key_map *keys_to_use_for_scanning();
const key_map *keys_to_use_for_scanning() override;
/*
Called in test_quick_select to determine if indexes should be used.
*/
virtual double scan_time();
double scan_time() override;
virtual double key_scan_time(uint inx);
double key_scan_time(uint inx) override;
virtual double keyread_time(uint inx, uint ranges, ha_rows rows);
double keyread_time(uint inx, uint ranges, ha_rows rows) override;
/*
The next method will never be called if you do not implement indexes.
*/
virtual double read_time(uint index, uint ranges, ha_rows rows);
double read_time(uint index, uint ranges, ha_rows rows) override;
/*
For the given range how many records are estimated to be in this range.
Used by optimiser to calculate cost of using a particular index.
*/
virtual ha_rows records_in_range(uint inx, key_range * min_key,
key_range * max_key);
ha_rows records_in_range(uint inx, key_range * min_key, key_range * max_key)
override;
/*
Upper bound of number records returned in scan is sum of all
underlying handlers.
*/
virtual ha_rows estimate_rows_upper_bound();
ha_rows estimate_rows_upper_bound() override;
/*
table_cache_type is implemented by the underlying handler but all
underlying handlers must have the same implementation for it to work.
*/
virtual uint8 table_cache_type();
virtual ha_rows records();
uint8 table_cache_type() override;
ha_rows records() override;
/* Calculate hash value for PARTITION BY KEY tables. */
static uint32 calculate_key_hash_value(Field **field_array);
@ -1082,19 +1081,19 @@ public:
Here we must ensure that all handlers use the same index type
for each index created.
*/
virtual const char *index_type(uint inx);
const char *index_type(uint inx) override;
/* The name of the table type that will be used for display purposes */
virtual const char *table_type() const;
const char *table_type() const;
/* The name of the row type used for the underlying tables. */
virtual enum row_type get_row_type() const;
enum row_type get_row_type() const override;
/*
Handler specific error messages
*/
virtual void print_error(int error, myf errflag);
virtual bool get_error_message(int error, String * buf);
void print_error(int error, myf errflag) override;
bool get_error_message(int error, String * buf) override;
/*
-------------------------------------------------------------------------
MODULE handler characteristics
@ -1248,7 +1247,7 @@ public:
HA_CAN_INSERT_DELAYED, HA_PRIMARY_KEY_REQUIRED_FOR_POSITION is disabled
until further investigated.
*/
virtual Table_flags table_flags() const;
Table_flags table_flags() const override;
/*
This is a bitmap of flags that says how the storage engine
@ -1306,7 +1305,7 @@ public:
must be updated in the row.
(InnoDB, MyISAM)
*/
virtual ulong index_flags(uint inx, uint part, bool all_parts) const
ulong index_flags(uint inx, uint part, bool all_parts) const override
{
/*
The following code is not safe if you are using different
@ -1319,7 +1318,8 @@ public:
wrapper function for handlerton alter_table_flags, since
the ha_partition_hton cannot know all its capabilities
*/
virtual alter_table_operations alter_table_flags(alter_table_operations flags);
alter_table_operations alter_table_flags(alter_table_operations flags)
override;
/*
unireg.cc will call the following to make sure that the storage engine
can handle the data it is about to send.
@ -1327,19 +1327,18 @@ public:
The maximum supported values is the minimum of all handlers in the table
*/
uint min_of_the_max_uint(uint (handler::*operator_func)(void) const) const;
virtual uint max_supported_record_length() const;
virtual uint max_supported_keys() const;
virtual uint max_supported_key_parts() const;
virtual uint max_supported_key_length() const;
virtual uint max_supported_key_part_length() const;
virtual uint min_record_length(uint options) const;
uint max_supported_record_length() const override;
uint max_supported_keys() const override;
uint max_supported_key_parts() const override;
uint max_supported_key_length() const override;
uint max_supported_key_part_length() const override;
uint min_record_length(uint options) const override;
/*
Primary key is clustered can only be true if all underlying handlers have
this feature.
*/
virtual bool primary_key_is_clustered()
{ return m_pkey_is_clustered; }
bool primary_key_is_clustered() override { return m_pkey_is_clustered; }
/*
-------------------------------------------------------------------------
@ -1357,7 +1356,7 @@ public:
to check whether the rest of the reference part is also the same.
-------------------------------------------------------------------------
*/
virtual int cmp_ref(const uchar * ref1, const uchar * ref2);
int cmp_ref(const uchar * ref1, const uchar * ref2) override;
/*
-------------------------------------------------------------------------
MODULE auto increment
@ -1371,15 +1370,15 @@ public:
auto_increment_column_changed
-------------------------------------------------------------------------
*/
virtual bool need_info_for_auto_inc();
virtual bool can_use_for_auto_inc_init();
virtual void get_auto_increment(ulonglong offset, ulonglong increment,
ulonglong nb_desired_values,
ulonglong *first_value,
ulonglong *nb_reserved_values);
virtual void release_auto_increment();
bool need_info_for_auto_inc() override;
bool can_use_for_auto_inc_init() override;
void get_auto_increment(ulonglong offset, ulonglong increment,
ulonglong nb_desired_values,
ulonglong *first_value,
ulonglong *nb_reserved_values) override;
void release_auto_increment() override;
private:
virtual int reset_auto_increment(ulonglong value);
int reset_auto_increment(ulonglong value) override;
void update_next_auto_inc_val();
virtual void lock_auto_increment()
{
@ -1441,7 +1440,7 @@ public:
This method is a special InnoDB method called before a HANDLER query.
-------------------------------------------------------------------------
*/
virtual void init_table_handle_for_HANDLER();
void init_table_handle_for_HANDLER() override;
/*
The remainder of this file defines the handler methods not implemented
@ -1469,20 +1468,20 @@ public:
List<FOREIGN_KEY_INFO> *f_key_list)
virtual uint referenced_by_foreign_key()
*/
virtual bool can_switch_engines();
bool can_switch_engines() override;
/*
-------------------------------------------------------------------------
MODULE fulltext index
-------------------------------------------------------------------------
*/
void ft_close_search(FT_INFO *handler);
virtual int ft_init();
virtual int pre_ft_init();
virtual void ft_end();
virtual int pre_ft_end();
virtual FT_INFO *ft_init_ext(uint flags, uint inx, String *key);
virtual int ft_read(uchar *buf);
virtual int pre_ft_read(bool use_parallel);
int ft_init() override;
int pre_ft_init() override;
void ft_end() override;
int pre_ft_end() override;
FT_INFO *ft_init_ext(uint flags, uint inx, String *key) override;
int ft_read(uchar *buf) override;
int pre_ft_read(bool use_parallel) override;
/*
-------------------------------------------------------------------------
@ -1490,7 +1489,7 @@ public:
-------------------------------------------------------------------------
The following method is only used by MyISAM when used as
temporary tables in a join.
virtual int restart_rnd_next(uchar *buf, uchar *pos);
int restart_rnd_next(uchar *buf, uchar *pos) override;
*/
/*
@ -1501,16 +1500,18 @@ public:
They are used for in-place alter table:
-------------------------------------------------------------------------
*/
virtual enum_alter_inplace_result
enum_alter_inplace_result
check_if_supported_inplace_alter(TABLE *altered_table,
Alter_inplace_info *ha_alter_info);
virtual bool prepare_inplace_alter_table(TABLE *altered_table,
Alter_inplace_info *ha_alter_info);
virtual bool inplace_alter_table(TABLE *altered_table,
Alter_inplace_info *ha_alter_info);
virtual bool commit_inplace_alter_table(TABLE *altered_table,
Alter_inplace_info *ha_alter_info,
bool commit);
Alter_inplace_info *ha_alter_info)
override;
bool prepare_inplace_alter_table(TABLE *altered_table,
Alter_inplace_info *ha_alter_info)
override;
bool inplace_alter_table(TABLE *altered_table,
Alter_inplace_info *ha_alter_info) override;
bool commit_inplace_alter_table(TABLE *altered_table,
Alter_inplace_info *ha_alter_info,
bool commit) override;
/*
-------------------------------------------------------------------------
MODULE tablespace support
@ -1533,24 +1534,24 @@ public:
all partitions.
-------------------------------------------------------------------------
*/
virtual int optimize(THD* thd, HA_CHECK_OPT *check_opt);
virtual int analyze(THD* thd, HA_CHECK_OPT *check_opt);
virtual int check(THD* thd, HA_CHECK_OPT *check_opt);
virtual int repair(THD* thd, HA_CHECK_OPT *check_opt);
virtual bool check_and_repair(THD *thd);
virtual bool auto_repair(int error) const;
virtual bool is_crashed() const;
virtual int check_for_upgrade(HA_CHECK_OPT *check_opt);
int optimize(THD* thd, HA_CHECK_OPT *check_opt) override;
int analyze(THD* thd, HA_CHECK_OPT *check_opt) override;
int check(THD* thd, HA_CHECK_OPT *check_opt) override;
int repair(THD* thd, HA_CHECK_OPT *check_opt) override;
bool check_and_repair(THD *thd) override;
bool auto_repair(int error) const override;
bool is_crashed() const override;
int check_for_upgrade(HA_CHECK_OPT *check_opt) override;
/*
-------------------------------------------------------------------------
MODULE condition pushdown
-------------------------------------------------------------------------
*/
virtual const COND *cond_push(const COND *cond);
virtual void cond_pop();
virtual void clear_top_table_fields();
virtual int info_push(uint info_type, void *info);
const COND *cond_push(const COND *cond) override;
void cond_pop() override;
void clear_top_table_fields() override;
int info_push(uint info_type, void *info) override;
private:
int handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, uint flags);
@ -1564,13 +1565,13 @@ public:
void append_row_to_str(String &str);
public:
virtual int pre_calculate_checksum();
virtual int calculate_checksum();
int pre_calculate_checksum() override;
int calculate_checksum() override;
/* Enabled keycache for performance reasons, WL#4571 */
virtual int assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt);
virtual int preload_keys(THD* thd, HA_CHECK_OPT* check_opt);
virtual TABLE_LIST *get_next_global_for_child();
int assign_to_keycache(THD* thd, HA_CHECK_OPT *check_opt) override;
int preload_keys(THD* thd, HA_CHECK_OPT* check_opt) override;
TABLE_LIST *get_next_global_for_child() override;
/*
-------------------------------------------------------------------------
@ -1579,9 +1580,9 @@ public:
Enable/Disable Indexes are only supported by HEAP and MyISAM.
-------------------------------------------------------------------------
*/
virtual int disable_indexes(uint mode);
virtual int enable_indexes(uint mode);
virtual int indexes_are_disabled(void);
int disable_indexes(uint mode) override;
int enable_indexes(uint mode) override;
int indexes_are_disabled() override;
/*
-------------------------------------------------------------------------
@ -1609,7 +1610,7 @@ public:
this can also be done before partition will support a mix of engines,
but preferably together with other incompatible API changes.
*/
virtual handlerton *partition_ht() const
handlerton *partition_ht() const override
{
handlerton *h= m_file[0]->ht;
for (uint i=1; i < m_tot_parts; i++)
@ -1638,5 +1639,16 @@ public:
friend int cmp_key_rowid_part_id(void *ptr, uchar *ref1, uchar *ref2);
friend int cmp_key_part_id(void *key_p, uchar *ref1, uchar *ref2);
bool can_convert_string(
const Field_string* field,
const Column_definition& new_field) const override;
bool can_convert_varstring(
const Field_varstring* field,
const Column_definition& new_field) const override;
bool can_convert_blob(
const Field_blob* field,
const Column_definition& new_field) const override;
};
#endif /* HA_PARTITION_INCLUDED */

View File

@ -2748,11 +2748,13 @@ double handler::keyread_time(uint index, uint ranges, ha_rows rows)
size_t len= table->key_info[index].key_length + ref_length;
if (index == table->s->primary_key && table->file->primary_key_is_clustered())
len= table->s->stored_rec_length;
uint keys_per_block= (uint) (stats.block_size/2.0/len+1);
ulonglong blocks= !rows ? 0 : (rows-1) / keys_per_block + 1;
double cost= (double)rows*len/(stats.block_size+1)*IDX_BLOCK_COPY_COST;
if (ranges)
{
uint keys_per_block= (uint) (stats.block_size/2.0/len+1);
ulonglong blocks= !rows ? 0 : (rows-1) / keys_per_block + 1;
cost+= blocks;
}
return cost;
}
@ -7042,6 +7044,20 @@ void handler::set_lock_type(enum thr_lock_type lock)
table->reginfo.lock_type= lock;
}
Compare_keys handler::compare_key_parts(const Field &old_field,
const Column_definition &new_field,
const KEY_PART_INFO &old_part,
const KEY_PART_INFO &new_part) const
{
if (!old_field.is_equal(new_field))
return Compare_keys::NotEqual;
if (old_part.length != new_part.length)
return Compare_keys::NotEqual;
return Compare_keys::Equal;
}
#ifdef WITH_WSREP
/**
@details

View File

@ -2940,6 +2940,13 @@ public:
virtual ~Handler_share() {}
};
enum class Compare_keys : uint32_t
{
Equal= 0,
EqualButKeyPartLength,
EqualButComment,
NotEqual
};
/**
The handler class is the interface for dynamically loadable
@ -4911,6 +4918,13 @@ public:
return false;
}
/* Used for ALTER TABLE.
Some engines can handle some differences in indexes by themself. */
virtual Compare_keys compare_key_parts(const Field &old_field,
const Column_definition &new_field,
const KEY_PART_INFO &old_part,
const KEY_PART_INFO &new_part) const;
protected:
Handler_share *get_ha_share_ptr();
void set_ha_share_ptr(Handler_share *arg_ha_share);

View File

@ -1203,7 +1203,7 @@ public:
bool fix_length_and_dec()
{
collation.set(default_charset());
max_length=64;
fix_char_length(64);
maybe_null= 1;
return FALSE;
}

View File

@ -3859,10 +3859,16 @@ int Xid_log_event::do_apply_event(rpl_group_info *rgi)
thd->variables.option_bits&= ~OPTION_GTID_BEGIN;
res= trans_commit(thd); /* Automatically rolls back on error. */
thd->mdl_context.release_transactional_locks();
#ifdef WITH_WSREP
if (WSREP(thd)) mysql_mutex_lock(&thd->LOCK_thd_data);
if ((!res || (WSREP(thd) && thd->wsrep_trx().state() == wsrep::transaction::s_must_replay )) && sub_id)
#else
if (likely(!res) && sub_id)
#endif /* WITH_WSREP */
rpl_global_gtid_slave_state->update_state_hash(sub_id, &gtid, hton, rgi);
#ifdef WITH_WSREP
if (WSREP(thd)) mysql_mutex_unlock(&thd->LOCK_thd_data);
#endif /* WITH_WSREP */
/*
Increment the global status commit count variable
*/

View File

@ -3227,19 +3227,14 @@ void MDL_context::set_transaction_duration_for_all_locks()
DBUG_ASSERT(m_tickets[MDL_STATEMENT].is_empty());
/* Don't swap locks if this thread is running backup stages */
if (current_thd->current_backup_stage == BACKUP_FINISHED)
m_tickets[MDL_TRANSACTION].swap(m_tickets[MDL_EXPLICIT]);
m_tickets[MDL_TRANSACTION].swap(m_tickets[MDL_EXPLICIT]);
Ticket_iterator it_ticket(m_tickets[MDL_EXPLICIT]);
while ((ticket= it_ticket++))
{
if (ticket->get_key()->mdl_namespace() != MDL_key::BACKUP)
{
m_tickets[MDL_EXPLICIT].remove(ticket);
m_tickets[MDL_TRANSACTION].push_front(ticket);
}
m_tickets[MDL_EXPLICIT].remove(ticket);
m_tickets[MDL_TRANSACTION].push_front(ticket);
}
#ifndef DBUG_OFF

View File

@ -702,7 +702,8 @@ static int rowid_cmp_reverse(void *file, uchar *a, uchar *b)
int Mrr_ordered_rndpos_reader::init(handler *h_arg,
Mrr_index_reader *index_reader_arg,
uint mode,
Lifo_buffer *buf)
Lifo_buffer *buf,
Rowid_filter *filter)
{
file= h_arg;
index_reader= index_reader_arg;
@ -710,19 +711,7 @@ int Mrr_ordered_rndpos_reader::init(handler *h_arg,
is_mrr_assoc= !MY_TEST(mode & HA_MRR_NO_ASSOCIATION);
index_reader_exhausted= FALSE;
index_reader_needs_refill= TRUE;
/*
Currently usage of a rowid filter within InnoDB engine is not supported
if the table is accessed by the primary key.
With optimizer switches ''mrr' and 'mrr_sort_keys' are both enabled
any access by a secondary index is converted to the rndpos access. In
InnoDB the rndpos access is always uses the primary key.
Do not use pushed rowid filter if the table is accessed actually by the
primary key. Use the rowid filter outside the engine code (see
Mrr_ordered_rndpos_reader::refill_from_index_reader).
*/
if (file->pushed_rowid_filter && file->primary_key_is_clustered())
file->cancel_pushed_rowid_filter();
rowid_filter= filter;
return 0;
}
@ -817,10 +806,8 @@ int Mrr_ordered_rndpos_reader::refill_from_index_reader()
index_reader->position();
/*
If the built rowid filter cannot be used at the engine level use it here.
If the built rowid filter cannot be used at the engine level, use it here.
*/
Rowid_filter *rowid_filter=
file->get_table()->reginfo.join_tab->rowid_filter;
if (rowid_filter && !file->pushed_rowid_filter &&
!rowid_filter->check((char *)index_rowid))
continue;
@ -960,7 +947,8 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs,
void *seq_init_param, uint n_ranges, uint mode,
HANDLER_BUFFER *buf)
{
THD *thd= h_arg->get_table()->in_use;
TABLE *table= h_arg->get_table();
THD *thd= table->in_use;
int res;
Key_parameters keypar;
uint UNINIT_VAR(key_buff_elem_size); /* set/used when do_sort_keys==TRUE */
@ -1015,6 +1003,21 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs,
if (!(keyno == table->s->primary_key && h_idx->primary_key_is_clustered()))
{
strategy= disk_strategy= &reader_factory.ordered_rndpos_reader;
if (h_arg->pushed_rowid_filter)
{
/*
Currently usage of a rowid filter within InnoDB engine is not supported
if the table is accessed by the primary key.
With optimizer switches ''mrr' and 'mrr_sort_keys' are both enabled
any access by a secondary index is converted to the rndpos access. In
InnoDB the rndpos access is always uses the primary key.
Do not use pushed rowid filter if the table is accessed actually by the
primary key. Use the rowid filter outside the engine code (see
Mrr_ordered_rndpos_reader::refill_from_index_reader).
*/
rowid_filter= h_arg->pushed_rowid_filter;
h_arg->cancel_pushed_rowid_filter();
}
}
full_buf= buf->buffer;
@ -1094,14 +1097,18 @@ int DsMrr_impl::dsmrr_init(handler *h_arg, RANGE_SEQ_IF *seq_funcs,
goto use_default_impl;
}
// setup_two_handlers() will call dsmrr_close() will clears the filter.
// Save its value and restore afterwards.
Rowid_filter *tmp = rowid_filter;
if ((res= setup_two_handlers()))
goto error;
rowid_filter= tmp;
if ((res= index_strategy->init(secondary_file, seq_funcs, seq_init_param,
n_ranges, mode, &keypar, key_buffer,
&buf_manager)) ||
(res= disk_strategy->init(primary_file, index_strategy, mode,
&rowid_buffer)))
&rowid_buffer, rowid_filter)))
{
goto error;
}
@ -1283,6 +1290,7 @@ void DsMrr_impl::close_second_handler()
void DsMrr_impl::dsmrr_close()
{
DBUG_ENTER("DsMrr_impl::dsmrr_close");
rowid_filter= NULL;
close_second_handler();
strategy= NULL;
DBUG_VOID_RETURN;

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