wsrep: create a macro for the error: label

that is used by WSREP_TO_ISOLATION_BEGIN and other galera macros,
to avoid the need for wrapping this label in #ifdef WITH_WSREP/#endif
This commit is contained in:
Sergei Golubchik 2018-09-27 17:28:01 +02:00
parent 0140bfac5e
commit 329058be29
11 changed files with 34 additions and 36 deletions

View file

@ -25,12 +25,12 @@
#define WSREP_MYSQL_DB (char *)"mysql"
#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) \
if (WSREP_ON && WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, table_list_)) \
goto error;
goto wsrep_error_label;
#define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_) \
if (WSREP_ON && WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, \
table_list_, alter_info_)) \
goto error;
goto wsrep_error_label;
#define WSREP_TO_ISOLATION_END \
if (WSREP_ON && (WSREP(thd) || (thd && thd->wsrep_exec_mode==TOTAL_ORDER))) \
@ -42,7 +42,7 @@
*/
#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;
&& wsrep_to_isolation_begin(thd, db_, table_, table_list_)) goto wsrep_error_label;
#define WSREP_DEBUG(...) \
if (wsrep_debug) WSREP_LOG(sql_print_information, ##__VA_ARGS__)
@ -52,8 +52,8 @@
#define WSREP_SYNC_WAIT(thd_, before_) \
{ if (WSREP_CLIENT(thd_) && \
wsrep_sync_wait(thd_, before_)) goto error; }
wsrep_sync_wait(thd_, before_)) goto wsrep_error_label; }
#define WSREP_ERROR_LABEL wsrep_error_label
#else
#define IF_WSREP(A,B) B
#define DBUG_ASSERT_IF_WSREP(A)
@ -65,6 +65,7 @@
#define WSREP_TO_ISOLATION_END
#define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, table_, table_list_)
#define WSREP_SYNC_WAIT(thd_, before_)
#define WSREP_ERROR_LABEL goto wsrep_error_label; wsrep_error_label
#endif /* WITH_WSREP */

View file

@ -418,10 +418,10 @@ Events::create_event(THD *thd, Event_parse_data *parse_data)
thd->restore_stmt_binlog_format(save_binlog_format);
DBUG_RETURN(ret);
#ifdef WITH_WSREP
error:
WSREP_ERROR_LABEL:
DBUG_RETURN(TRUE);
#endif /* WITH_WSREP */
}
@ -549,10 +549,9 @@ Events::update_event(THD *thd, Event_parse_data *parse_data,
thd->restore_stmt_binlog_format(save_binlog_format);
DBUG_RETURN(ret);
#ifdef WITH_WSREP
error:
WSREP_ERROR_LABEL:
DBUG_RETURN(TRUE);
#endif /* WITH_WSREP */
}
@ -616,10 +615,9 @@ Events::drop_event(THD *thd, LEX_STRING dbname, LEX_STRING name, bool if_exists)
thd->restore_stmt_binlog_format(save_binlog_format);
DBUG_RETURN(ret);
#ifdef WITH_WSREP
error:
WSREP_ERROR_LABEL:
DBUG_RETURN(TRUE);
#endif /* WITH_WSREP */
}

View file

@ -2861,7 +2861,7 @@ end:
close_mysql_tables(thd);
#ifdef WITH_WSREP
error: // this label is used in WSREP_TO_ISOLATION_BEGIN
WSREP_ERROR_LABEL:
if (WSREP(thd) && !thd->wsrep_applier)
{
WSREP_TO_ISOLATION_END;
@ -3014,7 +3014,7 @@ end:
close_mysql_tables(thd);
#ifdef WITH_WSREP
error: // this label is used in WSREP_TO_ISOLATION_END
WSREP_ERROR_LABEL:
if (WSREP(thd) && !thd->wsrep_applier)
{
WSREP_TO_ISOLATION_END;

View file

@ -1262,6 +1262,7 @@ bool Sql_cmd_analyze_table::execute(THD *thd)
m_lex->query_tables= first_table;
error:
WSREP_ERROR_LABEL:
DBUG_RETURN(res);
}
@ -1320,6 +1321,7 @@ bool Sql_cmd_optimize_table::execute(THD *thd)
m_lex->query_tables= first_table;
error:
WSREP_ERROR_LABEL:
DBUG_RETURN(res);
}
@ -1354,5 +1356,6 @@ bool Sql_cmd_repair_table::execute(THD *thd)
m_lex->query_tables= first_table;
error:
WSREP_ERROR_LABEL:
DBUG_RETURN(res);
}

View file

@ -330,13 +330,10 @@ bool Sql_cmd_alter_table::execute(THD *thd)
lex->ignore);
DBUG_RETURN(result);
#ifdef WITH_WSREP
error:
{
WSREP_WARN("ALTER TABLE isolation failure");
DBUG_RETURN(TRUE);
}
#endif /* WITH_WSREP */
WSREP_ERROR_LABEL:
WSREP_WARN("ALTER TABLE isolation failure");
DBUG_RETURN(TRUE);
}
bool Sql_cmd_discard_import_tablespace::execute(THD *thd)

View file

@ -4813,6 +4813,7 @@ restart:
}
error:
WSREP_ERROR_LABEL:
THD_STAGE_INFO(thd, stage_after_opening_tables);
thd_proc_info(thd, 0);

View file

@ -5712,6 +5712,7 @@ end_with_restore_list:
goto finish;
error:
WSREP_ERROR_LABEL:
res= TRUE;
finish:

View file

@ -2185,10 +2185,9 @@ err:
if (argv)
free_defaults(argv);
DBUG_RETURN(error);
#ifdef WITH_WSREP
error:
WSREP_ERROR_LABEL:
DBUG_RETURN(TRUE);
#endif /* WITH_WSREP */
}
@ -2330,10 +2329,9 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name,
mysql_mutex_unlock(&LOCK_plugin);
DBUG_RETURN(error);
#ifdef WITH_WSREP
error:
WSREP_ERROR_LABEL:
DBUG_RETURN(TRUE);
#endif /* WITH_WSREP */
}

View file

@ -612,10 +612,9 @@ end:
my_ok(thd);
DBUG_RETURN(result);
#ifdef WITH_WSREP
error:
WSREP_ERROR_LABEL:
DBUG_RETURN(true);
#endif /* WITH_WSREP */
}

View file

@ -691,10 +691,10 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
lex->link_first_table_back(view, link_to_local);
DBUG_RETURN(0);
#ifdef WITH_WSREP
error:
WSREP_ERROR_LABEL:
res= TRUE;
#endif /* WITH_WSREP */
err:
THD_STAGE_INFO(thd, stage_end);
lex->link_first_table_back(view, link_to_local);

View file

@ -2715,7 +2715,7 @@ bool wsrep_create_like_table(THD* thd, TABLE_LIST* table,
return(false);
error:
WSREP_ERROR_LABEL:
thd->wsrep_TOI_pre_query= NULL;
return (true);
}