diff options
author | Sergei Petrunia <sergey@mariadb.com> | 2022-04-26 15:18:15 +0300 |
---|---|---|
committer | Sergei Petrunia <sergey@mariadb.com> | 2022-04-26 15:18:15 +0300 |
commit | 2d18943a63ba51657c0e8ff0d4c98b16786a81b0 (patch) | |
tree | 8a74a5f20839ad2378caf6bc794a6813ab6fc5e3 | |
parent | c01ee954bf3b10fef85af7b8c77d319ff7bd6b61 (diff) | |
parent | 9b2d36660bbb4f93c6b9e0761c91d57d47f59196 (diff) | |
download | mariadb-git-bb-10.2-mdev26047-v2.tar.gz |
Merge branch '10.2' of github.com:MariaDB/server into 10.2bb-10.2-mdev26047-v2bb-10.2-mdev26047
56 files changed, 1638 insertions, 461 deletions
diff --git a/config.h.cmake b/config.h.cmake index c74592b4a65..3a43c6132f0 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -577,3 +577,5 @@ #endif // !defined(__STDC_FORMAT_MACROS) #endif + +#cmakedefine HAVE_VFORK 1 diff --git a/configure.cmake b/configure.cmake index 942d5780ed9..3ac42e8e3e4 100644 --- a/configure.cmake +++ b/configure.cmake @@ -1033,3 +1033,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() diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc index 78af2b7f5ac..bddf069f4e9 100644 --- a/extra/mariabackup/backup_mysql.cc +++ b/extra/mariabackup/backup_mysql.cc @@ -265,7 +265,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; @@ -273,10 +274,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); @@ -284,6 +285,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, @@ -1196,92 +1206,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 >id_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 >id_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", >id_executed}, - {"Using_Gtid", &using_gtid}, - {NULL, NULL} - }; - - mysql_variable variables[] = { - {"gtid_slave_pos", >id_slave_pos}, - {NULL, NULL} - }; - - read_mysql_variables(connection, "SHOW SLAVE STATUS", status, false); - read_mysql_variables(connection, "SHOW VARIABLES", variables, true); - - 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 = ' '; - } + 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; + } - 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); - } + if (Show_slave_status::get_slave_info(connection, show_all_slaves_status, + &sql, &comment)) + return false; // Error -cleanup: - free_mysql_variables(status); - free_mysql_variables(variables); + 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 + } - return(result); + mysql_slave_position= strdup(comment.c_ptr()); + return backup_file_print_buf(XTRABACKUP_SLAVE_INFO, sql.ptr(), sql.length()); } diff --git a/libmariadb b/libmariadb -Subproject f6c3d9fd2af5d17db64cc996574aa312efd70fc +Subproject f33017c19a5b02394de5d0816513d2e2c9d1767 diff --git a/man/mysql_tzinfo_to_sql.1 b/man/mysql_tzinfo_to_sql.1 index 9ab70fbc2e4..1c7de159e75 100644 --- a/man/mysql_tzinfo_to_sql.1 +++ b/man/mysql_tzinfo_to_sql.1 @@ -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" diff --git a/mysql-test/extra/rpl_tests/rpl_parallel.inc b/mysql-test/extra/rpl_tests/rpl_parallel.inc index b88d2126d4d..9ba7a30f2eb 100644 --- a/mysql-test/extra/rpl_tests/rpl_parallel.inc +++ b/mysql-test/extra/rpl_tests/rpl_parallel.inc @@ -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); diff --git a/mysql-test/r/create_select_tmp.result b/mysql-test/r/create_select.result index f499e539baf..6c6ab77522d 100644 --- a/mysql-test/r/create_select_tmp.result +++ b/mysql-test/r/create_select.result @@ -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 +# diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result index 0c045e39271..31a92207442 100644 --- a/mysql-test/r/derived_view.result +++ b/mysql-test/r/derived_view.result @@ -3586,4 +3586,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 diff --git a/mysql-test/r/func_default.result b/mysql-test/r/func_default.result index 2b5c869ee66..8e4a647ff8e 100644 --- a/mysql-test/r/func_default.result +++ b/mysql-test/r/func_default.result @@ -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 # diff --git a/mysql-test/r/mysql_tzinfo_to_sql_symlink.result b/mysql-test/r/mysql_tzinfo_to_sql_symlink.result index f56a2df2012..5753a719769 100644 --- a/mysql-test/r/mysql_tzinfo_to_sql_symlink.result +++ b/mysql-test/r/mysql_tzinfo_to_sql_symlink.result @@ -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 | diff --git a/mysql-test/r/parser.result b/mysql-test/r/parser.result index 9e091688e1d..e8bf9d12a33 100644 --- a/mysql-test/r/parser.result +++ b/mysql-test/r/parser.result @@ -1367,5 +1367,47 @@ 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 # diff --git a/mysql-test/r/parser_not_embedded.result b/mysql-test/r/parser_not_embedded.result index 25349e51577..2147e25b3b1 100644 --- a/mysql-test/r/parser_not_embedded.result +++ b/mysql-test/r/parser_not_embedded.result @@ -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 +# diff --git a/mysql-test/suite/galera/r/mysql_tzinfo_to_sql.result b/mysql-test/suite/galera/r/mysql_tzinfo_to_sql.result new file mode 100644 index 00000000000..a140f517ac8 --- /dev/null +++ b/mysql-test/suite/galera/r/mysql_tzinfo_to_sql.result @@ -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 +# diff --git a/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.opt b/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.opt new file mode 100644 index 00000000000..beae84b3862 --- /dev/null +++ b/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.opt @@ -0,0 +1 @@ +--log-bin diff --git a/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.test b/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.test new file mode 100644 index 00000000000..6bfad2f18b5 --- /dev/null +++ b/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.test @@ -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 # diff --git a/mysql-test/suite/handler/aria.result b/mysql-test/suite/handler/aria.result index 6b02ac9b085..433a8a7008e 100644 --- a/mysql-test/suite/handler/aria.result +++ b/mysql-test/suite/handler/aria.result @@ -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 diff --git a/mysql-test/suite/handler/aria.test b/mysql-test/suite/handler/aria.test index 1913d2b791c..912a9e89721 100644 --- a/mysql-test/suite/handler/aria.test +++ b/mysql-test/suite/handler/aria.test @@ -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 diff --git a/mysql-test/suite/handler/innodb.result b/mysql-test/suite/handler/innodb.result index 80e8ed679a9..7f9995c9e84 100644 --- a/mysql-test/suite/handler/innodb.result +++ b/mysql-test/suite/handler/innodb.result @@ -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 diff --git a/mysql-test/suite/handler/innodb.test b/mysql-test/suite/handler/innodb.test index d752da7dc31..74b0a650c25 100644 --- a/mysql-test/suite/handler/innodb.test +++ b/mysql-test/suite/handler/innodb.test @@ -31,3 +31,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 diff --git a/mysql-test/suite/handler/interface.result b/mysql-test/suite/handler/interface.result index a4ac32c16b4..1b0d08635f9 100644 --- a/mysql-test/suite/handler/interface.result +++ b/mysql-test/suite/handler/interface.result @@ -312,3 +312,19 @@ Note 1050 Table 'v' already exists 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 diff --git a/mysql-test/suite/handler/interface.test b/mysql-test/suite/handler/interface.test index 2f576c9b291..8a90ffc0cf7 100644 --- a/mysql-test/suite/handler/interface.test +++ b/mysql-test/suite/handler/interface.test @@ -354,3 +354,23 @@ execute stmt; --error ER_UNKNOWN_TABLE 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 diff --git a/mysql-test/suite/handler/myisam.result b/mysql-test/suite/handler/myisam.result index 90e1767a1f3..c444027d062 100644 --- a/mysql-test/suite/handler/myisam.result +++ b/mysql-test/suite/handler/myisam.result @@ -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 diff --git a/mysql-test/suite/handler/myisam.test b/mysql-test/suite/handler/myisam.test index a2d87630aef..2fce8548322 100644 --- a/mysql-test/suite/handler/myisam.test +++ b/mysql-test/suite/handler/myisam.test @@ -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 diff --git a/mysql-test/suite/mariabackup/include/show_xtrabackup_slave_info.inc b/mysql-test/suite/mariabackup/include/show_xtrabackup_slave_info.inc new file mode 100644 index 00000000000..4a83c9c394e --- /dev/null +++ b/mysql-test/suite/mariabackup/include/show_xtrabackup_slave_info.inc @@ -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 diff --git a/mysql-test/suite/mariabackup/include/show_xtrabackup_slave_info_out.inc b/mysql-test/suite/mariabackup/include/show_xtrabackup_slave_info_out.inc new file mode 100644 index 00000000000..90b2d00b61d --- /dev/null +++ b/mysql-test/suite/mariabackup/include/show_xtrabackup_slave_info_out.inc @@ -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 diff --git a/mysql-test/suite/mariabackup/rpl_slave_info.result b/mysql-test/suite/mariabackup/rpl_slave_info.result index 13044fd6c39..ec27166ecfb 100644 --- a/mysql-test/suite/mariabackup/rpl_slave_info.result +++ b/mysql-test/suite/mariabackup/rpl_slave_info.result @@ -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; diff --git a/mysql-test/suite/mariabackup/rpl_slave_info.test b/mysql-test/suite/mariabackup/rpl_slave_info.test index ca7682d8af9..1c5dd89acc9 100644 --- a/mysql-test/suite/mariabackup/rpl_slave_info.test +++ b/mysql-test/suite/mariabackup/rpl_slave_info.test @@ -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; diff --git a/mysql-test/suite/mariabackup/slave_info_norpl.result b/mysql-test/suite/mariabackup/slave_info_norpl.result new file mode 100644 index 00000000000..9fcd67a8916 --- /dev/null +++ b/mysql-test/suite/mariabackup/slave_info_norpl.result @@ -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 +# diff --git a/mysql-test/suite/mariabackup/slave_info_norpl.test b/mysql-test/suite/mariabackup/slave_info_norpl.test new file mode 100644 index 00000000000..0d2d2ed4861 --- /dev/null +++ b/mysql-test/suite/mariabackup/slave_info_norpl.test @@ -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 # diff --git a/mysql-test/suite/parts/inc/part_alter_values.inc b/mysql-test/suite/parts/inc/part_alter_values.inc index 2f16476c78b..ca18faa5758 100644 --- a/mysql-test/suite/parts/inc/part_alter_values.inc +++ b/mysql-test/suite/parts/inc/part_alter_values.inc @@ -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 # diff --git a/mysql-test/suite/parts/t/partition_alter_myisam.test b/mysql-test/suite/parts/t/partition_alter_myisam.test index 326cf52b018..d3abb8842e1 100644 --- a/mysql-test/suite/parts/t/partition_alter_myisam.test +++ b/mysql-test/suite/parts/t/partition_alter_myisam.test @@ -1,5 +1,4 @@ --source include/have_partition.inc ---source include/have_symlink.inc --let $engine=MyISAM --source inc/part_alter_values.inc diff --git a/mysql-test/suite/rpl/r/rpl_gtid_grouping.result b/mysql-test/suite/rpl/r/rpl_gtid_grouping.result new file mode 100644 index 00000000000..ad7d6116c49 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_gtid_grouping.result @@ -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 diff --git a/mysql-test/suite/rpl/r/rpl_parallel.result b/mysql-test/suite/rpl/r/rpl_parallel.result index 657b3ba7448..2601b30279e 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel.result +++ b/mysql-test/suite/rpl/r/rpl_parallel.result @@ -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); diff --git a/mysql-test/suite/rpl/t/rpl_gtid_grouping.test b/mysql-test/suite/rpl/t/rpl_gtid_grouping.test new file mode 100644 index 00000000000..66448c4f96c --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_gtid_grouping.test @@ -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 diff --git a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result deleted file mode 100644 index bcd96b86516..00000000000 --- a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result +++ /dev/null @@ -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 ; diff --git a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result deleted file mode 100644 index aff02cb413e..00000000000 --- a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink_skip.result +++ /dev/null @@ -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; diff --git a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.opt b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.opt deleted file mode 100644 index 864f7342cc7..00000000000 --- a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.opt +++ /dev/null @@ -1,3 +0,0 @@ ---wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep-on=1 --binlog_format=ROW - - diff --git a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test deleted file mode 100644 index 87554635666..00000000000 --- a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink.test +++ /dev/null @@ -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 diff --git a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.opt b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.opt deleted file mode 100644 index 864f7342cc7..00000000000 --- a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.opt +++ /dev/null @@ -1,3 +0,0 @@ ---wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --wsrep-on=1 --binlog_format=ROW - - diff --git a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test b/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test deleted file mode 100644 index ab1f94cc1cf..00000000000 --- a/mysql-test/suite/wsrep/t/mysql_tzinfo_to_sql_symlink_skip.test +++ /dev/null @@ -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 diff --git a/mysql-test/t/create_select_tmp.test b/mysql-test/t/create_select.test index ef3315aed97..170bbba31d4 100644 --- a/mysql-test/t/create_select_tmp.test +++ b/mysql-test/t/create_select.test @@ -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 # diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test index 0f3d9b224ba..f36401271cc 100644 --- a/mysql-test/t/derived_view.test +++ b/mysql-test/t/derived_view.test @@ -2376,4 +2376,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 diff --git a/mysql-test/t/func_default.test b/mysql-test/t/func_default.test index f542a279478..53cd94e58c4 100644 --- a/mysql-test/t/func_default.test +++ b/mysql-test/t/func_default.test @@ -166,5 +166,16 @@ 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 # diff --git a/mysql-test/t/information_schema_tables.test b/mysql-test/t/information_schema_tables.test index ebb1e21a65b..bc4f269a3fb 100644 --- a/mysql-test/t/information_schema_tables.test +++ b/mysql-test/t/information_schema_tables.test @@ -24,9 +24,14 @@ LOOP 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 diff --git a/mysql-test/t/mysql_tzinfo_to_sql_symlink.test b/mysql-test/t/mysql_tzinfo_to_sql_symlink.test index 8ca82b87e30..fcb5916c4a2 100644 --- a/mysql-test/t/mysql_tzinfo_to_sql_symlink.test +++ b/mysql-test/t/mysql_tzinfo_to_sql_symlink.test @@ -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 # diff --git a/mysql-test/t/parser.test b/mysql-test/t/parser.test index efb936d8ea4..095d274724b 100644 --- a/mysql-test/t/parser.test +++ b/mysql-test/t/parser.test @@ -1409,5 +1409,29 @@ 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 # diff --git a/mysql-test/t/parser_not_embedded.test b/mysql-test/t/parser_not_embedded.test index 3af1260f4ad..270573ece93 100644 --- a/mysql-test/t/parser_not_embedded.test +++ b/mysql-test/t/parser_not_embedded.test @@ -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 # diff --git a/sql/rpl_gtid.h b/sql/rpl_gtid.h index e4949ff0d39..bb171f3d95d 100644 --- a/sql/rpl_gtid.h +++ b/sql/rpl_gtid.h @@ -26,6 +26,7 @@ extern const LEX_STRING rpl_gtid_slave_state_table_name; class String; +#define PARAM_GTID(G) G.domain_id, G.server_id, G.seq_no struct rpl_gtid { diff --git a/sql/slave.cc b/sql/slave.cc index 2ff1a0490e9..31e50753c9e 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -6196,23 +6196,75 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) } } - if (unlikely(mi->gtid_reconnect_event_skip_count)) - { - goto default_action; - } - /* - 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 > + mi->gtid_reconnect_event_skip_count)) { - 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) + { + 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; @@ -6222,6 +6274,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; /* @@ -6274,6 +6327,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) @@ -6319,15 +6378,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) @@ -6500,15 +6592,35 @@ static int queue_event(Master_info* mi,const char* buf, ulong event_len) Query_log_event::peek_is_commit_rollback(buf, event_len, checksum_alg)))))) { - /* - 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; + DBUG_ASSERT(mi->events_queued_since_last_gtid > 1); - /* 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: diff --git a/sql/sp_head.cc b/sql/sp_head.cc index cb5348cd110..66df02d99fb 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -700,7 +700,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 */ uint not_used; /* Make the string of parameters. */ diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index ec3756eceba..132556f57b8 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -613,8 +613,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; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index d2186f60709..e9d81417ee6 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -16333,8 +16333,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; @@ -16901,6 +16900,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); diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 528d4ee4bdc..bade0bd3752 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1035,10 +1035,10 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); %parse-param { THD *thd } %lex-param { THD *thd } /* - Currently there are 98 shift/reduce conflicts. + Currently there are 119 shift/reduce conflicts. We should not introduce new conflicts any more. */ -%expect 115 +%expect 119 /* Comments for TOKENS. @@ -1258,6 +1258,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); %token FOLLOWS_SYM /* MYSQL trigger*/ %token FOLLOWING_SYM /* SQL-2011-N */ %token FORCE_SYM +%token FORCE_LOOKAHEAD /* INTERNAL never returned by the lexer */ %token FOREIGN /* SQL-2003-R */ %token FOR_SYM /* SQL-2003-R */ %token FORMAT_SYM @@ -2710,6 +2711,9 @@ server_option: } ; +/* this rule is used to force look-ahead in the parser */ +force_lookahead: {} | FORCE_LOOKAHEAD {} ; + event_tail: remember_name EVENT_SYM opt_if_not_exists sp_name { @@ -2854,7 +2858,7 @@ ev_sql_stmt: lex->sp_chistics.suid= SP_IS_SUID; //always the definer! lex->sphead->set_body_start(thd, lip->get_cpp_ptr()); } - sp_proc_stmt + sp_proc_stmt force_lookahead { LEX *lex= thd->lex; @@ -16838,8 +16842,8 @@ trigger_tail: lex->sphead->set_body_start(thd, lip->get_cpp_tok_start()); } - sp_proc_stmt /* $20 */ - { /* $21 */ + sp_proc_stmt force_lookahead + { LEX *lex= Lex; sp_head *sp= lex->sphead; @@ -16939,7 +16943,7 @@ sf_tail: lex->sphead->set_body_start(thd, lip->get_cpp_tok_start()); } - sp_proc_stmt_in_returns_clause /* $15 */ + sp_proc_stmt_in_returns_clause /* $15 */ force_lookahead { LEX *lex= thd->lex; sp_head *sp= lex->sphead; @@ -17020,7 +17024,7 @@ sp_tail: { Lex->sphead->set_body_start(thd, YYLIP->get_cpp_tok_start()); } - sp_proc_stmt + sp_proc_stmt force_lookahead { LEX *lex= Lex; sp_head *sp= lex->sphead; diff --git a/sql/table.cc b/sql/table.cc index a5f1a5d96cf..605a2e0ddbf 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -5984,7 +5984,7 @@ Item *Field_iterator_view::create_item(THD *thd) Item *create_view_field(THD *thd, TABLE_LIST *view, Item **field_ref, const char *name) { - bool save_wrapper= thd->lex->select_lex.no_wrap_view_item; + bool save_wrapper= thd->lex->current_select->no_wrap_view_item; Item *field= *field_ref; DBUG_ENTER("create_view_field"); diff --git a/sql/tztime.cc b/sql/tztime.cc index 47bc44f3386..8790673c5a0 100644 --- a/sql/tztime.cc +++ b/sql/tztime.cc @@ -2642,7 +2642,7 @@ static struct my_option my_long_options[] = &opt_verbose, &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"skip-write-binlog", 'S', "Do not replicate changes to time zone tables to other nodes in a Galera cluster.", + {"skip-write-binlog", 'S', "Do not replicate changes to time zone tables to the binary log, or to other nodes in a Galera cluster.", &opt_skip_write_binlog,&opt_skip_write_binlog, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -2738,9 +2738,9 @@ main(int argc, char **argv) sql_log_bin and wsrep_on to avoid Galera replicating below truncate table clauses. This will allow user to set different time zones to nodes in Galera cluster. */ - printf("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 ?');\n" - "prepare set_wsrep_write_binlog from @prep1;\n" - "set @toggle=0; execute set_wsrep_write_binlog using @toggle;\n"); + printf("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');\n" + "SET SESSION SQL_LOG_BIN=0;\n" + "execute immediate @prep1;\n"); } else { diff --git a/storage/connect/tabrest.cpp b/storage/connect/tabrest.cpp index c66d8d76f3d..7e8b51714fb 100644 --- a/storage/connect/tabrest.cpp +++ b/storage/connect/tabrest.cpp @@ -112,7 +112,11 @@ int Xcurl(PGLOBAL g, PCSZ Http, PCSZ Uri, PCSZ filename) } // endif f - pID = vfork(); +#ifdef HAVE_VFORK + pID = vfork(); +#else + pID = fork(); +#endif sprintf(fn, "-o%s", filename); if (pID == 0) { |