mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-20051: Add new mode to wsrep_OSU_method in which Galera checks storage engine of the effected table
Introduced a new wsrep_strict_ddl configuration variable in which Galera checks storage engine of the effected table. If table is not InnoDB (only storage engine currently fully supporting Galera replication) DDL-statement will return error code: ER_GALERA_REPLICATION_NOT_SUPPORTED eng "DDL-statement is forbidden as table storage engine does not support Galera replication" However, when wsrep_replicate_myisam=ON we allow DDL-statements to MyISAM tables. If effected table is allowed storage engine Galera will run normal TOI. This new setting should be for now set globally on all nodes in a cluster. When this setting is set following DDL-clauses accessing tables not supporting Galera replication are refused: * CREATE TABLE (e.g. CREATE TABLE t1(a int) engine=Aria * ALTER TABLE * TRUNCATE TABLE * CREATE VIEW * CREATE TRIGGER * CREATE INDEX * DROP INDEX * RENAME TABLE * DROP TABLE Statements on PROCEDURE, EVENT, FUNCTION are allowed as effected tables are known only at execution. Furthermore, USER, ROLE, SERVER, DATABASE statements are also allowed as they do not really have effected table.
This commit is contained in:
@ -3079,6 +3079,7 @@ mysql_create_routine(THD *thd, LEX *lex)
|
||||
return true;
|
||||
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
|
||||
|
||||
if (!lex->sphead->m_handler->sp_create_routine(thd, lex->sphead))
|
||||
{
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
@ -4147,7 +4148,6 @@ mysql_execute_command(THD *thd)
|
||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
if (check_one_table_access(thd, INDEX_ACL, all_tables))
|
||||
goto error; /* purecov: inspected */
|
||||
WSREP_TO_ISOLATION_BEGIN(first_table->db.str, first_table->table_name.str, NULL);
|
||||
|
||||
bzero((char*) &create_info, sizeof(create_info));
|
||||
create_info.db_type= 0;
|
||||
@ -4155,6 +4155,8 @@ mysql_execute_command(THD *thd)
|
||||
create_info.default_table_charset= thd->variables.collation_database;
|
||||
create_info.alter_info= &alter_info;
|
||||
|
||||
WSREP_TO_ISOLATION_BEGIN(first_table->db.str, first_table->table_name.str, NULL);
|
||||
|
||||
res= mysql_alter_table(thd, &first_table->db, &first_table->table_name,
|
||||
&create_info, first_table, &alter_info,
|
||||
0, (ORDER*) 0, 0);
|
||||
@ -4857,6 +4859,7 @@ mysql_execute_command(THD *thd)
|
||||
slave_ddl_exec_mode_options == SLAVE_EXEC_MODE_IDEMPOTENT)
|
||||
lex->create_info.set(DDL_options_st::OPT_IF_EXISTS);
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
if (WSREP(thd))
|
||||
{
|
||||
for (TABLE_LIST *table= all_tables; table; table= table->next_global)
|
||||
@ -4870,7 +4873,8 @@ mysql_execute_command(THD *thd)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* WITH_WSREP */
|
||||
|
||||
/* DDL and binlog write order are protected by metadata locks. */
|
||||
res= mysql_rm_table(thd, first_table, lex->if_exists(), lex->tmp_table(),
|
||||
lex->table_type == TABLE_TYPE_SEQUENCE);
|
||||
@ -5070,7 +5074,9 @@ mysql_execute_command(THD *thd)
|
||||
(CREATE_ACL | DROP_ACL) : CREATE_ACL,
|
||||
&lex->name))
|
||||
break;
|
||||
|
||||
WSREP_TO_ISOLATION_BEGIN(lex->name.str, NULL, NULL);
|
||||
|
||||
res= mysql_create_db(thd, &lex->name,
|
||||
lex->create_info, &lex->create_info);
|
||||
break;
|
||||
@ -5079,7 +5085,9 @@ mysql_execute_command(THD *thd)
|
||||
{
|
||||
if (prepare_db_action(thd, DROP_ACL, &lex->name))
|
||||
break;
|
||||
|
||||
WSREP_TO_ISOLATION_BEGIN(lex->name.str, NULL, NULL);
|
||||
|
||||
res= mysql_rm_db(thd, &lex->name, lex->if_exists());
|
||||
break;
|
||||
}
|
||||
@ -5111,7 +5119,9 @@ mysql_execute_command(THD *thd)
|
||||
res= 1;
|
||||
break;
|
||||
}
|
||||
|
||||
WSREP_TO_ISOLATION_BEGIN(db->str, NULL, NULL);
|
||||
|
||||
res= mysql_upgrade_db(thd, db);
|
||||
if (!res)
|
||||
my_ok(thd);
|
||||
@ -5122,7 +5132,9 @@ mysql_execute_command(THD *thd)
|
||||
LEX_CSTRING *db= &lex->name;
|
||||
if (prepare_db_action(thd, ALTER_ACL, db))
|
||||
break;
|
||||
|
||||
WSREP_TO_ISOLATION_BEGIN(db->str, NULL, NULL);
|
||||
|
||||
res= mysql_alter_db(thd, db, &lex->create_info);
|
||||
break;
|
||||
}
|
||||
@ -5196,6 +5208,7 @@ mysql_execute_command(THD *thd)
|
||||
break;
|
||||
#ifdef HAVE_DLOPEN
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
|
||||
|
||||
if (!(res = mysql_create_function(thd, &lex->udf)))
|
||||
my_ok(thd);
|
||||
#else
|
||||
@ -5213,7 +5226,9 @@ mysql_execute_command(THD *thd)
|
||||
"mysql", NULL, NULL, 1, 1) &&
|
||||
check_global_access(thd,CREATE_USER_ACL))
|
||||
break;
|
||||
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
|
||||
|
||||
/* Conditionally writes to binlog */
|
||||
if (!(res= mysql_create_user(thd, lex->users_list,
|
||||
lex->sql_command == SQLCOM_CREATE_ROLE)))
|
||||
@ -5226,8 +5241,10 @@ mysql_execute_command(THD *thd)
|
||||
if (check_access(thd, DELETE_ACL, "mysql", NULL, NULL, 1, 1) &&
|
||||
check_global_access(thd,CREATE_USER_ACL))
|
||||
break;
|
||||
/* Conditionally writes to binlog */
|
||||
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
|
||||
|
||||
/* Conditionally writes to binlog */
|
||||
if (!(res= mysql_drop_user(thd, lex->users_list,
|
||||
lex->sql_command == SQLCOM_DROP_ROLE)))
|
||||
my_ok(thd);
|
||||
@ -5239,8 +5256,10 @@ mysql_execute_command(THD *thd)
|
||||
if (check_access(thd, UPDATE_ACL, "mysql", NULL, NULL, 1, 1) &&
|
||||
check_global_access(thd,CREATE_USER_ACL))
|
||||
break;
|
||||
/* Conditionally writes to binlog */
|
||||
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
|
||||
|
||||
/* Conditionally writes to binlog */
|
||||
if (lex->sql_command == SQLCOM_ALTER_USER)
|
||||
res= mysql_alter_user(thd, lex->users_list);
|
||||
else
|
||||
@ -5255,16 +5274,19 @@ mysql_execute_command(THD *thd)
|
||||
check_global_access(thd,CREATE_USER_ACL))
|
||||
break;
|
||||
|
||||
/* Conditionally writes to binlog */
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
|
||||
|
||||
/* Conditionally writes to binlog */
|
||||
if (!(res = mysql_revoke_all(thd, lex->users_list)))
|
||||
my_ok(thd);
|
||||
break;
|
||||
}
|
||||
|
||||
case SQLCOM_REVOKE_ROLE:
|
||||
case SQLCOM_GRANT_ROLE:
|
||||
{
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
|
||||
|
||||
if (!(res= mysql_grant_role(thd, lex->users_list,
|
||||
lex->sql_command != SQLCOM_GRANT_ROLE)))
|
||||
my_ok(thd);
|
||||
@ -5611,6 +5633,7 @@ mysql_execute_command(THD *thd)
|
||||
case SQLCOM_DROP_PACKAGE:
|
||||
case SQLCOM_DROP_PACKAGE_BODY:
|
||||
if (drop_routine(thd, lex))
|
||||
|
||||
goto error;
|
||||
break;
|
||||
case SQLCOM_SHOW_CREATE_PROC:
|
||||
@ -5676,8 +5699,10 @@ mysql_execute_command(THD *thd)
|
||||
{
|
||||
if (check_table_access(thd, DROP_ACL, all_tables, FALSE, UINT_MAX, FALSE))
|
||||
goto error;
|
||||
/* Conditionally writes to binlog. */
|
||||
|
||||
WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
|
||||
|
||||
/* Conditionally writes to binlog. */
|
||||
res= mysql_drop_view(thd, first_table, thd->lex->drop_mode);
|
||||
break;
|
||||
}
|
||||
@ -5983,7 +6008,7 @@ finish:
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
thd->wsrep_consistency_check= NO_CONSISTENCY_CHECK;
|
||||
|
||||
|
||||
WSREP_TO_ISOLATION_END;
|
||||
/*
|
||||
Force release of transactional locks if not in active MST and wsrep is on.
|
||||
|
Reference in New Issue
Block a user