Commit 790a8274 authored by sjaakola's avatar sjaakola Committed by Jan Lindström

Refs: MW-360 * reverted WSREP_TO_ISOLATION macros back to original form

parent 04c6b03c
......@@ -4040,7 +4040,19 @@ case SQLCOM_PREPARE:
slave_ddl_exec_mode_options == SLAVE_EXEC_MODE_IDEMPOTENT)
lex->check_exists= 1;
WSREP_TO_ISOLATION_BEGIN(NULL, NULL, all_tables);
#ifdef WITH_WSREP
for (TABLE_LIST *table= all_tables; table; table= table->next_global)
{
if (!lex->drop_temporary &&
(!thd->is_current_stmt_binlog_format_row() ||
!find_temporary_table(thd, table)))
{
WSREP_TO_ISOLATION_BEGIN(NULL, NULL, all_tables);
break;
}
}
#endif /* WITH_WSREP */
/* DDL and binlog write order are protected by metadata locks. */
res= mysql_rm_table(thd, first_table, lex->check_exists,
lex->drop_temporary);
......
......@@ -209,12 +209,29 @@ inline bool is_supported_parser_charset(CHARSET_INFO *cs)
return MY_TEST(cs->mbminlen == 1);
}
#ifndef WITH_WSREP
#ifdef WITH_WSREP
#define WSREP_MYSQL_DB (char *)"mysql"
#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_END \
if (WSREP(thd) || (thd && thd->wsrep_exec_mode==TOTAL_ORDER)) \
wsrep_to_isolation_end(thd);
/* Checks if lex->no_write_to_binlog is set for statements that use
LOCAL or NO_WRITE_TO_BINLOG
*/
#define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, table_, table_list_) \
if (WSREP(thd) && !thd->lex->no_write_to_binlog \
&& wsrep_to_isolation_begin(thd, db_, table_, table_list_)) goto error;
#else
#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_)
#define WSREP_TO_ISOLATION_BEGIN_QUERY(db_, query_, table_, table_list_)
#define WSREP_TO_ISOLATION_END
#define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, query_, table_, table_list_)
#endif /* !WITH_WSREP */
#define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, table_, table_list_)
#endif /* WITH_WSREP */
#endif /* SQL_PARSE_INCLUDED */
......@@ -537,7 +537,7 @@ bool Sql_cmd_alter_table_exchange_partition::
if ((!thd->is_current_stmt_binlog_format_row() ||
/* TODO: Do we really need to check for temp tables in this case? */
!find_temporary_table(thd, table_list)) &&
wsrep_to_isolation_begin(thd, NULL, table_list->db, table_list->table_name,
wsrep_to_isolation_begin(thd, table_list->db, table_list->table_name,
NULL))
{
WSREP_WARN("ALTER TABLE EXCHANGE PARTITION isolation failure");
......@@ -785,7 +785,7 @@ bool Sql_cmd_alter_table_truncate_partition::execute(THD *thd)
if (WSREP(thd) && (!thd->is_current_stmt_binlog_format_row() ||
!find_temporary_table(thd, first_table)) &&
wsrep_to_isolation_begin(
thd, NULL, first_table->db, first_table->table_name, NULL)
thd, first_table->db, first_table->table_name, NULL)
)
{
WSREP_WARN("ALTER TABLE TRUNCATE PARTITION isolation failure");
......
......@@ -487,9 +487,9 @@ bool Sql_cmd_truncate_table::truncate_table(THD *thd, TABLE_LIST *table_ref)
bool hton_can_recreate;
#ifdef WITH_WSREP
if (WSREP(thd) && wsrep_to_isolation_begin(thd, NULL,
table_ref->db,
table_ref->table_name, NULL))
if (WSREP(thd) && wsrep_to_isolation_begin(thd,
table_ref->db,
table_ref->table_name, NULL))
DBUG_RETURN(TRUE);
#endif /* WITH_WSREP */
if (lock_table(thd, table_ref, &hton_can_recreate))
......
......@@ -1523,7 +1523,7 @@ static void wsrep_RSU_end(THD *thd)
thd->variables.wsrep_on = 1;
}
int wsrep_to_isolation_begin(THD *thd, const char *query, char *db_, char *table_,
int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_,
const TABLE_LIST* table_list)
{
......@@ -1579,7 +1579,7 @@ int wsrep_to_isolation_begin(THD *thd, const char *query, char *db_, char *table
{
switch (thd->variables.wsrep_OSU_method) {
case WSREP_OSU_TOI:
ret = wsrep_TOI_begin(thd, query, db_, table_, table_list);
ret = wsrep_TOI_begin(thd, thd->query(), db_, table_, table_list);
break;
case WSREP_OSU_RSU:
ret = wsrep_RSU_begin(thd, db_, table_);
......
......@@ -320,7 +320,7 @@ extern PSI_mutex_key key_LOCK_wsrep_slave_threads;
extern PSI_mutex_key key_LOCK_wsrep_desync;
#endif /* HAVE_PSI_INTERFACE */
struct TABLE_LIST;
int wsrep_to_isolation_begin(THD *thd, const char * query, char *db_, char *table_,
int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_,
const TABLE_LIST* table_list);
void wsrep_to_isolation_end(THD *thd);
void wsrep_cleanup_transaction(THD *thd);
......@@ -338,22 +338,4 @@ void wsrep_init_sidno(const wsrep_uuid_t&);
bool wsrep_node_is_donor();
bool wsrep_node_is_synced();
#define WSREP_MYSQL_DB (char *)"mysql"
#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) \
if (WSREP(thd) && wsrep_to_isolation_begin(thd, NULL, db_, table_, table_list_)) goto error;
#define WSREP_TO_ISOLATION_BEGIN_QUERY(query, db_, table_, table_list_) \
(WSREP(thd) && wsrep_to_isolation_begin(thd, query, db_, table_, table_list_))
#define WSREP_TO_ISOLATION_END \
if (WSREP(thd) || (thd && thd->wsrep_exec_mode==TOTAL_ORDER)) \
wsrep_to_isolation_end(thd);
/* Checks if lex->no_write_to_binlog is set for statements that use
LOCAL or NO_WRITE_TO_BINLOG
*/
#define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, table_, table_list_) \
if (WSREP(thd) && !thd->lex->no_write_to_binlog \
&& wsrep_to_isolation_begin(thd, NULL, db_, table_, table_list_)) goto error;
#endif /* WSREP_MYSQLD_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment