summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/mysql.cc6
-rw-r--r--dbug/dbug.c146
-rw-r--r--extra/mariabackup/backup_copy.cc31
m---------libmariadb0
-rw-r--r--man/mysql-test-run.pl.16
-rwxr-xr-xmysql-test/mysql-test-run.pl196
-rw-r--r--mysql-test/r/mysqld--help.result2
-rw-r--r--mysql-test/r/order_by.result30
-rw-r--r--mysql-test/suite/galera/disabled.def2
-rw-r--r--mysql-test/suite/galera/galera_2nodes.cnf11
-rw-r--r--mysql-test/suite/galera/r/MW-284.result11
-rw-r--r--mysql-test/suite/galera/r/MW-328C.result23
-rw-r--r--mysql-test/suite/galera/r/MW-44.result13
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave_ctas.result14
-rw-r--r--mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result21
-rw-r--r--mysql-test/suite/galera/r/galera_forced_binlog_format.result6
-rw-r--r--mysql-test/suite/galera/r/galera_gtid.result10
-rw-r--r--mysql-test/suite/galera/r/galera_log_bin.result2
-rw-r--r--mysql-test/suite/galera/r/galera_var_dirty_reads.result7
-rw-r--r--mysql-test/suite/galera/r/galera_var_notify_cmd.result17
-rw-r--r--mysql-test/suite/galera/r/galera_var_reject_queries.result5
-rw-r--r--mysql-test/suite/galera/r/galera_wsrep_new_cluster.result2
-rw-r--r--mysql-test/suite/galera/t/MW-284.test16
-rw-r--r--mysql-test/suite/galera/t/MW-313-master.opt1
-rw-r--r--mysql-test/suite/galera/t/MW-313.cnf12
-rw-r--r--mysql-test/suite/galera/t/MW-328C.test36
-rw-r--r--mysql-test/suite/galera/t/MW-329-master.opt1
-rw-r--r--mysql-test/suite/galera/t/MW-329.cnf9
-rw-r--r--mysql-test/suite/galera/t/MW-44-master.opt1
-rw-r--r--mysql-test/suite/galera/t/MW-44.test30
-rw-r--r--mysql-test/suite/galera/t/MW-86-wait1-master.opt1
-rw-r--r--mysql-test/suite/galera/t/MW-86-wait8-master.opt1
-rw-r--r--mysql-test/suite/galera/t/MW-86-wait8.cnf10
-rw-r--r--mysql-test/suite/galera/t/enforce_storage_engine2.cnf13
-rw-r--r--mysql-test/suite/galera/t/enforce_storage_engine2.opt2
-rw-r--r--mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.cnf14
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_ctas.cnf5
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_ctas.test75
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.cnf6
-rw-r--r--mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.test65
-rw-r--r--mysql-test/suite/galera/t/galera_bf_background_statistics.cnf9
-rw-r--r--mysql-test/suite/galera/t/galera_bf_background_statistics.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_checksum-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_checksum.cnf13
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_event_max_size_max.cnf9
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_event_max_size_min-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_binlog_event_max_size_min.cnf9
-rw-r--r--mysql-test/suite/galera/t/galera_flush-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_flush.cnf10
-rw-r--r--mysql-test/suite/galera/t/galera_flush_local.cnf12
-rw-r--r--mysql-test/suite/galera/t/galera_flush_local.opt3
-rw-r--r--mysql-test/suite/galera/t/galera_forced_binlog_format.test6
-rw-r--r--mysql-test/suite/galera/t/galera_gtid-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_gtid.cnf10
-rw-r--r--mysql-test/suite/galera/t/galera_gtid.test8
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin.cnf10
-rw-r--r--mysql-test/suite/galera/t/galera_log_bin.test5
-rw-r--r--mysql-test/suite/galera/t/galera_mdev_13787.cnf9
-rw-r--r--mysql-test/suite/galera/t/galera_mdev_13787.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_query_cache-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_query_cache.cnf10
-rw-r--r--mysql-test/suite/galera/t/galera_query_cache_sync_wait-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_query_cache_sync_wait.cnf10
-rw-r--r--mysql-test/suite/galera/t/galera_sbr_binlog-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_sbr_binlog.cnf7
-rw-r--r--mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf2
-rw-r--r--mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.opt2
-rw-r--r--mysql-test/suite/galera/t/galera_udf-master.opt2
-rw-r--r--mysql-test/suite/galera/t/galera_udf.cnf15
-rw-r--r--mysql-test/suite/galera/t/galera_v1_row_events-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_v1_row_events.cnf13
-rw-r--r--mysql-test/suite/galera/t/galera_var_auto_inc_control_on.cnf13
-rw-r--r--mysql-test/suite/galera/t/galera_var_auto_inc_control_on.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_var_dirty_reads.test9
-rw-r--r--mysql-test/suite/galera/t/galera_var_notify_cmd-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_var_notify_cmd.cnf13
-rw-r--r--mysql-test/suite/galera/t/galera_var_notify_cmd.test8
-rw-r--r--mysql-test/suite/galera/t/galera_var_reject_queries.test6
-rw-r--r--mysql-test/suite/galera/t/galera_var_sst_auth.cnf12
-rw-r--r--mysql-test/suite/galera/t/galera_var_sst_auth.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_wsrep_log_conficts-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_wsrep_log_conficts.cnf12
-rw-r--r--mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt1
-rw-r--r--mysql-test/suite/galera/t/galera_wsrep_new_cluster.cnf10
-rw-r--r--mysql-test/suite/galera/t/mysql-wsrep#201-master.opt1
-rw-r--r--mysql-test/suite/galera/t/mysql-wsrep#201.cnf9
-rw-r--r--mysql-test/suite/galera/t/query_cache.cnf9
-rw-r--r--mysql-test/suite/galera/t/query_cache.opt1
-rw-r--r--mysql-test/suite/innodb/r/innodb-32k-crash.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb-64k-crash.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb-mdev-7513.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result1
-rw-r--r--mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result1
-rw-r--r--mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result21
-rw-r--r--mysql-test/suite/innodb/r/undo_log.result1
-rw-r--r--mysql-test/suite/innodb/t/innodb-32k-crash.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-64k-crash.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-mdev-7513.test1
-rw-r--r--mysql-test/suite/innodb/t/innodb_max_recordsize_32k.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb_max_recordsize_64k.test2
-rw-r--r--mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test24
-rw-r--r--mysql-test/suite/innodb/t/undo_log.test2
-rw-r--r--mysql-test/suite/mariabackup/incremental_backup.result4
-rw-r--r--mysql-test/suite/mariabackup/incremental_backup.test63
-rw-r--r--mysql-test/suite/plugins/r/server_audit.result26
-rw-r--r--mysql-test/suite/plugins/t/server_audit.test20
-rw-r--r--mysql-test/suite/wsrep/disabled.def3
-rw-r--r--mysql-test/suite/wsrep/t/pool_of_threads.opt2
-rw-r--r--mysql-test/t/order_by.test16
-rw-r--r--scripts/mysql_install_db.sh2
-rw-r--r--sql/filesort.cc1
-rw-r--r--sql/item_cmpfunc.h2
-rw-r--r--sql/log_event.h3
-rw-r--r--sql/mysqld.cc4
-rw-r--r--sql/slave.cc33
-rw-r--r--sql/sql_insert.cc81
-rw-r--r--sql/sql_select.cc2
-rw-r--r--sql/wsrep_hton.cc21
-rw-r--r--sql/wsrep_mysqld.cc34
-rw-r--r--storage/connect/inihandl.cpp2
-rw-r--r--storage/innobase/gis/gis0geo.cc32
-rw-r--r--storage/innobase/handler/ha_innodb.cc15
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc6
-rw-r--r--storage/innobase/include/gis0geo.h13
-rw-r--r--storage/innobase/os/os0file.cc112
-rw-r--r--storage/innobase/os/os0thread.cc10
-rw-r--r--storage/spider/mysql-test/spider/r/pushdown_not_like.result63
-rw-r--r--storage/spider/mysql-test/spider/t/pushdown_not_like.test138
-rw-r--r--storage/spider/spd_db_include.h2
-rw-r--r--storage/spider/spd_db_mysql.cc16
133 files changed, 1503 insertions, 439 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 2247e93ca93..d672473798e 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -3213,7 +3213,7 @@ static int
com_go(String *buffer,char *line __attribute__((unused)))
{
char buff[200]; /* about 110 chars used so far */
- char time_buff[52+3+1]; /* time max + space&parens + NUL */
+ char time_buff[52+3+1]; /* time max + space & parens + NUL */
MYSQL_RES *result;
ulong timer, warnings= 0;
uint error= 0;
@@ -3232,7 +3232,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
if (buffer->is_empty())
{
- if (status.batch) // Ignore empty quries
+ if (status.batch) // Ignore empty queries.
return 0;
return put_info("No query specified\n",INFO_ERROR);
@@ -3297,7 +3297,7 @@ com_go(String *buffer,char *line __attribute__((unused)))
else
time_buff[0]= '\0';
- /* Every branch must truncate buff . */
+ /* Every branch must truncate buff. */
if (result)
{
if (!mysql_num_rows(result) && ! quick && !column_types_flag)
diff --git a/dbug/dbug.c b/dbug/dbug.c
index 9845fee0948..cde6363c86a 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -320,8 +320,36 @@ static void DbugVfprintf(FILE *stream, const char* format, va_list args);
*/
#include <my_pthread.h>
+/*
+** Protects writing to all file descriptors, init_settings.keywords
+** pointer and it's pointee - a linked list with keywords.
+*/
static pthread_mutex_t THR_LOCK_dbug;
+static void LockMutex(CODE_STATE *cs)
+{
+ if (!cs->locked)
+ pthread_mutex_lock(&THR_LOCK_dbug);
+ cs->locked++;
+}
+static void UnlockMutex(CODE_STATE *cs)
+{
+ --cs->locked;
+ assert(cs->locked >= 0);
+ if (cs->locked == 0)
+ pthread_mutex_unlock(&THR_LOCK_dbug);
+}
+static void LockIfInitSettings(CODE_STATE *cs)
+{
+ if (cs->stack == &init_settings)
+ LockMutex(cs);
+}
+static void UnlockIfInitSettings(CODE_STATE *cs)
+{
+ if (cs->stack == &init_settings)
+ UnlockMutex(cs);
+}
+
static CODE_STATE *code_state(void)
{
CODE_STATE *cs, **cs_ptr;
@@ -449,16 +477,9 @@ static int DbugParse(CODE_STATE *cs, const char *control)
const char *end;
int rel, f_used=0;
struct settings *stack;
- int org_cs_locked;
stack= cs->stack;
- if (!(org_cs_locked= cs->locked))
- {
- pthread_mutex_lock(&THR_LOCK_dbug);
- cs->locked= 1;
- }
-
if (control[0] == '-' && control[1] == '#')
control+=2;
@@ -472,7 +493,9 @@ static int DbugParse(CODE_STATE *cs, const char *control)
stack->sub_level= 0;
stack->out_file= sstderr;
stack->functions= NULL;
+ LockIfInitSettings(cs);
stack->keywords= NULL;
+ UnlockIfInitSettings(cs);
stack->processes= NULL;
}
else if (!stack->out_file)
@@ -488,7 +511,9 @@ static int DbugParse(CODE_STATE *cs, const char *control)
{
/* never share with the global parent - it can change under your feet */
stack->functions= ListCopy(init_settings.functions);
+ LockIfInitSettings(cs);
stack->keywords= ListCopy(init_settings.keywords);
+ UnlockIfInitSettings(cs);
stack->processes= ListCopy(init_settings.processes);
}
else
@@ -512,21 +537,31 @@ static int DbugParse(CODE_STATE *cs, const char *control)
case 'd':
if (sign < 0 && control == end)
{
+ LockIfInitSettings(cs);
if (!is_shared(stack, keywords))
FreeList(stack->keywords);
stack->keywords=NULL;
+ UnlockIfInitSettings(cs);
stack->flags &= ~DEBUG_ON;
break;
}
+ LockIfInitSettings(cs);
if (rel && is_shared(stack, keywords))
stack->keywords= ListCopy(stack->keywords);
+ UnlockIfInitSettings(cs);
if (sign < 0)
{
if (DEBUGGING)
+ {
+ LockIfInitSettings(cs);
stack->keywords= ListDel(stack->keywords, control, end);
+ UnlockIfInitSettings(cs);
+ }
break;
}
+ LockIfInitSettings(cs);
stack->keywords= ListAdd(stack->keywords, control, end);
+ UnlockIfInitSettings(cs);
stack->flags |= DEBUG_ON;
break;
case 'D':
@@ -661,11 +696,6 @@ static int DbugParse(CODE_STATE *cs, const char *control)
control=end+1;
end= DbugStrTok(control);
}
- if (!org_cs_locked)
- {
- cs->locked= 0;
- pthread_mutex_unlock(&THR_LOCK_dbug);
- }
return !rel || f_used;
}
@@ -998,7 +1028,9 @@ int _db_explain_ (CODE_STATE *cs, char *buf, size_t len)
get_code_state_if_not_set_or_return *buf=0;
+ LockIfInitSettings(cs);
op_list_to_buf('d', cs->stack->keywords, DEBUGGING);
+ UnlockIfInitSettings(cs);
op_int_to_buf ('D', cs->stack->delay, 0);
op_list_to_buf('f', cs->stack->functions, cs->stack->functions);
op_bool_to_buf('F', cs->stack->flags & FILE_ON);
@@ -1093,7 +1125,6 @@ int _db_explain_init_(char *buf, size_t len)
void _db_enter_(const char *_func_, const char *_file_,
uint _line_, struct _db_stack_frame_ *_stack_frame_)
{
- int save_errno, org_cs_locked;
CODE_STATE *cs;
if (!((cs=code_state())))
{
@@ -1101,7 +1132,6 @@ void _db_enter_(const char *_func_, const char *_file_,
_stack_frame_->prev= 0;
return;
}
- save_errno= errno;
_stack_frame_->line= -1;
_stack_frame_->func= cs->func;
@@ -1122,20 +1152,14 @@ void _db_enter_(const char *_func_, const char *_file_,
cs->stack->flags &= ~SANITY_CHECK_ON;
if (TRACING)
{
- if (!(org_cs_locked= cs->locked))
- {
- pthread_mutex_lock(&THR_LOCK_dbug);
- cs->locked= 1;
- }
+ int save_errno= errno;
+ LockMutex(cs);
DoPrefix(cs, _line_);
Indent(cs, cs->level);
(void) fprintf(cs->stack->out_file->file, ">%s\n", cs->func);
- DbugFlush(cs); /* This does a unlock */
- if (!org_cs_locked)
- {
- cs->locked= 0;
- pthread_mutex_unlock(&THR_LOCK_dbug);
- }
+ UnlockMutex(cs);
+ DbugFlush(cs);
+ errno=save_errno;
}
break;
case DISABLE_TRACE:
@@ -1144,7 +1168,6 @@ void _db_enter_(const char *_func_, const char *_file_,
case DONT_TRACE:
break;
}
- errno=save_errno;
}
/*
@@ -1169,7 +1192,6 @@ void _db_enter_(const char *_func_, const char *_file_,
void _db_return_(struct _db_stack_frame_ *_stack_frame_)
{
- int save_errno=errno;
uint _slevel_= _stack_frame_->level & ~TRACE_ON;
CODE_STATE *cs;
get_code_state_or_return;
@@ -1186,25 +1208,18 @@ void _db_return_(struct _db_stack_frame_ *_stack_frame_)
if (DoTrace(cs) & DO_TRACE)
{
- int org_cs_locked;
if ((cs->stack->flags & SANITY_CHECK_ON) && sf_sanity())
cs->stack->flags &= ~SANITY_CHECK_ON;
if (TRACING)
{
- if (!(org_cs_locked= cs->locked))
- {
- pthread_mutex_lock(&THR_LOCK_dbug);
- cs->locked= 1;
- }
+ int save_errno=errno;
+ LockMutex(cs);
DoPrefix(cs, _stack_frame_->line);
Indent(cs, cs->level);
(void) fprintf(cs->stack->out_file->file, "<%s\n", cs->func);
+ UnlockMutex(cs);
DbugFlush(cs);
- if (!org_cs_locked)
- {
- cs->locked= 0;
- pthread_mutex_unlock(&THR_LOCK_dbug);
- }
+ errno=save_errno;
}
}
/*
@@ -1216,7 +1231,6 @@ void _db_return_(struct _db_stack_frame_ *_stack_frame_)
cs->file= _stack_frame_->file;
if (cs->framep != NULL)
cs->framep= cs->framep->prev;
- errno=save_errno;
}
@@ -1281,18 +1295,14 @@ void _db_doprnt_(const char *format,...)
{
va_list args;
CODE_STATE *cs;
- int save_errno, org_cs_locked;
+ int save_errno;
get_code_state_or_return;
va_start(args,format);
- if (!(org_cs_locked= cs->locked))
- {
- pthread_mutex_lock(&THR_LOCK_dbug);
- cs->locked= 1;
- }
save_errno=errno;
+ LockMutex(cs);
DoPrefix(cs, cs->u_line);
if (TRACING)
Indent(cs, cs->level + 1);
@@ -1300,12 +1310,8 @@ void _db_doprnt_(const char *format,...)
(void) fprintf(cs->stack->out_file->file, "%s: ", cs->func);
(void) fprintf(cs->stack->out_file->file, "%s: ", cs->u_keyword);
DbugVfprintf(cs->stack->out_file->file, format, args);
+ UnlockMutex(cs);
DbugFlush(cs);
- if (!org_cs_locked)
- {
- cs->locked= 0;
- pthread_mutex_unlock(&THR_LOCK_dbug);
- }
errno=save_errno;
va_end(args);
@@ -1345,17 +1351,13 @@ static void DbugVfprintf(FILE *stream, const char* format, va_list args)
void _db_dump_(uint _line_, const char *keyword,
const unsigned char *memory, size_t length)
{
- int pos, org_cs_locked;
+ int pos;
CODE_STATE *cs;
get_code_state_or_return;
- if (!(org_cs_locked= cs->locked))
- {
- pthread_mutex_lock(&THR_LOCK_dbug);
- cs->locked= 1;
- }
if (_db_keyword_(cs, keyword, 0))
{
+ LockMutex(cs);
DoPrefix(cs, _line_);
if (TRACING)
{
@@ -1383,13 +1385,9 @@ void _db_dump_(uint _line_, const char *keyword,
fputc(' ',cs->stack->out_file->file);
}
(void) fputc('\n',cs->stack->out_file->file);
+ UnlockMutex(cs);
DbugFlush(cs);
}
- if (!org_cs_locked)
- {
- cs->locked= 0;
- pthread_mutex_unlock(&THR_LOCK_dbug);
- }
}
@@ -1617,8 +1615,10 @@ static void PushState(CODE_STATE *cs)
static void FreeState(CODE_STATE *cs, int free_state)
{
struct settings *state= cs->stack;
+ LockIfInitSettings(cs);
if (!is_shared(state, keywords))
FreeList(state->keywords);
+ UnlockIfInitSettings(cs);
if (!is_shared(state, functions))
FreeList(state->functions);
if (!is_shared(state, processes))
@@ -1697,8 +1697,6 @@ void _db_end_()
static int DoTrace(CODE_STATE *cs)
{
int res= DONT_TRACE;
- if (!cs->locked)
- pthread_mutex_lock(&THR_LOCK_dbug);
if ((cs->stack->maxdepth == 0 || cs->level <= cs->stack->maxdepth) &&
InList(cs->stack->processes, cs->process, 0) & (MATCHED|INCLUDE))
{
@@ -1723,8 +1721,6 @@ static int DoTrace(CODE_STATE *cs)
break;
}
}
- if (!cs->locked)
- pthread_mutex_unlock(&THR_LOCK_dbug);
return res;
}
@@ -1764,11 +1760,9 @@ BOOLEAN _db_keyword_(CODE_STATE *cs, const char *keyword, int strict)
if (!(DEBUGGING && (DoTrace(cs) & DO_TRACE)))
return 0;
- if (!cs->locked)
- pthread_mutex_lock(&THR_LOCK_dbug);
+ LockIfInitSettings(cs);
res= (InList(cs->stack->keywords, keyword, strict) & match);
- if (!cs->locked)
- pthread_mutex_unlock(&THR_LOCK_dbug);
+ UnlockIfInitSettings(cs);
return res != 0;
}
@@ -1995,16 +1989,16 @@ static void DBUGCloseFile(CODE_STATE *cs, sFILE *new_value)
sFILE *fp;
if (!cs || !cs->stack || !cs->stack->out_file)
return;
- if (!cs->locked)
- pthread_mutex_lock(&THR_LOCK_dbug);
fp= cs->stack->out_file;
if (--fp->used == 0)
{
if (fclose(fp->file) == EOF)
{
+ LockMutex(cs);
(void) fprintf(stderr, ERR_CLOSE, cs->process);
perror("");
+ UnlockMutex(cs);
}
else
{
@@ -2012,8 +2006,6 @@ static void DBUGCloseFile(CODE_STATE *cs, sFILE *new_value)
}
}
cs->stack->out_file= new_value;
- if (!cs->locked)
- pthread_mutex_unlock(&THR_LOCK_dbug);
}
@@ -2196,9 +2188,7 @@ void _db_flush_()
get_code_state_or_return;
if (DEBUGGING)
{
- pthread_mutex_lock(&THR_LOCK_dbug);
(void) fflush(cs->stack->out_file->file);
- pthread_mutex_unlock(&THR_LOCK_dbug);
}
}
@@ -2226,16 +2216,14 @@ void _db_lock_file_()
{
CODE_STATE *cs;
get_code_state_or_return;
- pthread_mutex_lock(&THR_LOCK_dbug);
- cs->locked=1;
+ LockMutex(cs);
}
void _db_unlock_file_()
{
CODE_STATE *cs;
get_code_state_or_return;
- cs->locked=0;
- pthread_mutex_unlock(&THR_LOCK_dbug);
+ UnlockMutex(cs);
}
const char* _db_get_func_(void)
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc
index 524177d7e33..6f9452ef76c 100644
--- a/extra/mariabackup/backup_copy.cc
+++ b/extra/mariabackup/backup_copy.cc
@@ -1669,6 +1669,9 @@ ibx_copy_incremental_over_full()
}
}
+ if (!(ret = backup_files_from_datadir(xtrabackup_incremental_dir)))
+ goto cleanup;
+
/* copy buffer pool dump */
if (innobase_buffer_pool_filename) {
const char *src_name;
@@ -2180,20 +2183,26 @@ static bool backup_files_from_datadir(const char *dir_path)
if (info.type != OS_FILE_TYPE_FILE)
continue;
- const char *pname = strrchr(info.name, IF_WIN('\\', '/'));
+ const char *pname = strrchr(info.name, OS_PATH_SEPARATOR);
if (!pname)
pname = info.name;
- /* Copy aria log files, and aws keys for encryption plugins.*/
- const char *prefixes[] = { "aria_log", "aws-kms-key" };
- for (size_t i = 0; i < array_elements(prefixes); i++) {
- if (starts_with(pname, prefixes[i])) {
- ret = copy_file(ds_data, info.name, info.name, 1);
- if (!ret) {
- break;
- }
- }
- }
+ if (!starts_with(pname, "aws-kms-key") &&
+ !starts_with(pname, "aria_log"))
+ /* For ES exchange the above line with the following code:
+ (!xtrabackup_prepare || !xtrabackup_incremental_dir ||
+ !starts_with(pname, "aria_log")))
+ */
+ continue;
+
+ if (xtrabackup_prepare && xtrabackup_incremental_dir &&
+ file_exists(info.name))
+ unlink(info.name);
+
+ std::string full_path(dir_path);
+ full_path.append(1, OS_PATH_SEPARATOR).append(info.name);
+ if (!(ret = copy_file(ds_data, full_path.c_str() , info.name, 1)))
+ break;
}
os_file_closedir(dir);
return ret;
diff --git a/libmariadb b/libmariadb
-Subproject 980f2dbea6586091333057bb2994b1874746694
+Subproject f035fc5f7fda5ac01d557073ef219c7e8d65fe1
diff --git a/man/mysql-test-run.pl.1 b/man/mysql-test-run.pl.1
index a2153ac57fe..e5489e5219e 100644
--- a/man/mysql-test-run.pl.1
+++ b/man/mysql-test-run.pl.1
@@ -1937,8 +1937,10 @@ Run stress test, providing options to mysql\-stress\-test\&.pl\&. Options are se
.\" suite option: mysql-test-run.pl
\fB\-\-suite[s]=\fR\fB\fIsuite_name...\fR\fR
.sp
-Comma separated list of suite names to run. The default is: "main-,archive-,binlog-,csv-,federated-,funcs_1-,funcs_2-,handler-,heap-,innodb-,innodb_fts-,
-innodb_zip-,maria-,multi_source-,optimizer_unfixed_bugs-,parts-,percona-,perfschema-,
+Comma separated list of suite names to run. The default is:
+"main-,archive-,binlog-,csv-,federated-,funcs_1-,funcs_2-,
+handler-,heap-,innodb-,innodb_fts-,innodb_zip-,maria-,
+multi_source-,optimizer_unfixed_bugs-,parts-,perfschema-,
plugins-,roles-,rpl-,sys_vars-,unit-,vcol-"\&.
.RE
.sp
diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl
index e1561d6794a..aae2e20e23c 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -321,7 +321,8 @@ my $opt_valgrind_mysqld= 0;
my $opt_valgrind_mysqltest= 0;
my @valgrind_args;
my $opt_strace= 0;
-my $opt_strace_client;
+my $opt_stracer;
+my $opt_client_strace = 0;
my @strace_args;
my $opt_valgrind_path;
my $valgrind_reports= 0;
@@ -1324,9 +1325,10 @@ sub command_line_setup {
'debugger=s' => \$opt_debugger,
'boot-dbx' => \$opt_boot_dbx,
'client-debugger=s' => \$opt_client_debugger,
- 'strace' => \$opt_strace,
- 'strace-client' => \$opt_strace_client,
- 'strace-option=s' => \@strace_args,
+ 'strace' => \$opt_strace,
+ 'strace-option=s' => \@strace_args,
+ 'client-strace' => \$opt_client_strace,
+ 'stracer=s' => \$opt_stracer,
'max-save-core=i' => \$opt_max_save_core,
'max-save-datadir=i' => \$opt_max_save_datadir,
'max-test-fail=i' => \$opt_max_test_fail,
@@ -1921,7 +1923,7 @@ sub command_line_setup {
join(" ", @valgrind_args), "\"");
}
- if (@strace_args)
+ if (@strace_args || $opt_stracer)
{
$opt_strace=1;
}
@@ -3055,15 +3057,43 @@ sub mysql_server_start($) {
# Save this test case information, so next can examine it
$mysqld->{'started_tinfo'}= $tinfo;
}
+
+ # If wsrep is on, we need to wait until the first
+ # server starts and bootstraps the cluster before
+ # starting other servers. The bootsrap server in the
+ # configuration should always be the first which has
+ # wsrep_on=ON
+ if (wsrep_on($mysqld) && wsrep_is_bootstrap_server($mysqld))
+ {
+ mtr_verbose("Waiting for wsrep bootstrap server to start");
+ if ($mysqld->{WAIT}->($mysqld))
+ {
+ return 1;
+ }
+ }
}
sub mysql_server_wait {
- my ($mysqld) = @_;
+ my ($mysqld, $tinfo) = @_;
- return not sleep_until_file_created($mysqld->value('pid-file'),
+ if (!sleep_until_file_created($mysqld->value('pid-file'),
$opt_start_timeout,
$mysqld->{'proc'},
- $warn_seconds);
+ $warn_seconds))
+ {
+ $tinfo->{comment}= "Failed to start ".$mysqld->name() . "\n";
+ return 1;
+ }
+
+ if (wsrep_on($mysqld))
+ {
+ mtr_verbose("Waiting for wsrep server " . $mysqld->name() . " to be ready");
+ if (!wait_wsrep_ready($tinfo, $mysqld))
+ {
+ return 1;
+ }
+ }
+ return 0;
}
sub create_config_file_for_extern {
@@ -5577,6 +5607,118 @@ sub stop_servers($$) {
}
}
+#
+# run_query_output
+#
+# Run a query against a server using mysql client. The output of
+# the query will be written into outfile.
+#
+sub run_query_output {
+ my ($mysqld, $query, $outfile)= @_;
+ my $args;
+
+ mtr_init_args(\$args);
+ mtr_add_arg($args, "--defaults-file=%s", $path_config_file);
+ mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld'));
+ mtr_add_arg($args, "--silent");
+ mtr_add_arg($args, "--execute=%s", $query);
+
+ my $res= My::SafeProcess->run
+ (
+ name => "run_query_output -> ".$mysqld->name(),
+ path => $exe_mysql,
+ args => \$args,
+ output => $outfile,
+ error => $outfile
+ );
+
+ return $res
+}
+
+
+#
+# wsrep_wait_ready
+#
+# Wait until the server has been joined to the cluster and is
+# ready for operation.
+#
+# RETURN
+# 1 Server is ready
+# 0 Server didn't transition to ready state within start timeout
+#
+sub wait_wsrep_ready($$) {
+ my ($tinfo, $mysqld)= @_;
+
+ my $sleeptime= 100; # Milliseconds
+ my $loops= ($opt_start_timeout * 1000) / $sleeptime;
+
+ my $name= $mysqld->name();
+ my $outfile= "$opt_vardir/tmp/$name.wsrep_ready";
+ my $query= "SET SESSION wsrep_sync_wait = 0;
+ SELECT VARIABLE_NAME, VARIABLE_VALUE
+ FROM INFORMATION_SCHEMA.GLOBAL_STATUS
+ WHERE VARIABLE_NAME = 'wsrep_ready'";
+
+ for (my $loop= 1; $loop <= $loops; $loop++)
+ {
+ # Careful... if MTR runs with option 'verbose' then the
+ # file contains also SafeProcess verbose output
+ if (run_query_output($mysqld, $query, $outfile) == 0 &&
+ mtr_grab_file($outfile) =~ /WSREP_READY\s+ON/)
+ {
+ unlink($outfile);
+ return 1;
+ }
+ mtr_milli_sleep($sleeptime);
+ }
+
+ $tinfo->{logfile}= "WSREP did not transition to state READY";
+ return 0;
+}
+
+#
+# wsrep_is_bootstrap_server
+#
+# Check if the server is the first one to be started in the
+# cluster.
+#
+# RETURN
+# 1 The server is a bootstrap server
+# 0 The server is not a bootstrap server
+#
+sub wsrep_is_bootstrap_server($) {
+ my $mysqld= shift;
+
+ my $cluster_address= $mysqld->if_exist('wsrep-cluster-address') ||
+ $mysqld->if_exist('wsrep_cluster_address');
+ if (defined $cluster_address)
+ {
+ return $cluster_address eq "gcomm://" || $cluster_address eq "'gcomm://'";
+ }
+ return 0;
+}
+
+#
+# wsrep_on
+#
+# Check if wsrep has been enabled for a server.
+#
+# RETURN
+# 1 Wsrep has been enabled
+# 0 Wsrep is not enabled
+#
+sub wsrep_on($) {
+ my $mysqld= shift;
+ #check if wsrep_on= is set in configuration
+ if ($mysqld->if_exist('wsrep-on')) {
+ my $on= "".$mysqld->value('wsrep-on');
+ if ($on eq "1" || $on eq "ON") {
+ return 1;
+ }
+ }
+ return 0;
+}
+
#
# start_servers
@@ -5596,7 +5738,7 @@ sub start_servers($) {
for (all_servers()) {
next unless $_->{WAIT} and started($_);
- if ($_->{WAIT}->($_)) {
+ if ($_->{WAIT}->($_, $tinfo)) {
$tinfo->{comment}= "Failed to start ".$_->name() . "\n";
return 1;
}
@@ -5705,14 +5847,6 @@ sub start_mysqltest ($) {
mtr_add_arg($args, "--non-blocking-api");
}
- if ( $opt_strace_client )
- {
- $exe= $opt_strace_client || "strace";
- mtr_add_arg($args, "-o");
- mtr_add_arg($args, "%s/log/mysqltest.strace", $opt_vardir);
- mtr_add_arg($args, "$exe_mysqltest");
- }
-
mtr_add_arg($args, "--timer-file=%s/log/timer", $opt_vardir);
if ( $opt_compress )
@@ -5778,6 +5912,17 @@ sub start_mysqltest ($) {
mtr_add_arg($args, "%s", $_) for @args_saved;
}
+ # ----------------------------------------------------------------------
+ # Prefix the strace options to the argument list.
+ # ----------------------------------------------------------------------
+ if ( $opt_client_strace )
+ {
+ my @args_saved = @$args;
+ mtr_init_args(\$args);
+ strace_arguments($args, \$exe, "mysqltest");
+ mtr_add_arg($args, "%s", $_) for @args_saved;
+ }
+
if ($opt_force > 1)
{
mtr_add_arg($args, "--continue-on-error");
@@ -6102,16 +6247,17 @@ sub strace_arguments {
my $args= shift;
my $exe= shift;
my $mysqld_name= shift;
+ my $output= sprintf("%s/log/%s.strace", $path_vardir_trace, $mysqld_name);
mtr_add_arg($args, "-f");
- mtr_add_arg($args, "-o%s/var/log/%s.strace", $glob_mysql_test_dir, $mysqld_name);
+ mtr_add_arg($args, "-o%s", $output);
- # Add strace options, can be overridden by user
+ # Add strace options
mtr_add_arg($args, '%s', $_) for (@strace_args);
mtr_add_arg($args, $$exe);
- $$exe= "strace";
+ $$exe= $opt_stracer || "strace";
if ($exe_libtool)
{
@@ -6387,11 +6533,11 @@ Options for valgrind
Options for strace
strace Run the "mysqld" executables using strace. Default
- options are -f -o var/log/'mysqld-name'.strace
- strace-option=ARGS Option to give strace, replaces default option(s),
- strace-client=[path] Create strace output for mysqltest client, optionally
- specifying name and path to the trace program to use.
- Example: $0 --strace-client=ktrace
+ options are -f -o 'vardir'/log/'mysqld-name'.strace.
+ client-strace Trace the "mysqltest".
+ strace-option=ARGS Option to give strace, appends to existing options.
+ stracer=<EXE> Specify name and path to the trace program to use.
+ Default is "strace". Example: $0 --stracer=ktrace.
Misc options
user=USER User for connecting to mysqld(default: $opt_user)
diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result
index 8bdf994f908..6ac6f34f74e 100644
--- a/mysql-test/r/mysqld--help.result
+++ b/mysql-test/r/mysqld--help.result
@@ -1544,5 +1544,5 @@ userstat FALSE
verbose TRUE
wait-timeout 28800
-To see what values a running MySQL server is using, type
+To see what variables a running MySQL server is using, type
'mysqladmin variables' instead of 'mysqld --verbose --help'.
diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result
index 28b63dab22e..e739b278746 100644
--- a/mysql-test/r/order_by.result
+++ b/mysql-test/r/order_by.result
@@ -3206,6 +3206,36 @@ pk
3
DROP TABLE t1;
#
+# MDEV-21044: Wrong result when using a smaller size for sort buffer
+#
+create table t1(a varchar(765),b int);
+insert into t1 values ("a",1),("b",2),("c",3),("e",4);
+insert into t1 values ("d",5),("f",6),("g",7),("h",8);
+insert into t1 values ("k",11),("l",12),("i",9),("j",10);
+insert into t1 values ("m",13),("n",14),("o",15),("p",16);
+set @save_sort_buffer_size= @@sort_buffer_size;
+set sort_buffer_size=1024;
+select * from t1 order by b;
+a b
+a 1
+b 2
+c 3
+e 4
+d 5
+f 6
+g 7
+h 8
+i 9
+j 10
+k 11
+l 12
+m 13
+n 14
+o 15
+p 16
+set @@sort_buffer_size= @save_sort_buffer_size;
+drop table t1;
+#
# MDEV-13994: Bad join results with orderby_uses_equalities=on
#
CREATE TABLE books (
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index f6853e35ca3..ebe8d2ac2d3 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -10,6 +10,7 @@
#
##############################################################################
+MW-286 : MDEV-18464 Killing thread can cause mutex deadlock if done concurrently with Galera/replication victim kill
MW-329 : MDEV-19962 Galera test failure on MW-329
MW-388: MDEV-19803 Long semaphore wait error on galera.MW-388
galera_account_management : MariaDB 10.0 does not support ALTER USER
@@ -17,6 +18,7 @@ galera_as_master_gtid : Requires MySQL GTID
galera_as_master_gtid_change_master : Requires MySQL GTID
galera_as_slave_preordered : wsrep-preordered feature not merged to MariaDB
galera_as_slave_replication_bundle : MDEV-15785 OPTION_GTID_BEGIN is set in Gtid_log_event::do_apply_event()
+galera_autoinc_sst_mariabackup : Known issue, may require porting MDEV-17458 from later versions
galera_binlog_rows_query_log_events: MariaDB does not support binlog_rows_query_log_events
galera_binlog_stmt_autoinc: MDEV-19959 Galera test failure on galera_binlog_stmt_autoinc
galera_flush : MariaDB does not have global.thread_statistics
diff --git a/mysql-test/suite/galera/galera_2nodes.cnf b/mysql-test/suite/galera/galera_2nodes.cnf
index b24f3603894..67e9893179f 100644
--- a/mysql-test/suite/galera/galera_2nodes.cnf
+++ b/mysql-test/suite/galera/galera_2nodes.cnf
@@ -2,7 +2,7 @@
!include include/default_mysqld.cnf
[mysqld]
-wsrep-on=1
+loose-innodb
binlog-format=row
innodb-autoinc-lock-mode=2
default-storage-engine=innodb
@@ -12,18 +12,26 @@ wsrep_node_address=127.0.0.1
wsrep-sync-wait=15
[mysqld.1]
+loose-innodb
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
+wsrep-on=1
wsrep-cluster-address=gcomm://
wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M'
wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
+# enforce read-committed characteristics across the cluster
+wsrep_causal_reads=ON
+wsrep_sync_wait = 15
+
[mysqld.2]
+loose-innodb
#galera_port=@OPT.port
#ist_port=@OPT.port
#sst_port=@OPT.port
+wsrep-on=1
wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port'
wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S'
@@ -36,7 +44,6 @@ wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port
wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
-
[ENV]
NODE_MYPORT_1= @mysqld.1.port
NODE_MYSOCK_1= @mysqld.1.socket
diff --git a/mysql-test/suite/galera/r/MW-284.result b/mysql-test/suite/galera/r/MW-284.result
index 0f6c0be25fe..6f7bdf3917a 100644
--- a/mysql-test/suite/galera/r/MW-284.result
+++ b/mysql-test/suite/galera/r/MW-284.result
@@ -1,4 +1,6 @@
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+call mtr.add_suppression("\\[ERROR\\] Error reading packet from server: WSREP has not yet prepared node for application use .*");
+call mtr.add_suppression("WSREP has not yet prepared node for application use");
connection node_1;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
SET GLOBAL wsrep_provider_options='gmcast.isolate=1';
@@ -6,6 +8,9 @@ SET SESSION wsrep_on = OFF;
SET SESSION wsrep_on = ON;
SET global wsrep_sync_wait=0;
connection node_3;
+SELECT @@wsrep_on;
+@@wsrep_on
+0
START SLAVE;
include/wait_for_slave_param.inc [Slave_IO_Running]
connection node_1;
@@ -22,9 +27,3 @@ connection node_3;
STOP SLAVE;
RESET SLAVE ALL;
CALL mtr.add_suppression('failed registering on master');
-CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work');
-connection node_1;
-RESET MASTER;
-CALL mtr.add_suppression('WSREP: Last Applied Action message in non-primary configuration from member');
-connection node_2;
-CALL mtr.add_suppression('WSREP: Last Applied Action message in non-primary configuration from member');
diff --git a/mysql-test/suite/galera/r/MW-328C.result b/mysql-test/suite/galera/r/MW-328C.result
deleted file mode 100644
index f8d747c5df1..00000000000
--- a/mysql-test/suite/galera/r/MW-328C.result
+++ /dev/null
@@ -1,23 +0,0 @@
-CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB;
-INSERT INTO t1 (f1) VALUES (1);
-CREATE TABLE t2 (f1 CHAR(20)) ENGINE=InnoDB;
-CREATE PROCEDURE proc_update ()
-BEGIN
-DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END;
-SET SESSION wsrep_sync_wait = 0;
-WHILE 1 DO
-UPDATE t1 SET f2 = LEFT(MD5(RAND()), 4);
-END WHILE;
-END|
-connect node_1X, 127.0.0.1, root, , test, $NODE_MYPORT_1;
-connection node_1X;
-CALL proc_update();;
-connection node_2;
-SET SESSION wsrep_retry_autocommit = 10000;
-connection node_1;
-connection node_1X;
-Got one of the listed errors
-connection node_1;
-DROP PROCEDURE proc_update;
-DROP TABLE t1, t2;
-CALL mtr.add_suppression("conflict state ABORTED after post commit");
diff --git a/mysql-test/suite/galera/r/MW-44.result b/mysql-test/suite/galera/r/MW-44.result
index 83668339310..7335acc445a 100644
--- a/mysql-test/suite/galera/r/MW-44.result
+++ b/mysql-test/suite/galera/r/MW-44.result
@@ -1,24 +1,11 @@
connection node_1;
TRUNCATE TABLE mysql.general_log;
connection node_2;
-TRUNCATE TABLE mysql.general_log;
connection node_1;
-SELECT Argument FROM mysql.general_log;
-Argument
-SET GLOBAL general_log='ON';
SET SESSION wsrep_osu_method=TOI;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
SET SESSION wsrep_osu_method=RSU;
ALTER TABLE t1 ADD COLUMN f2 INTEGER;
SET SESSION wsrep_osu_method=TOI;
-SELECT argument FROM mysql.general_log WHERE argument LIKE 'CREATE%' OR argument LIKE 'ALTER%';
-argument
-CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB
-ALTER TABLE t1 ADD COLUMN f2 INTEGER
connection node_2;
-SELECT Argument FROM mysql.general_log;
-Argument
DROP TABLE t1;
-SET GLOBAL general_log='OFF';
-connection node_1;
-SET GLOBAL general_log='OFF';
diff --git a/mysql-test/suite/galera/r/galera_as_slave_ctas.result b/mysql-test/suite/galera/r/galera_as_slave_ctas.result
new file mode 100644
index 00000000000..79114824008
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_slave_ctas.result
@@ -0,0 +1,14 @@
+START SLAVE;
+SHOW VARIABLES LIKE 'binlog_format';
+Variable_name Value
+binlog_format ROW
+CREATE TABLE source (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE target AS SELECT * FROM source;
+DROP TABLE target;
+INSERT INTO source VALUES(1);
+CREATE TABLE target AS SELECT * FROM source;
+DROP TABLE source;
+DROP TABLE target;
+STOP SLAVE;
+RESET SLAVE ALL;
+RESET MASTER;
diff --git a/mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result b/mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result
new file mode 100644
index 00000000000..d9a87571655
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result
@@ -0,0 +1,21 @@
+ALTER TABLE mysql.gtid_slave_pos engine = InnoDB;
+START SLAVE;
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t1 VALUES(1);
+SELECT LENGTH(@@global.gtid_binlog_state) > 1;
+LENGTH(@@global.gtid_binlog_state) > 1
+1
+gtid_binlog_state_equal
+0
+SELECT COUNT(*) = 0 FROM t1;
+COUNT(*) = 0
+1
+gtid_binlog_state_equal
+0
+#cleanup
+DROP TABLE t1;
+reset master;
+STOP SLAVE;
+RESET SLAVE ALL;
+reset master;
+reset master;
diff --git a/mysql-test/suite/galera/r/galera_forced_binlog_format.result b/mysql-test/suite/galera/r/galera_forced_binlog_format.result
index b94e6530886..2a31893ca1d 100644
--- a/mysql-test/suite/galera/r/galera_forced_binlog_format.result
+++ b/mysql-test/suite/galera/r/galera_forced_binlog_format.result
@@ -1,13 +1,11 @@
connection node_1;
+SET SESSION wsrep_on=OFF;
RESET MASTER;
+SET SESSION wsrep_on=ON;
SET SESSION binlog_format = 'STATEMENT';
-Warnings:
-Warning 1105 MariaDB Galera and flashback do not support binlog format: STATEMENT
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
SET SESSION binlog_format = 'MIXED';
-Warnings:
-Warning 1105 MariaDB Galera and flashback do not support binlog format: MIXED
INSERT INTO t1 VALUES (2);
SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256;
Log_name Pos Event_type Server_id End_log_pos Info
diff --git a/mysql-test/suite/galera/r/galera_gtid.result b/mysql-test/suite/galera/r/galera_gtid.result
index acc5eae9876..0346abc5a6c 100644
--- a/mysql-test/suite/galera/r/galera_gtid.result
+++ b/mysql-test/suite/galera/r/galera_gtid.result
@@ -1,14 +1,12 @@
CREATE TABLE t1 (f1 INT PRIMARY KEY);
INSERT INTO t1 VALUES (1);
connection node_2;
-SELECT COUNT(*) = 1 FROM t1;
-COUNT(*) = 1
-1
UPDATE t1 SET f1 = 2;
connection node_1;
-SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
-COUNT(*) = 1
-1
+SET SESSION wsrep_sync_wait = 15;
+SELECT * from t1;
+f1
+2
gtid_binlog_state_equal
1
DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_log_bin.result b/mysql-test/suite/galera/r/galera_log_bin.result
index 2fb59fc200f..eb009a620e0 100644
--- a/mysql-test/suite/galera/r/galera_log_bin.result
+++ b/mysql-test/suite/galera/r/galera_log_bin.result
@@ -71,5 +71,3 @@ DROP TABLE t2;
#cleanup
connection node_1;
RESET MASTER;
-connection node_2;
-reset master;
diff --git a/mysql-test/suite/galera/r/galera_var_dirty_reads.result b/mysql-test/suite/galera/r/galera_var_dirty_reads.result
index 020efb7b8f1..50938d61a4b 100644
--- a/mysql-test/suite/galera/r/galera_var_dirty_reads.result
+++ b/mysql-test/suite/galera/r/galera_var_dirty_reads.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("WSREP has not yet prepared node for application use");
connection node_1;
connection node_2;
connection node_2;
@@ -16,9 +17,9 @@ SHOW STATUS LIKE 'wsrep_cluster_status';
Variable_name Value
wsrep_cluster_status non-Primary
SELECT * FROM t1;
-ERROR 08S01: WSREP has not yet prepared node for application use
+Got one of the listed errors
SELECT 1 FROM t1;
-ERROR 08S01: WSREP has not yet prepared node for application use
+Got one of the listed errors
SET @@session.wsrep_dirty_reads=ON;
SELECT * FROM t1;
i
@@ -31,7 +32,7 @@ i variable_name variable_value
1 WSREP_DIRTY_READS ON
SET @@session.wsrep_dirty_reads=OFF;
SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1;
-ERROR 08S01: WSREP has not yet prepared node for application use
+Got one of the listed errors
SELECT 1;
1
1
diff --git a/mysql-test/suite/galera/r/galera_var_notify_cmd.result b/mysql-test/suite/galera/r/galera_var_notify_cmd.result
index 3f0dd57aa3b..2b390d0db8d 100644
--- a/mysql-test/suite/galera/r/galera_var_notify_cmd.result
+++ b/mysql-test/suite/galera/r/galera_var_notify_cmd.result
@@ -1,10 +1,11 @@
connection node_1;
-SELECT COUNT(DISTINCT uuid) = 2 FROM mtr_wsrep_notify.membership;
-COUNT(DISTINCT uuid) = 2
-1
-SELECT MAX(size) = 2 FROM mtr_wsrep_notify.status;
-MAX(size) = 2
-1
-SELECT COUNT(DISTINCT idx) = 2 FROM mtr_wsrep_notify.status;
-COUNT(DISTINCT idx) = 2
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(DISTINCT uuid) FROM mtr_wsrep_notify.membership;
+COUNT(DISTINCT uuid)
+2
+SELECT MAX(size) FROM mtr_wsrep_notify.status;
+MAX(size)
+2
+SELECT COUNT(DISTINCT idx) FROM mtr_wsrep_notify.status;
+COUNT(DISTINCT idx)
1
diff --git a/mysql-test/suite/galera/r/galera_var_reject_queries.result b/mysql-test/suite/galera/r/galera_var_reject_queries.result
index caf98566595..22e2e6d764a 100644
--- a/mysql-test/suite/galera/r/galera_var_reject_queries.result
+++ b/mysql-test/suite/galera/r/galera_var_reject_queries.result
@@ -1,3 +1,4 @@
+call mtr.add_suppression("WSREP has not yet prepared node for application use");
CREATE TABLE t1 (f1 INTEGER);
connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
connection node_1;
@@ -5,14 +6,14 @@ SET SESSION wsrep_reject_queries = ALL;
ERROR HY000: Variable 'wsrep_reject_queries' is a GLOBAL variable and should be set with SET GLOBAL
SET GLOBAL wsrep_reject_queries = ALL;
SELECT * FROM t1;
-ERROR 08S01: WSREP has not yet prepared node for application use
+Got one of the listed errors
SET GLOBAL wsrep_reject_queries = ALL_KILL;
connection node_1a;
SELECT * FROM t1;
Got one of the listed errors
connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1;
SELECT * FROM t1;
-ERROR 08S01: WSREP has not yet prepared node for application use
+Got one of the listed errors
connection node_2;
SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
VARIABLE_VALUE = 2
diff --git a/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result b/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result
index ca388496794..24484fb66d2 100644
--- a/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result
+++ b/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result
@@ -25,7 +25,7 @@ VARIABLE_VALUE = 'ON'
1
SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index';
VARIABLE_VALUE = 0
-1
+0
SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
VARIABLE_VALUE = 'ON'
1
diff --git a/mysql-test/suite/galera/t/MW-284.test b/mysql-test/suite/galera/t/MW-284.test
index 5e17baa1bdb..568826db5b0 100644
--- a/mysql-test/suite/galera/t/MW-284.test
+++ b/mysql-test/suite/galera/t/MW-284.test
@@ -2,10 +2,13 @@
# MW-284 Slave I/O retry on ER_COM_UNKNOWN_ERROR
#
+--source include/have_log_bin.inc
--source include/galera_cluster.inc
---source include/have_innodb.inc
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+call mtr.add_suppression("\\[ERROR\\] Error reading packet from server: WSREP has not yet prepared node for application use .*");
+call mtr.add_suppression("WSREP has not yet prepared node for application use");
+
--disable_query_log
--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1, MASTER_USER='root', MASTER_CONNECT_RETRY=1;
--enable_query_log
@@ -18,11 +21,14 @@ SET SESSION wsrep_on = OFF;
--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'
--source include/wait_condition.inc
SET SESSION wsrep_on = ON;
+
#wsrep_sync_wait is set to zero because when slave tries to connect it it ask for queries like SELECT UNIX_TIMESTAMP() on node 1 which will fail, causing
#a warning in slave error log.
SET global wsrep_sync_wait=0;
--connection node_3
+SELECT @@wsrep_on;
+--sleep 1
START SLAVE;
--let $slave_param= Slave_IO_Running
--let $slave_param_value= Connecting
@@ -50,8 +56,8 @@ INSERT INTO t1 VALUES (1);
--connection node_1
DROP TABLE t1;
-
--eval SET global wsrep_sync_wait=$wsrep_sync_wait_state
+
--connection node_3
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'
--source include/wait_condition.inc
@@ -60,11 +66,5 @@ STOP SLAVE;
RESET SLAVE ALL;
CALL mtr.add_suppression('failed registering on master');
-CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work');
---connection node_1
-RESET MASTER;
-CALL mtr.add_suppression('WSREP: Last Applied Action message in non-primary configuration from member');
---connection node_2
-CALL mtr.add_suppression('WSREP: Last Applied Action message in non-primary configuration from member'); \ No newline at end of file
diff --git a/mysql-test/suite/galera/t/MW-313-master.opt b/mysql-test/suite/galera/t/MW-313-master.opt
deleted file mode 100644
index 8a755e98b00..00000000000
--- a/mysql-test/suite/galera/t/MW-313-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---log-bin --log-slave-updates
diff --git a/mysql-test/suite/galera/t/MW-313.cnf b/mysql-test/suite/galera/t/MW-313.cnf
new file mode 100644
index 00000000000..184900c58fd
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-313.cnf
@@ -0,0 +1,12 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+log-bin
+log-slave-updates
+
+[mysqld.2]
+log-bin
+log-slave-updates
+
+
+
diff --git a/mysql-test/suite/galera/t/MW-328C.test b/mysql-test/suite/galera/t/MW-328C.test
deleted file mode 100644
index 1594547d0de..00000000000
--- a/mysql-test/suite/galera/t/MW-328C.test
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# MW-328 Fix unnecessary/silent BF aborts
-#
-
-#
-# Make sure that a high value of wsrep_retry_autocommit
-# masks all deadlock errors
-#
-
---source include/galera_cluster.inc
---source include/big_test.inc
---source suite/galera/t/MW-328-header.inc
-
---connection node_2
---let $count = 100
-
-SET SESSION wsrep_retry_autocommit = 10000;
-
---disable_query_log
-
-while ($count)
-{
- --error 0
- INSERT IGNORE INTO t2 SELECT f2 FROM t1;
-
- --disable_result_log
- --error 0
- SELECT 1 FROM DUAL;
- --enable_result_log
-
- --dec $count
-}
-
---enable_query_log
-
---source suite/galera/t/MW-328-footer.inc
diff --git a/mysql-test/suite/galera/t/MW-329-master.opt b/mysql-test/suite/galera/t/MW-329-master.opt
deleted file mode 100644
index 6565a6af3c4..00000000000
--- a/mysql-test/suite/galera/t/MW-329-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---wsrep-retry-autocommit=0
diff --git a/mysql-test/suite/galera/t/MW-329.cnf b/mysql-test/suite/galera/t/MW-329.cnf
new file mode 100644
index 00000000000..10870a81547
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-329.cnf
@@ -0,0 +1,9 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+wsrep-retry-autocommit=0
+
+[mysqld.2]
+
+
+
diff --git a/mysql-test/suite/galera/t/MW-44-master.opt b/mysql-test/suite/galera/t/MW-44-master.opt
index 9b086195e8a..a15aa0a99d9 100644
--- a/mysql-test/suite/galera/t/MW-44-master.opt
+++ b/mysql-test/suite/galera/t/MW-44-master.opt
@@ -1,2 +1 @@
--log-output=TABLE
---general-log=OFF
diff --git a/mysql-test/suite/galera/t/MW-44.test b/mysql-test/suite/galera/t/MW-44.test
index 8730631edc6..a2acfc57f6c 100644
--- a/mysql-test/suite/galera/t/MW-44.test
+++ b/mysql-test/suite/galera/t/MW-44.test
@@ -3,40 +3,30 @@
#
--source include/galera_cluster.inc
---source include/have_innodb.inc
--connection node_1
TRUNCATE TABLE mysql.general_log;
---sleep 1
--connection node_2
---let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log;
---source include/wait_condition.inc
-TRUNCATE TABLE mysql.general_log;
+--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument NOT LIKE '%mysql.general_log%'
+--let $wait_condition_on_error_output = SELECT * FROM mysql.general_log
+--source include/wait_condition_with_debug.inc
---sleep 1
--connection node_1
---let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log;
---source include/wait_condition.inc
-SELECT Argument FROM mysql.general_log;
-
-SET GLOBAL general_log='ON';
SET SESSION wsrep_osu_method=TOI;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
SET SESSION wsrep_osu_method=RSU;
ALTER TABLE t1 ADD COLUMN f2 INTEGER;
SET SESSION wsrep_osu_method=TOI;
---let $wait_condition = SELECT COUNT(argument) = 2 FROM mysql.general_log WHERE argument LIKE 'CREATE%' OR argument LIKE 'ALTER%';
---source include/wait_condition.inc
-
-SELECT argument FROM mysql.general_log WHERE argument LIKE 'CREATE%' OR argument LIKE 'ALTER%';
+--let $wait_condition = SELECT COUNT(*) = 2 FROM mysql.general_log WHERE argument LIKE "CREATE%" OR argument LIKE "ALTER%"
+--let $wait_condition_on_error_output = SELECT * FROM mysql.general_log
+--source include/wait_condition_with_debug.inc
--connection node_2
-SELECT Argument FROM mysql.general_log;
-DROP TABLE t1;
-SET GLOBAL general_log='OFF';
---connection node_1
-SET GLOBAL general_log='OFF';
+--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument LIKE "CREATE%" OR argument LIKE "ALTER%"
+--let $wait_condition_on_error_output = SELECT * FROM mysql.general_log
+--source include/wait_condition_with_debug.inc
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/MW-86-wait1-master.opt b/mysql-test/suite/galera/t/MW-86-wait1-master.opt
deleted file mode 100644
index 8a755e98b00..00000000000
--- a/mysql-test/suite/galera/t/MW-86-wait1-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---log-bin --log-slave-updates
diff --git a/mysql-test/suite/galera/t/MW-86-wait8-master.opt b/mysql-test/suite/galera/t/MW-86-wait8-master.opt
deleted file mode 100644
index 8a755e98b00..00000000000
--- a/mysql-test/suite/galera/t/MW-86-wait8-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---log-bin --log-slave-updates
diff --git a/mysql-test/suite/galera/t/MW-86-wait8.cnf b/mysql-test/suite/galera/t/MW-86-wait8.cnf
new file mode 100644
index 00000000000..8f6a760def0
--- /dev/null
+++ b/mysql-test/suite/galera/t/MW-86-wait8.cnf
@@ -0,0 +1,10 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+log-bin
+log-slave-updates
+
+[mysqld.2]
+log-bin
+log-slave-updates
+
diff --git a/mysql-test/suite/galera/t/enforce_storage_engine2.cnf b/mysql-test/suite/galera/t/enforce_storage_engine2.cnf
new file mode 100644
index 00000000000..b14fce85b36
--- /dev/null
+++ b/mysql-test/suite/galera/t/enforce_storage_engine2.cnf
@@ -0,0 +1,13 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+enforce_storage_engine=innodb
+sql_mode=''
+
+[mysqld.2]
+enforce_storage_engine=innodb
+sql_mode=''
+
+
+
+
diff --git a/mysql-test/suite/galera/t/enforce_storage_engine2.opt b/mysql-test/suite/galera/t/enforce_storage_engine2.opt
deleted file mode 100644
index 03f7dc5e527..00000000000
--- a/mysql-test/suite/galera/t/enforce_storage_engine2.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---enforce_storage_engine=innodb --sql_mode=''
-
diff --git a/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter-master.opt b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter-master.opt
deleted file mode 100644
index d8ecaacaa4c..00000000000
--- a/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---lock_wait_timeout=5 --innodb_lock_wait_timeout=5 --wait_timeout=5
diff --git a/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.cnf b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.cnf
new file mode 100644
index 00000000000..4d93a1b2509
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.cnf
@@ -0,0 +1,14 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+lock_wait_timeout=5
+innodb_lock_wait_timeout=5
+wait_timeout=5
+
+[mysqld.2]
+lock_wait_timeout=5
+innodb_lock_wait_timeout=5
+wait_timeout=5
+
+
+
diff --git a/mysql-test/suite/galera/t/galera_as_slave_ctas.cnf b/mysql-test/suite/galera/t/galera_as_slave_ctas.cnf
new file mode 100644
index 00000000000..eab2a6de90d
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_slave_ctas.cnf
@@ -0,0 +1,5 @@
+!include ../galera_2nodes_as_slave.cnf
+
+# make sure master server uses ROW format for replication
+[mysqld]
+binlog-format=row
diff --git a/mysql-test/suite/galera/t/galera_as_slave_ctas.test b/mysql-test/suite/galera/t/galera_as_slave_ctas.test
new file mode 100644
index 00000000000..1a5e023b981
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_slave_ctas.test
@@ -0,0 +1,75 @@
+#
+# Test Galera as a slave to a MySQL master
+#
+# The galera/galera_2node_slave.cnf describes the setup of the nodes
+# also, for this test, master server must have binlog_format=ROW
+#
+
+--source include/have_innodb.inc
+
+# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--source include/galera_cluster.inc
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+
+--connection node_2
+--disable_query_log
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1;
+--enable_query_log
+START SLAVE;
+
+
+# make sure master server has binlog_format=ROW
+--connection node_1
+SHOW VARIABLES LIKE 'binlog_format';
+
+#
+# test phase one, issue CTAS with empty source table
+#
+--connection node_1
+CREATE TABLE source (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
+
+CREATE TABLE target AS SELECT * FROM source;
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'target';
+--source include/wait_condition.inc
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'target';
+--source include/wait_condition.inc
+
+#
+# test phase two, issue CTAS with populated source table
+#
+--connection node_1
+DROP TABLE target;
+INSERT INTO source VALUES(1);
+
+CREATE TABLE target AS SELECT * FROM source;
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM target;
+--source include/wait_condition.inc
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 1 FROM target;
+--source include/wait_condition.inc
+
+--connection node_1
+DROP TABLE source;
+DROP TABLE target;
+
+--connection node_3
+--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'target';
+--source include/wait_condition.inc
+
+
+--connection node_2
+STOP SLAVE;
+RESET SLAVE ALL;
+
+--connection node_1
+RESET MASTER;
+
diff --git a/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.cnf b/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.cnf
new file mode 100644
index 00000000000..01d2eb12630
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.cnf
@@ -0,0 +1,6 @@
+!include ../galera_2nodes_as_slave.cnf
+
+[mysqld]
+log-bin=mysqld-bin
+log-slave-updates
+binlog-format=ROW
diff --git a/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.test b/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.test
new file mode 100644
index 00000000000..faa9ddfd5c8
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.test
@@ -0,0 +1,65 @@
+#
+# Test Galera as a slave to a MariaDB master using GTIDs
+#
+# suite/galera/galera_2nodes_as_slave.cnf describes the setup of the nodes
+# suite/galera/t/galera_as_slave_gtid.cnf has the GTID options
+#
+# This test will replicate writes to MyISAM table and check that slave node is able
+# to apply them.
+# mysql.gtid_slave_pos table should be defined as innodb engine, original problem
+# by writes to mysql.gtid_slave_pos, whereas the replicated transaction contained
+# no innodb writes
+#
+
+--source include/have_innodb.inc
+
+# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc
+--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
+--source include/galera_cluster.inc
+
+--connection node_2
+# make sure gtid_slave_pos is of innodb engine, mtr does not currently provide that
+ALTER TABLE mysql.gtid_slave_pos engine = InnoDB;
+
+--disable_query_log
+--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1;
+--enable_query_log
+START SLAVE;
+
+--connection node_1
+CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=MyISAM;
+INSERT INTO t1 VALUES(1);
+
+SELECT LENGTH(@@global.gtid_binlog_state) > 1;
+--let $gtid_binlog_state_node1 = `SELECT @@global.gtid_binlog_state;`
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
+--source include/wait_condition.inc
+
+--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
+--source include/wait_condition.inc
+
+--disable_query_log
+--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
+--enable_query_log
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+SELECT COUNT(*) = 0 FROM t1;
+
+--disable_query_log
+--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
+--enable_query_log
+
+--echo #cleanup
+--connection node_1
+DROP TABLE t1;
+reset master;
+
+--connection node_2
+STOP SLAVE;
+RESET SLAVE ALL;
+reset master;
+
+--connection node_3
+reset master;
diff --git a/mysql-test/suite/galera/t/galera_bf_background_statistics.cnf b/mysql-test/suite/galera/t/galera_bf_background_statistics.cnf
new file mode 100644
index 00000000000..4101b4073ec
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_bf_background_statistics.cnf
@@ -0,0 +1,9 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+innodb_stats_persistent=ON
+
+[mysqld.2]
+innodb_stats_persistent=ON
+
+
diff --git a/mysql-test/suite/galera/t/galera_bf_background_statistics.opt b/mysql-test/suite/galera/t/galera_bf_background_statistics.opt
deleted file mode 100644
index f9b1414a974..00000000000
--- a/mysql-test/suite/galera/t/galera_bf_background_statistics.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb_stats_persistent=ON
diff --git a/mysql-test/suite/galera/t/galera_binlog_checksum-master.opt b/mysql-test/suite/galera/t/galera_binlog_checksum-master.opt
deleted file mode 100644
index c8e53f07fc2..00000000000
--- a/mysql-test/suite/galera/t/galera_binlog_checksum-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---binlog-checksum=CRC32 --master-verify-checksum=1 --slave-sql-verify-checksum=1
diff --git a/mysql-test/suite/galera/t/galera_binlog_checksum.cnf b/mysql-test/suite/galera/t/galera_binlog_checksum.cnf
new file mode 100644
index 00000000000..bd61ee67406
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_binlog_checksum.cnf
@@ -0,0 +1,13 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+binlog-checksum=CRC32
+master-verify-checksum=1
+slave-sql-verify-checksum=1
+
+[mysqld.2]
+binlog-checksum=CRC32
+master-verify-checksum=1
+slave-sql-verify-checksum=1
+
+
diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt
deleted file mode 100644
index a36d21315a6..00000000000
--- a/mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---binlog-row-event-max-size=4294967295
diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.cnf b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.cnf
new file mode 100644
index 00000000000..7d87a0d0078
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.cnf
@@ -0,0 +1,9 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+binlog-row-event-max-size=4294967295
+
+[mysqld.2]
+
+
+
diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_min-master.opt b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min-master.opt
deleted file mode 100644
index 22174756652..00000000000
--- a/mysql-test/suite/galera/t/galera_binlog_event_max_size_min-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---binlog-row-event-max-size=256
diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.cnf b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.cnf
new file mode 100644
index 00000000000..798435d8e54
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.cnf
@@ -0,0 +1,9 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+binlog-row-event-max-size=256
+
+[mysqld.2]
+
+
+
diff --git a/mysql-test/suite/galera/t/galera_flush-master.opt b/mysql-test/suite/galera/t/galera_flush-master.opt
deleted file mode 100644
index 5a1fb6748d9..00000000000
--- a/mysql-test/suite/galera/t/galera_flush-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---query_cache_type=1 --query_cache_size=1000000
diff --git a/mysql-test/suite/galera/t/galera_flush.cnf b/mysql-test/suite/galera/t/galera_flush.cnf
new file mode 100644
index 00000000000..e2d869ab364
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_flush.cnf
@@ -0,0 +1,10 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+query_cache_type=1
+query_cache_size=1000000
+
+[mysqld.2]
+query_cache_type=1
+query_cache_size=1000000
+
diff --git a/mysql-test/suite/galera/t/galera_flush_local.cnf b/mysql-test/suite/galera/t/galera_flush_local.cnf
new file mode 100644
index 00000000000..c92cb58f484
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_flush_local.cnf
@@ -0,0 +1,12 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+query_cache_type=1
+query_cache_size=1000000
+wsrep_replicate_myisam=ON
+
+[mysqld.2]
+query_cache_type=1
+query_cache_size=1000000
+wsrep_replicate_myisam=ON
+
diff --git a/mysql-test/suite/galera/t/galera_flush_local.opt b/mysql-test/suite/galera/t/galera_flush_local.opt
deleted file mode 100644
index a084db15c5d..00000000000
--- a/mysql-test/suite/galera/t/galera_flush_local.opt
+++ /dev/null
@@ -1,3 +0,0 @@
---query_cache_type=1
---query_cache_size=1000000
---wsrep_replicate_myisam=ON
diff --git a/mysql-test/suite/galera/t/galera_forced_binlog_format.test b/mysql-test/suite/galera/t/galera_forced_binlog_format.test
index 364f41529a4..5da70abd255 100644
--- a/mysql-test/suite/galera/t/galera_forced_binlog_format.test
+++ b/mysql-test/suite/galera/t/galera_forced_binlog_format.test
@@ -7,14 +7,20 @@
--source include/galera_cluster.inc
--connection node_1
+SET SESSION wsrep_on=OFF;
RESET MASTER;
+SET SESSION wsrep_on=ON;
+--disable_warnings
SET SESSION binlog_format = 'STATEMENT';
+--enable_warnings
CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1);
+--disable_warnings
SET SESSION binlog_format = 'MIXED';
+--enable_warnings
INSERT INTO t1 VALUES (2);
diff --git a/mysql-test/suite/galera/t/galera_gtid-master.opt b/mysql-test/suite/galera/t/galera_gtid-master.opt
deleted file mode 100644
index 8a755e98b00..00000000000
--- a/mysql-test/suite/galera/t/galera_gtid-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---log-bin --log-slave-updates
diff --git a/mysql-test/suite/galera/t/galera_gtid.cnf b/mysql-test/suite/galera/t/galera_gtid.cnf
new file mode 100644
index 00000000000..8f6a760def0
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_gtid.cnf
@@ -0,0 +1,10 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+log-bin
+log-slave-updates
+
+[mysqld.2]
+log-bin
+log-slave-updates
+
diff --git a/mysql-test/suite/galera/t/galera_gtid.test b/mysql-test/suite/galera/t/galera_gtid.test
index e8369be62e6..560a320255f 100644
--- a/mysql-test/suite/galera/t/galera_gtid.test
+++ b/mysql-test/suite/galera/t/galera_gtid.test
@@ -11,14 +11,18 @@ CREATE TABLE t1 (f1 INT PRIMARY KEY);
INSERT INTO t1 VALUES (1);
--connection node_2
-SELECT COUNT(*) = 1 FROM t1;
+--let $wait_condition = SELECT COUNT(*) = 1 FROM t1
+--source include/wait_condition.inc
UPDATE t1 SET f1 = 2;
--let $gtid_binlog_state_node2 = `SELECT @@global.gtid_binlog_state;`
--connection node_1
-SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2;
+SET SESSION wsrep_sync_wait = 15;
+--let $wait_condition = SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2
+--source include/wait_condition.inc
+SELECT * from t1;
--disable_query_log
--eval SELECT '$gtid_binlog_state_node2' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
diff --git a/mysql-test/suite/galera/t/galera_log_bin-master.opt b/mysql-test/suite/galera/t/galera_log_bin-master.opt
deleted file mode 100644
index 8a755e98b00..00000000000
--- a/mysql-test/suite/galera/t/galera_log_bin-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---log-bin --log-slave-updates
diff --git a/mysql-test/suite/galera/t/galera_log_bin.cnf b/mysql-test/suite/galera/t/galera_log_bin.cnf
new file mode 100644
index 00000000000..8f6a760def0
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_log_bin.cnf
@@ -0,0 +1,10 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+log-bin
+log-slave-updates
+
+[mysqld.2]
+log-bin
+log-slave-updates
+
diff --git a/mysql-test/suite/galera/t/galera_log_bin.test b/mysql-test/suite/galera/t/galera_log_bin.test
index c3d94d15194..f1d2a12b9de 100644
--- a/mysql-test/suite/galera/t/galera_log_bin.test
+++ b/mysql-test/suite/galera/t/galera_log_bin.test
@@ -1,5 +1,5 @@
--source include/galera_cluster.inc
---source include/have_innodb.inc
+--source include/force_restart.inc
--connection node_1
reset master;
@@ -39,5 +39,4 @@ DROP TABLE t2;
--echo #cleanup
--connection node_1
RESET MASTER;
---connection node_2
-reset master;
+
diff --git a/mysql-test/suite/galera/t/galera_mdev_13787.cnf b/mysql-test/suite/galera/t/galera_mdev_13787.cnf
new file mode 100644
index 00000000000..ada78e1db2a
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_mdev_13787.cnf
@@ -0,0 +1,9 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+innodb-stats-persistent=1
+
+[mysqld.2]
+innodb-stats-persistent=1
+
+
diff --git a/mysql-test/suite/galera/t/galera_mdev_13787.opt b/mysql-test/suite/galera/t/galera_mdev_13787.opt
deleted file mode 100644
index 27ec1e3f00e..00000000000
--- a/mysql-test/suite/galera/t/galera_mdev_13787.opt
+++ /dev/null
@@ -1 +0,0 @@
---innodb-stats-persistent=1
diff --git a/mysql-test/suite/galera/t/galera_query_cache-master.opt b/mysql-test/suite/galera/t/galera_query_cache-master.opt
deleted file mode 100644
index 915a36c0937..00000000000
--- a/mysql-test/suite/galera/t/galera_query_cache-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---query_cache_type=1 --query_cache_size=1355776
diff --git a/mysql-test/suite/galera/t/galera_query_cache.cnf b/mysql-test/suite/galera/t/galera_query_cache.cnf
new file mode 100644
index 00000000000..80f40b0997e
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_query_cache.cnf
@@ -0,0 +1,10 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+query_cache_type=1
+query_cache_size=1355776
+
+[mysqld.2]
+query_cache_type=1
+query_cache_size=1355776
+
diff --git a/mysql-test/suite/galera/t/galera_query_cache_sync_wait-master.opt b/mysql-test/suite/galera/t/galera_query_cache_sync_wait-master.opt
deleted file mode 100644
index 915a36c0937..00000000000
--- a/mysql-test/suite/galera/t/galera_query_cache_sync_wait-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---query_cache_type=1 --query_cache_size=1355776
diff --git a/mysql-test/suite/galera/t/galera_query_cache_sync_wait.cnf b/mysql-test/suite/galera/t/galera_query_cache_sync_wait.cnf
new file mode 100644
index 00000000000..80f40b0997e
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_query_cache_sync_wait.cnf
@@ -0,0 +1,10 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+query_cache_type=1
+query_cache_size=1355776
+
+[mysqld.2]
+query_cache_type=1
+query_cache_size=1355776
+
diff --git a/mysql-test/suite/galera/t/galera_sbr_binlog-master.opt b/mysql-test/suite/galera/t/galera_sbr_binlog-master.opt
deleted file mode 100644
index beae84b3862..00000000000
--- a/mysql-test/suite/galera/t/galera_sbr_binlog-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---log-bin
diff --git a/mysql-test/suite/galera/t/galera_sbr_binlog.cnf b/mysql-test/suite/galera/t/galera_sbr_binlog.cnf
new file mode 100644
index 00000000000..9dbd81f758d
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_sbr_binlog.cnf
@@ -0,0 +1,7 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+log-bin
+
+[mysqld.2]
+log-bin
diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf
index 336296e9bfe..5e6913d4d2b 100644
--- a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf
+++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf
@@ -4,6 +4,8 @@
wsrep_sst_method=mariabackup
wsrep_sst_auth="root:"
wsrep_debug=ON
+innodb-file-format='Barracuda'
+innodb-file-per-table=ON
[mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true'
diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.opt b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.opt
deleted file mode 100644
index ae3fb580433..00000000000
--- a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.opt
+++ /dev/null
@@ -1,2 +0,0 @@
---innodb-file-format='Barracuda'
---innodb-file-per-table=ON
diff --git a/mysql-test/suite/galera/t/galera_udf-master.opt b/mysql-test/suite/galera/t/galera_udf-master.opt
deleted file mode 100644
index 14dfe3e20bc..00000000000
--- a/mysql-test/suite/galera/t/galera_udf-master.opt
+++ /dev/null
@@ -1,2 +0,0 @@
-$UDF_EXAMPLE_LIB_OPT
---query_cache_type=1
diff --git a/mysql-test/suite/galera/t/galera_udf.cnf b/mysql-test/suite/galera/t/galera_udf.cnf
new file mode 100644
index 00000000000..69d5acd65f3
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_udf.cnf
@@ -0,0 +1,15 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+$UDF_EXAMPLE_LIB_OPT
+query_cache_type=1
+
+[mysqld.2]
+query_cache_type=1
+
+
+
+
+
+
+
diff --git a/mysql-test/suite/galera/t/galera_v1_row_events-master.opt b/mysql-test/suite/galera/t/galera_v1_row_events-master.opt
deleted file mode 100644
index dc82542128e..00000000000
--- a/mysql-test/suite/galera/t/galera_v1_row_events-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---log-bin-use-v1-row-events=1
diff --git a/mysql-test/suite/galera/t/galera_v1_row_events.cnf b/mysql-test/suite/galera/t/galera_v1_row_events.cnf
new file mode 100644
index 00000000000..b95e321ad4f
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_v1_row_events.cnf
@@ -0,0 +1,13 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+log-bin-use-v1-row-events=1
+
+[mysqld.2]
+
+
+
+
+
+
+
diff --git a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.cnf b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.cnf
new file mode 100644
index 00000000000..523bae68763
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.cnf
@@ -0,0 +1,13 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+wsrep-auto-increment-control=ON
+
+[mysqld.2]
+wsrep-auto-increment-control=ON
+
+
+
+
+
+
diff --git a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.opt b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.opt
deleted file mode 100644
index 0a03610888c..00000000000
--- a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.opt
+++ /dev/null
@@ -1 +0,0 @@
---wsrep-auto-increment-control=ON
diff --git a/mysql-test/suite/galera/t/galera_var_dirty_reads.test b/mysql-test/suite/galera/t/galera_var_dirty_reads.test
index 3e2108868af..f18069929f9 100644
--- a/mysql-test/suite/galera/t/galera_var_dirty_reads.test
+++ b/mysql-test/suite/galera/t/galera_var_dirty_reads.test
@@ -3,9 +3,10 @@
#
--source include/galera_cluster.inc
---source include/have_innodb.inc
--source include/have_perfschema.inc
+call mtr.add_suppression("WSREP has not yet prepared node for application use");
+
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
@@ -30,10 +31,10 @@ SHOW STATUS LIKE 'wsrep_ready';
# Must return 'Non-primary'
SHOW STATUS LIKE 'wsrep_cluster_status';
---error ER_UNKNOWN_COM_ERROR
+--error ER_UNKNOWN_COM_ERROR,1047
SELECT * FROM t1;
---error ER_UNKNOWN_COM_ERROR
+--error ER_UNKNOWN_COM_ERROR,1047
SELECT 1 FROM t1;
SET @@session.wsrep_dirty_reads=ON;
@@ -45,7 +46,7 @@ SELECT i, variable_name, variable_value FROM t1, information_schema.session_vari
SET @@session.wsrep_dirty_reads=OFF;
---error ER_UNKNOWN_COM_ERROR
+--error ER_UNKNOWN_COM_ERROR,1047
SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1;
SELECT 1;
diff --git a/mysql-test/suite/galera/t/galera_var_notify_cmd-master.opt b/mysql-test/suite/galera/t/galera_var_notify_cmd-master.opt
deleted file mode 100644
index 70dfc98736b..00000000000
--- a/mysql-test/suite/galera/t/galera_var_notify_cmd-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---wsrep_notify_cmd=$MYSQL_TEST_DIR/std_data/wsrep_notify.sh --wsrep-sync-wait=0
diff --git a/mysql-test/suite/galera/t/galera_var_notify_cmd.cnf b/mysql-test/suite/galera/t/galera_var_notify_cmd.cnf
new file mode 100644
index 00000000000..69df4f0e7e0
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_notify_cmd.cnf
@@ -0,0 +1,13 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+wsrep_notify_cmd=$MYSQL_TEST_DIR/std_data/wsrep_notify.sh
+wsrep-sync-wait=0
+
+[mysqld.2]
+
+
+
+
+
+
diff --git a/mysql-test/suite/galera/t/galera_var_notify_cmd.test b/mysql-test/suite/galera/t/galera_var_notify_cmd.test
index b261f878ced..2b0852b4870 100644
--- a/mysql-test/suite/galera/t/galera_var_notify_cmd.test
+++ b/mysql-test/suite/galera/t/galera_var_notify_cmd.test
@@ -3,10 +3,10 @@
# notifications into a table.
#
---source include/have_innodb.inc
--source include/galera_cluster.inc
--connection node_1
-SELECT COUNT(DISTINCT uuid) = 2 FROM mtr_wsrep_notify.membership;
-SELECT MAX(size) = 2 FROM mtr_wsrep_notify.status;
-SELECT COUNT(DISTINCT idx) = 2 FROM mtr_wsrep_notify.status;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(DISTINCT uuid) FROM mtr_wsrep_notify.membership;
+SELECT MAX(size) FROM mtr_wsrep_notify.status;
+SELECT COUNT(DISTINCT idx) FROM mtr_wsrep_notify.status;
diff --git a/mysql-test/suite/galera/t/galera_var_reject_queries.test b/mysql-test/suite/galera/t/galera_var_reject_queries.test
index 8b80c04e3be..aa31b94d6e0 100644
--- a/mysql-test/suite/galera/t/galera_var_reject_queries.test
+++ b/mysql-test/suite/galera/t/galera_var_reject_queries.test
@@ -5,6 +5,8 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
+call mtr.add_suppression("WSREP has not yet prepared node for application use");
+
CREATE TABLE t1 (f1 INTEGER);
--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
@@ -15,7 +17,7 @@ SET SESSION wsrep_reject_queries = ALL;
SET GLOBAL wsrep_reject_queries = ALL;
---error ER_UNKNOWN_COM_ERROR
+--error ER_UNKNOWN_COM_ERROR,1047
SELECT * FROM t1;
#
@@ -30,7 +32,7 @@ SET GLOBAL wsrep_reject_queries = ALL_KILL;
SELECT * FROM t1;
--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1
---error ER_UNKNOWN_COM_ERROR
+--error ER_UNKNOWN_COM_ERROR,1047
SELECT * FROM t1;
# Confirm that replication continues
diff --git a/mysql-test/suite/galera/t/galera_var_sst_auth.cnf b/mysql-test/suite/galera/t/galera_var_sst_auth.cnf
new file mode 100644
index 00000000000..ff29db2306b
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_var_sst_auth.cnf
@@ -0,0 +1,12 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+wsrep_sst_auth=root:
+
+[mysqld.2]
+wsrep_sst_auth=root:
+
+
+
+
+
diff --git a/mysql-test/suite/galera/t/galera_var_sst_auth.opt b/mysql-test/suite/galera/t/galera_var_sst_auth.opt
deleted file mode 100644
index 67babbb1ae7..00000000000
--- a/mysql-test/suite/galera/t/galera_var_sst_auth.opt
+++ /dev/null
@@ -1 +0,0 @@
---wsrep_sst_auth=root:
diff --git a/mysql-test/suite/galera/t/galera_wsrep_log_conficts-master.opt b/mysql-test/suite/galera/t/galera_wsrep_log_conficts-master.opt
deleted file mode 100644
index 930c483bd64..00000000000
--- a/mysql-test/suite/galera/t/galera_wsrep_log_conficts-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---wsrep_log_conflicts=ON
diff --git a/mysql-test/suite/galera/t/galera_wsrep_log_conficts.cnf b/mysql-test/suite/galera/t/galera_wsrep_log_conficts.cnf
new file mode 100644
index 00000000000..440c37bea81
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_wsrep_log_conficts.cnf
@@ -0,0 +1,12 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+wsrep_log_conflicts=ON
+
+[mysqld.2]
+wsrep_log_conflicts=ON
+
+
+
+
+
diff --git a/mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt b/mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt
deleted file mode 100644
index c31150c46af..00000000000
--- a/mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---wsrep-new-cluster
diff --git a/mysql-test/suite/galera/t/galera_wsrep_new_cluster.cnf b/mysql-test/suite/galera/t/galera_wsrep_new_cluster.cnf
new file mode 100644
index 00000000000..0acbcfb7843
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_wsrep_new_cluster.cnf
@@ -0,0 +1,10 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+wsrep-new-cluster
+
+[mysqld.2]
+
+
+
+
diff --git a/mysql-test/suite/galera/t/mysql-wsrep#201-master.opt b/mysql-test/suite/galera/t/mysql-wsrep#201-master.opt
deleted file mode 100644
index a00258bc48c..00000000000
--- a/mysql-test/suite/galera/t/mysql-wsrep#201-master.opt
+++ /dev/null
@@ -1 +0,0 @@
---query_cache_type=1
diff --git a/mysql-test/suite/galera/t/mysql-wsrep#201.cnf b/mysql-test/suite/galera/t/mysql-wsrep#201.cnf
new file mode 100644
index 00000000000..4a82e9fa037
--- /dev/null
+++ b/mysql-test/suite/galera/t/mysql-wsrep#201.cnf
@@ -0,0 +1,9 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+query_cache_type=1
+
+[mysqld.2]
+query_cache_type=1
+
+
diff --git a/mysql-test/suite/galera/t/query_cache.cnf b/mysql-test/suite/galera/t/query_cache.cnf
new file mode 100644
index 00000000000..4a82e9fa037
--- /dev/null
+++ b/mysql-test/suite/galera/t/query_cache.cnf
@@ -0,0 +1,9 @@
+!include ../galera_2nodes.cnf
+
+[mysqld.1]
+query_cache_type=1
+
+[mysqld.2]
+query_cache_type=1
+
+
diff --git a/mysql-test/suite/galera/t/query_cache.opt b/mysql-test/suite/galera/t/query_cache.opt
deleted file mode 100644
index a00258bc48c..00000000000
--- a/mysql-test/suite/galera/t/query_cache.opt
+++ /dev/null
@@ -1 +0,0 @@
---query_cache_type=1
diff --git a/mysql-test/suite/innodb/r/innodb-32k-crash.result b/mysql-test/suite/innodb/r/innodb-32k-crash.result
index 6c6b7c7fd35..bb46704198d 100644
--- a/mysql-test/suite/innodb/r/innodb-32k-crash.result
+++ b/mysql-test/suite/innodb/r/innodb-32k-crash.result
@@ -1,4 +1,3 @@
-call mtr.add_suppression("Cannot add field `u` in table `test`.`t2` because after adding it, the row size is");
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
h blob,i blob,j blob,k blob,l blob,m blob,n blob,
o blob,p blob,q blob,r blob,s blob,t blob,u blob,
diff --git a/mysql-test/suite/innodb/r/innodb-64k-crash.result b/mysql-test/suite/innodb/r/innodb-64k-crash.result
index 7ed271a14dd..e7998fddf29 100644
--- a/mysql-test/suite/innodb/r/innodb-64k-crash.result
+++ b/mysql-test/suite/innodb/r/innodb-64k-crash.result
@@ -1,4 +1,3 @@
-call mtr.add_suppression("Cannot add field `pa` in table `test`.`t2` because after adding it, the row size is");
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
h blob,i blob,j blob,k blob,l blob,m blob,n blob,
o blob,p blob,q blob,r blob,s blob,t blob,u blob,
diff --git a/mysql-test/suite/innodb/r/innodb-mdev-7513.result b/mysql-test/suite/innodb/r/innodb-mdev-7513.result
index 55b4d3462b0..bb3531e3f90 100644
--- a/mysql-test/suite/innodb/r/innodb-mdev-7513.result
+++ b/mysql-test/suite/innodb/r/innodb-mdev-7513.result
@@ -1,4 +1,3 @@
-call mtr.add_suppression("InnoDB: Cannot add field `.* in table .* because after adding it, the row size is .* which is greater than maximum allowed size (.*) for a record on index leaf page.");
call mtr.add_suppression("Row size too large (> 8126)*");
CREATE TABLE t1 ( text1 TEXT,
text2 TEXT,
diff --git a/mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result b/mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result
index 7eb9a172754..8e3d670e4fe 100644
--- a/mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result
+++ b/mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result
@@ -1,4 +1,3 @@
-call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is');
SELECT @@innodb_page_size;
@@innodb_page_size
32768
diff --git a/mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result b/mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result
index c889e00107b..50d0971bc63 100644
--- a/mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result
+++ b/mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result
@@ -1,4 +1,3 @@
-call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is');
SELECT @@innodb_page_size;
@@innodb_page_size
65536
diff --git a/mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result b/mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result
new file mode 100644
index 00000000000..c175f8ee915
--- /dev/null
+++ b/mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result
@@ -0,0 +1,21 @@
+call mtr.add_suppression("InnoDB: Cannot add field .* in table .* because after adding it, the row size is .* which is greater than maximum allowed size (.*) for a record on index leaf page.");
+SET innodb_strict_mode = 0;
+SET @@global.log_warnings = 3;
+CREATE TABLE t1 (
+col_1 TEXT
+,col_2 TEXT
+,col_3 TEXT
+,col_4 TEXT
+,col_5 TEXT
+,col_6 TEXT
+,col_7 TEXT
+,col_8 TEXT
+,col_9 TEXT
+,col_10 TEXT
+,col_11 TEXT
+) ENGINE=INNODB ROW_FORMAT=COMPACT;
+Warnings:
+Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
+DROP TABLE t1;
+SET @@global.log_warnings = 2;
+SET innodb_strict_mode = 1;
diff --git a/mysql-test/suite/innodb/r/undo_log.result b/mysql-test/suite/innodb/r/undo_log.result
index 7892e26d896..cda3b190ede 100644
--- a/mysql-test/suite/innodb/r/undo_log.result
+++ b/mysql-test/suite/innodb/r/undo_log.result
@@ -1,4 +1,3 @@
-call mtr.add_suppression("Cannot add field `b_str_20` in table `test`.`test_tab` because after adding it, the row size is");
SET innodb_strict_mode=OFF;
CREATE TABLE test_tab (
a_str_18 mediumtext,
diff --git a/mysql-test/suite/innodb/t/innodb-32k-crash.test b/mysql-test/suite/innodb/t/innodb-32k-crash.test
index da6d91f351e..178b32d54c9 100644
--- a/mysql-test/suite/innodb/t/innodb-32k-crash.test
+++ b/mysql-test/suite/innodb/t/innodb-32k-crash.test
@@ -5,8 +5,6 @@
let $MYSQLD_DATADIR= `select @@datadir`;
-call mtr.add_suppression("Cannot add field `u` in table `test`.`t2` because after adding it, the row size is");
-
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
h blob,i blob,j blob,k blob,l blob,m blob,n blob,
o blob,p blob,q blob,r blob,s blob,t blob,u blob,
diff --git a/mysql-test/suite/innodb/t/innodb-64k-crash.test b/mysql-test/suite/innodb/t/innodb-64k-crash.test
index cbec1a452c7..93f6f79edf3 100644
--- a/mysql-test/suite/innodb/t/innodb-64k-crash.test
+++ b/mysql-test/suite/innodb/t/innodb-64k-crash.test
@@ -5,8 +5,6 @@
let $MYSQLD_DATADIR= `select @@datadir`;
-call mtr.add_suppression("Cannot add field `pa` in table `test`.`t2` because after adding it, the row size is");
-
CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob,
h blob,i blob,j blob,k blob,l blob,m blob,n blob,
o blob,p blob,q blob,r blob,s blob,t blob,u blob,
diff --git a/mysql-test/suite/innodb/t/innodb-mdev-7513.test b/mysql-test/suite/innodb/t/innodb-mdev-7513.test
index 88f941ef70d..b929ea14781 100644
--- a/mysql-test/suite/innodb/t/innodb-mdev-7513.test
+++ b/mysql-test/suite/innodb/t/innodb-mdev-7513.test
@@ -3,7 +3,6 @@
# MDEV-7513: ib_warn_row_too_big dereferences null thd
-call mtr.add_suppression("InnoDB: Cannot add field `.* in table .* because after adding it, the row size is .* which is greater than maximum allowed size (.*) for a record on index leaf page.");
call mtr.add_suppression("Row size too large (> 8126)*");
--disable_warnings
diff --git a/mysql-test/suite/innodb/t/innodb_max_recordsize_32k.test b/mysql-test/suite/innodb/t/innodb_max_recordsize_32k.test
index 5041612bec1..89bace5d9b1 100644
--- a/mysql-test/suite/innodb/t/innodb_max_recordsize_32k.test
+++ b/mysql-test/suite/innodb/t/innodb_max_recordsize_32k.test
@@ -1,8 +1,6 @@
--source include/have_innodb.inc
--source include/have_innodb_32k.inc
-call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is');
-
# Check page size 32k
SELECT @@innodb_page_size;
diff --git a/mysql-test/suite/innodb/t/innodb_max_recordsize_64k.test b/mysql-test/suite/innodb/t/innodb_max_recordsize_64k.test
index 5b06b57d4b4..4b4faf16f58 100644
--- a/mysql-test/suite/innodb/t/innodb_max_recordsize_64k.test
+++ b/mysql-test/suite/innodb/t/innodb_max_recordsize_64k.test
@@ -1,8 +1,6 @@
--source include/have_innodb.inc
--source include/have_innodb_64k.inc
-call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is');
-
# Check page size 64k
SELECT @@innodb_page_size;
diff --git a/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test b/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test
new file mode 100644
index 00000000000..35b86cc4c46
--- /dev/null
+++ b/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test
@@ -0,0 +1,24 @@
+--source include/have_innodb.inc
+
+call mtr.add_suppression("InnoDB: Cannot add field .* in table .* because after adding it, the row size is .* which is greater than maximum allowed size (.*) for a record on index leaf page.");
+
+SET innodb_strict_mode = 0;
+SET @@global.log_warnings = 3;
+
+CREATE TABLE t1 (
+ col_1 TEXT
+ ,col_2 TEXT
+ ,col_3 TEXT
+ ,col_4 TEXT
+ ,col_5 TEXT
+ ,col_6 TEXT
+ ,col_7 TEXT
+ ,col_8 TEXT
+ ,col_9 TEXT
+ ,col_10 TEXT
+ ,col_11 TEXT
+) ENGINE=INNODB ROW_FORMAT=COMPACT;
+DROP TABLE t1;
+
+SET @@global.log_warnings = 2;
+SET innodb_strict_mode = 1;
diff --git a/mysql-test/suite/innodb/t/undo_log.test b/mysql-test/suite/innodb/t/undo_log.test
index 94322868b06..150d50c2e75 100644
--- a/mysql-test/suite/innodb/t/undo_log.test
+++ b/mysql-test/suite/innodb/t/undo_log.test
@@ -1,7 +1,5 @@
--source include/have_innodb.inc
-call mtr.add_suppression("Cannot add field `b_str_20` in table `test`.`test_tab` because after adding it, the row size is");
-
SET innodb_strict_mode=OFF;
CREATE TABLE test_tab (
a_str_18 mediumtext,
diff --git a/mysql-test/suite/mariabackup/incremental_backup.result b/mysql-test/suite/mariabackup/incremental_backup.result
index cc7277bdde9..70cc2cf8c4a 100644
--- a/mysql-test/suite/mariabackup/incremental_backup.result
+++ b/mysql-test/suite/mariabackup/incremental_backup.result
@@ -1,4 +1,5 @@
call mtr.add_suppression("InnoDB: New log files created");
+CREATE TABLE t_aria(i INT) ENGINE ARIA;
CREATE TABLE t(i INT PRIMARY KEY) ENGINE INNODB;
BEGIN;
INSERT INTO t VALUES(2);
@@ -11,11 +12,13 @@ INSERT INTO t VALUES(0);
DELETE FROM t WHERE i=0;
connection default;
COMMIT;
+# Generate enough aria log records to increase area log file size
SELECT * FROM t;
i
1
2
# Prepare full backup, apply incremental one
+# Aria log file was updated during applying incremental backup
disconnect con1;
# Restore and check results
# shutdown server
@@ -27,3 +30,4 @@ i
1
2
DROP TABLE t;
+DROP TABLE t_aria;
diff --git a/mysql-test/suite/mariabackup/incremental_backup.test b/mysql-test/suite/mariabackup/incremental_backup.test
index 8fbfa701999..3e877af1398 100644
--- a/mysql-test/suite/mariabackup/incremental_backup.test
+++ b/mysql-test/suite/mariabackup/incremental_backup.test
@@ -1,10 +1,12 @@
+--source include/have_aria.inc
--source include/innodb_page_size.inc
call mtr.add_suppression("InnoDB: New log files created");
-let $basedir=$MYSQLTEST_VARDIR/tmp/backup;
-let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1;
+let basedir=$MYSQLTEST_VARDIR/tmp/backup;
+let incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1;
+CREATE TABLE t_aria(i INT) ENGINE ARIA;
CREATE TABLE t(i INT PRIMARY KEY) ENGINE INNODB;
BEGIN;
INSERT INTO t VALUES(2);
@@ -14,21 +16,73 @@ INSERT INTO t VALUES(1);
echo # Create full backup , modify table, then create incremental/differential backup;
--disable_result_log
-exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 --target-dir=$basedir;
--enable_result_log
BEGIN;
INSERT INTO t VALUES(0);
DELETE FROM t WHERE i=0;
connection default;
COMMIT;
+
+--echo # Generate enough aria log records to increase area log file size
+--disable_query_log
+--disable_result_log
+INSERT INTO t_aria VALUES
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9),
+ (0), (1), (2), (3), (4), (5), (6), (7), (8), (9);
+--let $i = 4
+while ($i) {
+INSERT INTO t_aria SELECT * FROM seq_1_to_2000;
+--dec $i
+}
+--enable_query_log
+--enable_result_log
+
SELECT * FROM t;
-exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --ftwrl-wait-timeout=5 --ftwrl-wait-threshold=300 --ftwrl-wait-query-type=all --target-dir=$incremental_dir --incremental-basedir=$basedir;
+# wf_incremental_init() allocates (page_size/4)*page_size bytes with mmap()
+# in each data file copy thread, what can fail on 32-bit platforms if threads
+# are too much, that's why don't set too big --parallel option value.
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=2 --ftwrl-wait-timeout=5 --ftwrl-wait-threshold=300 --ftwrl-wait-query-type=all --target-dir=$incremental_dir --incremental-basedir=$basedir;
--disable_result_log
echo # Prepare full backup, apply incremental one;
exec $XTRABACKUP --prepare --target-dir=$basedir;
exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir ;
+let perl_result_file=$MYSQLTEST_VARDIR/tmp/check_file_size_result.inc;
+
+--perl END_OF_FILE
+ use strict;
+ use warnings;
+
+ my $dst_file = "$ENV{'basedir'}/aria_log.00000001";
+ my $src_file = "$ENV{'incremental_dir'}/aria_log.00000001";
+ my $out_file = $ENV{'perl_result_file'};
+
+ my $dst_size = -s $dst_file;
+ my $src_size = -s $src_file;
+
+ open (my $output, '>', $out_file) or die $!;
+ if ($dst_size >= $src_size) {
+ print $output '--echo # Aria log file was updated during applying incremental backup'."\n";
+ }
+ else {
+ print $output '--echo # Aria log file was NOT updated during applying incremental backup'."\n";
+ }
+ close $output;
+END_OF_FILE
+
+--source $perl_result_file
+--remove_file $perl_result_file
+
disconnect con1;
echo # Restore and check results;
let $targetdir=$basedir;
@@ -37,6 +91,7 @@ let $targetdir=$basedir;
SELECT * FROM t;
DROP TABLE t;
+DROP TABLE t_aria;
# Cleanup
rmdir $basedir;
diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result
index 4088b36d440..7da9c840202 100644
--- a/mysql-test/suite/plugins/r/server_audit.result
+++ b/mysql-test/suite/plugins/r/server_audit.result
@@ -212,8 +212,22 @@ select 2;
2
2
drop table t1;
+set global server_audit_events='table';
+set global server_audit_incl_users='user1';
+create user user1@localhost;
+grant all on sa_db.* to user1@localhost;
+connect cn1,localhost,user1,,sa_db;
+connection cn1;
+create table t1(id int) engine=myisam;
+insert delayed into t1 values (1), (2);
+connection default;
+# Waiting until INSERT DELAYED thread does the insert.
+drop table t1;
set global server_audit_logging= off;
+set global server_audit_incl_users='root';
set global server_audit_logging= on;
+disconnect cn1;
+drop user user1@localhost;
set global server_audit_events='';
set global server_audit_query_log_limit= 15;
select (1), (2), (3), (4);
@@ -250,7 +264,7 @@ server_audit_file_path
server_audit_file_rotate_now OFF
server_audit_file_rotate_size 1000000
server_audit_file_rotations 9
-server_audit_incl_users odin, root, dva, tri
+server_audit_incl_users root
server_audit_logging ON
server_audit_mode 1
server_audit_output_type file
@@ -381,8 +395,16 @@ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1=<secret>',ID
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into t1 values (1), (2)',0
+TIME,HOSTNAME,user1,localhost,ID,ID,CREATE,sa_db,t1,
+TIME,HOSTNAME,user1,localhost,ID,ID,WRITE,sa_db,t1,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_logging= off',0
-TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_logging= on',0
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv,
+TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_events=\'\'',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global serv',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select (1), (2)',0
diff --git a/mysql-test/suite/plugins/t/server_audit.test b/mysql-test/suite/plugins/t/server_audit.test
index f19c8f53b61..67b855871a3 100644
--- a/mysql-test/suite/plugins/t/server_audit.test
+++ b/mysql-test/suite/plugins/t/server_audit.test
@@ -136,8 +136,28 @@ select * from t1;
select 2;
drop table t1;
+set global server_audit_events='table';
+set global server_audit_incl_users='user1';
+
+create user user1@localhost;
+grant all on sa_db.* to user1@localhost;
+
+connect (cn1,localhost,user1,,sa_db);
+connection cn1;
+
+create table t1(id int) engine=myisam;
+insert delayed into t1 values (1), (2);
+connection default;
+--echo # Waiting until INSERT DELAYED thread does the insert.
+let $wait_condition= SELECT COUNT(*) = 2 FROM t1;
+--source include/wait_condition.inc
+drop table t1;
+
set global server_audit_logging= off;
+set global server_audit_incl_users='root';
set global server_audit_logging= on;
+disconnect cn1;
+drop user user1@localhost;
set global server_audit_events='';
diff --git a/mysql-test/suite/wsrep/disabled.def b/mysql-test/suite/wsrep/disabled.def
index fcaf38a3d7b..862056bc83b 100644
--- a/mysql-test/suite/wsrep/disabled.def
+++ b/mysql-test/suite/wsrep/disabled.def
@@ -9,3 +9,6 @@
# Do not use any TAB characters for whitespace.
#
##############################################################################
+
+foreign_key : MENT-535 Galera test failures on wsrep suite
+pool_of_threads : MENT-535 Galera test failures on wsrep suite
diff --git a/mysql-test/suite/wsrep/t/pool_of_threads.opt b/mysql-test/suite/wsrep/t/pool_of_threads.opt
index 814417e5b0f..6948011b21b 100644
--- a/mysql-test/suite/wsrep/t/pool_of_threads.opt
+++ b/mysql-test/suite/wsrep/t/pool_of_threads.opt
@@ -1 +1 @@
---innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --thread_handling=pool-of-threads
+--innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --thread_handling=pool-of-threads wsrep-on=1
diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test
index d67c67de89c..78c16a0cd4c 100644
--- a/mysql-test/t/order_by.test
+++ b/mysql-test/t/order_by.test
@@ -2146,6 +2146,22 @@ SELECT DISTINCT pk FROM t1;
DROP TABLE t1;
--echo #
+--echo # MDEV-21044: Wrong result when using a smaller size for sort buffer
+--echo #
+
+create table t1(a varchar(765),b int);
+insert into t1 values ("a",1),("b",2),("c",3),("e",4);
+insert into t1 values ("d",5),("f",6),("g",7),("h",8);
+insert into t1 values ("k",11),("l",12),("i",9),("j",10);
+insert into t1 values ("m",13),("n",14),("o",15),("p",16);
+set @save_sort_buffer_size= @@sort_buffer_size;
+set sort_buffer_size=1024;
+select * from t1 order by b;
+set @@sort_buffer_size= @save_sort_buffer_size;
+drop table t1;
+
+
+--echo #
--echo # MDEV-13994: Bad join results with orderby_uses_equalities=on
--echo #
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index b2e38ae6641..38f12b5bd03 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -245,7 +245,7 @@ cannot_find_file()
echo "If you compiled from source, you need to either run 'make install' to"
echo "copy the software into the correct location ready for operation."
echo "If you don't want to do a full install, you can use the --srcdir"
- echo "option to only install the mysql database and privilege tables"
+ echo "option to only install the mysql database and privilege tables."
echo
echo "If you are using a binary release, you must either be at the top"
echo "level of the extracted archive, or pass the --basedir option"
diff --git a/sql/filesort.cc b/sql/filesort.cc
index f6530124b60..1df2f93676d 100644
--- a/sql/filesort.cc
+++ b/sql/filesort.cc
@@ -321,6 +321,7 @@ SORT_INFO *filesort(THD *thd, TABLE *table, Filesort *filesort,
param.max_keys_per_buffer=((param.max_keys_per_buffer *
(param.rec_length + sizeof(char*))) /
param.rec_length - 1);
+ set_if_bigger(param.max_keys_per_buffer, 1);
maxbuffer--; // Offset from 0
if (merge_many_buff(&param,
(uchar*) sort->get_sort_keys(),
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index b4a905896db..613fb75bcd6 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -1915,7 +1915,7 @@ protected:
Item_func::Functype type, Item *value);
public:
int escape;
- bool negated;
+ bool negated;
Item_func_like(THD *thd, Item *a, Item *b, Item *escape_arg, bool escape_used):
Item_bool_func2(thd, a, b), canDoTurboBM(FALSE), pattern(0), pattern_len(0),
diff --git a/sql/log_event.h b/sql/log_event.h
index a15b2168dda..368d9616daf 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -5191,6 +5191,9 @@ bool event_that_should_be_ignored(const char *buf);
bool event_checksum_test(uchar *buf, ulong event_len, enum_binlog_checksum_alg alg);
enum enum_binlog_checksum_alg get_checksum_alg(const char* buf, ulong len);
extern TYPELIB binlog_checksum_typelib;
+#ifdef WITH_WSREP
+enum Log_event_type wsrep_peak_event(rpl_group_info *rgi, ulonglong* event_size);
+#endif /* WITH_WSREP */
/**
@} (end of group Replication)
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 34e5704bcfe..58106add403 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -8754,8 +8754,8 @@ static void usage(void)
"\nbecause execution stopped before plugins were initialized.");
}
- puts("\nTo see what values a running MySQL server is using, type"
- "\n'mysqladmin variables' instead of 'mysqld --verbose --help'.");
+ puts("\nTo see what variables a running MySQL server is using, type"
+ "\n'mysqladmin variables' instead of 'mysqld --verbose --help'.");
}
DBUG_VOID_RETURN;
}
diff --git a/sql/slave.cc b/sql/slave.cc
index 1bc21f8895b..17abf8d53f3 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -304,6 +304,9 @@ handle_slave_background(void *arg __attribute__((unused)))
thd->store_globals();
thd->security_ctx->skip_grants();
thd->set_command(COM_DAEMON);
+#ifdef WITH_WSREP
+ thd->variables.wsrep_on= 0;
+#endif
thd_proc_info(thd, "Loading slave GTID position from table");
if (rpl_load_gtid_slave_state(thd))
@@ -4309,7 +4312,9 @@ pthread_handler_t handle_slave_io(void *arg)
goto err;
}
-
+#ifdef WITH_WSREP
+ thd->variables.wsrep_on= 0;
+#endif
if (RUN_HOOK(binlog_relay_io, thread_start, (thd, mi)))
{
mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL,
@@ -7389,7 +7394,33 @@ err:
sql_print_error("Error reading relay log event: %s", errmsg);
DBUG_RETURN(0);
}
+#ifdef WITH_WSREP
+enum Log_event_type wsrep_peak_event(rpl_group_info *rgi, ulonglong* event_size)
+{
+ mysql_mutex_lock(&rgi->rli->data_lock);
+
+ unsigned long long event_pos= rgi->event_relay_log_pos;
+ unsigned long long future_pos= rgi->future_event_relay_log_pos;
+ /* scan the log to read next event */
+ my_b_seek(rgi->rli->cur_log, future_pos);
+ rgi->rli->event_relay_log_pos= future_pos;
+ rgi->event_relay_log_pos= future_pos;
+
+ Log_event* ev = next_event(rgi, event_size);
+ enum Log_event_type ev_type= (ev) ? ev->get_type_code() : UNKNOWN_EVENT;
+ delete ev;
+
+ /* scan the log back and re-set the positions to original values */
+ rgi->rli->event_relay_log_pos= event_pos;
+ rgi->event_relay_log_pos= event_pos;
+ my_b_seek(rgi->rli->cur_log, future_pos);
+
+ mysql_mutex_unlock(&rgi->rli->data_lock);
+
+ return ev_type;
+}
+#endif /* WITH_WSREP */
/*
Rotate a relay log (this is used only by FLUSH LOGS; the automatic rotation
because of size is simpler because when we do it we already have all relevant
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index 550851bd215..a312a8652c4 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -2020,11 +2020,15 @@ public:
ulong auto_increment_offset;
LEX_STRING query;
Time_zone *time_zone;
+ char *user, *host, *ip;
+ query_id_t query_id;
+ my_thread_id thread_id;
delayed_row(LEX_STRING const query_arg, enum_duplicates dup_arg,
bool ignore_arg, bool log_query_arg)
: record(0), dup(dup_arg), ignore(ignore_arg), log_query(log_query_arg),
- forced_insert_id(0), query(query_arg), time_zone(0)
+ forced_insert_id(0), query(query_arg), time_zone(0),
+ user(0), host(0), ip(0)
{}
~delayed_row()
{
@@ -2072,6 +2076,27 @@ public:
passed from connection thread to the handler thread.
*/
MDL_request grl_protection;
+ my_thread_id orig_thread_id;
+ void set_default_user()
+ {
+ thd.security_ctx->user=(char*) delayed_user;
+ thd.security_ctx->host=(char*) my_localhost;
+ thd.security_ctx->ip= NULL;
+ thd.query_id= 0;
+ thd.thread_id= orig_thread_id;
+ }
+
+ void set_user_from_row(const delayed_row *r)
+ {
+ if (r)
+ {
+ thd.security_ctx->user= r->user;
+ thd.security_ctx->host= r->host;
+ thd.security_ctx->ip= r->ip;
+ thd.query_id= r->query_id;
+ thd.thread_id= r->thread_id;
+ }
+ }
Delayed_insert(SELECT_LEX *current_select)
:locks_in_memory(0), thd(next_thread_id()),
@@ -2079,8 +2104,8 @@ public:
status(0), retry(0), handler_thread_initialized(FALSE), group_count(0)
{
DBUG_ENTER("Delayed_insert constructor");
- thd.security_ctx->user=(char*) delayed_user;
- thd.security_ctx->host=(char*) my_localhost;
+ orig_thread_id= thd.thread_id;
+ set_default_user();
strmake_buf(thd.security_ctx->priv_user, thd.security_ctx->user);
thd.current_tablenr=0;
thd.set_command(COM_DELAYED_INSERT);
@@ -2584,6 +2609,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
delayed_row *row= 0;
Delayed_insert *di=thd->di;
const Discrete_interval *forced_auto_inc;
+ size_t user_len, host_len, ip_len;
DBUG_ENTER("write_delayed");
DBUG_PRINT("enter", ("query = '%s' length %lu", query.str,
(ulong) query.length));
@@ -2617,11 +2643,45 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic,
goto err;
}
+ user_len= host_len= ip_len= 0;
+ row->user= row->host= row->ip= NULL;
+ if (thd->security_ctx)
+ {
+ if (thd->security_ctx->user)
+ user_len= strlen(thd->security_ctx->user) + 1;
+ if (thd->security_ctx->host)
+ host_len= strlen(thd->security_ctx->host) + 1;
+ if (thd->security_ctx->ip)
+ ip_len= strlen(thd->security_ctx->ip) + 1;
+ }
/* This can't be THREAD_SPECIFIC as it's freed in delayed thread */
- if (!(row->record= (char*) my_malloc(table->s->reclength,
+ if (!(row->record= (char*) my_malloc(table->s->reclength +
+ user_len + host_len + ip_len,
MYF(MY_WME))))
goto err;
memcpy(row->record, table->record[0], table->s->reclength);
+
+ if (thd->security_ctx)
+ {
+ if (thd->security_ctx->user)
+ {
+ row->user= row->record + table->s->reclength;
+ memcpy(row->user, thd->security_ctx->user, user_len);
+ }
+ if (thd->security_ctx->host)
+ {
+ row->host= row->record + table->s->reclength + user_len;
+ memcpy(row->host, thd->security_ctx->host, host_len);
+ }
+ if (thd->security_ctx->ip)
+ {
+ row->ip= row->record + table->s->reclength + user_len + host_len;
+ memcpy(row->ip, thd->security_ctx->ip, ip_len);
+ }
+ }
+ row->query_id= thd->query_id;
+ row->thread_id= thd->thread_id;
+
row->start_time= thd->start_time;
row->query_start_used= thd->query_start_used;
row->start_time_sec_part= thd->start_time_sec_part;
@@ -3021,6 +3081,7 @@ pthread_handler_t handle_delayed_insert(void *arg)
if (di->tables_in_use && ! thd->lock && !thd->killed)
{
+ di->set_user_from_row(di->rows.head());
/*
Request for new delayed insert.
Lock the table, but avoid to be blocked by a global read lock.
@@ -3040,6 +3101,18 @@ pthread_handler_t handle_delayed_insert(void *arg)
}
if (di->stacked_inserts)
{
+ delayed_row *row;
+ I_List_iterator<delayed_row> it(di->rows);
+ while ((row= it++))
+ {
+ if (di->thd.thread_id != row->thread_id)
+ {
+ di->set_user_from_row(row);
+ mysql_audit_external_lock(&di->thd, di->table->s, F_WRLCK);
+ }
+ }
+ di->set_default_user();
+
if (di->handle_inserts())
{
/* Some fatal error */
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index b8f23cd135b..c9cb533aa33 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -19865,7 +19865,7 @@ join_read_last(JOIN_TAB *tab)
{
TABLE *table=tab->table;
int error= 0;
- DBUG_ENTER("join_read_first");
+ DBUG_ENTER("join_read_last");
DBUG_ASSERT(table->no_keyread ||
!table->covering_keys.is_set(tab->index) ||
diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc
index c34e14b7e1f..6cf29c43447 100644
--- a/sql/wsrep_hton.cc
+++ b/sql/wsrep_hton.cc
@@ -479,12 +479,29 @@ wsrep_run_wsrep_commit(THD *thd, bool all)
if (WSREP_UNDEFINED_TRX_ID == thd->wsrep_ws_handle.trx_id)
{
- WSREP_WARN("SQL statement was ineffective thd: %lld buf: %zu\n"
+ /*
+ Async replication slave may have applied some non-innodb workload,
+ and then has written replication "meta data" into gtid_slave_pos
+ innodb table. Writes to gtid_slave_pos must not be replicated,
+ but this activity has caused that innodb hton is registered for this
+ transaction, but no wsrep keys have been appended.
+ We enter in this code path, because IO cache has events for non-innodb
+ tables.
+ => we should not treat it an error if trx is not introduced for provider
+ */
+ if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL)
+ {
+ WSREP_DEBUG("skipping wsrep replication for async slave, error not raised");
+ DBUG_RETURN(WSREP_TRX_OK);
+ }
+
+ WSREP_WARN("SQL statement was ineffective thd: %llu buf: %zu\n"
"schema: %s \n"
"QUERY: %s\n"
" => Skipping replication",
- (longlong) thd->thread_id, data_len,
+ (ulonglong) thd->thread_id, data_len,
(thd->db ? thd->db : "(null)"), thd->query());
+
rcode = WSREP_TRX_FAIL;
}
else if (!rcode)
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 5e2e48fd15d..062c9dcd74c 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -37,7 +37,6 @@
#include <cstdio>
#include <cstdlib>
#include "log_event.h"
-#include <slave.h>
#include "sql_plugin.h" /* wsrep_plugins_pre_init() */
#include <vector>
@@ -1544,6 +1543,39 @@ static bool wsrep_can_run_in_toi(THD *thd, const char *db, const char *table,
{
return false;
}
+ /*
+ If mariadb master has replicated a CTAS, we should not replicate the create table
+ part separately as TOI, but to replicate both create table and following inserts
+ as one write set.
+ Howver, if CTAS creates empty table, we should replicate the create table alone
+ as TOI. We have to do relay log event lookup to see if row events follow the
+ create table event.
+ */
+ if (thd->slave_thread && !(thd->rgi_slave->gtid_ev_flags2 & Gtid_log_event::FL_STANDALONE))
+ {
+ /* this is CTAS, either empty or populated table */
+ ulonglong event_size = 0;
+ enum Log_event_type ev_type= wsrep_peak_event(thd->rgi_slave, &event_size);
+ switch (ev_type)
+ {
+ case QUERY_EVENT:
+ /* CTAS with empty table, we replicate create table as TOI */
+ break;
+
+ case TABLE_MAP_EVENT:
+ WSREP_DEBUG("replicating CTAS of empty table as TOI");
+ // fall through
+ case WRITE_ROWS_EVENT:
+ /* CTAS with populated table, we replicate later at commit time */
+ WSREP_DEBUG("skipping create table of CTAS replication");
+ return false;
+
+ default:
+ WSREP_WARN("unexpected async replication event: %d", ev_type);
+ }
+ return true;
+ }
+ /* no next async replication event */
return true;
case SQLCOM_CREATE_VIEW:
diff --git a/storage/connect/inihandl.cpp b/storage/connect/inihandl.cpp
index 8e79aeac7ef..dacab3c485c 100644
--- a/storage/connect/inihandl.cpp
+++ b/storage/connect/inihandl.cpp
@@ -194,7 +194,7 @@ static void PROFILE_Save( FILE *file, PROFILESECTION *section )
}
for (key = section->key; key; key = key->next)
- if (key->name && key->name[0]) {
+ if (key->name[0]) {
fprintf(file, "%s", SVP(key->name));
if (key->value)
diff --git a/storage/innobase/gis/gis0geo.cc b/storage/innobase/gis/gis0geo.cc
index cad3877d3e9..fb55945549e 100644
--- a/storage/innobase/gis/gis0geo.cc
+++ b/storage/innobase/gis/gis0geo.cc
@@ -801,35 +801,3 @@ rtree_area_overlapping(
return(area);
}
-
-/** Get the wkb of default POINT value, which represents POINT(0 0)
-if it's of dimension 2, etc.
-@param[in] n_dims dimensions
-@param[out] wkb wkb buffer for default POINT
-@param[in] len length of wkb buffer
-@return non-0 indicate the length of wkb of the default POINT,
-0 if the buffer is too small */
-uint
-get_wkb_of_default_point(
- uint n_dims,
- uchar* wkb,
- uint len)
-{
- // JAN: TODO: MYSQL 5.7 GIS
- #define GEOM_HEADER_SIZE 16
- if (len < GEOM_HEADER_SIZE + sizeof(double) * n_dims) {
- return(0);
- }
-
- /** POINT wkb comprises SRID, wkb header(byte order and type)
- and coordinates of the POINT */
- len = GEOM_HEADER_SIZE + sizeof(double) * n_dims;
- /** We always use 0 as default coordinate */
- memset(wkb, 0, len);
- /** We don't need to write SRID, write 0x01 for Byte Order */
- mach_write_to_n_little_endian(wkb + SRID_SIZE, 1, 0x01);
- /** Write wkbType::wkbPoint for the POINT type */
- mach_write_to_n_little_endian(wkb + SRID_SIZE + 1, 4, wkbPoint);
-
- return(len);
-}
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index caa0b1e861c..7e61a38320a 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -12964,12 +12964,15 @@ bool create_table_info_t::row_size_is_acceptable(
const size_t idx= info.get_first_overrun_field_index();
const dict_field_t *field= dict_index_get_nth_field(&index, idx);
- ib::error_or_warn(strict)
- << "Cannot add field " << field->name << " in table "
- << index.table->name << " because after adding it, the row size is "
- << info.get_overrun_size()
- << " which is greater than maximum allowed size ("
- << info.max_leaf_size << " bytes) for a record on index leaf page.";
+ if (strict || global_system_variables.log_warnings > 2)
+ {
+ ib::error_or_warn(strict)
+ << "Cannot add field " << field->name << " in table "
+ << index.table->name << " because after adding it, the row size is "
+ << info.get_overrun_size()
+ << " which is greater than maximum allowed size ("
+ << info.max_leaf_size << " bytes) for a record on index leaf page.";
+ }
if (strict)
{
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index 7bf00eaa7c8..c5768653154 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -4574,8 +4574,7 @@ loop:
}
if (!btr_pcur_is_on_user_rec(&pcur)) {
- ut_ad(btr_pcur_is_after_last_in_tree(&pcur, &mtr));
-
+ ut_ad(btr_pcur_is_after_last_on_page(&pcur));
goto reset_bit;
}
@@ -4805,8 +4804,7 @@ loop:
&pcur, &mtr);
if (!btr_pcur_is_on_user_rec(&pcur)) {
- ut_ad(btr_pcur_is_after_last_in_tree(&pcur, &mtr));
-
+ ut_ad(btr_pcur_is_after_last_on_page(&pcur));
goto leave_loop;
}
diff --git a/storage/innobase/include/gis0geo.h b/storage/innobase/include/gis0geo.h
index 3b71815d0fe..dea6d63f4e0 100644
--- a/storage/innobase/include/gis0geo.h
+++ b/storage/innobase/include/gis0geo.h
@@ -54,19 +54,6 @@ enum wkbByteOrder
wkbNDR = 1 /* Little Endian */
};
-/** Get the wkb of default POINT value, which represents POINT(0 0)
-if it's of dimension 2, etc.
-@param[in] n_dims dimensions
-@param[out] wkb wkb buffer for default POINT
-@param[in] len length of wkb buffer
-@return non-0 indicate the length of wkb of the default POINT,
-0 if the buffer is too small */
-uint
-get_wkb_of_default_point(
- uint n_dims,
- uchar* wkb,
- uint len);
-
/*************************************************************//**
Calculate minimal bounding rectangle (mbr) of the spatial object
stored in "well-known binary representation" (wkb) format.
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index fc411dad564..b32a2fa77ef 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -413,7 +413,7 @@ public:
/** Accessor for the AIO context
@param[in] segment Segment for which to get the context
@return the AIO context for the segment */
- io_context* io_ctx(ulint segment)
+ io_context_t io_ctx(ulint segment)
MY_ATTRIBUTE((warn_unused_result))
{
ut_ad(segment < get_n_segments());
@@ -421,11 +421,11 @@ public:
return(m_aio_ctx[segment]);
}
- /** Creates an io_context for native linux AIO.
+ /** Creates an io_context_t for native linux AIO.
@param[in] max_events number of events
@param[out] io_ctx io_ctx to initialize.
@return true on success. */
- static bool linux_create_io_ctx(unsigned max_events, io_context_t* io_ctx)
+ static bool linux_create_io_ctx(unsigned max_events, io_context_t& io_ctx)
MY_ATTRIBUTE((warn_unused_result));
/** Checks if the system supports native linux aio. On some kernel
@@ -622,7 +622,7 @@ private:
/** completion queue for IO. There is one such queue per
segment. Each thread will work on one ctx exclusively. */
- io_context_t* m_aio_ctx;
+ std::vector<io_context_t> m_aio_ctx;
/** The array to collect completed IOs. There is one such
event for each possible pending IO. The size of the array
@@ -1792,10 +1792,14 @@ LinuxAIOHandler::resubmit(Slot* slot)
iocb->data = slot;
+ ut_a(reinterpret_cast<size_t>(iocb->u.c.buf) % OS_FILE_LOG_BLOCK_SIZE
+ == 0);
+
/* Resubmit an I/O request */
int ret = io_submit(m_array->io_ctx(m_segment), 1, &iocb);
+ ut_a(ret != -EINVAL);
- if (ret < -1) {
+ if (ret < 0) {
errno = -ret;
}
@@ -1896,8 +1900,8 @@ LinuxAIOHandler::collect()
ut_ad(m_array != NULL);
ut_ad(m_segment < m_array->get_n_segments());
- /* Which io_context we are going to use. */
- io_context* io_ctx = m_array->io_ctx(m_segment);
+ /* Which io_context_t we are going to use. */
+ io_context_t io_ctx = m_array->io_ctx(m_segment);
/* Starting point of the m_segment we will be working on. */
ulint start_pos = m_segment * m_n_slots;
@@ -1924,6 +1928,8 @@ LinuxAIOHandler::collect()
int ret;
ret = io_getevents(io_ctx, 1, m_n_slots, events, &timeout);
+ ut_a(ret != -EINVAL);
+ ut_ad(ret != -EFAULT);
for (int i = 0; i < ret; ++i) {
@@ -2150,14 +2156,18 @@ AIO::linux_dispatch(Slot* slot)
/* Find out what we are going to work with.
The iocb struct is directly in the slot.
- The io_context is one per segment. */
+ The io_context_t is one per segment. */
ulint io_ctx_index;
struct iocb* iocb = &slot->control;
io_ctx_index = (slot->pos * m_n_segments) / m_slots.size();
- int ret = io_submit(m_aio_ctx[io_ctx_index], 1, &iocb);
+ ut_a(reinterpret_cast<size_t>(iocb->u.c.buf) % OS_FILE_LOG_BLOCK_SIZE
+ == 0);
+
+ int ret = io_submit(io_ctx(io_ctx_index), 1, &iocb);
+ ut_a(ret != -EINVAL);
/* io_submit() returns number of successfully queued requests
or -errno. */
@@ -2169,25 +2179,26 @@ AIO::linux_dispatch(Slot* slot)
return(ret == 1);
}
-/** Creates an io_context for native linux AIO.
+/** Creates an io_context_t for native linux AIO.
@param[in] max_events number of events
@param[out] io_ctx io_ctx to initialize.
@return true on success. */
bool
AIO::linux_create_io_ctx(
unsigned max_events,
- io_context_t* io_ctx)
+ io_context_t& io_ctx)
{
ssize_t n_retries = 0;
for (;;) {
- memset(io_ctx, 0x0, sizeof(*io_ctx));
+ memset(&io_ctx, 0x0, sizeof(io_ctx));
/* Initialize the io_ctx. Tell it how many pending
IO requests this context will handle. */
- int ret = io_setup(max_events, io_ctx);
+ int ret = io_setup(max_events, &io_ctx);
+ ut_a(ret != -EINVAL);
if (ret == 0) {
/* Success. Return now. */
@@ -2266,7 +2277,7 @@ AIO::is_linux_native_aio_supported()
io_context_t io_ctx;
char name[1000];
- if (!linux_create_io_ctx(1, &io_ctx)) {
+ if (!linux_create_io_ctx(1, io_ctx)) {
/* The platform does not support native aio. */
@@ -2282,6 +2293,10 @@ AIO::is_linux_native_aio_supported()
<< "Unable to create temp file to check"
" native AIO support.";
+ int ret = io_destroy(io_ctx);
+ ut_a(ret != -EINVAL);
+ ut_ad(ret != -EFAULT);
+
return(false);
}
} else {
@@ -2311,6 +2326,10 @@ AIO::is_linux_native_aio_supported()
<< " \"" << name << "\" to check native"
<< " AIO read support.";
+ int ret = io_destroy(io_ctx);
+ ut_a(ret != EINVAL);
+ ut_ad(ret != EFAULT);
+
return(false);
}
}
@@ -2339,11 +2358,15 @@ AIO::is_linux_native_aio_supported()
io_prep_pread(p_iocb, fd, ptr, 512, 0);
}
+ ut_a(reinterpret_cast<size_t>(p_iocb->u.c.buf) % OS_FILE_LOG_BLOCK_SIZE
+ == 0);
int err = io_submit(io_ctx, 1, &p_iocb);
+ ut_a(err != -EINVAL);
if (err >= 1) {
/* Now collect the submitted IO request. */
err = io_getevents(io_ctx, 1, 1, &io_event, NULL);
+ ut_a(err != -EINVAL);
}
ut_free(buf);
@@ -2351,7 +2374,13 @@ AIO::is_linux_native_aio_supported()
switch (err) {
case 1:
- return(true);
+ {
+ int ret = io_destroy(io_ctx);
+ ut_a(ret != -EINVAL);
+ ut_ad(ret != -EFAULT);
+
+ return(true);
+ }
case -EINVAL:
case -ENOSYS:
@@ -2371,6 +2400,10 @@ AIO::is_linux_native_aio_supported()
<< "returned error[" << -err << "]";
}
+ int ret = io_destroy(io_ctx);
+ ut_a(ret != -EINVAL);
+ ut_ad(ret != -EFAULT);
+
return(false);
}
@@ -5779,8 +5812,7 @@ AIO::AIO(
m_n_segments(segments),
m_n_reserved()
# ifdef LINUX_NATIVE_AIO
- ,m_aio_ctx(),
- m_events(m_slots.size())
+ ,m_events(m_slots.size())
# endif /* LINUX_NATIVE_AIO */
#ifdef WIN_ASYNC_IO
,m_completion_port(new_completion_port())
@@ -5836,29 +5868,20 @@ AIO::init_slots()
dberr_t
AIO::init_linux_native_aio()
{
- /* Initialize the io_context array. One io_context
- per segment in the array. */
- ut_a(m_aio_ctx == NULL);
-
- m_aio_ctx = static_cast<io_context**>(
- ut_zalloc_nokey(m_n_segments * sizeof(*m_aio_ctx)));
-
- if (m_aio_ctx == NULL) {
- return(DB_OUT_OF_MEMORY);
- }
+ /* Initialize the io_context_t array. One io_context_t
+ per segment in the array. */
+ m_aio_ctx.resize(get_n_segments());
- io_context** ctx = m_aio_ctx;
ulint max_events = slots_per_segment();
- for (ulint i = 0; i < m_n_segments; ++i, ++ctx) {
+ for (std::vector<io_context_t>::iterator it = m_aio_ctx.begin(),
+ end = m_aio_ctx.end();
+ it != end; ++it) {
- if (!linux_create_io_ctx(max_events, ctx)) {
+ if (!linux_create_io_ctx(max_events, *it)) {
/* If something bad happened during aio setup
we disable linux native aio.
- The disadvantage will be a small memory leak
- at shutdown but that's ok compared to a crash
- or a not working server.
This frequently happens when running the test suite
with many threads on a system with low fs.aio-max-nr!
*/
@@ -5870,8 +5893,15 @@ AIO::init_linux_native_aio()
<< "try increasing system "
<< "fs.aio-max-nr to 1048576 or larger or "
<< "setting innodb_use_native_aio = 0 in my.cnf";
- ut_free(m_aio_ctx);
- m_aio_ctx = 0;
+
+ for (std::vector<io_context_t>::iterator it2
+ = m_aio_ctx.begin();
+ it2 != it; ++it2) {
+ int ret = io_destroy(*it2);
+ ut_a(ret != -EINVAL);
+ }
+
+ m_aio_ctx.clear();
srv_use_native_aio = FALSE;
return(DB_SUCCESS);
}
@@ -5947,15 +5977,15 @@ AIO::~AIO()
#if defined(LINUX_NATIVE_AIO)
if (srv_use_native_aio) {
- m_events.clear();
- ut_free(m_aio_ctx);
+ for (ulint i = 0; i < m_aio_ctx.size(); i++) {
+ int ret = io_destroy(m_aio_ctx[i]);
+ ut_a(ret != -EINVAL);
+ }
}
#endif /* LINUX_NATIVE_AIO */
#if defined(WIN_ASYNC_IO)
CloseHandle(m_completion_port);
#endif
-
- m_slots.clear();
}
/** Initializes the asynchronous io system. Creates one array each for ibuf
@@ -6249,6 +6279,10 @@ AIO::reserve_slot(
os_offset_t offset,
ulint len)
{
+ ut_ad(reinterpret_cast<size_t>(buf) % OS_FILE_LOG_BLOCK_SIZE == 0);
+ ut_ad(offset % OS_FILE_LOG_BLOCK_SIZE == 0);
+ ut_ad(len % OS_FILE_LOG_BLOCK_SIZE == 0);
+
#ifdef WIN_ASYNC_IO
ut_a((len & 0xFFFFFFFFUL) == len);
#endif /* WIN_ASYNC_IO */
diff --git a/storage/innobase/os/os0thread.cc b/storage/innobase/os/os0thread.cc
index b34d875b759..2aac53f572d 100644
--- a/storage/innobase/os/os0thread.cc
+++ b/storage/innobase/os/os0thread.cc
@@ -125,11 +125,17 @@ os_thread_create_func(
pthread_attr_t attr;
- pthread_attr_init(&attr);
+ int ret = pthread_attr_init(&attr);
+ if (UNIV_UNLIKELY(ret)) {
+ fprintf(stderr,
+ "InnoDB: Error: pthread_attr_init() returned %d\n",
+ ret);
+ abort();
+ }
my_atomic_addlint(&os_thread_count, 1);
- int ret = pthread_create(&new_thread_id, &attr, func, arg);
+ ret = pthread_create(&new_thread_id, &attr, func, arg);
ut_a(ret == 0);
diff --git a/storage/spider/mysql-test/spider/r/pushdown_not_like.result b/storage/spider/mysql-test/spider/r/pushdown_not_like.result
new file mode 100644
index 00000000000..cd926962180
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/pushdown_not_like.result
@@ -0,0 +1,63 @@
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+drop and create databases
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+CREATE DATABASE auto_test_remote;
+USE auto_test_remote;
+
+create table select test
+connection master_1;
+DROP TABLE IF EXISTS ta_l;
+CREATE TABLE ta_l (
+a INT,
+b CHAR(1),
+c DATETIME,
+PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1
+INSERT INTO ta_l (a, b, c) VALUES
+(1, 'a', '2018-11-01 10:21:39'),
+(2, 'b', '2015-06-30 23:59:59'),
+(3, 'c', '2013-11-01 01:01:01');
+
+spider not like bug fix test
+connection master_1;
+select * from ta_l where b not like 'a%';
+a b c
+2 b 2015-06-30 23:59:59
+3 c 2013-11-01 01:01:01
+connection child2_1;
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select%';
+argument
+select `a`,`b`,`c` from `auto_test_remote`.`ta_r` where (`b` not like 'a%')
+SELECT argument FROM mysql.general_log WHERE argument LIKE '%select%'
+
+deinit
+connection master_1;
+DROP DATABASE IF EXISTS auto_test_local;
+connection child2_1;
+DROP DATABASE IF EXISTS auto_test_remote;
+SET GLOBAL log_output = @old_log_output;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+
+end of test
diff --git a/storage/spider/mysql-test/spider/t/pushdown_not_like.test b/storage/spider/mysql-test/spider/t/pushdown_not_like.test
new file mode 100644
index 00000000000..95e4fa6eea8
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/pushdown_not_like.test
@@ -0,0 +1,138 @@
+--disable_warnings
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+
+--echo
+--echo drop and create databases
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ CREATE DATABASE auto_test_remote;
+ USE auto_test_remote;
+}
+--enable_warnings
+
+
+--echo
+--echo create table select test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ echo CHILD2_1_DROP_TABLES;
+ echo CHILD2_1_CREATE_TABLES;
+ }
+ --disable_warnings
+ eval $CHILD2_1_DROP_TABLES;
+ --enable_warnings
+ eval $CHILD2_1_CREATE_TABLES;
+ if ($OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ }
+ if ($USE_GENERAL_LOG)
+ {
+ SET @old_log_output = @@global.log_output;
+ TRUNCATE TABLE mysql.general_log;
+ set global log_output = 'TABLE';
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+--disable_warnings
+DROP TABLE IF EXISTS ta_l;
+--enable_warnings
+--disable_query_log
+echo CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1;
+eval CREATE TABLE ta_l (
+ a INT,
+ b CHAR(1),
+ c DATETIME,
+ PRIMARY KEY(a)
+) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+--enable_query_log
+INSERT INTO ta_l (a, b, c) VALUES
+ (1, 'a', '2018-11-01 10:21:39'),
+ (2, 'b', '2015-06-30 23:59:59'),
+ (3, 'c', '2013-11-01 01:01:01');
+
+--echo
+--echo spider not like bug fix test
+if ($USE_CHILD_GROUP2)
+{
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --disable_query_log
+ --disable_result_log
+ }
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ TRUNCATE TABLE mysql.general_log;
+ }
+ if (!$OUTPUT_CHILD_GROUP2)
+ {
+ --enable_query_log
+ --enable_result_log
+ }
+}
+
+--connection master_1
+select * from ta_l where b not like 'a%';
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ if ($USE_GENERAL_LOG)
+ {
+ SELECT argument FROM mysql.general_log WHERE argument LIKE '%select%';
+ }
+}
+
+
+--echo
+--echo deinit
+--disable_warnings
+--connection master_1
+DROP DATABASE IF EXISTS auto_test_local;
+if ($USE_CHILD_GROUP2)
+{
+ --connection child2_1
+ DROP DATABASE IF EXISTS auto_test_remote;
+ SET GLOBAL log_output = @old_log_output;
+}
+
+
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
+--enable_warnings
+--echo
+--echo end of test
diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h
index 7db61d44e20..39e2c8650c4 100644
--- a/storage/spider/spd_db_include.h
+++ b/storage/spider/spd_db_include.h
@@ -139,6 +139,8 @@ typedef st_spider_result SPIDER_RESULT;
#define SPIDER_SQL_IN_LEN (sizeof(SPIDER_SQL_IN_STR) - 1)
#define SPIDER_SQL_NOT_IN_STR "not in("
#define SPIDER_SQL_NOT_IN_LEN (sizeof(SPIDER_SQL_NOT_IN_STR) - 1)
+#define SPIDER_SQL_NOT_LIKE_STR "not like"
+#define SPIDER_SQL_NOT_LIKE_LEN (sizeof(SPIDER_SQL_NOT_LIKE_STR) - 1)
#define SPIDER_SQL_AS_CHAR_STR " as char"
#define SPIDER_SQL_AS_CHAR_LEN (sizeof(SPIDER_SQL_AS_CHAR_STR) - 1)
#define SPIDER_SQL_CAST_STR "cast("
diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc
index 6f2960cb868..2be4c810c06 100644
--- a/storage/spider/spd_db_mysql.cc
+++ b/storage/spider/spd_db_mysql.cc
@@ -3948,13 +3948,27 @@ int spider_db_mysql_util::open_item_func(
case Item_func::LE_FUNC:
case Item_func::GE_FUNC:
case Item_func::GT_FUNC:
- case Item_func::LIKE_FUNC:
if (str)
{
func_name = (char*) item_func->func_name();
func_name_length = strlen(func_name);
}
break;
+ case Item_func::LIKE_FUNC:
+ if (str)
+ {
+ if (((Item_func_like *)item_func)->negated)
+ {
+ func_name = SPIDER_SQL_NOT_LIKE_STR;
+ func_name_length = SPIDER_SQL_NOT_LIKE_LEN;
+ }
+ else
+ {
+ func_name = (char*)item_func->func_name();
+ func_name_length = strlen(func_name);
+ }
+ }
+ break;
default:
THD *thd = spider->trx->thd;
SPIDER_SHARE *share = spider->share;