summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay@skysql.com>2014-06-25 11:22:01 -0400
committerNirbhay Choubey <nirbhay@skysql.com>2014-06-25 11:22:01 -0400
commit9e1075eea005f0ddcc7c429cf4c9d60e54578ecb (patch)
tree0d959af1af817bb8118ce8b710338af8a2427835 /sql
parentc039d9667e5a2d15eed50357e4c7ce586c7de70b (diff)
downloadmariadb-git-9e1075eea005f0ddcc7c429cf4c9d60e54578ecb.tar.gz
Follow-up patch for lp:1312618 to fix a segfault.
Diffstat (limited to 'sql')
-rw-r--r--sql/event_data_objects.cc21
1 files changed, 12 insertions, 9 deletions
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc
index b91db2c3df4..8f00ace7124 100644
--- a/sql/event_data_objects.cc
+++ b/sql/event_data_objects.cc
@@ -1473,20 +1473,23 @@ end:
thd->tx_read_only= false;
#ifdef WITH_WSREP
- // sql_print_information("sizeof(LEX) = %d", sizeof(struct LEX));
- // sizeof(LEX) = 4512, so it's relatively safe to allocate it on stack.
- LEX lex;
- lex.sql_command = SQLCOM_DROP_EVENT;
- thd->lex = &lex;
- WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
+ if (WSREP(thd)) {
+ // sql_print_information("sizeof(LEX) = %d", sizeof(struct LEX));
+ // sizeof(LEX) = 4512, so it's relatively safe to allocate it on stack.
+ LEX *old_lex= thd->lex, new_lex;
+ new_lex.sql_command= SQLCOM_DROP_EVENT;
+ thd->lex= &new_lex;
+ WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, NULL, NULL);
+ thd->lex= old_lex;
+ }
#endif
-
+
ret= Events::drop_event(thd, dbname, name, FALSE);
-#ifdef WITH_WSREP
+#ifdef WITH_WSREP
WSREP_TO_ISOLATION_END;
error:
-#endif
+#endif
thd->tx_read_only= save_tx_read_only;
thd->security_ctx->master_access= saved_master_access;
}