correctly in some cases".
In short, calls to a stored function located in another database
than the default database, may fail to replicate if the call was made
by SET, SELECT, or DO.
Longer: when a stored function is called from a statement which does not go
to binlog ("SET @a=somedb.myfunc()", "SELECT somedb.myfunc()",
"DO somedb.myfunc()"), this crafted statement is binlogged:
"SELECT myfunc();" (accompanied with a mention of the default database
if there is one). So, if "somedb" is not the default database,
the slave would fail to find myfunc(). The fix is to specify the
function's database name in the crafted binlogged statement, like this:
"SELECT somedb.myfunc();". Test added in rpl_sp.test.
mysql-test/r/rpl_sp.result:
Because I moved the SHOW BINLOG EVENTS down a bit, big portions of its
output move. Also, the function's database name appears in
SELECT statements.
mysql-test/t/rpl_sp.test:
Adding test for BUG#19725.
Moving the SHOW BINLOG EVENTS down, it is run at the very end to
test everything.
sql/sp_head.cc:
When binlogging a "SELECT myfunc()" (when a stored function is executed
inside a statement which does not go to the binlog (like a SET,
SELECT, DO), we need to write "SELECT db_of_myfunc().myfunc()",
because the function may be in a database which is not the default
database.
into kpdesk.mysql.com:/home/thek/dev/mysql-5.0-maint
mysql-test/r/information_schema.result:
Auto merged
mysql-test/t/information_schema.test:
Auto merged
mysql-test/t/rpl_sp.test:
Auto merged
sql/sql_parse.cc:
Auto merged
mysql-test/r/rpl_sp.result:
- Merged
- Refactoring of duplicate code
- Modified bad test cases
- Changed expected error when operating on information_schema.
mysql-test/r/information_schema.result:
- updated result file with new error code.
mysql-test/r/rpl_sp.result:
- Modified test case
mysql-test/t/information_schema.test:
- Changed error code for operations on information_schema
mysql-test/t/rpl_sp.test:
- Modified test case
sql/sql_parse.cc:
- Cleaned up code:
* replace tab with space
* simplified if/switch statements
* refactored duplicated code
into kpdesk.mysql.com:/home/thek/dev/mysql-5.0-maint
sql/sql_parse.cc:
Auto merged
mysql-test/r/rpl_sp.result:
- merged
mysql-test/t/rpl_sp.test:
-merged
- CREATE PROCEDURE stores database name based on query context instead
of 'current database' as set by 'USE' according to manual.
The bug reporter interpret the filtering statements as bug for
DROP PROCEDURE based on this behavior.
- Removed the code which changes db context.
- Added code to check that a valid db was supplied.
mysql-test/r/rpl_sp.result:
- Added test case (result)
mysql-test/t/rpl_sp.test:
- Added test case
sql/sp.cc:
- Removed code for changing current db context.
sql/sql_parse.cc:
- Added code to check if a valid db was supplied.
mysql-test/r/init_connect.result:
Restore global variable to the value it's set to when server is started
mysql-test/r/key_cache.result:
Restore global variable values to original
mysql-test/r/mysqldump.result:
Drop the user that was created. Specifying "drop user myDB_user" is equal to "drop user myDB_user@%"
mysql-test/r/rpl_deadlock.result:
Restore global variable values to original
mysql-test/r/rpl_drop_db.result:
Remove the conflicting file and drop database mysqltest1 before test exits
mysql-test/r/rpl_ignore_revoke.result:
As changes to mysql.* are ignored - explicitly delete the user on slave
mysql-test/r/rpl_init_slave.result:
Restore global variable values to original
mysql-test/r/rpl_max_relay_size.result:
Restore global variable values to original
mysql-test/r/rpl_sp.result:
Restore global variable values to original
mysql-test/r/rpl_timezone.result:
Restore global variable values to original
mysql-test/r/rpl_variables.result:
Restore global variable values to original
mysql-test/r/view_grant.result:
Use same user in all places in the same test "readonly" is equal to "readonly@%" not "readonly@localhost"
mysql-test/t/init_connect.test:
Restore global variable to the value it's set to when server is started
mysql-test/t/key_cache.test:
Restore global variable values to original
mysql-test/t/mysqldump.test:
Drop the user that was created. Specifying "drop user myDB_user" is equal to "drop user myDB_user@%"
mysql-test/t/rpl_deadlock.test:
Restore global variable values to original
mysql-test/t/rpl_drop_db.test:
Remove the conflicting file and drop database mysqltest1 before test exits
mysql-test/t/rpl_ignore_revoke.test:
As changes to mysql.* are ignored - explicitly delete the user on slave
mysql-test/t/rpl_init_slave.test:
Restore global variable values to original
mysql-test/t/rpl_max_relay_size.test:
Restore global variable values to original
mysql-test/t/rpl_sp.test:
Restore global variable values to original
mysql-test/t/rpl_timezone.test:
Restore global variable values to original
mysql-test/t/rpl_variables.test:
Restore global variable values to original
mysql-test/t/view_grant.test:
Use same user in all places in the same test "readonly" is equal to "readonly@%" not "readonly@localhost"
can be not replicable.
Now CREATE statements for writing in the binlog are created as follows:
- the beginning of the statement is re-created;
- the rest of the statement is copied from the original query.
The problem appears when there is a version-specific comment (produced by
mysqldump), started in the re-created part of the statement and closed in the
copied part -- there is closing comment-parenthesis, but there is no opening
one.
The proper fix could be to re-create original statement, but we can not
implement it in 5.0. So, for 5.0 the fix is just to cut closing
comment-parenthesis. This technique is also used for SHOW CREATE PROCEDURE
statement (so we are able to reuse existing code).
mysql-test/r/rpl_sp.result:
Updated result file.
mysql-test/r/rpl_trigger.result:
Updated result file.
mysql-test/r/rpl_view.result:
Updated result file.
mysql-test/t/rpl_sp.test:
Added test case for BUG#20438.
mysql-test/t/rpl_trigger.test:
Added test case for BUG#20438.
mysql-test/t/rpl_view.test:
Added test case for BUG#20438.
sql/sp.cc:
Trim comments at the end.
sql/sp_head.cc:
Moved this code to the separate function to be re-used.
sql/sql_lex.cc:
Added a new function.
sql/sql_lex.h:
Added a new function.
sql/sql_trigger.cc:
Trim comments at the end.
sql/sql_view.cc:
Trim comments at the end.
The idea is to add DEFINER-clause in CREATE PROCEDURE and CREATE FUNCTION
statements. Almost all support of definer in stored routines had been already
done before this patch.
NOTE: this patch changes behaviour of dumping stored routines in mysqldump.
Before this patch, mysqldump did not dump DEFINER-clause for stored routines
and this was documented behaviour. In order to get full information about stored
routines, one should have dumped mysql.proc table. This patch changes this
behaviour, so that DEFINER-clause is dumped.
Since DEFINER-clause is not supported in CREATE PROCEDURE | FUNCTION statements
before this patch, the clause is covered by additional version-specific comments.
client/mysqldump.c:
Updated the code for dumping stored routines: cover DEFINER-clause
into version-specific comment.
mysql-test/r/gis.result:
Updated result file after adding DEFINER-clause.
mysql-test/r/information_schema.result:
Updated result file after adding DEFINER-clause.
mysql-test/r/mysqldump.result:
Updated result file after adding DEFINER-clause.
mysql-test/r/rpl_ddl.result:
Updated result file after adding DEFINER-clause.
mysql-test/r/rpl_sp.result:
Updated result file after adding DEFINER-clause.
mysql-test/r/rpl_trigger.result:
Updated result file after adding DEFINER-clause.
mysql-test/r/sp-security.result:
Updated result file after adding DEFINER-clause.
mysql-test/r/sp.result:
Updated result file after adding DEFINER-clause.
mysql-test/r/sql_mode.result:
Updated result file after adding DEFINER-clause.
mysql-test/t/sp-security.test:
Updated result file after adding DEFINER-clause.
sql/sp.cc:
Added DEFINER-clause.
sql/sp_head.cc:
Added a new convenient variant of set_definer() operation.
sql/sp_head.h:
Updated result file after adding DEFINER-clause.
sql/sql_lex.h:
Renamed trigger_definition_begin into stmt_definition_begin to be used for
triggers and stored routines.
sql/sql_parse.cc:
Check DEFINER-clause.
sql/sql_trigger.cc:
Renamed trigger_definition_begin into stmt_definition_begin to be used for
triggers and stored routines.
sql/sql_yacc.yy:
Added DEFINER-clause.
if the function, invoked in a non-binlogged caller (e.g. SELECT, DO), failed half-way on the master,
slave would stop and complain that error code between him and master mismatch.
To solve this, when a stored function is invoked in a non-binlogged caller (e.g. SELECT, DO), we binlog the function
call as SELECT instead of as DO (see revision comment of sp_head.cc for more).
And: minor wording change in the help text.
This cset will cause conflicts in 5.1, I'll merge.
mysql-test/r/rpl_sp.result:
result update
mysql-test/t/rpl_sp-slave.opt:
bug just fixed so option not needed
mysql-test/t/rpl_sp.test:
test for more half-failed functions with DO and SELECT, to test the bug of this changeset.
cleanup at the end.
sql/mysqld.cc:
function -> stored function (change suggested by Paul)
sql/sp_head.cc:
When a function updates data and is called from a non-binlogged statement (SELECT, DO), we binlog it
as SELECT myfunc(), and not DO myfunc() like before.
in the Binary Log.
mysql-test/r/rpl_sp.result:
Update result file.
mysql-test/t/rpl_sp.test:
Add test case for BUG#16621: INSERTs in Stored Procedures causes data corruption
in the Binary Log.
the bug is fixed.
mysql-test/r/rpl_sp.result:
BUG#14931: Temporarily add synchronization to avoid sporadic failures until
the bug is fixed.
mysql-test/t/rpl_sp.test:
BUG#14931: Temporarily add synchronization to avoid sporadic failures until
the bug is fixed.
function with a cursor". Enable execution of SELECT queries in SP on slave.
mysql-test/r/rpl_sp.result:
Test results were fixed (Bug#14077).
mysql-test/t/rpl_sp.test:
Add a test case for Bug#14077 "Failure to replicate a stored
function with a cursor".
sql/sql_parse.cc:
Do not rewrite SELECTs with DOs on slave: if this SELECT was for a stored
routine cursor, slave must be able to execute the SELECT in order to
open a cursor.
At the moment the bug is present only in stored functions and stored
procedures called from stored functions, because, due to
stored procedure unfolding for replication, top level stored procedures
are never executed on slave.
into mysql.com:/home/alik/MySQL/devel/5.0-wl2818
mysql-test/r/mysqldump.result:
Auto merged
mysql-test/t/mysqldump.test:
Auto merged
sql/item_func.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/share/errmsg.txt:
Auto merged
sql/sp.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_trigger.cc:
Auto merged
mysql-test/r/rpl_sp.result:
Manual merge.
checks on trigger activation)
mysql-test/r/information_schema.result:
Update result file: a new column DEFINER has been added to
INFORMATION_SCHEMA.TRIGGERS.
mysql-test/r/mysqldump.result:
Update result file: a new column DEFINER has been added to
INFORMATION_SCHEMA.TRIGGERS.
mysql-test/r/rpl_ddl.result:
Update result file: a new column DEFINER has been added to
INFORMATION_SCHEMA.TRIGGERS.
mysql-test/r/rpl_sp.result:
Update result file: a new clause DEFINER has been added to
CREATE TRIGGER statement.
mysql-test/r/rpl_trigger.result:
Results for new test cases were added.
mysql-test/r/skip_grants.result:
Error message has been changed.
mysql-test/r/trigger.result:
Added DEFINER column.
mysql-test/r/view.result:
Error messages have been changed.
mysql-test/r/view_grant.result:
Error messages have been changed.
mysql-test/t/mysqldump.test:
Drop created procedure to not affect further tests.
mysql-test/t/rpl_trigger.test:
Add tests for new column in information schema.
mysql-test/t/skip_grants.test:
Error tag has been renamed.
mysql-test/t/view.test:
Error tag has been renamed.
mysql-test/t/view_grant.test:
Error tag has been changed.
sql/item_func.cc:
Fix typo in comments.
sql/mysql_priv.h:
A try to minimize copy&paste:
- introduce operations to be used from sql_yacc.yy;
- introduce an operation to be used from trigger and
view processing code.
sql/share/errmsg.txt:
- Rename ER_NO_VIEW_USER to ER_MALFORMED_DEFINER in order to
be shared for view and trigger implementations;
- Fix a typo;
- Add a new error code for trigger warning.
sql/sp.cc:
set_info() was split into set_info() and set_definer().
sql/sp_head.cc:
set_info() was split into set_info() and set_definer().
sql/sp_head.h:
set_info() was split into set_info() and set_definer().
sql/sql_acl.cc:
Add a new check: exit from the cycle if the table is NULL.
sql/sql_lex.h:
- Rename create_view_definer to definer, since it is used for views
and triggers;
- Change st_lex_user to LEX_USER, since st_lex_user is a structure.
So, formally, it should be "struct st_lex_user", which is longer
than just LEX_USER;
- Add trigger_definition_begin.
sql/sql_parse.cc:
- Add a new check: exit from the cycle if the table is NULL;
- Implement definer-related functions.
sql/sql_show.cc:
Add DEFINER column.
sql/sql_trigger.cc:
Add DEFINER support for triggers.
sql/sql_trigger.h:
Add DEFINER support for triggers.
sql/sql_view.cc:
Rename create_view_definer to definer.
sql/sql_yacc.yy:
Add support for DEFINER-clause in CREATE TRIGGER statement.
Since CREATE TRIGGER and CREATE VIEW can be similar at the start,
yacc is unable to distinguish between them. So, had to modify both
statements in order to make it parsable by yacc.
mysql-test/r/trigger-compat.result:
Result file for triggers backward compatibility test.
mysql-test/r/trigger-grant.result:
Result file of the test for WL#2818.
mysql-test/t/trigger-compat.test:
Triggers backward compatibility test: check that the server
still can load triggers w/o definer attribute and modify
tables with such triggers (add a new trigger, etc).
mysql-test/t/trigger-grant.test:
Test for WL#2818 -- check that DEFINER support in triggers
works properly
Indeed now that stored procedures CALL is not binlogged, but instead the invoked substatements are,
the restrictions applied by log-bin-trust-routine-creators=0 are superfluous for procedures.
They still need to apply to functions where function calls are written to the binlog (for example as "DO myfunc(3)").
We rename the variable to log-bin-trust-function-creators but allow the old name until some future version (and issue a warning if old name is used).
mysql-test/mysql-test-run.pl:
update to new option name
mysql-test/mysql-test-run.sh:
update to new option name
mysql-test/mysql_test_run_new.c:
update to new option name
mysql-test/r/rpl_sp.result:
result update
mysql-test/t/rpl_sp-slave.opt:
we need to skip this error to not hit BUG#14769
mysql-test/t/rpl_sp.test:
Test update:
1) as log-bin-trust-routine-creators now affects only functions, the testing of this option, which was
mainly done on procedures, is moved to functions
2) cleanup is simplified; and instead of many SHOW BINLOG EVENTS we do a big one in the end, which is more
maintainable.
3) we test a few more function and procedures cases to see how they replicate.
4) removing out-of-date comments
sql/item_func.cc:
This warning is wrong since binlogging of functions was changed in August. If a function fails
in the middle, it will be binlogged with its error code (i.e. properly).
sql/mysql_priv.h:
variable name changed
sql/mysqld.cc:
option name changes. A precision about --read-only.
sql/set_var.cc:
a new class sys_var_trust_routine_creators to be able to issue a "this is a deprecated variable" warning if used.
sql/set_var.h:
new class to be able to issue a "this is a deprecated variable" warning if used.
sql/share/errmsg.txt:
routine -> function
sql/sp.cc:
log-bin-trust-routine-creators now applies only to functions.
sql/sql_parse.cc:
1) sending ER_FAILED_ROUTINE_BREAK_BINLOG is wrong since August as we don't binlog CALL anymore but instead binlog the substatements;
the clear_error() goes away too as it was necessary only when we created a binlog event from the "CALL" statement.
2) log-bin-trust-routine-creators now applies only to functions.
sql/sql_trigger.cc:
comments.
can't be executed on slave". It will be possible to solve this problem
in more correct way when we will implement WL#2897 "Complete definer support
in the stored routines".
mysql-test/r/rpl_sp.result:
Added test for bug #13969 "Routines which are replicated from master can't be
executed on slave".
mysql-test/t/rpl_sp.test:
Added test for bug #13969 "Routines which are replicated from master can't be
executed on slave".
sql/sp_head.cc:
sp_change_security_context():
Currently the slave replication thread creates all stored routines with
definer ''@'', ignoring the actual definer. When the slave replication
thread executes these routines, it ignores the definer, and so the routines
work. However, in case of a failover, the replica operates in a normal mysqld
mode and changes security context to the definer when executing a routine.
A proper fix for this issue is described in WL#2897 "Complete definer support
in the stored routines". Until this WL is implemented, we need this temporary
fix, which ignores errors when changing security context.
"Interleaved SPs execution is now binlogged properly, "SELECT spfunc()" is binlogged too.
The known remaining issue is binlogging/replication of "a routine is deleted while it is executed" scenario.
mysql-test/r/rpl_sp.result:
Fix for BUG#12335: updated test cases/results
mysql-test/t/rpl_sp.test:
Fix for BUG#12335: updated test cases/results
sql/item.cc:
Fix for BUG#12335 (SP replication):
- Added Item_name_const 'function'
- Addede 'delete reuse' to call dtor on item reuse
sql/item.h:
Fix for BUG#12335 (SP replication) : Added Item_name_const 'function' + code cleanup
sql/item_create.cc:
Fix for BUG#12335 (SP replication) : Added Item_name_const 'function'
sql/item_create.h:
Fix for BUG#12335 (SP replication) : Added Item_name_const 'function'
sql/item_func.cc:
Fix for BUG#12335 (SP replication) : binary log is now constrolled from within execute_function.
sql/lex.h:
Fix for BUG#12335 (SP replication) : Added Item_name_const 'function'
sql/log.cc:
Fix for BUG#12335 (SP replication) : Added MYSQL_LOG::{start|stop}_union_events to allow
one to temporary disable binlogging but collect a 'union' information about binlog write
calls.
sql/mysql_priv.h:
Fix for BUG#12335 (SP replication)
sql/sp_head.cc:
Fix for BUG#12335 (SP replication) : Now we use different SP binlogging strategy, grep for
StoredRoutinesBinlogging for details
sql/sp_head.h:
Comments added
sql/sp_pcontext.h:
Comments added
sql/sp_rcontext.h:
Comments added
sql/sql_class.cc:
Fix for BUG#12335 (SP replication) : Now we use different SP binlogging strategy, grep for
StoredRoutinesBinlogging for details
sql/sql_class.h:
Fix for BUG#12335 (SP replication) : Added MYSQL_LOG::{start|stop}_union_events to allow
one to temporary disable binlogging but collect a 'union' information about binlog write
calls.
sql/sql_delete.cc:
Fix for BUG#12335: check THD::query_str_binlog_unsuitable when writing to binlog.
sql/sql_insert.cc:
Fix for BUG#12335: check THD::query_str_binlog_unsuitable when writing to binlog.
sql/sql_lex.cc:
Fix for BUG#12335 (SP replication): Add ability to extract previous returned token from
the tokenizer.
sql/sql_lex.h:
Fix for BUG#12335 (SP replication): Add ability to extract previous returned token from
the tokenizer.
sql/sql_parse.cc:
Fix for BUG#12335 (SP replication) : Now we use different SP binlogging strategy, grep for
StoredRoutinesBinlogging for details
sql/sql_update.cc:
Fix for BUG#12335: check THD::query_str_binlog_unsuitable when writing to binlog.
sql/sql_yacc.yy:
Fix for BUG#12335 (SP replication) : When creating Item_splocal, remember where it is located
in the query.
and Bug#12297 SP crashes the server if data inserted inside a lon loop
Third commit attempt. With fixes to the issues, showed up after full rebuild and
tests on other hosts.
mysql-test/r/rpl_sp.result:
New warnings appeared in result file, as now we always create spcont in a stored routine.
This is correct behaviour. We swallowed some warnings, as we used thd->spcont to check whether
we are in the SP though we didn't set spcont in certain cases. This is fixed now.
mysql-test/r/sp.result:
fixed result file to reflect new tests
mysql-test/t/sp.test:
Added tests for bugs. Though one of them is disabled, as it fails because of the other bug.
It should be enabled, when bug 12297 is fixed.
sql/sp_head.cc:
Per-instruction arena is implemented
sql/sp_rcontext.cc:
Now we should deal with callers_arena->free_list when we employ reuse mechanism with callers_arena
switched during sp_eval_func_item
sql/sp_rcontext.h:
Add new member to sp_rcontext class, in order to handle instructions with assignment
and/or with nested SP processing properly.
"Triggers have the wrong namespace"
"Triggers: duplicate names allowed"
"Triggers: CREATE TRIGGER does not accept fully qualified names"
"SHOW TRIGGERS"
mysql-test/r/information_schema.result:
Added tests for new INFORMATION_SCHEMA.TRIGGERS view and SHOW TRIGGERS command.
mysql-test/r/information_schema_db.result:
INFORMATION_SCHEMA.TRIGGERS view was added.
mysql-test/r/rpl_sp.result:
Now DROP TRIGGER interprets first part of trigger identifier as database
name and not as table name. Adjusted tests properly.
mysql-test/r/trigger.result:
Now DROP TRIGGER interprets first part of trigger identifier as database
name and not as table name. Adjusted tests properly.
Added test checking that triggers have database wide namespace.
Added test for bug #8791 "Triggers: Allowed to create triggers on a subject
table in a different DB".
mysql-test/r/view.result:
Now DROP TRIGGER interprets first part of trigger identifier as database
name and not as table name. Adjusted tests properly.
mysql-test/t/information_schema.test:
Added tests for new INFORMATION_SCHEMA.TRIGGERS view and SHOW TRIGGERS command.
mysql-test/t/rpl_sp.test:
Now DROP TRIGGER interprets first part of trigger identifier as database
name and not as table name. Adjusted tests properly.
mysql-test/t/trigger.test:
Now DROP TRIGGER interprets first part of trigger identifier as database
name and not as table name. Adjusted tests properly.
Added test checking that triggers have database wide namespace.
Added test for bug #8791 "Triggers: Allowed to create triggers on a subject
table in a different DB".
mysql-test/t/view.test:
Now DROP TRIGGER interprets first part of trigger identifier as database
name and not as table name. Adjusted tests properly.
sql/handler.cc:
Added .TRN tho the list of known file extensions assoicated with tables.
sql/item.h:
trg_action_time_type/trg_event_type enums:
Added TRG_ACTION_MAX/TRG_EVENT_MAX elements which should be used instead of
magical values in various loops where we iterate through all types of trigger
action times or/and trigger event types.
sql/lex.h:
Added new symbol "TRIGGERS".
sql/mysql_priv.h:
Added declaration of constant holding extension for trigger name (.TRN) files.
sql/mysqld.cc:
Added statistical variable for SHOW TRIGGERS command.
sql/share/errmsg.txt:
Added error message saying that one attempts to create trigger in wrong schema.
sql/sp.cc:
Replaced magical values with TRG_EVENT_MAX/TRG_ACTION_MAX constants.
sql/sql_base.cc:
open_unireg_entry():
Now Table_triggers_list::check_n_load() has one more argument which
controls whether we should prepare Table_triggers_list with fully functional
triggers or load only their names.
sql/sql_lex.h:
Added element for new SHOW TRIGGERS command to enum_sql_command enum.
sql/sql_parse.cc:
prepare_schema_table():
Added support for SHOW TRIGGERS statement.
sql/sql_show.cc:
Added new INFORMATION_SCHEMA.TRIGGERS view and SHOW TRIGGERS command.
sql/sql_table.cc:
mysql_rm_table_part2():
Replaced simple deletion of .TRG file with call to
Table_triggers_list::drop_all_triggers which will also delete .TRN files
for all triggers associated with table.
sql/sql_trigger.cc:
Now triggers have database wide namespace. To support it we create special .TRN
file with same name as trigger for each trigger. This file contains name of
trigger's table so one does not need to specify it explicitly in DROP TRIGGER.
Moreover DROP TRIGGER treats first part of trigger identifier as database name
now. Updated mysql_create_or_drop_trigger() routine and
Table_triggers_list::create_trigger()/drop_trigger()/check_n_load() methods
accordingly. Added add_table_for_trigger() routine and
Table_triggers_list::drop_all_triggers() method.
Added Table_triggers_list::get_trigger_info() for obtaining trigger metadata.
sql/sql_trigger.h:
Table_triggers_list:
Use TRG_EVENT_MAX, TRG_ACTION_MAX instead of magic values.
Added get_trigger_info() method for obtaining trigger's meta-data.
Added drop_all_triggers() method which drops all triggers for table.
Added declarations of trg_action_time_type_names/trg_event_type_names
arrays which hold names of triggers action time types and event types.
sql/sql_yacc.yy:
Changed grammar for CREATE/DROP TRIGGER to support database wide trigger
namespace. Added new SHOW TRIGGERS statement.
sql/table.h:
enum enum_schema_tables:
Added constant for new INFORMATION_SCHEMA.TRIGGERS view.
writing DROP and CREATE TRIGGER to binlog, disabling binlogging
of substatements, testing.
mysql-test/r/rpl_sp.result:
result update
mysql-test/t/rpl_sp.test:
removing useless lines, plus testing replication of triggers
sql/sql_trigger.cc:
trigger can be used to destroy slave, so only SUPER can create it by default.
If create|drop goes ok, binlog CREATE TRIGGER and DROP TRIGGER.
sql/sql_trigger.h:
disable binlogging of substatements of triggers (even if now triggers
can't do updates)
mysql-test/t/rpl_sp.test:
making test hostname-independent (don't know why the problem didn't appear on my machine)
mysql-test/r/rpl_sp.result:
result update
Approximative, because it's using our binlogging way (what we call "query"-level) and this is not as good as record-level binlog (5.1) would be. It imposes several
limitations to routines, and has caveats (which I'll document, and for which the server will try to issue errors but that is not always possible).
Reason I don't propagate caller info to the binlog as planned is that on master and slave
users may be different; even with that some caveats would remain.
mysql-test/mysql-test-run.sh:
In the testsuite we know what we do, we are not creating nasty routines, and breaking binlog is ok except in rpl_sp.
mysql-test/r/blackhole.result:
Updating results now that 4.1 has been merged
mysql-test/valgrind.supp:
Some suppressions for Valgrind (useful on my machine Suse 9.1);
this is just adding to the already existing suppressions of pthread and dl.
sql/item_func.cc:
Don't binlog the substatements when executing a function. If the function
is declared to modify data and does not complete, warning "broken binlog".
Note that SELECT myfunc() will not be binlogged even if myfunc() updates data (will be documented);
but INSERT INTO t VALUES(myfunc()) will be binlogged (what decides is if the caller
gets binlogged; the function changes nothing to binlogging).
sql/log_event.cc:
Just making functions which can be re-used when we binlog more strings
in status_vars in Query_log_event (e.g. one day "user", "host").
sql/log_event.h:
comment
sql/mysql_priv.h:
--log-bin-trust-routine-creators
sql/mysqld.cc:
--log-bin-trust-routine-creators
sql/set_var.cc:
--log-bin-trust-routine-creators
sql/share/errmsg.txt:
error messages to warn about problems with routines and binlog
sql/slave.cc:
If in a routine, replication table inclusion/exclusion rules always answer "replicate!" (see comment in code).
sql/sp.cc:
If binlog is on: errors if one wants to create a non-deterministic update routine
(repeatability problem - note that the test is not perfect for functions) or does not have SUPER (because routines can easily
be made to destroy slave's data with just CREATE ROUTINE and EXECUTE priv on master).
--log-bin-trust-routine-creators removes these errors.
Binlogging of CREATE PROCEDURE|FUNCTION.
sql/sql_acl.cc:
No thd==0 in tables_ok().
sql/sql_parse.cc:
Binlogging of CALL (and not of the substatements of the SP).
If SP returns error, we don't binlog it (see comment); we push warning in this case.
Binlogging of ALTER|DROP PROCEDURE|FUNCTION with safety messages.