diff options
author | Nirbhay Choubey <nirbhay@skysql.com> | 2014-06-10 17:00:32 -0400 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@skysql.com> | 2014-06-10 17:00:32 -0400 |
commit | c29cbac2eb06ab4a2bf1aeda65c15fce40a84345 (patch) | |
tree | 9d5b5dab4dfd0fe78084b0654cd06d6f3fc1171b /sql/events.cc | |
parent | 90ead99572c8168583cb0943792d964cc2a6abd2 (diff) | |
download | mariadb-git-c29cbac2eb06ab4a2bf1aeda65c15fce40a84345.tar.gz |
bzr merge -r3985..3997 codership/5.5
Diffstat (limited to 'sql/events.cc')
-rw-r--r-- | sql/events.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/sql/events.cc b/sql/events.cc index e016ccd2b84..9e15a5f47bd 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -1104,6 +1104,20 @@ Events::load_events_from_db(THD *thd) delete et; goto end; } +#ifdef WITH_WSREP + // when SST from master node who initials event, the event status is ENABLED + // this is problematic because there are two nodes with same events and both enabled. + if (et->originator != thd->server_id) + { + store_record(table, record[1]); + table->field[ET_FIELD_STATUS]-> + store((longlong) Event_parse_data::SLAVESIDE_DISABLED, + TRUE); + (void) table->file->ha_update_row(table->record[1], table->record[0]); + delete et; + continue; + } +#endif drop_on_completion= (et->on_completion == Event_parse_data::ON_COMPLETION_DROP); @@ -1158,6 +1172,33 @@ int wsrep_create_event_query(THD *thd, uchar** buf, size_t* buf_len) } return wsrep_to_buf_helper(thd, log_query.ptr(), log_query.length(), buf, buf_len); } +static int +wsrep_alter_query_string(THD *thd, String *buf) +{ + /* Append the "ALTER" part of the query */ + if (buf->append(STRING_WITH_LEN("ALTER "))) + return 1; + /* Append definer */ + append_definer(thd, buf, &(thd->lex->definer->user), &(thd->lex->definer->host)); + /* Append the left part of thd->query after event name part */ + if (buf->append(thd->lex->stmt_definition_begin, + thd->lex->stmt_definition_end - + thd->lex->stmt_definition_begin)) + return 1; + + return 0; +} +int wsrep_alter_event_query(THD *thd, uchar** buf, size_t* buf_len) +{ + String log_query; + + if (wsrep_alter_query_string(thd, &log_query)) + { + WSREP_WARN("events alter string failed: %s", thd->query()); + return 1; + } + return wsrep_to_buf_helper(thd, log_query.ptr(), log_query.length(), buf, buf_len); +} #endif /* WITH_WSREP */ /** @} (End of group Event_Scheduler) |