diff options
author | Jan Lindström <jan.lindstrom@mariadb.com> | 2020-11-03 10:44:26 +0200 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2021-02-25 07:47:51 +0200 |
commit | 27d66d644cf2ebe9201e0362f2050036cce2908a (patch) | |
tree | 8b1dc6ca683c0c0c5cb04d01de7043276f2bcff5 /sql | |
parent | 74281fe1fb0faf444aec3744b90995156f9f58f9 (diff) | |
download | mariadb-git-27d66d644cf2ebe9201e0362f2050036cce2908a.tar.gz |
MENT-411 : Implement wsrep_replicate_aria
Introduced two new wsrep_mode options
* REPLICATE_MYISAM
* REPLICATE_ARIA
Depracated wsrep_replicate_myisam parameter and we use
wsrep_mode = REPLICATE_MYISAM instead.
This required small refactoring of wsrep_check_mode_after_open_table
so that both MyISAM and Aria are handled on required DML cases.
Similarly, added Aria to wsrep_should_replicate_ddl to handle DDL
for Aria tables using TOI. Added test cases and improved MyISAM testing.
Changed use of wsrep_replicate_myisam to wsrep_mode = REPLICATE_MYISAM
Diffstat (limited to 'sql')
-rw-r--r-- | sql/sp_head.cc | 4 | ||||
-rw-r--r-- | sql/sys_vars.cc | 9 | ||||
-rw-r--r-- | sql/wsrep_mysqld.cc | 16 | ||||
-rw-r--r-- | sql/wsrep_mysqld.h | 5 | ||||
-rw-r--r-- | sql/wsrep_var.cc | 11 | ||||
-rw-r--r-- | sql/wsrep_var.h | 1 |
6 files changed, 36 insertions, 10 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 513e7207b7e..ec5b2d0e832 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1473,7 +1473,9 @@ sp_head::execute(THD *thd, bool merge_da_on_success) WSREP_DEBUG("MUST_REPLAY set after SP, err_status %d trx state: %d", err_status, thd->wsrep_trx().state()); } - (void) wsrep_after_statement(thd); + + if (wsrep_thd_is_local(thd)) + (void) wsrep_after_statement(thd); /* Reset the return code to zero if the transaction was diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 71dbd166bb0..f817f9086a9 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -5926,11 +5926,13 @@ static Sys_var_uint Sys_wsrep_sync_wait( NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(wsrep_sync_wait_update)); -static const char *wsrep_mode_names[]= +static const char *wsrep_mode_names[]= { "STRICT_REPLICATION", "BINLOG_ROW_FORMAT_ONLY", "REQUIRED_PRIMARY_KEY", + "REPLICATE_MYISAM", + "REPLICATE_ARIA", NullS }; static Sys_var_set Sys_wsrep_mode( @@ -5989,7 +5991,10 @@ static Sys_var_mybool Sys_wsrep_recover_datadir( static Sys_var_mybool Sys_wsrep_replicate_myisam( "wsrep_replicate_myisam", "To enable myisam replication", - GLOBAL_VAR(wsrep_replicate_myisam), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); + GLOBAL_VAR(wsrep_replicate_myisam), CMD_LINE(OPT_ARG), DEFAULT(FALSE), + NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0), + ON_UPDATE(wsrep_replicate_myisam_update), + DEPRECATED("'@@wsrep_mode=REPLICATE_MYISAM'")); // since 10.6.0 static Sys_var_mybool Sys_wsrep_log_conflicts( "wsrep_log_conflicts", "To log multi-master conflicts", diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index ea1582c5a44..21131b6b671 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1216,7 +1216,7 @@ static const char* wsrep_warning_name(const enum wsrep_warning_type type) return "WSREP_REQUIRE_PRIMARY_KEY"; break; case WSREP_REQUIRE_INNODB: return "WSREP_REQUIRE_INNODB"; break; - default: assert(0); + default: assert(0); return " "; break; // for compiler } } /** @@ -1373,7 +1373,8 @@ bool wsrep_check_mode_after_open_table (THD *thd, return true; const legacy_db_type db_type= hton->db_type; - bool replicate= (wsrep_replicate_myisam && db_type == DB_TYPE_MYISAM); + bool replicate= ((db_type == DB_TYPE_MYISAM && wsrep_check_mode(WSREP_MODE_REPLICATE_MYISAM)) || + (db_type == DB_TYPE_ARIA && wsrep_check_mode(WSREP_MODE_REPLICATE_ARIA))); TABLE *tbl= tables->table; if (replicate) @@ -1383,7 +1384,7 @@ bool wsrep_check_mode_after_open_table (THD *thd, Following code will kick-start the TOI but this has to be done only once per statement. Note: kick-start will take-care of creating isolation key for all tables - involved in the list (provided all of them are MYISAM tables). */ + involved in the list (provided all of them are MYISAM or Aria tables). */ if (!is_stat_table(&tables->db, &tables->alias)) { if (tbl->s->primary_key == MAX_KEY && @@ -2183,14 +2184,17 @@ bool wsrep_should_replicate_ddl(THD* thd, const handlerton *hton) return true; break; case DB_TYPE_MYISAM: - if (wsrep_replicate_myisam) + if (wsrep_check_mode(WSREP_MODE_REPLICATE_MYISAM)) return true; else WSREP_DEBUG("wsrep OSU failed for %s", wsrep_thd_query(thd)); break; case DB_TYPE_ARIA: - /* if (wsrep_replicate_aria) */ - /* fallthrough */ + if (wsrep_check_mode(WSREP_MODE_REPLICATE_ARIA)) + return true; + else + WSREP_DEBUG("wsrep OSU failed for %s", wsrep_thd_query(thd)); + break; default: WSREP_DEBUG("wsrep OSU failed for %s", wsrep_thd_query(thd)); break; diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index 201f1e0da93..b1d5373b3b4 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -134,10 +134,13 @@ enum enum_wsrep_ignore_apply_error { WSREP_IGNORE_ERRORS_MAX= 0x7 }; +/* wsrep_mode features */ enum enum_wsrep_mode { WSREP_MODE_STRICT_REPLICATION= (1ULL << 0), WSREP_MODE_BINLOG_ROW_FORMAT_ONLY= (1ULL << 1), - WSREP_MODE_REQUIRED_PRIMARY_KEY= (1ULL << 2) + WSREP_MODE_REQUIRED_PRIMARY_KEY= (1ULL << 2), + WSREP_MODE_REPLICATE_MYISAM= (1ULL << 3), + WSREP_MODE_REPLICATE_ARIA= (1ULL << 4) }; // Streaming Replication diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index 4c55e4c15a4..22a434e304d 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -1047,3 +1047,14 @@ bool wsrep_strict_ddl_update(sys_var *self, THD* thd, enum_var_type var_type) wsrep_mode&= (~WSREP_MODE_STRICT_REPLICATION); return false; } + +bool wsrep_replicate_myisam_update(sys_var *self, THD* thd, enum_var_type var_type) +{ + // In case user still sets wsrep_replicate_myisam we set new + // option to wsrep_mode + if (wsrep_replicate_myisam) + wsrep_mode|= WSREP_MODE_REPLICATE_MYISAM; + else + wsrep_mode&= (~WSREP_MODE_REPLICATE_MYISAM); + return false; +} diff --git a/sql/wsrep_var.h b/sql/wsrep_var.h index ae4f39a4034..b123ff41e78 100644 --- a/sql/wsrep_var.h +++ b/sql/wsrep_var.h @@ -109,6 +109,7 @@ extern bool wsrep_gtid_domain_id_update UPDATE_ARGS; extern bool wsrep_mode_check CHECK_ARGS; extern bool wsrep_strict_ddl_update UPDATE_ARGS; +extern bool wsrep_replicate_myisam_update UPDATE_ARGS; #else /* WITH_WSREP */ #define wsrep_provider_init(X) |