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

Conflicts:
	cmake/make_dist.cmake.in
	mysql-test/r/func_json.result
	mysql-test/r/ps.result
	mysql-test/t/func_json.test
	mysql-test/t/ps.test
	sql/item_cmpfunc.h
This commit is contained in:
Monty 2018-01-01 19:39:59 +02:00
commit fbab79c9b8
161 changed files with 4321 additions and 635 deletions

1
.gitignore vendored
View File

@ -193,6 +193,7 @@ storage/myisam/sp_test
storage/rocksdb/ldb
storage/rocksdb/mysql_ldb
storage/rocksdb/sst_dump
storage/rocksdb/rdb_source_revision.h
storage/tokudb/PerconaFT/buildheader/db.h
storage/tokudb/PerconaFT/buildheader/make_tdb
storage/tokudb/PerconaFT/buildheader/runcat.sh

17
appveyor.yml Normal file
View File

@ -0,0 +1,17 @@
version: 10.2-{build}
before_build:
- md %APPVEYOR_BUILD_FOLDER%\win_build
- cd %APPVEYOR_BUILD_FOLDER%\win_build
- cmake .. -G "Visual Studio 15 2017" -DBISON_EXECUTABLE=C:\cygwin\bin\bison
- dir
build:
project: win_build\MySQL.sln
parallel: true
verbosity: minimal
configuration:
- Debug
test:
test_script:
- cd %APPVEYOR_BUILD_FOLDER%\win_build\mysql-test
- perl mysql-test-run.pl --force --max-test-fail=20 --parallel=6 --testcase-timeout=4 --skip-test-list=unstable-tests --suite=main,innodb,plugins,mariabackup
image: Visual Studio 2017

View File

@ -1797,8 +1797,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
case OPT_MYSQL_PROTOCOL:
#ifndef EMBEDDED_LIBRARY
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
#endif
break;
case OPT_SERVER_ARG:

View File

@ -299,8 +299,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
#endif
break;
case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
break;
}
return 0;

View File

@ -1958,8 +1958,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
one_table= 1;
break;
case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
break;
#ifdef WHEN_FLASHBACK_REVIEW_READY
case opt_flashback_review:
@ -1977,8 +1981,15 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
opt_base64_output_mode= BASE64_OUTPUT_ALWAYS;
else
{
opt_base64_output_mode= (enum_base64_output_mode)
(find_type_or_exit(argument, &base64_output_mode_typelib, opt->name)-1);
int val;
if ((val= find_type_with_warning(argument, &base64_output_mode_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
opt_base64_output_mode= (enum_base64_output_mode) (val - 1);
}
break;
case OPT_REWRITE_DB: // db_from->db_to

View File

@ -369,8 +369,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
print_version(); exit(0);
break;
case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
break;
}

View File

@ -960,8 +960,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
}
case (int) OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
break;
}
return 0;

View File

@ -249,8 +249,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
break;
#endif
case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
break;
case '#':
DBUG_PUSH(argument ? argument : "d:t:o");

View File

@ -330,8 +330,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
#endif
break;
case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
break;
case '#':
DBUG_PUSH(argument ? argument : "d:t:o");

View File

@ -779,8 +779,12 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
#endif
break;
case OPT_MYSQL_PROTOCOL:
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
break;
case '#':
DBUG_PUSH(argument ? argument : default_dbug_option);

View File

@ -7294,8 +7294,12 @@ get_one_option(int optid, const struct my_option *opt, char *argument)
exit(0);
case OPT_MYSQL_PROTOCOL:
#ifndef EMBEDDED_LIBRARY
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
#endif
break;
case '?':

View File

@ -162,6 +162,8 @@ SET(INSTALL_MYSQLDATADIR_RPM "/var/lib/mysql")
SET(INSTALL_UNIX_ADDRDIR_RPM "${INSTALL_MYSQLDATADIR_RPM}/mysql.sock")
SET(INSTALL_SYSTEMD_UNITDIR_RPM "/usr/lib/systemd/system")
SET(INSTALL_SYSTEMD_SYSUSERSDIR_RPM "/usr/lib/sysusers.d")
SET(INSTALL_SYSTEMD_TMPFILESDIR_RPM "/usr/lib/tmpfiles.d")
#
# DEB layout
@ -191,6 +193,8 @@ SET(INSTALL_MYSQLDATADIR_DEB "/var/lib/mysql")
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")
#
# SVR4 layout
@ -232,7 +236,7 @@ SET(OLD_INSTALL_LAYOUT ${INSTALL_LAYOUT} CACHE INTERNAL "")
# layout is chosen)
FOREACH(var BIN SBIN LIB MYSQLSHARE SHARE PLUGIN INCLUDE SCRIPT DOC MAN SYSCONF SYSCONF2
INFO MYSQLTEST SQLBENCH DOCREADME SUPPORTFILES MYSQLDATA UNIX_ADDR
SYSTEMD_UNIT)
SYSTEMD_UNIT SYSTEMD_SYSUSERS SYSTEMD_TMPFILES)
SET(INSTALL_${var}DIR ${INSTALL_${var}DIR_${INSTALL_LAYOUT}}
CACHE STRING "${var} installation directory" ${FORCE})
MARK_AS_ADVANCED(INSTALL_${var}DIR)

View File

@ -55,6 +55,9 @@ ENDIF()
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/include/source_revision.h
${PACKAGE_DIR}/include/source_revision.h COPYONLY)
CONFIGURE_FILE(${CMAKE_BINARY_DIR}/storage/rocksdb/rdb_source_revision.h
${PACKAGE_DIR}/storage/rocksdb/rdb_source_revision.h COPYONLY)
IF(NOT GIT_EXECUTABLE)
MESSAGE(STATUS "git not found or source dir is not a repo, use CPack")

View File

@ -230,7 +230,7 @@ MACRO(MYSQL_ADD_PLUGIN)
SET(CPACK_COMPONENTS_ALL ${CPACK_COMPONENTS_ALL} PARENT_SCOPE)
IF (NOT ARG_CLIENT)
SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_REQUIRES "MariaDB${ver}" PARENT_SCOPE)
SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_REQUIRES "MariaDB-server${ver}" PARENT_SCOPE)
ENDIF()
# workarounds for cmake issues #13248 and #12864:
SET(CPACK_RPM_${ARG_COMPONENT}_PACKAGE_PROVIDES "cmake_bug_13248" PARENT_SCOPE)

View File

@ -79,7 +79,7 @@ GCCVERSION=$(gcc -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]
# x86 32 bit.
if [[ $GCCVERSION -lt 40800 ]] || [[ $(arch) =~ i[346]86 ]]
then
sed '/Package: mariadb-plugin-rocksdb/,+7d' -i debian/control
sed '/Package: mariadb-plugin-rocksdb/,+9d' -i debian/control
fi
if [[ $GCCVERSION -lt 40800 ]]
then

27
debian/control vendored
View File

@ -438,7 +438,7 @@ Description: MariaDB database client (metapackage depending on the latest versio
Package: mariadb-plugin-connect
Architecture: any
Depends: libxml2,
mariadb-server-10.2,
mariadb-server-10.2 (= ${binary:Version}),
unixodbc,
${misc:Depends},
${shlibs:Depends}
@ -452,7 +452,9 @@ Description: Connect storage engine for MariaDB
Package: mariadb-plugin-rocksdb
Architecture: any
Depends: mariadb-server-10.2, ${misc:Depends}, ${shlibs:Depends}
Depends: mariadb-server-10.2 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Description: RocksDB storage engine for MariaDB
The RocksDB storage engine is a high performance storage engine, aimed
at maximising storage efficiency while maintaining InnoDB-like performance.
@ -460,7 +462,10 @@ Description: RocksDB storage engine for MariaDB
Package: mariadb-plugin-oqgraph
Architecture: any
Depends: libjudydebian1, mariadb-server-10.2, ${misc:Depends}, ${shlibs:Depends}
Depends: libjudydebian1,
mariadb-server-10.2 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-oqgraph-engine-10.1, mariadb-oqgraph-engine-10.2
Replaces: mariadb-oqgraph-engine-10.1, mariadb-oqgraph-engine-10.2
Description: OQGraph storage engine for MariaDB
@ -470,7 +475,9 @@ Description: OQGraph storage engine for MariaDB
Package: mariadb-plugin-tokudb
Architecture: any
Depends: mariadb-server-10.2, ${misc:Depends}, ${shlibs:Depends}
Depends: mariadb-server-10.2 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-server-10.0,
mariadb-server-10.1,
mariadb-server-10.2 (<< ${source:Version})
@ -485,7 +492,9 @@ Description: TokuDB storage engine for MariaDB
Package: mariadb-plugin-mroonga
Architecture: any
Depends: mariadb-server-10.2, ${misc:Depends}, ${shlibs:Depends}
Depends: mariadb-server-10.2 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-server-10.0,
mariadb-server-10.1,
mariadb-server-10.2 (<< ${source:Version})
@ -499,7 +508,9 @@ Description: Mroonga storage engine for MariaDB
Package: mariadb-plugin-spider
Architecture: any
Depends: mariadb-server-10.2, ${misc:Depends}, ${shlibs:Depends}
Depends: mariadb-server-10.2 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-server-10.0,
mariadb-server-10.1,
mariadb-server-10.2 (<< ${source:Version})
@ -514,7 +525,9 @@ Description: Spider storage engine for MariaDB
Package: mariadb-plugin-cassandra
Architecture: any
Depends: mariadb-server-10.2, ${misc:Depends}, ${shlibs:Depends}
Depends: mariadb-server-10.2 (= ${binary:Version}),
${misc:Depends},
${shlibs:Depends}
Breaks: mariadb-server-10.0,
mariadb-server-10.1,
mariadb-server-10.2 (<< ${source:Version})

19
debian/rules vendored
View File

@ -45,11 +45,6 @@ else
TESTSUITE_FAIL_CMD:=exit 1
endif
# Skip TokuDB if arch is not amd64
ifneq ($(ARCH), amd64)
CMAKEFLAGS += -DWITHOUT_TOKUDB=true
endif
# Add support for verbose builds
MAKEFLAGS += VERBOSE=1
@ -119,19 +114,15 @@ override_dh_auto_install:
dh_testdir
dh_testroot
# If TokuDB plugin was not built skip the package
[ -f $(BUILDDIR)/storage/tokudb/ha_tokudb.so ] || sed -i -e "/Package: mariadb-plugin-tokudb/,+14d" debian/control
# If Mroonga plugin was not built skip the package
[ -f $(BUILDDIR)/storage/mroonga/ha_mroonga.so ] || sed -i -e "/Package: mariadb-plugin-mroonga/,+13d" debian/control
# Skip TokuDB if arch is not amd64
ifneq ($(ARCH), amd64)
sed -i -e "/Package: mariadb-plugin-tokudb/,+16d" debian/control
endif
# If libthrift-dev was available (manually installed, as it is
# not in Debian) and ha_cassandra.so was thus built, create package,
# otherwise skip it.
[ -f $(BUILDDIR)/storage/cassandra/ha_cassandra.so ] || sed -i -e "/Package: mariadb-plugin-cassandra/,+16d" debian/control
# If Spider plugin was not built skip the package
[ -f $(BUILDDIR)/storage/spider/ha_spider.so ] || sed -i -e "/Package: mariadb-plugin-spider/,+14d" debian/control
[ -f $(BUILDDIR)/storage/cassandra/ha_cassandra.so ] || sed -i -e "/Package: mariadb-plugin-cassandra/,+18d" debian/control
# Copy systemd files to a location available for dh_installinit
cp $(BUILDDIR)/support-files/mariadb.service debian/mariadb-server-10.2.mariadb.service

View File

@ -1421,8 +1421,12 @@ xb_get_one_option(int optid,
case OPT_PROTOCOL:
if (argument)
{
opt_protocol= find_type_or_exit(argument, &sql_protocol_typelib,
opt->name);
if ((opt_protocol= find_type_with_warning(argument, &sql_protocol_typelib,
opt->name)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
}
break;
#include "sslopt-case.h"

View File

@ -65,15 +65,6 @@
extern "C" {
#endif
/*
my_str_malloc(), my_str_realloc() and my_str_free() are assigned to
implementations in strings/alloc.c, but can be overridden in
the calling program.
*/
extern void *(*my_str_malloc)(size_t);
extern void *(*my_str_realloc)(void *, size_t);
extern void (*my_str_free)(void *);
#ifdef DBUG_OFF
#if defined(HAVE_STPCPY) && MY_GNUC_PREREQ(3, 4) && !defined(__INTEL_COMPILER)
#define strmov(A,B) __builtin_stpcpy((A),(B))

View File

@ -250,8 +250,6 @@ typedef struct st_typelib {
extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position);
extern int find_type_with_warning(const char *x, TYPELIB *typelib,
const char *option);
extern int find_type_or_exit(const char *x, TYPELIB *typelib,
const char *option);
extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags);
extern void make_type(char *to,unsigned int nr,TYPELIB *typelib);
extern const char *get_type(TYPELIB *typelib,unsigned int nr);

View File

@ -30,8 +30,6 @@ typedef struct st_typelib { /* Different types saved here */
extern my_ulonglong find_typeset(char *x, TYPELIB *typelib,int *error_position);
extern int find_type_with_warning(const char *x, TYPELIB *typelib,
const char *option);
extern int find_type_or_exit(const char *x, TYPELIB *typelib,
const char *option);
#define FIND_TYPE_BASIC 0
/** makes @c find_type() require the whole name, no prefix */
#define FIND_TYPE_NO_PREFIX (1U << 0)

@ -1 +1 @@
Subproject commit 63f841f78f520d7f3bcff1fe8cecec9d8c47829d
Subproject commit fe129ed39f33ba2b430aac91473baee84de88b12

View File

@ -121,6 +121,9 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
my_free(mysql->options.my_cnf_file);
my_free(mysql->options.my_cnf_group);
mysql->options.my_cnf_file=mysql->options.my_cnf_group=0;
if (mysql->options.protocol == UINT_MAX32)
goto error;
}
if (!db || !db[0])

View File

@ -458,3 +458,23 @@ CREATE OR REPLACE TABLE t1 AS SELECT f1();
UNLOCK TABLES;
DROP FUNCTION f1;
DROP TABLE t1;
#
# MDEV-11071 - Assertion `thd->transaction.stmt.is_empty()' failed in
# Locked_tables_list::unlock_locked_tables
#
CREATE TEMPORARY TABLE t1(a INT) ENGINE=InnoDB;
CREATE TEMPORARY TABLE t2(a INT);
CREATE TABLE t3(a INT);
LOCK TABLE t2 WRITE;
SELECT * FROM t2;
a
CREATE OR REPLACE TEMPORARY TABLE t1(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
SELECT * FROM t3;
ERROR HY000: Table 't3' was not locked with LOCK TABLES
CREATE OR REPLACE TEMPORARY TABLE t2(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE.
SELECT * FROM t3;
ERROR HY000: Table 't3' was not locked with LOCK TABLES
UNLOCK TABLES;
DROP TABLE t3;

View File

@ -1147,3 +1147,121 @@ SELECT * FROM cte_test;
a
1
DROP VIEW cte_test;
#
# mdev-14755 : PS for query using CTE in select with subquery
#
create table t1 (a int);
insert into t1 values
(7), (2), (8), (1), (3), (2), (7), (5), (4), (7), (9), (8);
with cte as
(select a from t1 where a between 4 and 7 group by a)
(select a from cte where exists( select a from t1 where cte.a=t1.a ))
union
(select a from t1 where a < 2);
a
7
5
4
1
prepare stmt from "with cte as
(select a from t1 where a between 4 and 7 group by a)
(select a from cte where exists( select a from t1 where cte.a=t1.a ))
union
(select a from t1 where a < 2)";
execute stmt;
a
7
5
4
1
execute stmt;
a
7
5
4
1
deallocate prepare stmt;
with cte as
(select a from t1 where a between 4 and 7 group by a)
(select a from t1 where a < 2)
union
(select a from cte where exists( select a from t1 where cte.a=t1.a ));
a
1
7
5
4
prepare stmt from "with cte as
(select a from t1 where a between 4 and 7 group by a)
(select a from t1 where a < 2)
union
(select a from cte where exists( select a from t1 where cte.a=t1.a ))";
execute stmt;
a
1
7
5
4
execute stmt;
a
1
7
5
4
deallocate prepare stmt;
with cte as
(select a from t1 where a between 4 and 7)
(select a from t1 where a < 2)
union
(select a from cte where exists( select a from t1 where cte.a=t1.a ));
a
1
7
5
4
prepare stmt from "with cte as
(select a from t1 where a between 4 and 7)
(select a from t1 where a < 2)
union
(select a from cte where exists( select a from t1 where cte.a=t1.a ))";
execute stmt;
a
1
7
5
4
execute stmt;
a
1
7
5
4
deallocate prepare stmt;
with cte as
(select a from t1 where a between 4 and 7)
(select a from cte
where exists( select a from t1 where t1.a < 2 and cte.a=t1.a ))
union
(select a from cte where exists( select a from t1 where cte.a=t1.a ));
a
7
5
4
prepare stmt from "with cte as
(select a from t1 where a between 4 and 7)
(select a from cte
where exists( select a from t1 where t1.a < 2 and cte.a=t1.a ))
union
(select a from cte where exists( select a from t1 where cte.a=t1.a ))";
execute stmt;
a
7
5
4
execute stmt;
a
7
5
4
deallocate prepare stmt;
drop table t1;

View File

@ -1584,3 +1584,63 @@ EXPLAIN
}
}
drop table t0,t1;
#
# MDEV-10844: EXPLAIN FORMAT=JSON doesn't show order direction for filesort
#
create table t1 (a int, b int);
insert into t1 values (1,2),(3,4),(2,3);
explain format=json select * from t1 order by a, b desc;
EXPLAIN
{
"query_block": {
"select_id": 1,
"read_sorted_file": {
"filesort": {
"sort_key": "t1.a, t1.b desc",
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"filtered": 100
}
}
}
}
}
explain format=json select * from t1 order by a desc, b desc;
EXPLAIN
{
"query_block": {
"select_id": 1,
"read_sorted_file": {
"filesort": {
"sort_key": "t1.a desc, t1.b desc",
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"filtered": 100
}
}
}
}
}
explain format=json select * from t1 order by a desc, b ;
EXPLAIN
{
"query_block": {
"select_id": 1,
"read_sorted_file": {
"filesort": {
"sort_key": "t1.a desc, t1.b",
"table": {
"table_name": "t1",
"access_type": "ALL",
"rows": 3,
"filtered": 100
}
}
}
}
}
drop table t1;

View File

@ -731,6 +731,11 @@ Warning 4042 Syntax error in JSON path in argument 3 to function 'json_contains_
select JSON_VALID(0x36f0c8dccd83c5eac156da);
JSON_VALID(0x36f0c8dccd83c5eac156da)
0
create table t1(a double not null);
insert into t1 values (2),(1);
select 1 from t1 where json_extract(a,'$','$[81]');
1
drop table t1;
#
# Start of 10.3 tests
#

View File

@ -1523,6 +1523,21 @@ str str1 b c
::10.0.5.9 ::10.0.5.9 1 0
DROP TABLE t1;
#
# MDEV-14613: Assertion `fixed == 0' failed in Item_func::fix_fields
#
CREATE TABLE `t1` (
`numgtfmt` char(10) COLLATE utf8_bin NOT NULL
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
create view v1(numgtfmt)
as
select 'x' from t1
union
select 'x' from t1 ;
SELECT * FROM v1 WHERE numgtfmt = NAME_CONST('wnumgtfmt',_utf8'QEDITIONS' COLLATE 'utf8_bin');
numgtfmt
DROP VIEW v1;
DROP TABLE t1;
#
# End of 10.2 tests
#
#

View File

@ -221,21 +221,11 @@ NULL
DROP TABLE t1;
#
# Start of 5.3 tests
#
#
# MDEV-4512 Valgrind warnings in my_long10_to_str_8bit on INTERVAL and DATE_ADD with incorrect types
#
CREATE TABLE t1 (pk INT PRIMARY KEY);
INSERT INTO t1 VALUES (10),(11);
SELECT INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 ) FROM t1;
INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 )
8
8
Warnings:
Warning 1292 Incorrect datetime value: '10' for column 'pk' at row 1
Warning 1292 Incorrect datetime value: '11' for column 'pk' at row 2
DROP TABLE t1;
#
# End of 5.3 tests
# MDEV-14596 Crash in INTERVAL(ROW(..),ROW(..))
#
SELECT INTERVAL(ROW(1,1),ROW(1,2));
ERROR 21000: Operand should contain 1 column(s)
SELECT INTERVAL(1,ROW(1,2));
ERROR 21000: Operand should contain 1 column(s)
SELECT INTERVAL(ROW(1,2),1);
ERROR 21000: Operand should contain 1 column(s)

View File

@ -2667,6 +2667,31 @@ create table t2 (c1 int, c2 int);
select t1.c1 as c1, t2.c2 as c1 from t1, t2 where t1.c1 < 20 and t2.c2 > 5 group by t1.c1, t2.c2 having t1.c1 < 3;
c1 c1
drop table t1, t2;
SET @old_sort_buff_size = @@sort_buffer_size;
SET @@sort_buffer_size=256*1024;
CREATE TABLE t1 (c INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES
(2011),(1977),(1982),(2027),(2023),(NULL),(NULL),(2004),(1974),(2032),
(1993),(NULL),(1995),(2034),(NULL),(2009),(1900),(NULL),(2025),(1900),
(2033),(1900),(2012),(NULL),(2009),(1992),(1974),(1974),(2012),(2028),
(2007),(2012),(1900),(1983),(1900),(2010),(1987),(1994),(1981),(2032),
(2010),(1989),(2014),(1900),(1900),(1976),(1978),(2007),(2030),(NULL),
(2002),(1997),(1900),(NULL),(2000),(2027),(1975),(2026),(1975),(2026),
(2029),(1977),(1900),(1900),(2031),(1993),(1986),(2012),(1979),(2013),
(1994),(2014),(2025),(2006),(1971),(1974),(2021),(2011),(NULL),(1991),
(2001),(1977),(2023),(2012),(1900),(1978),(1998),(NULL),(1988),(1999),
(2017),(2008),(1976),(1900),(2005),(2030),(2023),(1900),(1978),(1990),
(1978),(1987),(2030),(1900),(2034),(2006),(2015),(2001),(2019),(2024),
(2030),(1989),(1997),(2007),(2023),(1994),(1971),(2011),(2011),(2015),
(1984),(1978),(1979),(1989),(2008),(2030);
SELECT ExtractValue('<a></a>','/a') AS f1, SPACE(c) AS f2 FROM t1 GROUP BY f1, f2 WITH ROLLUP;
f1 f2
NULL
NULL
NULL NULL
SET @@sort_buffer_size = @old_sort_buff_size;
DROP TABLE t1;
#
# Bug #58782
# Missing rows with SELECT .. WHERE .. IN subquery

View File

@ -696,6 +696,21 @@ id column_1
expected -- 1 row(s) returned not ER_BAD_FIELD_ERROR
drop table t1;
#
# mdev-14368: grouping query with alias for aggregate function in HAVING
# when sql_mode = 'ONLY_FULL_GROUP_BY'
set @save_sql_mode= @@sql_mode;
set sql_mode = 'ONLY_FULL_GROUP_BY';
create table t1(a int);
insert t1 values (4),(1),(2),(1), (3),(4);
SELECT a, COUNT(a) as ct FROM t1 GROUP BY a HAVING ct>0;
a ct
1 2
2 1
3 1
4 2
set sql_mode=@save_sql_mode;
drop table t1;
#
# Bug mdev-5160: two-way join with HAVING over the second table
#
CREATE TABLE t1 (c1 varchar(6)) ENGINE=MyISAM;

View File

@ -2431,5 +2431,18 @@ Warnings:
Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1`) where `f1`(`test`.`t2`.`col3`,0) = 0
DROP FUNCTION f1;
DROP TABLE t1,t2;
#
# MDEV-10397: Server crashes in key_copy with join_cache_level > 2 and join on BIT fields
#
CREATE TABLE t1 (b1 BIT NOT NULL);
INSERT INTO t1 VALUES (0),(1);
CREATE TABLE t2 (b2 BIT NOT NULL);
INSERT INTO t2 VALUES (0),(1);
SET SESSION JOIN_CACHE_LEVEL = 3;
SELECT t1.b1+'0' , t2.b2 + '0' FROM t1 LEFT JOIN t2 ON b1 = b2;
t1.b1+'0' t2.b2 + '0'
0 0
1 1
DROP TABLE t1, t2;
# end of 5.5 tests
SET optimizer_switch=@save_optimizer_switch;

View File

@ -2442,6 +2442,19 @@ Warnings:
Note 1003 select `test`.`t1`.`col1` AS `col1`,`test`.`t2`.`col1` AS `col1`,`test`.`t2`.`col3` AS `col3` from `test`.`t1` left join `test`.`t2` on(`test`.`t2`.`col2` = `test`.`t1`.`col1`) where `f1`(`test`.`t2`.`col3`,0) = 0
DROP FUNCTION f1;
DROP TABLE t1,t2;
#
# MDEV-10397: Server crashes in key_copy with join_cache_level > 2 and join on BIT fields
#
CREATE TABLE t1 (b1 BIT NOT NULL);
INSERT INTO t1 VALUES (0),(1);
CREATE TABLE t2 (b2 BIT NOT NULL);
INSERT INTO t2 VALUES (0),(1);
SET SESSION JOIN_CACHE_LEVEL = 3;
SELECT t1.b1+'0' , t2.b2 + '0' FROM t1 LEFT JOIN t2 ON b1 = b2;
t1.b1+'0' t2.b2 + '0'
0 0
1 1
DROP TABLE t1, t2;
# end of 5.5 tests
SET optimizer_switch=@save_optimizer_switch;
set join_cache_level=default;

View File

@ -26,9 +26,5 @@ ALTER TABLE t1 ADD PARTITION (PARTITION p3 DATA DIRECTORY = 'G:/mysqltest/p3Data
Warnings:
Warning 1618 <DATA DIRECTORY> option ignored
Warning 1618 <INDEX DIRECTORY> option ignored
Warning 1618 <DATA DIRECTORY> option ignored
Warning 1618 <INDEX DIRECTORY> option ignored
Warning 1618 <DATA DIRECTORY> option ignored
Warning 1618 <INDEX DIRECTORY> option ignored
INSERT INTO t1 VALUES (NULL, "last", 4);
DROP TABLE t1;

View File

@ -5075,6 +5075,35 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
DROP PROCEDURE p1;
#
# MDEV-14426 Assertion in Diagnostics_area::set_error_status when using a bad datetime with PS and SP
#
CREATE PROCEDURE p1(OUT a VARCHAR(20))
BEGIN
SET a=10;
END;
$$
BEGIN NOT ATOMIC
DECLARE a DATETIME;
CALL p1(a);
END;
$$
ERROR 22007: Incorrect datetime value: '10' for column 'a' at row 1
BEGIN NOT ATOMIC
DECLARE a DATETIME;
EXECUTE IMMEDIATE 'CALL p1(?)' USING a;
END;
$$
ERROR 22007: Incorrect datetime value: '10' for column 'a' at row 1
BEGIN NOT ATOMIC
DECLARE a DATETIME;
PREPARE stmt FROM 'CALL p1(?)';
EXECUTE stmt USING a;
DEALLOCATE PREPARE stmt;
END;
$$
ERROR 22007: Incorrect datetime value: '10' for column 'a' at row 1
DROP PROCEDURE p1;
#
# MDEV-14454 Binary protocol returns wrong collation ID for SP OUT parameters
#
CREATE PROCEDURE p1(OUT v CHAR(32) CHARACTER SET utf8) SET v='aaa';

View File

@ -5621,6 +5621,20 @@ PREPARE stmt FROM 'REPLACE INTO v2 SELECT a FROM t3';
ERROR HY000: Can not insert into join view 'test.v2' without fields list
drop view v1,v2;
drop table t3;
#
# MDEV-14619: VIEW and GROUP_CONCAT
#
CREATE TABLE t1 (str text);
INSERT INTO t1 VALUES ("My"),("SQL");
CREATE VIEW v1 AS SELECT GROUP_CONCAT(str SEPARATOR '\\') FROM t1;
SELECT * FROM v1;
GROUP_CONCAT(str SEPARATOR '\\')
My\SQL
SHOW CREATE VIEW v1;
View Create View character_set_client collation_connection
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select group_concat(`t1`.`str` separator '\\') AS `GROUP_CONCAT(str SEPARATOR '\\')` from `t1` latin1 latin1_swedish_ci
drop view v1;
drop table t1;
# -----------------------------------------------------------------
# -- End of 5.5 tests.
# -----------------------------------------------------------------

View File

@ -1779,7 +1779,7 @@ EXPLAIN
"query_block": {
"select_id": 1,
"filesort": {
"sort_key": "row_number() over ( order by t1.s1,t1.s2)",
"sort_key": "row_number() over ( order by t1.s1,t1.s2) desc",
"window_functions_computation": {
"sorts": {
"filesort": {

View File

@ -0,0 +1,36 @@
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2;
START SLAVE;
connection node_1;
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
begin;
insert into t2 values(21);
insert into t2 values(22);
commit;
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
1-1-4
connection node_2;
INSERT INTO t1 VALUES(2);
INSERT INTO t1 VALUES(3);
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
1-1-4,2-2-2
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
INSERT INTO t1 VALUES(4);
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
1-1-4,2-2-2,2-3-3
connection node_1;
DROP TABLE t1,t2;
reset master;
connection node_2;
connection node_3;
connection node_2;
STOP SLAVE;
RESET SLAVE ALL;
reset master;
connection node_3;
reset master;

View File

@ -0,0 +1,130 @@
#Connection 2
START SLAVE;
#Connection 1
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 int unique) ENGINE=InnoDB;
INSERT INTO t2 VALUES(1,11);
INSERT INTO t2 VALUES(2,22);
INSERT INTO t2 VALUES(3,33);
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
1-1-4
include/save_master_gtid.inc
#Connection 2
include/sync_with_master_gtid.inc
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
1-1-4
INSERT INTO t2 VALUES(4,44);
INSERT INTO t2 VALUES(5,55);
INSERT INTO t2 VALUES(6,66);
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
1-1-4,2-2-3
#Connection 3
INSERT INTO t2 VALUES(7,77);
INSERT INTO t2 VALUES(8,88);
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
1-1-4,2-2-3,2-3-5
#Connection 1
CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_committed_before');
INSERT INTO t1 VALUES ('node1_committed_before');
COMMIT;
include/save_master_gtid.inc
#Connection 2
include/sync_with_master_gtid.inc
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
COMMIT;
#Connection 3
Shutting down server ...
#Connection 2
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_committed_during');
INSERT INTO t1 VALUES ('node1_committed_during');
COMMIT;
#Connection 3
Starting server ...
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node3_committed_after');
INSERT INTO t1 VALUES ('node3_committed_after');
COMMIT;
#Connection 2
Select * from t1 order by f1;
f1
node1_committed_before
node1_committed_before
node1_committed_during
node1_committed_during
node2_committed_before
node2_committed_before
node3_committed_after
node3_committed_after
#Connection 3
Select * from t1 order by f1;
f1
node1_committed_before
node1_committed_before
node1_committed_during
node1_committed_during
node2_committed_before
node2_committed_before
node3_committed_after
node3_committed_after
#Connection 2
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
1-1-6,2-2-7,2-3-8
#Connection 3
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
1-1-6,2-2-7,2-3-8
#Connection 1
SET AUTOCOMMIT=ON;
#Connection 2
SET AUTOCOMMIT=ON;
#Connection 3
SET AUTOCOMMIT=ON;
#Connection 2
STOP slave;
INSERT INTO t1 VALUES ('node2_slave_stoped');
#Connection 1
INSERT INTO t1 VALUES ('node1_normal_entry');
include/save_master_gtid.inc
#Connection 2
INSERT INTO t1 VALUES ('node2_slave_stoped_inserted');
start slave;
include/sync_with_master_gtid.inc
INSERT INTO t1 VALUES ('node2_slave_started');
SELECT count(*) from t1;
count(*)
12
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
1-1-7,2-3-8,2-2-11
#Connection 3
SELECT count(*) from t1;
count(*)
12
SELECT @@global.gtid_binlog_state;
@@global.gtid_binlog_state
1-1-7,2-3-8,2-2-11
#Connection 1
DROP TABLE t2,t1;
#Connection 2
#Connection 3
#Connection 2
STOP SLAVE;
RESET SLAVE ALL;
reset master;
#Connection 3
reset master;
#Connection 1
reset master;

View File

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

View File

@ -0,0 +1,78 @@
#
# Test Galera as a slave to a MariaDB master using GTIDs
#
# suite/galera/galera_2nodes_as_slave.cnf describes the setup of the nodes
# suite/galera/t/galera_as_slave_gtid.cnf has the GTID options
#
# In addition to performing DDL and DML, we check that the gtid of the master is preserved inside the cluster
#
--source include/have_innodb.inc
# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--source include/galera_cluster.inc
--connection node_2
--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;
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES(1);
#multi stmt trans
begin;
insert into t2 values(21);
insert into t2 values(22);
commit;
SELECT @@global.gtid_binlog_state;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc
--sleep 1
INSERT INTO t1 VALUES(2);
INSERT INTO t1 VALUES(3);
SELECT @@global.gtid_binlog_state;
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--let $wait_condition = SELECT COUNT(*) = 3 FROM t1;
--source include/wait_condition.inc
INSERT INTO t1 VALUES(4);
SELECT @@global.gtid_binlog_state;
--connection node_1
DROP TABLE t1,t2;
reset master;
#
# Unfortunately without the sleep below the following statement fails with "query returned no rows", which
# is difficult to understand given that it is an aggregate query. A "query execution was interrupted"
# warning is also reported by MTR, which is also weird.
#
--sleep 1
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--connection node_2
STOP SLAVE;
RESET SLAVE ALL;
reset master;
--connection node_3
reset master;

View File

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

View File

@ -0,0 +1,207 @@
#
# Test Galera as a slave to a MariaDB master using GTIDs
#
# suite/galera/galera_2nodes_as_slave.cnf describes the setup of the nodes
#
# In addition to performing DDL and DML, we check that the gtid of the master is preserved inside the cluster
#
--source include/big_test.inc
--source include/have_innodb.inc
# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc
--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
--source include/galera_cluster.inc
--echo #Connection 2
--connection node_2
--disable_query_log
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1,master_use_gtid=slave_pos;
--enable_query_log
START SLAVE;
--sleep 1
--echo #Connection 1
--connection node_1
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY, f2 int unique) ENGINE=InnoDB;
INSERT INTO t2 VALUES(1,11);
INSERT INTO t2 VALUES(2,22);
INSERT INTO t2 VALUES(3,33);
SELECT @@global.gtid_binlog_state;
--source include/save_master_gtid.inc
--echo #Connection 2
--connection node_2
--source include/sync_with_master_gtid.inc
SELECT @@global.gtid_binlog_state;
INSERT INTO t2 VALUES(4,44);
INSERT INTO t2 VALUES(5,55);
INSERT INTO t2 VALUES(6,66);
SELECT @@global.gtid_binlog_state;
--echo #Connection 3
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME= 't2';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 6 FROM t2;
--source include/wait_condition.inc
INSERT INTO t2 VALUES(7,77);
INSERT INTO t2 VALUES(8,88);
SELECT @@global.gtid_binlog_state;
#Perform SST
--echo #Connection 1
--connection node_1
CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_committed_before');
INSERT INTO t1 VALUES ('node1_committed_before');
COMMIT;
--source include/save_master_gtid.inc
--echo #Connection 2
--connection node_2
--source include/sync_with_master_gtid.inc
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node2_committed_before');
INSERT INTO t1 VALUES ('node2_committed_before');
COMMIT;
--echo #Connection 3
--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
--let $node_1= node_2
--let $node_2= node_3
--source include/auto_increment_offset_save.inc
--echo Shutting down server ...
--source include/shutdown_mysqld.inc
--echo #Connection 2
--connection node_2
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node1_committed_during');
INSERT INTO t1 VALUES ('node1_committed_during');
COMMIT;
--echo #Connection 3
--connection node_3
--echo Starting server ...
--source include/start_mysqld.inc
--source include/wait_until_ready.inc
--source include/auto_increment_offset_restore.inc
SET AUTOCOMMIT=OFF;
START TRANSACTION;
INSERT INTO t1 VALUES ('node3_committed_after');
INSERT INTO t1 VALUES ('node3_committed_after');
COMMIT;
--echo #Connection 2
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 8 FROM t1;
--source include/wait_condition.inc
Select * from t1 order by f1;
--echo #Connection 3
--connection node_3
Select * from t1 order by f1;
#SST Done
--sleep 1
--echo #Connection 2
--connection node_2
SELECT @@global.gtid_binlog_state;
--echo #Connection 3
--connection node_3
SELECT @@global.gtid_binlog_state;
--echo #Connection 1
--connection node_1
SET AUTOCOMMIT=ON;
#drop table t1;
#CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB;
--echo #Connection 2
--connection node_2
SET AUTOCOMMIT=ON;
--echo #Connection 3
--connection node_3
SET AUTOCOMMIT=ON;
#
#stop slave on node 2
--echo #Connection 2
--connection node_2
STOP slave;
--sleep 1
INSERT INTO t1 VALUES ('node2_slave_stoped');
--echo #Connection 1
--connection node_1
INSERT INTO t1 VALUES ('node1_normal_entry');
--source include/save_master_gtid.inc
#start slave
--echo #Connection 2
--connection node_2
INSERT INTO t1 VALUES ('node2_slave_stoped_inserted');
start slave;
--source include/sync_with_master_gtid.inc
INSERT INTO t1 VALUES ('node2_slave_started');
SELECT count(*) from t1;
SELECT @@global.gtid_binlog_state;
--echo #Connection 3
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 12 FROM t1;
--source include/wait_condition.inc
SELECT count(*) from t1;
SELECT @@global.gtid_binlog_state;
--echo #Connection 1
--connection node_1
DROP TABLE t2,t1;
# Unfortunately without the sleep below the following statement fails with "query returned no rows", which
# is difficult to understand given that it is an aggregate query. A "query execution was interrupted"
# warning is also reported by MTR, which is also weird.
#
--sleep 3
--echo #Connection 2
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2';
--source include/wait_condition.inc
--echo #Connection 3
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--echo #Connection 2
--connection node_2
STOP SLAVE;
RESET SLAVE ALL;
reset master;
--echo #Connection 3
--connection node_3
reset master;
--echo #Connection 1
--connection node_1
reset master;

View File

@ -0,0 +1,122 @@
# Use default setting for mysqld processes
!include include/default_mysqld.cnf
[mysqld]
log-bin
log-slave-updates
binlog-format=row
innodb-autoinc-lock-mode=2
default-storage-engine=innodb
wsrep_gtid_mode=1
gtid_ignore_duplicates
wsrep-on=1
wsrep-provider=@ENV.WSREP_PROVIDER
wsrep_node_address=127.0.0.1
# enforce read-committed characteristics across the cluster
# wsrep-causal-reads=ON
# wsrep-sync-wait=15
[mysqld.1]
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
wsrep-cluster-address='gcomm://'
wsrep_provider_options='base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
wsrep_sst_receive_address=127.0.0.2:@mysqld.1.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
[mysqld.2]
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
wsrep_provider_options='base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
[mysqld.3]
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
wsrep_provider_options='base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
wsrep_sst_receive_address=127.0.0.2:@mysqld.3.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port'
[mysqld.4]
wsrep_cluster_name=cluster2
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
wsrep-cluster-address='gcomm://'
wsrep_provider_options='base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
wsrep_sst_receive_address=127.0.0.2:@mysqld.4.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port'
[mysqld.5]
wsrep_cluster_name=cluster2
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.4.#galera_port'
wsrep_provider_options='base_port=@mysqld.5.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
wsrep_sst_receive_address=127.0.0.2:@mysqld.5.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.5.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.5.#sst_port'
[mysqld.6]
wsrep_cluster_name=cluster2
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.4.#galera_port'
wsrep_provider_options='base_port=@mysqld.6.#galera_port;evs.suspect_timeout=PT300S;evs.inactive_timeout=PT1000M;evs.install_timeout=PT155S;evs.keepalive_period = PT100S'
wsrep_sst_receive_address=127.0.0.2:@mysqld.6.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.6.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.6.#sst_port'
[ENV]
NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket
NODE_MYPORT_2= @mysqld.2.port
NODE_MYSOCK_2= @mysqld.2.socket
NODE_MYPORT_3= @mysqld.3.port
NODE_MYSOCK_3= @mysqld.3.socket
NODE_MYPORT_4= @mysqld.4.port
NODE_MYSOCK_4= @mysqld.4.socket
NODE_MYPORT_5= @mysqld.5.port
NODE_MYSOCK_5= @mysqld.5.socket
NODE_MYPORT_6= @mysqld.6.port
NODE_MYSOCK_6= @mysqld.6.socket
NODE_GALERAPORT_1= @mysqld.1.#galera_port
NODE_GALERAPORT_2= @mysqld.2.#galera_port
NODE_GALERAPORT_3= @mysqld.3.#galera_port
NODE_GALERAPORT_4= @mysqld.4.#galera_port
NODE_GALERAPORT_5= @mysqld.5.#galera_port
NODE_GALERAPORT_6= @mysqld.6.#galera_port
NODE_SSTPORT_1= @mysqld.1.#sst_port
NODE_SSTPORT_2= @mysqld.2.#sst_port
NODE_SSTPORT_3= @mysqld.3.#sst_port
NODE_SSTPORT_4= @mysqld.4.#sst_port
NODE_SSTPORT_5= @mysqld.5.#sst_port
NODE_SSTPORT_6= @mysqld.6.#sst_port

View File

@ -0,0 +1,231 @@
cluster 1 node 1
SHOW STATUS LIKE 'wsrep_cluster_size';
Variable_name Value
wsrep_cluster_size 3
cluster 1 node 2
SHOW STATUS LIKE 'wsrep_cluster_size';
Variable_name Value
wsrep_cluster_size 3
cluster 1 node 3
SHOW STATUS LIKE 'wsrep_cluster_size';
Variable_name Value
wsrep_cluster_size 3
cluster 2 node 1
SHOW STATUS LIKE 'wsrep_cluster_size';
Variable_name Value
wsrep_cluster_size 3
cluster 2 node 2
SHOW STATUS LIKE 'wsrep_cluster_size';
Variable_name Value
wsrep_cluster_size 3
cluster 2 node 3
SHOW STATUS LIKE 'wsrep_cluster_size';
Variable_name Value
wsrep_cluster_size 3
change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_4, master_use_gtid=current_pos, ignore_server_ids=(12,13);;
start slave;
include/wait_for_slave_to_start.inc
select @@gtid_binlog_state;
@@gtid_binlog_state
select @@gtid_slave_pos;
@@gtid_slave_pos
change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_1, master_use_gtid=current_pos, ignore_server_ids=(22,23);;
start slave;
include/wait_for_slave_to_start.inc
select @@gtid_binlog_state;
@@gtid_binlog_state
select @@gtid_slave_pos;
@@gtid_slave_pos
cluster 1 node 1
create table t1 (cluster_domain_id int ,node_server_id int, seq_no int);
insert into t1 values (1, 11, 2);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2
#wait for sync cluster 1 and 2
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 2 node 1
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2
insert into t1 values (2, 21, 1);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2,2-21-1
select * from t1;
cluster_domain_id node_server_id seq_no
1 11 2
2 21 1
#wait for sync cluster 1 and 2
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 1 node 2
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2,2-21-1
insert into t1 values (1, 12, 3);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2,1-12-3,2-21-1
#wait for sync cluster 1 and 2
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 1 node 3
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2,1-12-3,2-21-1
insert into t1 values (1, 13, 4);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1
#wait for sync cluster 1 and 2
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 2 node 2
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1
insert into t1 values (2, 22, 2);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2
#wait for sync cluster 2 and 1
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 2 node 3
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2
insert into t1 values (2, 23, 3);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3
#wait for sync cluster 2 and 1
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 1 node 1
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3
drop table t1;
stop slave;
reset slave;
change master to master_use_gtid=no, ignore_server_ids=();
reset master;
set global GTID_SLAVE_POS="";
cluster 2 node 1
stop slave;
reset slave;
change master to master_use_gtid=no, ignore_server_ids=();
reset master;
set global GTID_SLAVE_POS="";
reset master;
reset master;
reset master;
reset master;
change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_6, master_use_gtid=current_pos, ignore_server_ids=(12,13);;
start slave;
include/wait_for_slave_to_start.inc
select @@gtid_binlog_state;
@@gtid_binlog_state
select @@gtid_slave_pos;
@@gtid_slave_pos
change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_3, master_use_gtid=current_pos, ignore_server_ids=(22,23);;
start slave;
include/wait_for_slave_to_start.inc
select @@gtid_binlog_state;
@@gtid_binlog_state
select @@gtid_slave_pos;
@@gtid_slave_pos
cluster 1 node 1
create table t1 (cluster_domain_id int ,node_server_id int, seq_no int);
insert into t1 values (1, 11, 2);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2
#wait for sync cluster 1 and 2
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 2 node 1
insert into t1 values (2, 21, 1);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2,2-21-1
select * from t1;
cluster_domain_id node_server_id seq_no
1 11 2
2 21 1
#wait for sync cluster 1 and 2
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 1 node 2
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2,2-21-1
insert into t1 values (1, 12, 3);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2,1-12-3,2-21-1
#wait for sync cluster 1 and 2
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 1 node 3
select @@gtid_binlog_state;
@@gtid_binlog_state
1-11-2,1-12-3,2-21-1
insert into t1 values (1, 13, 4);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1
#wait for sync cluster 1 and 2
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 2 node 2
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1
insert into t1 values (2, 22, 2);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2
#wait for sync cluster 2 and 1
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 2 node 3
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2
insert into t1 values (2, 23, 3);
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3
#wait for sync cluster 2 and 1
include/save_master_gtid.inc
include/sync_with_master_gtid.inc
cluster 1 node 1
select @@gtid_binlog_state;
@@gtid_binlog_state
1-12-3,1-11-2,1-13-4,2-21-1,2-22-2,2-23-3
drop table t1;
stop slave;
change master to master_use_gtid=no, ignore_server_ids=();
reset master;
set global GTID_SLAVE_POS="";
cluster 2 node 1
stop slave;
change master to master_use_gtid=no, ignore_server_ids=();
reset master;
set global GTID_SLAVE_POS="";
reset master;
reset master;
reset master;
reset master;

View File

@ -0,0 +1,28 @@
# We need a dedicated .cnf file, even if empty, in order to force this test to run
# alone on a freshly started cluster. Otherwise there are adverse interactions with
# following tests such as galera_3nodes.galera_var_dirty_reads2
!include ../galera_2x3nodes.cnf
[mysqld.1]
wsrep_gtid_domain_id=1
server-id=11
[mysqld.2]
wsrep_gtid_domain_id=1
server-id=12
[mysqld.3]
wsrep_gtid_domain_id=1
server-id=13
[mysqld.4]
wsrep_gtid_domain_id=2
server-id=21
[mysqld.5]
wsrep_gtid_domain_id=2
server-id=22
[mysqld.6]
wsrep_gtid_domain_id=2
server-id=23

View File

@ -0,0 +1,292 @@
#
# This test creates 2x 3 nodes galera cluster.
# The whole test case
# A <-> B <-> C {Galera cluster 1}
# | {Circular Async replication}
# D <-> E <-> F {Galera cluster 2}
# We will write on any random node to see if gtid is consitent or not
# Then we will kill node D and set up the replication between A and E
# To see whether fail over works or not.
--source include/big_test.inc
--source include/galera_cluster.inc
--source include/have_innodb.inc
--connection node_1
--echo cluster 1 node 1
SHOW STATUS LIKE 'wsrep_cluster_size';
--connection node_2
--echo cluster 1 node 2
SHOW STATUS LIKE 'wsrep_cluster_size';
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_3
--echo cluster 1 node 3
SHOW STATUS LIKE 'wsrep_cluster_size';
--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
--connection node_4
--echo cluster 2 node 1
SHOW STATUS LIKE 'wsrep_cluster_size';
--connect node_5, 127.0.0.1, root, , test, $NODE_MYPORT_5
--connection node_5
--echo cluster 2 node 2
SHOW STATUS LIKE 'wsrep_cluster_size';
--connect node_6, 127.0.0.1, root, , test, $NODE_MYPORT_6
--connection node_6
--echo cluster 2 node 3
SHOW STATUS LIKE 'wsrep_cluster_size';
#--disable_parsing
--connection node_1
--replace_result $NODE_MYPORT_4 NODE_MYPORT_4
--eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_4, master_use_gtid=current_pos, ignore_server_ids=(12,13);
start slave;
--source include/wait_for_slave_to_start.inc
select @@gtid_binlog_state;
select @@gtid_slave_pos;
#--query_vertical SHOW SLAVE STATUS;
--connection node_4
--replace_result $NODE_MYPORT_1 NODE_MYPORT_1
--eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_1, master_use_gtid=current_pos, ignore_server_ids=(22,23);
start slave;
--source include/wait_for_slave_to_start.inc
select @@gtid_binlog_state;
select @@gtid_slave_pos;
#--query_vertical SHOW SLAVE STATUS;
--echo cluster 1 node 1
--connection node_1
create table t1 (cluster_domain_id int ,node_server_id int, seq_no int);
insert into t1 values (1, 11, 2);
select @@gtid_binlog_state;
--echo #wait for sync cluster 1 and 2
--connection node_1
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--echo cluster 2 node 1
--connection node_4
select @@gtid_binlog_state;
insert into t1 values (2, 21, 1);
select @@gtid_binlog_state;
select * from t1;
--echo #wait for sync cluster 1 and 2
--connection node_1
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--echo cluster 1 node 2
--connection node_2
select @@gtid_binlog_state;
insert into t1 values (1, 12, 3);
select @@gtid_binlog_state;
--echo #wait for sync cluster 1 and 2
--connection node_1
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--echo cluster 1 node 3
--connection node_3
select @@gtid_binlog_state;
insert into t1 values (1, 13, 4);
select @@gtid_binlog_state;
--echo #wait for sync cluster 1 and 2
--connection node_1
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--echo cluster 2 node 2
--connection node_5
select @@gtid_binlog_state;
insert into t1 values (2, 22, 2);
select @@gtid_binlog_state;
--echo #wait for sync cluster 2 and 1
--connection node_4
--source include/save_master_gtid.inc
--connection node_1
--source include/sync_with_master_gtid.inc
--echo cluster 2 node 3
--connection node_6
select @@gtid_binlog_state;
insert into t1 values (2, 23, 3);
select @@gtid_binlog_state;
--echo #wait for sync cluster 2 and 1
--connection node_4
--source include/save_master_gtid.inc
--connection node_1
--source include/sync_with_master_gtid.inc
--echo cluster 1 node 1
--connection node_1
select @@gtid_binlog_state;
drop table t1;
stop slave;
reset slave;
change master to master_use_gtid=no, ignore_server_ids=();
reset master;
set global GTID_SLAVE_POS="";
--sleep 2
--echo cluster 2 node 1
--connection node_4
stop slave;
reset slave;
change master to master_use_gtid=no, ignore_server_ids=();
reset master;
set global GTID_SLAVE_POS="";
--connection node_2
reset master;
--connection node_3
reset master;
--connection node_5
reset master;
--connection node_6
reset master;
#--enable_parsing
#
# This test creates 2x 3 nodes galera cluster.
# The whole test case
# A <-> B <-> C {Galera cluster 1}
# \ /
# \ /
# / {C->D, F->A , Async normal slave repl}
# / \
# | \
# D <-> E <-> F {Galera cluster 2}
# We will write on any random node to see if gtid is consitent or not
# Then we will kill node D and set up the replication between A and E
# To see whether fail over works or not.
--connection node_1
--replace_result $NODE_MYPORT_6 NODE_MYPORT_6
--eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_6, master_use_gtid=current_pos, ignore_server_ids=(12,13);
start slave;
--source include/wait_for_slave_to_start.inc
select @@gtid_binlog_state;
select @@gtid_slave_pos;
#--query_vertical SHOW SLAVE STATUS;
--connection node_4
--replace_result $NODE_MYPORT_3 NODE_MYPORT_3
--eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_3, master_use_gtid=current_pos, ignore_server_ids=(22,23);
start slave;
--source include/wait_for_slave_to_start.inc
select @@gtid_binlog_state;
select @@gtid_slave_pos;
#--query_vertical SHOW SLAVE STATUS;
--echo cluster 1 node 1
--connection node_1
create table t1 (cluster_domain_id int ,node_server_id int, seq_no int);
insert into t1 values (1, 11, 2);
select @@gtid_binlog_state;
--echo #wait for sync cluster 1 and 2
--connection node_1
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--sleep 2
--echo cluster 2 node 1
--connection node_4
insert into t1 values (2, 21, 1);
select @@gtid_binlog_state;
select * from t1;
--echo #wait for sync cluster 1 and 2
--connection node_1
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--echo cluster 1 node 2
--connection node_2
select @@gtid_binlog_state;
insert into t1 values (1, 12, 3);
select @@gtid_binlog_state;
--echo #wait for sync cluster 1 and 2
--connection node_1
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--echo cluster 1 node 3
--connection node_3
select @@gtid_binlog_state;
insert into t1 values (1, 13, 4);
select @@gtid_binlog_state;
--echo #wait for sync cluster 1 and 2
--connection node_1
--source include/save_master_gtid.inc
--connection node_4
--source include/sync_with_master_gtid.inc
--echo cluster 2 node 2
--connection node_5
select @@gtid_binlog_state;
insert into t1 values (2, 22, 2);
select @@gtid_binlog_state;
--echo #wait for sync cluster 2 and 1
--connection node_4
--source include/save_master_gtid.inc
--connection node_1
--source include/sync_with_master_gtid.inc
--echo cluster 2 node 3
--connection node_6
select @@gtid_binlog_state;
insert into t1 values (2, 23, 3);
select @@gtid_binlog_state;
--echo #wait for sync cluster 2 and 1
--connection node_4
--source include/save_master_gtid.inc
--connection node_1
--source include/sync_with_master_gtid.inc
--echo cluster 1 node 1
--connection node_1
select @@gtid_binlog_state;
drop table t1;
stop slave;
change master to master_use_gtid=no, ignore_server_ids=();
reset master;
set global GTID_SLAVE_POS="";
--echo cluster 2 node 1
--connection node_4
stop slave;
change master to master_use_gtid=no, ignore_server_ids=();
reset master;
set global GTID_SLAVE_POS="";
--connection node_2
reset master;
--connection node_3
reset master;
--connection node_5
reset master;
--connection node_6
reset master;

View File

@ -1363,3 +1363,9 @@ SELECT * FROM t1;
c1
1e19
DROP TABLE t1;
CREATE TABLE t1 (a DOUBLE PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (-1);
SELECT * FROM t1;
a
-1
DROP TABLE t1;

View File

@ -112,6 +112,35 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB AUTO_INCREMENT=1023 DEFAULT CHARSET=latin1
drop table t1;
drop table t480;
#
# MDEV-12827 Assertion failure when reporting duplicate key error
# in online table rebuild
#
CREATE TABLE t1 (j INT UNIQUE, i INT UNIQUE) ENGINE=InnoDB;
connect con1,localhost,root,,test;
SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built WAIT_FOR log';
ALTER TABLE t1 DROP j, FORCE;
connection default;
SET DEBUG_SYNC='now WAIT_FOR built';
INSERT INTO t1 (i) VALUES (0),(0);
ERROR 23000: Duplicate entry '0' for key 'i'
SET DEBUG_SYNC='now SIGNAL log';
connection con1;
ERROR 23000: Duplicate entry '0' for key 'i'
SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built2 WAIT_FOR log2';
ALTER TABLE t1 DROP j, FORCE;
connection default;
SET DEBUG_SYNC='now WAIT_FOR built2';
INSERT INTO t1 (i) VALUES (0),(1);
UPDATE t1 SET i=0;
ERROR 23000: Duplicate entry '0' for key 'i'
SET DEBUG_SYNC='now SIGNAL log2';
connection con1;
ERROR 23000: Duplicate entry '0' for key 'i'
disconnect con1;
connection default;
SET DEBUG_SYNC='RESET';
DROP TABLE t1;
SET DEBUG_SYNC='RESET';
#
# BUG#21612714 ALTER TABLE SORTING SKIPPED WHEN CHANGE PK AND DROP

View File

@ -3354,3 +3354,83 @@ show status like "handler_read_key";
Variable_name Value
Handler_read_key 0
drop table t1;
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
CREATE TEMPORARY TABLE t2 (c1 INT) ENGINE=InnoDB;
START TRANSACTION READ ONLY;
INSERT INTO t2 VALUES(0);
INSERT INTO t1 VALUES(0);
ERROR 25006: Cannot execute statement in a READ ONLY transaction
ROLLBACK;
SELECT * FROM t1;
c1
SELECT * FROM t2;
c1
START TRANSACTION READ ONLY;
INSERT INTO t1 VALUES(0);
ERROR 25006: Cannot execute statement in a READ ONLY transaction
INSERT INTO t2 VALUES(1);
COMMIT;
SET TRANSACTION READ ONLY;
START TRANSACTION;
INSERT INTO t2 VALUES(3);
INSERT INTO t1 VALUES(0);
ERROR 25006: Cannot execute statement in a READ ONLY transaction
COMMIT;
SELECT * FROM t1;
c1
SELECT * FROM t2;
c1
1
3
DROP TABLE t2;
CREATE TEMPORARY TABLE t2 (
c1 INT AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TEMPORARY TABLE `t2` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
START TRANSACTION READ ONLY;
INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3);
INSERT INTO t1 VALUES(0);
ERROR 25006: Cannot execute statement in a READ ONLY transaction
ROLLBACK;
SELECT * FROM t1;
c1
SELECT * FROM t2;
c1 c2
START TRANSACTION READ ONLY;
INSERT INTO t1 VALUES(0);
ERROR 25006: Cannot execute statement in a READ ONLY transaction
INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3);
COMMIT;
SET TRANSACTION READ ONLY;
START TRANSACTION;
INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3);
INSERT INTO t1 VALUES(0);
ERROR 25006: Cannot execute statement in a READ ONLY transaction
COMMIT;
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TEMPORARY TABLE `t2` (
`c1` int(11) NOT NULL AUTO_INCREMENT,
`c2` int(11) DEFAULT NULL,
PRIMARY KEY (`c1`),
KEY `idx` (`c2`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1
SELECT * FROM t1;
c1
SELECT * FROM t2;
c1 c2
4 1
7 1
5 2
8 2
6 3
9 3
DROP TABLE t1;
DROP TABLE t2;

View File

@ -695,3 +695,8 @@ CREATE TABLE t1 (
INSERT INTO t1 VALUES ();
SELECT * FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a DOUBLE PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (-1);
SELECT * FROM t1;
DROP TABLE t1;

View File

@ -114,6 +114,45 @@ connection default;
show create table t1;
drop table t1;
drop table t480;
--echo #
--echo # MDEV-12827 Assertion failure when reporting duplicate key error
--echo # in online table rebuild
--echo #
CREATE TABLE t1 (j INT UNIQUE, i INT UNIQUE) ENGINE=InnoDB;
--connect (con1,localhost,root,,test)
SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built WAIT_FOR log';
--send
ALTER TABLE t1 DROP j, FORCE;
--connection default
SET DEBUG_SYNC='now WAIT_FOR built';
--error ER_DUP_ENTRY
INSERT INTO t1 (i) VALUES (0),(0);
SET DEBUG_SYNC='now SIGNAL log';
--connection con1
--error ER_DUP_ENTRY
reap;
SET DEBUG_SYNC='row_log_table_apply1_before SIGNAL built2 WAIT_FOR log2';
--send
ALTER TABLE t1 DROP j, FORCE;
--connection default
SET DEBUG_SYNC='now WAIT_FOR built2';
INSERT INTO t1 (i) VALUES (0),(1);
--error ER_DUP_ENTRY
UPDATE t1 SET i=0;
SET DEBUG_SYNC='now SIGNAL log2';
--connection con1
--error ER_DUP_ENTRY
reap;
--disconnect con1
--connection default
SET DEBUG_SYNC='RESET';
DROP TABLE t1;
SET DEBUG_SYNC='RESET';
--source include/wait_until_count_sessions.inc

View File

@ -2618,6 +2618,76 @@ select f1 from t1;
show status like "handler_read_key";
drop table t1;
#
# Test handling of writes to TEMPORARY tables for read-only transactions
#
CREATE TABLE t1 (c1 INT) ENGINE=InnoDB;
CREATE TEMPORARY TABLE t2 (c1 INT) ENGINE=InnoDB;
# Check that the rollback works
START TRANSACTION READ ONLY;
INSERT INTO t2 VALUES(0);
--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT INTO t1 VALUES(0);
ROLLBACK;
SELECT * FROM t1;
SELECT * FROM t2;
START TRANSACTION READ ONLY;
--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT INTO t1 VALUES(0);
INSERT INTO t2 VALUES(1);
COMMIT;
SET TRANSACTION READ ONLY;
START TRANSACTION;
INSERT INTO t2 VALUES(3);
--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT INTO t1 VALUES(0);
COMMIT;
SELECT * FROM t1;
SELECT * FROM t2;
DROP TABLE t2;
# This time with some indexes
CREATE TEMPORARY TABLE t2 (
c1 INT AUTO_INCREMENT PRIMARY KEY,
c2 INT, INDEX idx(c2)) ENGINE=InnoDB;
SHOW CREATE TABLE t2;
# Check that the rollback works
START TRANSACTION READ ONLY;
INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3);
--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT INTO t1 VALUES(0);
ROLLBACK;
SELECT * FROM t1;
SELECT * FROM t2;
START TRANSACTION READ ONLY;
--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT INTO t1 VALUES(0);
INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3);
COMMIT;
SET TRANSACTION READ ONLY;
START TRANSACTION;
INSERT INTO t2 VALUES(NULL,1),(NULL,2),(NULL,3);
--error ER_CANT_EXECUTE_IN_READ_ONLY_TRANSACTION
INSERT INTO t1 VALUES(0);
COMMIT;
SHOW CREATE TABLE t2;
SELECT * FROM t1;
SELECT * FROM t2;
DROP TABLE t1;
DROP TABLE t2;
#######################################################################
# #
# Please, DO NOT TOUCH this file as well as the innodb.result file. #

View File

@ -3,6 +3,13 @@ CREATE TABLE t(a INT UNSIGNED PRIMARY KEY) ENGINE INNODB;
INSERT INTO t VALUES(0);
COMMIT;
start transaction;
connect flush_log,localhost,root,,;
BEGIN;
DELETE FROM t LIMIT 1;
SET GLOBAL innodb_flush_log_at_trx_commit = 1;
ROLLBACK;
disconnect flush_log;
connection default;
NOT FOUND /Rollback of trx with id/ in current_test
# expect NOT FOUND
NOT FOUND /Rollback of trx with id/ in current_test

View File

@ -26,6 +26,13 @@ eval INSERT t VALUES(201-$n);
dec $n;
}
--enable_query_log
connect (flush_log,localhost,root,,);
BEGIN;
DELETE FROM t LIMIT 1;
SET GLOBAL innodb_flush_log_at_trx_commit = 1;
ROLLBACK;
disconnect flush_log;
connection default;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --ftwrl-wait-timeout=5 --ftwrl-wait-threshold=300 --ftwrl-wait-query-type=all --target-dir=$incremental_dir --incremental-basedir=$basedir ;

View File

@ -0,0 +1,37 @@
--echo #
--echo # MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine
--echo #
--eval CREATE TABLE t1 (i INT) ENGINE=$engine PARTITION BY LIST(i) (PARTITION p0 VALUES IN (1), PARTITION p1 VALUES IN (2));
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DROP PARTITION p1;
SELECT * FROM t1;
# Cleanup
DROP TABLE t1;
--echo #
--echo # MDEV-13788 Server crash when issuing bad SQL partition syntax
--echo #
--eval CREATE TABLE t1 (id int, d date) ENGINE=$engine PARTITION BY RANGE COLUMNS(d) (PARTITION p1 VALUES LESS THAN (MAXVALUE))
SHOW CREATE TABLE t1;
--error ER_PARTITION_REQUIRES_VALUES_ERROR
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO
(
PARTITION p2, /* Notice no values */
PARTITION p3 VALUES LESS THAN (MAXVALUE)
);
DROP TABLE t1;
--eval CREATE TABLE t1 (id int, d date) ENGINE=$engine PARTITION BY LIST (id) (PARTITION p1 VALUES IN (1,2,3))
SHOW CREATE TABLE t1;
--error ER_PARTITION_REQUIRES_VALUES_ERROR
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO
(
PARTITION p2, /* Notice no values */
PARTITION p3 VALUES IN (4,5,6)
);
DROP TABLE t1;

View File

@ -0,0 +1,44 @@
#
# MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine
#
CREATE TABLE t1 (i INT) ENGINE=InnoDB PARTITION BY LIST(i) (PARTITION p0 VALUES IN (1), PARTITION p1 VALUES IN (2));;
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DROP PARTITION p1;
SELECT * FROM t1;
i
DROP TABLE t1;
#
# MDEV-13788 Server crash when issuing bad SQL partition syntax
#
CREATE TABLE t1 (id int, d date) ENGINE=InnoDB PARTITION BY RANGE COLUMNS(d) (PARTITION p1 VALUES LESS THAN (MAXVALUE));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`d` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY RANGE COLUMNS(`d`)
(PARTITION `p1` VALUES LESS THAN (MAXVALUE) ENGINE = InnoDB)
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO
(
PARTITION p2, /* Notice no values */
PARTITION p3 VALUES LESS THAN (MAXVALUE)
);
ERROR HY000: Syntax error: RANGE PARTITIONING requires definition of VALUES LESS THAN for each partition
DROP TABLE t1;
CREATE TABLE t1 (id int, d date) ENGINE=InnoDB PARTITION BY LIST (id) (PARTITION p1 VALUES IN (1,2,3));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`d` date DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
PARTITION BY LIST (`id`)
(PARTITION `p1` VALUES IN (1,2,3) ENGINE = InnoDB)
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO
(
PARTITION p2, /* Notice no values */
PARTITION p3 VALUES IN (4,5,6)
);
ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition
DROP TABLE t1;

View File

@ -16,3 +16,47 @@ select * from t1;
pk dt
1 2017-09-28 15:12:00
drop table t1;
#
# MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine
#
CREATE TABLE t1 (i INT) ENGINE=Aria PARTITION BY LIST(i) (PARTITION p0 VALUES IN (1), PARTITION p1 VALUES IN (2));;
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DROP PARTITION p1;
SELECT * FROM t1;
i
DROP TABLE t1;
#
# MDEV-13788 Server crash when issuing bad SQL partition syntax
#
CREATE TABLE t1 (id int, d date) ENGINE=Aria PARTITION BY RANGE COLUMNS(d) (PARTITION p1 VALUES LESS THAN (MAXVALUE));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`d` date DEFAULT NULL
) ENGINE=Aria DEFAULT CHARSET=latin1
PARTITION BY RANGE COLUMNS(`d`)
(PARTITION `p1` VALUES LESS THAN (MAXVALUE) ENGINE = Aria)
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO
(
PARTITION p2, /* Notice no values */
PARTITION p3 VALUES LESS THAN (MAXVALUE)
);
ERROR HY000: Syntax error: RANGE PARTITIONING requires definition of VALUES LESS THAN for each partition
DROP TABLE t1;
CREATE TABLE t1 (id int, d date) ENGINE=Aria PARTITION BY LIST (id) (PARTITION p1 VALUES IN (1,2,3));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`d` date DEFAULT NULL
) ENGINE=Aria DEFAULT CHARSET=latin1
PARTITION BY LIST (`id`)
(PARTITION `p1` VALUES IN (1,2,3) ENGINE = Aria)
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO
(
PARTITION p2, /* Notice no values */
PARTITION p3 VALUES IN (4,5,6)
);
ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition
DROP TABLE t1;

View File

@ -1,10 +1,57 @@
CREATE TABLE t1 (i INT) ENGINE=MYISAM
PARTITION BY LIST(i) (
PARTITION p0 VALUES IN (1),
PARTITION p1 VALUES IN (2)
);
#
# MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine
#
CREATE TABLE t1 (i INT) ENGINE=MyISAM PARTITION BY LIST(i) (PARTITION p0 VALUES IN (1), PARTITION p1 VALUES IN (2));;
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DROP PARTITION p1;
SELECT * FROM t1;
i
DROP TABLE t1;
#
# MDEV-13788 Server crash when issuing bad SQL partition syntax
#
CREATE TABLE t1 (id int, d date) ENGINE=MyISAM PARTITION BY RANGE COLUMNS(d) (PARTITION p1 VALUES LESS THAN (MAXVALUE));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`d` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY RANGE COLUMNS(`d`)
(PARTITION `p1` VALUES LESS THAN (MAXVALUE) ENGINE = MyISAM)
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO
(
PARTITION p2, /* Notice no values */
PARTITION p3 VALUES LESS THAN (MAXVALUE)
);
ERROR HY000: Syntax error: RANGE PARTITIONING requires definition of VALUES LESS THAN for each partition
DROP TABLE t1;
CREATE TABLE t1 (id int, d date) ENGINE=MyISAM PARTITION BY LIST (id) (PARTITION p1 VALUES IN (1,2,3));
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`id` int(11) DEFAULT NULL,
`d` date DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
PARTITION BY LIST (`id`)
(PARTITION `p1` VALUES IN (1,2,3) ENGINE = MyISAM)
ALTER TABLE t1 REORGANIZE PARTITION p1 INTO
(
PARTITION p2, /* Notice no values */
PARTITION p3 VALUES IN (4,5,6)
);
ERROR HY000: Syntax error: LIST PARTITIONING requires definition of VALUES IN for each partition
DROP TABLE t1;
create table t1 ( c1 int, c2 int, c3 varchar(100)) delay_key_write=1
partition by key(c1) (
partition p01 data directory = 'MYSQL_TMP_DIR'
index directory = 'MYSQL_TMP_DIR',
partition p02 data directory = 'MYSQL_TMP_DIR'
index directory = 'MYSQL_TMP_DIR');
insert into t1 values (1, 1, repeat('a', 100));
insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1;
insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1;
insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1;
alter online table t1 delay_key_write=0;
alter online table t1 delay_key_write=1;
drop table t1;

View File

@ -0,0 +1,4 @@
--source include/have_innodb.inc
--source include/have_partition.inc
--let $engine=InnoDB
--source inc/part_alter_values.inc

View File

@ -16,3 +16,6 @@ select * from t1;
alter table t1 drop partition p20181231;
select * from t1;
drop table t1;
--let $engine=Aria
--source inc/part_alter_values.inc

View File

@ -1,17 +1,22 @@
#
# MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine
#
--source include/have_partition.inc
--let $engine=MyISAM
--source inc/part_alter_values.inc
CREATE TABLE t1 (i INT) ENGINE=MYISAM
PARTITION BY LIST(i) (
PARTITION p0 VALUES IN (1),
PARTITION p1 VALUES IN (2)
);
ALTER TABLE t1 ROW_FORMAT=COMPRESSED;
ALTER TABLE t1 DROP PARTITION p1;
SELECT * FROM t1;
#
# MDEV-14026 ALTER TABLE ... DELAY_KEY_WRITE=1 creates table copy for partitioned MyISAM table with DATA DIRECTORY/INDEX DIRECTORY options
#
# Cleanup
DROP TABLE t1;
replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR;
eval create table t1 ( c1 int, c2 int, c3 varchar(100)) delay_key_write=1
partition by key(c1) (
partition p01 data directory = '$MYSQL_TMP_DIR'
index directory = '$MYSQL_TMP_DIR',
partition p02 data directory = '$MYSQL_TMP_DIR'
index directory = '$MYSQL_TMP_DIR');
insert into t1 values (1, 1, repeat('a', 100));
insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1;
insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1;
insert into t1 select rand()*1000, rand()*1000, repeat('b', 100) from t1;
alter online table t1 delay_key_write=0;
alter online table t1 delay_key_write=1;
drop table t1;

View File

@ -0,0 +1,19 @@
INSTALL SONAME "simple_password_check";
SELECT PLUGIN_NAME FROM INFORMATION_SCHEMA.PLUGINS
WHERE PLUGIN_NAME='simple_password_check';
PLUGIN_NAME
simple_password_check
#
# MDEV-14031 Password policy causes replication failure
#
CREATE USER user1@localhost IDENTIFIED BY 'BsG9#9.cem#!85';
CREATE USER user2@localhost IDENTIFIED BY 'bsg9#d.cem#!85';
ERROR HY000: Your password does not satisfy the current policy requirements
DROP USER user1@localhost;
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; CREATE USER user1@localhost IDENTIFIED BY 'BsG9#9.cem#!85'
master-bin.000001 # Gtid # # GTID #-#-#
master-bin.000001 # Query # # use `test`; DROP USER user1@localhost
UNINSTALL PLUGIN simple_password_check;

View File

@ -0,0 +1,31 @@
--source include/not_embedded.inc
--source include/have_binlog_format_statement.inc
if (!$SIMPLE_PASSWORD_CHECK_SO) {
skip No SIMPLE_PASSWORD_CHECK plugin;
}
INSTALL SONAME "simple_password_check";
SELECT PLUGIN_NAME FROM INFORMATION_SCHEMA.PLUGINS
WHERE PLUGIN_NAME='simple_password_check';
--echo #
--echo # MDEV-14031 Password policy causes replication failure
--echo #
--disable_query_log
RESET MASTER; # get rid of previous tests binlog
--enable_query_log
CREATE USER user1@localhost IDENTIFIED BY 'BsG9#9.cem#!85';
--error ER_NOT_VALID_PASSWORD
CREATE USER user2@localhost IDENTIFIED BY 'bsg9#d.cem#!85';
DROP USER user1@localhost;
--let $binlog_file = LAST
source include/show_binlog_events.inc;
UNINSTALL PLUGIN simple_password_check;

View File

@ -0,0 +1,543 @@
#
# MDEV-12366: FLUSH PRIVILEGES can break hierarchy of roles
#
# This testcase contains a user, who is granted a master role
# operations_cluster. operations_cluster is granted 8 different roles
# who in turn each have 4 different roles granted to them.
#
# Only the leaf roles contain privileges to access databases.
# Make sure the user has access to all databases if the master role
# is granted to him.
#
CREATE USER u;
CREATE ROLE operations_cluster;
GRANT operations_cluster TO u;
CREATE DATABASE bob_live_sg;
CREATE TABLE bob_live_sg.a (i INT(10));
CREATE TABLE bob_live_sg.b (i INT(10));
CREATE TABLE bob_live_sg.c (i INT(10));
CREATE TABLE bob_live_sg.d (i INT(10));
CREATE DATABASE oms_live_sg;
CREATE TABLE oms_live_sg.a (i INT(10));
CREATE TABLE oms_live_sg.b (i INT(10));
CREATE TABLE oms_live_sg.c (i INT(10));
CREATE TABLE oms_live_sg.d (i INT(10));
CREATE DATABASE bob_live_ph;
CREATE TABLE bob_live_ph.a (i INT(10));
CREATE TABLE bob_live_ph.b (i INT(10));
CREATE TABLE bob_live_ph.c (i INT(10));
CREATE TABLE bob_live_ph.d (i INT(10));
CREATE DATABASE oms_live_ph;
CREATE TABLE oms_live_ph.a (i INT(10));
CREATE TABLE oms_live_ph.b (i INT(10));
CREATE TABLE oms_live_ph.c (i INT(10));
CREATE TABLE oms_live_ph.d (i INT(10));
CREATE DATABASE bob_live_id;
CREATE TABLE bob_live_id.a (i INT(10));
CREATE TABLE bob_live_id.b (i INT(10));
CREATE TABLE bob_live_id.c (i INT(10));
CREATE TABLE bob_live_id.d (i INT(10));
CREATE DATABASE oms_live_id;
CREATE TABLE oms_live_id.a (i INT(10));
CREATE TABLE oms_live_id.b (i INT(10));
CREATE TABLE oms_live_id.c (i INT(10));
CREATE TABLE oms_live_id.d (i INT(10));
CREATE DATABASE bob_live_hk;
CREATE TABLE bob_live_hk.a (i INT(10));
CREATE TABLE bob_live_hk.b (i INT(10));
CREATE TABLE bob_live_hk.c (i INT(10));
CREATE TABLE bob_live_hk.d (i INT(10));
CREATE DATABASE oms_live_hk;
CREATE TABLE oms_live_hk.a (i INT(10));
CREATE TABLE oms_live_hk.b (i INT(10));
CREATE TABLE oms_live_hk.c (i INT(10));
CREATE TABLE oms_live_hk.d (i INT(10));
CREATE DATABASE bob_live_vn;
CREATE TABLE bob_live_vn.a (i INT(10));
CREATE TABLE bob_live_vn.b (i INT(10));
CREATE TABLE bob_live_vn.c (i INT(10));
CREATE TABLE bob_live_vn.d (i INT(10));
CREATE DATABASE oms_live_vn;
CREATE TABLE oms_live_vn.a (i INT(10));
CREATE TABLE oms_live_vn.b (i INT(10));
CREATE TABLE oms_live_vn.c (i INT(10));
CREATE TABLE oms_live_vn.d (i INT(10));
CREATE DATABASE bob_live_tw;
CREATE TABLE bob_live_tw.a (i INT(10));
CREATE TABLE bob_live_tw.b (i INT(10));
CREATE TABLE bob_live_tw.c (i INT(10));
CREATE TABLE bob_live_tw.d (i INT(10));
CREATE DATABASE oms_live_tw;
CREATE TABLE oms_live_tw.a (i INT(10));
CREATE TABLE oms_live_tw.b (i INT(10));
CREATE TABLE oms_live_tw.c (i INT(10));
CREATE TABLE oms_live_tw.d (i INT(10));
CREATE DATABASE bob_live_my;
CREATE TABLE bob_live_my.a (i INT(10));
CREATE TABLE bob_live_my.b (i INT(10));
CREATE TABLE bob_live_my.c (i INT(10));
CREATE TABLE bob_live_my.d (i INT(10));
CREATE DATABASE oms_live_my;
CREATE TABLE oms_live_my.a (i INT(10));
CREATE TABLE oms_live_my.b (i INT(10));
CREATE TABLE oms_live_my.c (i INT(10));
CREATE TABLE oms_live_my.d (i INT(10));
CREATE DATABASE bob_live_th;
CREATE TABLE bob_live_th.a (i INT(10));
CREATE TABLE bob_live_th.b (i INT(10));
CREATE TABLE bob_live_th.c (i INT(10));
CREATE TABLE bob_live_th.d (i INT(10));
CREATE DATABASE oms_live_th;
CREATE TABLE oms_live_th.a (i INT(10));
CREATE TABLE oms_live_th.b (i INT(10));
CREATE TABLE oms_live_th.c (i INT(10));
CREATE TABLE oms_live_th.d (i INT(10));
CREATE ROLE a_sg;
CREATE ROLE b_sg;
CREATE ROLE c_sg;
CREATE ROLE d_sg;
CREATE ROLE operations_sg;
GRANT a_sg TO operations_sg;
GRANT b_sg TO operations_sg;
GRANT c_sg TO operations_sg;
GRANT d_sg TO operations_sg;
GRANT SELECT ON bob_live_sg.a TO a_sg;
GRANT SELECT ON bob_live_sg.b TO b_sg;
GRANT SELECT ON bob_live_sg.c TO c_sg;
GRANT SELECT ON bob_live_sg.d TO d_sg;
GRANT SELECT ON oms_live_sg.a TO a_sg;
GRANT SELECT ON oms_live_sg.b TO b_sg;
GRANT SELECT ON oms_live_sg.c TO c_sg;
GRANT SELECT ON oms_live_sg.d TO d_sg;
CREATE ROLE a_ph;
CREATE ROLE b_ph;
CREATE ROLE c_ph;
CREATE ROLE d_ph;
CREATE ROLE operations_ph;
GRANT a_ph TO operations_ph;
GRANT b_ph TO operations_ph;
GRANT c_ph TO operations_ph;
GRANT d_ph TO operations_ph;
GRANT SELECT ON bob_live_ph.a TO a_ph;
GRANT SELECT ON bob_live_ph.b TO b_ph;
GRANT SELECT ON bob_live_ph.c TO c_ph;
GRANT SELECT ON bob_live_ph.d TO d_ph;
GRANT SELECT ON oms_live_ph.a TO a_ph;
GRANT SELECT ON oms_live_ph.b TO b_ph;
GRANT SELECT ON oms_live_ph.c TO c_ph;
GRANT SELECT ON oms_live_ph.d TO d_ph;
CREATE ROLE a_id;
CREATE ROLE b_id;
CREATE ROLE c_id;
CREATE ROLE d_id;
CREATE ROLE operations_id;
GRANT a_id TO operations_id;
GRANT b_id TO operations_id;
GRANT c_id TO operations_id;
GRANT d_id TO operations_id;
GRANT SELECT ON bob_live_id.a TO a_id;
GRANT SELECT ON bob_live_id.b TO b_id;
GRANT SELECT ON bob_live_id.c TO c_id;
GRANT SELECT ON bob_live_id.d TO d_id;
GRANT SELECT ON oms_live_id.a TO a_id;
GRANT SELECT ON oms_live_id.b TO b_id;
GRANT SELECT ON oms_live_id.c TO c_id;
GRANT SELECT ON oms_live_id.d TO d_id;
CREATE ROLE a_hk;
CREATE ROLE b_hk;
CREATE ROLE c_hk;
CREATE ROLE d_hk;
CREATE ROLE operations_hk;
GRANT a_hk TO operations_hk;
GRANT b_hk TO operations_hk;
GRANT c_hk TO operations_hk;
GRANT d_hk TO operations_hk;
GRANT SELECT ON bob_live_hk.a TO a_hk;
GRANT SELECT ON bob_live_hk.b TO b_hk;
GRANT SELECT ON bob_live_hk.c TO c_hk;
GRANT SELECT ON bob_live_hk.d TO d_hk;
GRANT SELECT ON oms_live_hk.a TO a_hk;
GRANT SELECT ON oms_live_hk.b TO b_hk;
GRANT SELECT ON oms_live_hk.c TO c_hk;
GRANT SELECT ON oms_live_hk.d TO d_hk;
CREATE ROLE a_vn;
CREATE ROLE b_vn;
CREATE ROLE c_vn;
CREATE ROLE d_vn;
CREATE ROLE operations_vn;
GRANT a_vn TO operations_vn;
GRANT b_vn TO operations_vn;
GRANT c_vn TO operations_vn;
GRANT d_vn TO operations_vn;
GRANT SELECT ON bob_live_vn.a TO a_vn;
GRANT SELECT ON bob_live_vn.b TO b_vn;
GRANT SELECT ON bob_live_vn.c TO c_vn;
GRANT SELECT ON bob_live_vn.d TO d_vn;
GRANT SELECT ON oms_live_vn.a TO a_vn;
GRANT SELECT ON oms_live_vn.b TO b_vn;
GRANT SELECT ON oms_live_vn.c TO c_vn;
GRANT SELECT ON oms_live_vn.d TO d_vn;
CREATE ROLE a_tw;
CREATE ROLE b_tw;
CREATE ROLE c_tw;
CREATE ROLE d_tw;
CREATE ROLE operations_tw;
GRANT a_tw TO operations_tw;
GRANT b_tw TO operations_tw;
GRANT c_tw TO operations_tw;
GRANT d_tw TO operations_tw;
GRANT SELECT ON bob_live_tw.a TO a_tw;
GRANT SELECT ON bob_live_tw.b TO b_tw;
GRANT SELECT ON bob_live_tw.c TO c_tw;
GRANT SELECT ON bob_live_tw.d TO d_tw;
GRANT SELECT ON oms_live_tw.a TO a_tw;
GRANT SELECT ON oms_live_tw.b TO b_tw;
GRANT SELECT ON oms_live_tw.c TO c_tw;
GRANT SELECT ON oms_live_tw.d TO d_tw;
CREATE ROLE a_my;
CREATE ROLE b_my;
CREATE ROLE c_my;
CREATE ROLE d_my;
CREATE ROLE operations_my;
GRANT a_my TO operations_my;
GRANT b_my TO operations_my;
GRANT c_my TO operations_my;
GRANT d_my TO operations_my;
GRANT SELECT ON bob_live_my.a TO a_my;
GRANT SELECT ON bob_live_my.b TO b_my;
GRANT SELECT ON bob_live_my.c TO c_my;
GRANT SELECT ON bob_live_my.d TO d_my;
GRANT SELECT ON oms_live_my.a TO a_my;
GRANT SELECT ON oms_live_my.b TO b_my;
GRANT SELECT ON oms_live_my.c TO c_my;
GRANT SELECT ON oms_live_my.d TO d_my;
CREATE ROLE a_th;
CREATE ROLE b_th;
CREATE ROLE c_th;
CREATE ROLE d_th;
CREATE ROLE operations_th;
GRANT a_th TO operations_th;
GRANT b_th TO operations_th;
GRANT c_th TO operations_th;
GRANT d_th TO operations_th;
GRANT SELECT ON bob_live_th.a TO a_th;
GRANT SELECT ON bob_live_th.b TO b_th;
GRANT SELECT ON bob_live_th.c TO c_th;
GRANT SELECT ON bob_live_th.d TO d_th;
GRANT SELECT ON oms_live_th.a TO a_th;
GRANT SELECT ON oms_live_th.b TO b_th;
GRANT SELECT ON oms_live_th.c TO c_th;
GRANT SELECT ON oms_live_th.d TO d_th;
GRANT operations_sg TO operations_cluster;
GRANT operations_ph TO operations_cluster;
GRANT operations_id TO operations_cluster;
GRANT operations_hk TO operations_cluster;
GRANT operations_vn TO operations_cluster;
GRANT operations_tw TO operations_cluster;
GRANT operations_my TO operations_cluster;
GRANT operations_th TO operations_cluster;
connect con1,localhost,u,,;
SHOW DATABASES;
Database
information_schema
test
SET ROLE operations_cluster;
SHOW DATABASES;
Database
bob_live_hk
bob_live_id
bob_live_my
bob_live_ph
bob_live_sg
bob_live_th
bob_live_tw
bob_live_vn
information_schema
oms_live_hk
oms_live_id
oms_live_my
oms_live_ph
oms_live_sg
oms_live_th
oms_live_tw
oms_live_vn
test
SELECT COUNT(1) FROM oms_live_sg.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_sg.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_sg.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_sg.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_ph.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_ph.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_ph.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_ph.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_id.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_id.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_id.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_id.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_hk.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_hk.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_hk.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_hk.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_vn.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_vn.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_vn.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_vn.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_tw.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_tw.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_tw.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_tw.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_my.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_my.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_my.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_my.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_th.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_th.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_th.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_th.d;
COUNT(1)
0
connect con2,localhost,root,,;
FLUSH PRIVILEGES;
connect con3,localhost,u,,;
SHOW DATABASES;
Database
information_schema
test
SET ROLE operations_cluster;
SHOW DATABASES;
Database
bob_live_hk
bob_live_id
bob_live_my
bob_live_ph
bob_live_sg
bob_live_th
bob_live_tw
bob_live_vn
information_schema
oms_live_hk
oms_live_id
oms_live_my
oms_live_ph
oms_live_sg
oms_live_th
oms_live_tw
oms_live_vn
test
SELECT COUNT(1) FROM oms_live_sg.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_sg.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_sg.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_sg.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_ph.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_ph.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_ph.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_ph.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_id.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_id.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_id.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_id.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_hk.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_hk.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_hk.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_hk.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_vn.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_vn.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_vn.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_vn.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_tw.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_tw.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_tw.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_tw.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_my.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_my.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_my.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_my.d;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_th.a;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_th.b;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_th.c;
COUNT(1)
0
SELECT COUNT(1) FROM oms_live_th.d;
COUNT(1)
0
connect con4,localhost,root,,;
DROP DATABASE bob_live_sg;
DROP DATABASE oms_live_sg;
DROP DATABASE bob_live_ph;
DROP DATABASE oms_live_ph;
DROP DATABASE bob_live_id;
DROP DATABASE oms_live_id;
DROP DATABASE bob_live_hk;
DROP DATABASE oms_live_hk;
DROP DATABASE bob_live_vn;
DROP DATABASE oms_live_vn;
DROP DATABASE bob_live_tw;
DROP DATABASE oms_live_tw;
DROP DATABASE bob_live_my;
DROP DATABASE oms_live_my;
DROP DATABASE bob_live_th;
DROP DATABASE oms_live_th;
DROP ROLE operations_sg;
DROP ROLE a_sg;
DROP ROLE b_sg;
DROP ROLE c_sg;
DROP ROLE d_sg;
DROP ROLE operations_ph;
DROP ROLE a_ph;
DROP ROLE b_ph;
DROP ROLE c_ph;
DROP ROLE d_ph;
DROP ROLE operations_id;
DROP ROLE a_id;
DROP ROLE b_id;
DROP ROLE c_id;
DROP ROLE d_id;
DROP ROLE operations_hk;
DROP ROLE a_hk;
DROP ROLE b_hk;
DROP ROLE c_hk;
DROP ROLE d_hk;
DROP ROLE operations_vn;
DROP ROLE a_vn;
DROP ROLE b_vn;
DROP ROLE c_vn;
DROP ROLE d_vn;
DROP ROLE operations_tw;
DROP ROLE a_tw;
DROP ROLE b_tw;
DROP ROLE c_tw;
DROP ROLE d_tw;
DROP ROLE operations_my;
DROP ROLE a_my;
DROP ROLE b_my;
DROP ROLE c_my;
DROP ROLE d_my;
DROP ROLE operations_th;
DROP ROLE a_th;
DROP ROLE b_th;
DROP ROLE c_th;
DROP ROLE d_th;
DROP USER u;
DROP ROLE operations_cluster;

View File

@ -0,0 +1,379 @@
--source include/not_embedded.inc
--echo #
--echo # MDEV-12366: FLUSH PRIVILEGES can break hierarchy of roles
--echo #
--echo # This testcase contains a user, who is granted a master role
--echo # operations_cluster. operations_cluster is granted 8 different roles
--echo # who in turn each have 4 different roles granted to them.
--echo #
--echo # Only the leaf roles contain privileges to access databases.
--echo # Make sure the user has access to all databases if the master role
--echo # is granted to him.
--echo #
CREATE USER u;
CREATE ROLE operations_cluster;
GRANT operations_cluster TO u;
CREATE DATABASE bob_live_sg;
CREATE TABLE bob_live_sg.a (i INT(10));
CREATE TABLE bob_live_sg.b (i INT(10));
CREATE TABLE bob_live_sg.c (i INT(10));
CREATE TABLE bob_live_sg.d (i INT(10));
CREATE DATABASE oms_live_sg;
CREATE TABLE oms_live_sg.a (i INT(10));
CREATE TABLE oms_live_sg.b (i INT(10));
CREATE TABLE oms_live_sg.c (i INT(10));
CREATE TABLE oms_live_sg.d (i INT(10));
CREATE DATABASE bob_live_ph;
CREATE TABLE bob_live_ph.a (i INT(10));
CREATE TABLE bob_live_ph.b (i INT(10));
CREATE TABLE bob_live_ph.c (i INT(10));
CREATE TABLE bob_live_ph.d (i INT(10));
CREATE DATABASE oms_live_ph;
CREATE TABLE oms_live_ph.a (i INT(10));
CREATE TABLE oms_live_ph.b (i INT(10));
CREATE TABLE oms_live_ph.c (i INT(10));
CREATE TABLE oms_live_ph.d (i INT(10));
CREATE DATABASE bob_live_id;
CREATE TABLE bob_live_id.a (i INT(10));
CREATE TABLE bob_live_id.b (i INT(10));
CREATE TABLE bob_live_id.c (i INT(10));
CREATE TABLE bob_live_id.d (i INT(10));
CREATE DATABASE oms_live_id;
CREATE TABLE oms_live_id.a (i INT(10));
CREATE TABLE oms_live_id.b (i INT(10));
CREATE TABLE oms_live_id.c (i INT(10));
CREATE TABLE oms_live_id.d (i INT(10));
CREATE DATABASE bob_live_hk;
CREATE TABLE bob_live_hk.a (i INT(10));
CREATE TABLE bob_live_hk.b (i INT(10));
CREATE TABLE bob_live_hk.c (i INT(10));
CREATE TABLE bob_live_hk.d (i INT(10));
CREATE DATABASE oms_live_hk;
CREATE TABLE oms_live_hk.a (i INT(10));
CREATE TABLE oms_live_hk.b (i INT(10));
CREATE TABLE oms_live_hk.c (i INT(10));
CREATE TABLE oms_live_hk.d (i INT(10));
CREATE DATABASE bob_live_vn;
CREATE TABLE bob_live_vn.a (i INT(10));
CREATE TABLE bob_live_vn.b (i INT(10));
CREATE TABLE bob_live_vn.c (i INT(10));
CREATE TABLE bob_live_vn.d (i INT(10));
CREATE DATABASE oms_live_vn;
CREATE TABLE oms_live_vn.a (i INT(10));
CREATE TABLE oms_live_vn.b (i INT(10));
CREATE TABLE oms_live_vn.c (i INT(10));
CREATE TABLE oms_live_vn.d (i INT(10));
CREATE DATABASE bob_live_tw;
CREATE TABLE bob_live_tw.a (i INT(10));
CREATE TABLE bob_live_tw.b (i INT(10));
CREATE TABLE bob_live_tw.c (i INT(10));
CREATE TABLE bob_live_tw.d (i INT(10));
CREATE DATABASE oms_live_tw;
CREATE TABLE oms_live_tw.a (i INT(10));
CREATE TABLE oms_live_tw.b (i INT(10));
CREATE TABLE oms_live_tw.c (i INT(10));
CREATE TABLE oms_live_tw.d (i INT(10));
CREATE DATABASE bob_live_my;
CREATE TABLE bob_live_my.a (i INT(10));
CREATE TABLE bob_live_my.b (i INT(10));
CREATE TABLE bob_live_my.c (i INT(10));
CREATE TABLE bob_live_my.d (i INT(10));
CREATE DATABASE oms_live_my;
CREATE TABLE oms_live_my.a (i INT(10));
CREATE TABLE oms_live_my.b (i INT(10));
CREATE TABLE oms_live_my.c (i INT(10));
CREATE TABLE oms_live_my.d (i INT(10));
CREATE DATABASE bob_live_th;
CREATE TABLE bob_live_th.a (i INT(10));
CREATE TABLE bob_live_th.b (i INT(10));
CREATE TABLE bob_live_th.c (i INT(10));
CREATE TABLE bob_live_th.d (i INT(10));
CREATE DATABASE oms_live_th;
CREATE TABLE oms_live_th.a (i INT(10));
CREATE TABLE oms_live_th.b (i INT(10));
CREATE TABLE oms_live_th.c (i INT(10));
CREATE TABLE oms_live_th.d (i INT(10));
CREATE ROLE a_sg;
CREATE ROLE b_sg;
CREATE ROLE c_sg;
CREATE ROLE d_sg;
CREATE ROLE operations_sg;
GRANT a_sg TO operations_sg;
GRANT b_sg TO operations_sg;
GRANT c_sg TO operations_sg;
GRANT d_sg TO operations_sg;
GRANT SELECT ON bob_live_sg.a TO a_sg;
GRANT SELECT ON bob_live_sg.b TO b_sg;
GRANT SELECT ON bob_live_sg.c TO c_sg;
GRANT SELECT ON bob_live_sg.d TO d_sg;
GRANT SELECT ON oms_live_sg.a TO a_sg;
GRANT SELECT ON oms_live_sg.b TO b_sg;
GRANT SELECT ON oms_live_sg.c TO c_sg;
GRANT SELECT ON oms_live_sg.d TO d_sg;
CREATE ROLE a_ph;
CREATE ROLE b_ph;
CREATE ROLE c_ph;
CREATE ROLE d_ph;
CREATE ROLE operations_ph;
GRANT a_ph TO operations_ph;
GRANT b_ph TO operations_ph;
GRANT c_ph TO operations_ph;
GRANT d_ph TO operations_ph;
GRANT SELECT ON bob_live_ph.a TO a_ph;
GRANT SELECT ON bob_live_ph.b TO b_ph;
GRANT SELECT ON bob_live_ph.c TO c_ph;
GRANT SELECT ON bob_live_ph.d TO d_ph;
GRANT SELECT ON oms_live_ph.a TO a_ph;
GRANT SELECT ON oms_live_ph.b TO b_ph;
GRANT SELECT ON oms_live_ph.c TO c_ph;
GRANT SELECT ON oms_live_ph.d TO d_ph;
CREATE ROLE a_id;
CREATE ROLE b_id;
CREATE ROLE c_id;
CREATE ROLE d_id;
CREATE ROLE operations_id;
GRANT a_id TO operations_id;
GRANT b_id TO operations_id;
GRANT c_id TO operations_id;
GRANT d_id TO operations_id;
GRANT SELECT ON bob_live_id.a TO a_id;
GRANT SELECT ON bob_live_id.b TO b_id;
GRANT SELECT ON bob_live_id.c TO c_id;
GRANT SELECT ON bob_live_id.d TO d_id;
GRANT SELECT ON oms_live_id.a TO a_id;
GRANT SELECT ON oms_live_id.b TO b_id;
GRANT SELECT ON oms_live_id.c TO c_id;
GRANT SELECT ON oms_live_id.d TO d_id;
CREATE ROLE a_hk;
CREATE ROLE b_hk;
CREATE ROLE c_hk;
CREATE ROLE d_hk;
CREATE ROLE operations_hk;
GRANT a_hk TO operations_hk;
GRANT b_hk TO operations_hk;
GRANT c_hk TO operations_hk;
GRANT d_hk TO operations_hk;
GRANT SELECT ON bob_live_hk.a TO a_hk;
GRANT SELECT ON bob_live_hk.b TO b_hk;
GRANT SELECT ON bob_live_hk.c TO c_hk;
GRANT SELECT ON bob_live_hk.d TO d_hk;
GRANT SELECT ON oms_live_hk.a TO a_hk;
GRANT SELECT ON oms_live_hk.b TO b_hk;
GRANT SELECT ON oms_live_hk.c TO c_hk;
GRANT SELECT ON oms_live_hk.d TO d_hk;
CREATE ROLE a_vn;
CREATE ROLE b_vn;
CREATE ROLE c_vn;
CREATE ROLE d_vn;
CREATE ROLE operations_vn;
GRANT a_vn TO operations_vn;
GRANT b_vn TO operations_vn;
GRANT c_vn TO operations_vn;
GRANT d_vn TO operations_vn;
GRANT SELECT ON bob_live_vn.a TO a_vn;
GRANT SELECT ON bob_live_vn.b TO b_vn;
GRANT SELECT ON bob_live_vn.c TO c_vn;
GRANT SELECT ON bob_live_vn.d TO d_vn;
GRANT SELECT ON oms_live_vn.a TO a_vn;
GRANT SELECT ON oms_live_vn.b TO b_vn;
GRANT SELECT ON oms_live_vn.c TO c_vn;
GRANT SELECT ON oms_live_vn.d TO d_vn;
CREATE ROLE a_tw;
CREATE ROLE b_tw;
CREATE ROLE c_tw;
CREATE ROLE d_tw;
CREATE ROLE operations_tw;
GRANT a_tw TO operations_tw;
GRANT b_tw TO operations_tw;
GRANT c_tw TO operations_tw;
GRANT d_tw TO operations_tw;
GRANT SELECT ON bob_live_tw.a TO a_tw;
GRANT SELECT ON bob_live_tw.b TO b_tw;
GRANT SELECT ON bob_live_tw.c TO c_tw;
GRANT SELECT ON bob_live_tw.d TO d_tw;
GRANT SELECT ON oms_live_tw.a TO a_tw;
GRANT SELECT ON oms_live_tw.b TO b_tw;
GRANT SELECT ON oms_live_tw.c TO c_tw;
GRANT SELECT ON oms_live_tw.d TO d_tw;
CREATE ROLE a_my;
CREATE ROLE b_my;
CREATE ROLE c_my;
CREATE ROLE d_my;
CREATE ROLE operations_my;
GRANT a_my TO operations_my;
GRANT b_my TO operations_my;
GRANT c_my TO operations_my;
GRANT d_my TO operations_my;
GRANT SELECT ON bob_live_my.a TO a_my;
GRANT SELECT ON bob_live_my.b TO b_my;
GRANT SELECT ON bob_live_my.c TO c_my;
GRANT SELECT ON bob_live_my.d TO d_my;
GRANT SELECT ON oms_live_my.a TO a_my;
GRANT SELECT ON oms_live_my.b TO b_my;
GRANT SELECT ON oms_live_my.c TO c_my;
GRANT SELECT ON oms_live_my.d TO d_my;
CREATE ROLE a_th;
CREATE ROLE b_th;
CREATE ROLE c_th;
CREATE ROLE d_th;
CREATE ROLE operations_th;
GRANT a_th TO operations_th;
GRANT b_th TO operations_th;
GRANT c_th TO operations_th;
GRANT d_th TO operations_th;
GRANT SELECT ON bob_live_th.a TO a_th;
GRANT SELECT ON bob_live_th.b TO b_th;
GRANT SELECT ON bob_live_th.c TO c_th;
GRANT SELECT ON bob_live_th.d TO d_th;
GRANT SELECT ON oms_live_th.a TO a_th;
GRANT SELECT ON oms_live_th.b TO b_th;
GRANT SELECT ON oms_live_th.c TO c_th;
GRANT SELECT ON oms_live_th.d TO d_th;
GRANT operations_sg TO operations_cluster;
GRANT operations_ph TO operations_cluster;
GRANT operations_id TO operations_cluster;
GRANT operations_hk TO operations_cluster;
GRANT operations_vn TO operations_cluster;
GRANT operations_tw TO operations_cluster;
GRANT operations_my TO operations_cluster;
GRANT operations_th TO operations_cluster;
connect(con1,localhost,u,,);
SHOW DATABASES;
SET ROLE operations_cluster;
SHOW DATABASES;
SELECT COUNT(1) FROM oms_live_sg.a;
SELECT COUNT(1) FROM oms_live_sg.b;
SELECT COUNT(1) FROM oms_live_sg.c;
SELECT COUNT(1) FROM oms_live_sg.d;
SELECT COUNT(1) FROM oms_live_ph.a;
SELECT COUNT(1) FROM oms_live_ph.b;
SELECT COUNT(1) FROM oms_live_ph.c;
SELECT COUNT(1) FROM oms_live_ph.d;
SELECT COUNT(1) FROM oms_live_id.a;
SELECT COUNT(1) FROM oms_live_id.b;
SELECT COUNT(1) FROM oms_live_id.c;
SELECT COUNT(1) FROM oms_live_id.d;
SELECT COUNT(1) FROM oms_live_hk.a;
SELECT COUNT(1) FROM oms_live_hk.b;
SELECT COUNT(1) FROM oms_live_hk.c;
SELECT COUNT(1) FROM oms_live_hk.d;
SELECT COUNT(1) FROM oms_live_vn.a;
SELECT COUNT(1) FROM oms_live_vn.b;
SELECT COUNT(1) FROM oms_live_vn.c;
SELECT COUNT(1) FROM oms_live_vn.d;
SELECT COUNT(1) FROM oms_live_tw.a;
SELECT COUNT(1) FROM oms_live_tw.b;
SELECT COUNT(1) FROM oms_live_tw.c;
SELECT COUNT(1) FROM oms_live_tw.d;
SELECT COUNT(1) FROM oms_live_my.a;
SELECT COUNT(1) FROM oms_live_my.b;
SELECT COUNT(1) FROM oms_live_my.c;
SELECT COUNT(1) FROM oms_live_my.d;
SELECT COUNT(1) FROM oms_live_th.a;
SELECT COUNT(1) FROM oms_live_th.b;
SELECT COUNT(1) FROM oms_live_th.c;
SELECT COUNT(1) FROM oms_live_th.d;
connect(con2,localhost,root,,);
FLUSH PRIVILEGES;
connect(con3,localhost,u,,);
SHOW DATABASES;
SET ROLE operations_cluster;
SHOW DATABASES;
SELECT COUNT(1) FROM oms_live_sg.a;
SELECT COUNT(1) FROM oms_live_sg.b;
SELECT COUNT(1) FROM oms_live_sg.c;
SELECT COUNT(1) FROM oms_live_sg.d;
SELECT COUNT(1) FROM oms_live_ph.a;
SELECT COUNT(1) FROM oms_live_ph.b;
SELECT COUNT(1) FROM oms_live_ph.c;
SELECT COUNT(1) FROM oms_live_ph.d;
SELECT COUNT(1) FROM oms_live_id.a;
SELECT COUNT(1) FROM oms_live_id.b;
SELECT COUNT(1) FROM oms_live_id.c;
SELECT COUNT(1) FROM oms_live_id.d;
SELECT COUNT(1) FROM oms_live_hk.a;
SELECT COUNT(1) FROM oms_live_hk.b;
SELECT COUNT(1) FROM oms_live_hk.c;
SELECT COUNT(1) FROM oms_live_hk.d;
SELECT COUNT(1) FROM oms_live_vn.a;
SELECT COUNT(1) FROM oms_live_vn.b;
SELECT COUNT(1) FROM oms_live_vn.c;
SELECT COUNT(1) FROM oms_live_vn.d;
SELECT COUNT(1) FROM oms_live_tw.a;
SELECT COUNT(1) FROM oms_live_tw.b;
SELECT COUNT(1) FROM oms_live_tw.c;
SELECT COUNT(1) FROM oms_live_tw.d;
SELECT COUNT(1) FROM oms_live_my.a;
SELECT COUNT(1) FROM oms_live_my.b;
SELECT COUNT(1) FROM oms_live_my.c;
SELECT COUNT(1) FROM oms_live_my.d;
SELECT COUNT(1) FROM oms_live_th.a;
SELECT COUNT(1) FROM oms_live_th.b;
SELECT COUNT(1) FROM oms_live_th.c;
SELECT COUNT(1) FROM oms_live_th.d;
connect(con4,localhost,root,,);
DROP DATABASE bob_live_sg;
DROP DATABASE oms_live_sg;
DROP DATABASE bob_live_ph;
DROP DATABASE oms_live_ph;
DROP DATABASE bob_live_id;
DROP DATABASE oms_live_id;
DROP DATABASE bob_live_hk;
DROP DATABASE oms_live_hk;
DROP DATABASE bob_live_vn;
DROP DATABASE oms_live_vn;
DROP DATABASE bob_live_tw;
DROP DATABASE oms_live_tw;
DROP DATABASE bob_live_my;
DROP DATABASE oms_live_my;
DROP DATABASE bob_live_th;
DROP DATABASE oms_live_th;
DROP ROLE operations_sg;
DROP ROLE a_sg;
DROP ROLE b_sg;
DROP ROLE c_sg;
DROP ROLE d_sg;
DROP ROLE operations_ph;
DROP ROLE a_ph;
DROP ROLE b_ph;
DROP ROLE c_ph;
DROP ROLE d_ph;
DROP ROLE operations_id;
DROP ROLE a_id;
DROP ROLE b_id;
DROP ROLE c_id;
DROP ROLE d_id;
DROP ROLE operations_hk;
DROP ROLE a_hk;
DROP ROLE b_hk;
DROP ROLE c_hk;
DROP ROLE d_hk;
DROP ROLE operations_vn;
DROP ROLE a_vn;
DROP ROLE b_vn;
DROP ROLE c_vn;
DROP ROLE d_vn;
DROP ROLE operations_tw;
DROP ROLE a_tw;
DROP ROLE b_tw;
DROP ROLE c_tw;
DROP ROLE d_tw;
DROP ROLE operations_my;
DROP ROLE a_my;
DROP ROLE b_my;
DROP ROLE c_my;
DROP ROLE d_my;
DROP ROLE operations_th;
DROP ROLE a_th;
DROP ROLE b_th;
DROP ROLE c_th;
DROP ROLE d_th;
DROP USER u;
DROP ROLE operations_cluster;

View File

@ -0,0 +1,52 @@
#
# MDEV-13655: SET ROLE does not properly grant privileges.
#
# We must test that if aditional db privileges get granted to a role
# which previously inherited privileges from another granted role
# keep the internal memory structures intact.
#
create role simple;
#
# First we create an entry with privileges for databases for the simple role.
#
grant select, insert, update, delete, lock tables, execute on t.* to simple;
create role admin;
#
# Now we grant the simple role to admin. This means that db privileges
# should propagate to admin.
#
grant simple to admin;
show grants for admin;
Grants for admin
GRANT simple TO 'admin'
GRANT USAGE ON *.* TO 'admin'
GRANT USAGE ON *.* TO 'simple'
GRANT SELECT, INSERT, UPDATE, DELETE, LOCK TABLES, EXECUTE ON `t`.* TO 'simple'
#
# Finally, we give the admin all the available privileges for the db.
#
grant all on t.* to admin;
#
# Create a user to test out the new roles;
#
create user foo;
grant admin to foo;
connect foo,localhost,foo,,,,,;
create database t;
ERROR 42000: Access denied for user 'foo'@'%' to database 't'
set role admin;
show grants;
Grants for foo@%
GRANT admin TO 'foo'@'%'
GRANT USAGE ON *.* TO 'foo'@'%'
GRANT simple TO 'admin'
GRANT USAGE ON *.* TO 'admin'
GRANT ALL PRIVILEGES ON `t`.* TO 'admin'
GRANT USAGE ON *.* TO 'simple'
GRANT SELECT, INSERT, UPDATE, DELETE, LOCK TABLES, EXECUTE ON `t`.* TO 'simple'
create database t;
drop database t;
connection default;
drop role simple;
drop role admin;
drop user foo;

View File

@ -0,0 +1,49 @@
source include/not_embedded.inc;
--echo #
--echo # MDEV-13655: SET ROLE does not properly grant privileges.
--echo #
--echo # We must test that if aditional db privileges get granted to a role
--echo # which previously inherited privileges from another granted role
--echo # keep the internal memory structures intact.
--echo #
create role simple;
--echo #
--echo # First we create an entry with privileges for databases for the simple role.
--echo #
grant select, insert, update, delete, lock tables, execute on t.* to simple;
create role admin;
--echo #
--echo # Now we grant the simple role to admin. This means that db privileges
--echo # should propagate to admin.
--echo #
grant simple to admin;
show grants for admin;
--echo #
--echo # Finally, we give the admin all the available privileges for the db.
--echo #
grant all on t.* to admin;
--echo #
--echo # Create a user to test out the new roles;
--echo #
create user foo;
grant admin to foo;
connect (foo,localhost,foo,,,,,);
--error ER_DBACCESS_DENIED_ERROR
create database t;
set role admin;
show grants;
create database t;
drop database t;
connection default;
drop role simple;
drop role admin;
drop user foo;

View File

@ -0,0 +1,28 @@
include/master-slave.inc
[connection master]
#
# Start of 10.2 tests
#
#
# MDEV-14249 Wrong character set info of Query_log_event and the query in Query_log_event constructed by different charsets cause error when slave apply the event.
#
SET NAMES latin1;
CREATE TABLE `tё` (`tё` INT);
CREATE VIEW `vё` AS SELECT 'vё';
CREATE PROCEDURE `pё`() SELECT 'pё';
connection slave;
SHOW TABLES LIKE 't%';
Tables_in_test (t%)
SHOW TABLES LIKE 'v%';
Tables_in_test (v%)
SHOW PROCEDURE STATUS LIKE 'p%';
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
test pё PROCEDURE root@localhost ts ts DEFINER latin1 latin1_swedish_ci latin1_swedish_ci
connection master;
DROP TABLE `tё`;
DROP VIEW `vё`;
DROP PROCEDURE `pё`;
connection slave;
include/rpl_end.inc

View File

@ -0,0 +1,40 @@
--disable_warnings
--source include/master-slave.inc
--enable_warnings
--echo #
--echo # Start of 10.2 tests
--echo #
--echo #
--echo # MDEV-14249 Wrong character set info of Query_log_event and the query in Query_log_event constructed by different charsets cause error when slave apply the event.
--echo #
#
# The below tests uses a sequence of bytes 0xD191,
# which in a utf8 console looks like ё (CYRILIC SMALL LETTER YO).
# Don't be mislead. This sequence is used in latin1 context and
# represents a sequence of two characters:
# U+00D1 CAPITAL LATIN LETTER N WITH TILDE (_latin1 0xD1)
# U+2018 LEFT SINGLE QUOTATION MARK (_latin1 0x91)
#
SET NAMES latin1;
CREATE TABLE `tё` (`tё` INT);
CREATE VIEW `vё` AS SELECT 'vё';
CREATE PROCEDURE `pё`() SELECT 'pё';
--sync_slave_with_master
SHOW TABLES LIKE 't%';
SHOW TABLES LIKE 'v%';
--replace_column 5 ts 6 ts
SHOW PROCEDURE STATUS LIKE 'p%';
--connection master
DROP TABLE `tё`;
DROP VIEW `vё`;
DROP PROCEDURE `pё`;
--sync_slave_with_master
--source include/rpl_end.inc

View File

@ -4,6 +4,6 @@ create table t2 (a int, b int) engine=myisam;
insert into t2 values (1,2),(2,4);
select * from t1 inner join t2 on ( t2.b = t1.v or t2.a = t1.pk );
pk i v a b
1 1 0 1 2
2 2 0 2 4
1 1 2 1 2
2 2 4 2 4
drop table t1, t2;

View File

@ -396,3 +396,27 @@ CREATE OR REPLACE TABLE t1 AS SELECT f1();
UNLOCK TABLES;
DROP FUNCTION f1;
DROP TABLE t1;
--echo #
--echo # MDEV-11071 - Assertion `thd->transaction.stmt.is_empty()' failed in
--echo # Locked_tables_list::unlock_locked_tables
--echo #
CREATE TEMPORARY TABLE t1(a INT) ENGINE=InnoDB;
CREATE TEMPORARY TABLE t2(a INT);
CREATE TABLE t3(a INT);
LOCK TABLE t2 WRITE;
SELECT * FROM t2;
# drops t2
--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE
CREATE OR REPLACE TEMPORARY TABLE t1(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
# make sure we didn't leave locked tables mode
--error ER_TABLE_NOT_LOCKED
SELECT * FROM t3;
# drops t1
--error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE
CREATE OR REPLACE TEMPORARY TABLE t2(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED;
# make sure we didn't leave locked tables mode
--error ER_TABLE_NOT_LOCKED
SELECT * FROM t3;
UNLOCK TABLES;
DROP TABLE t3;

View File

@ -790,3 +790,66 @@ SHOW CREATE VIEW cte_test;
SELECT * FROM cte_test;
DROP VIEW cte_test;
--echo #
--echo # mdev-14755 : PS for query using CTE in select with subquery
--echo #
create table t1 (a int);
insert into t1 values
(7), (2), (8), (1), (3), (2), (7), (5), (4), (7), (9), (8);
let $q1=
with cte as
(select a from t1 where a between 4 and 7 group by a)
(select a from cte where exists( select a from t1 where cte.a=t1.a ))
union
(select a from t1 where a < 2);
eval $q1;
eval prepare stmt from "$q1";
execute stmt;
execute stmt;
deallocate prepare stmt;
let $q2=
with cte as
(select a from t1 where a between 4 and 7 group by a)
(select a from t1 where a < 2)
union
(select a from cte where exists( select a from t1 where cte.a=t1.a ));
eval $q2;
eval prepare stmt from "$q2";
execute stmt;
execute stmt;
deallocate prepare stmt;
let $q3=
with cte as
(select a from t1 where a between 4 and 7)
(select a from t1 where a < 2)
union
(select a from cte where exists( select a from t1 where cte.a=t1.a ));
eval $q3;
eval prepare stmt from "$q3";
execute stmt;
execute stmt;
deallocate prepare stmt;
let $q4=
with cte as
(select a from t1 where a between 4 and 7)
(select a from cte
where exists( select a from t1 where t1.a < 2 and cte.a=t1.a ))
union
(select a from cte where exists( select a from t1 where cte.a=t1.a ));
eval $q4;
eval prepare stmt from "$q4";
execute stmt;
execute stmt;
deallocate prepare stmt;
drop table t1;

View File

@ -406,3 +406,14 @@ explain format=json
select a, (select max(a) from t1 where t0.a<5 and t1.b<t0.a) from t0;
drop table t0,t1;
--echo #
--echo # MDEV-10844: EXPLAIN FORMAT=JSON doesn't show order direction for filesort
--echo #
create table t1 (a int, b int);
insert into t1 values (1,2),(3,4),(2,3);
explain format=json select * from t1 order by a, b desc;
explain format=json select * from t1 order by a desc, b desc;
explain format=json select * from t1 order by a desc, b ;
drop table t1;

View File

@ -383,6 +383,14 @@ select json_contains_path('{"foo":"bar"}', 'one', '$[]');
#
select JSON_VALID(0x36f0c8dccd83c5eac156da);
#
# MDEV-13970 crash in Item_func_json_extract::read_json.
#
create table t1(a double not null);
insert into t1 values (2),(1);
select 1 from t1 where json_extract(a,'$','$[81]');
drop table t1;
--echo #
--echo # Start of 10.3 tests
--echo #

View File

@ -1152,6 +1152,27 @@ INSERT INTO t1 (str) VALUES ('::FFFF:192.168.0.1'),('::10.0.5.9');
SELECT str, str1, b,c FROM t1;
DROP TABLE t1;
--echo #
--echo # MDEV-14613: Assertion `fixed == 0' failed in Item_func::fix_fields
--echo #
CREATE TABLE `t1` (
`numgtfmt` char(10) COLLATE utf8_bin NOT NULL
) DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
create view v1(numgtfmt)
as
select 'x' from t1
union
select 'x' from t1 ;
SELECT * FROM v1 WHERE numgtfmt = NAME_CONST('wnumgtfmt',_utf8'QEDITIONS' COLLATE 'utf8_bin');
# Cleanup
DROP VIEW v1;
DROP TABLE t1;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -136,18 +136,14 @@ SELECT * FROM t1 WHERE FIND_IN_SET(NULL, NULL) IS UNKNOWN;
--echo
DROP TABLE t1;
--echo #
--echo # Start of 5.3 tests
--echo #
--echo #
--echo # MDEV-4512 Valgrind warnings in my_long10_to_str_8bit on INTERVAL and DATE_ADD with incorrect types
--echo # MDEV-14596 Crash in INTERVAL(ROW(..),ROW(..))
--echo #
CREATE TABLE t1 (pk INT PRIMARY KEY);
INSERT INTO t1 VALUES (10),(11);
SELECT INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 ) FROM t1;
DROP TABLE t1;
--echo #
--echo # End of 5.3 tests
--echo #
--error ER_OPERAND_COLUMNS
SELECT INTERVAL(ROW(1,1),ROW(1,2));
--error ER_OPERAND_COLUMNS
SELECT INTERVAL(1,ROW(1,2));
--error ER_OPERAND_COLUMNS
SELECT INTERVAL(ROW(1,2),1);

View File

@ -1789,6 +1789,32 @@ create table t2 (c1 int, c2 int);
select t1.c1 as c1, t2.c2 as c1 from t1, t2 where t1.c1 < 20 and t2.c2 > 5 group by t1.c1, t2.c2 having t1.c1 < 3;
drop table t1, t2;
#
# MDEV-12350: Heap corruption, overrun buffer, ASAN errors, server crash in my_fill_8bit / filesort
#
SET @old_sort_buff_size = @@sort_buffer_size;
SET @@sort_buffer_size=256*1024;
CREATE TABLE t1 (c INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES
(2011),(1977),(1982),(2027),(2023),(NULL),(NULL),(2004),(1974),(2032),
(1993),(NULL),(1995),(2034),(NULL),(2009),(1900),(NULL),(2025),(1900),
(2033),(1900),(2012),(NULL),(2009),(1992),(1974),(1974),(2012),(2028),
(2007),(2012),(1900),(1983),(1900),(2010),(1987),(1994),(1981),(2032),
(2010),(1989),(2014),(1900),(1900),(1976),(1978),(2007),(2030),(NULL),
(2002),(1997),(1900),(NULL),(2000),(2027),(1975),(2026),(1975),(2026),
(2029),(1977),(1900),(1900),(2031),(1993),(1986),(2012),(1979),(2013),
(1994),(2014),(2025),(2006),(1971),(1974),(2021),(2011),(NULL),(1991),
(2001),(1977),(2023),(2012),(1900),(1978),(1998),(NULL),(1988),(1999),
(2017),(2008),(1976),(1900),(2005),(2030),(2023),(1900),(1978),(1990),
(1978),(1987),(2030),(1900),(2034),(2006),(2015),(2001),(2019),(2024),
(2030),(1989),(1997),(2007),(2023),(1994),(1971),(2011),(2011),(2015),
(1984),(1978),(1979),(1989),(2008),(2030);
SELECT ExtractValue('<a></a>','/a') AS f1, SPACE(c) AS f2 FROM t1 GROUP BY f1, f2 WITH ROLLUP;
SET @@sort_buffer_size = @old_sort_buff_size;
DROP TABLE t1;
#
# End of MariaDB 5.5 tests
#

View File

@ -728,6 +728,23 @@ HAVING UPPER(`column_1`) LIKE '8%';
drop table t1;
--echo #
--echo # mdev-14368: grouping query with alias for aggregate function in HAVING
--echo # when sql_mode = 'ONLY_FULL_GROUP_BY'
set @save_sql_mode= @@sql_mode;
set sql_mode = 'ONLY_FULL_GROUP_BY';
create table t1(a int);
insert t1 values (4),(1),(2),(1), (3),(4);
SELECT a, COUNT(a) as ct FROM t1 GROUP BY a HAVING ct>0;
set sql_mode=@save_sql_mode;
drop table t1;
--echo #
--echo # Bug mdev-5160: two-way join with HAVING over the second table
--echo #

View File

@ -1962,6 +1962,20 @@ DROP FUNCTION f1;
DROP TABLE t1,t2;
--echo #
--echo # MDEV-10397: Server crashes in key_copy with join_cache_level > 2 and join on BIT fields
--echo #
CREATE TABLE t1 (b1 BIT NOT NULL);
INSERT INTO t1 VALUES (0),(1);
CREATE TABLE t2 (b2 BIT NOT NULL);
INSERT INTO t2 VALUES (0),(1);
SET SESSION JOIN_CACHE_LEVEL = 3;
SELECT t1.b1+'0' , t2.b2 + '0' FROM t1 LEFT JOIN t2 ON b1 = b2;
DROP TABLE t1, t2;
--echo # end of 5.5 tests
SET optimizer_switch=@save_optimizer_switch;

View File

@ -4530,6 +4530,39 @@ SHOW CREATE TABLE t1;
DROP TABLE t1;
DROP PROCEDURE p1;
--echo #
--echo # MDEV-14426 Assertion in Diagnostics_area::set_error_status when using a bad datetime with PS and SP
--echo #
DELIMITER $$;
CREATE PROCEDURE p1(OUT a VARCHAR(20))
BEGIN
SET a=10;
END;
$$
--error ER_TRUNCATED_WRONG_VALUE
BEGIN NOT ATOMIC
DECLARE a DATETIME;
CALL p1(a);
END;
$$
--error ER_TRUNCATED_WRONG_VALUE
BEGIN NOT ATOMIC
DECLARE a DATETIME;
EXECUTE IMMEDIATE 'CALL p1(?)' USING a;
END;
$$
--error ER_TRUNCATED_WRONG_VALUE
BEGIN NOT ATOMIC
DECLARE a DATETIME;
PREPARE stmt FROM 'CALL p1(?)';
EXECUTE stmt USING a;
DEALLOCATE PREPARE stmt;
END;
$$
DELIMITER ;$$
DROP PROCEDURE p1;
--echo #
--echo # MDEV-14454 Binary protocol returns wrong collation ID for SP OUT parameters
--echo #

View File

@ -5519,6 +5519,18 @@ PREPARE stmt FROM 'REPLACE INTO v2 SELECT a FROM t3';
drop view v1,v2;
drop table t3;
--echo #
--echo # MDEV-14619: VIEW and GROUP_CONCAT
--echo #
CREATE TABLE t1 (str text);
INSERT INTO t1 VALUES ("My"),("SQL");
CREATE VIEW v1 AS SELECT GROUP_CONCAT(str SEPARATOR '\\') FROM t1;
SELECT * FROM v1;
SHOW CREATE VIEW v1;
drop view v1;
drop table t1;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.5 tests.
--echo # -----------------------------------------------------------------

View File

@ -713,7 +713,7 @@ FROM t1;
SELECT UPDATEXML(txt, CONCAT('//', REPEAT('b', 63)), '63/63+') FROM t1;
DROP TABLE t1;
# This will call my_str_realloc_mysqld()
# This will call realloc()
CREATE TABLE t1 (a TEXT);
INSERT INTO t1 VALUES (CONCAT('<a><', REPEAT('b',128),'>b128</',REPEAT('b',128),'><',REPEAT('c',512),'>c512</',REPEAT('c',512),'></a>'));
SELECT ExtractValue (a, CONCAT('//',REPEAT('c',512))) AS c512 FROM t1;

View File

@ -23,56 +23,55 @@
#
##############################################################################
# Based on 10.2 e2dd4e32063b2526d951e5f4ddfdb8b0d69ef634
# Based on 10.2 f5c479565d1d07662f23f0a688add6dffeee5f84
main.alter_table : Modified in 10.2.10
main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result
main.case : Modified in 10.2.10
main.auth_named_pipe : MDEV-14724 - System error 2
main.connect2 : MDEV-13885 - Server crash
main.create_or_replace : Modified in 10.2.12
main.cte_grant : Modified in 10.2.11
main.cte_nonrecursive : Modified in 10.2.11
main.cte_recursive : Modified in 10.2.11
main.ctype_gbk : Modified in 10.2.10
main.ctype_latin1 : Modified in 10.2.10
main.ctype_ucs : Modified in 10.2.10
main.ctype_utf32 : Modified in 10.2.10
main.ctype_utf8 : Modified in 10.2.10
main.delete_returning : Modified in 10.2.10
main.cte_nonrecursive : Modified in 10.2.12
main.cte_recursive : Modified in 10.2.12
main.ctype_latin1 : Modified in 10.2.12
main.ctype_like_range : Modified in 10.2.12
main.ctype_ucs2_uca : Modified in 10.2.12
main.ctype_utf16_uca : Modified in 10.2.12
main.ctype_utf32_uca : Modified in 10.2.12
main.ctype_utf8 : Modified in 10.2.12
main.ctype_utf8_uca : Modified in 10.2.12
main.ctype_utf8mb4 : Modified in 10.2.12
main.ctype_utf8mb4_uca : Modified in 10.2.12
main.delimiter_command_case_sensitivity : Added in 10.2.11
main.derived_cond_pushdown : Modified in 10.2.11
main.distinct : MDEV-14194 - Crash
main.events_2 : MDEV-13277 - Crash
main.func_in : Modified in 10.2.10
main.func_json : MDEV-11648 - Crash, valgrind; modified in 10.2.11
main.func_misc : Modified in 10.2.11
main.func_regexp_pcre : Modified in 10.2.10
main.func_time : Modified in 10.2.10
main.events_slowlog : MDEV-12821 - Wrong result
main.func_json : Modified in 10.2.12
main.func_misc : Modified in 10.2.12
main.func_set : Modified in 10.2.12
main.func_str : Modified in 10.2.12
main.gis-json : Modified in 10.2.11
main.gis-precise : Modified in 10.2.10
main.gis2 : Modified in 10.2.10
main.having : Modified in 10.2.11
main.group_by : Modified in 10.2.12
main.having : Modified in 10.2.12
main.index_merge_innodb : MDEV-7142 - Plan mismatch
main.information_schema : Modified in 10.2.10
main.innodb_mysql_lock : MDEV-7861 - Wrong result
main.join_outer : Modified in 10.2.12
main.kill-2 : MDEV-13257 - Wrong result
main.log_slow : MDEV-13263 - Wrong result
main.mdev13607 : Added in 10.2.10
main.myisam : Modified in 10.2.10
main.mysql_client_test_nonblock : CONC-208 - Error on Power
main.mysql_upgrade_noengine : MDEV-14355 - Wrong result
main.mysql_upgrade_ssl : MDEV-13492 - Unknown SSL error
main.mysqlbinlog : Modified in 10.2.11
main.mysqldump : MDEV-14800 - Stack smashing detected
main.mysqld_option_err : MDEV-12747 - Timeout
main.mysqlhotcopy_myisam : MDEV-10995 - Hang on debug
main.mysqltest : MDEV-13887 - Wrong result
main.openssl_1 : MDEV-13492 - Unknown SSL error
main.order_by : Modified in 10.2.11
main.order_by_innodb : Modified in 10.2.11
main.partition_datatype : Modified in 10.2.10
main.ps : Modified in 10.2.11
main.range_vs_index_merge : Modified in 10.2.10
main.ps : MDEV-11017 - Wrong result; modified in 10.2.12
main.shm : MDEV-12727 - Mismatch, ERROR 2013
main.show_function_with_pad_char_to_full_length : Added in 10.2.10
main.show_explain : MDEV-10674 - Wrong result code
main.sp : MDEV-7866 - Mismatch; modified in 10.2.11
main.ssl_ca : MDEV-10895 - SSL connection error on Power
main.ssl_cert_verify : MDEV-13735 - Server crash
@ -81,21 +80,18 @@ main.ssl_timeout : MDEV-11244 - Crash
main.stat_tables_par : MDEV-13266 - Wrong result
main.status : MDEV-13255 - Wrong result
main.subselect_exists2in : Modified in 10.2.11
main.subselect_mat_cost_bugs : Modified in 10.2.10
main.tc_heuristic_recover : MDEV-14189 - Wrong result; modified in 10.2.10
main.subselect_innodb : MDEV-10614 - Wrong result
main.tc_heuristic_recover : MDEV-14189 - Wrong result
main.trigger : Modified in 10.2.11
main.type_bit : Modified in 10.2.11
main.type_date : Modified in 10.2.11
main.type_float : Modified in 10.2.10
main.type_time : Modified in 10.2.11
main.type_varchar : Modified in 10.2.10
main.user_var : Modified in 10.2.10
main.userstat : MDEV-12904 - SSL errors
main.xml : Modified in 10.2.10
main.view : Modified in 10.2.12
main.win : Modified in 10.2.12
#----------------------------------------------------------------
archive.archive-big : MDEV-10615 - Table marked as crashed
archive.mysqlhotcopy_archive : MDEV-10995 - Hang on debug
#----------------------------------------------------------------
@ -117,15 +113,11 @@ binlog_encryption.rpl_semi_sync : MDEV-11673 - Valgrind
binlog_encryption.rpl_skip_replication : MDEV-13571 - Unexpected warning
binlog_encryption.rpl_ssl : MDEV-14507 - Timeouts
binlog_encryption.rpl_stm_relay_ign_space : MDEV-13278 - Wrong result (test assertion)
binlog_encryption.rpl_sync : MDEV-13830 - Assertion failure
#----------------------------------------------------------------
connect.json_java_2 : Include file modified in 10.2.10
connect.json_java_3 : Include file modified in 10.2.10
connect.json_mongo_c : Include file modified in 10.2.10
connect.mongo_c : Include file modified in 10.2.10
connect.mongo_java_2 : Include file modified in 10.2.10
connect.mongo_java_3 : Include file modified in 10.2.10
connect.pivot : MDEV-14803 - Failed to discover table
connect.tbl : MDEV-10179 - Mismatch, MDEV-9844 - Valgrind, crash
connect.tbl_thread : MDEV-10179 - Mismatch, MDEV-9844 - Valgrind, crash, MDEV-14214 - Syntax error
connect.vcol : MDEV-12374 - Fails on Windows
@ -139,13 +131,16 @@ encryption.encryption_force : Modified in 10.2.11
encryption.filekeys_encfile : Modified in 10.2.11
encryption.filekeys_encfile_file : Modified in 10.2.11
encryption.innochecksum : MDEV-13644 - Assertion failure
encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate
encryption.innodb-discard-import-change : MDEV-12632 - Valgrind
encryption.innodb-encryption-alter : MDEV-13566 - Lock wait timeout; modified in 10.2.11
encryption.innodb_encryption_discard_import : MDEV-12903 - Wrong result, MDEV-14045 - Error 192
encryption.innodb_encryption_filekeys : MDEV-9962 - Timeout
encryption.innodb_encryption-page-compression : MDEV-14814 - Timeout in wait condition
encryption.innodb_encryption_tables : MDEV-9359 - Assertion failure
encryption.innodb-first-page-read : MDEV-14356 - Timeout in wait condition
encryption.innodb_lotoftables : MDEV-11531 - Operation on a dropped tablespace
encryption.innodb-missing-key : MDEV-9359 - assertion failure
encryption.innodb-redo-badkey : MDEV-13893 - Page cannot be decrypted
encryption.innodb-spatial-index : MDEV-13746 - Wrong result; modified in 10.2.11
@ -155,6 +150,7 @@ engines/rr_trx.* : MDEV-10998 - Not maintained
#----------------------------------------------------------------
federated.federated_bug_585688 : MDEV-14805 - Server crash, MDEV-12907 - Valgrind
federated.federated_innodb : MDEV-10617 - Wrong checksum
federated.federated_transactions : MDEV-10617 - Wrong checksum
federated.federatedx : MDEV-10617 - Wrong checksum
@ -174,23 +170,18 @@ gcol.innodb_virtual_basic : Modified in 10.2.11
gcol.innodb_virtual_debug : Modified in 10.2.11
gcol.innodb_virtual_debug_purge : MDEV-13568 - Wrong result
gcol.innodb_virtual_rebuild : Added in 10.2.11
gcol.innodb_virtual_stats : Added in 10.2.12
#----------------------------------------------------------------
innodb.101_compatibility : MDEV-13891 - Wrong result
innodb.alter_table : Modified in 10.2.10
innodb.deadlock_detect : MDEV-13262 - Wrong error code
innodb.defrag_mdl-9155 : Re-enabled in 10.2.10
innodb_defragment_fill_factor : Re-enabled in 10.2.10
innodb.doublewrite : MDEV-12905 - Server crash
innodb.group_commit_crash : MDEV-14191 - InnoDB registration failed
innodb.group_commit_crash_no_optimize_thread : MDEV-13830 - Assertion failure
innodb.innodb-16k : Modified in 10.2.10
innodb.innodb-32k : Modified in 10.2.10
innodb.innodb-64k : Modified in 10.2.10
innodb.innodb-alter : Modified in 10.2.10
innodb.innodb-alter-table : Modified in 10.2.10
innodb.innodb : Modified in 10.2.12
innodb.innodb-alter-tempfile : MDEV-14485 - Server deadlock on startup
innodb.innodb-autoinc : Modified in 10.2.12
innodb.innodb_bug14147491 : MDEV-11808 - Index is corrupt
innodb.innodb_bug59641 : MDEV-13830 - Assertion failure
innodb.innodb_bulk_create_index : Added in 10.2.11
@ -198,94 +189,58 @@ innodb.innodb_bulk_create_index_debug : Added in 10.2.11
innodb.innodb_bulk_create_index_flush : Added in 10.2.11
innodb.innodb_bulk_create_index_replication : Added in 10.2.11
innodb.innodb_bulk_create_index_small : Added in 10.2.11
innodb.innodb_defrag_binlog : Re-enabled in 10.2.10
innodb.innodb_defrag_concurrent : Re-enabled in 10.2.10
innodb.innodb_defrag_stats : Re-enabled in 10.2.10
innodb.innodb_defrag_stats_many_tables : MDEV-14198 - Table is full; re-enabled in 10.2.10
innodb.innodb_defragment : Re-enabled in 10.2.10
innodb.innodb_defragment_fill_factor : Re-enabled in 10.2.10
innodb.innodb_defragment_small : Re-enabled in 10.2.10
innodb.innodb-get-fk : MDEV-13276 - Server crash; modified in 10.2.10
innodb.innodb_defrag_stats_many_tables : MDEV-14198 - Table is full
innodb.innodb-get-fk : MDEV-13276 - Server crash
innodb.innodb-index-debug : Modified in 10.2.12
innodb.innodb-index-online : MDEV-14809 - Cannot save statistics
innodb.innodb_information_schema : MDEV-8851 - Wrong result
innodb.innodb_max_recordsize_32k : MDEV-14801 - Operation failed; modified in 10.2.12
innodb.innodb_max_recordsize_64k : Modified in 10.2.12
innodb.innodb-on-duplicate-update : Added in 10.2.11
innodb.innodb-online-alter-gis : Modified in 10.2.10
innodb.innodb-page_compression_default : MDEV-13644 - Assertion failure
innodb.innodb-page_compression_lzma : MDEV-14353 - Wrong result
innodb.innodb-page_compression_tables : Modified in 10.2.11
innodb.innodb-replace-debug : Added in 10.2.11
innodb.innodb_stats_debug : Modified in 10.2.12
innodb.innodb_stats_drop_locked : Modified in 10.2.12
innodb.innodb_stats_persistent_debug : MDEV-14801 - Operation failed
innodb.innodb-table-online : MDEV-13894 - Wrong result; modified in 10.2.11
innodb.innodb-truncate : Modified in 10.2.10
innodb.innodb_sys_semaphore_waits : MDEV-10331 - Semaphore wait
innodb.innodb-wl5522-debug : MDEV-14200 - Wrong errno
innodb.innodb-wl5980-alter : Modified in 10.2.10
innodb.innodb_zip_innochecksum2 : MDEV-13882 - Extra warnings
innodb.innodb_zip_innochecksum3 : MDEV-14486 - Resource temporarily unavailable
innodb.lock_deleted : Added in 10.2.12
innodb.log_corruption : MDEV-13251 - Wrong result
innodb.log_data_file_size : MDEV-14204 - Server failed to start
innodb.log_file_name : MDEV-14193 - Exception
innodb.log_file_size : Modified in 10.2.10
innodb.purge_thread_shutdown : MDEV-13792 - Wrong result
innodb.read_only_recovery : MDEV-13886 - Server crash
innodb.recovery_shutdown : Added in 10.2.12
innodb.row_format_redundant : MDEV-14485 - Server deadlock on startup
innodb.table_definition_cache_debug : MDEV-14206 - Extra warning; added in 10.2.10
innodb.table_definition_cache_debug : MDEV-14206 - Extra warning; opt file modified in 10.2.12
innodb.table_flags : MDEV-13572 - Wrong result
innodb.temporary_table : MDEV-13265 - Wrong result
innodb.truncate_debug : Modified in 10.2.10
innodb.truncate_restart : Added in 10.2.11
innodb.undo_log : Added in 10.2.10
innodb.update_time : Added in 10.2.11
innodb.truncate_restart : Modified in 10.2.12
innodb.update_time : MDEV-14804 - Wrong result; modified in 10.2.12
innodb.update_time_wl6658 : Added in 10.2.11
innodb-wl5980-alter : Re-enabled in 10.2.10
innodb_fts.concurrent_insert : Added in 10.2.10
innodb_fts.fulltext : Modified in 10.2.10
innodb_fts.fulltext2 : MDEV-14727 - Long semaphore wait
innodb_fts.fulltext_misc : MDEV-12636 - Valgrind
innodb_fts.innodb_fts_plugin : MDEV-13888 - Errors in server log
innodb_fts.innodb_fts_stopword_charset : MDEV-13259 - Table crashed
innodb_fts.sync : Added in 10.2.10
innodb_fts.sync_block : Added in 10.2.10
innodb_fts.truncate : Added in 10.2.10
innodb_fts.sync : MDEV-14808 - Wrong result
innodb_gis.alter_spatial_index : Modified in 10.2.10
innodb_gis.bug16236208 : Added in 10.2.10
innodb_gis.bug16266012 : Added in 10.2.10
innodb_gis.bug17057168 : Added in 10.2.10
innodb_gis.geometry : Added in 10.2.10
innodb_gis.gis_split_inf : Added in 10.2.10
innodb_gis.gis_split_nan : Added in 10.2.10
innodb_gis.kill_server : MDEV-14218 - Assertion failure; added in 10.2.10
innodb_gis.multi_pk : Added in 10.2.10
innodb_gis.point_basic : Added in 10.2.10
innodb_gis.point_big : Added in 10.2.10
innodb_gis.repeatable_spatial : Added in 10.2.10
innodb_gis.rollback : Added in 10.2.10
innodb_gis.row_format : Added in 10.2.10
innodb_gis.rtree_compress : MDEV-14207 - Missing include; added in 10.2.10
innodb_gis.rtree_compress2 : MDEV-14207 - Missing include; added in 10.2.10
innodb_gis.rtree_concurrent_srch : Added in 10.2.10
innodb_gis.rtree_create_inplace : Added in 10.2.10
innodb_gis.rtree_debug : MDEV-14209 - Huge error log; added in 10.2.10
innodb_gis.rtree_drop_index : Added in 10.2.10
innodb_gis.rtree_estimate : Added in 10.2.10
innodb_gis.rtree_multi_pk : Added in 10.2.10
innodb_gis.rtree_old : Added in 10.2.10
innodb_gis.rtree_purge : MDEV-14207 - Missing include; added in 10.2.10
innodb_gis.rtree_recovery : Added in 10.2.10
innodb_gis.rtree_rollback1 : Added in 10.2.10
innodb_gis.rtree_rollback2 : Added in 10.2.10
innodb_gis.rtree_search : Added in 10.2.10
innodb_gis.rtree_split : MDEV-14208 - Too many arguments; MDEV-14209 - Huge error log; added in 10.2.10
innodb_gis.rtree_undo : Added in 10.2.10
innodb_gis.types : Added in 10.2.10
innodb_gis.update_root : Added in 10.2.10
innodb_zip.16k : Modified in 10.2.10
innodb_zip.4k : Modified in 10.2.10
innodb_zip.8k : Modified in 10.2.10
innodb_gis.kill_server : MDEV-14218 - Assertion failure; modified in 10.2.12
innodb_gis.rtree_compress : MDEV-14207 - Missing include
innodb_gis.rtree_compress2 : MDEV-14207 - Missing include; modified in 10.2.12
innodb_gis.rtree_debug : MDEV-14209 - Huge error log
innodb_gis.rtree_purge : MDEV-14207 - Missing include
innodb_gis.rtree_recovery : Modified in 10.2.12
innodb_gis.rtree_split : MDEV-14208 - Too many arguments; MDEV-14209 - Huge error log
innodb_gis.rtree_undo : MDEV-14456 - Timeout in include file
innodb_gis.types : Modified in 10.2.12
innodb_zip.cmp_per_index : MDEV-14490 - Table is marked as crashed
innodb_zip.innochecksum_3 : MDEV-13279 - Extra warnings
innodb_zip.index_large_prefix_4k : Modified in 10.2.10
innodb_zip.index_large_prefix_8k : Modified in 10.2.10
innodb_zip.prefix_index_liftedlimit : MDEV-14238 - Assertion failure
innodb_zip.wl6470_1 : MDEV-14240 - Assertion failure
innodb_zip.wl6501_1 : MDEV-10891 - Can't create UNIX socket
@ -295,21 +250,22 @@ innodb_zip.wl6501_scale_1 : MDEV-13254 - Timeout, MDEV-14104 - Error
#----------------------------------------------------------------
maria.insert_select : MDEV-12757 - Timeout
maria.maria : MDEV-14430 - Extra warning; modified in 10.2.10
maria.maria : MDEV-14430 - Extra warning
#----------------------------------------------------------------
mariabackup.apply-log-only : MDEV-14192 - Assertion failure
mariabackup.apply-log-only-incr : MDEV-14192 - Assertion failure
mariabackup.compress_qpress : Added in 10.2.10
mariabackup.apply-log-only-incr : MDEV-14192 - Assertion failure; modified in 10.2.12
mariabackup.data_directory : Added in 10.2.11
mariabackup.full_backup : MDEV-13889 - Timeout
mariabackup.incremental_backup : MDEV-14192 - Assertion failure; modified in 10.2.11
mariabackup.incremental_encrypted : MDEV-14188 - Wrong result
mariabackup.log_checksum_mismatch : Added in 10.2.12
mariabackup.mdev-14447 : Added in 10.2.11
mariabackup.partition_datadir : Added in 10.2.11
mariabackup.xb_file_key_management : Modified in 10.2.10
mariabackup.partition_datadir : MDEV-14802 - Timeout; added in 10.2.11
mariabackup.xbstream : MDEV-14192 - Crash
mariabackup.xb_page_compress : MDEV-14810 - status: 1, errno: 11
mariabackup.xb_compressed_encrypted : MDEV-14812 - Segmentation fault
#----------------------------------------------------------------
@ -328,9 +284,11 @@ multi_source.simple : MDEV-4633 - Wrong result
#----------------------------------------------------------------
parts.partition_alter_maria : Added in 10.2.10
parts.partition_alter_innodb : Added in 10.2.12
parts.partition_alter_maria : Modified in 10.2.12
parts.partition_alter_myisam : Added in 10.2.12
parts.partition_auto_increment_maria : MDEV-14430 - Extra warning
parts.partition_debug_innodb : MDEV-10891 - Can't create UNIX socket
parts.partition_debug_innodb : MDEV-10891 - Can't create UNIX socket
#----------------------------------------------------------------
@ -345,8 +303,11 @@ perfschema.hostcache_ipv4_addrinfo_again_allow : MDEV-12759 - Crash
perfschema.hostcache_ipv6_addrinfo_again_allow : MDEV-12752 - Crash
perfschema.hostcache_ipv6_addrinfo_bad_allow : MDEV-13260 - Crash
perfschema.hostcache_ipv6_ssl : MDEV-10696 - Crash
perfschema.misc : Modified in 10.2.12
perfschema.setup_actors : MDEV-10679 - Crash
perfschema.socket_summary_by_event_name_func : MDEV-10622 - Wrong result
perfschema.stage_mdl_procedure : MDEV-11545 - Missing row
perfschema.threads_mysql : MDEV-10677 - Wrong result
#----------------------------------------------------------------
@ -354,6 +315,7 @@ perfschema_stress.* : MDEV-10996 - Not maintained
#----------------------------------------------------------------
plugins.binlog-simple_plugin_check : Added in 10.2.12
plugins.feedback_plugin_send : MDEV-7932, MDEV-11118 - Connection problems and such
plugins.server_audit : Modified in 10.2.11
plugins.thread_pool_server : Modified in 10.2.11
@ -365,12 +327,14 @@ rocksdb.* : MyRocks is alpha-quality and tests are uns
#----------------------------------------------------------------
roles.definer : Modified in 10.2.10
roles.flush_roles-12366 : Added in 10.2.12
roles.set_role-13655 : Added in 10.2.12
#----------------------------------------------------------------
rpl.rpl_binlog_errors : MDEV-12742 - Crash
rpl.rpl_binlog_index : MDEV-9501 - Failed registering on master
rpl.rpl_ctype_latin1 : MDEV-14813 - Wrong result on Mac; added in 10.2.12
rpl.rpl_domain_id_filter_io_crash : MDEV-12729 - Timeout in include file, MDEV-13677 - Server crash
rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result
rpl.rpl_extra_col_master_myisam : MDEV-14203 - Extra warning
@ -381,6 +345,9 @@ rpl.rpl_gtid_reconnect : MDEV-14497 - Crash
rpl.rpl_gtid_stop_start : MDEV-11621 - Table marked as crashed
rpl.rpl_manual_change_index_file : MDEV-14309 - Requires Env package
rpl.rpl_mariadb_slave_capability : MDEV-11018 - Extra lines in binlog
rpl.rpl_mixed_mixing_engines : MDEV-14489 - Sync slave with master failed
rpl.rpl_non_direct_mixed_mixing_engines : MDEV-14489 - Sync slave with master failed
rpl.rpl_non_direct_row_mixing_engines : MDEV-14491 - Long semaphore wait
rpl.rpl_non_direct_stm_mixing_engines : MDEV-14489 - Failed sync_slave_with_master
rpl.rpl_parallel : MDEV-12730 - Assertion failure
rpl.rpl_parallel_mdev6589 : MDEV-12979 - Assertion failure
@ -388,9 +355,12 @@ rpl.rpl_parallel_optimistic_nobinlog : MDEV-12746 - Timeouts, mismatch
rpl.rpl_parallel_retry : MDEV-11119 - Crash
rpl.rpl_parallel_temptable : MDEV-10356 - Crash
rpl.rpl_row_drop_create_temp_table : MDEV-14487 - Wrong result
rpl.rpl_row_log : Included test modified in 10.2.12
rpl.rpl_row_log_innodb : Included test modified in 10.2.12
rpl.rpl_row_mixing_engines : MDEV-14491 - Long semaphore wait
rpl.rpl_semi_sync : MDEV-11220 - Wrong result
rpl.rpl_semi_sync_after_sync : MDEV-14366 - Wrong result
rpl.rpl_semi_sync_after_sync_row : MDEV-14366 - Wrong result
rpl.rpl_set_statement_default_master : MDEV-13258 - Extra warning
rpl.rpl_show_slave_hosts : MDEV-10681 - Crash
rpl.rpl_skip_replication : MDEV-13258 - Extra warning
@ -399,8 +369,11 @@ rpl.rpl_slave_load_tmpdir_not_exist : MDEV-14203 - Extra warning
rpl.rpl_slow_query_log : MDEV-13250 - Test abort
rpl.rpl_sp_effects : MDEV-13249 - Crash
rpl.rpl_start_stop_slave : MDEV-13567 - Sync slave timeout
rpl.rpl_stm_log : Included test modified in 10.2.12
rpl.rpl_stm_mixing_engines : MDEV-14489 - Sync slave with master failed
rpl.rpl_stm_multi_query : MDEV-9501 - Failed registering on master
rpl.rpl_stm_stop_middle_group : MDEV-13791 - Server crash
rpl.rpl_sync : MDEV-13830 - Assertion failure
rpl.rpl_temporal_mysql56_to_mariadb53 : MDEV-9501 - Failed registering on master
rpl.rpl_upgrade_master_info : MDEV-11620 - Table marked as crashed
@ -427,15 +400,14 @@ storage_engine.* : Not always timely maintained
#----------------------------------------------------------------
sys_vars.explicit_defaults_for_timestamp_on : Include file modified in 10.2.10
sys_vars.explicit_defaults_for_timestamp_off : Include file modified in 10.2.10
sys_vars.host_cache_size_auto : Modified in 10.2.10
sys_vars.innodb_buffer_pool_dump_at_shutdown_basic : MDEV-14280 - Unexpected error
sys_vars.innodb_buffer_pool_dump_now_basic : Modified in 10.2.11
sys_vars.innodb_buffer_pool_dump_pct_basic : Modified in 10.2.11
sys_vars.innodb_buffer_pool_load_now_basic : Modified in 10.2.11
sys_vars.rpl_init_slave_func : MDEV-10149 - Test assertion
sys_vars.slow_query_log_func : MDEV-14273 - Wrong result
sys_vars.thread_cache_size_func : MDEV-11775 - Wrong result
sys_vars.wsrep_on_basic : Opt file added in 10.2.12
#----------------------------------------------------------------
@ -450,6 +422,9 @@ tokudb.rows-32m-seq-insert : MDEV-12640 - Crash
tokudb_mariadb.mdev6657 : MDEV-12737 - Mismatch or valgrind
tokudb-rpl.rpl_tokudb_row_log : Included test modified in 10.2.12
tokudb-rpl.rpl_tokudb_stm_log : Included test modified in 10.2.12
tokudb_backup.* : MDEV-11001 - Missing include file
tokudb_sys_vars.* : MDEV-11001 - Missing include file
tokudb_rpl.* : MDEV-11001 - Missing include file
@ -458,16 +433,14 @@ tokudb_parts.partition_alter4_tokudb : MDEV-12640 - Lost connection
#----------------------------------------------------------------
unit.conc_misc : MDEV-14811 - not ok 12 - test_conc49
unit.conc_ps_bugs : MDEV-13252 - not ok 44 test_bug4236
unit.lf : MDEV-12897 - Signal 11 thrown
#----------------------------------------------------------------
vcol.vcol_misc : Modified in 10.2.10
#----------------------------------------------------------------
wsrep.binlog_format : MDEV-11532 - Could not execute check-testcase
wsrep.foreign_key : MDEV-14725 - WSREP has not yet prepared node
wsrep.mdev_6832 : MDEV-14195 - Check testcase failed
wsrep.pool_of_threads : MDEV-12234 - GLIBCXX_3.4.20 not found
wsrep.variables : MDEV-14311 - Wrong result

View File

@ -487,8 +487,7 @@ int load_defaults(const char *conf_file, const char **groups,
easily command line options override options in configuration files
NOTES
In case of fatal error, the function will print a warning and do
exit(1)
In case of fatal error, the function will print a warning and returns 2
To free used memory one should call free_defaults() with the argument
that was put in *argv
@ -641,8 +640,7 @@ int my_load_defaults(const char *conf_file, const char **groups,
err:
fprintf(stderr,"Fatal error in defaults handling. Program aborted\n");
exit(1);
return 0; /* Keep compiler happy */
return 2;
}

View File

@ -109,7 +109,7 @@ void *my_malloc(size_t size, myf my_flags)
my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_WAITTANG +
ME_NOREFRESH + ME_FATALERROR),size);
if (my_flags & MY_FAE)
exit(1);
abort();
}
else
{

View File

@ -45,18 +45,6 @@ int find_type_with_warning(const char *x, TYPELIB *typelib, const char *option)
}
int find_type_or_exit(const char *x, TYPELIB *typelib, const char *option)
{
int res;
if ((res= find_type_with_warning(x, typelib, option)) <= 0)
{
sf_leaking_memory= 1; /* no memory leak reports here */
exit(1);
}
return res;
}
/**
Search after a string in a list of strings. Endspace in x is not compared.

View File

@ -977,8 +977,8 @@ if expr "${-}" : '.*x' > /dev/null
then
:
else
exec 1>&-
exec 2>&-
exec 1>/dev/null
exec 2>/dev/null
fi
# maximum number of wsrep restarts

View File

@ -1072,7 +1072,7 @@ then
wsrep_log_info "Cleaning the existing datadir and innodb-data/log directories"
find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -regex $cpat -prune -o -exec rm -rfv {} 1>&2 \+
find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+
tempdir=$(parse_cnf mysqld log-bin "")
if [[ -n ${tempdir:-} ]];then

View File

@ -1234,11 +1234,12 @@ void mysql_read_default_options(struct st_mysql_options *options,
options->max_allowed_packet= atoi(opt_arg);
break;
case OPT_protocol:
if ((options->protocol= find_type(opt_arg, &sql_protocol_typelib,
if (options->protocol != UINT_MAX32 &&
(options->protocol= find_type(opt_arg, &sql_protocol_typelib,
FIND_TYPE_BASIC)) <= 0)
{
fprintf(stderr, "Unknown option to protocol: %s\n", opt_arg);
exit(1);
options->protocol= UINT_MAX32;
}
break;
case OPT_shared_memory_base_name:
@ -3133,6 +3134,8 @@ CLI_MYSQL_REAL_CONNECT(MYSQL *mysql,const char *host, const char *user,
my_free(mysql->options.my_cnf_file);
my_free(mysql->options.my_cnf_group);
mysql->options.my_cnf_file=mysql->options.my_cnf_group=0;
if (mysql->options.protocol == UINT_MAX32)
goto error;
}
/* Some empty-string-tests are done because of ODBC */

View File

@ -421,7 +421,7 @@ Events::create_event(THD *thd, Event_parse_data *parse_data)
DBUG_RETURN(ret);
#ifdef WITH_WSREP
error:
DBUG_RETURN(true);
DBUG_RETURN(TRUE);
#endif /* WITH_WSREP */
}

View File

@ -714,6 +714,7 @@ static ha_rows find_all_keys(THD *thd, Sort_param *param, SQL_SELECT *select,
handler *file;
MY_BITMAP *save_read_set, *save_write_set, *save_vcol_set;
Item *sort_cond;
ha_rows retval;
DBUG_ENTER("find_all_keys");
DBUG_PRINT("info",("using: %s",
(select ? select->quick ? "ranges" : "where":
@ -771,7 +772,7 @@ static ha_rows find_all_keys(THD *thd, Sort_param *param, SQL_SELECT *select,
if (quick_select)
{
if (select->quick->reset())
DBUG_RETURN(HA_POS_ERROR);
goto err;
}
DEBUG_SYNC(thd, "after_index_merge_phase1");
@ -808,7 +809,7 @@ static ha_rows find_all_keys(THD *thd, Sort_param *param, SQL_SELECT *select,
(void) file->extra(HA_EXTRA_NO_CACHE);
file->ha_rnd_end();
}
DBUG_RETURN(HA_POS_ERROR); /* purecov: inspected */
goto err; /* purecov: inspected */
}
bool write_record= false;
@ -856,7 +857,7 @@ static ha_rows find_all_keys(THD *thd, Sort_param *param, SQL_SELECT *select,
if (idx == param->max_keys_per_buffer)
{
if (write_keys(param, fs_info, idx, buffpek_pointers, tempfile))
DBUG_RETURN(HA_POS_ERROR);
goto err;
idx= 0;
indexpos++;
}
@ -882,12 +883,12 @@ static ha_rows find_all_keys(THD *thd, Sort_param *param, SQL_SELECT *select,
file->ha_rnd_end();
}
if (thd->is_error())
DBUG_RETURN(HA_POS_ERROR);
/* Signal we should use orignal column read and write maps */
sort_form->column_bitmaps_set(save_read_set, save_write_set, save_vcol_set);
if (thd->is_error())
DBUG_RETURN(HA_POS_ERROR);
DBUG_PRINT("test",("error: %d indexpos: %d",error,indexpos));
if (error != HA_ERR_END_OF_FILE)
{
@ -897,11 +898,15 @@ static ha_rows find_all_keys(THD *thd, Sort_param *param, SQL_SELECT *select,
if (indexpos && idx &&
write_keys(param, fs_info, idx, buffpek_pointers, tempfile))
DBUG_RETURN(HA_POS_ERROR); /* purecov: inspected */
const ha_rows retval=
my_b_inited(tempfile) ?
(ha_rows) (my_b_tell(tempfile)/param->rec_length) : idx;
retval= (my_b_inited(tempfile) ?
(ha_rows) (my_b_tell(tempfile)/param->rec_length) :
idx);
DBUG_PRINT("info", ("find_all_keys return %llu", (ulonglong) retval));
DBUG_RETURN(retval);
err:
sort_form->column_bitmaps_set(save_read_set, save_write_set, save_vcol_set);
DBUG_RETURN(HA_POS_ERROR);
} /* find_all_keys */
@ -999,7 +1004,8 @@ Type_handler_string_result::make_sort_key(uchar *to, Item *item,
if (maybe_null)
*to++= 1;
char *tmp_buffer= param->tmp_buffer ? param->tmp_buffer : (char*) to;
String tmp(tmp_buffer, param->sort_length, cs);
String tmp(tmp_buffer, param->tmp_buffer ? param->sort_length :
sort_field->length, cs);
String *res= item->str_result(&tmp);
if (!res)
{

View File

@ -105,7 +105,7 @@ uchar **Filesort_buffer::alloc_sort_buffer(uint num_records,
DBUG_EXECUTE_IF("alloc_sort_buffer_fail",
DBUG_SET("+d,simulate_out_of_memory"););
buff_size= num_records * (record_length + sizeof(uchar*));
buff_size= ((size_t)num_records) * (record_length + sizeof(uchar*));
set_if_bigger(buff_size, record_length * MERGEBUFF2);
if (!m_idx_array.is_null())

View File

@ -2186,38 +2186,19 @@ void ha_partition::update_create_info(HA_CREATE_INFO *create_info)
DBUG_ASSERT(sub_elem);
part= i * num_subparts + j;
DBUG_ASSERT(part < m_file_tot_parts && m_file[part]);
if (ha_legacy_type(m_file[part]->ht) == DB_TYPE_INNODB)
{
dummy_info.data_file_name= dummy_info.index_file_name = NULL;
m_file[part]->update_create_info(&dummy_info);
if (dummy_info.data_file_name || sub_elem->data_file_name)
{
sub_elem->data_file_name = (char*) dummy_info.data_file_name;
}
if (dummy_info.index_file_name || sub_elem->index_file_name)
{
sub_elem->index_file_name = (char*) dummy_info.index_file_name;
}
}
dummy_info.data_file_name= dummy_info.index_file_name = NULL;
m_file[part]->update_create_info(&dummy_info);
sub_elem->data_file_name = (char*) dummy_info.data_file_name;
sub_elem->index_file_name = (char*) dummy_info.index_file_name;
}
}
else
{
DBUG_ASSERT(m_file[i]);
if (ha_legacy_type(m_file[i]->ht) == DB_TYPE_INNODB)
{
dummy_info.data_file_name= dummy_info.index_file_name= NULL;
m_file[i]->update_create_info(&dummy_info);
if (dummy_info.data_file_name || part_elem->data_file_name)
{
part_elem->data_file_name = (char*) dummy_info.data_file_name;
}
if (dummy_info.index_file_name || part_elem->index_file_name)
{
part_elem->index_file_name = (char*) dummy_info.index_file_name;
}
}
dummy_info.data_file_name= dummy_info.index_file_name= NULL;
m_file[i]->update_create_info(&dummy_info);
part_elem->data_file_name = (char*) dummy_info.data_file_name;
part_elem->index_file_name = (char*) dummy_info.index_file_name;
}
}
DBUG_VOID_RETURN;
@ -8165,20 +8146,36 @@ uint ha_partition::alter_table_flags(uint flags)
bool ha_partition::check_if_incompatible_data(HA_CREATE_INFO *create_info,
uint table_changes)
{
handler **file;
bool ret= COMPATIBLE_DATA_YES;
/*
The check for any partitioning related changes have already been done
in mysql_alter_table (by fix_partition_func), so it is only up to
the underlying handlers.
*/
for (file= m_file; *file; file++)
if ((ret= (*file)->check_if_incompatible_data(create_info,
table_changes)) !=
COMPATIBLE_DATA_YES)
break;
return ret;
List_iterator<partition_element> part_it(m_part_info->partitions);
HA_CREATE_INFO dummy_info= *create_info;
uint i=0;
while (partition_element *part_elem= part_it++)
{
if (m_is_sub_partitioned)
{
List_iterator<partition_element> subpart_it(part_elem->subpartitions);
while (partition_element *sub_elem= subpart_it++)
{
dummy_info.data_file_name= sub_elem->data_file_name;
dummy_info.index_file_name= sub_elem->index_file_name;
if (m_file[i++]->check_if_incompatible_data(&dummy_info, table_changes))
return COMPATIBLE_DATA_NO;
}
}
else
{
dummy_info.data_file_name= part_elem->data_file_name;
dummy_info.index_file_name= part_elem->index_file_name;
if (m_file[i++]->check_if_incompatible_data(&dummy_info, table_changes))
return COMPATIBLE_DATA_NO;
}
}
return COMPATIBLE_DATA_YES;
}

View File

@ -2180,8 +2180,10 @@ bool Item_name_const::fix_fields(THD *thd, Item **ref)
String s(buf, sizeof(buf), &my_charset_bin);
s.length(0);
if (value_item->fix_fields(thd, &value_item) ||
name_item->fix_fields(thd, &name_item) ||
if ((!value_item->fixed &&
value_item->fix_fields(thd, &value_item)) ||
(!name_item->fixed &&
name_item->fix_fields(thd, &name_item)) ||
!value_item->const_item() ||
!name_item->const_item() ||
!(item_name= name_item->val_str(&s))) // Can't have a NULL name
@ -5317,7 +5319,8 @@ resolve_ref_in_select_and_group(THD *thd, Item_ident *ref, SELECT_LEX *select)
if (thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY &&
select->having_fix_field &&
select_ref != not_found_item && !group_by_ref)
select_ref != not_found_item && !group_by_ref &&
!ref->alias_name_used)
{
/*
Report the error if fields was found only in the SELECT item list and

View File

@ -1839,6 +1839,19 @@ bool Item_func_opt_neg::eq(const Item *item, bool binary_cmp) const
}
bool Item_func_interval::fix_fields(THD *thd, Item **ref)
{
if (Item_long_func::fix_fields(thd, ref))
return true;
for (uint i= 0 ; i < row->cols(); i++)
{
if (row->element_index(i)->check_cols(1))
return true;
}
return false;
}
void Item_func_interval::fix_length_and_dec()
{
uint rows= row->cols();

View File

@ -976,6 +976,7 @@ public:
Item_func_interval(THD *thd, Item_row *a):
Item_long_func(thd, a), row(a), intervals(0)
{ }
bool fix_fields(THD *, Item **);
longlong val_int();
void fix_length_and_dec();
const char *func_name() const { return "interval"; }

View File

@ -781,10 +781,10 @@ String *Item_func_json_extract::read_json(String *str,
{
str->set_charset(js->charset());
str->length(0);
}
if (possible_multiple_values && str->append("[", 1))
goto error;
if (possible_multiple_values && str->append("[", 1))
goto error;
}
json_get_path_start(&je, js->charset(),(const uchar *) js->ptr(),
(const uchar *) js->ptr() + js->length(), &p);

View File

@ -3682,7 +3682,7 @@ void Item_func_group_concat::print(String *str, enum_query_type query_type)
}
}
str->append(STRING_WITH_LEN(" separator \'"));
str->append(*separator);
str->append_for_single_quote(separator->ptr(), separator->length());
str->append(STRING_WITH_LEN("\')"));
}

View File

@ -2470,7 +2470,7 @@ static int find_uniq_filename(char *name, ulong next_log_number)
char buff[FN_REFLEN], ext_buf[FN_REFLEN];
struct st_my_dir *dir_info;
reg1 struct fileinfo *file_info;
ulong max_found, next, number;
ulong max_found, next, UNINIT_VAR(number);
size_t buf_length, length;
char *start, *end;
int error= 0;
@ -3630,6 +3630,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
new_xid_list_entry->binlog_name= name_mem;
new_xid_list_entry->binlog_name_len= len;
new_xid_list_entry->xid_count= 0;
new_xid_list_entry->notify_count= 0;
/*
Find the name for the Initial binlog checkpoint.
@ -4990,7 +4991,55 @@ MYSQL_BIN_LOG::is_xidlist_idle_nolock()
return true;
}
#ifdef WITH_WSREP
inline bool
is_gtid_cached_internal(IO_CACHE *file)
{
uchar data[EVENT_TYPE_OFFSET+1];
bool result= false;
my_off_t write_pos= my_b_tell(file);
if (reinit_io_cache(file, READ_CACHE, 0, 0, 0))
return false;
/*
In the cache we have gtid event if , below condition is true,
*/
my_b_read(file, data, sizeof(data));
uint event_type= (uchar)data[EVENT_TYPE_OFFSET];
if (event_type == GTID_LOG_EVENT)
result= true;
/*
Cleanup , Why because we have not read the full buffer
and this will cause next to next reinit_io_cache(called in write_cache)
to make cache empty.
*/
file->read_pos= file->read_end;
if (reinit_io_cache(file, WRITE_CACHE, write_pos, 0, 0))
return false;
return result;
}
#endif
#ifdef WITH_WSREP
inline bool
MYSQL_BIN_LOG::is_gtid_cached(THD *thd)
{
binlog_cache_mngr *mngr= (binlog_cache_mngr *) thd_get_ha_data(
thd, binlog_hton);
if (!mngr)
return false;
binlog_cache_data *cache_trans= mngr->get_binlog_cache_data(
use_trans_cache(thd, true));
binlog_cache_data *cache_stmt= mngr->get_binlog_cache_data(
use_trans_cache(thd, false));
if (cache_trans && !cache_trans->empty() &&
is_gtid_cached_internal(&cache_trans->cache_log))
return true;
if (cache_stmt && !cache_stmt->empty() &&
is_gtid_cached_internal(&cache_stmt->cache_log))
return true;
return false;
}
#endif
/**
Create a new log file name.
@ -5582,7 +5631,36 @@ THD::binlog_start_trans_and_stmt()
cache_mngr->trx_cache.get_prev_position() == MY_OFF_T_UNDEF)
{
this->binlog_set_stmt_begin();
if (in_multi_stmt_transaction_mode())
bool mstmt_mode= in_multi_stmt_transaction_mode();
#ifdef WITH_WSREP
/* Write Gtid
Get domain id only when gtid mode is set
If this event is replicate through a master then ,
we will forward the same gtid another nodes
We have to do this only one time in mysql transaction.
Since this function is called multiple times , We will check for
ha_info->is_started()
*/
Ha_trx_info *ha_info;
ha_info= this->ha_data[binlog_hton->slot].ha_info + (mstmt_mode ? 1 : 0);
if (!ha_info->is_started() && wsrep_gtid_mode
&& this->variables.gtid_seq_no)
{
binlog_cache_mngr *const cache_mngr=
(binlog_cache_mngr*) thd_get_ha_data(this, binlog_hton);
binlog_cache_data *cache_data= cache_mngr->get_binlog_cache_data(1);
IO_CACHE *file= &cache_data->cache_log;
Log_event_writer writer(file, cache_data);
Gtid_log_event gtid_event(this, this->variables.gtid_seq_no,
this->variables.gtid_domain_id,
true, LOG_EVENT_SUPPRESS_USE_F,
true, 0);
gtid_event.server_id= this->variables.server_id;
writer.write(&gtid_event);
}
#endif
if (mstmt_mode)
trans_register_ha(this, TRUE, binlog_hton);
trans_register_ha(this, FALSE, binlog_hton);
/*
@ -5862,7 +5940,7 @@ MYSQL_BIN_LOG::write_gtid_event(THD *thd, bool standalone,
DBUG_PRINT("enter", ("standalone: %d", standalone));
#ifdef WITH_WSREP
if (WSREP(thd) && thd->wsrep_trx_meta.gtid.seqno != -1 && wsrep_gtid_mode)
if (WSREP(thd) && thd->wsrep_trx_meta.gtid.seqno != -1 && wsrep_gtid_mode && !thd->variables.gtid_seq_no)
{
domain_id= wsrep_gtid_domain_id;
} else {
@ -5914,6 +5992,12 @@ MYSQL_BIN_LOG::write_gtid_event(THD *thd, bool standalone,
/* Write the event to the binary log. */
DBUG_ASSERT(this == &mysql_bin_log);
#ifdef WITH_WSREP
if (wsrep_gtid_mode && is_gtid_cached(thd))
DBUG_RETURN(false);
#endif
if (write_event(&gtid_event))
DBUG_RETURN(true);
status_var_add(thd->status_var.binlog_bytes_written, gtid_event.data_written);
@ -9718,9 +9802,20 @@ void
TC_LOG_BINLOG::commit_checkpoint_notify(void *cookie)
{
xid_count_per_binlog *entry= static_cast<xid_count_per_binlog *>(cookie);
bool found_entry= false;
mysql_mutex_lock(&LOCK_binlog_background_thread);
entry->next_in_queue= binlog_background_thread_queue;
binlog_background_thread_queue= entry;
/* count the same notification kind from different engines */
for (xid_count_per_binlog *link= binlog_background_thread_queue;
link && !found_entry; link= link->next_in_queue)
{
if ((found_entry= (entry == link)))
entry->notify_count++;
}
if (!found_entry)
{
entry->next_in_queue= binlog_background_thread_queue;
binlog_background_thread_queue= entry;
}
mysql_cond_signal(&COND_binlog_background_thread);
mysql_mutex_unlock(&LOCK_binlog_background_thread);
}
@ -9815,13 +9910,16 @@ binlog_background_thread(void *arg __attribute__((unused)))
);
while (queue)
{
long count= queue->notify_count;
THD_STAGE_INFO(thd, stage_binlog_processing_checkpoint_notify);
DEBUG_SYNC(thd, "binlog_background_thread_before_mark_xid_done");
/* Set the thread start time */
thd->set_time();
/* Grab next pointer first, as mark_xid_done() may free the element. */
next= queue->next_in_queue;
mysql_bin_log.mark_xid_done(queue->binlog_id, true);
queue->notify_count= 0;
for (long i= 0; i <= count; i++)
mysql_bin_log.mark_xid_done(queue->binlog_id, true);
queue= next;
DBUG_EXECUTE_IF("binlog_background_checkpoint_processed",

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