From 6aa22eaf62ab6cd78073efbddbc2ff3b5f11883d Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Wed, 7 Mar 2018 14:36:40 +1100 Subject: [PATCH 01/17] wsrep_sst_common: fix per shellcheck shellcheck -s sh wsrep_sst_common.sh In wsrep_sst_common.sh line 258: [ -n $3 ] && reval=$3 ^-- SC2070: -n doesn't work with unquoted arguments. Quote or use [[ ]]. ^-- SC2086: Double quote to prevent globbing and word splitting. --- scripts/wsrep_sst_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index b9d9d04fef6..7f3fe23e0c4 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -255,7 +255,7 @@ parse_cnf() # use default if we haven't found a value if [ -z $reval ]; then - [ -n $3 ] && reval=$3 + [ -n "$3" ] && reval=$3 fi echo $reval } From 33e39f0682d966f67aa403a0be9bc7dbd44a69e6 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomew Date: Thu, 3 May 2018 10:23:36 -0400 Subject: [PATCH 02/17] bump the VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 44f719ca097..23e938e60e1 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=5 MYSQL_VERSION_MINOR=5 -MYSQL_VERSION_PATCH=60 +MYSQL_VERSION_PATCH=61 MYSQL_VERSION_EXTRA= From cf648afd5b336ea61eacb3d0c0e52e0777d12c16 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 14 Jun 2018 15:12:13 +0200 Subject: [PATCH 03/17] fix galera sst tests note that ${A#foo} is $A if there's no prefix foo. That's why galera nodes tried to connect to 127.0.0.1:127.0.0.1 if there was no port in the address Followup for 2b35db5ac4e --- scripts/wsrep_sst_common.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index d20e3bc36c9..1f57f3ebbc2 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -41,15 +41,14 @@ case "$1" in addr_no_bracket=${WSREP_SST_OPT_ADDR#\[} readonly WSREP_SST_OPT_HOST_UNESCAPED=${addr_no_bracket%%\]*} readonly WSREP_SST_OPT_HOST="[${WSREP_SST_OPT_HOST_UNESCAPED}]" - remain=${WSREP_SST_OPT_ADDR#*\]} - remain=${remain#*:} ;; *) readonly WSREP_SST_OPT_HOST=${WSREP_SST_OPT_ADDR%%[:/]*} readonly WSREP_SST_OPT_HOST_UNESCAPED=$WSREP_SST_OPT_HOST - remain=${WSREP_SST_OPT_ADDR#*:} ;; esac + remain=${WSREP_SST_OPT_ADDR#${WSREP_SST_OPT_HOST}} + remain=${remain#:} readonly WSREP_SST_OPT_ADDR_PORT=${remain%%/*} remain=${remain#*/} readonly WSREP_SST_OPT_MODULE=${remain%%/*} From c09d54924a46df13daf68f61caf906b6fecefca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 19 Jul 2018 15:13:31 +0300 Subject: [PATCH 04/17] MDEV-10564: Galera `wsrep_debug` patch logs MySQL user credentials Restricted output for CREATE USER, GRANT, REVOKE and SET PASSWORD so that it shows only above keywords but not rest of query i.e. not user or password. --- sql/wsrep_mysqld.cc | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index bd397a9a012..5b6575e7166 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1317,6 +1317,25 @@ static bool wsrep_can_run_in_toi(THD *thd, const char *db, const char *table, } } +static const char* wsrep_get_query_or_msg(const THD* thd) +{ + switch(thd->lex->sql_command) + { + case SQLCOM_CREATE_USER: + return "CREATE USER"; + case SQLCOM_GRANT: + return "GRANT"; + case SQLCOM_REVOKE: + return "REVOKE"; + case SQLCOM_SET_OPTION: + if (thd->lex->definer) + return "SET PASSWORD"; + /* fallthrough */ + default: + return thd->query(); + } +} + /* returns: 0: statement was replicated as TOI @@ -1339,7 +1358,8 @@ static int wsrep_TOI_begin(THD *thd, char *db_, char *table_, } WSREP_DEBUG("TO BEGIN: %lld, %d : %s", (long long)wsrep_thd_trx_seqno(thd), - thd->wsrep_exec_mode, thd->query() ); + thd->wsrep_exec_mode, wsrep_get_query_or_msg(thd)); + switch (thd->lex->sql_command) { case SQLCOM_CREATE_VIEW: @@ -1413,8 +1433,8 @@ static void wsrep_TOI_end(THD *thd) { wsrep_status_t ret; wsrep_to_isolation--; - WSREP_DEBUG("TO END: %lld, %d : %s", (long long)wsrep_thd_trx_seqno(thd), - thd->wsrep_exec_mode, (thd->query()) ? thd->query() : "void"); + WSREP_DEBUG("TO END: %lld, %d: %s", (long long)wsrep_thd_trx_seqno(thd), + thd->wsrep_exec_mode, wsrep_get_query_or_msg(thd)); wsrep_set_SE_checkpoint(thd->wsrep_trx_meta.gtid.uuid, thd->wsrep_trx_meta.gtid.seqno); From f99fe68b4fb7ca1715d059d283e50f050f692294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 19 Jul 2018 21:05:36 +0300 Subject: [PATCH 05/17] Fix compile error. --- sql/sql_trigger.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index 34875824e2e..784464110cf 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -508,7 +508,9 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) if (err_status) goto end; } - WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL); + + if (thd->wsrep_exec_mode == LOCAL_STATE) + WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL); /* We should have only one table in table list. */ DBUG_ASSERT(tables->next_global == 0); From c863159c320008676aff978a7cdde5732678f975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Tue, 24 Jul 2018 14:54:50 +0300 Subject: [PATCH 06/17] MDEV-16799: Test wsrep.variables crash at sql_class.cc:639 thd_get_ha_data Problem was that binlog_hton was not initialized fully when needed i.e. when wsrep_on = true. --- sql/events.cc | 3 +++ sql/handler.cc | 1 + sql/log.cc | 12 ++---------- sql/log_event.cc | 5 ----- sql/sql_class.cc | 1 + sql/sql_insert.cc | 10 ++++++++-- sql/sql_parse.cc | 26 +++++++++++++++++++------- sql/wsrep_hton.cc | 21 ++++++++++++++------- sql/wsrep_mysqld.h | 3 +++ 9 files changed, 51 insertions(+), 31 deletions(-) diff --git a/sql/events.cc b/sql/events.cc index 661d9e19001..a30c1fadf75 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -331,6 +331,7 @@ Events::create_event(THD *thd, Event_parse_data *parse_data, if (check_access(thd, EVENT_ACL, parse_data->dbname.str, NULL, NULL, 0, 0)) DBUG_RETURN(TRUE); + WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL); if (check_db_dir_existence(parse_data->dbname.str)) @@ -454,6 +455,7 @@ Events::update_event(THD *thd, Event_parse_data *parse_data, if (check_access(thd, EVENT_ACL, parse_data->dbname.str, NULL, NULL, 0, 0)) DBUG_RETURN(TRUE); + WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL); if (new_dbname) /* It's a rename */ @@ -569,6 +571,7 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists) if (check_access(thd, EVENT_ACL, dbname.str, NULL, NULL, 0, 0)) DBUG_RETURN(TRUE); + WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL); /* diff --git a/sql/handler.cc b/sql/handler.cc index 128043a8d80..d8df91c82ab 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -4455,6 +4455,7 @@ handler::ha_create_partitioning_metadata(const char *name, const char *old_name, (!old_name && strcmp(name, table_share->path.str))); + mark_trx_read_write(); return create_partitioning_metadata(name, old_name, action_flag); } diff --git a/sql/log.cc b/sql/log.cc index 0098dd2ba3d..3034a6b894a 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1707,16 +1707,8 @@ binlog_trans_log_truncate(THD *thd, my_off_t pos) int binlog_init(void *p) { binlog_hton= (handlerton *)p; -#ifdef WITH_WSREP - if (WSREP_ON) - binlog_hton->state= SHOW_OPTION_YES; - else - { -#endif /* WITH_WSREP */ - binlog_hton->state=opt_bin_log ? SHOW_OPTION_YES : SHOW_OPTION_NO; -#ifdef WITH_WSREP - } -#endif /* WITH_WSREP */ + binlog_hton->state= (WSREP_ON || opt_bin_log) ? SHOW_OPTION_YES + : SHOW_OPTION_NO; binlog_hton->db_type=DB_TYPE_BINLOG; binlog_hton->savepoint_offset= sizeof(my_off_t); binlog_hton->close_connection= binlog_close_connection; diff --git a/sql/log_event.cc b/sql/log_event.cc index 52df9fc5f84..5697f5fa707 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -7753,11 +7753,6 @@ User_var_log_event(const char* buf, uint event_len, we keep the flags set to UNDEF_F. */ uint bytes_read= ((val + val_len) - buf_start); - if (bytes_read > event_len) - { - error= true; - goto err; - } if ((data_written - bytes_read) > 0) { flags= (uint) *(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE + diff --git a/sql/sql_class.cc b/sql/sql_class.cc index b3d964d4006..59746d466ea 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -6689,6 +6689,7 @@ int THD::binlog_query(THD::enum_binlog_query_type qtype, char const *query_arg, DBUG_ENTER("THD::binlog_query"); DBUG_PRINT("enter", ("qtype: %s query: '%-.*s'", show_query_type(qtype), (int) query_len, query_arg)); + #ifdef WITH_WSREP DBUG_ASSERT(query_arg && (WSREP_EMULATE_BINLOG(this) || mysql_bin_log.is_open())); diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index fa754d2da38..48fd4a2bd6e 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -4333,6 +4333,8 @@ bool select_create::send_eof() if (!table->s->tmp_table) { #ifdef WITH_WSREP + if (WSREP_ON) + { /* append table level exclusive key for CTAS */ @@ -4359,22 +4361,26 @@ bool select_create::send_eof() } /* If commit fails, we should be able to reset the OK status. */ thd->get_stmt_da()->set_overwrite_status(TRUE); + } #endif /* WITH_WSREP */ trans_commit_stmt(thd); if (!(thd->variables.option_bits & OPTION_GTID_BEGIN)) trans_commit_implicit(thd); #ifdef WITH_WSREP - thd->get_stmt_da()->set_overwrite_status(FALSE); + if (WSREP_ON) + { + thd->get_stmt_da()->set_overwrite_status(FALSE); mysql_mutex_lock(&thd->LOCK_wsrep_thd); if (thd->wsrep_conflict_state != NO_CONFLICT) { - WSREP_DEBUG("select_create commit failed, thd: %lu err: %d %s", + WSREP_DEBUG("select_create commit failed, thd: %lu err: %d %s", thd->thread_id, thd->wsrep_conflict_state, thd->query()); mysql_mutex_unlock(&thd->LOCK_wsrep_thd); abort_result_set(); DBUG_RETURN(true); } mysql_mutex_unlock(&thd->LOCK_wsrep_thd); + } #endif /* WITH_WSREP */ } else if (!thd->is_current_stmt_binlog_format_row()) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index c353c50d8c0..2b11e492a94 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -5622,6 +5622,7 @@ finish: #ifdef WITH_WSREP else if (thd->spcont && (thd->wsrep_conflict_state == MUST_ABORT || + thd->wsrep_conflict_state == ABORTED || thd->wsrep_conflict_state == CERT_FAILURE)) { /* @@ -7017,7 +7018,9 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, com_statement_info[thd->get_command()].m_key); MYSQL_SET_STATEMENT_TEXT(thd->m_statement_psi, thd->query(), thd->query_length()); + WSREP_DEBUG("Retry autocommit query: %s", thd->query()); } + mysql_parse(thd, rawbuf, length, parser_state); if (WSREP(thd)) { @@ -7031,6 +7034,11 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, if (thd->wsrep_conflict_state == MUST_REPLAY) { + mysql_mutex_unlock(&thd->LOCK_wsrep_thd); + if (thd->lex->explain) + delete_explain_query(thd->lex); + mysql_mutex_lock(&thd->LOCK_wsrep_thd); + wsrep_replay_transaction(thd); } @@ -7044,7 +7052,7 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, thd->lex->sql_command != SQLCOM_SELECT && (thd->wsrep_retry_counter < thd->variables.wsrep_retry_autocommit)) { - WSREP_DEBUG("wsrep retrying AC query: %s", + WSREP_DEBUG("wsrep retrying AC query: %s", (thd->query()) ? thd->query() : "void"); /* Performance Schema Interface instrumentation, end */ @@ -7061,27 +7069,31 @@ static void wsrep_mysql_parse(THD *thd, char *rawbuf, uint length, } else { - WSREP_DEBUG("%s, thd: %lu is_AC: %d, retry: %lu - %lu SQL: %s", - (thd->wsrep_conflict_state == ABORTED) ? + WSREP_DEBUG("%s, thd: %lu is_AC: %d, retry: %lu - %lu SQL: %s", + (thd->wsrep_conflict_state == ABORTED) ? "BF Aborted" : "cert failure", - thd->thread_id, is_autocommit, thd->wsrep_retry_counter, + thd->thread_id, is_autocommit, thd->wsrep_retry_counter, thd->variables.wsrep_retry_autocommit, thd->query()); my_error(ER_LOCK_DEADLOCK, MYF(0), "wsrep aborted transaction"); - thd->killed= NOT_KILLED; thd->wsrep_conflict_state= NO_CONFLICT; if (thd->wsrep_conflict_state != REPLAYING) thd->wsrep_retry_counter= 0; // reset } + + mysql_mutex_unlock(&thd->LOCK_wsrep_thd); + thd->reset_killed(); } else { set_if_smaller(thd->wsrep_retry_counter, 0); // reset; eventually ok + mysql_mutex_unlock(&thd->LOCK_wsrep_thd); } - mysql_mutex_unlock(&thd->LOCK_wsrep_thd); } /* If retry is requested clean up explain structure */ - if (thd->wsrep_conflict_state == RETRY_AUTOCOMMIT && thd->lex->explain) + if ((thd->wsrep_conflict_state == RETRY_AUTOCOMMIT || + thd->wsrep_conflict_state == MUST_REPLAY ) + && thd->lex->explain) delete_explain_query(thd->lex); } while (thd->wsrep_conflict_state== RETRY_AUTOCOMMIT); diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc index 0a2264ac03c..734a0686a6d 100644 --- a/sql/wsrep_hton.cc +++ b/sql/wsrep_hton.cc @@ -24,6 +24,8 @@ #include #include "debug_sync.h" +extern handlerton *binlog_hton; +extern int binlog_close_connection(handlerton *hton, THD *thd); extern ulonglong thd_to_trx_id(THD *thd); extern "C" int thd_binlog_format(const MYSQL_THD thd); @@ -173,7 +175,10 @@ wsrep_close_connection(handlerton* hton, THD* thd) { DBUG_RETURN(0); } - DBUG_RETURN(wsrep_binlog_close_connection (thd)); + + if (wsrep_emulate_bin_log && thd_get_ha_data(thd, binlog_hton) != NULL) + binlog_hton->close_connection (binlog_hton, thd); + DBUG_RETURN(0); } /* @@ -256,9 +261,9 @@ static int wsrep_rollback(handlerton *hton, THD *thd, bool all) } if ((all || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) && - thd->wsrep_conflict_state != MUST_REPLAY) + thd->variables.wsrep_on && thd->wsrep_conflict_state != MUST_REPLAY) { - if (WSREP(thd) && wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle)) + if (wsrep && wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle)) { DBUG_PRINT("wsrep", ("setting rollback fail")); WSREP_ERROR("settting rollback fail: thd: %llu, schema: %s, SQL: %s", @@ -299,12 +304,14 @@ int wsrep_commit(handlerton *hton, THD *thd, bool all) Transaction didn't go through wsrep->pre_commit() so just roll back possible changes to clean state. */ - if (WSREP(thd) && wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle)) - { - DBUG_PRINT("wsrep", ("setting rollback fail")); - WSREP_ERROR("settting rollback fail: thd: %llu, schema: %s, SQL: %s", + if (WSREP_PROVIDER_EXISTS) { + if (wsrep && wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle)) + { + DBUG_PRINT("wsrep", ("setting rollback fail")); + WSREP_ERROR("settting rollback fail: thd: %llu, schema: %s, SQL: %s", (long long)thd->real_id, (thd->db ? thd->db : "(null)"), thd->query()); + } } wsrep_cleanup_transaction(thd); } diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index 94c97f04aab..ee96a304f7b 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -204,6 +204,9 @@ extern void wsrep_prepend_PATH (const char* path); extern wsrep_seqno_t wsrep_locked_seqno; #define WSREP_ON \ + (global_system_variables.wsrep_on) + +#define WSREP_ON_NEW \ ((global_system_variables.wsrep_on) && \ wsrep_provider && \ strcmp(wsrep_provider, WSREP_NONE)) From 4d2b5523695ea6b6f7e6cde406165a09d517dfeb Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Tue, 22 May 2018 16:45:27 +0200 Subject: [PATCH 07/17] Fix FK constraint violation in applier, after ALTER TABLE ADD FK Adding a FK constraint to an existing table (ALTER TABLE ADD FOREIGN KEY) causes the applier to fail, if a concurrent DML statement that violate the new constraint (i.e. a DELETE or UPDATE of record in the parent table). For exmaple, the following scenario causes a crash in the applier: 1. ALTER successfully adds FK constraint in node_1 2. On node_2 is UPDATE is in pre_commit() and has certified successfully 3. ALTER is delivered in node_2 and BF aborts DML 4. Applying UPDATE event causes FK violation in node_1 To avoid this situation it is necessary for UPDATE to fail during certification. And for the UPDATE to fail certfication it is necessary that ALTER appends certification keys for both the child and the parent table. Before this patch, ALTER TABLE ADD FK only appended keys for child table which is ALTERed. --- .../suite/galera/r/mysql-wsrep#332.result | 111 ++++++++ .../suite/galera/t/mysql-wsrep#332.test | 113 ++++++++ scripts/mysql_config.pl | 2 +- sql/sql_alter.cc | 17 +- sql/sql_parse.h | 5 + sql/wsrep_mysqld.cc | 253 ++++++++++-------- sql/wsrep_mysqld.h | 4 +- 7 files changed, 383 insertions(+), 122 deletions(-) create mode 100644 mysql-test/suite/galera/r/mysql-wsrep#332.result create mode 100644 mysql-test/suite/galera/t/mysql-wsrep#332.test diff --git a/mysql-test/suite/galera/r/mysql-wsrep#332.result b/mysql-test/suite/galera/r/mysql-wsrep#332.result new file mode 100644 index 00000000000..8667f5e9c41 --- /dev/null +++ b/mysql-test/suite/galera/r/mysql-wsrep#332.result @@ -0,0 +1,111 @@ +CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER) ENGINE=INNODB; +INSERT INTO p VALUES (1, 0); +INSERT INTO p VALUES (2, 0); +INSERT INTO c VALUES (1, 1); +INSERT INTO c VALUES (2, 2); +SET AUTOCOMMIT=ON; +START TRANSACTION; +UPDATE p SET f1 = f1 + 100; +SET SESSION wsrep_sync_wait = 0; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +ALTER TABLE c ADD FOREIGN KEY (p_id) REFERENCES p(f1); +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync'; +COMMIT; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync'; +SET GLOBAL wsrep_provider_options = 'dbug='; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SELECT * FROM p; +f1 f2 +1 0 +2 0 +SELECT * FROM c; +f1 p_id +1 1 +2 2 +DROP TABLE c; +DROP TABLE p; +CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id1 INTEGER, p_id2 INTEGER) ENGINE=INNODB; +INSERT INTO p1 VALUES (1, 0), (2, 0); +INSERT INTO p2 VALUES (1, 0), (2, 0); +INSERT INTO c VALUES (1, 1, 1); +INSERT INTO c VALUES (2, 2, 2); +SET AUTOCOMMIT=ON; +START TRANSACTION; +UPDATE p1 SET f1 = f1 + 100; +SET SESSION wsrep_sync_wait = 0; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +ALTER TABLE c ADD FOREIGN KEY (p_id1) REFERENCES p1(f1), ADD FOREIGN KEY (p_id2) REFERENCES p2(f1); +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync'; +COMMIT; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync'; +SET GLOBAL wsrep_provider_options = 'dbug='; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SELECT * FROM p1; +f1 f2 +1 0 +2 0 +SELECT * FROM p2; +f1 f2 +1 0 +2 0 +SELECT * FROM c; +f1 p_id1 p_id2 +1 1 1 +2 2 2 +DROP TABLE c; +DROP TABLE p1; +DROP TABLE p2; +CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id1 INTEGER, p_id2 INTEGER) ENGINE=INNODB; +INSERT INTO p1 VALUES (1, 0), (2, 0); +INSERT INTO p2 VALUES (1, 0), (2, 0); +INSERT INTO c VALUES (1, 1, 1); +INSERT INTO c VALUES (2, 2, 2); +SET AUTOCOMMIT=ON; +START TRANSACTION; +UPDATE p2 SET f1 = f1 + 100; +SET SESSION wsrep_sync_wait = 0; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +ALTER TABLE c ADD FOREIGN KEY (p_id1) REFERENCES p1(f1), ADD FOREIGN KEY (p_id2) REFERENCES p2(f1); +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_enter_sync'; +COMMIT; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET GLOBAL wsrep_provider_options = 'signal=local_monitor_enter_sync'; +SET GLOBAL wsrep_provider_options = 'dbug='; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +SELECT * FROM p1; +f1 f2 +1 0 +2 0 +SELECT * FROM p2; +f1 f2 +1 0 +2 0 +SELECT * FROM c; +f1 p_id1 p_id2 +1 1 1 +2 2 2 +DROP TABLE c; +DROP TABLE p1; +DROP TABLE p2; diff --git a/mysql-test/suite/galera/t/mysql-wsrep#332.test b/mysql-test/suite/galera/t/mysql-wsrep#332.test new file mode 100644 index 00000000000..2da01ba900e --- /dev/null +++ b/mysql-test/suite/galera/t/mysql-wsrep#332.test @@ -0,0 +1,113 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source suite/galera/include/galera_have_debug_sync.inc + +# Open connection node_1a here, MW-369.inc will use it later +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 + +# +# Test the scenario where a foreign key is added to an existing child table, and +# concurrently UPDATE the parent table so that it violates the constraint. +# +# We expect that ALTER TABLE ADD FOREIGN KEY adds a table level key on both +# parent and child table. And therefore we also expect the UPDATE to fail +# certification. +# +--connection node_1 +CREATE TABLE p (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id INTEGER) ENGINE=INNODB; + +INSERT INTO p VALUES (1, 0); +INSERT INTO p VALUES (2, 0); + +INSERT INTO c VALUES (1, 1); +INSERT INTO c VALUES (2, 2); + +--let $mw_369_parent_query = UPDATE p SET f1 = f1 + 100 +--let $mw_369_child_query = ALTER TABLE c ADD FOREIGN KEY (p_id) REFERENCES p(f1) + +--source MW-369.inc + +# Expect certification failure +--connection node_1 +--error ER_LOCK_DEADLOCK +--reap + +--connection node_2 +SELECT * FROM p; +SELECT * FROM c; + +DROP TABLE c; +DROP TABLE p; + + +# +# Same as above, except that two foreign keys pointing to different parent +# tables are added, p1 and p2. Concurrently UPDATE p1. +# +# Expect certification error on UPDATE. +# +--connection node_1 +CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id1 INTEGER, p_id2 INTEGER) ENGINE=INNODB; + +INSERT INTO p1 VALUES (1, 0), (2, 0); +INSERT INTO p2 VALUES (1, 0), (2, 0); + +INSERT INTO c VALUES (1, 1, 1); +INSERT INTO c VALUES (2, 2, 2); + +--let $mw_369_parent_query = UPDATE p1 SET f1 = f1 + 100 +--let $mw_369_child_query = ALTER TABLE c ADD FOREIGN KEY (p_id1) REFERENCES p1(f1), ADD FOREIGN KEY (p_id2) REFERENCES p2(f1) + +--source MW-369.inc + +# Expect certification failure +--connection node_1 +--error ER_LOCK_DEADLOCK +--reap + +--connection node_2 +SELECT * FROM p1; +SELECT * FROM p2; +SELECT * FROM c; + +DROP TABLE c; +DROP TABLE p1; +DROP TABLE p2; + + +# +# Same as above, except that UPDATE is on p2. +# +--connection node_1 +CREATE TABLE p1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE p2 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=INNODB; +CREATE TABLE c (f1 INTEGER PRIMARY KEY, p_id1 INTEGER, p_id2 INTEGER) ENGINE=INNODB; + +INSERT INTO p1 VALUES (1, 0), (2, 0); +INSERT INTO p2 VALUES (1, 0), (2, 0); + +INSERT INTO c VALUES (1, 1, 1); +INSERT INTO c VALUES (2, 2, 2); + +--let $mw_369_parent_query = UPDATE p2 SET f1 = f1 + 100 +--let $mw_369_child_query = ALTER TABLE c ADD FOREIGN KEY (p_id1) REFERENCES p1(f1), ADD FOREIGN KEY (p_id2) REFERENCES p2(f1) + +--source MW-369.inc + +# Expect certification failure +--connection node_1 +--error ER_LOCK_DEADLOCK +--reap + +--connection node_2 +SELECT * FROM p1; +SELECT * FROM p2; +SELECT * FROM c; + +DROP TABLE c; +DROP TABLE p1; +DROP TABLE p2; diff --git a/scripts/mysql_config.pl b/scripts/mysql_config.pl index 113d8fc10be..c83aad5bc24 100644 --- a/scripts/mysql_config.pl +++ b/scripts/mysql_config.pl @@ -53,7 +53,7 @@ my $cwd = cwd(); my $basedir; my $socket = '/tmp/mysql.sock'; -my $version = '5.5.60'; +my $version = '5.5.61'; sub which { diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc index 0b4636c1f0f..1d69b06d798 100644 --- a/sql/sql_alter.cc +++ b/sql/sql_alter.cc @@ -106,14 +106,10 @@ bool Alter_table_statement::execute(THD *thd) (!thd->is_current_stmt_binlog_format_row() || !find_temporary_table(thd, first_table))) { - if (wsrep_to_isolation_begin(thd, - lex->name.str ? select_lex->db : NULL, - lex->name.str ? lex->name.str : NULL, - first_table)) - { - WSREP_WARN("ALTER TABLE isolation failure"); - DBUG_RETURN(TRUE); - } + WSREP_TO_ISOLATION_BEGIN_ALTER(((lex->name.str) ? select_lex->db : NULL), + ((lex->name.str) ? lex->name.str : NULL), + first_table, + &alter_info); thd->variables.auto_increment_offset = 1; thd->variables.auto_increment_increment = 1; @@ -128,6 +124,11 @@ bool Alter_table_statement::execute(THD *thd) lex->ignore, lex->online); #ifdef WITH_WSREP +error: + { + WSREP_WARN("ALTER TABLE isolation failure"); + DBUG_RETURN(TRUE); + } #endif /* WITH_WSREP */ DBUG_RETURN(result); } diff --git a/sql/sql_parse.h b/sql/sql_parse.h index 2093ecc85ee..a0c1c89eecc 100644 --- a/sql/sql_parse.h +++ b/sql/sql_parse.h @@ -214,6 +214,11 @@ inline bool is_supported_parser_charset(CHARSET_INFO *cs) #define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) \ if (WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, table_list_)) goto error; +#define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_) \ + if (WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, \ + table_list_, alter_info_)) \ + goto error; + #define WSREP_TO_ISOLATION_END \ if (WSREP(thd) || (thd && thd->wsrep_exec_mode==TOTAL_ORDER)) \ wsrep_to_isolation_end(thd); diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 54fdf430f86..a7950754666 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -981,43 +981,137 @@ static bool wsrep_prepare_key_for_isolation(const char* db, wsrep_buf_t* key, size_t* key_len) { - if (*key_len < 2) return false; + if (*key_len < 2) return false; - switch (wsrep_protocol_version) + switch (wsrep_protocol_version) + { + case 0: + *key_len= 0; + break; + case 1: + case 2: + case 3: + { + *key_len= 0; + if (db) { - case 0: - *key_len= 0; - break; - case 1: - case 2: - case 3: - { - *key_len= 0; - if (db) - { - // sql_print_information("%s.%s", db, table); - if (db) - { - key[*key_len].ptr= db; - key[*key_len].len= strlen(db); - ++(*key_len); - if (table) - { - key[*key_len].ptr= table; - key[*key_len].len= strlen(table); - ++(*key_len); - } - } - } - break; + // sql_print_information("%s.%s", db, table); + key[*key_len].ptr= db; + key[*key_len].len= strlen(db); + ++(*key_len); + if (table) + { + key[*key_len].ptr= table; + key[*key_len].len= strlen(table); + ++(*key_len); + } } - default: - return false; - } - - return true; + break; + } + default: + return false; + } + return true; } + +static bool wsrep_prepare_key_for_isolation(const char* db, + const char* table, + wsrep_key_arr_t* ka) +{ + wsrep_key_t* tmp; + tmp= (wsrep_key_t*)my_realloc(ka->keys, + (ka->keys_len + 1) * sizeof(wsrep_key_t), + MYF(0)); + if (!tmp) + { + WSREP_ERROR("Can't allocate memory for key_array"); + return false; + } + ka->keys= tmp; + if (!(ka->keys[ka->keys_len].key_parts= (wsrep_buf_t*) + my_malloc(sizeof(wsrep_buf_t)*2, MYF(0)))) + { + WSREP_ERROR("Can't allocate memory for key_parts"); + return false; + } + ka->keys[ka->keys_len].key_parts_num= 2; + ++ka->keys_len; + if (!wsrep_prepare_key_for_isolation(db, table, + (wsrep_buf_t*)ka->keys[ka->keys_len - 1].key_parts, + &ka->keys[ka->keys_len - 1].key_parts_num)) + { + WSREP_ERROR("Preparing keys for isolation failed"); + return false; + } + + return true; +} + + +static bool wsrep_prepare_keys_for_alter_add_fk(char* child_table_db, + Alter_info* alter_info, + wsrep_key_arr_t* ka) +{ + Key *key; + List_iterator key_iterator(alter_info->key_list); + while ((key= key_iterator++)) + { + if (key->type == Key::FOREIGN_KEY) + { + Foreign_key *fk_key= (Foreign_key *)key; + const char *db_name= fk_key->ref_table->db.str; + const char *table_name= fk_key->ref_table->table.str; + if (!db_name) + { + db_name= child_table_db; + } + if (!wsrep_prepare_key_for_isolation(db_name, table_name, ka)) + { + return false; + } + } + } + return true; +} + + +static bool wsrep_prepare_keys_for_isolation(THD* thd, + const char* db, + const char* table, + const TABLE_LIST* table_list, + Alter_info* alter_info, + wsrep_key_arr_t* ka) +{ + ka->keys= 0; + ka->keys_len= 0; + + if (db || table) + { + if (!wsrep_prepare_key_for_isolation(db, table, ka)) + goto err; + } + + for (const TABLE_LIST* table= table_list; table; table= table->next_global) + { + if (!wsrep_prepare_key_for_isolation(table->db, table->table_name, ka)) + goto err; + } + + if (alter_info && (alter_info->flags & ALTER_FOREIGN_KEY)) + { + if (!wsrep_prepare_keys_for_alter_add_fk(table_list->db, alter_info, ka)) + goto err; + } + + return false; + +err: + wsrep_keys_free(ka); + return true; +} + + /* Prepare key list from db/table and table_list */ bool wsrep_prepare_keys_for_isolation(THD* thd, const char* db, @@ -1025,78 +1119,7 @@ bool wsrep_prepare_keys_for_isolation(THD* thd, const TABLE_LIST* table_list, wsrep_key_arr_t* ka) { - ka->keys= 0; - ka->keys_len= 0; - - extern TABLE* find_temporary_table(THD*, const TABLE_LIST*); - - if (db || table) - { - TABLE_LIST tmp_table; - bzero((char*) &tmp_table,sizeof(tmp_table)); - tmp_table.table_name= (char*)db; - tmp_table.db= (char*)table; - if (!table || !find_temporary_table(thd, &tmp_table)) - { - if (!(ka->keys= (wsrep_key_t*)my_malloc(sizeof(wsrep_key_t), MYF(0)))) - { - WSREP_ERROR("Can't allocate memory for key_array"); - goto err; - } - ka->keys_len= 1; - if (!(ka->keys[0].key_parts= (wsrep_buf_t*) - my_malloc(sizeof(wsrep_buf_t)*2, MYF(0)))) - { - WSREP_ERROR("Can't allocate memory for key_parts"); - goto err; - } - ka->keys[0].key_parts_num= 2; - if (!wsrep_prepare_key_for_isolation( - db, table, - (wsrep_buf_t*)ka->keys[0].key_parts, - &ka->keys[0].key_parts_num)) - { - WSREP_ERROR("Preparing keys for isolation failed"); - goto err; - } - } - } - - for (const TABLE_LIST* table= table_list; table; table= table->next_global) - { - if (!find_temporary_table(thd, table)) - { - wsrep_key_t* tmp; - tmp= (wsrep_key_t*)my_realloc( - ka->keys, (ka->keys_len + 1) * sizeof(wsrep_key_t), MYF(0)); - if (!tmp) - { - WSREP_ERROR("Can't allocate memory for key_array"); - goto err; - } - ka->keys= tmp; - if (!(ka->keys[ka->keys_len].key_parts= (wsrep_buf_t*) - my_malloc(sizeof(wsrep_buf_t)*2, MYF(0)))) - { - WSREP_ERROR("Can't allocate memory for key_parts"); - goto err; - } - ka->keys[ka->keys_len].key_parts_num= 2; - ++ka->keys_len; - if (!wsrep_prepare_key_for_isolation( - table->db, table->table_name, - (wsrep_buf_t*)ka->keys[ka->keys_len - 1].key_parts, - &ka->keys[ka->keys_len - 1].key_parts_num)) - { - WSREP_ERROR("Preparing keys for isolation failed"); - goto err; - } - } - } - return true; -err: - wsrep_keys_free(ka); - return false; + return wsrep_prepare_keys_for_isolation(thd, db, table, table_list, NULL, ka); } @@ -1260,7 +1283,8 @@ create_view_query(THD *thd, uchar** buf, size_t* buf_len) } static int wsrep_TOI_begin(THD *thd, char *db_, char *table_, - const TABLE_LIST* table_list) + const TABLE_LIST* table_list, + Alter_info* alter_info) { wsrep_status_t ret(WSREP_WARNING); uchar* buf(0); @@ -1295,8 +1319,10 @@ static int wsrep_TOI_begin(THD *thd, char *db_, char *table_, wsrep_key_arr_t key_arr= {0, 0}; struct wsrep_buf buff = { buf, buf_len }; - if (!buf_err && - wsrep_prepare_keys_for_isolation(thd, db_, table_, table_list, &key_arr)&& + if (!buf_err && + !wsrep_prepare_keys_for_isolation(thd, db_, table_, + table_list, alter_info, &key_arr) && + key_arr.keys_len > 0 && WSREP_OK == (ret = wsrep->to_execute_start(wsrep, thd->thread_id, key_arr.keys, key_arr.keys_len, &buff, 1, @@ -1417,9 +1443,9 @@ static void wsrep_RSU_end(THD *thd) } int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_, - const TABLE_LIST* table_list) + const TABLE_LIST* table_list, + Alter_info* alter_info) { - /* No isolation for applier or replaying threads. */ @@ -1469,9 +1495,12 @@ int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_, if (thd->variables.wsrep_on && thd->wsrep_exec_mode==LOCAL_STATE) { switch (wsrep_OSU_method_options) { - case WSREP_OSU_TOI: ret = wsrep_TOI_begin(thd, db_, table_, - table_list); break; - case WSREP_OSU_RSU: ret = wsrep_RSU_begin(thd, db_, table_); break; + case WSREP_OSU_TOI: + ret= wsrep_TOI_begin(thd, db_, table_, table_list, alter_info); + break; + case WSREP_OSU_RSU: + ret= wsrep_RSU_begin(thd, db_, table_); + break; } if (!ret) { diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index 56e3baae7cc..b1dc5ba452b 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -305,8 +305,10 @@ extern PSI_mutex_key key_LOCK_wsrep_slave_threads; extern PSI_mutex_key key_LOCK_wsrep_desync; #endif /* HAVE_PSI_INTERFACE */ struct TABLE_LIST; +class Alter_info; int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_, - const TABLE_LIST* table_list); + const TABLE_LIST* table_list, + Alter_info* alter_info = NULL); void wsrep_to_isolation_end(THD *thd); void wsrep_cleanup_transaction(THD *thd); int wsrep_to_buf_helper( From e88e26b4242e1c030bb138fca7ea2c916dbe6a76 Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Wed, 23 May 2018 14:13:11 +0200 Subject: [PATCH 08/17] Follow up to previous commit for codership/mysql-wsrep#332 Fix misplaced `DBUG_RETURN` in `Alter_table_statement::execute`. --- sql/sql_alter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc index 1d69b06d798..e343808cf77 100644 --- a/sql/sql_alter.cc +++ b/sql/sql_alter.cc @@ -123,6 +123,7 @@ bool Alter_table_statement::execute(THD *thd) select_lex->order_list.first, lex->ignore, lex->online); + DBUG_RETURN(result); #ifdef WITH_WSREP error: { @@ -130,5 +131,4 @@ error: DBUG_RETURN(TRUE); } #endif /* WITH_WSREP */ - DBUG_RETURN(result); } From 40f6bcb856ce05e15efd3070663af2686182147d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 2 Aug 2018 20:35:44 +0300 Subject: [PATCH 09/17] Add missing WSREP(thd) condition and remove unnecessary DBUG_RETURN. --- sql/sql_alter.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc index 1129b209775..0bf2d4be2ad 100644 --- a/sql/sql_alter.cc +++ b/sql/sql_alter.cc @@ -308,7 +308,8 @@ bool Sql_cmd_alter_table::execute(THD *thd) #ifdef WITH_WSREP TABLE *find_temporary_table(THD *thd, const TABLE_LIST *tl); - if ((!thd->is_current_stmt_binlog_format_row() || + if (WSREP(thd) && + (!thd->is_current_stmt_binlog_format_row() || !find_temporary_table(thd, first_table))) { WSREP_TO_ISOLATION_BEGIN_ALTER(((lex->name.str) ? select_lex->db : NULL), @@ -329,8 +330,6 @@ bool Sql_cmd_alter_table::execute(THD *thd) lex->ignore); DBUG_RETURN(result); - - DBUG_RETURN(result); #ifdef WITH_WSREP error: { From 1d414d9491db8b7252d37bcc917cd72a7869b313 Mon Sep 17 00:00:00 2001 From: Teemu Ollakka Date: Thu, 1 Mar 2018 17:07:07 +0200 Subject: [PATCH 10/17] codership/galera#501 Check cluster weight in galera_pc_weight test Check that cluster weight have proper values in galera_pc_weight test. Removed sleeps from tests and added condition waits for expected cluster sizes. Replaced galera suspend/resume with gmcast.isolate in order to avoid breaking client connections to server which is isolated from the cluster and to avoid the need to reset wsrep_cluster_address. Re-recorded galera_defaults. --- .../galera_3nodes/r/galera_pc_weight.result | 31 ++++++++-- .../galera_3nodes/t/galera_pc_weight.test | 58 ++++++++++--------- 2 files changed, 57 insertions(+), 32 deletions(-) diff --git a/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result b/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result index 6fb931638ef..9f845ffe776 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result +++ b/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result @@ -1,11 +1,17 @@ +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; +VARIABLE_VALUE = 3 SET GLOBAL wsrep_provider_options = 'pc.weight=3'; -Suspending node ... +SELECT VARIABLE_VALUE = 5 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; +VARIABLE_VALUE = 5 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; SET SESSION wsrep_sync_wait=0; SET SESSION wsrep_on=OFF; SET SESSION wsrep_on=ON; SHOW STATUS LIKE 'wsrep_cluster_size'; Variable_name Value wsrep_cluster_size 2 +SHOW STATUS LIKE 'wsrep_cluster_weight'; +Variable_name Value SHOW STATUS LIKE 'wsrep_cluster_status'; Variable_name Value wsrep_cluster_status non-Primary @@ -22,9 +28,13 @@ SHOW STATUS LIKE 'wsrep_local_state_comment'; Variable_name Value wsrep_local_state_comment Initialized SET SESSION wsrep_sync_wait=0; +SET SESSION wsrep_on=OFF; +SET SESSION wsrep_on=ON; SHOW STATUS LIKE 'wsrep_cluster_size'; Variable_name Value wsrep_cluster_size 2 +SHOW STATUS LIKE 'wsrep_cluster_weight'; +Variable_name Value SHOW STATUS LIKE 'wsrep_cluster_status'; Variable_name Value wsrep_cluster_status non-Primary @@ -40,7 +50,8 @@ wsrep_local_state 0 SHOW STATUS LIKE 'wsrep_local_state_comment'; Variable_name Value wsrep_local_state_comment Initialized -Resuming node ... +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; +VARIABLE_VALUE = 3 SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; VARIABLE_VALUE = 'Primary' 1 @@ -57,11 +68,14 @@ SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VAR VARIABLE_VALUE = 'Synced' 1 SET GLOBAL wsrep_provider_options = 'pc.weight=1'; -SET SESSION wsrep_sync_wait=0; -SET SESSION wsrep_sync_wait=0; +SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; +VARIABLE_VALUE = 1 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 3 1 +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; +VARIABLE_VALUE = 3 SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; VARIABLE_VALUE = 'Primary' 1 @@ -80,6 +94,8 @@ VARIABLE_VALUE = 'Synced' SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 3 1 +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; +VARIABLE_VALUE = 3 SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; VARIABLE_VALUE = 'Primary' 1 @@ -98,6 +114,8 @@ VARIABLE_VALUE = 'Synced' SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 3 1 +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; +VARIABLE_VALUE = 3 SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; VARIABLE_VALUE = 'Primary' 1 @@ -116,6 +134,9 @@ VARIABLE_VALUE = 'Synced' SET GLOBAL wsrep_provider_options = 'pc.weight=1'; CALL mtr.add_suppression('WSREP: gcs_caused\\(\\) returned -1'); CALL mtr.add_suppression('overriding reported weight for'); +CALL mtr.add_suppression('SYNC message from member'); +CALL mtr.add_suppression('user message in state LEAVING'); +CALL mtr.add_suppression('sending install message failed: (Transport endpoint is not connected|Socket is not connected)'); CALL mtr.add_suppression('WSREP: user message in state LEAVING'); -CALL mtr.add_suppression('sending install message failed: Transport endpoint is not connected'); +CALL mtr.add_suppression('sending install message failed: (Transport endpoint is not connected|Socket is not connected)'); CALL mtr.add_suppression('overriding reported weight for'); diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test index c118b7481bc..0a94e7cd85d 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test +++ b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test @@ -8,17 +8,16 @@ --source include/have_innodb.inc --connection node_1 +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; SET GLOBAL wsrep_provider_options = 'pc.weight=3'; +SELECT VARIABLE_VALUE = 5 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; ---source include/wait_until_connected_again.inc ---source include/galera_suspend.inc ---sleep 10 +# Isolate node_1 from the cluster. +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; --connection node_2 # Do not wait for causality as we are no longer in the primary component SET SESSION wsrep_sync_wait=0; ---source include/wait_until_connected_again.inc - 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 @@ -26,8 +25,9 @@ SET SESSION wsrep_on=ON; # We can not use SELECT queries here, as only SHOW is allowed to run. # For nodes #2 and #3, we expect a non-primary component of size 2 - +# and cluster weight 0 SHOW STATUS LIKE 'wsrep_cluster_size'; +SHOW STATUS LIKE 'wsrep_cluster_weight'; SHOW STATUS LIKE 'wsrep_cluster_status'; SHOW STATUS LIKE 'wsrep_connected'; SHOW STATUS LIKE 'wsrep_ready'; @@ -39,9 +39,13 @@ SHOW STATUS LIKE 'wsrep_local_state_comment'; --source include/galera_connect.inc --connection node_3 SET SESSION wsrep_sync_wait=0; ---source include/wait_until_connected_again.inc +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; SHOW STATUS LIKE 'wsrep_cluster_size'; +SHOW STATUS LIKE 'wsrep_cluster_weight'; SHOW STATUS LIKE 'wsrep_cluster_status'; SHOW STATUS LIKE 'wsrep_connected'; SHOW STATUS LIKE 'wsrep_ready'; @@ -49,15 +53,13 @@ SHOW STATUS LIKE 'wsrep_local_state'; SHOW STATUS LIKE 'wsrep_local_state_comment'; --connection node_1 ---source include/galera_resume.inc ---sleep 10 ---source include/wait_until_connected_again.inc # For Node #1, we expect a primary component of size 1 --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' --source include/wait_condition.inc +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; @@ -65,30 +67,27 @@ SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_N SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; SET GLOBAL wsrep_provider_options = 'pc.weight=1'; +SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; -# Restore the cluster by resetting wsrep_cluster_address on nodes #1 and #2 +# Resume cluster connectivity on node_1 +--connection node_1 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; + +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc --connection node_2 ---disable_query_log ---eval SET GLOBAL wsrep_cluster_address = @@wsrep_cluster_address; ---enable_query_log - -SET SESSION wsrep_sync_wait=0; ---source include/wait_until_connected_again.inc +--source include/wait_condition.inc --connection node_3 ---disable_query_log ---eval SET GLOBAL wsrep_cluster_address = @@wsrep_cluster_address; ---enable_query_log - -SET SESSION wsrep_sync_wait=0; ---source include/wait_until_connected_again.inc - -# On all nodes, we now expect a Primary component of size 3, Synced and ready +--source include/wait_condition.inc --connection node_1 ---source include/wait_until_connected_again.inc +--source include/wait_condition.inc + +# On all nodes, we now expect a Primary component of size 3, weight 3, Synced and ready SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; @@ -97,6 +96,7 @@ SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VAR --connection node_2 SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; @@ -105,6 +105,7 @@ SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VAR --connection node_3 SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_weight'; SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_connected'; SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; @@ -121,8 +122,11 @@ CALL mtr.add_suppression('WSREP: gcs_caused\\(\\) returned -1'); --connection node_2 CALL mtr.add_suppression('overriding reported weight for'); +CALL mtr.add_suppression('SYNC message from member'); +CALL mtr.add_suppression('user message in state LEAVING'); +CALL mtr.add_suppression('sending install message failed: (Transport endpoint is not connected|Socket is not connected)'); --connection node_3 CALL mtr.add_suppression('WSREP: user message in state LEAVING'); -CALL mtr.add_suppression('sending install message failed: Transport endpoint is not connected'); +CALL mtr.add_suppression('sending install message failed: (Transport endpoint is not connected|Socket is not connected)'); CALL mtr.add_suppression('overriding reported weight for'); From 639bd1c71f52f0bd6d91b33d9bee53a8c35d760b Mon Sep 17 00:00:00 2001 From: mkaruza Date: Fri, 6 Jul 2018 11:53:43 +0200 Subject: [PATCH 11/17] galera#505 mtr test MTR test for galera#505 --- mysql-test/suite/galera/r/galera#505.result | 5 +++++ mysql-test/suite/galera/t/galera#505.test | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 mysql-test/suite/galera/r/galera#505.result create mode 100644 mysql-test/suite/galera/t/galera#505.test diff --git a/mysql-test/suite/galera/r/galera#505.result b/mysql-test/suite/galera/r/galera#505.result new file mode 100644 index 00000000000..9ae09cac187 --- /dev/null +++ b/mysql-test/suite/galera/r/galera#505.result @@ -0,0 +1,5 @@ +SET GLOBAL wsrep_provider_options = 'pc.weight=3'; +SHOW GLOBAL VARIABLES LIKE 'wsrep_provider_options'; +Variable_name Value +wsrep_provider_options pc.weight = 3 +SET GLOBAL wsrep_provider_options = 'pc.weight=1'; diff --git a/mysql-test/suite/galera/t/galera#505.test b/mysql-test/suite/galera/t/galera#505.test new file mode 100644 index 00000000000..74aa781bc54 --- /dev/null +++ b/mysql-test/suite/galera/t/galera#505.test @@ -0,0 +1,17 @@ +# galera#505 - Change of pc.weight wsrep param will be correctly stored in wsrep_provider_options variable + +--source include/galera_cluster.inc + +--connection node_1 + +# Convert "... pc.weight = N; ..." to "N; ..." +--let $s1 = `SELECT SUBSTR(@@wsrep_provider_options, LOCATE('pc.weight =', @@wsrep_provider_options) + LENGTH('pc.weight = '))` +# Convert "N; ..." to "N" +--let $pc_weight_value = `SELECT SUBSTR('$s1', 1, LOCATE(';', '$s1') - 1)` + +SET GLOBAL wsrep_provider_options = 'pc.weight=3'; + +-- replace_regex /.*(pc\.weight = [0-9]+);.*/\1/ +SHOW GLOBAL VARIABLES LIKE 'wsrep_provider_options'; + +--eval SET GLOBAL wsrep_provider_options = 'pc.weight=$pc_weight_value' From 62e290923e0d9caedeb91e40d16b5dcef983048f Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 16 Jul 2018 09:41:37 +0200 Subject: [PATCH 12/17] Put one filter per line in wsrep_sst_rsync.sh This way it is more readable and easy to change, also if a new entry is added or one removed, the diff will be easier to read. --- scripts/wsrep_sst_rsync.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 5617142ea99..89afaa6ecbd 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -120,8 +120,14 @@ fi # --exclude '*.[0-9][0-9][0-9][0-9][0-9][0-9]' --exclude '*.index') # New filter - exclude everything except dirs (schemas) and innodb files -FILTER=(-f '- /lost+found' -f '- /.fseventsd' -f '- /.Trashes' - -f '+ /wsrep_sst_binlog.tar' -f '+ /ib_lru_dump' -f '+ /ibdata*' -f '+ /*/' -f '- /*') +FILTER=(-f '- /lost+found' + -f '- /.fseventsd' + -f '- /.Trashes' + -f '+ /wsrep_sst_binlog.tar' + -f '+ /ib_lru_dump' + -f '+ /ibdata*' + -f '+ /*/' + -f '- /*') if [ "$WSREP_SST_OPT_ROLE" = "donor" ] then From 3f0cd66a2bf5a1addfa2b020305ebc4e93ce51d1 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Mon, 16 Jul 2018 09:42:53 +0200 Subject: [PATCH 13/17] Also include InnoDB undo tablespaces in rsync sst If --innodb-undo-tablespaces is used, then InnoDB stores undo in a separate file(s) which whould also be replicated. This fixes Issue#337 This filter will cause sst failed at applying undo... https://github.com/codership/mysql-wsrep/issues/337 --- scripts/wsrep_sst_rsync.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 89afaa6ecbd..7dd78dd86d3 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -126,6 +126,7 @@ FILTER=(-f '- /lost+found' -f '+ /wsrep_sst_binlog.tar' -f '+ /ib_lru_dump' -f '+ /ibdata*' + -f '+ /undo*' -f '+ /*/' -f '- /*') From 9808e23a7aceeea69112fe8b6bf54460ecf4bb65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 3 Aug 2018 13:44:30 +0300 Subject: [PATCH 14/17] MariaDB adjustments. --- mysql-test/suite/galera/disabled.def | 1 + sql/wsrep_mysqld.cc | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index fad1e69d4d7..bb5bd04c1f1 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -51,3 +51,4 @@ galera_admin : MDEV-13549 Galera test failures MW-416 : MDEV-13549 Galera test failures galera_wan : MDEV-13549 Galera test failures MW-388 : MDEV-13549 Galera test failures +galera#505 : Requires galera library version 25.3.24 diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 91dbe75408a..bfd22ff1900 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -538,6 +538,9 @@ int wsrep_init() wsrep->provider_vendor, sizeof(provider_vendor) - 1); } + if (!wsrep_data_home_dir || strlen(wsrep_data_home_dir) == 0) + wsrep_data_home_dir = mysql_real_data_home; + char node_addr[512]= { 0, }; size_t const node_addr_max= sizeof(node_addr) - 1; if (!wsrep_node_address || !strcmp(wsrep_node_address, "")) @@ -933,9 +936,15 @@ static bool wsrep_prepare_key_for_isolation(const char* db, wsrep_key_arr_t* ka) { wsrep_key_t* tmp; - tmp= (wsrep_key_t*)my_realloc(ka->keys, - (ka->keys_len + 1) * sizeof(wsrep_key_t), - MYF(0)); + + if (!ka->keys) + tmp= (wsrep_key_t*)my_malloc((ka->keys_len + 1) * sizeof(wsrep_key_t), + MYF(0)); + else + tmp= (wsrep_key_t*)my_realloc(ka->keys, + (ka->keys_len + 1) * sizeof(wsrep_key_t), + MYF(0)); + if (!tmp) { WSREP_ERROR("Can't allocate memory for key_array"); @@ -1410,6 +1419,9 @@ static int wsrep_TOI_begin(THD *thd, char *db_, char *table_, case SQLCOM_ALTER_EVENT: buf_err= wsrep_alter_event_query(thd, &buf, &buf_len); break; + case SQLCOM_DROP_TABLE: + buf_err= wsrep_drop_table_query(thd, &buf, &buf_len); + break; case SQLCOM_CREATE_ROLE: if (sp_process_definer(thd)) { From ea0356e1ad506e55f2c26808c9b0e2d88953c79e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Fri, 3 Aug 2018 16:43:32 +0300 Subject: [PATCH 15/17] Add galera library dependency directly to test case. --- mysql-test/suite/galera/disabled.def | 2 +- mysql-test/suite/galera/t/galera#505.test | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index bb5bd04c1f1..1dd3128a2d7 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -51,4 +51,4 @@ galera_admin : MDEV-13549 Galera test failures MW-416 : MDEV-13549 Galera test failures galera_wan : MDEV-13549 Galera test failures MW-388 : MDEV-13549 Galera test failures -galera#505 : Requires galera library version 25.3.24 + diff --git a/mysql-test/suite/galera/t/galera#505.test b/mysql-test/suite/galera/t/galera#505.test index 74aa781bc54..78cdf53db74 100644 --- a/mysql-test/suite/galera/t/galera#505.test +++ b/mysql-test/suite/galera/t/galera#505.test @@ -2,6 +2,21 @@ --source include/galera_cluster.inc +--disable_query_log +select CAST(REGEXP_REPLACE(variable_value,'^(\\d+)\\.(\\d+)\\.(\\d+)(r\\d+)','\\3') AS UNSIGNED) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'wsrep_provider_version' INTO @GALERA_VERSION; + +# Make sure that the test is operating on the right version of galera library. +--let $galera_version=24 +eval SET @REQUIRED_GALERA_VERSION='$galera_version'; + +SELECT @GALERA_VERSION, @REQUIRED_GALERA_VERSION; + +if (!`SELECT (@GALERA_VERSION < @REQUIRED_GALERA_VERSION)`) +{ + skip Test requires Galera library version 25.3.$galera_version; +} +--enable_query_log + --connection node_1 # Convert "... pc.weight = N; ..." to "N; ..." From 5d90717cc9e05f2a3bfe137031eb15fc1e291ad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Sat, 4 Aug 2018 11:28:25 +0300 Subject: [PATCH 16/17] Add wsrep.cnf --- support-files/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/support-files/CMakeLists.txt b/support-files/CMakeLists.txt index 80de8333db8..36340a2fbe7 100644 --- a/support-files/CMakeLists.txt +++ b/support-files/CMakeLists.txt @@ -102,6 +102,12 @@ IF(UNIX) DESTINATION ${inst_location} COMPONENT SupportFiles PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/wsrep.cnf.sh + ${CMAKE_CURRENT_BINARY_DIR}/wsrep.cnf @ONLY) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/wsrep.cnf + DESTINATION ${inst_location} COMPONENT SupportFiles + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ + GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) IF (INSTALL_SYSCONFDIR) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/mysql-log-rotate DESTINATION ${INSTALL_SYSCONFDIR}/logrotate.d From 2482306861ca107adfb6c8823cd9f6e413912ebe Mon Sep 17 00:00:00 2001 From: Daniel Bartholomew Date: Tue, 7 Aug 2018 10:17:08 -0400 Subject: [PATCH 17/17] bump the VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 59a439d4152..2eee908ea01 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,3 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=0 -MYSQL_VERSION_PATCH=36 +MYSQL_VERSION_PATCH=37