Merge branch '10.2' into 10.3

This commit is contained in:
Oleksandr Byelkin 2022-05-03 10:59:54 +02:00
commit 9614fde1aa
111 changed files with 2663 additions and 552 deletions

View File

@ -567,3 +567,5 @@
#endif // !defined(__STDC_FORMAT_MACROS)
#endif
#cmakedefine HAVE_VFORK 1

View File

@ -1018,3 +1018,19 @@ IF(NOT MSVC)
HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE
)
ENDIF()
MY_CHECK_C_COMPILER_FLAG("-Werror")
IF(have_C__Werror)
SET(SAVE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror")
CHECK_C_SOURCE_COMPILES("
#include <unistd.h>
int main()
{
pid_t pid=vfork();
return (int)pid;
}"
HAVE_VFORK
)
SET(CMAKE_REQUIRED_FLAGS ${SAVE_CMAKE_REQUIRED_FLAGS})
ENDIF()

View File

@ -266,7 +266,8 @@ free_mysql_variables(mysql_variable *vars)
static
char *
read_mysql_one_value(MYSQL *connection, const char *query)
read_mysql_one_value(MYSQL *connection, const char *query,
uint column, uint expect_columns)
{
MYSQL_RES *mysql_result;
MYSQL_ROW row;
@ -274,10 +275,10 @@ read_mysql_one_value(MYSQL *connection, const char *query)
mysql_result = xb_mysql_query(connection, query, true);
ut_ad(mysql_num_fields(mysql_result) == 1);
ut_ad(mysql_num_fields(mysql_result) == expect_columns);
if ((row = mysql_fetch_row(mysql_result))) {
result = strdup(row[0]);
result = strdup(row[column]);
}
mysql_free_result(mysql_result);
@ -285,6 +286,15 @@ read_mysql_one_value(MYSQL *connection, const char *query)
return(result);
}
static
char *
read_mysql_one_value(MYSQL *mysql, const char *query)
{
return read_mysql_one_value(mysql, query, 0/*offset*/, 1/*total columns*/);
}
static
bool
check_server_version(unsigned long version_number,
@ -1197,92 +1207,322 @@ cleanup:
}
class Var
{
const char *m_name;
char *m_value;
/*
Disable copying constructors for safety, as the default binary copying
which would be wrong. If we ever want them, the m_value
member should be copied using an strdup()-alike function.
*/
Var(const Var &); // Disabled
Var(Var &); // Disabled
public:
~Var()
{
free(m_value);
}
Var(const char *name)
:m_name(name),
m_value(NULL)
{ }
// Init using a SHOW VARIABLES LIKE 'name' query
Var(const char *name, MYSQL *mysql)
:m_name(name)
{
char buf[128];
my_snprintf(buf, sizeof(buf), "SHOW VARIABLES LIKE '%s'", m_name);
m_value= read_mysql_one_value(mysql, buf, 1/*offset*/, 2/*total columns*/);
}
/*
Init by name from a result set.
If the variable name is not found in the result set metadata field names,
it's value stays untouched.
*/
bool init(MYSQL_RES *mysql_result, MYSQL_ROW row)
{
MYSQL_FIELD *field= mysql_fetch_fields(mysql_result);
for (uint i= 0; i < mysql_num_fields(mysql_result); i++)
{
if (!strcmp(field[i].name, m_name))
{
free(m_value); // In case it was initialized earlier
m_value= row[i] ? strdup(row[i]) : NULL;
return false;
}
}
return true;
}
void replace(char from, char to)
{
ut_ad(m_value);
for (char *ptr= strchr(m_value, from); ptr; ptr= strchr(ptr, from))
*ptr= to;
}
const char *value() const { return m_value; }
bool eq_value(const char *str, size_t length) const
{
return m_value && !strncmp(m_value, str, length) && m_value[length] == '\0';
}
bool is_null_or_empty() const { return !m_value || !m_value[0]; }
bool print(String *to) const
{
ut_ad(m_value);
return to->append(m_value);
}
bool print_quoted(String *to) const
{
ut_ad(m_value);
return to->append("'") || to->append(m_value) || to->append("'");
}
bool print_set_global(String *to) const
{
ut_ad(m_value);
return
to->append("SET GLOBAL ") ||
to->append(m_name) ||
to->append(" = '") ||
to->append(m_value) ||
to->append("';\n");
}
};
class Show_slave_status
{
Var m_mariadb_connection_name; // MariaDB: e.g. 'master1'
Var m_master; // e.g. 'localhost'
Var m_filename; // e.g. 'source-bin.000002'
Var m_position; // a number
Var m_mysql_gtid_executed; // MySQL56: e.g. single '<UUID>:1-5" or multiline
// '<UUID1>:1-10,\n<UUID2>:1-20\n<UUID3>:1-30'
Var m_mariadb_using_gtid; // MariaDB: 'No','Slave_Pos','Current_Pos'
public:
Show_slave_status()
:m_mariadb_connection_name("Connection_name"),
m_master("Master_Host"),
m_filename("Relay_Master_Log_File"),
m_position("Exec_Master_Log_Pos"),
m_mysql_gtid_executed("Executed_Gtid_Set"),
m_mariadb_using_gtid("Using_Gtid")
{ }
void init(MYSQL_RES *res, MYSQL_ROW row)
{
m_mariadb_connection_name.init(res, row);
m_master.init(res, row);
m_filename.init(res, row);
m_position.init(res, row);
m_mysql_gtid_executed.init(res, row);
m_mariadb_using_gtid.init(res, row);
// Normalize
if (m_mysql_gtid_executed.value())
m_mysql_gtid_executed.replace('\n', ' ');
}
static void msg_is_not_slave()
{
msg("Failed to get master binlog coordinates "
"from SHOW SLAVE STATUS.This means that the server is not a "
"replication slave. Ignoring the --slave-info option");
}
bool is_mariadb_using_gtid() const
{
return !m_mariadb_using_gtid.eq_value("No", 2);
}
static bool start_comment_chunk(String *to)
{
return to->length() ? to->append("; ") : false;
}
bool print_connection_name_if_set(String *to) const
{
if (!m_mariadb_connection_name.is_null_or_empty())
return m_mariadb_connection_name.print_quoted(to) || to->append(' ');
return false;
}
bool print_comment_master_identity(String *comment) const
{
if (comment->append("master "))
return true;
if (!m_mariadb_connection_name.is_null_or_empty())
return m_mariadb_connection_name.print_quoted(comment);
return comment->append("''"); // Default not named master
}
bool print_using_master_log_pos(String *sql, String *comment) const
{
return
sql->append("CHANGE MASTER ") ||
print_connection_name_if_set(sql) ||
sql->append("TO MASTER_LOG_FILE=") || m_filename.print_quoted(sql) ||
sql->append(", MASTER_LOG_POS=") || m_position.print(sql) ||
sql->append(";\n") ||
print_comment_master_identity(comment) ||
comment->append(" filename ") || m_filename.print_quoted(comment) ||
comment->append(" position ") || m_position.print_quoted(comment);
}
bool print_mysql56(String *sql, String *comment) const
{
/*
SET @@GLOBAL.gtid_purged = '2174B383-5441-11E8-B90A-C80AA9429562:1-1029, '
'224DA167-0C0C-11E8-8442-00059A3C7B00:1-2695';
CHANGE MASTER TO MASTER_AUTO_POSITION=1;
*/
return
sql->append("SET GLOBAL gtid_purged=") ||
m_mysql_gtid_executed.print_quoted(sql) ||
sql->append(";\n") ||
sql->append("CHANGE MASTER TO MASTER_AUTO_POSITION=1;\n") ||
print_comment_master_identity(comment) ||
comment->append(" purge list ") ||
m_mysql_gtid_executed.print_quoted(comment);
}
bool print_mariadb10_using_gtid(String *sql, String *comment) const
{
return
sql->append("CHANGE MASTER ") ||
print_connection_name_if_set(sql) ||
sql->append("TO master_use_gtid = slave_pos;\n") ||
print_comment_master_identity(comment) ||
comment->append(" master_use_gtid = slave_pos");
}
bool print(String *sql, String *comment, const Var &gtid_slave_pos) const
{
if (!m_mysql_gtid_executed.is_null_or_empty())
{
/* MySQL >= 5.6 with GTID enabled */
return print_mysql56(sql, comment);
}
if (!gtid_slave_pos.is_null_or_empty() && is_mariadb_using_gtid())
{
/* MariaDB >= 10.0 with GTID enabled */
return print_mariadb10_using_gtid(sql, comment);
}
return print_using_master_log_pos(sql, comment);
}
/*
Get master info into strings "sql" and "comment" from a MYSQL_RES.
@return false on success
@return true on error
*/
static bool get_slave_info(MYSQL_RES *show_slave_info_result,
const Var &gtid_slave_pos,
String *sql, String *comment)
{
if (!gtid_slave_pos.is_null_or_empty())
{
// Print gtid_slave_pos if any of the masters really needs it.
while (MYSQL_ROW row= mysql_fetch_row(show_slave_info_result))
{
Show_slave_status status;
status.init(show_slave_info_result, row);
if (status.is_mariadb_using_gtid())
{
if (gtid_slave_pos.print_set_global(sql) ||
comment->append("gtid_slave_pos ") ||
gtid_slave_pos.print_quoted(comment))
return true; // Error
break;
}
}
}
// Print the list of masters
mysql_data_seek(show_slave_info_result, 0);
while (MYSQL_ROW row= mysql_fetch_row(show_slave_info_result))
{
Show_slave_status status;
status.init(show_slave_info_result, row);
if (start_comment_chunk(comment) ||
status.print(sql, comment, gtid_slave_pos))
return true; // Error
}
return false; // Success
}
/*
Get master info into strings "sql" and "comment".
@return false on success
@return true on error
*/
static bool get_slave_info(MYSQL *mysql, bool show_all_slave_status,
String *sql, String *comment)
{
bool rc= false; // Success
// gtid_slave_pos - MariaDB variable : e.g. "0-1-1" or "1-10-100,2-20-500"
Var gtid_slave_pos("gtid_slave_pos", mysql);
const char *query= show_all_slave_status ? "SHOW ALL SLAVES STATUS" :
"SHOW SLAVE STATUS";
MYSQL_RES *mysql_result= xb_mysql_query(mysql, query, true);
if (!mysql_num_rows(mysql_result))
{
msg_is_not_slave();
// Don't change rc, we still want to continue the backup
}
else
{
rc= get_slave_info(mysql_result, gtid_slave_pos, sql, comment);
}
mysql_free_result(mysql_result);
return rc;
}
};
/*********************************************************************//**
Retrieves MySQL binlog position of the master server in a replication
setup and saves it in a file. It also saves it in mysql_slave_position
variable. */
variable.
@returns false on error
@returns true on success
*/
bool
write_slave_info(MYSQL *connection)
{
char *master = NULL;
char *filename = NULL;
char *gtid_executed = NULL;
char *using_gtid = NULL;
char *position = NULL;
char *gtid_slave_pos = NULL;
char *ptr;
bool result = false;
String sql, comment;
bool show_all_slaves_status= false;
mysql_variable status[] = {
{"Master_Host", &master},
{"Relay_Master_Log_File", &filename},
{"Exec_Master_Log_Pos", &position},
{"Executed_Gtid_Set", &gtid_executed},
{"Using_Gtid", &using_gtid},
{NULL, NULL}
};
switch (server_flavor)
{
case FLAVOR_MARIADB:
show_all_slaves_status= mysql_server_version >= 100000;
break;
case FLAVOR_UNKNOWN:
case FLAVOR_MYSQL:
case FLAVOR_PERCONA_SERVER:
break;
}
mysql_variable variables[] = {
{"gtid_slave_pos", &gtid_slave_pos},
{NULL, NULL}
};
if (Show_slave_status::get_slave_info(connection, show_all_slaves_status,
&sql, &comment))
return false; // Error
read_mysql_variables(connection, "SHOW SLAVE STATUS", status, false);
read_mysql_variables(connection, "SHOW VARIABLES", variables, true);
if (!sql.length())
{
/*
SHOW [ALL] SLAVE STATUS returned no rows.
Don't create the file, but return success to continue the backup.
*/
return true; // Success
}
if (master == NULL || filename == NULL || position == NULL) {
msg("Failed to get master binlog coordinates "
"from SHOW SLAVE STATUS.This means that the server is not a "
"replication slave. Ignoring the --slave-info option");
/* we still want to continue the backup */
result = true;
goto cleanup;
}
/* Print slave status to a file.
If GTID mode is used, construct a CHANGE MASTER statement with
MASTER_AUTO_POSITION and correct a gtid_purged value. */
if (gtid_executed != NULL && *gtid_executed) {
/* MySQL >= 5.6 with GTID enabled */
for (ptr = strchr(gtid_executed, '\n');
ptr;
ptr = strchr(ptr, '\n')) {
*ptr = ' ';
}
result = backup_file_printf(XTRABACKUP_SLAVE_INFO,
"SET GLOBAL gtid_purged='%s';\n"
"CHANGE MASTER TO MASTER_AUTO_POSITION=1\n",
gtid_executed);
ut_a(asprintf(&mysql_slave_position,
"master host '%s', purge list '%s'",
master, gtid_executed) != -1);
} else if (gtid_slave_pos && *gtid_slave_pos &&
!(using_gtid && !strncmp(using_gtid, "No", 2))) {
/* MariaDB >= 10.0 with GTID enabled */
result = backup_file_printf(XTRABACKUP_SLAVE_INFO,
"SET GLOBAL gtid_slave_pos = '%s';\n"
"CHANGE MASTER TO master_use_gtid = slave_pos\n",
gtid_slave_pos);
ut_a(asprintf(&mysql_slave_position,
"master host '%s', gtid_slave_pos %s",
master, gtid_slave_pos) != -1);
} else {
result = backup_file_printf(XTRABACKUP_SLAVE_INFO,
"CHANGE MASTER TO MASTER_LOG_FILE='%s', "
"MASTER_LOG_POS=%s\n", filename, position);
ut_a(asprintf(&mysql_slave_position,
"master host '%s', filename '%s', position '%s'",
master, filename, position) != -1);
}
cleanup:
free_mysql_variables(status);
free_mysql_variables(variables);
return(result);
mysql_slave_position= strdup(comment.c_ptr());
return backup_file_print_buf(XTRABACKUP_SLAVE_INFO, sql.ptr(), sql.length());
}

View File

@ -5390,11 +5390,23 @@ static ibool prepare_handle_new_files(const char *data_home_dir,
const char *file_name, void *arg)
{
const char *dest_dir = static_cast<const char *>(arg);
std::string src_path = std::string(data_home_dir) + '/' + std::string(db_name) + '/' + file_name;
std::string src_path = std::string(data_home_dir) + '/' + std::string(db_name) + '/';
/* Copy "*.new" files from incremental to base dir for incremental backup */
std::string dest_path=
dest_dir ? std::string(dest_dir) + '/' + std::string(db_name) +
'/' + file_name : src_path;
'/' : src_path;
/*
A CREATE DATABASE could have happened during the base mariabackup run.
In case if the current table file (e.g. `t1.new`) is from such
a new database, the database directory may not exist yet in
the base backup directory. Let's make sure to check if the directory
exists (and create if needed).
*/
if (!directory_exists(dest_path.c_str(), true/*create if not exists*/))
return FALSE;
src_path+= file_name;
dest_path+= file_name;
size_t index = dest_path.find(".new");
DBUG_ASSERT(index != std::string::npos);

@ -1 +1 @@
Subproject commit f6c3d9fd2af5d17db64cc996574aa312efd70fcf
Subproject commit ab7a81e79e4be4324a2d09d19d4f5249801ef665

View File

@ -41,6 +41,7 @@ can be invoked several ways:
shell> \fBmysql_tzinfo_to_sql \fR\fB\fItz_dir\fR\fR
shell> \fBmysql_tzinfo_to_sql \fR\fB\fItz_file tz_name\fR\fR
shell> \fBmysql_tzinfo_to_sql \-\-leap \fR\fB\fItz_file\fR\fR
shell> \fBmysql_tzinfo_to_sql \-\-skip\-write\-binlog \fR\fB\fItz_dir\fR\fR
.fi
.if n \{\
.RE
@ -100,6 +101,9 @@ shell> \fBmysql_tzinfo_to_sql \-\-leap \fR\fB\fItz_file\fR\fR\fB | mysql \-u roo
.RE
.\}
.PP
Using the \-\-skip\-write\-binlog option prevents writing of changes to the binary log or to other Galera
cluster members. This can be used with any form of running \fBmysql_tzinfo_to_sql\fR.
.PP
After running
\fBmysql_tzinfo_to_sql\fR, it is best to restart the server so that it does not continue to use any previously cached time zone data\&.
.SH "COPYRIGHT"

View File

@ -1,4 +1,7 @@
drop table if exists t1, t2;
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
#
# Testcase for BUG#4551
#
CREATE TABLE t1 ( a int );
INSERT INTO t1 VALUES (1),(2),(1);
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
@ -18,3 +21,17 @@ ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
select * from t2;
ERROR 42S02: Table 'test.t2' doesn't exist
drop table t1;
#
# End of 4.1 tests
#
#
# MDEV-28393 Server crashes in TABLE::mark_default_fields_for_write
#
create table t1 (a int, b text not null default '');
alter table t1 character set = utf8;
create table t2 select * from t1;
insert into t1 values (1,'');
drop table t1, t2;
#
# End of 10.2 tests
#

View File

@ -1,39 +1,52 @@
# Testcase for BUG#4551
# This does not work for RBR yet.
--source include/have_innodb.inc
--source include/have_binlog_format_mixed_or_statement.inc
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
--echo #
--echo # Testcase for BUG#4551
--echo #
# The bug was that when the table was TEMPORARY, it was not deleted if
# the CREATE SELECT failed (the code intended too, but it actually
# didn't). And as the CREATE TEMPORARY TABLE was not written to the
# binlog if it was a transactional table, it resulted in an
# inconsistency between binlog and the internal list of temp tables.
# This does not work for RBR yet.
--source include/have_binlog_format_mixed_or_statement.inc
--disable_query_log
CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT");
--enable_query_log
-- source include/have_innodb.inc
--disable_warnings
drop table if exists t1, t2;
--enable_warnings
CREATE TABLE t1 ( a int );
INSERT INTO t1 VALUES (1),(2),(1);
--error ER_DUP_ENTRY
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
--error 1146
--error ER_NO_SUCH_TABLE
select * from t2;
--error ER_DUP_ENTRY
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=INNODB SELECT a FROM t1;
--error 1146
--error ER_NO_SUCH_TABLE
select * from t2;
--error ER_DUP_ENTRY
CREATE TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
--error 1146
--error ER_NO_SUCH_TABLE
select * from t2;
--error ER_DUP_ENTRY
CREATE TEMPORARY TABLE t2 ( PRIMARY KEY (a) ) ENGINE=MYISAM SELECT a FROM t1;
--error 1146
--error ER_NO_SUCH_TABLE
select * from t2;
drop table t1;
# End of 4.1 tests
--echo #
--echo # End of 4.1 tests
--echo #
--echo #
--echo # MDEV-28393 Server crashes in TABLE::mark_default_fields_for_write
--echo #
create table t1 (a int, b text not null default '');
alter table t1 character set = utf8;
create table t2 select * from t1;
insert into t1 values (1,'');
drop table t1, t2;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -3628,4 +3628,64 @@ f2 f3
DROP PROCEDURE p1;
DROP VIEW v1,v2,v3;
DROP TABLE t1;
#
# MDEV-27212: 2-nd execution of PS for select with embedded derived tables
# and correlated subquery in select list of outer derived
#
create table t1 ( id int, id2 int ) engine=myisam;
create table t2 ( x3 int , x1 int , x2 int, a1 int) engine=myisam;
insert into t1 values (3, 2), (4, 2), (3, 4);
insert into t2 values (1, 2, 2, 1), (1, 3, 3, 2), (2, 3, 3, 1);
prepare stmt from "select id from t1
join
( select dt2.x1,
( select sum(a1) from t2 where t2.x1 = dt2.x1 ) m
from ( select x1 from t2 u where x3 = 1 ) dt2
) dt
on t1.id = dt.x1
where t1.id2 < dt.m";
execute stmt;
id
3
execute stmt;
id
3
deallocate prepare stmt;
create procedure sp1() select id from t1
join
( select dt2.x1,
( select sum(a1) from t2 where t2.x1 = dt2.x1 ) m
from ( select x1 from t2 u where x3 = 1 ) dt2
) dt
on t1.id = dt.x1
where t1.id2 < dt.m;
call sp1();
id
3
call sp1();
id
3
create view v2 as select x1 from t2 u where x3 = 1;
create view v as
select v2.x1,
( select sum(a1) from t2 where t2.x1 = v2.x1 ) m from v2;
prepare stmt from "select id from t1 join v on t1.id = v.x1 where t1.id2 < v.m";
execute stmt;
id
3
execute stmt;
id
3
deallocate prepare stmt;
create procedure sp2() select id from t1 join v on t1.id = v.x1 where t1.id2 < v.m;
call sp2();
id
3
call sp2();
id
3
drop procedure sp1;
drop procedure sp2;
drop view v, v2;
drop table t1,t2;
# End of 10.2 tests

View File

@ -2400,4 +2400,56 @@ DROP PROCEDURE p1;
DROP VIEW v1,v2,v3;
DROP TABLE t1;
--echo #
--echo # MDEV-27212: 2-nd execution of PS for select with embedded derived tables
--echo # and correlated subquery in select list of outer derived
--echo #
create table t1 ( id int, id2 int ) engine=myisam;
create table t2 ( x3 int , x1 int , x2 int, a1 int) engine=myisam;
insert into t1 values (3, 2), (4, 2), (3, 4);
insert into t2 values (1, 2, 2, 1), (1, 3, 3, 2), (2, 3, 3, 1);
let $q=
select id from t1
join
( select dt2.x1,
( select sum(a1) from t2 where t2.x1 = dt2.x1 ) m
from ( select x1 from t2 u where x3 = 1 ) dt2
) dt
on t1.id = dt.x1
where t1.id2 < dt.m;
eval prepare stmt from "$q";
execute stmt;
execute stmt;
deallocate prepare stmt;
eval create procedure sp1() $q;
call sp1();
call sp1();
create view v2 as select x1 from t2 u where x3 = 1;
create view v as
select v2.x1,
( select sum(a1) from t2 where t2.x1 = v2.x1 ) m from v2;
let $q=
select id from t1 join v on t1.id = v.x1 where t1.id2 < v.m;
eval prepare stmt from "$q";
execute stmt;
execute stmt;
deallocate prepare stmt;
eval create procedure sp2() $q;
call sp2();
call sp2();
drop procedure sp1;
drop procedure sp2;
drop view v, v2;
drop table t1,t2;
--echo # End of 10.2 tests

View File

@ -167,8 +167,8 @@ create algorithm=temptable view v1 as select * from t1;
create algorithm=merge view v2 as select * from t1;
select default(a) = now() from v1;
default(a) = now()
NULL
NULL
1
1
select default(a) = now() from v2;
default(a) = now()
1
@ -191,16 +191,29 @@ default(v1)
2001-01-01 10:20:30
select default(v1) from (select v1 from t1 group by v1) dt;
default(v1)
0000-00-00 00:00:00
2001-01-01 10:20:30
drop table t1;
create table t1 (a text default '');
create algorithm=temptable view v1 as select * from t1;
insert into t1 values ('a');
select default(a) from v1;
default(a)
NULL
drop view v1;
drop table t1;
#
# MDEV-28403 ASAN heap-use-after-free in String::copy / get_field_default_value
#
create table t (a blob default 'x');
create view v as select * from t;
insert into t () values ();
update t set a = default;
select table_name,column_name,column_default from information_schema.columns where table_name = 'v';
table_name v
column_name a
column_default 'x'
drop view v;
drop table t;
#
# End of 10.2 tests
#

View File

@ -166,6 +166,17 @@ select default(a) from v1;
drop view v1;
drop table t1;
--echo #
--echo # MDEV-28403 ASAN heap-use-after-free in String::copy / get_field_default_value
--echo #
create table t (a blob default 'x');
create view v as select * from t;
insert into t () values ();
update t set a = default;
query_vertical select table_name,column_name,column_default from information_schema.columns where table_name = 'v';
drop view v;
drop table t;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -989,6 +989,12 @@ ADDTIME('916:40:00', '416:40:00')
Warnings:
Warning 1292 Truncated incorrect time value: '916:40:00'
Warning 1292 Truncated incorrect time value: '1255:39:59.999999'
SELECT ADDTIME(20010101,1e0), ADDTIME(20010101,1.1e0);
ADDTIME(20010101,1e0) ADDTIME(20010101,1.1e0)
2001-01-01 00:00:01 2001-01-01 00:00:01.100000
SELECT ADDTIME(ADDTIME(20010101,1e0), 0);
ADDTIME(ADDTIME(20010101,1e0), 0)
2001-01-01 00:00:01
SELECT SUBTIME('916:40:00', '416:40:00');
SUBTIME('916:40:00', '416:40:00')
422:19:59.999999

View File

@ -513,6 +513,10 @@ SELECT TIME_TO_SEC('916:40:00');
SELECT ADDTIME('500:00:00', '416:40:00');
SELECT ADDTIME('916:40:00', '416:40:00');
# check if ADDTIME() handles NOT_FIXED_DEC correctly
SELECT ADDTIME(20010101,1e0), ADDTIME(20010101,1.1e0);
SELECT ADDTIME(ADDTIME(20010101,1e0), 0);
# check if SUBTIME() handles out-of-range values correctly
SELECT SUBTIME('916:40:00', '416:40:00');
SELECT SUBTIME('-916:40:00', '416:40:00');

View File

@ -2,8 +2,6 @@ set GLOBAL sql_mode="";
set LOCAL sql_mode="";
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
drop table if exists t1;
drop database if exists mysqltest;
connect master,localhost,root,,;
connection master;
SET NAMES binary;
@ -2789,6 +2787,14 @@ DROP USER foo;
DROP TABLE db.t;
DROP DATABASE db;
#
# Bug#33578113: DROP privilege on performance_schema.* can't be revoked
#
connection default;
CREATE USER bug33578113;
GRANT DROP ON performance_schema.* TO bug33578113;
REVOKE DROP ON performance_schema.* FROM bug33578113;
DROP USER bug33578113;
#
# End of 10.2 tests
#
#

View File

@ -1,7 +1,7 @@
# Test of GRANT commands
# Grant tests not performed with embedded server
-- source include/not_embedded.inc
--source include/not_embedded.inc
# Save the initial number of concurrent sessions
--source include/count_sessions.inc
@ -11,12 +11,6 @@ set LOCAL sql_mode="";
SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators;
SET GLOBAL log_bin_trust_function_creators = 1;
# Cleanup
--disable_warnings
drop table if exists t1;
drop database if exists mysqltest;
--enable_warnings
connect (master,localhost,root,,);
connection master;
SET NAMES binary;
@ -2292,6 +2286,16 @@ DROP USER foo;
DROP TABLE db.t;
DROP DATABASE db;
--echo #
--echo # Bug#33578113: DROP privilege on performance_schema.* can't be revoked
--echo #
connection default;
CREATE USER bug33578113;
GRANT DROP ON performance_schema.* TO bug33578113;
REVOKE DROP ON performance_schema.* FROM bug33578113;
DROP USER bug33578113;
--source include/wait_until_count_sessions.inc
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -0,0 +1,47 @@
#
# Start of 10.2 tests
#
#
# MDEV-25243 ASAN heap-use-after-free in Item_func_sp::execute_impl upon concurrent view DDL and I_S query with view and function
#
CREATE FUNCTION f1() RETURNS INT RETURN 1;
CREATE VIEW v01 AS SELECT f1();
CREATE VIEW v02 AS SELECT f1();
connect con1,localhost,root,,;
SELECT GET_LOCK('v01',30);
GET_LOCK('v01',30)
1
SELECT GET_LOCK('v02',30);
GET_LOCK('v02',30)
1
connection default;
SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA='test'
AND TABLE_NAME LIKE 'v0%'
AND GET_LOCK(TABLE_NAME,30)
AND RELEASE_LOCK(TABLE_NAME)
AND f1()=1
ORDER BY TABLE_NAME;
connection con1;
connection con1;
SELECT RELEASE_LOCK('v01') /* Let the first row evaluate f1 */;
RELEASE_LOCK('v01')
1
CREATE FUNCTION f2() RETURNS INT RETURN 1 /* Invalidate SP cache*/;
SELECT RELEASE_LOCK('v02') /* Let the second row evaluate f1() */;
RELEASE_LOCK('v02')
1
DROP FUNCTION f2;
disconnect con1;
connection default;
SELECT RELEASE_LOCK('v01');
RELEASE_LOCK('v01')
NULL
SELECT RELEASE_LOCK('v02');
RELEASE_LOCK('v02')
NULL
DROP VIEW v01, v02;
DROP FUNCTION f1;
#
# End of 10.2 tests
#

View File

@ -0,0 +1,48 @@
--echo #
--echo # Start of 10.2 tests
--echo #
--echo #
--echo # MDEV-25243 ASAN heap-use-after-free in Item_func_sp::execute_impl upon concurrent view DDL and I_S query with view and function
--echo #
CREATE FUNCTION f1() RETURNS INT RETURN 1;
CREATE VIEW v01 AS SELECT f1();
CREATE VIEW v02 AS SELECT f1();
--connect(con1,localhost,root,,)
SELECT GET_LOCK('v01',30);
SELECT GET_LOCK('v02',30);
--connection default
--send
SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA='test'
AND TABLE_NAME LIKE 'v0%'
AND GET_LOCK(TABLE_NAME,30)
AND RELEASE_LOCK(TABLE_NAME)
AND f1()=1
ORDER BY TABLE_NAME;
--connection con1
--connection con1
SELECT RELEASE_LOCK('v01') /* Let the first row evaluate f1 */;
CREATE FUNCTION f2() RETURNS INT RETURN 1 /* Invalidate SP cache*/;
SELECT RELEASE_LOCK('v02') /* Let the second row evaluate f1() */;
DROP FUNCTION f2;
--disconnect con1
--connection default
--disable_result_log
--reap
--enable_result_log
SELECT RELEASE_LOCK('v01');
SELECT RELEASE_LOCK('v02');
DROP VIEW v01, v02;
DROP FUNCTION f1;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -0,0 +1,77 @@
#
# Start of 10.2 tests
#
#
# MDEV-25243 ASAN heap-use-after-free in Item_func_sp::execute_impl upon concurrent view DDL and I_S query with view and function
#
# The originally reported non-deterministic test.
# It did not fail reliably on every run.
CREATE TABLE t (a INT);
INSERT INTO t VALUES (1),(2);
CREATE FUNCTION f(b INT) RETURNS INT RETURN 1;
CREATE VIEW v AS SELECT f(SUM(a)) FROM t;
connect con1,localhost,root,,test;
LOOP
CREATE OR REPLACE VIEW vv AS SELECT 1;
END LOOP $
connection default;
SELECT v.* FROM v JOIN INFORMATION_SCHEMA.TABLES WHERE DATA_LENGTH = -1;
f(SUM(a))
KILL CONID;
disconnect con1;
connection default;
DROP VIEW IF EXISTS vv;
DROP VIEW v;
DROP FUNCTION f;
DROP TABLE t;
# The second test version from the MDEV.
# It failed more reliably, but still was not deterministic.
CREATE FUNCTION f() RETURNS INT RETURN 1;
CREATE VIEW v AS SELECT f() FROM seq_1_to_10;
SELECT * FROM INFORMATION_SCHEMA.TABLES, v;;
connect con1,localhost,root,,;
CREATE VIEW v2 AS SELECT 1;
connection default;
disconnect con1;
DROP VIEW v;
DROP VIEW v2;
DROP FUNCTION f;
# The third test version from the MDEV.
# It failed reliably, and should be deterninistic.
CREATE FUNCTION f1() RETURNS INT RETURN 1;
CREATE VIEW v01 AS SELECT f1();
CREATE VIEW v02 AS SELECT f1();
connect con1,localhost,root,,;
SELECT GET_LOCK('v01',30);
GET_LOCK('v01',30)
1
SELECT GET_LOCK('v02',30);
GET_LOCK('v02',30)
1
connection default;
SELECT * FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA='test'
AND TABLE_NAME LIKE 'v0%'
AND GET_LOCK(TABLE_NAME,30)
AND RELEASE_LOCK(TABLE_NAME)
AND f1()=1
ORDER BY TABLE_NAME;
connection con1;
SELECT RELEASE_LOCK('v01') /* Let the first row evaluate f1 */;
RELEASE_LOCK('v01')
1
CREATE FUNCTION f2() RETURNS INT RETURN 1 /* Invalidate SP cache*/;
SELECT RELEASE_LOCK('v02') /* Let the second row evaluate f1() */;
RELEASE_LOCK('v02')
1
DROP FUNCTION f2;
disconnect con1;
connection default;
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME TABLE_TYPE ENGINE VERSION ROW_FORMAT TABLE_ROWS AVG_ROW_LENGTH DATA_LENGTH MAX_DATA_LENGTH INDEX_LENGTH DATA_FREE AUTO_INCREMENT CREATE_TIME UPDATE_TIME CHECK_TIME TABLE_COLLATION CHECKSUM CREATE_OPTIONS TABLE_COMMENT MAX_INDEX_LENGTH TEMPORARY
def test v01 VIEW NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL VIEW NULL NULL
def test v02 VIEW NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL VIEW NULL NULL
DROP VIEW v01, v02;
DROP FUNCTION f1;
#
# End of 10.2 tests
#

View File

@ -0,0 +1,100 @@
--source include/have_sequence.inc
--echo #
--echo # Start of 10.2 tests
--echo #
--echo #
--echo # MDEV-25243 ASAN heap-use-after-free in Item_func_sp::execute_impl upon concurrent view DDL and I_S query with view and function
--echo #
--echo # The originally reported non-deterministic test.
--echo # It did not fail reliably on every run.
CREATE TABLE t (a INT);
INSERT INTO t VALUES (1),(2);
CREATE FUNCTION f(b INT) RETURNS INT RETURN 1;
CREATE VIEW v AS SELECT f(SUM(a)) FROM t;
--connect (con1,localhost,root,,test)
--let $conid= `SELECT CONNECTION_ID()`
--delimiter $
--send
LOOP
CREATE OR REPLACE VIEW vv AS SELECT 1;
END LOOP $
--delimiter ;
--connection default
# Avoid "Prepared statement needs to be re-prepared"
# Note, the code could probably eventually fixed to avoid forcing re-pepare if
# the *temporary* instance of Sp_caches (not the permanent one) was invalidated.
--disable_ps_protocol
--disable_warnings
SELECT v.* FROM v JOIN INFORMATION_SCHEMA.TABLES WHERE DATA_LENGTH = -1;
--enable_warnings
--enable_ps_protocol
# Cleanup
--replace_result $conid CONID
--eval KILL $conid
--disconnect con1
--connection default
DROP VIEW IF EXISTS vv;
DROP VIEW v;
DROP FUNCTION f;
DROP TABLE t;
--echo # The second test version from the MDEV.
--echo # It failed more reliably, but still was not deterministic.
CREATE FUNCTION f() RETURNS INT RETURN 1;
CREATE VIEW v AS SELECT f() FROM seq_1_to_10;
--send SELECT * FROM INFORMATION_SCHEMA.TABLES, v;
--connect(con1,localhost,root,,)
CREATE VIEW v2 AS SELECT 1;
--connection default
--disable_result_log
--reap
--enable_result_log
--disconnect con1
DROP VIEW v;
DROP VIEW v2;
DROP FUNCTION f;
--echo # The third test version from the MDEV.
--echo # It failed reliably, and should be deterninistic.
CREATE FUNCTION f1() RETURNS INT RETURN 1;
CREATE VIEW v01 AS SELECT f1();
CREATE VIEW v02 AS SELECT f1();
--connect(con1,localhost,root,,)
SELECT GET_LOCK('v01',30);
SELECT GET_LOCK('v02',30);
--connection default
--send
SELECT * FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA='test'
AND TABLE_NAME LIKE 'v0%'
AND GET_LOCK(TABLE_NAME,30)
AND RELEASE_LOCK(TABLE_NAME)
AND f1()=1
ORDER BY TABLE_NAME;
--connection con1
SELECT RELEASE_LOCK('v01') /* Let the first row evaluate f1 */;
CREATE FUNCTION f2() RETURNS INT RETURN 1 /* Invalidate SP cache*/;
SELECT RELEASE_LOCK('v02') /* Let the second row evaluate f1() */;
DROP FUNCTION f2;
--disconnect con1
--connection default
--reap
DROP VIEW v01, v02;
DROP FUNCTION f1;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -149,6 +149,29 @@ ALTER TABLE time_zone_transition_type ENGINE=MyISAM;
END IF|
\d ;
#
# MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases
#
#
# Testing --skip-write-binlog
#
set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION WSREP_ON=OFF', 'do 0');
SET SESSION SQL_LOG_BIN=0;
execute immediate @prep1;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id);
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
(@time_zone_id, 0, 0, 0, 'GMT')
;
set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION WSREP_ON=OFF', 'do 0');
SET SESSION SQL_LOG_BIN=0;
execute immediate @prep1;
TRUNCATE TABLE time_zone_leap_second;
ALTER TABLE time_zone_leap_second ORDER BY Transition_time;
#
# End of 10.2 tests
#
#
# MDEV-6236 - [PATCH] mysql_tzinfo_to_sql may produce invalid SQL
#
\d |

View File

@ -32,6 +32,23 @@
--exec $MYSQL_TZINFO_TO_SQL --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1
--echo #
--echo # MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases
--echo #
--echo #
--echo # Testing --skip-write-binlog
--echo #
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>&1
--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1
--echo #
--echo # End of 10.2 tests
--echo #
#
# Cleanup
#

View File

@ -3508,6 +3508,26 @@ DELETE FROM t1 ORDER BY c;
DROP TABLE t1;
SET @@SESSION.max_sort_length=DEFAULT;
SET sql_mode=DEFAULT;
#
# MDEV-25994 Crash with union of my_decimal type in ORDER BY clause
#
CREATE TABLE t1 (v1 INTEGER) ;
INSERT INTO t1 (v1) VALUES (8);
UPDATE t1 SET v1 = 1 ORDER BY (SELECT 1.1 UNION SELECT -1);
ERROR 21000: Subquery returns more than 1 row
# This one must be successful
UPDATE t1 SET v1 = 2 ORDER BY (SELECT 1 UNION SELECT 1);
UPDATE t1 SET v1 = 3 ORDER BY (SELECT 'a' UNION SELECT 'b');
ERROR 21000: Subquery returns more than 1 row
# Insert some more data
INSERT INTO t1 (v1) VALUES (8),(9),(100),(-234),(46584),(0);
UPDATE t1 SET v1 = v1+1 ORDER BY (SELECT 100.122 UNION SELECT -189.2);
ERROR 21000: Subquery returns more than 1 row
# This one must be successful
UPDATE t1 SET v1 = v1-200 ORDER BY (SELECT 1 UNION SELECT 1);
UPDATE t1 SET v1 = v1 ORDER BY (SELECT 'abc' UNION SELECT 'bbb');
ERROR 21000: Subquery returns more than 1 row
DROP TABLE t1;
# End of 10.2 tests
#
# MDEV-16214: Incorrect plan taken by the optimizer , uses INDEX instead of ref access with ORDER BY

View File

@ -2331,6 +2331,31 @@ DROP TABLE t1;
SET @@SESSION.max_sort_length=DEFAULT;
SET sql_mode=DEFAULT;
--echo #
--echo # MDEV-25994 Crash with union of my_decimal type in ORDER BY clause
--echo #
CREATE TABLE t1 (v1 INTEGER) ;
INSERT INTO t1 (v1) VALUES (8);
--error ER_SUBQUERY_NO_1_ROW
UPDATE t1 SET v1 = 1 ORDER BY (SELECT 1.1 UNION SELECT -1);
--echo # This one must be successful
UPDATE t1 SET v1 = 2 ORDER BY (SELECT 1 UNION SELECT 1);
--error ER_SUBQUERY_NO_1_ROW
UPDATE t1 SET v1 = 3 ORDER BY (SELECT 'a' UNION SELECT 'b');
-- echo # Insert some more data
INSERT INTO t1 (v1) VALUES (8),(9),(100),(-234),(46584),(0);
--error ER_SUBQUERY_NO_1_ROW
UPDATE t1 SET v1 = v1+1 ORDER BY (SELECT 100.122 UNION SELECT -189.2);
--echo # This one must be successful
UPDATE t1 SET v1 = v1-200 ORDER BY (SELECT 1 UNION SELECT 1);
--error ER_SUBQUERY_NO_1_ROW
UPDATE t1 SET v1 = v1 ORDER BY (SELECT 'abc' UNION SELECT 'bbb');
DROP TABLE t1;
--echo # End of 10.2 tests

View File

@ -1360,6 +1360,48 @@ SELECT tmp 1.e.test FROM scientific_notation AS tmp;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '1.e.test FROM scientific_notation AS tmp' at line 1
DROP TABLE scientific_notation;
#
# MDEV-6899 extra semicolon in show create event syntax
#
set timestamp=unix_timestamp('2020-10-10 5:5:5');
create table t1 (a int);
create trigger a before insert on t1 for each row set @a:=1;select 2$
2
2
show create trigger a;
Trigger a
sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
SQL Original Statement CREATE DEFINER=`root`@`localhost` trigger a before insert on t1 for each row set @a:=1
character_set_client latin1
collation_connection latin1_swedish_ci
Database Collation latin1_swedish_ci
Created 2020-10-10 05:05:05.00
drop table t1;
create procedure a() select 1;select 2$
2
2
show create procedure a;
Procedure a
sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Create Procedure CREATE DEFINER=`root`@`localhost` PROCEDURE `a`()
select 1
character_set_client latin1
collation_connection latin1_swedish_ci
Database Collation latin1_swedish_ci
drop procedure a;
create function a() returns int return 1;select 2$
2
2
show create function a;
Function a
sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
Create Function CREATE DEFINER=`root`@`localhost` FUNCTION `a`() RETURNS int(11)
return 1
character_set_client latin1
collation_connection latin1_swedish_ci
Database Collation latin1_swedish_ci
drop function a;
set timestamp=default;
#
# End of 10.2 tests
#
#

View File

@ -1399,6 +1399,30 @@ SELECT tmp 1.e.test FROM scientific_notation AS tmp;
DROP TABLE scientific_notation;
--echo #
--echo # MDEV-6899 extra semicolon in show create event syntax
--echo #
set timestamp=unix_timestamp('2020-10-10 5:5:5');
create table t1 (a int);
delimiter $;
create trigger a before insert on t1 for each row set @a:=1;select 2$
delimiter ;$
query_vertical show create trigger a;
drop table t1;
delimiter $;
create procedure a() select 1;select 2$
delimiter ;$
query_vertical show create procedure a;
drop procedure a;
delimiter $;
create function a() returns int return 1;select 2$
delimiter ;$
query_vertical show create function a;
drop function a;
set timestamp=default;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -102,3 +102,23 @@ ROLLBACK AND NO CHAIN NO RELEASE;
#
# End of 5.5 tests
#
#
# MDEV-6899 extra semicolon in show create event syntax
#
set timestamp=unix_timestamp('2020-10-10 5:5:5');
create event a on schedule every 1 day do set @a:=1;select 2$
2
2
show create event a;
Event a
sql_mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
time_zone SYSTEM
Create Event CREATE DEFINER=`root`@`localhost` EVENT `a` ON SCHEDULE EVERY 1 DAY STARTS '2020-10-10 05:05:05' ON COMPLETION NOT PRESERVE ENABLE DO set @a:=1
character_set_client latin1
collation_connection latin1_swedish_ci
Database Collation latin1_swedish_ci
drop event a;
set timestamp=default;
#
# End of 10.2 tests
#

View File

@ -99,3 +99,18 @@ ROLLBACK AND NO CHAIN NO RELEASE;
--echo #
--echo # End of 5.5 tests
--echo #
--echo #
--echo # MDEV-6899 extra semicolon in show create event syntax
--echo #
set timestamp=unix_timestamp('2020-10-10 5:5:5');
delimiter $;
create event a on schedule every 1 day do set @a:=1;select 2$
delimiter ;$
query_vertical show create event a;
drop event a;
set timestamp=default;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -1,4 +1,3 @@
drop table if exists t1;
create table t1 (a int null, v varchar(100)) engine=myisam checksum=0;
insert into t1 values(null, null), (1, "hello");
checksum table t1;
@ -98,4 +97,48 @@ CHECKSUM TABLE t1 EXTENDED;
Table Checksum
test.t1 2326430205
drop table t1;
#
# End of 5.5 tests
#
#
# MDEV-28020 CHECKSUM TABLE calculates different checksums
#
create table t1 ( a int, b int as (a) virtual, c text) engine=myisam checksum=1;
insert ignore t1 values (1,2,'foo'),(2,3,'bar');
Warnings:
Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
checksum table t1 extended;
Table Checksum
test.t1 4101438232
checksum table t1;
Table Checksum
test.t1 4101438232
drop table t1;
create table t1 ( a int, b int as (a) virtual, c text, key(b)) engine=myisam checksum=1;
insert ignore t1 values (1,2,'foo'),(2,3,'bar');
Warnings:
Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
checksum table t1 extended;
Table Checksum
test.t1 4101438232
checksum table t1;
Table Checksum
test.t1 4101438232
drop table t1;
create table t1 ( a int, b int as (a) stored, c text) engine=myisam checksum=1;
insert ignore t1 values (1,2,'foo'),(2,3,'bar');
Warnings:
Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
checksum table t1 extended;
Table Checksum
test.t1 2897795735
checksum table t1;
Table Checksum
test.t1 2897795735
drop table t1;
#
# End of 10.2 tests
#

View File

@ -1,4 +1,3 @@
drop table if exists t1;
create table t1 (a int null, v varchar(100)) engine=myisam checksum=0;
insert into t1 values(null, null), (1, "hello");
checksum table t1;
@ -98,4 +97,48 @@ CHECKSUM TABLE t1 EXTENDED;
Table Checksum
test.t1 2326430205
drop table t1;
#
# End of 5.5 tests
#
#
# MDEV-28020 CHECKSUM TABLE calculates different checksums
#
create table t1 ( a int, b int as (a) virtual, c text) engine=myisam checksum=1;
insert ignore t1 values (1,2,'foo'),(2,3,'bar');
Warnings:
Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
checksum table t1 extended;
Table Checksum
test.t1 4101438232
checksum table t1;
Table Checksum
test.t1 4101438232
drop table t1;
create table t1 ( a int, b int as (a) virtual, c text, key(b)) engine=myisam checksum=1;
insert ignore t1 values (1,2,'foo'),(2,3,'bar');
Warnings:
Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
checksum table t1 extended;
Table Checksum
test.t1 4101438232
checksum table t1;
Table Checksum
test.t1 4101438232
drop table t1;
create table t1 ( a int, b int as (a) stored, c text) engine=myisam checksum=1;
insert ignore t1 values (1,2,'foo'),(2,3,'bar');
Warnings:
Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
Warning 1906 The value specified for generated column 'b' in table 't1' has been ignored
checksum table t1 extended;
Table Checksum
test.t1 2897795735
checksum table t1;
Table Checksum
test.t1 2897795735
drop table t1;
#
# End of 10.2 tests
#

View File

@ -2,12 +2,8 @@
# Test checksum
#
-- source include/have_innodb.inc
-- source include/have_maria.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
--source include/have_innodb.inc
--source include/have_maria.inc
create table t1 (a int null, v varchar(100)) engine=myisam checksum=0;
insert into t1 values(null, null), (1, "hello");
@ -76,4 +72,31 @@ CHECKSUM TABLE t1 EXTENDED;
drop table t1;
--echo #
--echo # End of 5.5 tests
--echo #
--echo #
--echo # MDEV-28020 CHECKSUM TABLE calculates different checksums
--echo #
create table t1 ( a int, b int as (a) virtual, c text) engine=myisam checksum=1;
insert ignore t1 values (1,2,'foo'),(2,3,'bar');
checksum table t1 extended;
checksum table t1;
drop table t1;
create table t1 ( a int, b int as (a) virtual, c text, key(b)) engine=myisam checksum=1;
insert ignore t1 values (1,2,'foo'),(2,3,'bar');
checksum table t1 extended;
checksum table t1;
drop table t1;
create table t1 ( a int, b int as (a) stored, c text) engine=myisam checksum=1;
insert ignore t1 values (1,2,'foo'),(2,3,'bar');
checksum table t1 extended;
checksum table t1;
drop table t1;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -1260,7 +1260,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(3) NOT NULL
`a` int(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int);

View File

@ -2905,5 +2905,80 @@ id select_type table type possible_keys key key_len ref rows Extra
2 DEPENDENT SUBQUERY tn eq_ref PRIMARY PRIMARY 32 test.tms.key1 1 Using where
set optimizer_switch=@tmp_os;
drop table t1, t10, t11;
#
# MDEV-28268: Server crashes in Expression_cache_tracker::fetch_current_stats
#
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,2),(3,4);
ANALYZE FORMAT=JSON
SELECT DISTINCT
(SELECT MIN(a) FROM t1 WHERE b <= ANY (SELECT a FROM t1)) AS f
FROM t1;
ANALYZE
{
"query_block": {
"select_id": 1,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"duplicate_removal": {
"temporary_table": {
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100
},
"subqueries": [
{
"expression_cache": {
"state": "disabled",
"r_loops": 0,
"query_block": {
"select_id": 2,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 50,
"attached_condition": "<nop>(<in_optimizer>(t1.b,(subquery#3) >= 4))"
},
"subqueries": [
{
"query_block": {
"select_id": 3,
"r_loops": 1,
"r_total_time_ms": "REPLACED",
"table": {
"table_name": "t1",
"access_type": "ALL",
"r_loops": 1,
"rows": 2,
"r_rows": 2,
"r_total_time_ms": "REPLACED",
"filtered": 100,
"r_filtered": 100
}
}
}
]
}
}
}
]
}
}
}
}
DROP TABLE t1;
# End of 10.2 tests
# End of 10.3 tests

View File

@ -2421,6 +2421,21 @@ set optimizer_switch=@tmp_os;
drop table t1, t10, t11;
--echo #
--echo # MDEV-28268: Server crashes in Expression_cache_tracker::fetch_current_stats
--echo #
CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,2),(3,4);
--source include/analyze-format.inc
ANALYZE FORMAT=JSON
SELECT DISTINCT
(SELECT MIN(a) FROM t1 WHERE b <= ANY (SELECT a FROM t1)) AS f
FROM t1;
# Cleanup
DROP TABLE t1;
--echo # End of 10.2 tests
--echo # End of 10.3 tests

View File

@ -629,3 +629,35 @@ a b
2019-03-10 02:55:05 2019-03-10 02:55:05
DROP TABLE t1,t2;
set character_set_connection=@save_character_set_connection;
#
# MDEV-26047: MariaDB server crash at Item_subselect::init_expr_cache_tracker
#
CREATE TABLE t1 (a int) engine=innodb;
SELECT 1 IN (
SELECT NULL
FROM t1
WHERE
a IS NOT NULL
GROUP BY
(SELECT NULL from dual WHERE a = 1)
);
1 IN (
SELECT NULL
FROM t1
WHERE
a IS NOT NULL
GROUP BY
(SELECT NULL from dual WHERE a = 1)
)
0
drop table t1;
# Testcase from MDEV-26164
create table t1(a int);
# Disable the warning as it includes current time and changes for every test run.
select 1 from t1 where not exists
(
select 1 from t1 where binary current_time()
group by (select a),(select 1)
);
1
drop table t1;

View File

@ -627,3 +627,31 @@ SELECT * FROM t1 WHERE (SELECT 1,CONCAT(a) FROM t1) = (SELECT 1,CONCAT(a) FROM t
DROP TABLE t1,t2;
set character_set_connection=@save_character_set_connection;
--echo #
--echo # MDEV-26047: MariaDB server crash at Item_subselect::init_expr_cache_tracker
--echo #
CREATE TABLE t1 (a int) engine=innodb;
SELECT 1 IN (
SELECT NULL
FROM t1
WHERE
a IS NOT NULL
GROUP BY
(SELECT NULL from dual WHERE a = 1)
);
drop table t1;
--echo # Testcase from MDEV-26164
create table t1(a int);
--echo # Disable the warning as it includes current time and changes for every test run.
--disable_warnings
select 1 from t1 where not exists
(
select 1 from t1 where binary current_time()
group by (select a),(select 1)
);
--enable_warnings
drop table t1;

View File

@ -1264,7 +1264,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(3) NOT NULL
`a` int(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int);

View File

@ -1267,7 +1267,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(3) NOT NULL
`a` int(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int);

View File

@ -1263,7 +1263,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(3) NOT NULL
`a` int(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int);

View File

@ -1266,7 +1266,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(3) NOT NULL
`a` int(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int);

View File

@ -1263,7 +1263,7 @@ a
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(3) NOT NULL
`a` int(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 (a int);

View File

@ -2456,5 +2456,29 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
#
# MDEV-25317 Assertion `scale <= precision' failed in
# decimal_bin_size And Assertion `scale >= 0 && precision > 0 && scale <= precision'
# failed in decimal_bin_size_inline/decimal_bin_size.
#
SELECT AVG(DISTINCT 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001);
AVG(DISTINCT 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0.00000000000000000000000000000000000000
CREATE TABLE t1 AS SELECT NULL AS v1;
SELECT 1 FROM t1 GROUP BY v1 ORDER BY AVG ( from_unixtime ( '' ) ) ;
1
1
Warnings:
Warning 1292 Truncated incorrect DECIMAL value: ''
DROP TABLE t1;
SELECT SUM(DISTINCT 0.000000000000000000000000000000000000001);
SUM(DISTINCT 0.000000000000000000000000000000000000001)
0.00000000000000000000000000000000000000
CREATE TABLE t1 AS SELECT 1.000000000000000000000000000000000 AS a;
ALTER TABLE t1 ADD COLUMN b INT;
SELECT ROUND (a,b) AS c FROM t1 ORDER BY c;
c
NULL
DROP TABLE t1;
#
# End of 10.2 tests
#

View File

@ -1894,6 +1894,25 @@ show create table t1;
drop table t1;
--echo #
--echo # MDEV-25317 Assertion `scale <= precision' failed in
--echo # decimal_bin_size And Assertion `scale >= 0 && precision > 0 && scale <= precision'
--echo # failed in decimal_bin_size_inline/decimal_bin_size.
--echo #
SELECT AVG(DISTINCT 0.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001);
CREATE TABLE t1 AS SELECT NULL AS v1;
SELECT 1 FROM t1 GROUP BY v1 ORDER BY AVG ( from_unixtime ( '' ) ) ;
DROP TABLE t1;
SELECT SUM(DISTINCT 0.000000000000000000000000000000000000001);
CREATE TABLE t1 AS SELECT 1.000000000000000000000000000000000 AS a;
ALTER TABLE t1 ADD COLUMN b INT;
SELECT ROUND (a,b) AS c FROM t1 ORDER BY c;
DROP TABLE t1;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -1379,6 +1379,7 @@ include/stop_slave.inc
SET GLOBAL slave_parallel_threads=1;
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000";
CALL mtr.add_suppression("Unexpected break of being relay-logged GTID");
connection server_1;
INSERT INTO t2 VALUES (101);
INSERT INTO t2 VALUES (102);

View File

@ -23,6 +23,8 @@ t
Master_SSL_Allowed = 'Yes'
Master_SSL_CA_Path = ''
Master_SSL_CA_File = 'MYSQL_TEST_DIR/std_data/cacert.pem'
Master_SSL_Crl = ''
Master_SSL_Crlpath = ''
Master_SSL_Cert = 'MYSQL_TEST_DIR/std_data/client-cert.pem'
Master_SSL_Key = 'MYSQL_TEST_DIR/std_data/client-key.pem'
include/check_slave_is_running.inc
@ -37,6 +39,8 @@ include/wait_for_slave_to_start.inc
Master_SSL_Allowed = 'Yes'
Master_SSL_CA_Path = ''
Master_SSL_CA_File = 'MYSQL_TEST_DIR/std_data/cacert.pem'
Master_SSL_Crl = ''
Master_SSL_Crlpath = ''
Master_SSL_Cert = 'MYSQL_TEST_DIR/std_data/client-cert.pem'
Master_SSL_Key = 'MYSQL_TEST_DIR/std_data/client-key.pem'
include/check_slave_is_running.inc

View File

@ -0,0 +1,152 @@
#
# MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases
#
# On node_1
connection node_1;
CREATE TABLE time_zone LIKE mysql.time_zone;
CREATE TABLE time_zone_name LIKE mysql.time_zone_name;
CREATE TABLE time_zone_transition LIKE mysql.time_zone_transition;
CREATE TABLE time_zone_transition_type LIKE mysql.time_zone_transition_type;
CREATE TABLE time_zone_leap_second LIKE mysql.time_zone_leap_second;
#
# Run on zoneinfo directory --skip-write-binlog
#
# Apply on node_1
load timezones
'binlog stationary as expected'
SELECT COUNT(*) FROM time_zone;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_name;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_transition;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_transition_type;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_leap_second;
COUNT(*)
0
# On node_2 (not replicated)
connection node_2;
SELECT COUNT(*) FROM time_zone;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_name;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_transition;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_transition_type;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_leap_second;
COUNT(*)
0
#
# Run on zoneinfo directory without --skip-write-binlog
#
# Apply on node_1
connection node_1;
load timezones
'binlog advanced as expected'
SELECT COUNT(*) FROM time_zone;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_name;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_transition;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_transition_type;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_leap_second;
COUNT(*)
0
# On node_2 (replicated via InnoDB)
connection node_2;
SELECT COUNT(*) FROM time_zone;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_name;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_transition;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_transition_type;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_leap_second;
COUNT(*)
0
TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
TRUNCATE TABLE time_zone_leap_second;
# Apply on node_1 (with wsrep_on=OFF)
connection node_1;
SET GLOBAL WSREP_ON=OFF;
load timezones
SET GLOBAL WSREP_ON=ON;
'binlog advanced as expected'
SELECT COUNT(*) FROM time_zone;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_name;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_transition;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_transition_type;
COUNT(*)
2
SELECT COUNT(*) FROM time_zone_leap_second;
COUNT(*)
0
# On node_2 (Should not have been replicated)
connection node_2;
SELECT COUNT(*) FROM time_zone;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_name;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_transition;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_transition_type;
COUNT(*)
0
SELECT COUNT(*) FROM time_zone_leap_second;
COUNT(*)
0
connection node_1;
DROP TABLE time_zone;
DROP TABLE time_zone_name;
DROP TABLE time_zone_transition;
DROP TABLE time_zone_transition_type;
DROP TABLE time_zone_leap_second;
#
# End of 10.2 tests
#

View File

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

View File

@ -0,0 +1,156 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/not_embedded.inc
# merge note: 10.6 change not_embedded.inc to no_protocol.inc
# Unlike the similar galera.mariadb_tzinfo_to_sql.test in 10.6+, this
# tests that the output can be parsed by the mysql client.
--echo #
--echo # MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases
--echo #
--exec mkdir $MYSQLTEST_VARDIR/zoneinfo
--exec ln -s $MYSQLTEST_VARDIR/zoneinfo $MYSQLTEST_VARDIR/zoneinfo/posix
--copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/GMT
--echo
--echo # On node_1
--connection node_1
CREATE TABLE time_zone LIKE mysql.time_zone;
CREATE TABLE time_zone_name LIKE mysql.time_zone_name;
CREATE TABLE time_zone_transition LIKE mysql.time_zone_transition;
CREATE TABLE time_zone_transition_type LIKE mysql.time_zone_transition_type;
CREATE TABLE time_zone_leap_second LIKE mysql.time_zone_leap_second;
--echo #
--echo # Run on zoneinfo directory --skip-write-binlog
--echo #
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo 2>/dev/null > $MYSQL_TMP_DIR/tz.sql
--echo
--echo # Apply on node_1
--echo
--let $snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
--echo load timezones
--exec $MYSQL test < "$MYSQL_TMP_DIR/tz.sql"
--let $new_snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
if ($snap_pos == $new_snap_pos)
{
--echo 'binlog stationary as expected'
}
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
--echo
--echo # On node_2 (not replicated)
--echo
--connection node_2
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
--echo #
--echo # Run on zoneinfo directory without --skip-write-binlog
--echo #
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>/dev/null > $MYSQL_TMP_DIR/tz.sql
--echo
--echo # Apply on node_1
--echo
--connection node_1
--echo load timezones
--exec $MYSQL test < "$MYSQL_TMP_DIR/tz.sql"
--let $new_snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
if ($snap_pos < $new_snap_pos)
{
--echo 'binlog advanced as expected'
}
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
--echo
--echo # On node_2 (replicated via InnoDB)
--echo
--connection node_2
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
TRUNCATE TABLE time_zone_leap_second;
--echo
--echo # Apply on node_1 (with wsrep_on=OFF)
--echo
--connection node_1
SET GLOBAL WSREP_ON=OFF;
--let $snap_pos= $new_snap_pos
--echo load timezones
--exec $MYSQL test < "$MYSQL_TMP_DIR/tz.sql"
--let $new_snap_pos= query_get_value(SHOW STATUS LIKE 'binlog_snapshot_position', Value, 1)
SET GLOBAL WSREP_ON=ON;
if ($snap_pos < $new_snap_pos)
{
--echo 'binlog advanced as expected'
}
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
--echo
--echo # On node_2 (Should not have been replicated)
--echo
--connection node_2
SELECT COUNT(*) FROM time_zone;
SELECT COUNT(*) FROM time_zone_name;
SELECT COUNT(*) FROM time_zone_transition;
SELECT COUNT(*) FROM time_zone_transition_type;
SELECT COUNT(*) FROM time_zone_leap_second;
#
# Cleanup
#
--connection node_1
--remove_file $MYSQL_TMP_DIR/tz.sql
--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo
DROP TABLE time_zone;
DROP TABLE time_zone_name;
DROP TABLE time_zone_transition;
DROP TABLE time_zone_transition_type;
DROP TABLE time_zone_leap_second;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -1845,3 +1845,19 @@ a b
HANDLER t1 CLOSE;
DROP TABLE t1;
End of 5.1 tests
#
# 10.2 Test
#
# MDEV-20207: Assertion `! is_set()' failed in
# Diagnostics_area::set_eof_status upon HANDLER READ
#
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 'test.t1'
CREATE TABLE t1 (a POINT, KEY(a));
HANDLER t1 OPEN h;
HANDLER h READ a = (0);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
HANDLER h CLOSE;
DROP TABLE t1;
# End of 10.2 Test

View File

@ -80,3 +80,23 @@ HANDLER t1 CLOSE;
DROP TABLE t1;
--echo End of 5.1 tests
--echo #
--echo # 10.2 Test
--echo #
--echo # MDEV-20207: Assertion `! is_set()' failed in
--echo # Diagnostics_area::set_eof_status upon HANDLER READ
--echo #
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a POINT, KEY(a));
HANDLER t1 OPEN h;
--error ER_CANT_CREATE_GEOMETRY_OBJECT
HANDLER h READ a = (0);
HANDLER h CLOSE;
DROP TABLE t1;
--echo # End of 10.2 Test

View File

@ -1748,3 +1748,19 @@ HANDLER t1 READ `PRIMARY` PREV;
f1 f2
3 3
DROP TABLE t1;
#
# 10.2 Test
#
# MDEV-20207: Assertion `! is_set()' failed in
# Diagnostics_area::set_eof_status upon HANDLER READ
#
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 'test.t1'
CREATE TABLE t1 (a POINT, KEY(a));
HANDLER t1 OPEN h;
HANDLER h READ a = (0);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
HANDLER h CLOSE;
DROP TABLE t1;
# End of 10.2 Test

View File

@ -26,3 +26,23 @@ HANDLER t1 OPEN;
HANDLER t1 READ FIRST WHERE f2 <= 1;
HANDLER t1 READ `PRIMARY` PREV;
DROP TABLE t1;
--echo #
--echo # 10.2 Test
--echo #
--echo # MDEV-20207: Assertion `! is_set()' failed in
--echo # Diagnostics_area::set_eof_status upon HANDLER READ
--echo #
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a POINT, KEY(a));
HANDLER t1 OPEN h;
--error ER_CANT_CREATE_GEOMETRY_OBJECT
HANDLER h READ a = (0);
HANDLER h CLOSE;
DROP TABLE t1;
--echo # End of 10.2 Test

View File

@ -313,6 +313,22 @@ handler v read next;
ERROR 42S02: Unknown table 'v' in HANDLER
drop view v;
#
# 10.2 Test
#
# MDEV-20207: Assertion `! is_set()' failed in
# Diagnostics_area::set_eof_status upon HANDLER READ
#
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 'test.t1'
CREATE TABLE t1 (a POINT, KEY(a));
HANDLER t1 OPEN h;
HANDLER h READ a = (0);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
HANDLER h CLOSE;
DROP TABLE t1;
# End of 10.2 Test
#
# MDEV-15813 ASAN use-after-poison in hp_hashnr upon
# HANDLER READ on a versioned HEAP table
#

View File

@ -355,6 +355,26 @@ execute stmt;
handler v read next;
drop view v;
--echo #
--echo # 10.2 Test
--echo #
--echo # MDEV-20207: Assertion `! is_set()' failed in
--echo # Diagnostics_area::set_eof_status upon HANDLER READ
--echo #
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a POINT, KEY(a));
HANDLER t1 OPEN h;
--error ER_CANT_CREATE_GEOMETRY_OBJECT
HANDLER h READ a = (0);
HANDLER h CLOSE;
DROP TABLE t1;
--echo # End of 10.2 Test
--echo #
--echo # MDEV-15813 ASAN use-after-poison in hp_hashnr upon
--echo # HANDLER READ on a versioned HEAP table

View File

@ -1931,3 +1931,17 @@ test.t1 preload_keys status OK
HANDLER t1 READ FIRST;
ERROR 42S02: Unknown table 't1' in HANDLER
End of 5.1 tests
#
# 10.2 Test
#
# MDEV-20207: Assertion `! is_set()' failed in
# Diagnostics_area::set_eof_status upon HANDLER READ
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a POINT, KEY(a));
HANDLER t1 OPEN h;
HANDLER h READ a = (0);
ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
HANDLER h CLOSE;
DROP TABLE t1;
# End of 10.2 Test

View File

@ -169,3 +169,23 @@ HANDLER t1 READ FIRST;
--echo End of 5.1 tests
--echo #
--echo # 10.2 Test
--echo #
--echo # MDEV-20207: Assertion `! is_set()' failed in
--echo # Diagnostics_area::set_eof_status upon HANDLER READ
--echo #
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a POINT, KEY(a));
HANDLER t1 OPEN h;
--error ER_CANT_CREATE_GEOMETRY_OBJECT
HANDLER h READ a = (0);
HANDLER h CLOSE;
DROP TABLE t1;
--echo # End of 10.2 Test

View File

@ -0,0 +1,34 @@
#
# MDEV-28416 Incorrect AUTO_INCREMENT may be issued
#
SET @aii=@@auto_increment_increment;
SET auto_increment_increment=300;
CREATE TABLE t1 (a SERIAL) ENGINE=innodb
PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (6),
PARTITION p1 VALUES LESS THAN MAXVALUE
);
INSERT INTO t1 VALUES (18446744073709551613);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
UNIQUE KEY `a` (`a`)
) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551614 DEFAULT CHARSET=latin1
PARTITION BY RANGE (`a`)
(PARTITION `p0` VALUES LESS THAN (6) ENGINE = InnoDB,
PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
INSERT INTO t1 VALUES (NULL);
ERROR 22003: Out of range value for column 'a' at row 1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
UNIQUE KEY `a` (`a`)
) ENGINE=InnoDB AUTO_INCREMENT=298 DEFAULT CHARSET=latin1
PARTITION BY RANGE (`a`)
(PARTITION `p0` VALUES LESS THAN (6) ENGINE = InnoDB,
PARTITION `p1` VALUES LESS THAN MAXVALUE ENGINE = InnoDB)
DROP TABLE t1;
SET auto_increment_increment=@aii;
# End of 10.2 tests

View File

@ -1,4 +1,3 @@
drop table if exists t1;
CREATE TABLE t1 (c1 BIGINT PRIMARY KEY AUTO_INCREMENT, c2 VARCHAR(10)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (9223372036854775807, null);
INSERT INTO t1 (c2) VALUES ('innodb');
@ -1619,3 +1618,27 @@ id name
-1 dog
2 cat
DROP PROCEDURE autoinc_mdev15353_one;
#
# MDEV-28416 Incorrect AUTO_INCREMENT may be issued
#
SET @aii=@@auto_increment_increment;
SET auto_increment_increment=300;
CREATE TABLE t1 (a SERIAL) ENGINE=innodb;
INSERT INTO t1 VALUES (18446744073709551613);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
UNIQUE KEY `a` (`a`)
) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551614 DEFAULT CHARSET=latin1
INSERT INTO t1 VALUES (NULL);
ERROR 22003: Out of range value for column 'a' at row 1
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
UNIQUE KEY `a` (`a`)
) ENGINE=InnoDB AUTO_INCREMENT=18446744073709551615 DEFAULT CHARSET=latin1
DROP TABLE t1;
SET auto_increment_increment=@aii;
# End of 10.2 tests

View File

@ -0,0 +1,24 @@
--source include/have_partition.inc
--source include/have_innodb.inc
--echo #
--echo # MDEV-28416 Incorrect AUTO_INCREMENT may be issued
--echo #
SET @aii=@@auto_increment_increment;
SET auto_increment_increment=300;
CREATE TABLE t1 (a SERIAL) ENGINE=innodb
PARTITION BY RANGE (a) (
PARTITION p0 VALUES LESS THAN (6),
PARTITION p1 VALUES LESS THAN MAXVALUE
);
INSERT INTO t1 VALUES (18446744073709551613);
SHOW CREATE TABLE t1;
--error HA_ERR_AUTOINC_ERANGE
INSERT INTO t1 VALUES (NULL);
SHOW CREATE TABLE t1;
DROP TABLE t1;
SET auto_increment_increment=@aii;
--echo # End of 10.2 tests

View File

@ -1,10 +1,4 @@
--source include/have_innodb.inc
# embedded server ignores 'delayed', so skip this
-- source include/not_embedded.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
#
# Bug #34335
@ -770,3 +764,20 @@ DROP TABLE t1;
SET @engine='INNODB';
--source include/autoinc_mdev15353.inc
--echo #
--echo # MDEV-28416 Incorrect AUTO_INCREMENT may be issued
--echo #
SET @aii=@@auto_increment_increment;
SET auto_increment_increment=300;
CREATE TABLE t1 (a SERIAL) ENGINE=innodb;
INSERT INTO t1 VALUES (18446744073709551613);
SHOW CREATE TABLE t1;
--error HA_ERR_AUTOINC_ERANGE
INSERT INTO t1 VALUES (NULL);
SHOW CREATE TABLE t1;
DROP TABLE t1;
SET auto_increment_increment=@aii;
--echo # End of 10.2 tests

View File

@ -0,0 +1,14 @@
--disable_query_log
--file_exists $targetdir/xtrabackup_slave_info
CREATE TEMPORARY TABLE tmp_slave_info(lineno SERIAL, line TEXT);
--replace_result $targetdir TARGETDIR
--eval LOAD DATA LOCAL INFILE '$targetdir/xtrabackup_slave_info' INTO TABLE tmp_slave_info (line);
SELECT
lineno,
regexp_replace(
regexp_replace(line, '(?<=MASTER_LOG_POS=)[0-9]+', '<NUM>'),
'[0-9]+-[0-9]+-[0-9]+', '<NUM-NUM-NUM>')
AS line
FROM tmp_slave_info ORDER BY lineno;
DROP TEMPORARY TABLE tmp_slave_info;
--enable_query_log

View File

@ -0,0 +1,20 @@
--disable_query_log
--file_exists $XTRABACKUP_OUT
CREATE TEMPORARY TABLE tmp_slave_info_out(lineno SERIAL, line TEXT);
--replace_result $targetdir TARGETDIR
--eval LOAD DATA LOCAL INFILE '$XTRABACKUP_OUT' INTO TABLE tmp_slave_info_out (line);
SELECT
replace(
regexp_replace(
regexp_replace(line,
'[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9]',
'YYYY-MM-DD hh:mm:ss'),
'[0-9]+-[0-9]+-[0-9]+', '<NUM-NUM-NUM>'),
'\r','' /* Remove CR on Windows */)
AS line
FROM tmp_slave_info_out
WHERE line LIKE '%MySQL slave binlog position%'
OR line LIKE '%Failed to get master binlog coordinates%'
ORDER BY lineno;
DROP TEMPORARY TABLE tmp_slave_info_out;
--enable_query_log

View File

@ -0,0 +1,24 @@
call mtr.add_suppression("InnoDB: New log files created");
#
# Start of 10.2 tests
#
#
# MDEV-28446 mariabackup prepare fails for incrementals if a new schema is created after full backup is taken
#
CREATE TABLE t1(i INT PRIMARY KEY) ENGINE INNODB;
# Prepare full backup, apply incremental one
# shutdown server
# remove datadir
# xtrabackup move back
# restart server
SELECT COUNT(*) FROM test.t1;
COUNT(*)
0
SELECT COUNT(*) FROM test1.t1;
COUNT(*)
10000
DROP TABLE t1;
DROP DATABASE test1;
#
# End of 10.2 tests
#

View File

@ -0,0 +1,47 @@
--source include/have_innodb.inc
--source include/have_debug.inc
call mtr.add_suppression("InnoDB: New log files created");
--echo #
--echo # Start of 10.2 tests
--echo #
--echo #
--echo # MDEV-28446 mariabackup prepare fails for incrementals if a new schema is created after full backup is taken
--echo #
--let $basedir=$MYSQLTEST_VARDIR/tmp/backup
--let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1
CREATE TABLE t1(i INT PRIMARY KEY) ENGINE INNODB;
--disable_result_log
--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir
--enable_result_log
--let after_load_tablespaces=BEGIN NOT ATOMIC CREATE DATABASE test1; CREATE TABLE test1.t1 ENGINE=INNODB SELECT UUID() from test.seq_1_to_10000; END
--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir --dbug=+d,mariabackup_events,mariabackup_inject_code
--let after_load_tablespaces=
--disable_result_log
--echo # Prepare full backup, apply incremental one
--exec $XTRABACKUP --apply-log-only --prepare --target-dir=$basedir
--exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir
--enable_result_log
--let $targetdir=$basedir
--source include/restart_and_restore.inc
--enable_result_log
SELECT COUNT(*) FROM test.t1;
SELECT COUNT(*) FROM test1.t1;
DROP TABLE t1;
DROP DATABASE test1;
--rmdir $basedir
--rmdir $incremental_dir
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -13,6 +13,9 @@ connection slave;
"using_gtid: Slave_Pos"
FOUND 1 /gtid_slave_pos/ in xtrabackup_slave_info
NOT FOUND /MASTER_LOG_FILE/ in xtrabackup_slave_info
lineno line
1 SET GLOBAL gtid_slave_pos = '<NUM-NUM-NUM>';
2 CHANGE MASTER TO master_use_gtid = slave_pos;
###############
# If Using_Gtid != 'No' and !gtid_slave_pos, backup master position
########################
@ -20,6 +23,8 @@ include/stop_slave.inc
SET GLOBAL gtid_slave_pos="";
NOT FOUND /gtid_slave_pos/ in xtrabackup_slave_info
FOUND 1 /MASTER_LOG_FILE/ in xtrabackup_slave_info
lineno line
1 CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=<NUM>;
###############
# If Using_Gtid == 'No', backup Exec_Master_Log_Pos
########################
@ -31,6 +36,8 @@ connection slave;
"using_gtid: No"
NOT FOUND /gtid_slave_pos/ in xtrabackup_slave_info
FOUND 1 /MASTER_LOG_FILE/ in xtrabackup_slave_info
lineno line
1 CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=<NUM>;
connection master;
DROP TABLE t;
connection slave;

View File

@ -27,6 +27,7 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffi
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=MASTER_LOG_FILE
--source include/search_pattern_in_file.inc
--source include/show_xtrabackup_slave_info.inc
rmdir $targetdir;
@ -35,7 +36,9 @@ rmdir $targetdir;
--echo ########################
--source include/stop_slave.inc
--disable_warnings
SET GLOBAL gtid_slave_pos="";
--enable_warnings
--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup
--disable_result_log
@ -47,6 +50,7 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffi
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=MASTER_LOG_FILE
--source include/search_pattern_in_file.inc
--source include/show_xtrabackup_slave_info.inc
rmdir $targetdir;
@ -74,6 +78,7 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffi
--source include/search_pattern_in_file.inc
--let SEARCH_PATTERN=MASTER_LOG_FILE
--source include/search_pattern_in_file.inc
--source include/show_xtrabackup_slave_info.inc
rmdir $targetdir;

View File

@ -0,0 +1,59 @@
#
# Start of 10.2 tests
#
#
# MDEV-21037 mariabackup does not detect multi-source replication slave
#
SELECT @@global.gtid_slave_pos;
@@global.gtid_slave_pos
# Without any masters the file xtrabackup_slave_info is not created
line
[00] YYYY-MM-DD hh:mm:ss Failed to get master binlog coordinates from SHOW SLAVE STATUS.This means that the server is not a replication slave. Ignoring the --slave-info option
CHANGE MASTER TO MASTER_HOST='localhost', MASTER_PORT=10000;
lineno line
1 CHANGE MASTER TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
line
[00] YYYY-MM-DD hh:mm:ss MySQL slave binlog position: master '' filename '' position '0'
CHANGE MASTER 'master2' TO MASTER_HOST='localhost', MASTER_PORT=10002;
lineno line
1 CHANGE MASTER TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
2 CHANGE MASTER 'master2' TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
line
[00] YYYY-MM-DD hh:mm:ss MySQL slave binlog position: master '' filename '' position '0'; master 'master2' filename '' position '0'
SET GLOBAL gtid_slave_pos='1-1-1,2-2-2';
CHANGE MASTER 'master3' TO MASTER_HOST='localhost', MASTER_PORT=10003, MASTER_USE_GTID=slave_pos;
CHANGE MASTER 'master4' TO MASTER_HOST='localhost', MASTER_PORT=10004, MASTER_USE_GTID=no;
CHANGE MASTER 'master5' TO MASTER_HOST='localhost', MASTER_PORT=10005, MASTER_USE_GTID=slave_pos;
lineno line
1 SET GLOBAL gtid_slave_pos = '<NUM-NUM-NUM>,<NUM-NUM-NUM>';
2 CHANGE MASTER TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
3 CHANGE MASTER 'master2' TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
4 CHANGE MASTER 'master3' TO master_use_gtid = slave_pos;
5 CHANGE MASTER 'master4' TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
6 CHANGE MASTER 'master5' TO master_use_gtid = slave_pos;
line
[00] YYYY-MM-DD hh:mm:ss MySQL slave binlog position: gtid_slave_pos '<NUM-NUM-NUM>,<NUM-NUM-NUM>'; master '' filename '' position '0'; master 'master2' filename '' position '0'; master 'master3' master_use_gtid = slave_pos; master 'master4' filename '' position '0'; master 'master5' master_use_gtid = slave_pos
CHANGE MASTER TO MASTER_HOST='localhost', MASTER_PORT=10000, MASTER_USE_GTID=slave_pos;
lineno line
1 SET GLOBAL gtid_slave_pos = '<NUM-NUM-NUM>,<NUM-NUM-NUM>';
2 CHANGE MASTER TO master_use_gtid = slave_pos;
3 CHANGE MASTER 'master2' TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
4 CHANGE MASTER 'master3' TO master_use_gtid = slave_pos;
5 CHANGE MASTER 'master4' TO MASTER_LOG_FILE='', MASTER_LOG_POS=<NUM>;
6 CHANGE MASTER 'master5' TO master_use_gtid = slave_pos;
line
[00] YYYY-MM-DD hh:mm:ss MySQL slave binlog position: gtid_slave_pos '<NUM-NUM-NUM>,<NUM-NUM-NUM>'; master '' master_use_gtid = slave_pos; master 'master2' filename '' position '0'; master 'master3' master_use_gtid = slave_pos; master 'master4' filename '' position '0'; master 'master5' master_use_gtid = slave_pos
RESET SLAVE ALL;
RESET SLAVE 'master2' ALL;
RESET SLAVE 'master3' ALL;
RESET SLAVE 'master4' ALL;
RESET SLAVE 'master5' ALL;
#
# End of 10.2 tests
#

View File

@ -0,0 +1,86 @@
#
# "mariabackup --slave-info" tests that can be run without
# actually starting the replication.
#
--echo #
--echo # Start of 10.2 tests
--echo #
--echo #
--echo # MDEV-21037 mariabackup does not detect multi-source replication slave
--echo #
--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup
--let $XTRABACKUP_ARGS=--defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.2 --slave-info --backup --databases=test --target-dir=$targetdir
--let $XTRABACKUP_OUT=$MYSQLTEST_VARDIR/tmp/xtrabackup_out
# Should be empty by default
SELECT @@global.gtid_slave_pos;
--echo
--echo # Without any masters the file xtrabackup_slave_info is not created
--disable_result_log
exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT;
--enable_result_log
--error 1
--file_exists $targetdir/xtrabackup_slave_info
--source include/show_xtrabackup_slave_info_out.inc
--remove_file $XTRABACKUP_OUT
rmdir $targetdir;
--echo
CHANGE MASTER TO MASTER_HOST='localhost', MASTER_PORT=10000;
--disable_result_log
exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT;
--enable_result_log
--source include/show_xtrabackup_slave_info.inc
--source include/show_xtrabackup_slave_info_out.inc
--remove_file $XTRABACKUP_OUT
rmdir $targetdir;
--echo
CHANGE MASTER 'master2' TO MASTER_HOST='localhost', MASTER_PORT=10002;
--disable_result_log
exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT;
--enable_result_log
--source include/show_xtrabackup_slave_info.inc
--source include/show_xtrabackup_slave_info_out.inc
--remove_file $XTRABACKUP_OUT
rmdir $targetdir;
--echo
SET GLOBAL gtid_slave_pos='1-1-1,2-2-2';
CHANGE MASTER 'master3' TO MASTER_HOST='localhost', MASTER_PORT=10003, MASTER_USE_GTID=slave_pos;
CHANGE MASTER 'master4' TO MASTER_HOST='localhost', MASTER_PORT=10004, MASTER_USE_GTID=no;
CHANGE MASTER 'master5' TO MASTER_HOST='localhost', MASTER_PORT=10005, MASTER_USE_GTID=slave_pos;
--disable_result_log
exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT;
--enable_result_log
--source include/show_xtrabackup_slave_info.inc
--source include/show_xtrabackup_slave_info_out.inc
--remove_file $XTRABACKUP_OUT
rmdir $targetdir;
--echo
CHANGE MASTER TO MASTER_HOST='localhost', MASTER_PORT=10000, MASTER_USE_GTID=slave_pos;
--disable_result_log
exec $XTRABACKUP $XTRABACKUP_ARGS >$XTRABACKUP_OUT;
--enable_result_log
--source include/show_xtrabackup_slave_info.inc
--source include/show_xtrabackup_slave_info_out.inc
--remove_file $XTRABACKUP_OUT
rmdir $targetdir;
RESET SLAVE ALL;
RESET SLAVE 'master2' ALL;
RESET SLAVE 'master3' ALL;
RESET SLAVE 'master4' ALL;
RESET SLAVE 'master5' ALL;
--echo #
--echo # End of 10.2 tests
--echo #

View File

@ -1,3 +1,5 @@
--source include/have_symlink.inc
--echo #
--echo # MDEV-14641 Incompatible key or row definition between the MariaDB .frm file and the information in the storage engine
--echo #

View File

@ -1,5 +1,4 @@
--source include/have_partition.inc
--source include/have_symlink.inc
--let $engine=MyISAM
--source inc/part_alter_values.inc

View File

@ -1872,6 +1872,7 @@ SET GLOBAL slave_parallel_threads=10;
SET GLOBAL slave_parallel_threads=1;
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000";
CALL mtr.add_suppression("Unexpected break of being relay-logged GTID");
--connection server_1
INSERT INTO t2 VALUES (101);

View File

@ -37,7 +37,7 @@ select * from t1;
# The slave is synced and waiting/reading from master
# SHOW SLAVE STATUS will show "Waiting for master to send event"
let $status_items= Master_SSL_Allowed, Master_SSL_CA_Path, Master_SSL_CA_File, Master_SSL_Cert, Master_SSL_Key;
let $status_items= Master_SSL_Allowed, Master_SSL_CA_Path, Master_SSL_CA_File, Master_SSL_Crl, Master_SSL_Crlpath, Master_SSL_Cert, Master_SSL_Key;
source include/show_slave_status.inc;
source include/check_slave_is_running.inc;

View File

@ -0,0 +1,54 @@
include/master-slave.inc
[connection master]
connection slave;
call mtr.add_suppression("Unexpected break of being relay-logged GTID 0-27697-1000");
call mtr.add_suppression("Relay log write failure: could not queue event from master");
call mtr.add_suppression("The current group of events starts with a non-GTID");
include/stop_slave.inc
CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
include/start_slave.inc
connection master;
CREATE TABLE t (a INT) ENGINE=innodb;
INSERT INTO t VALUES(1);
### A. Simulate an unnoticeable loss of Xid event
connection slave;
SET @@global.debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000";
connection master;
SET @@gtid_seq_no=1000;
set @@server_id=27697;
INSERT INTO t VALUES(1000);
set @@server_id=default;
INSERT INTO t VALUES(1001);
## Prove the error occurs.
connection slave;
include/wait_for_slave_io_error.inc [errno=1595]
## Prove the slave recovers after the simulation condtion is lifted.
SET @@global.debug_dbug=default;
include/start_slave.inc
### B. Do the same to GTID event.
connection slave;
SET @@global.debug_dbug="+d,slave_discard_gtid_0_x_1002";
connection master;
SET @@gtid_seq_no=1002;
set @@server_id=27697;
INSERT INTO t VALUES(1002);
set @@server_id=default;
INSERT INTO t VALUES(1003);
## Prove the error occurs.
connection slave;
include/wait_for_slave_io_error.inc [errno=1595]
## Prove the slave recovers after the simulation condtion is lifted.
SET @@global.debug_dbug=default;
include/start_slave.inc
connection master;
connection slave;
include/diff_tables.inc [master:t,slave:t]
"===== Clean up ====="
connection slave;
include/stop_slave.inc
CHANGE MASTER TO MASTER_USE_GTID=no;
include/start_slave.inc
connection master;
DROP TABLE t;
SET GLOBAL LOG_WARNINGS=default;
include/rpl_end.inc

View File

@ -1378,6 +1378,7 @@ include/stop_slave.inc
SET GLOBAL slave_parallel_threads=1;
SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000";
CALL mtr.add_suppression("Unexpected break of being relay-logged GTID");
connection server_1;
INSERT INTO t2 VALUES (101);
INSERT INTO t2 VALUES (102);

View File

@ -132,8 +132,13 @@ connection server_1;
INSERT INTO t1 VALUES (0, 1);
include/save_master_gtid.inc
connection server_2;
set @@sql_log_bin=0;
call mtr.add_suppression("Unexpected break of being relay-logged GTID 1-1-32 event group by the current GTID event 0-1-4");
set @@sql_log_bin=1;
set @@global.debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000";
include/start_slave.inc
include/sync_with_master_gtid.inc
set @@global.debug_dbug="";
SELECT * FROM t1 ORDER BY a;
a b
0 1

View File

@ -23,6 +23,8 @@ t
Master_SSL_Allowed = 'Yes'
Master_SSL_CA_Path = ''
Master_SSL_CA_File = 'MYSQL_TEST_DIR/std_data/cacert.pem'
Master_SSL_Crl = ''
Master_SSL_Crlpath = ''
Master_SSL_Cert = 'MYSQL_TEST_DIR/std_data/client-cert.pem'
Master_SSL_Key = 'MYSQL_TEST_DIR/std_data/client-key.pem'
include/check_slave_is_running.inc
@ -37,6 +39,8 @@ include/wait_for_slave_to_start.inc
Master_SSL_Allowed = 'Yes'
Master_SSL_CA_Path = ''
Master_SSL_CA_File = 'MYSQL_TEST_DIR/std_data/cacert.pem'
Master_SSL_Crl = ''
Master_SSL_Crlpath = ''
Master_SSL_Cert = 'MYSQL_TEST_DIR/std_data/client-cert.pem'
Master_SSL_Key = 'MYSQL_TEST_DIR/std_data/client-key.pem'
include/check_slave_is_running.inc

View File

@ -0,0 +1,97 @@
# ==== Purpose ====
#
# Test verifies that replicated transaction boundaries are set properly
# at receiving from master time.
#
# ==== Implementation ====
#
# A. Simulate an unnoticeable loss of Xid event to observe a slave error,
# then restart slave to recover from the failure.
# B. Do the same to GTID event.
#
# ==== References ====
#
# MDEV-27697 slave must recognize incomplete replication event group
#
--source include/have_binlog_format_mixed.inc
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/master-slave.inc
--connection slave
call mtr.add_suppression("Unexpected break of being relay-logged GTID 0-27697-1000");
call mtr.add_suppression("Relay log write failure: could not queue event from master");
call mtr.add_suppression("The current group of events starts with a non-GTID");
--source include/stop_slave.inc
CHANGE MASTER TO MASTER_USE_GTID=slave_pos;
--source include/start_slave.inc
--connection master
CREATE TABLE t (a INT) ENGINE=innodb;
INSERT INTO t VALUES(1);
save_master_pos;
--echo ### A. Simulate an unnoticeable loss of Xid event
--sync_slave_with_master
SET @@global.debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000";
--connection master
SET @@gtid_seq_no=1000;
set @@server_id=27697;
INSERT INTO t VALUES(1000);
set @@server_id=default;
INSERT INTO t VALUES(1001);
--echo ## Prove the error occurs.
--connection slave
# ER_SLAVE_RELAY_LOG_WRITE_FAILURE
--let $slave_io_errno = 1595
--source include/wait_for_slave_io_error.inc
## EOP
--echo ## Prove the slave recovers after the simulation condtion is lifted.
SET @@global.debug_dbug=default;
--source include/start_slave.inc
--echo ### B. Do the same to GTID event.
--connection slave
SET @@global.debug_dbug="+d,slave_discard_gtid_0_x_1002";
--connection master
SET @@gtid_seq_no=1002;
set @@server_id=27697;
INSERT INTO t VALUES(1002);
set @@server_id=default;
INSERT INTO t VALUES(1003);
--echo ## Prove the error occurs.
--connection slave
# ER_SLAVE_RELAY_LOG_WRITE_FAILURE
--let $slave_io_errno = 1595
--source include/wait_for_slave_io_error.inc
## EOP
--echo ## Prove the slave recovers after the simulation condtion is lifted.
SET @@global.debug_dbug=default;
--source include/start_slave.inc
--connection master
save_master_pos;
--sync_slave_with_master
## EOP
--let $diff_tables=master:t,slave:t
--source include/diff_tables.inc
--echo "===== Clean up ====="
--connection slave
--source include/stop_slave.inc
CHANGE MASTER TO MASTER_USE_GTID=no;
--source include/start_slave.inc
--connection master
DROP TABLE t;
SET GLOBAL LOG_WARNINGS=default;
--source include/rpl_end.inc

View File

@ -201,9 +201,16 @@ INSERT INTO t1 VALUES (0, 1);
# execution of format_description event will not wait infinitely
# for a commit of the incomplete group that never happens.
# Apart from the suppression, MDEV-27697 refinement to the original test needs
# an allowance to one time accept malformed event group.
set @@sql_log_bin=0;
call mtr.add_suppression("Unexpected break of being relay-logged GTID 1-1-32 event group by the current GTID event 0-1-4");
set @@sql_log_bin=1;
set @@global.debug_dbug="+d,slave_discard_xid_for_gtid_0_x_1000";
--source include/start_slave.inc
#--sync_with_master
--source include/sync_with_master_gtid.inc
set @@global.debug_dbug="";
SELECT * FROM t1 ORDER BY a;
SHOW STATUS LIKE 'Slave_open_temp_tables';

View File

@ -1,150 +0,0 @@
#
# MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
#
# Verbose run
\d |
IF (select count(*) from information_schema.global_variables where
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=InnoDB;
ALTER TABLE time_zone_name ENGINE=InnoDB;
ALTER TABLE time_zone_transition ENGINE=InnoDB;
ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
END IF|
\d ;
TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
(@time_zone_id, 0, 0, 0, 'GMT')
;
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/garbage' as time zone. Skipping it.
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/ignored.tab' as time zone. Skipping it.
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('posix/GMT', @time_zone_id);
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
(@time_zone_id, 0, 0, 0, 'GMT')
;
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it.
Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion.
COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d |
IF (select count(*) from information_schema.global_variables where
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=MyISAM;
ALTER TABLE time_zone_name ENGINE=MyISAM;
ALTER TABLE time_zone_transition ENGINE=MyISAM;
ALTER TABLE time_zone_transition_type ENGINE=MyISAM;
END IF|
\d ;
# Silent run
\d |
IF (select count(*) from information_schema.global_variables where
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=InnoDB;
ALTER TABLE time_zone_name ENGINE=InnoDB;
ALTER TABLE time_zone_transition ENGINE=InnoDB;
ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
END IF|
\d ;
TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
(@time_zone_id, 0, 0, 0, 'GMT')
;
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/garbage' as time zone. Skipping it.
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('posix/GMT', @time_zone_id);
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
(@time_zone_id, 0, 0, 0, 'GMT')
;
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
\d |
IF (select count(*) from information_schema.global_variables where
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=MyISAM;
ALTER TABLE time_zone_name ENGINE=MyISAM;
ALTER TABLE time_zone_transition ENGINE=MyISAM;
ALTER TABLE time_zone_transition_type ENGINE=MyISAM;
END IF|
\d ;
#
# Testing with explicit timezonefile
#
\d |
IF (select count(*) from information_schema.global_variables where
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=InnoDB;
ALTER TABLE time_zone_name ENGINE=InnoDB;
ALTER TABLE time_zone_transition ENGINE=InnoDB;
ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
END IF|
\d ;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id);
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
(@time_zone_id, 0, 0, 0, 'GMT')
;
\d |
IF (select count(*) from information_schema.global_variables where
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=MyISAM;
ALTER TABLE time_zone_name ENGINE=MyISAM;
ALTER TABLE time_zone_transition ENGINE=MyISAM;
ALTER TABLE time_zone_transition_type ENGINE=MyISAM;
END IF|
\d ;
#
# Testing --leap
#
\d |
IF (select count(*) from information_schema.global_variables where
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=InnoDB;
ALTER TABLE time_zone_name ENGINE=InnoDB;
ALTER TABLE time_zone_transition ENGINE=InnoDB;
ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
END IF|
\d ;
\d |
IF (select count(*) from information_schema.global_variables where
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone_leap_second ENGINE=InnoDB;
END IF|
\d ;
TRUNCATE TABLE time_zone_leap_second;
\d |
IF (select count(*) from information_schema.global_variables where
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone_leap_second ENGINE=MyISAM;
END IF|
\d ;
ALTER TABLE time_zone_leap_second ORDER BY Transition_time;
\d |
IF (select count(*) from information_schema.global_variables where
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone ENGINE=MyISAM;
ALTER TABLE time_zone_name ENGINE=MyISAM;
ALTER TABLE time_zone_transition ENGINE=MyISAM;
ALTER TABLE time_zone_transition_type ENGINE=MyISAM;
END IF|
\d ;

View File

@ -1,78 +0,0 @@
#
# MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
#
# Verbose run
set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
prepare set_wsrep_write_binlog from @prep1;
set @toggle=0; execute set_wsrep_write_binlog using @toggle;
TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
(@time_zone_id, 0, 0, 0, 'GMT')
;
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/garbage' as time zone. Skipping it.
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/ignored.tab' as time zone. Skipping it.
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('posix/GMT', @time_zone_id);
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
(@time_zone_id, 0, 0, 0, 'GMT')
;
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/ignored.tab' as time zone. Skipping it.
Warning: Skipping directory 'MYSQLTEST_VARDIR/zoneinfo/posix/posix': to avoid infinite symlink recursion.
COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
# Silent run
set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
prepare set_wsrep_write_binlog from @prep1;
set @toggle=0; execute set_wsrep_write_binlog using @toggle;
TRUNCATE TABLE time_zone;
TRUNCATE TABLE time_zone_name;
TRUNCATE TABLE time_zone_transition;
TRUNCATE TABLE time_zone_transition_type;
START TRANSACTION;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('GMT', @time_zone_id);
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
(@time_zone_id, 0, 0, 0, 'GMT')
;
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/garbage' as time zone. Skipping it.
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('posix/GMT', @time_zone_id);
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
(@time_zone_id, 0, 0, 0, 'GMT')
;
Warning: Unable to load 'MYSQLTEST_VARDIR/zoneinfo/posix/garbage' as time zone. Skipping it.
COMMIT;
ALTER TABLE time_zone_transition ORDER BY Time_zone_id, Transition_time;
ALTER TABLE time_zone_transition_type ORDER BY Time_zone_id, Transition_type_id;
#
# Testing with explicit timezonefile
#
set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
prepare set_wsrep_write_binlog from @prep1;
set @toggle=0; execute set_wsrep_write_binlog using @toggle;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id);
INSERT INTO time_zone_transition_type (Time_zone_id, Transition_type_id, Offset, Is_DST, Abbreviation) VALUES
(@time_zone_id, 0, 0, 0, 'GMT')
;
#
# Testing --leap
#
set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');
prepare set_wsrep_write_binlog from @prep1;
set @toggle=0; execute set_wsrep_write_binlog using @toggle;
TRUNCATE TABLE time_zone_leap_second;
ALTER TABLE time_zone_leap_second ORDER BY Transition_time;

View File

@ -1,3 +0,0 @@
--wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep-on=1 --binlog_format=ROW

View File

@ -1,41 +0,0 @@
--source include/have_wsrep.inc
--source include/have_symlink.inc
--source include/not_windows.inc
--source include/have_innodb.inc
--echo #
--echo # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
--echo #
--exec mkdir $MYSQLTEST_VARDIR/zoneinfo
--exec ln -s $MYSQLTEST_VARDIR/zoneinfo $MYSQLTEST_VARDIR/zoneinfo/posix
--copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/GMT
--copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/garbage
--copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/ignored.tab
--echo # Verbose run
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL --verbose $MYSQLTEST_VARDIR/zoneinfo 2>&1
--echo # Silent run
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo 2>&1
--echo #
--echo # Testing with explicit timezonefile
--echo #
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>&1
--echo #
--echo # Testing --leap
--echo #
--exec $MYSQL_TZINFO_TO_SQL --leap $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1
#
# Cleanup
#
--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo

View File

@ -1,3 +0,0 @@
--wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep-on=1 --binlog_format=ROW

View File

@ -1,41 +0,0 @@
--source include/have_wsrep.inc
--source include/have_symlink.inc
--source include/not_windows.inc
--source include/have_innodb.inc
--echo #
--echo # MDEV-5226 mysql_tzinfo_to_sql errors with tzdata 2013f and above
--echo #
--exec mkdir $MYSQLTEST_VARDIR/zoneinfo
--exec ln -s $MYSQLTEST_VARDIR/zoneinfo $MYSQLTEST_VARDIR/zoneinfo/posix
--copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/GMT
--copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/garbage
--copy_file std_data/words.dat $MYSQLTEST_VARDIR/zoneinfo/ignored.tab
--echo # Verbose run
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL --verbose --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo 2>&1
--echo # Silent run
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo 2>&1
--echo #
--echo # Testing with explicit timezonefile
--echo #
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--exec $MYSQL_TZINFO_TO_SQL --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo/GMT XXX 2>&1
--echo #
--echo # Testing --leap
--echo #
--exec $MYSQL_TZINFO_TO_SQL --leap --skip-write-binlog $MYSQLTEST_VARDIR/zoneinfo/GMT 2>&1
#
# Cleanup
#
--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo

View File

@ -3116,6 +3116,15 @@ Field *Field_decimal::make_new_field(MEM_ROOT *root, TABLE *new_table,
}
void Field_new_decimal::set_and_validate_prec(uint32 len_arg,
uint8 dec_arg, bool unsigned_arg)
{
precision= my_decimal_length_to_precision(len_arg, dec_arg, unsigned_arg);
set_if_smaller(precision, DECIMAL_MAX_PRECISION);
bin_size= my_decimal_get_binary_size(precision, dec);
}
/****************************************************************************
** Field_new_decimal
****************************************************************************/
@ -3134,12 +3143,10 @@ Field_new_decimal::Field_new_decimal(uchar *ptr_arg,
uint8 dec_arg,bool zero_arg,
bool unsigned_arg)
:Field_num(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg, dec_arg, zero_arg, unsigned_arg)
unireg_check_arg, field_name_arg,
MY_MIN(dec_arg, DECIMAL_MAX_SCALE), zero_arg, unsigned_arg)
{
precision= get_decimal_precision(len_arg, dec_arg, unsigned_arg);
DBUG_ASSERT((precision <= DECIMAL_MAX_PRECISION) &&
(dec <= DECIMAL_MAX_SCALE));
bin_size= my_decimal_get_binary_size(precision, dec);
set_and_validate_prec(len_arg, dec_arg, unsigned_arg);
}

View File

@ -1984,6 +1984,8 @@ public:
class Field_new_decimal :public Field_num {
private:
int save_field_metadata(uchar *first_byte);
void set_and_validate_prec(uint32 len_arg,
uint8 dec_arg, bool unsigned_arg);
public:
/* The maximum number of decimal digits can be stored */
uint precision;

View File

@ -5118,6 +5118,9 @@ int handler::calculate_checksum()
for (uint i= 0; i < table->s->fields; i++ )
{
Field *f= table->field[i];
if (!f->stored_in_db())
continue;
if (! thd->variables.old_mode && f->is_real_null(0))
{

View File

@ -2463,7 +2463,7 @@ void Item_func_round::fix_arg_decimal()
set_handler(&type_handler_newdecimal);
unsigned_flag= args[0]->unsigned_flag;
decimals= args[0]->decimals;
max_length= float_length(args[0]->decimals) + 1;
max_length= args[0]->max_length;
}
}

View File

@ -763,6 +763,7 @@ bool Item_subselect::exec()
DBUG_ENTER("Item_subselect::exec");
DBUG_ASSERT(fixed);
DBUG_ASSERT(!eliminated);
DBUG_EXECUTE_IF("Item_subselect",
Item::Print print(this,
@ -1272,11 +1273,18 @@ bool Item_singlerow_subselect::fix_length_and_dec()
}
unsigned_flag= value->unsigned_flag;
/*
If there are not tables in subquery then ability to have NULL value
depends on SELECT list (if single row subquery have tables then it
always can be NULL if there are not records fetched).
If the subquery has no tables (1) and is not a UNION (2), like:
(SELECT subq_value)
then its NULLability is the same as subq_value's NULLability.
(1): A subquery that uses a table will return NULL when the table is empty.
(2): A UNION subquery will return NULL if it produces a "Subquery returns
more than one row" error.
*/
if (engine->no_tables())
if (engine->no_tables() &&
engine->engine_type() != subselect_engine::UNION_ENGINE)
maybe_null= engine->may_be_null();
else
{
@ -1312,6 +1320,16 @@ Item* Item_singlerow_subselect::expr_cache_insert_transformer(THD *tmp_thd,
DBUG_ASSERT(thd == tmp_thd);
/*
Do not create subquery cache if the subquery was eliminated.
The optimizer may eliminate subquery items (see
eliminate_subselect_processor). However it does not update
all query's data structures, so the eliminated item may be
still reachable.
*/
if (eliminated)
DBUG_RETURN(this);
if (expr_cache)
DBUG_RETURN(expr_cache);

View File

@ -1539,6 +1539,8 @@ void Item_sum_sum::fix_length_and_dec_decimal()
decimals= args[0]->decimals;
/* SUM result can't be longer than length(arg) + length(MAX_ROWS) */
int precision= args[0]->decimal_precision() + DECIMAL_LONGLONG_DIGITS;
decimals= MY_MIN(decimals, DECIMAL_MAX_SCALE);
precision= MY_MIN(precision, DECIMAL_MAX_PRECISION);
max_length= my_decimal_precision_to_length_no_truncation(precision,
decimals,
unsigned_flag);
@ -1954,12 +1956,12 @@ void Item_sum_avg::fix_length_and_dec_decimal()
{
Item_sum_sum::fix_length_and_dec_decimal();
int precision= args[0]->decimal_precision() + prec_increment;
decimals= MY_MIN(args[0]->decimals + prec_increment, DECIMAL_MAX_SCALE);
decimals= MY_MIN(args[0]->decimal_scale() + prec_increment, DECIMAL_MAX_SCALE);
max_length= my_decimal_precision_to_length_no_truncation(precision,
decimals,
unsigned_flag);
f_precision= MY_MIN(precision+DECIMAL_LONGLONG_DIGITS, DECIMAL_MAX_PRECISION);
f_scale= args[0]->decimals;
f_scale= args[0]->decimal_scale();
dec_bin_size= my_decimal_get_binary_size(f_precision, f_scale);
}

View File

@ -26,6 +26,7 @@
extern const LEX_CSTRING rpl_gtid_slave_state_table_name;
class String;
#define PARAM_GTID(G) G.domain_id, G.server_id, G.seq_no
struct rpl_gtid
{

View File

@ -3214,9 +3214,9 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
protocol->store((uint32) mi->master_id);
// SQL_Delay
// Master_Ssl_Crl
protocol->store(mi->ssl_ca, &my_charset_bin);
protocol->store(mi->ssl_crl, &my_charset_bin);
// Master_Ssl_Crlpath
protocol->store(mi->ssl_capath, &my_charset_bin);
protocol->store(mi->ssl_crlpath, &my_charset_bin);
// Using_Gtid
protocol->store(mi->using_gtid_astext(mi->using_gtid), &my_charset_bin);
// Gtid_IO_Pos
@ -3315,7 +3315,7 @@ bool show_all_master_info(THD* thd)
String gtid_pos;
Master_info **tmp;
List<Item> field_list;
DBUG_ENTER("show_master_info");
DBUG_ENTER("show_all_master_info");
mysql_mutex_assert_owner(&LOCK_active_mi);
gtid_pos.length(0);
@ -6573,17 +6573,75 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
mi->gtid_event_seen= true;
/*
We have successfully queued to relay log everything before this GTID, so
Unless the previous group is malformed,
we have successfully queued to relay log everything before this GTID, so
in case of reconnect we can start from after any previous GTID.
(Normally we would have updated gtid_current_pos earlier at the end of
the previous event group, but better leave an extra check here for
safety).
(We must have updated gtid_current_pos earlier at the end of
the previous event group. Unless ...)
*/
if (mi->events_queued_since_last_gtid)
if (unlikely(mi->events_queued_since_last_gtid > 0))
{
mi->gtid_current_pos.update(&mi->last_queued_gtid);
mi->events_queued_since_last_gtid= 0;
/*
...unless the last group has not been completed. An assert below
can be satisfied only with the strict mode that ensures
against "genuine" gtid duplicates.
*/
rpl_gtid *gtid_in_slave_state=
mi->gtid_current_pos.find(mi->last_queued_gtid.domain_id);
// Slave gtid state must not have updated yet to the last received gtid.
DBUG_ASSERT((mi->using_gtid == Master_info::USE_GTID_NO ||
!opt_gtid_strict_mode) ||
(!gtid_in_slave_state ||
!(*gtid_in_slave_state == mi->last_queued_gtid)));
DBUG_EXECUTE_IF("slave_discard_xid_for_gtid_0_x_1000",
{
/* Inject an event group that is missing its XID commit event. */
if ((mi->last_queued_gtid.domain_id == 0 &&
mi->last_queued_gtid.seq_no == 1000) ||
(mi->last_queued_gtid.domain_id == 1 &&
mi->last_queued_gtid.seq_no == 32))
{
sql_print_warning(
"Unexpected break of being relay-logged GTID %u-%u-%llu "
"event group by the current GTID event %u-%u-%llu",
PARAM_GTID(mi->last_queued_gtid),PARAM_GTID(event_gtid));
DBUG_SET("-d,slave_discard_xid_for_gtid_0_x_1000");
goto dbug_gtid_accept;
}
});
error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE;
sql_print_error("Unexpected break of being relay-logged GTID %u-%u-%llu "
"event group by the current GTID event %u-%u-%llu",
PARAM_GTID(mi->last_queued_gtid),PARAM_GTID(event_gtid));
goto err;
}
else if (unlikely(mi->gtid_reconnect_event_skip_count > 0))
{
if (mi->gtid_reconnect_event_skip_count ==
mi->events_queued_since_last_gtid)
{
DBUG_ASSERT(event_gtid == mi->last_queued_gtid);
goto default_action;
}
DBUG_ASSERT(0);
}
// else_likely{...
#ifndef DBUG_OFF
dbug_gtid_accept:
DBUG_EXECUTE_IF("slave_discard_gtid_0_x_1002",
{
if (mi->last_queued_gtid.server_id == 27697 &&
mi->last_queued_gtid.seq_no == 1002)
{
DBUG_SET("-d,slave_discard_gtid_0_x_1002");
goto skip_relay_logging;
}
});
#endif
mi->last_queued_gtid= event_gtid;
mi->last_queued_gtid_standalone=
(gtid_flag & Gtid_log_event::FL_STANDALONE) != 0;
@ -6593,6 +6651,7 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
++mi->events_queued_since_last_gtid;
inc_pos= event_len;
// ...} eof else_likely
}
break;
/*
@ -6671,6 +6730,12 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
case XID_EVENT:
DBUG_EXECUTE_IF("slave_discard_xid_for_gtid_0_x_1000",
{
if (mi->last_queued_gtid.server_id == 27697 &&
mi->last_queued_gtid.seq_no == 1000)
{
DBUG_SET("-d,slave_discard_xid_for_gtid_0_x_1000");
goto skip_relay_logging;
}
/* Inject an event group that is missing its XID commit event. */
if (mi->last_queued_gtid.domain_id == 0 &&
mi->last_queued_gtid.seq_no == 1000)
@ -6716,15 +6781,48 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
}
};);
if (mi->using_gtid != Master_info::USE_GTID_NO && mi->gtid_event_seen)
if (mi->using_gtid != Master_info::USE_GTID_NO)
{
if (unlikely(mi->gtid_reconnect_event_skip_count))
if (likely(mi->gtid_event_seen))
{
--mi->gtid_reconnect_event_skip_count;
gtid_skip_enqueue= true;
if (unlikely(mi->gtid_reconnect_event_skip_count))
{
if (!got_gtid_event &&
mi->gtid_reconnect_event_skip_count ==
mi->events_queued_since_last_gtid)
goto gtid_not_start; // the 1st re-sent must be gtid
--mi->gtid_reconnect_event_skip_count;
gtid_skip_enqueue= true;
}
else if (likely(mi->events_queued_since_last_gtid))
{
DBUG_ASSERT(!got_gtid_event);
++mi->events_queued_since_last_gtid;
}
else if (Log_event::is_group_event((Log_event_type) (uchar)
buf[EVENT_TYPE_OFFSET]))
{
goto gtid_not_start; // no first gtid event in this group
}
}
else if (Log_event::is_group_event((Log_event_type) (uchar)
buf[EVENT_TYPE_OFFSET]))
{
gtid_not_start:
DBUG_ASSERT(!got_gtid_event);
error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE;
sql_print_error("The current group of events starts with "
"a non-GTID %s event; "
"the last seen GTID is %u-%u-%llu",
Log_event::get_type_str((Log_event_type) (uchar)
buf[EVENT_TYPE_OFFSET]),
mi->last_queued_gtid);
goto err;
}
else if (mi->events_queued_since_last_gtid)
++mi->events_queued_since_last_gtid;
}
if (!is_compress_event)
@ -6917,11 +7015,13 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
The whole of the current event group is queued. So in case of
reconnect we can start from after the current GTID.
*/
if (mi->gtid_reconnect_event_skip_count)
if (gtid_skip_enqueue)
{
bool first= true;
StringBuffer<1024> gtid_text;
DBUG_ASSERT(mi->events_queued_since_last_gtid > 1);
rpl_slave_state_tostring_helper(&gtid_text, &mi->last_queued_gtid,
&first);
sql_print_error("Slave IO thread received a terminal event from "
@ -6931,12 +7031,39 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len)
gtid_text.ptr(),
mi->gtid_reconnect_event_skip_count,
mi->events_queued_since_last_gtid);
error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE;
goto err;
}
mi->gtid_current_pos.update(&mi->last_queued_gtid);
mi->events_queued_since_last_gtid= 0;
/* Reset the domain_id_filter flag. */
mi->domain_id_filter.reset_filter();
if (unlikely(gtid_skip_enqueue))
{
error= ER_SLAVE_RELAY_LOG_WRITE_FAILURE;
sql_print_error("Recieved a group closing %s event "
"at %llu position in the group while there are "
"still %llu events to skip upon reconnecting; "
"the last seen GTID is %u-%u-%llu",
Log_event::get_type_str((Log_event_type) (uchar)
buf[EVENT_TYPE_OFFSET]),
(mi->events_queued_since_last_gtid -
mi->gtid_reconnect_event_skip_count),
mi->events_queued_since_last_gtid,
mi->last_queued_gtid);
goto err;
}
else
{
/*
The whole of the current event group is queued. So in case of
reconnect we can start from after the current GTID.
*/
mi->gtid_current_pos.update(&mi->last_queued_gtid);
mi->events_queued_since_last_gtid= 0;
/* Reset the domain_id_filter flag. */
mi->domain_id_filter.reset_filter();
}
}
skip_relay_logging:

View File

@ -312,3 +312,12 @@ sp_cache::cleanup()
{
my_hash_free(&m_hashtable);
}
void Sp_caches::sp_caches_clear()
{
sp_cache_clear(&sp_proc_cache);
sp_cache_clear(&sp_func_cache);
sp_cache_clear(&sp_package_spec_cache);
sp_cache_clear(&sp_package_body_cache);
}

View File

@ -791,7 +791,7 @@ void
sp_head::set_stmt_end(THD *thd)
{
Lex_input_stream *lip= & thd->m_parser_state->m_lip; /* shortcut */
const char *end_ptr= lip->get_cpp_ptr(); /* shortcut */
const char *end_ptr= lip->get_cpp_tok_start(); /* shortcut */
/* Make the string of parameters. */

View File

@ -812,11 +812,6 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
(my_hash_get_key) get_sequence_last_key,
(my_hash_free_key) free_sequence_last, HASH_THREAD_SPECIFIC);
sp_proc_cache= NULL;
sp_func_cache= NULL;
sp_package_spec_cache= NULL;
sp_package_body_cache= NULL;
/* For user vars replication*/
if (opt_bin_log)
my_init_dynamic_array(&user_var_events,
@ -1383,10 +1378,7 @@ void THD::change_user(void)
my_hash_init(&sequences, system_charset_info, SEQUENCES_HASH_SIZE, 0, 0,
(my_hash_get_key) get_sequence_last_key,
(my_hash_free_key) free_sequence_last, HASH_THREAD_SPECIFIC);
sp_cache_clear(&sp_proc_cache);
sp_cache_clear(&sp_func_cache);
sp_cache_clear(&sp_package_spec_cache);
sp_cache_clear(&sp_package_body_cache);
sp_caches_clear();
}
/**
@ -1512,10 +1504,7 @@ void THD::cleanup(void)
my_hash_free(&user_vars);
my_hash_free(&sequences);
sp_cache_clear(&sp_proc_cache);
sp_cache_clear(&sp_func_cache);
sp_cache_clear(&sp_package_spec_cache);
sp_cache_clear(&sp_package_body_cache);
sp_caches_clear();
auto_inc_intervals_forced.empty();
auto_inc_intervals_in_cur_stmt_for_binlog.empty();

View File

@ -2167,6 +2167,39 @@ struct wait_for_commit
void reinit();
};
class Sp_caches
{
public:
sp_cache *sp_proc_cache;
sp_cache *sp_func_cache;
sp_cache *sp_package_spec_cache;
sp_cache *sp_package_body_cache;
Sp_caches()
:sp_proc_cache(NULL),
sp_func_cache(NULL),
sp_package_spec_cache(NULL),
sp_package_body_cache(NULL)
{ }
~Sp_caches()
{
// All caches must be freed by the caller explicitly
DBUG_ASSERT(sp_proc_cache == NULL);
DBUG_ASSERT(sp_func_cache == NULL);
DBUG_ASSERT(sp_package_spec_cache == NULL);
DBUG_ASSERT(sp_package_body_cache == NULL);
}
void sp_caches_swap(Sp_caches &rhs)
{
swap_variables(sp_cache*, sp_proc_cache, rhs.sp_proc_cache);
swap_variables(sp_cache*, sp_func_cache, rhs.sp_func_cache);
swap_variables(sp_cache*, sp_package_spec_cache, rhs.sp_package_spec_cache);
swap_variables(sp_cache*, sp_package_body_cache, rhs.sp_package_body_cache);
}
void sp_caches_clear();
};
extern "C" void my_message_sql(uint error, const char *str, myf MyFlags);
/**
@ -2185,7 +2218,8 @@ class THD :public Statement,
*/
public Item_change_list,
public MDL_context_owner,
public Open_tables_state
public Open_tables_state,
public Sp_caches
{
private:
inline bool is_stmt_prepare() const
@ -3180,10 +3214,6 @@ public:
enum_sql_command last_sql_command; // Last sql_command exceuted in mysql_execute_command()
sp_rcontext *spcont; // SP runtime context
sp_cache *sp_proc_cache;
sp_cache *sp_func_cache;
sp_cache *sp_package_spec_cache;
sp_cache *sp_package_body_cache;
/** number of name_const() substitutions, see sp_head.cc:subst_spvars() */
uint query_name_consts;

View File

@ -63,7 +63,7 @@ void Expression_cache_tmptable::disable_cache()
cache_table= NULL;
update_tracker();
if (tracker)
tracker->cache= NULL;
tracker->detach_from_cache();
}
@ -189,6 +189,8 @@ Expression_cache_tmptable::~Expression_cache_tmptable()
else
{
update_tracker();
if (tracker)
tracker->detach_from_cache();
tracker= NULL;
}
}

View File

@ -83,7 +83,11 @@ public:
cache(c), hit(0), miss(0), state(UNINITED)
{}
private:
// This can be NULL if the cache is already deleted
Expression_cache *cache;
public:
ulong hit, miss;
enum expr_cache_state state;
@ -91,6 +95,7 @@ public:
void set(ulong h, ulong m, enum expr_cache_state s)
{hit= h; miss= m; state= s;}
void detach_from_cache() { cache= NULL; }
void fetch_current_stats()
{
if (cache)

View File

@ -701,8 +701,10 @@ mysql_ha_fix_cond_and_key(SQL_HANDLER *handler,
if (!in_prepare)
{
MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set);
(void) item->save_in_field(key_part->field, 1);
int res= item->save_in_field(key_part->field, 1);
dbug_tmp_restore_column_map(&table->write_set, old_map);
if (res)
return 1;
}
key_len+= key_part->store_length;
keypart_map= (keypart_map << 1) | 1;

View File

@ -17144,8 +17144,7 @@ Field *create_tmp_field_from_field(THD *thd, Field *org_field,
table->s->db_create_options|= HA_OPTION_PACK_RECORD;
else if (org_field->type() == FIELD_TYPE_DOUBLE)
((Field_double *) new_field)->not_fixed= TRUE;
new_field->vcol_info= new_field->default_value=
new_field->check_constraint= 0;
new_field->vcol_info= 0;
new_field->cond_selectivity= 1.0;
new_field->next_equal_field= NULL;
new_field->option_list= NULL;
@ -17740,6 +17739,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
table->intersect_keys.init();
table->keys_in_use_for_query.init();
table->no_rows_with_nulls= param->force_not_null_cols;
table->expr_arena= thd;
table->s= share;
init_tmp_table_share(thd, share, "", 0, "(temporary)", tmpname);

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