The problem is that the server could crash when attempting
to access a non-conformant proc system table. One such case
was a crash when invoking stored procedure related statements
on a 5.1 server with a proc system table in the 5.0 format.
The solution is to validate the proc system table format
before attempts to access it are made. If the table is not
in the format that the server expects, a message is written
to the error log and the statement that caused the table to
be accessed fails.
mysql-test/r/sp-destruct.result:
Add test case result for Bug#41726
mysql-test/t/sp-destruct.test:
Add test case for Bug#41726
sql/event_db_repository.cc:
Update code to use new structures.
sql/sp.cc:
Describe the proc table format and use it to validate when
opening a instance of the table.
Add a check to insure that a error message is written to
the error log only once.
sql/sql_acl.cc:
Remove unused variable and use new structure.
sql/sql_acl.h:
Export field definition.
sql/table.cc:
Accept the field count and definition in a single structure.
sql/table.h:
Combine the field count and definition in a single structure.
Transform function into a class in order to support different
ways of reporting a error.
Add a pointer cache to TABLE_SHARE.
Not all my_hash_insert() calls are checked for return value.
This patch adds appropriate checks and failure responses
where needed.
mysys/hash.c:
* Debug hook for testing failures in my_hash_insert()
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 the log_bin_trust_function_creators option is not defined, creating a stored
function requires either one of the modifiers DETERMINISTIC, NO SQL, or READS
SQL DATA. Executing a stored function should also follows the same rules if in
STATEMENT mode. However, this was not happening and a wrong error was being
printed out: ER_BINLOG_ROW_RBR_TO_SBR.
The patch makes the creation and execution compatible and prints out the correct
error ER_BINLOG_UNSAFE_ROUTINE when a stored function without one of the modifiers
above is executed in STATEMENT mode.
Make the caller of Query_log_event, Execute_load_log_event
constructors and THD::binlog_query to provide the error code
instead of having the constructors to figure out the error code.
sql/log_event.cc:
Changed constructors of Query_log_event and Execute_load_log_event to accept the error code argument instead of figuring it out by itself
sql/log_event.h:
Changed constructors of Query_log_event and Execute_load_log_event to accept the error code argument
MySQL crashes if a user without proper privileges attempts to create a procedure.
The crash happens because more than one error state is pushed onto the Diagnostic
area. In this particular case the user is denied to implicitly create a new user
account with the implicitly granted privileges ALTER- and EXECUTE ROUTINE.
The new account is needed if the original user account contained a host mask.
A user account with a host mask is a distinct user account in this context.
An alternative would be to first get the most permissive user account which
include the current user connection and then assign privileges to that
account. This behavior change is considered out of scope for this bug patch.
The implicit assignment of privileges when a user creates a stored routine is a
considered to be a feature for user convenience and as such it is not
a critical operation. Any failure to complete this operation is thus considered
non-fatal (an error becomes a warning).
The patch back ports a stack implementation of the internal error handler interface.
This enables the use of multiple error handlers so that it is possible to intercept
and cancel errors thrown by lower layers. This is needed as a error handler already
is used in the call stack emitting the errors which needs to be converted.
mysql-test/r/grant.result:
* Added test case for bug44658
mysql-test/t/grant.test:
* Added test case for bug44658
sql/sp.cc:
* Removed non functional parameter no_error and my_error calls as all errors
from this function will be converted to a warning anyway.
* Change function return type from int to bool.
sql/sp.h:
* Removed non functional parameter no_error and my_error calls as all errors
from this function will be converted to a warning anyway.
* Changed function return value from int to bool
sql/sql_acl.cc:
* Removed the non functional no_error parameter from the function prototype.
The function is called from two places and in one of the places we now
ignore errors through error handlers.
* Introduced the parameter write_to_binlog
* Introduced an error handler to cancel any error state from mysql_routine_grant.
* Moved my_ok() signal from mysql_routine_grant to make it easier to avoid
setting the wrong state in the Diagnostic area.
* Changed the broken error state in sp_grant_privileges() to a warning
so that if "CREATE PROCEDURE" fails because "Password hash isn't a hexidecimal
number" it is still clear what happened.
sql/sql_acl.h:
* Removed the non functional no_error parameter from the function prototype.
The function is called from two places and in one of the places we now
ignore errors through error handlers.
* Introduced the parameter write_to_binlog
* Changed return type for sp_grant_privileges() from int to bool
sql/sql_class.cc:
* Back ported implementation of internal error handler from 6.0 branch
sql/sql_class.h:
* Back ported implementation of internal error handler from 6.0 branch
sql/sql_parse.cc:
* Moved my_ok() signal from mysql_routine_grant() to make it easier to avoid
setting the wrong state in the Diagnostic area.
When the thread executing a DDL was killed after finished its
execution but before writing the binlog event, the error code in
the binlog event could be set wrongly to ER_SERVER_SHUTDOWN or
ER_QUERY_INTERRUPTED.
This patch fixed the problem by ignoring the kill status when
constructing the event for DDL statements.
This patch also included the following changes in order to
provide the test case.
1) modified mysqltest to support variable for connection command
2) modified mysql-test-run.pl, add new variable MYSQL_SLAVE to
run mysql client against the slave mysqld.
Set wrong sql_mode when creating a procedure.
So that the sql_mode can't be writen into binary log correctly.
Restore the current session sql_mode right before generating the binlog event
when creating a procedure.
mysql-test/suite/binlog/r/binlog_sql_mode.result:
Test result
mysql-test/suite/binlog/t/binlog_sql_mode.test:
Test file for sql_mode testing
sql/sp.cc:
Restore the current session sql_mode right before generating the binlog event.
- 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
build)
The crash was caused by freeing the internal parser stack during the parser
execution.
This occured only for complex stored procedures, after reallocating the parser
stack using my_yyoverflow(), with the following C call stack:
- MYSQLparse()
- any rule calling sp_head::restore_lex()
- lex_end()
- x_free(lex->yacc_yyss), xfree(lex->yacc_yyvs)
The root cause is the implementation of stored procedures, which breaks the
assumption from 4.1 that there is only one LEX structure per parser call.
The solution is to separate the LEX structure into:
- attributes that represent a statement (the current LEX structure),
- attributes that relate to the syntax parser itself (Yacc_state),
so that parsing multiple statements in stored programs can create multiple
LEX structures while not changing the unique Yacc_state.
Now, Yacc_state and the existing Lex_input_stream are aggregated into
Parser_state, a structure that represent the complete state of the (Lexical +
Syntax) parser.
mysql-test/r/parser_stack.result:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
mysql-test/t/parser_stack.test:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sp.cc:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sp_head.cc:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sql_class.cc:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sql_class.h:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sql_lex.cc:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sql_lex.h:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sql_parse.cc:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sql_prepare.cc:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sql_trigger.cc:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sql_view.cc:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
sql/sql_yacc.yy:
Bug#35577 (CREATE PROCEDURE causes either crash or syntax error depending on
build)
into bodhi.(none):/opt/local/work/mysql-5.1-27430
Makefile.am:
Auto merged
include/my_global.h:
Auto merged
mysql-test/include/mix1.inc:
Auto merged
sql/item.cc:
Auto merged
sql/my_decimal.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/set_var.h:
Auto merged
sql/sp.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_update.cc:
Auto merged
sql/share/errmsg.txt:
Auto merged
sql/sql_yacc.yy:
Auto merged
libmysqld/CMakeLists.txt:
Manual merge.
libmysqld/lib_sql.cc:
Manual merge.
mysql-test/t/disabled.def:
Manual merge.
into zippy.cornsilk.net:/home/cmiller/work/mysql/bug36570/my51-bug36570
BitKeeper/deleted/.del-binlog_innodb.result:
Auto merged
sql/sp_head.cc:
Auto merged
mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result:
need to re-record.
mysql-test/suite/rpl/r/rpl_sp.result:
need to re-record.
mysql-test/r/mysqlbinlog.result:
manual merge.
mysql-test/suite/rpl/t/rpl_sp.test:
manual merge.
sql/sp.cc:
manual merge.
sql/sp_head.h:
manual merge.
slave
The stored-routine code took the contents of the (lowest) parser
and copied it directly to the binlog, which causes problems if there
is a special case of interpretation at the parser level -- which
there is, in the "/*!VER */" comments. The trailing "*/" caused
errors on the slave, naturally.
Now, since by that point we have /properly/ created parse-tree (as
the rest of the server should do!) for the stored-routine CREATE, we
can construct a perfect statement from that information, instead of
writing uncertain information from an unknown parser state.
Fortunately, there's already a function nearby that does exactly
that.
---
Update for Bug#36570. Qualify routine names with db name when
writing to the binlog ONLY if the source text is qualified.
mysql-test/r/binlog_innodb.result:
Offsets changed due to quoting.
---
New offset to account for db-qualified names.
mysql-test/r/ctype_cp932_binlog.result:
Offsets changed due to quoting.
---
Qualify routine names with DB. Offsets change also.
mysql-test/r/mysqlbinlog.result:
Case changed in result due to interpretation of data instead of
literal recitation.
---
Qualify procedure name with db.
mysql-test/r/rpl_sp.result:
Offsets changed due to quoting. Added tests.
---
Qualify routine names with DB if qualified in query. Offsets change also.
mysql-test/t/rpl_sp.test:
Add version-limiting quotes to exercise bug#36570. Test that
backtick-quoted identifiers and labels work also.
---
Use different db to show qualification works. Qualify routine names
with DB if qualified in query.
sql/sp.cc:
In create_string, we may not have a sp_name parameter yet, so
instead pass the char* and length of the only member we'd get out
of it.
Having done that, we can use the same function to write the
CREATE (FUNC|TRIG|PROC) statement to the binlog as we always used
to display the statement to the user.
---
Make the db name part of the CREATE string if it is specified.
Specify it in part of writing to the binlog when creating a new
routine.
sql/sp_head.cc:
Set the sp_head m_explicit_name member as the sp_name member is set.
We can not peek at this later, as the sp_name is gone by then.
sql/sp_head.h:
Add a member to track whether the name is qualified with the
database.
into zippy.cornsilk.net:/home/cmiller/work/mysql/bug36570/my51-bug36570
BitKeeper/deleted/.del-binlog_innodb.result:
Auto merged
mysql-test/r/mysqlbinlog.result:
need to record.
mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result:
need to record.
mysql-test/suite/rpl/r/rpl_sp.result:
need to record.
mysql-test/suite/rpl/t/rpl_sp.test:
manual merge.
sql/sp.cc:
Manual merge
slave
The stored-routine code took the contents of the (lowest) parser
and copied it directly to the binlog, which causes problems if there
is a special case of interpretation at the parser level -- which
there is, in the "/*!VER */" comments. The trailing "*/" caused
errors on the slave, naturally.
Now, since by that point we have /properly/ created parse-tree (as
the rest of the server should do!) for the stored-routine CREATE, we
can construct a perfect statement from that information, instead of
writing uncertain information from an unknown parser state.
Fortunately, there's already a function nearby that does exactly
that.
mysql-test/r/binlog_innodb.result:
Offsets changed due to quoting.
mysql-test/r/ctype_cp932_binlog.result:
Offsets changed due to quoting.
mysql-test/r/mysqlbinlog.result:
Case changed in result due to interpretation of data instead of
literal recitation.
mysql-test/r/rpl_sp.result:
Offsets changed due to quoting. Added tests.
mysql-test/t/rpl_sp.test:
Add version-limiting quotes to exercise bug#36570. Test that
backtick-quoted identifiers and labels work also.
sql/sp.cc:
In create_string, we may not have a sp_name parameter yet, so
instead pass the char* and length of the only member we'd get out
of it.
Having done that, we can use the same function to write the
CREATE (FUNC|TRIG|PROC) statement to the binlog as we always used
to display the statement to the user.
into kaamos.(none):/data/src/opt/mysql-5.1-opt
client/mysql.cc:
Auto merged
client/mysqldump.c:
Auto merged
configure.in:
Auto merged
include/my_global.h:
Auto merged
libmysql/libmysql.c:
Auto merged
libmysqld/lib_sql.cc:
Auto merged
mysql-test/include/mix1.inc:
Auto merged
mysql-test/r/create.result:
Auto merged
mysql-test/r/func_str.result:
Auto merged
mysql-test/r/innodb.result:
Auto merged
mysql-test/r/innodb_mysql.result:
Auto merged
mysql-test/r/select.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/t/create.test:
Auto merged
mysql-test/t/disabled.def:
Auto merged
sql/filesort.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/item_sum.cc:
Auto merged
sql/log.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_plugin.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
storage/ndb/src/kernel/blocks/backup/Backup.hpp:
Auto merged
tests/mysql_client_test.c:
Auto merged
mysql-test/r/func_time.result:
Manual merge.
mysql-test/r/view.result:
Manual merge.
mysql-test/t/view.test:
Manual merge.
scripts/mysql_config.sh:
Manual merge.
sql-common/client.c:
Manual merge.
sql/sql_parse.cc:
Manual merge.
into magare.gmz:/home/kgeorge/mysql/work/B30604-5.1-opt
BitKeeper/deleted/.del-binlog_innodb.result:
Auto merged
BitKeeper/deleted/.del-binlog_innodb.test:
Auto merged
mysql-test/suite/binlog/r/binlog_stm_ctype_ucs.result:
merged bug 30604 to 5.1-opt
sql/sp.cc:
merged bug 30604 to 5.1-opt
and ps-protocol
Finding a routine should be a transparent operation as
far as the binary log is concerned.
But it was influencing the binary log because of the TIMESTAMP
column in the proc table.
Fixed by preserving and restoring the time_zone usage flag when
searching for a stored routine in the proc table.
mysql-test/r/binlog_innodb.result:
Bug #30604: test case
mysql-test/r/ctype_cp932_binlog.result:
Bug #30604: updated test results (a procedure call before that)
mysql-test/t/binlog_innodb.test:
Bug #30604: test case
sql/sp.cc:
Bug #30604: finding a routine should be a transparent operation as
far as the binary log is concerned.
Fixed by preserving and restoring the time_zone usage flag.
into dipika.(none):/opt/local/work/mysql-5.1-2pc-opt-merge-push
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
Auto merged
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
Auto merged
sql/ha_ndbcluster_binlog.cc:
Auto merged
sql/log.cc:
Auto merged
sql/log_event.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_table.cc:
Auto merged
mysql-test/suite/rpl_ndb/t/disabled.def:
Manual merge.
a SELECT doesn't cause ROLLBACK of statem".
The idea of the fix is to ensure that we always commit the current
statement at the end of dispatch_command(). In order to not issue
redundant disc syncs, an optimization of the two-phase commit
protocol is implemented to bypass the two phase commit if
the transaction is read-only.
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
Update test results.
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
Update test results.
mysql-test/suite/rpl_ndb/t/disabled.def:
Disable the tests, for which this changeset reveals a bug:
the injector thread does not always add 'statement commit' to the
rows injected in circular replication set up.
To be investigated separately.
sql/ha_ndbcluster_binlog.cc:
Add close_thread_tables() to run_query: this ensures
that all tables are closed and there is no pending statement transaction.
sql/handler.cc:
Implement optimisation of read-only transactions.
If a transaction consists only of DML statements that do not change
data, we do not perform a two-phase commit for it
(run one phase commit only).
sql/handler.h:
Implement optimisation of read-only transactions.
If a transaction consists only of DML statements that do not change
data, we do not perform a two-phase commit for it
(run one phase commit only).
sql/log.cc:
Mark the binlog transaction read-write whenever it's started.
We never read from binlog, so it's safe and least intrusive to add
this mark up here.
sql/log_event.cc:
Update to the new layout of thd->transaction.
sql/rpl_injector.cc:
Always commit statement transaction before committing the global one.
sql/sp.cc:
Ad comments.
sql/sp_head.cc:
Add comments.
sql/sql_base.cc:
Commit transaction at the end of the statement. Always.
sql/sql_class.cc:
Update thd_ha_data to return the right pointer in the new layout.
Fix select_dumpvar::send_data to properly return operation status.
A test case from commit.inc would lead to an assertion failure in the
diagnostics area (double assignment). Not test otherwise by the test suite.
sql/sql_class.h:
Implement a new layout of storage engine transaction info in which
it is easy to access all members related to the handlerton only
based on ht->slot.
sql/sql_cursor.cc:
Update to the new layout of thd->transaction.
sql/sql_delete.cc:
Remove wrong and now redundant calls to ha_autocommit_or_rollback.
The transaction is committed in one place, at the end of the statement.
Remove calls to mysql_unlock_tables, since some engines count locks
and commit statement transaction in unlock_tables(), which essentially
equates mysql_unlock_tables to ha_autocommit_or_rollback.
Previously it was necessary to unlock tables soon because we wanted
to avoid sending of 'ok' packet to the client under locked tables.
This is no longer necessary, since OK packet is also sent from one place
at the end of transaction.
sql/sql_do.cc:
Add DO always clears the error, we must rollback the current
statement before this happens. Otherwise the statement will be committed,
and not rolled back in the end.
sql/sql_insert.cc:
Remove wrong and now redundant calls to ha_autocommit_or_rollback.
The transaction is committed in one place, at the end of the statement.
Remove calls to mysql_unlock_tables, since some engines count locks
and commit statement transaction in unlock_tables(), which essentially
equates mysql_unlock_tables to ha_autocommit_or_rollback.
Previously it was necessary to unlock tables soon because we wanted
to avoid sending of 'ok' packet to the client under locked tables.
This is no longer necessary, since OK packet is also sent from one place
at the end of transaction.
sql/sql_load.cc:
Remove wrong and now redundant calls to ha_autocommit_or_rollback.
The transaction is committed in one place, at the end of the statement.
Remove calls to mysql_unlock_tables, since some engines count locks
and commit statement transaction in unlock_tables(), which essentially
equates mysql_unlock_tables to ha_autocommit_or_rollback.
Previously it was necessary to unlock tables soon because we wanted
to avoid sending of 'ok' packet to the client under locked tables.
This is no longer necessary, since OK packet is also sent from one place
at the end of transaction.
sql/sql_parse.cc:
Implement optimisation of read-only transactions: bypass 2-phase
commit for them.
Always commit statement transaction before commiting the global one.
Fix an unrelated crash in check_table_access, when called from
information_schema.
sql/sql_partition.cc:
Partitions commit at the end of a DDL operation.
Make sure that send_ok() is done only if the commit has succeeded.
sql/sql_table.cc:
Use ha_autocommit_or_rollback and end_active_trans everywhere.
Add end_trans to mysql_admin_table, so that it leaves no pending
transaction.
sql/sql_udf.cc:
Remvove a redundant call to close_thread_tables()
sql/sql_update.cc:
Remove wrong and now redundant calls to ha_autocommit_or_rollback.
The transaction is committed in one place, at the end of the statement.
Remove calls to mysql_unlock_tables, since some engines count locks
and commit statement transaction in unlock_tables(), which essentially
equates mysql_unlock_tables to ha_autocommit_or_rollback.
Previously it was necessary to unlock tables soon because we wanted
to avoid sending of 'ok' packet to the client under locked tables.
This is no longer necessary, since OK packet is also sent from one place
at the end of transaction.
mysql-test/include/commit.inc:
New BitKeeper file ``mysql-test/include/commit.inc''
mysql-test/r/commit_1innodb.result:
New BitKeeper file ``mysql-test/r/commit_1innodb.result''
mysql-test/t/commit_1innodb.test:
New BitKeeper file ``mysql-test/t/commit_1innodb.test''
The problem is that one can not create a stored routine if sql_mode
contains NO_ENGINE_SUBSTITUTION or PAD_CHAR_TO_FULL_LENGTH. Also when
a event is created, the mode is silently lost if sql_mode contains one
of the aforementioned. This was happening because the table definitions
which stored sql_mode values weren't being updated to accept new values
of sql_mode.
The solution is to update, in a backwards compatible manner, the various
table definitions (columns) that store the sql_mode value to take into
account the new possible values. One incompatible change is that if a event
that is being created can't be stored to the mysql.event table, an error
will be raised.
The tests case also ensure that new SQL modes will be added to the mysql.proc
and mysql.event tables, otherwise the tests will fail.
mysql-test/r/events_bugs.result:
Add test case result for Bug#32633
mysql-test/r/information_schema.result:
Update the sql_mode column definition.
mysql-test/r/sp.result:
Add test case result for Bug#32633
mysql-test/r/system_mysql_db.result:
Update the sql_mode column definition.
mysql-test/t/events_bugs.test:
Add test case for Bug#32633
mysql-test/t/sp.test:
Add test case for Bug#32633
mysql-test/t/system_mysql_db_fix50117.test:
Update the sql_mode column definition.
scripts/mysql_system_tables.sql:
Update the sql_mode column definition.
scripts/mysql_system_tables_fix.sql:
Update the sql_mode column definition.
sql/event_db_repository.cc:
Reset and restore SQL modes when storing and loading a
event from the data dictionary. Also throw out a error
if a store fails.
sql/mysqld.cc:
Add warning to avoid this problem in the future.
sql-common/my_user.c:
Truncate length if user name or host name does not fit
in the buffer.
sql/sp.cc:
SQL mode of the thread must not effect data dictionary operations.
The problem is that deprecated syntax warnings were not being
suppressed when the stored routine is being parsed for the first
execution. It's doesn't make sense to print out deprecated
syntax warnings when the routine is being executed because this
kind of warning only matters when the routine is being created.
The solution is to suppress deprecated syntax warnings when
parsing the stored routine for loading into the cache (might
mean that the routine is being executed for the first time).
mysql-test/r/sp-error.result:
Add test case result for Bug#21801
mysql-test/t/sp-error.test:
Add test case for Bug#21801
sql/sp.cc:
Implement a internal error handler to catch deprecated
syntax warnings when loading a stored procedure into the
cache.
into mysql.com:/misc/mysql/31752_/50-31752_
client/mysql.cc:
Auto merged
sql/log.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/unireg.cc:
Auto merged
into zippy.cornsilk.net:/home/cmiller/work/mysql/mysql-5.1-maint
sql/field.cc:
Auto merged
sql/filesort.cc:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_create.cc:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_geofunc.cc:
Auto merged
sql/item_strfunc.cc:
Auto merged
sql/item_subselect.cc:
Auto merged
sql/item_sum.cc:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/log.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/mysqld.cc:
Auto merged
sql/net_serv.cc:
Auto merged
sql/opt_sum.cc:
Auto merged
sql/protocol.h:
Auto merged
sql/records.cc:
Auto merged
sql/set_var.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/sp_head.h:
Auto merged
sql/sql_cache.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_prepare.cc:
Auto merged
sql/sql_select.h:
Auto merged
sql/sql_trigger.cc:
Auto merged
sql/sql_update.cc:
Auto merged
sql/sql_view.cc:
Auto merged
sql/structs.h:
Auto merged
sql/unireg.h:
Auto merged
sql/item.cc:
manual merge
sql/log_event.cc:
manual merge
sql/protocol.cc:
manual merge
sql/sp_head.cc:
manual merge
sql/sql_base.cc:
manual merge
sql/sql_parse.cc:
manual merge
sql/sql_select.cc:
manual merge
strmake() called with wrong parameters:
5.0-specific fixes.
client/mysql.cc:
In debug-mode, strmake() fills unused part of buffer with
a test-pattern. This overwrites our previous extra '\0'
(from previous bzero()).
sql/sp.cc:
off-by-one buffer-size.
The problem was that the RETURNS column in the mysql.proc was of
CHAR(64). That was not enough for storing long-named datatypes.
The fix is to change CHAR(64) to LONGBLOB, and to throw warnings
at the time a stored routine is created if some data is truncated
during writing into mysql.proc.
mysql-test/r/sp.result:
Update test result.
mysql-test/t/sp.test:
Add a test case for BUG#24923.
scripts/mysql_system_tables.sql:
Change the data type of column 'returns' from char(64) to longblob.
scripts/mysql_system_tables_fix.sql:
Change the data type of column 'returns' from char(64) to longblob.
sql/sp.cc:
Produce warnings if any data was truncated during writing
into mysql.proc.
sql/sp.h:
Add new error code.
sql/share/errmsg.txt:
Add new error message.
sql/sql_parse.cc:
Hande
into lambda.hsd1.co.comcast.net.:/home/malff/TREE/mysql-5.1-rt-merge
mysql-test/t/sp-error.test:
Auto merged
mysql-test/t/udf.test:
Auto merged
sql/item.cc:
Auto merged
sql/sp.cc:
Auto merged
sql/sp_head.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_udf.cc:
Auto merged
mysql-test/r/sp-error.result:
failed auto merge
mysql-test/r/sp.result:
failed auto merge
mysql-test/r/udf.result:
failed auto merge
mysql-test/t/sp.test:
failed auto merge
sql/sp_head.cc:
failed auto merge
sql/sql_yacc.yy:
failed auto merge
Bug#29816 Syntactically wrong query fails with misleading error message
The core problem is that an SQL-invoked function name can be a <schema
qualified routine name> that contains no <schema name>, but the mysql
parser insists that all stored procedures (function, procedures and
triggers) must have a <schema name>, which is not true for functions.
This problem is especially visible when trying to create a function
or when a query contains a syntax error after a function call (in the
same query), both will fail with a "No database selected" message if
the session is not attached to a particular schema, but the first
one should succeed and the second fail with a "syntax error" message.
Part of the fix is to revamp the sp name handling so that a schema
name may be omitted for functions -- this means that the internal
function name representation may not have a dot, which represents
that the function doesn't have a schema name. The other part is
to place schema checks after the type (function, trigger or procedure)
of the routine is known.
mysql-test/r/sp-error.result:
Add test case result for Bug#29816
mysql-test/r/udf.result:
Add test case result for Bug#28318
mysql-test/t/sp-error.test:
Add test case for Bug#29816
mysql-test/t/udf.test:
Add test case for Bug#28318
sql/sp.cc:
Copy the (last) nul byte of the stored routine key and move name parsing
code to the sp_name class constructor.
sql/sp_head.cc:
Revamp routine name parsing for when no schema is specified and
omit dot from the qualified name if the routine is not associated
with a scheme name.
sql/sp_head.h:
Name parsing got bigger, uninline by moving to a single unit -- the sp_head.cc
file.
sql/sql_yacc.yy:
Only copy the schema name if one is actually set and check for schema
name presence only where it's necessary.
into ibm.opbmk:/home/alik/Documents/MySQL/devel/5.1-rt-bug25843
sql/mysql_priv.h:
Auto merged
sql/sp.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_db.cc:
Auto merged
of statement breaks binlog.
There were two problems discovered by this bug:
1. Default (current) database is not fixed at the creation time.
That leads to wrong output of DATABASE() function.
2. Database attributes (@@collation_database) are not fixed at
the creation time. That leads to wrong resultset.
Binlog breakage and Query Cache wrong output happened because of
the first problem.
The fix is to remember the current database at the PREPARE-time and
set it each time at EXECUTE.
mysql-test/include/query_cache_sql_prepare.inc:
The first part of the test case for BUG#25843.
mysql-test/r/query_cache_ps_no_prot.result:
Update result file.
mysql-test/r/query_cache_ps_ps_prot.result:
Update result file.
mysql-test/suite/rpl/r/rpl_ps.result:
Update result file.
mysql-test/suite/rpl/t/rpl_ps.test:
The second part of the test case for BUG#25843.
sql/mysql_priv.h:
Added mysql_opt_change_db() prototype.
sql/sp.cc:
1. Polishing;
2. sp_use_new_db() has been removed;
3. Use mysql_opt_change_db() instead of sp_use_new_db().
sql/sp.h:
sp_use_new_db() has been removed.
This function has nothing to do with a) sp and b) *new* database.
It was merely "switch the current database if needed".
sql/sp_head.cc:
1. Polishing.
2. Use mysql_opt_change_db() instead of sp_use_new_db().
sql/sql_class.cc:
Move THD::{db, db_length} into Statement.
sql/sql_class.h:
Move THD::{db, db_length} into Statement.
sql/sql_db.cc:
Introduce mysql_opt_change_db() as a replacement (and inspired by)
sp_use_new_db().
sql/sql_prepare.cc:
1. Remember the current database in Prepared_statement::prepare().
2. Switch/restore the current database in Prepared_statement::execute().
into weblab.(none):/home/marcsql/TREE/mysql-5.1-rt50-merge
client/mysql.cc:
Auto merged
mysql-test/r/query_cache.result:
Auto merged
mysql-test/t/query_cache.test:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/sp.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_db.cc:
Auto merged
sql/sql_handler.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_yacc.yy:
Auto merged
PREPARE and EXECUTE of statement breaks binlog.
sql/sp.cc:
- Polishing sp_use_new_db():
- renamed no_access_check to force_switch to be more adequate;
- fixed comment;
sql/sql_class.h:
Polishing: fixed comment.
sql/sql_db.cc:
1. Use mysql_change_db_impl() to reset current database instead of
THD::set_db() in mysql_rm_db(). THD::set_db() does not take care of
THD::db_access and database attributes (@@collation_database).
2. Polishing: add, fix comments.
into hynda.mysql.fi:/home/my/mysql-5.1-marvel
client/mysqldump.c:
Auto merged
sql/event_db_repository.cc:
Auto merged
sql/event_queue.cc:
Auto merged
sql/field.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item_subselect.cc:
Auto merged
sql/log_event.h:
Auto merged
sql/sp.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_db.cc:
Auto merged
sql/sql_handler.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_plugin.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/table.h:
Auto merged
sql/sql_yacc.yy:
Manual merge with 5.1 main tree.
Faster thr_alarm()
Added 'Opened_files' status variable to track calls to my_open()
Don't give warnings when running mysql_install_db
Added option --source-install to mysql_install_db
I had to do the following renames() as used polymorphism didn't work with Forte compiler on 64 bit systems
index_read() -> index_read_map()
index_read_idx() -> index_read_idx_map()
index_read_last() -> index_read_last_map()
BUILD/compile-solaris-sparc-forte:
Updated script to current Solaris installations
Now we compile by default for 64 bits
client/mysql.cc:
Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
client/mysql_upgrade.c:
Fixed compiler warning (on Forte)
client/mysqladmin.cc:
Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
client/mysqlcheck.c:
Fixed compiler warning (on Forte)
client/mysqldump.c:
Fixed compiler warning (on Forte)
client/mysqlslap.c:
Fixed compiler warning (on Forte)
client/mysqltest.c:
Fixed compiler warning (on Forte)
client/sql_string.cc:
Avoid compiler warnings when using C function pointers in C++
configure.in:
Added detection of mtmalloc and ieeefp.h
extra/replace.c:
Fixed compiler warning (on Forte)
include/m_ctype.h:
Added some typedef's to make it easy to use C function pointers in C++
include/my_sys.h:
Added my_file_total_opened (counter for calls to my_open())
include/myisam.h:
Fixed compiler warning (on Forte)
libmysql/libmysql.c:
Fixed compiler warning (on Forte) by adding casts and change types
libmysql/manager.c:
Fixed compiler warning (on Forte) by adding casts and change types
mysql-test/r/ctype_cp932_binlog_stm.result:
Updated positions
(Needed because we didn't before correctly restore collation_database after running stored procedure
mysys/my_fopen.c:
Count number of opened files
mysys/my_open.c:
Count number of opened files
mysys/my_static.c:
Count number of opened files
mysys/thr_alarm.c:
Optimization to do less alarm() and pthread_sigmask() calls.
Idea is to remember time for next pending alarm and not reschedule a new alarm if it's after the current one.
Before we only did this if there was other pending alarms.
We don't have to use pthread_sigmask() in case of 'USE_ONE_SIGNAL_HAND' as the alarm()
signal will be blocked for the calling thread anyway and no other thread will have the alarm() signal enabled to call process_alarm()
regex/regcomp.c:
Fixed compiler warning (on Forte) by adding casts and change types
scripts/mysql_install_db.sh:
Added option --source-install to allow one to create a mysql database from the source tree without installing MySQL
Don't give (unnecessary) warnings
server-tools/instance-manager/angel.cc:
Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
server-tools/instance-manager/thread_registry.cc:
Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
sql/event_db_repository.cc:
index_read() -> index_read_map()
sql/event_queue.cc:
Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
sql/field.cc:
Fixed compiler warnings about hidden fields
sql/ha_partition.cc:
Fixed compiler warnings about hidden fields
index_read() -> index_read_map()
sql/ha_partition.h:
index_read() -> index_read_map()
sql/handler.cc:
Added PAGE option to row types (to prepare for future)
index_read() -> index_read_map()
sql/handler.h:
Added ROW_TYPE_PAGE (for future)
Added flag to signal if table was to be created transactionally
I had to do the following renames() as used polymorphism didn't work with Forte compiler on 64 bit systems
index_read() -> index_read_map()
index_read_idx() -> index_read_idx_map()
index_read_last() -> index_read_last_map()
sql/item.cc:
Fixed indentation
Renamed local variable to avoid hiding class variable
sql/item_cmpfunc.cc:
Renamed local variable to avoid hiding class variable
sql/item_cmpfunc.h:
Removed not used variable
sql/item_func.cc:
Renamed local variable to avoid hiding class variable
sql/item_strfunc.cc:
Moved functions from Item_strfunc.cc
sql/item_strfunc.h:
Move functions to item_strfunc.cc
Use C function pointer type to avoid compiler warnings (with Forte)
sql/item_subselect.cc:
index_read() -> index_read_map()
sql/item_xmlfunc.cc:
Renamed local variable to avoid hiding class variable
Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
sql/key.cc:
Fixed indentation
sql/log.cc:
Renamed local variable to avoid hiding class variable
sql/log_event.cc:
Removed call to my_time() when creating class instance of Log_event() as this may have static instances.
(One can't call my_time() before my_init())
index_read() -> index_read_map()
Renamed local variable to avoid hiding class variable
sql/log_event_old.cc:
Renamed local variable to avoid hiding class variable
sql/mysql_priv.h:
Made all create_backup_ctx() declarations identical.
This lifted up a bug where wrong create_backup_ctx() was called in some cases.
Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
sql/mysqld.cc:
Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
Fixed indentation
Don't call end_thr_alarm() when calling unireg_abort() as unireg_abort() already calls end_thr_alarm()
Added variable 'Opened_files' (number of calls to my_open() or my_fopen())
Don't print 'loose' warnings when using --bootstrap (to avoid warnings when running mysql_install_db)
Fixed compiler warnings
sql/opt_range.cc:
index_read() -> index_read_map()
sql/opt_sum.cc:
index_read() -> index_read_map()
sql/partition_info.cc:
Renamed local variable to avoid hiding class variable
sql/rpl_filter.cc:
Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
sql/set_var.cc:
Renamed local variable to avoid hiding class variable
Added 'process_key_cache_t' type to avoid compiler warning (on Forte)
sql/set_var.h:
Added 'process_key_cache_t' type to avoid compiler warning (on Forte)
sql/sp.cc:
More debugging
index_read() -> index_read_map()
sql/sp_cache.cc:
Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
sql/sp_head.cc:
Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
Moved 'saved_creation_ctx' higher up to be able to free objects allocated by create_backup_ctx()
sql/sql_acl.cc:
index_read() -> index_read_map()
sql/sql_class.cc:
Renamed local variable to avoid hiding class variable
Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
sql/sql_class.h:
Renamed local variable to avoid hiding class variable
sql/sql_db.cc:
Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
sql/sql_delete.cc:
Renamed local variable to avoid hiding class variable
sql/sql_handler.cc:
index_read() -> index_read_map()
sql/sql_help.cc:
index_read() -> index_read_map()
sql/sql_insert.cc:
index_read() -> index_read_map()
Renamed local variable to avoid hiding class variable
sql/sql_lex.cc:
Renamed local variable to avoid hiding class variable
sql/sql_plugin.cc:
Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
index_read() -> index_read_map()
Don't give warnings about not used plugins if we are using --warnings=0
sql/sql_select.cc:
index_read() -> index_read_map()
sql-common/client.c:
Fixed compiler warning (on Forte)
sql-common/my_time.c:
Removed never accessed code
Fixed compiler warning (on Forte)
sql/sql_servers.cc:
index_read() -> index_read_map()
sql/sql_show.cc:
Added TRANSACTIONAL to SHOW CREATE
Fixed ROW_TYPE_PAGE
sql/sql_string.cc:
Avoid compiler warnings when using C function pointers in C++
sql/sql_table.cc:
Set create_info->transactional if we used TRANSACTIONAL=1
sql/sql_udf.cc:
index_read() -> index_read_map()
sql/sql_yacc.yy:
Added TRANSACTIONAL=0|1 to CREATE (for future)
Added row type PAGE (was only partionally handled before)
sql/strfunc.cc:
Avoid compiler warnings when using C function pointers in C++
sql/table.cc:
More DBUG statements
Declare all create_backup_ctx() functions identically
Remember if table was created with TRANSACTIONAL flag or not (future safe)
Renamed local variable to avoid hiding class variable
sql/table.h:
Remember if table was created with TRANSACTIONAL=1
sql/tztime.cc:
index_read() -> index_read_map()
sql-common/pack.c:
Fixed compiler warning (on Forte)
storage/archive/archive_reader.c:
Fixed compiler warning (on Forte)
storage/archive/azio.c:
Fixed compiler warning (on Forte)
storage/blackhole/ha_blackhole.cc:
index_read() -> index_read_map()
storage/blackhole/ha_blackhole.h:
index_read() -> index_read_map()
storage/csv/ha_tina.cc:
Declare functions sent to C code with extern "C" to avoid compiler warnings (on Forte)
storage/example/ha_example.cc:
index_read() -> index_read_map()
storage/example/ha_example.h:
index_read() -> index_read_map()
storage/heap/ha_heap.cc:
index_read() -> index_read_map()
storage/heap/ha_heap.h:
index_read() -> index_read_map()
storage/heap/hp_test1.c:
Fixed compiler warning (on Forte)
storage/heap/hp_test2.c:
Fixed compiler warning (on Forte)
storage/myisam/ft_boolean_search.c:
Fixed compiler warning (on Forte)
storage/myisam/ft_nlq_search.c:
Fixed compiler warning (on Forte)
storage/myisam/ft_parser.c:
Fixed compiler warning (on Forte)
storage/myisam/ft_stopwords.c:
Fixed compiler warning (on Forte)
storage/myisam/ha_myisam.cc:
index_read() -> index_read_map()
storage/myisam/ha_myisam.h:
index_read() -> index_read_map()
storage/myisam/mi_check.c:
Fixed compiler warning (on Forte)
storage/myisam/mi_delete.c:
Fixed compiler warning (on Forte)
storage/myisam/mi_dynrec.c:
Fixed compiler warning (on Forte)
storage/myisam/mi_extra.c:
Fixed compiler warning (on Forte)
storage/myisam/mi_key.c:
Fixed compiler warning (on Forte)
storage/myisam/mi_keycache.c:
Fixed compiler warning (on Forte)
storage/myisam/mi_locking.c:
Fixed compiler warning (on Forte)
storage/myisam/mi_log.c:
Fixed compiler warning (on Forte)
storage/myisam/mi_open.c:
Fixed compiler warning (on Forte)
storage/myisam/mi_packrec.c:
Fixed compiler warning (on Forte)
storage/myisam/mi_page.c:
Fixed compiler warning (on Forte)
storage/myisam/mi_rkey.c:
Added comment
storage/myisam/mi_search.c:
Fixed compiler warning (on Forte)
storage/myisam/mi_statrec.c:
Fixed compiler warning (on Forte)
storage/myisam/mi_test1.c:
Fixed compiler warning (on Forte)
storage/myisam/mi_test2.c:
Fixed compiler warning (on Forte)
storage/myisam/mi_test3.c:
Fixed compiler warning (on Forte)
storage/myisam/mi_update.c:
Fixed compiler warning (on Forte)
storage/myisam/mi_write.c:
Fixed compiler warning (on Forte)
storage/myisam/myisamdef.h:
Fixed that file_read/file_write returns type size_t
Changed some functions to use uchar * as argument/return value instead of char*
This fixed some compiler warnings on Forte
storage/myisam/myisamlog.c:
Fixed compiler warning (on Forte)
storage/myisam/myisampack.c:
Fixed compiler warning (on Forte)
storage/myisam/rt_test.c:
Fixed compiler warning (on Forte)
storage/myisam/sort.c:
Fixed compiler warning (on Forte) by adding casts or changing variables to uchar*
storage/myisam/sp_test.c:
Fixed compiler warning (on Forte) by adding casts or changing variables to uchar*
storage/myisammrg/ha_myisammrg.cc:
index_read() -> index_read_map()
storage/myisammrg/ha_myisammrg.h:
index_read() -> index_read_map()
storage/myisammrg/myrg_create.c:
Fixed compiler warning (on Forte) by adding casts or changing variable types
storage/ndb/src/kernel/blocks/dbtup/DbtupExecQuery.cpp:
Tdummy -> align (as in other part of cluster code)
storage/ndb/src/kernel/vm/DynArr256.cpp:
Removed not used variable
storage/ndb/src/ndbapi/Ndb.cpp:
Removed not used variable
strings/strtod.c:
Include ieeefp.h to avoid compiler warning
tests/bug25714.c:
Fixed compiler warning
tests/mysql_client_test.c:
Remove not used variable
Fixed indentation
Removed never reached code
Fixed compiler warning (on Forte) by adding casts or changing variable types
vio/viosocket.c:
Fixed compiler warning (on Forte) by adding casts or changing variable types
into weblab.(none):/home/marcsql/TREE/mysql-5.1-25422-d
client/mysqldump.c:
Auto merged
mysql-test/r/log_state.result:
Auto merged
mysql-test/r/show_check.result:
Auto merged
mysql-test/t/show_check.test:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/share/errmsg.txt:
Auto merged
sql/sp.cc:
Auto merged
into ibm.:/home/alik/Documents/MySQL/devel/5.1-rt-merge
mysql-test/r/mysqldump-max.result:
Auto merged
mysql-test/r/openssl_1.result:
Auto merged
mysql-test/t/show_check.test:
Auto merged
sql/sp.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
client/mysqldump.c:
Manual merge.
mysql-test/r/mysqldump.result:
Manual merge + use local.
Bug#25422 (Hang with log tables)
Bug 17876 (Truncating mysql.slow_log in a SP after using cursor locks the
thread)
Bug 23044 (Warnings on flush of a log table)
Bug 29129 (Resetting general_log while the GLOBAL READ LOCK is set causes
a deadlock)
Prior to this fix, the server would hang when performing concurrent
ALTER TABLE or TRUNCATE TABLE statements against the LOG TABLES,
which are mysql.general_log and mysql.slow_log.
The root cause traces to the following code:
in sql_base.cc, open_table()
if (table->in_use != thd)
{
/* wait_for_condition will unlock LOCK_open for us */
wait_for_condition(thd, &LOCK_open, &COND_refresh);
}
The problem with this code is that the current implementation of the
LOGGER creates 'fake' THD objects, like
- Log_to_csv_event_handler::general_log_thd
- Log_to_csv_event_handler::slow_log_thd
which are not associated to a real thread running in the server,
so that waiting for these non-existing threads to release table locks
cause the dead lock.
In general, the design of Log_to_csv_event_handler does not fit into the
general architecture of the server, so that the concept of general_log_thd
and slow_log_thd has to be abandoned:
- this implementation does not work with table locking
- it will not work with commands like SHOW PROCESSLIST
- having the log tables always opened does not integrate well with DDL
operations / FLUSH TABLES / SET GLOBAL READ_ONLY
With this patch, the fundamental design of the LOGGER has been changed to:
- always open and close a log table when writing a log
- remove totally the usage of fake THD objects
- clarify how locking of log tables is implemented in general.
See WL#3984 for details related to the new locking design.
Additional changes (misc bugs exposed and fixed):
1)
mysqldump which would ignore some tables in dump_all_tables_in_db(),
but forget to ignore the same in dump_all_views_in_db().
2)
mysqldump would also issue an empty "LOCK TABLE" command when all the tables
to lock are to be ignored (numrows == 0), instead of not issuing the query.
3)
Internal errors handlers could intercept errors but not warnings
(see sql_error.cc).
4)
Implementing a nested call to open tables, for the performance schema tables,
exposed an existing bug in remove_table_from_cache(), which would perform:
in_use->some_tables_deleted=1;
against another thread, without any consideration about thread locking.
This call inside remove_table_from_cache() was not required anyway,
since calling mysql_lock_abort() takes care of aborting -- cleanly -- threads
that might hold a lock on a table.
This line (in_use->some_tables_deleted=1) has been removed.
sql/handler.cc:
Moved logic for system / log tables in the SQL layer.
sql/handler.h:
Moved logic for system / log tables in the SQL layer.
sql/lock.cc:
Revised locking of log tables
sql/log.cc:
Major cleanup: changed how log tables are locked / written to.
sql/log.h:
Major cleanup: changed how log tables are locked / written to.
sql/mysql_priv.h:
performance schema helpers
sql/slave.cc:
open_ltable() lock flags
sql/sp.cc:
open_ltable() lock flags
sql/sql_acl.cc:
open_ltable() lock flags
sql/sql_class.h:
performance schema helpers
sql/sql_delete.cc:
log tables cleanup in TRUNCATE
sql/sql_error.cc:
Internal handlers can also intercept warnings
sql/sql_insert.cc:
open_ltable() lock flags
sql/sql_parse.cc:
performance schema helpers
sql/sql_plugin.cc:
open_ltable() lock flags
sql/sql_rename.cc:
log tables cleanup in RENAME
sql/sql_servers.cc:
open_ltable() lock flags
sql/sql_show.cc:
Move INFORMATION_SCHEMA_NAME to table.cc
sql/sql_table.cc:
log tables cleanup (admin operations, ALTER TABLE)
sql/sql_udf.cc:
open_ltable() lock flags
sql/table.cc:
Implemented TABLE_CATEGORY.
sql/share/errmsg.txt:
Changed the wording and name of ER_CANT_READ_LOCK_LOG_TABLE
sql/table.h:
Implemented TABLE_CATEGORY.
storage/csv/ha_tina.cc:
Moved logic for system / log tables in the SQL layer.
storage/csv/ha_tina.h:
Moved logic for system / log tables in the SQL layer.
storage/myisam/ha_myisam.cc:
Moved logic for system / log tables in the SQL layer.
storage/myisam/ha_myisam.h:
Moved logic for system / log tables in the SQL layer.
client/mysqldump.c:
Don't lock tables in the ignore list.
Don't issue empty LOCK TABLES queries.
sql/sql_base.cc:
log tables cleanup
performance schema helpers
mysql-test/r/ps.result:
Adjust test results
mysql-test/r/show_check.result:
Adjust test results
mysql-test/r/status.result:
Adjust test results
mysql-test/t/log_state.test:
Added tests for Bug#29129
mysql-test/t/ps.test:
Make the test output deterministic
mysql-test/t/show_check.test:
Make the test output deterministic
mysql-test/r/log_state.result:
Changed the default location of the log output to LOG_FILE,
for backward compatibility with MySQL 5.0
---
Adjust test results
mysql-test/r/log_tables.result:
cleanup for -ps-protocol
mysql-test/t/log_tables.test:
cleanup for -ps-protocol
sql/set_var.cc:
Changed the default location of the log output to LOG_FILE,
for backward compatibility with MySQL 5.0
---
log tables cleanup
mysql-test/r/innodb_mysql.result:
Update test results (merge from the main tree).
mysql-test/r/query_cache.result:
Update test results (merge from the main tree).
mysql-test/r/sp.result:
Update test results (merge from the main tree).
mysql-test/t/query_cache.test:
Use --echo End of to simplify future merges.
sql/handler.h:
st_table_list -> TABLE_LIST
sql/item_create.cc:
A post-merge fix (this code is in sql_yacc.yy in 5.0)
sql/rpl_utility.h:
st_table_list -> TABLE_LIST
sql/sp.cc:
A post-merge fix.
sql/sp_head.cc:
In 5.1 memdup_root returns void*.
sql/sql_show.cc:
st_table_list -> TABLE_LIST
sql/sql_show.h:
st_table_list -> TABLE_LIST
sql/sql_yacc.yy:
A post-merge fix.
sql/table.cc:
st_table_list -> TABLE_LIST
sql/table.h:
st_table_list -> TABLE_LIST
causes full table lock on innodb table.
Also fixes Bug#28502 Triggers that update another innodb table
will block on X lock unnecessarily (duplciate).
Code review fixes.
Both bugs' synopses are misleading: InnoDB table is
not X locked. The statements, however, cannot proceed concurrently,
but this happens due to lock conflicts for tables used in triggers,
not for the InnoDB table.
If a user had an InnoDB table, and two triggers, AFTER UPDATE and
AFTER INSERT, competing for different resources (e.g. two distinct
MyISAM tables), then these two triggers would not be able to execute
concurrently. Moreover, INSERTS/UPDATES of the InnoDB table would
not be able to run concurrently.
The problem had other side-effects (see respective bug reports).
This behavior was a consequence of a shortcoming of the pre-locking
algorithm, which would not distinguish between different DML operations
(e.g. INSERT and DELETE) and pre-lock all the tables
that are used by any trigger defined on the subject table.
The idea of the fix is to extend the pre-locking algorithm to keep track,
for each table, what DML operation it is used for and not
load triggers that are known to never be fired.
mysql-test/r/trigger-trans.result:
Update results (Bug#26141)
mysql-test/r/trigger.result:
Update results (Bug#28502)
mysql-test/t/trigger-trans.test:
Add a test case for Bug#26141 mixing table types in trigger causes
full table lock on innodb table.
mysql-test/t/trigger.test:
Add a test case for Bug#28502 Triggers that update another innodb
table will block echo on X lock unnecessarily. Add more test
coverage for triggers.
sql/item.h:
enum trg_event_type is needed in table.h
sql/sp.cc:
Take into account table_list->trg_event_map when determining
what tables to pre-lock.
After this change, if we attempt to fire a
trigger for which we had not pre-locked any tables, error
'Table was not locked with LOCK TABLES' will be printed.
This, however, should never happen, provided the pre-locking
algorithm has no programming bugs.
Previously a trigger key in the sroutines hash was based on the name
of the table the trigger belongs to. This was possible because we would
always add to the pre-locking list all the triggers defined for a table when
handling this table.
Now the key is based on the name of the trigger, owing
to the fact that a trigger name must be unique in the database it
belongs to.
sql/sp_head.cc:
Generate sroutines hash key in init_spname(). This is a convenient
place since there we have all the necessary information and can
avoid an extra alloc.
Maintain and merge trg_event_map when adding and merging elements
of the pre-locking list.
sql/sp_head.h:
Add ,m_sroutines_key member, used when inserting the sphead for a
trigger into the cache of routines used by a statement.
Previously the key was based on the table name the trigger belonged
to, since for a given table we would add to the sroutines list
all the triggers defined on it.
sql/sql_lex.cc:
Introduce a new lex step: set_trg_event_type_for_tables().
It is called when we have finished parsing but before opening
and locking tables. Now this step is used to evaluate for each
TABLE_LIST instance which INSERT/UPDATE/DELETE operation, if any,
it is used in.
In future this method could be extended to aggregate other information
that is hard to aggregate during parsing.
sql/sql_lex.h:
Add declaration for set_trg_event_type_for_tables().
sql/sql_parse.cc:
Call set_trg_event_type_for_tables() after MYSQLparse(). Remove tabs.
sql/sql_prepare.cc:
Call set_trg_event_type_for_tables() after MYSQLparse().
sql/sql_trigger.cc:
Call set_trg_event_type_for_tables() after MYSQLparse().
sql/sql_trigger.h:
Remove an obsolete member.
sql/sql_view.cc:
Call set_trg_event_type_for_tables() after MYSQLparse().
sql/sql_yacc.yy:
Move assignment of sp_head::m_type before calling sp_head::init_spname(),
one is now used inside another.
sql/table.cc:
Implement TABLE_LIST::set_trg_event_map() - a method that calculates
wh triggers may be fired on this table when executing a statement.
sql/table.h:
Add missing declarations.
Move declaration of trg_event_type from item.h (it will be needed for
trg_event_map bitmap when we start using Bitmap template instead
of uint8).