The log event of 'CREATE EVENT' was being binlogged with garbage
at the end of the query if 'CREATE EVENT' is followed by another SQL statement
and they were executed as one command.
for example:
DELIMITER |;
CREATE EVENT e1 ON EVERY DAY DO SELECT 1; SELECT 'a';
DELIMITER ;|
When binlogging 'CREATE EVENT', we always create a new statement with definer
and write it into the log event. The new statement is made from cpp_buf(preprocessed buffer).
which is not a c string(end with '\0'), but it is copied as a c string.
In this patch, cpp_buf is copied with its length.
In RBR, DDL statement will change binlog format to non row-based
format before it is binlogged, but the binlog format was not be
restored, and then manipulating a temporary table can not reset binlog
format to row-based format rightly. So that the manipulated statement
is binlogged with statement-based format.
To fix the problem, restore the state of binlog format after the DDL
statement is binlogged.
mysql-test/extra/rpl_tests/rpl_tmp_table_and_DDL.test:
Added the test file to verify if executing DDL statement before
trying to manipulate a temporary table causes row-based replication
to break with error 'table does not exist'.
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
Correct the test result, all the above binlog event
should be row-based after the bug49132 is fixed IN RBR.
mysql-test/suite/ndb/r/ndb_tmp_table_and_DDL.result:
Test result for bug#49132 base on ndb engine.
mysql-test/suite/ndb/t/ndb_tmp_table_and_DDL.test:
Added the test file to verify if executing DDL statement before
trying to manipulate a temporary table causes row-based replication
to break with error 'table does not exist' base on ndb engine.
mysql-test/suite/rpl/r/rpl_tmp_table_and_DDL.result:
Test result for bug#49132 base on myisam engine.
mysql-test/suite/rpl/t/rpl_tmp_table_and_DDL.test:
Added the test file to verify if executing DDL statement before
trying to manipulate a temporary table causes row-based replication
to break with error 'table does not exist' base on myisam engine.
sql/event_db_repository.cc:
Added code to restore the state of binlog format after the DDL
statement is binlogged.
sql/events.cc:
Added code to restore the state of binlog format after the DDL
statement is binlogged.
sql/sp.cc:
Added code to restore the state of binlog format after the DDL
statement is binlogged.
sql/sql_acl.cc:
Added code to restore the state of binlog format after the DDL
statement is binlogged.
sql/sql_udf.cc:
Added code to restore the state of binlog format after the DDL
statement is binlogged.
Implemented the server infrastructure for the fix:
1. Added a function LEX_STRING *thd_query_string(THD) to return
a LEX_STRING structure instead of char *.
This is the function that must be called in innodb instead of
thd_query()
2. Did some encapsulation in THD : aggregated thd_query and
thd_query_length into a LEX_STRING and made accessor and mutator
methods for easy code updating.
3. Updated the server code to use the new methods where applicable.
If an EVENT is created without the DEFINER clause set explicitly or with it set
to CURRENT_USER, the master and slaves become inconsistent. This issue stems from
the fact that in both cases, the DEFINER is set to the CURRENT_USER of the current
thread. On the master, the CURRENT_USER is the mysqld's user, while on the slave,
the CURRENT_USER is empty for the SQL Thread which is responsible for executing
the statement.
To fix the problem, we do what follows. If the definer is not set explicitly,
a DEFINER clause is added when writing the query into binlog; if 'CURRENT_USER' is
used as the DEFINER, it is replaced with the value of the current user before
writing to binlog.
mysql-test/suite/rpl/r/rpl_create_if_not_exists.result:
Updated the result file after fixing bug#44331
mysql-test/suite/rpl/r/rpl_drop_if_exists.result:
Updated the result file after fixing bug#44331
mysql-test/suite/rpl/r/rpl_events.result:
Test result of Bug#44331
mysql-test/suite/rpl/r/rpl_innodb_mixed_dml.result:
Updated the result file after fixing bug#44331
mysql-test/suite/rpl/t/rpl_events.test:
Added test to verify if the definer is consistent between master and slave
when the event is created without the DEFINER clause set explicitly or the
DEFINER is set to CURRENT_USER
sql/events.cc:
The "create_query_string" function is added to create a new query string
for removing executable comments.
sql/sql_yacc.yy:
The remember_name token was added for recording the offset of EVENT_SYM.
mysqld
The problem was that enabling the event scheduler inside a init
file caused the server to crash upon start-up. The crash occurred
because the event scheduler wasn't being initialized before the
commands in the init-file are processed.
The solution is to initialize the event scheduler before the init
file is read. The patch also disables the event scheduler during
bootstrap and makes the bootstrap operation robust in the
presence of background threads.
mysql-test/std_data/init_file.dat:
Add test case for Bug#43587
sql/event_scheduler.cc:
Signal that the thread_count has been decremented.
sql/events.cc:
Disable the event scheduler during bootstrap.
sql/mysql_priv.h:
Export variable.
sql/mysqld.cc:
Initialize the event scheduler before commands are executed.
sql/sql_parse.cc:
Signal that the bootstrap thread is done.
Binlog the CREATE EVENT unless the created event been successfully dropped
Modified Query_log_event constructor to make sure that error_code
is not set to ER_SERVER_SHUTDOWN or ER_QUERY_INTERRUPTED errors
when NOT_KILLED
sql/events.cc:
binlog the create event unless it's been successfully dropped
sql/log_event.cc:
Modified Query_log_event constructor to make sure that error_code
is not set to ER_SERVER_SHUTDOWN or ER_QUERY_INTERRUPTED errors
when NOT_KILLED
- Remove bothersome warning messages. This change focuses on the warnings
that are covered by the ignore file: support-files/compiler_warnings.supp.
- Strings are guaranteed to be max uint in length
The event scheduler was not designed to work in embedded mode. This
patch disables and excludes the event scheduler when the server is
compiled for embedded build.
libmysqld/Makefile.am:
Reduce the amount of event code in an embedded build.
mysql-test/t/events_trans.test:
Disable test if run in embedded mode.
sql/Makefile.am:
Introduce definition HAVE_EVENT_SCHEDULER and one new source file.
sql/event_data_objects.cc:
Refactor Event_parse_data to new file.
sql/event_data_objects.h:
Refactor Event_parse_data to new file.
Move global definitions to new file.
sql/event_queue.cc:
Move all parsed items to Event_parse_data for easier modularization.
sql/events.cc:
Move all parsed items to Event_parse_data for easier modularization.
sql/mysqld.cc:
Disable the event schedular subsystem if the server is compiled in
embedded mode.
sql/set_var.cc:
Disable the event schedular subsystem if the server is compiled in
embedded mode.
sql/set_var.h:
Disable the event schedular subsystem if the server is compiled in
embedded mode.
sql/sql_db.cc:
Disable the event schedular subsystem if the server is compiled in
embedded mode.
sql/sql_parse.cc:
Disable the event schedular subsystem if the server is compiled in
embedded mode.
sql/sql_show.cc:
Disable the event schedular subsystem if the server is compiled in
embedded mode.
sql/sql_test.cc:
Disable the event schedular subsystem if the server is compiled in
embedded mode.
sql/sql_yacc.yy:
Only include event-code needed for parsing to reduce impact on embedded
build.
Move all constants to Event_parse_data class.
mysql-test/r/events_embedded.result:
Add test case to make sure the 'event_scheduler' can't be activated
in embedded mode.
mysql-test/r/is_embedded.require:
Add test case to make sure the 'event_scheduler' can't be activated
in embedded mode.
mysql-test/t/events_embedded.test:
Add test case to make sure the 'event_scheduler' can't be activated
in embedded mode.
sql/event_parse_data.cc:
New file. Extracted Event_parse data into a new file.
sql/event_parse_data.h:
New file. Extracted Event_parse data into a new file.
Disabled events weren't removed from the memory queue after the scheduler has been
re-enabled. After recalculation of next execution time of an event, it might get disabled.
sql/event_queue.cc:
Sort the event queue in a way that the disabled events will always be
at the end. We will use this for cleaning it, starting from the end.
After recalculating times in the queue, after the scheduler has been enabled
after disabled state, the queue should be cleaned from DISABLED events.
The queue is sorted in a way such that the disabled events are at the end.
Thus, we can start from the end of the queue and remove all DISABLED till we
find the first with different state.
sql/events.cc:
Add a comment about possible problem with replication of events,
disabled events and server restarts.
into mysql.com:/home/gluh/MySQL/Merge/5.1-opt
BitKeeper/etc/ignore:
auto-union
client/mysql.cc:
Auto merged
client/mysqltest.c:
Auto merged
include/mysql_com.h:
Auto merged
libmysql/CMakeLists.txt:
Auto merged
libmysqld/lib_sql.cc:
Auto merged
mysql-test/r/archive.result:
Auto merged
mysql-test/r/create.result:
Auto merged
mysql-test/r/delayed.result:
Auto merged
mysql-test/r/func_misc.result:
Auto merged
mysql-test/r/innodb.result:
Auto merged
mysql-test/r/innodb_mysql.result:
Auto merged
mysql-test/r/merge.result:
Auto merged
mysql-test/r/ps.result:
Auto merged
mysql-test/r/type_date.result:
Auto merged
mysql-test/suite/rpl/r/rpl_innodb_bug28430.result:
Auto merged
mysql-test/t/create.test:
Auto merged
mysql-test/t/func_misc.test:
Auto merged
mysql-test/t/information_schema.test:
Auto merged
mysql-test/t/merge.test:
Auto merged
mysql-test/t/subselect.test:
Auto merged
mysql-test/t/type_date.test:
Auto merged
mysql-test/t/type_datetime.test:
Auto merged
mysql-test/t/variables.test:
Auto merged
mysys/queues.c:
Auto merged
sql/events.cc:
Auto merged
sql/field.cc:
Auto merged
sql/field.h:
Auto merged
sql/ha_partition.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/opt_range.cc:
Auto merged
sql/protocol.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/set_var.h:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_db.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_partition.cc:
Auto merged
sql/sql_plugin.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_string.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/table.cc:
Auto merged
sql/table.h:
Auto merged
storage/myisam/ha_myisam.cc:
Auto merged
storage/myisam/mi_check.c:
Auto merged
storage/myisam/mi_open.c:
Auto merged
tests/mysql_client_test.c:
Auto merged
mysql-test/lib/mtr_report.pl:
manual merge
mysql-test/r/myisam.result:
manual merge
mysql-test/r/partition.result:
manual merge
mysql-test/r/user_var.result:
manual merge
mysql-test/t/myisam.test:
manual merge
mysql-test/t/partition.test:
manual merge
mysql-test/t/user_var.test:
manual merge
sql/item.h:
manual merge
sql/item_func.cc:
manual merge
storage/myisammrg/ha_myisammrg.cc:
manual merge
removed unnecessary privilege checks for I_S schema
mysql-test/r/information_schema.result:
test result
mysql-test/t/information_schema.test:
test case
sql/events.cc:
There is no events in I_S so we don't need to execute check_access here.
sql/sql_parse.cc:
removed unnecessary check
into mattiasj-laptop.(none):/home/mattiasj/clones/mysql-5.1-last_with_main
libmysqld/lib_sql.cc:
Auto merged
mysql-test/include/mix1.inc:
Auto merged
mysql-test/r/innodb_mysql.result:
Auto merged
sql/event_scheduler.cc:
Auto merged
sql/events.cc:
Auto merged
sql/ha_ndbcluster_binlog.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_connect.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_yacc.yy:
Auto merged
partitioned table
Trying INSERT DELAYED on a partitioned table, that has not been
used right before, crashes the server. When a table is used for
select or update, it is kept open for some time. This period I
mean with "right before".
Information about partitioning of a table is stored in form of
a string in the .frm file. Parsing of this string requires a
correctly set up lexical analyzer (lex). The partitioning code
uses a new temporary instance of a lex. But it does still refer
to the previously active lex. The delayd insert thread does not
initialize its lex though...
Added initialization for thd->lex before open table in the delayed
thread and at all other places where it is necessary to call
lex_start() if all tables would be partitioned and need to parse
the .frm file.
mysql-test/r/partition_hash.result:
Bug#31210 - INSERT DELAYED crashes server when used on
partitioned table
Added test result
mysql-test/t/partition_hash.test:
Bug#31210 - INSERT DELAYED crashes server when used on
partitioned table
Added test
sql/event_scheduler.cc:
Bug#31210 - INSERT DELAYED crashes server when used on
partitioned table
Initialized lex for later use in open_table().
sql/events.cc:
Bug#31210 - INSERT DELAYED crashes server when used on
partitioned table
Initialized lex for later use in open_table().
sql/ha_ndbcluster_binlog.cc:
Bug#31210 - INSERT DELAYED crashes server when used on
partitioned table
Initialized lex for later use in open_table().
sql/slave.cc:
Bug#31210 - INSERT DELAYED crashes server when used on
partitioned table
Initialized lex for later use in open_table().
sql/sql_acl.cc:
Bug#31210 - INSERT DELAYED crashes server when used on
partitioned table
Initialized lex for later use in open_table().
sql/sql_base.cc:
Bug#31210 - INSERT DELAYED crashes server when used on
partitioned table
Asserted that lex is initialized in open_table().
sql/sql_connect.cc:
Bug#31210 - INSERT DELAYED crashes server when used on
partitioned table
Initialized lex for later use in open_table().
sql/sql_insert.cc:
Bug#31210 - INSERT DELAYED crashes server when used on
partitioned table
Added initialization for thd->lex before open table.
sql/sql_lex.cc:
Bug#31210 - INSERT DELAYED crashes server when used on
partitioned table
Added 'is_lex_started' to test if lex is initialized.
sql/sql_lex.h:
Bug#31210 - INSERT DELAYED crashes server when used on
partitioned table
Added 'is_lex_started' to test if lex is initialized.
sql/sql_plugin.cc:
Bug#31210 - INSERT DELAYED crashes server when used on
partitioned table
Initialized lex for later use in open_table().
sql/sql_servers.cc:
Bug#31210 - INSERT DELAYED crashes server when used on
partitioned table
Initialized lex for later use in open_table().
sql/sql_udf.cc:
Bug#31210 - INSERT DELAYED crashes server when used on
partitioned table
Initialized lex for later use in open_table().
sql/table.cc:
Bug#31210 - INSERT DELAYED crashes server when used on
partitioned table
Asserted that lex is initialized in open_table_from_share().
sql/tztime.cc:
Bug#31210 - INSERT DELAYED crashes server when used on
partitioned table
Initialized lex for later use in open_table().
Changed the behaviour of the --event-scheduler option when used without an arguments. It
now turns the option on.
mysql-test/r/events_bugs.result:
Test that --event-scheduler with no options in events_bugs-master.opt turns the option
on.
mysql-test/t/events_bugs.test:
Test that --event-scheduler with no options in events_bugs-master.opt turns the option
on.
sql/events.cc:
Changed the behaviour of the --event-scheduler option when used without an arguments.
It now turns the option on.
mysql-test/t/events_bugs-master.opt:
Test that --event-scheduler with no options in events_bugs-master.opt turns the option
on.
There actually were several problems here:
- WRITE-lock is required to load events from the mysql.event table,
but in the read-only mode an ordinary user can not acquire it;
- Security_context::master_access attribute was not properly
initialized in Security_context::init(), which led to differences
in behavior with and without debug configure options.
- if the server failed to load events from mysql.event, it forgot to
close the mysql.event table, that led to the coredump, described
in the bug report.
The patch is to fix all these problems:
- Use the super-user to acquire WRITE-lock on the mysql.even table;
- The WRITE-lock is acquired by the event scheduler in two cases:
- on initial loading of events from the database;
- when an event has been executed, so its attributes should
be updated.
Other cases when WRITE-lock is needed for the mysql.event table
happen under the user account. So, nothing should be changed there
for the read-only mode. The user is able to create/update/drop
an event only if he is a super-user.
- Initialize Security_context::master_access;
- Close the mysql.event table in case something went wrong.
mysql-test/r/events_bugs.result:
Update result file.
mysql-test/t/events_bugs.test:
A test case for BUG#31111: --read-only crashes MySQL (events fail
to load).
sql/event_data_objects.cc:
When the worker thread is going to drop event after the execution
we should do it under the super-user privileges in order to be able
to lock the mysql.event table for writing in the read-only mode.
This is a system operation, where user SQL can not be executed.
So, there is no risk in compromising security by dropping an event
under the super-user privileges.
sql/event_db_repository.cc:
1. Close tables if something went wrong in simple_open_n_lock_tables();
2. As soon as the system event scheduler thread is running under
the super-user privileges, we should always be able to acquire
WRITE-lock on the mysql.event table. However, let's have an assert
to check this.
sql/event_scheduler.cc:
Run the system event scheduler thread under the super-user privileges.
In particular, this is needed to be able to lock the mysql.event table
for writing when the server is running in the read-only mode.
The event scheduler executes only system operations and does not
execute user SQL (this is what the worker threads for). So, there
is no risk in compromising security by running the event scheduler
under the super-user privileges.
sql/events.cc:
Open the mysql.event table as the super user to be able to acquire
WRITE-lock in the read-only mode.
sql/sql_class.cc:
Initialize Security_context::master_acces.
SHOW CREATE TABLE or SELECT FROM I_S.
This is the last patch for this bug, which depends on the big
CS patch and was pending.
The problem was that SHOW CREATE statements returned original
queries in the binary character set. That could cause the query
to be unreadable.
The fix is to use original character_set_client when sending
the original query to the client. In order to preserve the query
in mysqldump, 'binary' character set results should be set when
issuing SHOW CREATE statement. If either source or destination
character set is 'binary' , no conversion is performed.
The idea is that since the source character set is no longer
'binary', we fix the destination character set to still produce
valid dumps.
client/mysqldump.c:
Switch character_set_results of mysqldump-connection before
calling SHOW CREATE statements for the objects.
mysql-test/r/show_check.result:
Result file.
mysql-test/t/show_check.test:
Add test case for the part of BUG#10491.
sql/events.cc:
Send original query in the original character set.
sql/sp_head.cc:
Send original query in the original character set.
sql/sql_show.cc:
Send original query in the original character set.
- BUG#11986: Stored routines and triggers can fail if the code
has a non-ascii symbol
- BUG#16291: mysqldump corrupts string-constants with non-ascii-chars
- BUG#19443: INFORMATION_SCHEMA does not support charsets properly
- BUG#21249: Character set of SP-var can be ignored
- BUG#25212: Character set of string constant is ignored (stored routines)
- BUG#25221: Character set of string constant is ignored (triggers)
There were a few general problems that caused these bugs:
1. Character set information of the original (definition) query for views,
triggers, stored routines and events was lost.
2. mysqldump output query in client character set, which can be
inappropriate to encode definition-query.
3. INFORMATION_SCHEMA used strings with mixed encodings to display object
definition;
1. No query-definition-character set.
In order to compile query into execution code, some extra data (such as
environment variables or the database character set) is used. The problem
here was that this context was not preserved. So, on the next load it can
differ from the original one, thus the result will be different.
The context contains the following data:
- client character set;
- connection collation (character set and collation);
- collation of the owner database;
The fix is to store this context and use it each time we parse (compile)
and execute the object (stored routine, trigger, ...).
2. Wrong mysqldump-output.
The original query can contain several encodings (by means of character set
introducers). The problem here was that we tried to convert original query
to the mysqldump-client character set.
Moreover, we stored queries in different character sets for different
objects (views, for one, used UTF8, triggers used original character set).
The solution is
- to store definition queries in the original character set;
- to change SHOW CREATE statement to output definition query in the
binary character set (i.e. without any conversion);
- introduce SHOW CREATE TRIGGER statement;
- to dump special statements to switch the context to the original one
before dumping and restore it afterwards.
Note, in order to preserve the database collation at the creation time,
additional ALTER DATABASE might be used (to temporary switch the database
collation back to the original value). In this case, ALTER DATABASE
privilege will be required. This is a backward-incompatible change.
3. INFORMATION_SCHEMA showed non-UTF8 strings
The fix is to generate UTF8-query during the parsing, store it in the object
and show it in the INFORMATION_SCHEMA.
Basically, the idea is to create a copy of the original query convert it to
UTF8. Character set introducers are removed and all text literals are
converted to UTF8.
This UTF8 query is intended to provide user-readable output. It must not be
used to recreate the object. Specialized SHOW CREATE statements should be
used for this.
The reason for this limitation is the following: the original query can
contain symbols from several character sets (by means of character set
introducers).
Example:
- original query:
CREATE VIEW v1 AS SELECT _cp1251 'Hello' AS c1;
- UTF8 query (for INFORMATION_SCHEMA):
CREATE VIEW v1 AS SELECT 'Hello' AS c1;
client/mysqldump.c:
Set original character set and collation before dumping definition query.
include/my_sys.h:
Move out-parameter to the end of list.
mysql-test/lib/mtr_report.pl:
Ignore server-warnings during the test case.
mysql-test/r/create.result:
Update result file.
mysql-test/r/ctype_cp932_binlog_stm.result:
Update result file.
mysql-test/r/events.result:
Update result file.
mysql-test/r/events_bugs.result:
Update result file.
mysql-test/r/events_grant.result:
Update result file.
mysql-test/r/func_in.result:
Update result file.
mysql-test/r/gis.result:
Update result file.
mysql-test/r/grant.result:
Update result file.
mysql-test/r/information_schema.result:
Update result file.
mysql-test/r/information_schema_db.result:
Update result file.
mysql-test/r/lowercase_view.result:
Update result file.
mysql-test/r/mysqldump.result:
Update result file.
mysql-test/r/ndb_sp.result:
Update result file.
mysql-test/r/ps.result:
Update result file.
mysql-test/r/rpl_replicate_do.result:
Update result file.
mysql-test/r/rpl_sp.result:
Update result file.
mysql-test/r/rpl_trigger.result:
Update result file.
mysql-test/r/rpl_view.result:
Update result file.
mysql-test/r/show_check.result:
Update result file.
mysql-test/r/skip_grants.result:
Update result file.
mysql-test/r/sp-destruct.result:
Update result file.
mysql-test/r/sp-error.result:
Update result file.
mysql-test/r/sp-security.result:
Update result file.
mysql-test/r/sp.result:
Update result file.
mysql-test/r/sql_mode.result:
Update result file.
mysql-test/r/system_mysql_db.result:
Update result file.
mysql-test/r/temp_table.result:
Update result file.
mysql-test/r/trigger-compat.result:
Update result file.
mysql-test/r/trigger-grant.result:
Update result file.
mysql-test/r/trigger.result:
Update result file.
mysql-test/r/view.result:
Update result file.
mysql-test/r/view_grant.result:
Update result file.
mysql-test/t/events.test:
Update test case (new columns added).
mysql-test/t/information_schema.test:
Update test case (new columns added).
mysql-test/t/show_check.test:
Test case for SHOW CREATE TRIGGER in prepared statements and
stored routines.
mysql-test/t/sp-destruct.test:
Update test case (new columns added).
mysql-test/t/sp.test:
Update test case (new columns added).
mysql-test/t/view.test:
Update test.
mysys/charset.c:
Move out-parameter to the end of list.
scripts/mysql_system_tables.sql:
Add new columns to mysql.proc and mysql.event.
scripts/mysql_system_tables_fix.sql:
Add new columns to mysql.proc and mysql.event.
sql/event_data_objects.cc:
Support new attributes for events.
sql/event_data_objects.h:
Support new attributes for events.
sql/event_db_repository.cc:
Support new attributes for events.
sql/event_db_repository.h:
Support new attributes for events.
sql/events.cc:
Add new columns to SHOW CREATE event resultset.
sql/mysql_priv.h:
1. Introduce Object_creation_ctx;
2. Introduce SHOW CREATE TRIGGER;
3. Introduce auxilary functions.
sql/sp.cc:
Add support for new store routines attributes.
sql/sp_head.cc:
Add support for new store routines attributes.
sql/sp_head.h:
Add support for new store routines attributes.
sql/sql_lex.cc:
Generate UTF8-body on parsing/lexing.
sql/sql_lex.h:
1. Generate UTF8-body on parsing/lexing.
2. Introduce SHOW CREATE TRIGGER.
sql/sql_parse.cc:
Introduce SHOW CREATE TRIGGER.
sql/sql_partition.cc:
Update parse_sql().
sql/sql_prepare.cc:
Update parse_sql().
sql/sql_show.cc:
Support new attributes for views
sql/sql_trigger.cc:
Support new attributes for views
sql/sql_trigger.h:
Support new attributes for views
sql/sql_view.cc:
Support new attributes for views
sql/sql_yacc.yy:
1. Add SHOW CREATE TRIGGER statement.
2. Generate UTF8-body for views, stored routines, triggers and events.
sql/table.cc:
Introduce Object_creation_ctx.
sql/table.h:
Introduce Object_creation_ctx.
sql/share/errmsg.txt:
Add new errors.
mysql-test/include/ddl_i18n.check_events.inc:
Aux file for test suite.
mysql-test/include/ddl_i18n.check_sp.inc:
Aux file for test suite.
mysql-test/include/ddl_i18n.check_triggers.inc:
Aux file for test suite.
mysql-test/include/ddl_i18n.check_views.inc:
Aux file for test suite.
mysql-test/include/have_cp1251.inc:
Aux file for test suite.
mysql-test/include/have_cp866.inc:
Aux file for test suite.
mysql-test/include/have_koi8r.inc:
Aux file for test suite.
mysql-test/include/have_utf8.inc:
Aux file for test suite.
mysql-test/r/ddl_i18n_koi8r.result:
Result file.
mysql-test/r/ddl_i18n_utf8.result:
Result file.
mysql-test/r/have_cp1251.require:
Aux file for test suite.
mysql-test/r/have_cp866.require:
Aux file for test suite.
mysql-test/r/have_koi8r.require:
Aux file for test suite.
mysql-test/r/have_utf8.require:
Aux file for test suite.
mysql-test/t/ddl_i18n_koi8r.test:
Complete koi8r test case for the CS patch.
mysql-test/t/ddl_i18n_utf8.test:
Complete utf8 test case for the CS patch.
CREATE/DROP TEMPORARY TABLE + ROLLBACK on master
The transaction ability of the storage engines of
the tables on the replication master and the replication
slave must generally be the same.
When the storage engine type of the slave is
non-transactional then transactions on the master that
mix update of transactional and non-transactional tables
should be avoided because they will cause inconsistency of
the data between the master's transactional table and the
slave's non-transactional table.
The effect described by this bug is actually expected.
A detailed test case is added (to be merged later to
the updated rpl_ddl.test), as there was no coverage
by the existing tests.
Some code cleanup is also added by this change.
mysql-test/r/rpl_innodb.result:
Bug #26418: test case
mysql-test/t/rpl_innodb.test:
Bug #26418: test case
sql/events.cc:
Bug #26418: replace repeating code with a function call
sql/sp.cc:
Bug #26418: replace repeating code with a function call
sql/sql_acl.cc:
Bug #26418: replace repeating code with a function call
sql/sql_class.cc:
Bug #26418: remove dead code
sql/sql_class.h:
Bug #26418: remove dead code
sql/sql_delete.cc:
Bug #26418: replace repeating code with a function call
sql/sql_parse.cc:
Bug #26418: replace repeating code with a function call
sql/sql_rename.cc:
Bug #26418: replace repeating code with a function call
sql/sql_tablespace.cc:
Bug #26418: replace repeating code with a function call
sql/sql_trigger.cc:
Bug #26418: replace repeating code with a function call
sql/sql_udf.cc:
Bug #26418: replace repeating code with a function call
sql/sql_view.cc:
Bug #26418: replace repeating code with a function call
into vajra.(none):/opt/local/work/mysql-5.1-runtime
client/mysqldump.c:
Auto merged
sql/events.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sql_class.cc:
Auto merged
mysql-test/r/rpl_events.result:
Now ON COMPLETION NOT PRESERVE events are also dropped on the
slave, since DROP EVENT command that is invoked for all such commands
gets invoked on the slave.
sql/event_data_objects.cc:
Fix the failing rpl_events test after the patch for Bug#27733.
At the time Events::drop_event got invoked inside
Event_job_data::execute() thd->query pointed to CREATE PROCEDURE
statement. This statement was written to the binary log
from inside Events::drop_event (under assumption that this is a
DROP EVENT statement that needs to be replicated), and caused
creation of this procedure on the slave (and a subsequent failure
when a procedure with the same name already exist).
The patch ensures that thd->query points at the right query text
for DROP EVENT executed when dropping ON COMPLETION NOT PRESERVE
events.
sql/event_data_objects.h:
Update a declaration.
sql/events.cc:
Change if () to an assert: thd->query now always points at a valid
query.
into mysql.com:/d2/hf/mrg/mysql-5.1-opt
client/mysqldump.c:
Auto merged
mysql-test/r/rpl_packet.result:
Auto merged
mysql-test/r/sp.result:
Auto merged
mysql-test/t/rpl_packet.test:
Auto merged
sql/field.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sp_head.h:
Auto merged
sql/sql_partition.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/share/errmsg.txt:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/table.cc:
Auto merged
storage/innobase/handler/ha_innodb.cc:
Auto merged
mysql-test/r/create.result:
SCCS merged
mysql-test/t/create.test:
merging
mysql-test/t/disabled.def:
merging
sql/events.cc:
merging
sql/sql_parse.cc:
SCCS merged
sql/event_data_objects.cc:
Disable an event if its data in the table is corrupted.
sql/events.cc:
A fix for events_trans failure on most of the hosts.
A better error message if the event table is old
(don't suggest it's corrupted, it may simply have bad data).
Bug#23631 "Events: SHOW VARIABLES doesn't work when mysql.event
is damaged:
mysql-test/r/events.result:
Update results (a post-merge fix)
mysql-test/r/events_bugs.result:
Update results (a post-merge fix)
mysql-test/r/events_scheduling.result:
Update results (a post-merge fix)
mysql-test/t/events_scheduling.test:
Make sure this test has no races.
sql/event_data_objects.cc:
Manual post-merge fix for the events replication patch.
sql/event_data_objects.h:
A post-merge fix.
sql/event_db_repository.cc:
A post-merge fix.
sql/event_scheduler.cc:
We should drop the event inside ::execute since there we have
the right credentials to do so (otherwise Events::drop_event
returns "access denied" error).
sql/events.cc:
A post-review fix for: rename start_or_stop_event_scheduler
to switch_event_scheduler_state.
sql/events.h:
A post-review fix for: rename start_or_stop_event_scheduler
to switch_event_scheduler_state.
sql/set_var.cc:
A post-review fix for: rename start_or_stop_event_scheduler
to switch_event_scheduler_state.
sql/sql_yacc.yy:
Remove unused declaratoins.
into vajra.(none):/opt/local/work/mysql-5.1-c1
mysql-test/r/events_bugs.result:
Auto merged
mysql-test/r/events_scheduling.result:
Auto merged
mysql-test/t/events.test:
Auto merged
mysql-test/t/events_scheduling.test:
Auto merged
sql/event_data_objects.h:
Auto merged
sql/event_db_repository.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/set_var.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/table.h:
Auto merged
sql/share/errmsg.txt:
Auto merged
mysql-test/r/events.result:
e
Use local.
mysql-test/r/events_restart_phase1.result:
Use local
mysql-test/r/events_time_zone.result:
SCCS merged
mysql-test/t/events_restart_phase1.test:
Use local
sql/event_data_objects.cc:
Use local
sql/event_db_repository.cc:
Manual merge.
sql/event_queue.cc:
Manual merge.
sql/events.cc:
Manual merge.
when there are no up-to-date system tables to support it:
- initialize the scheduler before reporting "Ready for connections".
This ensures that warnings, if any, are printed before "Ready for
connections", and this message is not mangled.
- do not abort the scheduler if there are no system tables
- check the tables once at start up, remember the status and disable
the scheduler if the tables are not up to date.
If one attempts to use the scheduler with bad tables,
issue an error message.
- clean up the behaviour of the module under LOCK TABLES and pre-locking
mode
- make sure implicit commit of Events DDL works as expected.
- add more tests
Collateral clean ups in the events code.
This patch fixes Bug#23631 Events: SHOW VARIABLES doesn't work
when mysql.event is damaged
mysql-test/r/events.result:
Update results.
mysql-test/r/events_bugs.result:
Update results.
mysql-test/r/events_restart_phase1.result:
Update results.
mysql-test/r/events_restart_phase2.result:
Update results.
mysql-test/r/events_restart_phase3.result:
Update results.
mysql-test/r/events_scheduling.result:
Update results.
mysql-test/r/events_time_zone.result:
Update results.
mysql-test/t/events.test:
Add new tests for tampering with mysql.event and some more
tests for sub-statements, LOCK TABLES mode and pre-locking.
mysql-test/t/events_bugs.test:
Move the non-concurrent part of test for Bug 16420 to this file.
mysql-test/t/events_restart_phase1.test:
Rewrite events_restart_* tests to take into account that now
we check mysql.event table only once, at server startup.
mysql-test/t/events_restart_phase2.test:
Rewrite events_restart_* tests to take into account that now
we check mysql.event table only once, at server startup.
mysql-test/t/events_restart_phase3.test:
Rewrite events_restart_* tests to take into account that now
we check mysql.event table only once, at server startup.
mysql-test/t/events_scheduling.test:
Add more coverage for event_scheduler global variable.
mysql-test/t/events_time_zone.test:
Move the non-concurrent part of the tests for Bug 16420 to
events_bugs.test
sql/event_data_objects.cc:
Move update_timing_fields functionality to Event_db_repository.
Make loading of events from a table record more robust to tampering
with the table - now we do not check mysql.event on every table open.
sql/event_data_objects.h:
Cleanup.
sql/event_db_repository.cc:
Now Event_db_repository is responsible for table I/O only.
All the logic of events DDL is handled outside, in Events class please
refer to the added test coverage to see how this change affected
the behavior of Event Scheduler.
Dependency on sp_head.h and sp.h removed.
Make this module robust to tweaks with mysql.event table.
Move check_system_tables from events.cc to this file
sql/event_db_repository.h:
Cleanup declarations (remove unused ones, change return type to bool
from int).
sql/event_queue.cc:
Update to adapt to the new start up scheme of the Event Scheduler.
sql/event_queue.h:
Cleanup declarations.
sql/event_scheduler.cc:
Make all the error messages uniform:
[SEVERITY] Event Scheduler: [user][schema.event] message
Using append_identifier for error logging was an overkill - we may
need it only if the system character set may have NUL (null character)
as part of a valid identifier, this is currently never the case,
whereas additional quoting did not look nice in the log.
sql/event_scheduler.h:
Cleanup the headers.
sql/events.cc:
Use a different start up procedure of Event Scheduler:
- at start up, try to check the system tables first.
If they are not up-to-date, disable the scheduler.
- try to load all the active events. In case of a load error, abort
start up.
- do not parse an event on start up. Parsing only gives some information
about event validity, but far not all.
Consolidate the business logic of Events DDL in this module.
Now opt_event_scheduler may change after start up and thus is protected
by LOCK_event_metadata mutex.
sql/events.h:
Use all-static-data-members approach to implement Singleton pattern.
sql/mysqld.cc:
New invocation scheme of Events. Move some logic to events.cc.
Initialize the scheduler before reporting "Ready for connections".
sql/set_var.cc:
Clean up sys_var_thd_sql_mode::symbolic_mode_representation
to work with a LEX_STRING.
Move more logic related to @@events_scheduler global variable to Events
module.
sql/set_var.h:
Update declarations.
sql/share/errmsg.txt:
If someone tampered with mysql.event table after the server has
started we no longer give him/her a complete report what was actually
broken. Do not send the user to look at the error log in such case,
as there is nothing there (check_table_intact is not executed).
sql/sp_head.cc:
Update to a new declaration of
sys_var_thd_sql_mode::symbolic_mode_representation
sql/sql_db.cc:
New invocation scheme of Events module.
sql/sql_parse.cc:
Move more logic to Events module. Make sure that we are consistent
in the way access rights are checked for Events DDL: always
after committing the current transaction and checking the system tables.
sql/sql_show.cc:
Update to the new declarations of
sys_var_thd_sql_mode::symbolic_mode_representation
sql/sql_test.cc:
New invocation scheme of events.
sql/table.cc:
mysql.event is a system table.
Update check_table_intact to be concurrent, more verbose, and less smart.
sql/table.h:
Add a helper method.
mysql-test/r/events_trans.result:
New BitKeeper file ``mysql-test/r/events_trans.result''
mysql-test/t/events_trans.test:
New BitKeeper file ``mysql-test/t/events_trans.test'':
test cases for Event Scheduler that require a transactional
storage engine.
client/mysqldump.c:
fixed typo
include/mysql_com.h:
added new constants SYSTEM_CHARSET_MBMAXLEN, NAME_CHAR_LEN, USERNAME_CHAR_LENGTH
increased NAME_LEN, USERNAME_LENGTH
mysql-test/r/create.result:
result fix
mysql-test/r/grant.result:
result fix
mysql-test/r/mysql.result:
result fix
mysql-test/r/sp.result:
result fix
mysql-test/t/create.test:
test case
mysql-test/t/grant.test:
test case
sql/events.cc:
NAME_LEN is replaced with NAME_CHAR_LEN
sql/item_strfunc.h:
fixed calculation of max_length
sql/mysql_priv.h:
check_string_length function is replaced with check_string_byte_length
added new function check_string_char_length
sql/sp.cc:
NAME_LEN is replaced with NAME_CHAR_LEN
sql/sp_head.cc:
NAME_LEN is replaced with NAME_CHAR_LEN
sql/sp_head.h:
changed parameter of 'check_routine_name' function
sql/sql_class.cc:
NAME_LEN is replaced with NAME_CHAR_LEN
sql/share/errmsg.txt:
increased argument lengths according to new constants
sql/sql_parse.cc:
removed unnecessary checks
added function 'check_string_char_length'
sql/sql_plugin.cc:
check that name is not longer than NAME_CHAR_LEN symbols
sql/sql_show.cc:
NAME_LEN is replaced with NAME_CHAR_LEN
sql/sql_table.cc:
check that key name is not longer than NAME_LEN symbols
sql/sql_udf.cc:
check that udf name is not longer than NAME_CHAR_LEN symbols
sql/sql_yacc.yy:
check that user name is not longer than USERNAME_CHAR_LENGTH symbols
sql/table.cc:
check that db or table or column name is not longer than NAME_LEN symbols
storage/innobase/handler/ha_innodb.cc:
removed unnecessary multiplication
tests/mysql_client_test.c:
NAME_LEN is replaced with NAME_CHAR_LEN
into bodhi.local:/opt/local/work/mysql-5.1-runtime
mysql-test/r/events_bugs.result:
Auto merged
mysql-test/r/ps.result:
Auto merged
mysql-test/t/events.test:
Auto merged
sql/event_data_objects.cc:
Auto merged
sql/event_data_objects.h:
Auto merged
sql/event_db_repository.h:
Auto merged
sql/event_queue.cc:
Auto merged
sql/events.cc:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sql_servers.cc:
Auto merged
sql/sql_view.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/table.h:
Auto merged
sql/share/errmsg.txt:
Auto merged
mysql-test/r/events.result:
Manual merge.
sql/event_db_repository.cc:
Manual merge.
sql/sql_parse.cc:
Manual merge.
This patch adds code to the binlog calls for replication of the
CREATE, DROP, and UPDATE event commands. An extra gate was added
to ensure a query with length 0 is not binlogged. This corrects
the problem of events_scheduling and rpl_events failing on some
build machines.
sql/events.cc:
WL#3629 - Replication of Invocation and Invoked Features
This patch adds code to the binlog calls for replication of the
CREATE, DROP, and UPDATE event commands. An extra gate was added
to ensure a query with length 0 is not binlogged. This corrects
problems found when the patch for this worklog was pushed.
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.
into mysql_cab_desk.:C:/source/c++/mysql-5.1_WL_3629
BitKeeper/deleted/.del-init_db.sql~a77d572c39d5a1f8:
Auto merged
BitKeeper/deleted/.del-mysql_create_system_tables.sh:
Auto merged
scripts/mysql_system_tables_fix.sql:
Auto merged
sql/event_data_objects.cc:
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
sql/event_data_objects.h:
Manual merge.
sql/event_queue.cc:
Manual merge.
sql/events.cc:
Manual merge.
A larger patch is to come, this is to exclude rudimentary changes
from it.
sql/event_data_objects.cc:
Whitespace change.
sql/event_data_objects.h:
Remove debug allocators - we have safemalloc.
sql/event_db_repository.cc:
Whitespace change.
sql/event_db_repository.h:
Whitespace change.
sql/event_queue.cc:
Remove an unused structure. Whitespace change.
sql/event_queue.h:
Whitespace.
sql/event_scheduler.cc:
Whitespace change.
sql/event_scheduler.h:
Add comments. Whitespace change.
sql/events.cc:
Whitespace change.
sql/events.h:
Trivial cleanups.
BUG#26429: SHOW CREATE EVENT is incorrect for an event that
STARTS NOW()
BUG#26431: Impossible to re-create an event from backup if its
STARTS clause is in the past
WL#3698: Events: execution in local time zone
The problem was that local times specified by the user in AT, STARTS
and ENDS of CREATE EVENT/ALTER EVENT statement were converted to UTC,
and the original time zone was forgotten. This way, event scheduler
couldn't honor Daylight Saving Time shifts, and times shown to the
user were also in UTC. Additionally, CREATE EVENT didn't allow times
in the past, thus preventing straightforward event restoration from
old backups.
This patch reworks event scheduler time computations, performing them
in the time zone associated with the event. Also it allows times to
be in the past.
The patch adds time_zone column to mysql.event table.
NOTE: The patch is almost final, but the bug#9953 should be pushed
first.
client/mysqldump.c:
Before every CREATE EVENT, output its time zone.
mysql-test/include/wait_condition.inc:
Add optional $wait_timeout parameter.
mysql-test/lib/init_db.sql:
Add time_zone column.
mysql-test/r/events.result:
Update result.
mysql-test/r/events_bugs.result:
Update result.
mysql-test/r/events_grant.result:
Update result.
mysql-test/r/events_restart_phase1.result:
Update result.
mysql-test/r/events_scheduling.result:
Update result.
mysql-test/r/mysqldump.result:
Update result.
mysql-test/r/ps.result:
Update result.
mysql-test/r/system_mysql_db.result:
Update result.
mysql-test/t/events.test:
Remove STARTS from the result, as it depends on current time.
mysql-test/t/events_bugs.test:
Time in the past is no longer an error.
mysql-test/t/events_restart_phase1.test:
Fill new column 'time_zone' in mysql.event.
mysql-test/t/events_scheduling.test:
Cleanup: disable event scheduler.
scripts/mysql_create_system_tables.sh:
Add new column 'time_zone' to mysql.event.
scripts/mysql_fix_privilege_tables.sql:
Add new column 'time_zone' to mysql.event.
sql/event_data_objects.cc:
The essence of the change is the following:
- for internal times use my_time_t instead of TIME. Assignment and
comparison is done now on plain numbers.
- in init_execute_at(), init_starts(), init_ends() convert given time
to number of seconds since Epoch (aka Unix time, in UTC).
- handle time_zone field loading and storing.
- in get_next_time(), Unix time is converted back to event time zone,
interval is added, and the result is converted to UTC again.
- fix Event_timed::get_create_event() to report STARTS and ENDS.
- before executing the event body we set thread time zone to the
event time zone.
sql/event_data_objects.h:
Add time_zone member to Event_basic class.
Store internal times in my_time_t (number of seconds since Epoch),
rather than in broken down TIME structure.
sql/event_db_repository.cc:
Add time_zone column handling.
Give a warning and do not create an event if its execution time is in
the past, and ON COMPLETION NOT PRESERVE is set, because such an event
should be dropped by that time. Also, do not allow ALTER EVENT to
set execution time in the past when ON COMPLETION NOT PRESERVE is set.
sql/event_db_repository.h:
Add enum member for new time zone column.
sql/event_queue.cc:
Replace handling of broken down times with simple handling of
my_time_t.
sql/event_queue.h:
Store internal times in my_time_t (number of seconds since Epoch),
rather than in broken down TIME structure.
sql/event_scheduler.cc:
Add TODO comment.
sql/events.cc:
Send time_zone column for SHOW CREATE EVENT.
sql/share/errmsg.txt:
Update error message, and add two more errors.
sql/sql_show.cc:
Add TIME_ZONE column to the output of SHOW EVENTS.
mysql-test/r/events_time_zone.result:
BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/r/events_time_zone.result
mysql-test/t/events_time_zone.test:
BitKeeper file /home/tomash/src/mysql_ab/mysql-5.1-wl3698/mysql-test/t/events_time_zone.test
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.
mysql-test/lib/init_db.sql:
WL#3629 - Replication of Invocation and Invoked Feature
This patch adds the SLAVESIDE_DISABLED to the list of enumerated
values for the mysql.event table.
This patch adds the column 'originator' to the mysql.event table.
mysql-test/r/events.result:
WL#3629 - Replication of Invocation and Invoked Feature
This patch adds the 'originator' column to the events test results.
This was necessary to ensure the manual insert into mysql.event table
succeeds because the originator column is set to NOT NULL.
mysql-test/r/events_grant.result:
WL#3629 - Replication of Invocation and Invoked Feature
This patch adds the 'originator' column to the events_grant test results.
This was necessary to ensure the manual insert into mysql.event table
succeeds because the originator column is set to NOT NULL.
mysql-test/r/events_restart_phase1.result:
WL#3629 - Replication of Invocation and Invoked Feature
This patch adds the 'originator' column to the events_restart_phase1
test results. This was necessary to ensure the manual insert into
mysql.event table succeeds because the originator column is set to
NOT NULL.
mysql-test/r/system_mysql_db.result:
WL#3629 - Replication of Invocation and Invoked Feature
This patch adds the SLAVESIDE_DISABLED to the list of enumerated
values for the mysql.event table.
This patch adds the column 'originator' to the mysql.event table.
These changes to the result file were necessary to ensure correct test
results.
mysql-test/t/events.test:
WL#3629 - Replication of Invocation and Invoked Feature
This patch adds the 'originator' column to the events
test. This was necessary to ensure the manual insert into
mysql.event table succeeds because the originator column is set to
NOT NULL.
mysql-test/t/events_restart_phase1.test:
WL#3629 - Replication of Invocation and Invoked Feature
This patch adds the 'originator' column to the events_restart_phase1
test. This was necessary to ensure the manual insert into
mysql.event table succeeds because the originator column is set to
NOT NULL.
scripts/mysql_create_system_tables.sh:
WL#3629 - Replication of Invocation and Invoked Feature
This patch adds the SLAVESIDE_DISABLED to the list of enumerated
values for the mysql.event table.
This patch adds the column 'originator' to the mysql.event table.
scripts/mysql_fix_privilege_tables.sql:
WL#3629 - Replication of Invocation and Invoked Feature
This patch adds the SLAVESIDE_DISABLED to the list of enumerated
values for the mysql.event table.
This patch adds the column 'originator' to the mysql.event table.
sql/event_data_objects.cc:
WL#3629 - Replication of Invocation and Invoked Features
This patch modifies the code to permit processing of the new enum
SLAVESIDE_DISABLED which is set on the slave during replication
of events.
This patch uses the new Event_basic:: enumerated values.
sql/event_data_objects.h:
WL#3629 - Replication of Invocation and Invoked Features
This patch moves the duplicated enumeration values for ENABLED,
SLAVESIDE_DISABLED, and DISABLED to the Event_basic class removing
them from the other Event_* classes.
sql/event_db_repository.cc:
WL#3629 - Replication of Invocation and Invoked Features
This patch modifies the code to permit processing of the new enum
SLAVESIDE_DISABLED which is set on the slave during replication
of events.
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.
sql/event_db_repository.h:
WL#3629 - Replication of Invocation and Invoked Features
This patch modifies the code to add a new field named 'originator'
to the enum_event_table_field and associated structure.
sql/event_queue.cc:
WL#3629 - Replication of Invocation and Invoked Features
This patch modifies the code to permit processing of the new enum
SLAVESIDE_DISABLED which is set on the slave during replication
of events.
sql/events.cc:
WL#3629 - Replication of Invocation and Invoked Features
This patch modifies the code to permit processing of the new enum
SLAVESIDE_DISABLED which is set on the slave during replication
of events.
sql/lex.h:
WL#3629 - Replication of Invocation and Invoked Features
This patch modifies the code to add the new SLAVESIDE_DISABLE symbol
to the lexical parser.
sql/slave.cc:
WL#3629 - Replication of Invocation and Invoked Features
This patch modifies the code to permit the capture of the error on
the slave when a UDF from a loadable library is not loaded on the server
when replicated from the master.
sql/sql_parse.cc:
WL#3629 - Replication of Invocation and Invoked Features
This patch removes the comment because drop functions commands
are replicated.
sql/sql_show.cc:
WL#3629 - Replication of Invocation and Invoked Features
This patch modifies the code to permit processing of the new enum
SLAVESIDE_DISABLED which is set on the slave during replication
of events. The code also adds changes the display width of the status
column for the schema table for the show events command and also adds
the new column 'originator' to the events_field_info structure.
sql/sql_udf.cc:
WL#3629 - Replication of Invocation and Invoked Features
This patch modifies the code to add the binlogging of the create and
drop function events.
sql/sql_yacc.yy:
WL#3629 - Replication of Invocation and Invoked Features
This patch modifies the code to change the enumeration of the status
column for the events in the parser. The code uses the Event_basic::
enumerations allowing the enums to be defined in one place.
mysql-test/t/rpl_events.test:
WL#3629 - Replication of Invocation and Invoked Features
This patch adds a new test for testing replication of events. The test
uses include files so that the test can test under both RBR and SBR.
mysql-test/r/rpl_events.result:
WL#3629 - Replication of Invocation and Invoked Features
This patch adds a new result file for testing replication of events.
mysql-test/r/rpl_udf.result:
WL#3629 - Replication of Invocation and Invoked Features
This patch adds a new result file for testing replication of UDFs.
mysql-test/t/rpl_udf.test:
WL#3629 - Replication of Invocation and Invoked Features
This patch adds a new test for testing replication of UDFs. The test
uses include files so that the test can test under both RBR and SBR.
mysql-test/include/rpl_events.inc:
WL#3629 - Replication of Invocation and Invoked Features
This patch adds a new include file for testing replication of events.
This file contains the core test procedures.
mysql-test/include/rpl_udf.inc:
WL#3629 - Replication of Invocation and Invoked Features
This patch adds a new include file for testing replication of UDFs.
This file contains the core test procedures.
This patch implements the idea of the bug report by making Event_queue
unaware of Event_db_repository by making a higher level class - Events,
which is aware of most of all classes, responsible for passing all data
needed for adding/updating/deleting an event to/from the queue.
Introduces few new classes :
- Event_worker_thread
- Event_queue_element_for_exec
sql/event_data_objects.cc:
Introduced a new class Event_queue_element_for_exec
According to Konstantin it should be named Event_name and hold
only two LEX_STRINGs but `dropped` is not saved on disk and will
require additional logic in Event_worker_thread class, after loading
to compute whether the event should be dropped or not. It's easier
just to pass this flag around.
Removed Event_queue_element::drop(). This method was a source of a
race condition. At the place where the event should be dropped we
call Events::drop_event() which is the only code-flow for dropping.
In addition, because ::drop_event() holds Events::LOCK_metadata there is
no source of race conditions. Before this patch dropping from ::drop()
wasn't under LOCK_metadata and races were possible.
Because Events::open_event_table was removed as a method, provisionally
events_event_db_repository was exported from events.cc till a solution is
build where Event_queue_element does not access directly mysql.event.
sql/event_data_objects.h:
New class Event_queue_element_for_exec added which is returned
from Event_queue::get_top_if_time() and passed through Event_scheduler
to Event_worker_thread. There by using the (db)name Event_job_data is
instanciated and executed.
Dropped Event_queue_element::drop()
thd was moved out of Event_job_data as it is now part of
Event_queue_element_for_exec
sql/event_queue.cc:
Removed dependency of Event_queue on Event_db_repository.
The instantiation of Event_job_data was moved to class Event_worker_thread
In place is a return of an object of Event_queue_element_for_exec is used
later for instantiating Event_job_data.
The `dropped` flag of Event_queue_element is passed over
Event_queue_element_for_exec to the code in Event_worker_thread.
sql/event_queue.h:
Removed dependency of Event_queue on Event_db_repository
Removed dependency on Event_scheduler
sql/event_scheduler.cc:
Added class Event_worker_thread, which is used during
the execution of an event. It has a static init() method
to get a pointer to Event_db_repository to be used for
instantiation of Event_job_data object. This object it then
executed.
sql/event_scheduler.h:
Added class Event_worker_thread, which is used during
the execution of an event.
sql/events.cc:
Removed Events::open_event_table() because it was a product of
a bad architecture.
sql/events.h:
Removed friend definition, unneeded.
Fixed Events::drop_event() to have the previous signature without
bool only_from_disk
sql/sql_parse.cc:
Fix call
Changed header to GPL version 2 only
client/mysqlslap.c:
Changed header to GPL version 2 only
include/atomic/nolock.h:
Changed header to GPL version 2 only
include/atomic/rwlock.h:
Changed header to GPL version 2 only
include/atomic/x86-gcc.h:
Changed header to GPL version 2 only
include/atomic/x86-msvc.h:
Changed header to GPL version 2 only
include/my_atomic.h:
Changed header to GPL version 2 only
include/my_trie.h:
Changed header to GPL version 2 only
include/my_vle.h:
Changed header to GPL version 2 only
include/mysql/plugin.h:
Changed header to GPL version 2 only
mysys/my_atomic.c:
Changed header to GPL version 2 only
mysys/my_getncpus.c:
Changed header to GPL version 2 only
mysys/my_memmem.c:
Changed header to GPL version 2 only
mysys/my_vle.c:
Changed header to GPL version 2 only
mysys/trie.c:
Changed header to GPL version 2 only
plugin/Makefile.am:
Changed header to GPL version 2 only
server-tools/instance-manager/IMService.h:
Changed header to GPL version 2 only
server-tools/instance-manager/WindowsService.h:
Changed header to GPL version 2 only
server-tools/instance-manager/exit_codes.h:
Changed header to GPL version 2 only
server-tools/instance-manager/user_management_commands.h:
Changed header to GPL version 2 only
sql/authors.h:
Changed header to GPL version 2 only
sql/contributors.h:
Changed header to GPL version 2 only
sql/event_data_objects.cc:
Changed header to GPL version 2 only
sql/event_data_objects.h:
Changed header to GPL version 2 only
sql/event_db_repository.cc:
Changed header to GPL version 2 only
sql/event_db_repository.h:
Changed header to GPL version 2 only
sql/event_queue.cc:
Changed header to GPL version 2 only
sql/event_queue.h:
Changed header to GPL version 2 only
sql/event_scheduler.cc:
Changed header to GPL version 2 only
sql/event_scheduler.h:
Changed header to GPL version 2 only
sql/events.cc:
Changed header to GPL version 2 only
sql/events.h:
Changed header to GPL version 2 only
sql/ha_ndbcluster_binlog.cc:
Changed header to GPL version 2 only
sql/ha_ndbcluster_binlog.h:
Changed header to GPL version 2 only
sql/ha_ndbcluster_tables.h:
Changed header to GPL version 2 only
sql/ha_partition.cc:
Changed header to GPL version 2 only
sql/ha_partition.h:
Changed header to GPL version 2 only
sql/item_xmlfunc.cc:
Changed header to GPL version 2 only
sql/item_xmlfunc.h:
Changed header to GPL version 2 only
sql/log.h:
Changed header to GPL version 2 only
sql/partition_element.h:
Changed header to GPL version 2 only
sql/partition_info.cc:
Changed header to GPL version 2 only
sql/partition_info.h:
Changed header to GPL version 2 only
sql/rpl_filter.cc:
Changed header to GPL version 2 only
sql/rpl_filter.h:
Changed header to GPL version 2 only
sql/rpl_injector.cc:
Changed header to GPL version 2 only
sql/rpl_injector.h:
Changed header to GPL version 2 only
sql/rpl_mi.cc:
Changed header to GPL version 2 only
sql/rpl_mi.h:
Changed header to GPL version 2 only
sql/rpl_rli.cc:
Changed header to GPL version 2 only
sql/rpl_rli.h:
Changed header to GPL version 2 only
sql/rpl_tblmap.cc:
Changed header to GPL version 2 only
sql/rpl_tblmap.h:
Changed header to GPL version 2 only
sql/rpl_utility.cc:
Changed header to GPL version 2 only
sql/rpl_utility.h:
Changed header to GPL version 2 only
sql/sql_binlog.cc:
Changed header to GPL version 2 only
sql/sql_partition.cc:
Changed header to GPL version 2 only
sql/sql_partition.h:
Changed header to GPL version 2 only
sql/sql_plugin.cc:
Changed header to GPL version 2 only
sql/sql_plugin.h:
Changed header to GPL version 2 only
sql/sql_servers.cc:
Changed header to GPL version 2 only
sql/sql_servers.h:
Changed header to GPL version 2 only
sql/sql_tablespace.cc:
Changed header to GPL version 2 only
sql/sql_yacc.yy.bak:
Changed header to GPL version 2 only
storage/Makefile.am:
Changed header to GPL version 2 only
storage/archive/Makefile.am:
Changed header to GPL version 2 only
storage/blackhole/Makefile.am:
Changed header to GPL version 2 only
storage/csv/Makefile.am:
Changed header to GPL version 2 only
storage/example/Makefile.am:
Changed header to GPL version 2 only
storage/federated/Makefile.am:
Changed header to GPL version 2 only
storage/innobase/handler/Makefile.am:
Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/AllocNodeId.hpp:
Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/CreateFilegroup.hpp:
Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/CreateFilegroupImpl.hpp:
Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/CreateObj.hpp:
Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/DictObjOp.hpp:
Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/DihFragCount.hpp:
Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/DropFilegroup.hpp:
Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/DropFilegroupImpl.hpp:
Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/DropObj.hpp:
Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/Extent.hpp:
Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/LgmanContinueB.hpp:
Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/PgmanContinueB.hpp:
Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/RestoreContinueB.hpp:
Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/RestoreImpl.hpp:
Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/RouteOrd.hpp:
Changed header to GPL version 2 only
storage/ndb/include/kernel/signaldata/TsmanContinueB.hpp:
Changed header to GPL version 2 only
storage/ndb/include/ndbapi/NdbIndexStat.hpp:
Changed header to GPL version 2 only
storage/ndb/ndbapi-examples/mgmapi_logevent/mgmapi_logevent.cpp:
Changed header to GPL version 2 only
storage/ndb/ndbapi-examples/mgmapi_logevent_dual/mgmapi_logevent_dual.cpp:
Changed header to GPL version 2 only
storage/ndb/ndbapi-examples/ndbapi_async/ndbapi_async.cpp:
Changed header to GPL version 2 only
storage/ndb/ndbapi-examples/ndbapi_async1/ndbapi_async1.cpp:
Changed header to GPL version 2 only
storage/ndb/ndbapi-examples/ndbapi_event/ndbapi_event.cpp:
Changed header to GPL version 2 only
storage/ndb/ndbapi-examples/ndbapi_retries/ndbapi_retries.cpp:
Changed header to GPL version 2 only
storage/ndb/ndbapi-examples/ndbapi_scan/ndbapi_scan.cpp:
Changed header to GPL version 2 only
storage/ndb/ndbapi-examples/ndbapi_simple/ndbapi_simple.cpp:
Changed header to GPL version 2 only
storage/ndb/ndbapi-examples/ndbapi_simple_dual/ndbapi_simple_dual.cpp:
Changed header to GPL version 2 only
storage/ndb/ndbapi-examples/ndbapi_simple_index/ndbapi_simple_index.cpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/dbdih/printSysfile.cpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/dbtup/DbtupDiskAlloc.cpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/dbtup/DbtupVarAlloc.cpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.cpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/dbtup/Undo_buffer.hpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/dbtup/tuppage.cpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/dbtup/tuppage.hpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/dbtux/DbtuxStat.cpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/diskpage.hpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/lgman.cpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/lgman.hpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/pgman.cpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/pgman.hpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/print_file.cpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/record_types.hpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/restore.cpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/restore.hpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/tsman.cpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/blocks/tsman.hpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/DLCFifoList.hpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/DLCHashTable.hpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/DynArr256.cpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/DynArr256.hpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/KeyTable2Ref.hpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/LinearPool.hpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/NdbdSuperPool.cpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/NdbdSuperPool.hpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/Pool.cpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/Pool.hpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/RWPool.cpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/RWPool.hpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/Rope.hpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/SLFifoList.hpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/WOPool.cpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/WOPool.hpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/bench_pool.cpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp:
Changed header to GPL version 2 only
storage/ndb/src/kernel/vm/ndbd_malloc_impl.hpp:
Changed header to GPL version 2 only
storage/ndb/src/mgmsrv/ParamInfo.cpp:
Changed header to GPL version 2 only
storage/ndb/src/ndbapi/NdbIndexStat.cpp:
Changed header to GPL version 2 only
storage/ndb/test/ndbapi/testIndexStat.cpp:
Changed header to GPL version 2 only
storage/ndb/test/tools/listen.cpp:
Changed header to GPL version 2 only
storage/ndb/tools/restore/ndb_nodegroup_map.h:
Changed header to GPL version 2 only
strings/my_strchr.c:
Changed header to GPL version 2 only
unittest/mysys/base64-t.c:
Changed header to GPL version 2 only
unittest/mysys/bitmap-t.c:
Changed header to GPL version 2 only
unittest/mysys/my_atomic-t.c:
Changed header to GPL version 2 only
unittest/mytap/tap.c:
Changed header to GPL version 2 only
unittest/mytap/tap.h:
Changed header to GPL version 2 only
win/Makefile.am:
Changed header to GPL version 2 only