summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-09-27 17:28:01 +0200
committerSergei Golubchik <serg@mariadb.org>2018-10-24 14:48:08 +0200
commit329058be298a471006e55a674db1c4d769acaf67 (patch)
tree15b06cd31a74ad39aeff25abfb7d48fa4db094f1
parent0140bfac5e216bd7ba8ad324bd914d596bf59a1f (diff)
downloadmariadb-git-329058be298a471006e55a674db1c4d769acaf67.tar.gz
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
-rw-r--r--include/wsrep.h11
-rw-r--r--sql/events.cc16
-rw-r--r--sql/sql_acl.cc4
-rw-r--r--sql/sql_admin.cc3
-rw-r--r--sql/sql_alter.cc11
-rw-r--r--sql/sql_base.cc1
-rw-r--r--sql/sql_parse.cc1
-rw-r--r--sql/sql_plugin.cc10
-rw-r--r--sql/sql_trigger.cc5
-rw-r--r--sql/sql_view.cc6
-rw-r--r--sql/wsrep_mysqld.cc2
11 files changed, 34 insertions, 36 deletions
diff --git a/include/wsrep.h b/include/wsrep.h
index 0d32547d69c..14d624aec26 100644
--- a/include/wsrep.h
+++ b/include/wsrep.h
@@ -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 */
diff --git a/sql/events.cc b/sql/events.cc
index 3fdb432cba6..187a3208d9f 100644
--- a/sql/events.cc
+++ b/sql/events.cc
@@ -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 */
}
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index 72d65e14a94..886ff90f35b 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -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;
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index be23cd3341b..b8881f8f108 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -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);
}
diff --git a/sql/sql_alter.cc b/sql/sql_alter.cc
index 0accc04c10d..758489ddcfb 100644
--- a/sql/sql_alter.cc
+++ b/sql/sql_alter.cc
@@ -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)
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index c4b243e5aba..e6e1b9beb96 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -4813,6 +4813,7 @@ restart:
}
error:
+WSREP_ERROR_LABEL:
THD_STAGE_INFO(thd, stage_after_opening_tables);
thd_proc_info(thd, 0);
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index add059340c9..a76d9f0bbd3 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -5712,6 +5712,7 @@ end_with_restore_list:
goto finish;
error:
+WSREP_ERROR_LABEL:
res= TRUE;
finish:
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 8d055fd612f..1000fc3711a 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -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 */
}
diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc
index 4a484723f02..14e1e84739b 100644
--- a/sql/sql_trigger.cc
+++ b/sql/sql_trigger.cc
@@ -612,10 +612,9 @@ end:
my_ok(thd);
DBUG_RETURN(result);
-#ifdef WITH_WSREP
- error:
+
+WSREP_ERROR_LABEL:
DBUG_RETURN(true);
-#endif /* WITH_WSREP */
}
diff --git a/sql/sql_view.cc b/sql/sql_view.cc
index 6bd6b6a7b63..b7ff4513a32 100644
--- a/sql/sql_view.cc
+++ b/sql/sql_view.cc
@@ -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);
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 1b2d7fe04e6..c3f5dd1ce97 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -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);
}