summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
authorcbell/Chuck@mysql_cab_desk. <>2007-03-16 09:56:57 -0400
committercbell/Chuck@mysql_cab_desk. <>2007-03-16 09:56:57 -0400
commit3e44599c11e90c2b6470e64dbe6d78bc6c5f9f10 (patch)
tree15f703b3b46120a527b00e8e328eb91286163cec /sql/sql_show.cc
parent2763e9af9addbaea0d55c6653c36ee59803979d8 (diff)
downloadmariadb-git-3e44599c11e90c2b6470e64dbe6d78bc6c5f9f10.tar.gz
WL#3629 - Replication of Invocation and Invoked Features
This changeset adds replication of events and user-defined functions. There are several bug reports involved in this change: BUG#16421, BUG#17857, BUG#20384: This patch modifies the mysql.events table to permit the addition of another enum value for the status column. The column now has values of ('DISABLED','SLAVESIDE_DISABLED','ENABLED'). A status of SLAVESIDE_DISABLED is set on the slave during replication of events. This enables users to determine which events werereplicated from the master and to later enable them if they promote the slave to a master. The CREATE, ALTER, and DROP statements are binlogged. A new test was added for replication of events (rpl_events). BUG#17671: This patch modifies the code to permit logging of user-defined functions. Note: this is the CREATE FUNCTION ... SONAME variety. A more friendly error message to be displayed should a replicated user-defined function not be found in the loadable library or if the library is missing from the slave.The CREATE andDROP statements are binlogged. A new test was added for replication of user-defined functions (rpl_udf). The patch also adds a new column to the mysql.event table named 'originator' that is used to store the server_id of the server that the event originated on. This enables users to promote a slave to a master and later return the promoted slave to a slave and disable the replicated events.
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc31
1 files changed, 22 insertions, 9 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 881cf7dc6c4..6a6e7ce3225 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -52,7 +52,8 @@ enum enum_i_s_events_fields
ISE_CREATED,
ISE_LAST_ALTERED,
ISE_LAST_EXECUTED,
- ISE_EVENT_COMMENT
+ ISE_EVENT_COMMENT,
+ ISE_ORIGINATOR
};
@@ -4393,10 +4394,23 @@ copy_event_to_schema_table(THD *thd, TABLE *sch_table, TABLE *event_table)
}
/* status */
- if (et.status == Event_timed::ENABLED)
- sch_table->field[ISE_STATUS]->store(STRING_WITH_LEN("ENABLED"), scs);
- else
- sch_table->field[ISE_STATUS]->store(STRING_WITH_LEN("DISABLED"), scs);
+
+ switch (et.status)
+ {
+ case Event_timed::ENABLED:
+ sch_table->field[ISE_STATUS]->store(STRING_WITH_LEN("ENABLED"), scs);
+ break;
+ case Event_timed::SLAVESIDE_DISABLED:
+ sch_table->field[ISE_STATUS]->store(STRING_WITH_LEN("SLAVESIDE_DISABLED"),
+ scs);
+ break;
+ case Event_timed::DISABLED:
+ sch_table->field[ISE_STATUS]->store(STRING_WITH_LEN("DISABLED"), scs);
+ break;
+ default:
+ DBUG_ASSERT(0);
+ }
+ sch_table->field[ISE_ORIGINATOR]->store(et.originator, TRUE);
/* on_completion */
if (et.on_completion == Event_timed::ON_COMPLETION_DROP)
@@ -4935,9 +4949,7 @@ int mysql_schema_table(THD *thd, LEX *lex, TABLE_LIST *table_list)
TABLE *table;
DBUG_ENTER("mysql_schema_table");
if (!(table= table_list->schema_table->create_table(thd, table_list)))
- {
DBUG_RETURN(1);
- }
table->s->tmp_table= SYSTEM_TMP_TABLE;
table->grant.privilege= SELECT_ACL;
/*
@@ -5429,13 +5441,14 @@ ST_FIELD_INFO events_fields_info[]=
{"SQL_MODE", 65535, MYSQL_TYPE_STRING, 0, 0, 0},
{"STARTS", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Starts"},
{"ENDS", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, "Ends"},
- {"STATUS", 8, MYSQL_TYPE_STRING, 0, 0, "Status"},
+ {"STATUS", 18, MYSQL_TYPE_STRING, 0, 0, "Status"},
{"ON_COMPLETION", 12, MYSQL_TYPE_STRING, 0, 0, 0},
{"CREATED", 0, MYSQL_TYPE_TIMESTAMP, 0, 0, 0},
{"LAST_ALTERED", 0, MYSQL_TYPE_TIMESTAMP, 0, 0, 0},
{"LAST_EXECUTED", 0, MYSQL_TYPE_TIMESTAMP, 0, 1, 0},
+ {"ORIGINATOR", 10, MYSQL_TYPE_LONG, 0, 0, "Originator"},
{"EVENT_COMMENT", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
- {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0}
};