diff options
author | unknown <cbell/Chuck@mysql_cab_desk.> | 2007-03-29 09:54:59 -0400 |
---|---|---|
committer | unknown <cbell/Chuck@mysql_cab_desk.> | 2007-03-29 09:54:59 -0400 |
commit | 4a0f5887b71ca3bda0d06e5d0641f985a0ca679a (patch) | |
tree | b882e0f7e923a5f2e63a816eb86059d4de1a3abd /sql/event_data_objects.cc | |
parent | cbbb40346ffaed733ba9784c7ee9f461667d45fd (diff) | |
parent | 7e43b1f586142693a9b1ec1cf5ac92e6a38a3190 (diff) | |
download | mariadb-git-4a0f5887b71ca3bda0d06e5d0641f985a0ca679a.tar.gz |
Merge cbell@bk-internal.mysql.com:/home/bk/mysql-5.1-new-rpl
into mysql_cab_desk.:C:/source/c++/mysql-5.1-new-rpl
mysql-test/t/events.test:
Auto merged
sql/event_queue.cc:
Auto merged
sql/events.cc:
Auto merged
sql/lex.h:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
BitKeeper/deleted/.del-init_db.sql~a77d572c39d5a1f8:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
BitKeeper/deleted/.del-mysql_create_system_tables.sh:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
mysql-test/r/events.result:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
mysql-test/r/events_grant.result:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
mysql-test/r/events_restart_phase1.result:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
mysql-test/r/system_mysql_db.result:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
mysql-test/t/events_restart_phase1.test:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
scripts/mysql_system_tables.sql:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
scripts/mysql_system_tables_fix.sql:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
sql/event_data_objects.cc:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
sql/event_data_objects.h:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
sql/event_db_repository.cc:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
sql/event_db_repository.h:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
sql/sql_udf.cc:
WL#3629 : Replication of Invocation and Invoked Features
Manual merge prior to pushing patches.
Diffstat (limited to 'sql/event_data_objects.cc')
-rw-r--r-- | sql/event_data_objects.cc | 60 |
1 files changed, 55 insertions, 5 deletions
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index 67ba371772a..9f9e778658f 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -101,7 +101,8 @@ Event_parse_data::new_instance(THD *thd) */ Event_parse_data::Event_parse_data() - :on_completion(ON_COMPLETION_DROP), status(ENABLED), do_not_create(FALSE), + :on_completion(Event_basic::ON_COMPLETION_DROP), + status(Event_basic::ENABLED), do_not_create(FALSE), item_starts(NULL), item_ends(NULL), item_execute_at(NULL), starts_null(TRUE), ends_null(TRUE), execute_at_null(TRUE), item_expression(NULL), expression(0) @@ -588,9 +589,9 @@ Event_parse_data::check_parse_data(THD *thd) init_name(thd, identifier); init_definer(thd); - ret= init_execute_at(thd) || init_interval(thd) || init_starts(thd) || init_ends(thd); + check_originator_id(thd); DBUG_RETURN(ret); } @@ -638,6 +639,31 @@ Event_parse_data::init_definer(THD *thd) /* + Set the originator id of the event to the server_id if executing on + the master or set to the server_id of the master if executing on + the slave. If executing on slave, also set status to SLAVESIDE_DISABLED. + + SYNOPSIS + Event_parse_data::check_originator_id() +*/ +void Event_parse_data::check_originator_id(THD *thd) +{ + /* Disable replicated events on slave. */ + if ((thd->system_thread == SYSTEM_THREAD_SLAVE_SQL) || + (thd->system_thread == SYSTEM_THREAD_SLAVE_IO)) + { + DBUG_PRINT("info", ("Invoked object status set to SLAVESIDE_DISABLED.")); + if ((status == Event_basic::ENABLED) || + (status == Event_basic::DISABLED)) + status = Event_basic::SLAVESIDE_DISABLED; + originator = thd->server_id; + } + else + originator = server_id; +} + + +/* Constructor SYNOPSIS @@ -995,8 +1021,23 @@ Event_queue_element::load_from_row(THD *thd, TABLE *table) goto error; DBUG_PRINT("load_from_row", ("Event [%s] is [%s]", name.str, ptr)); - status= (ptr[0]=='E'? Event_queue_element::ENABLED: - Event_queue_element::DISABLED); + + /* Set event status (ENABLED | SLAVESIDE_DISABLED | DISABLED) */ + switch (ptr[0]) + { + case 'E' : + status = Event_queue_element::ENABLED; + break; + case 'S' : + status = Event_queue_element::SLAVESIDE_DISABLED; + break; + case 'D' : + status = Event_queue_element::DISABLED; + break; + } + if ((ptr= get_field(&mem_root, table->field[ET_FIELD_ORIGINATOR])) == NullS) + goto error; + originator = table->field[ET_FIELD_ORIGINATOR]->val_int(); /* ToDo : Andrey . Find a way not to allocate ptr on event_mem_root */ if ((ptr= get_field(&mem_root, @@ -1343,7 +1384,7 @@ Event_queue_element::compute_next_execution_time() (long) starts, (long) ends, (long) last_executed, (long) this)); - if (status == Event_queue_element::DISABLED) + if (status != Event_queue_element::ENABLED) { DBUG_PRINT("compute_next_execution_time", ("Event %s is DISABLED", name.str)); @@ -1641,6 +1682,13 @@ Event_queue_element::update_timing_fields(THD *thd) status_changed= FALSE; } + /* + Turn off row binlogging of event timing updates. These are not used + for RBR of events replicated to the slave. + */ + if (thd->current_stmt_binlog_row_based) + thd->clear_current_stmt_binlog_row_based(); + if ((table->file->ha_update_row(table->record[1], table->record[0]))) ret= TRUE; @@ -1731,6 +1779,8 @@ Event_timed::get_create_event(THD *thd, String *buf) if (status == Event_timed::ENABLED) buf->append(STRING_WITH_LEN("ENABLE")); + else if (status == Event_timed::SLAVESIDE_DISABLED) + buf->append(STRING_WITH_LEN("SLAVESIDE_DISABLE")); else buf->append(STRING_WITH_LEN("DISABLE")); |