diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-09-12 12:16:40 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-09-12 12:16:40 +0300 |
commit | 60c04be6599597548ad07ce11e1d7d4004a7cc9c (patch) | |
tree | 491f1b7b65b82ed270e5af34db4d4cebf760e501 /sql/events.cc | |
parent | ebddd8699c02519f99a313182b96ae1c04a67a63 (diff) | |
parent | 9554ef067878c4650ef4b9ad44e0b222cdb313a5 (diff) | |
download | mariadb-git-60c04be6599597548ad07ce11e1d7d4004a7cc9c.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'sql/events.cc')
-rw-r--r-- | sql/events.cc | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/sql/events.cc b/sql/events.cc index 166fa992f88..242689f8370 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -1202,6 +1202,46 @@ Events::load_events_from_db(THD *thd) delete et; goto end; } + +#ifdef WITH_WSREP + /** + IF SST is done from a galera node that is also acting as MASTER + newly synced node in galera eco-system will also copy-over the event state + enabling duplicate event in galera eco-system. + DISABLE such events if the current node is not event orginator. + (Also, make sure you skip disabling it if is already disabled to avoid + creation of redundant action) + NOTE: + This complete system relies on server-id. Ideally server-id should be + same for all nodes of galera eco-system but they aren't same. + Infact, based on galera use-case it seems like it recommends to have each + node with different server-id. + */ + if (et->originator != thd->variables.server_id) + { + if (et->status == Event_parse_data::SLAVESIDE_DISABLED) + continue; + + store_record(table, record[1]); + table->field[ET_FIELD_STATUS]-> + store((longlong) Event_parse_data::SLAVESIDE_DISABLED, + TRUE); + + /* All the dmls to mysql.events tables are stmt bin-logged. */ + bool save_binlog_row_based; + if ((save_binlog_row_based= thd->is_current_stmt_binlog_format_row())) + thd->set_current_stmt_binlog_format_stmt(); + + (void) table->file->ha_update_row(table->record[1], table->record[0]); + + if (save_binlog_row_based) + thd->set_current_stmt_binlog_format_row(); + + delete et; + continue; + } +#endif /* WITH_WSREP */ + /** Since the Event_queue_element object could be deleted inside Event_queue::create_event we should save the value of dropped flag |