Backporting a changeset made for 5.0. Comments from there:
The fix refines the algorithm of generating DROPs for binlog.
Temp tables with common pseudo_thread_id are clustered into one query.
Consequently one replication event per pseudo_thread_id is generated.
mysql-test/r/rpl_temporary.result:
results changed
mysql-test/t/rpl_temporary.test:
test to generate problematic drop in binlog to feed it to restarting slave
to see no stop.
sql/sql_base.cc:
change in drop temprorary tables alg in close_temporary_tables.
Error was emitted when one tried to select information from view which used
merge algorithm and which also had CONVERT_TZ() function in its select list.
This bug was caused by wrong assumption that global table list for view
which is handled using merge algorithm begins from tables belonging to
the main select of this view. Nowadays the above assumption is not true only
when one uses convert_tz() function in view's select list, but in future
other cases may be added (for example we may support merging of views
with subqueries in select list one day). Relying on this false assumption
led to the usage of wrong table list for field lookups and therefor errors.
With this fix we explicitly use pointer to the beginning of main select's
table list.
mysql-test/r/timezone_grant.result:
Added additional test case for bug#15153 "CONVERT_TZ() is not allowed in
all places in VIEWs" that checks that usage of CONVERT_TZ() function in view
does not require additional privileges.
mysql-test/r/view.result:
Added test case for bug#15153 "CONVERT_TZ() is not allowed in all places in
VIEWs".
mysql-test/t/timezone_grant.test:
Added additional test case for bug#15153 "CONVERT_TZ() is not allowed in
all places in VIEWs" that checks that usage of CONVERT_TZ() function in view
does not require additional privileges.
mysql-test/t/view.test:
Added test case for bug#15153 "CONVERT_TZ() is not allowed in all places in
VIEWs".
sql/sql_view.cc:
mysql_make_view():
We should not assume that global table list for view which is handled using
merge algorithm begins from tables belonging to the main select of this
view. Nowadays the above assumption is not true only when one uses
convert_tz() function in view's select list, but in future other cases
may be added (for example we may support merging of views with subqueries
in select list one day). So let us instead explicitly use pointer to the
beginning of main select's table list.
Make InnoDB option "loose", as the server might be
started with this option just to find out the test
is to be skipped in the configuration (bug#17359)
mysql-test/t/innodb_unsafe_binlog-master.opt:
Make InnoDB option "loose", as the server might be
started with this option just to find out the test
is to be skipped in the configuration (bug#17359)
Do not reset value of LAST_INSERT_ID() in sub-statement.
mysql-test/r/rpl_insert_id.result:
Add result for bug#15728.
mysql-test/r/sp.result:
Add result for bug#15728.
mysql-test/t/rpl_insert_id.test:
Add test case for bug#15728.
mysql-test/t/sp.test:
Add test case for bug#15728.
sql/sql_class.cc:
Do not reset value of LAST_INSERT_ID() in sub-statement.
The bug caused wrong result sets for union constructs of the form
(SELECT ... ORDER BY order_list1 [LIMIT n]) ORDER BY order_list2.
For such queries order lists were concatenated and limit clause was
completely neglected.
mysql-test/r/order_by.result:
Added a test case for bug #18767.
mysql-test/t/order_by.test:
Added a test case for bug #18767.
sql/sql_lex.h:
Fixed bug #18767.
Placed the code the created a fake SELECT_LEX into a separate function.
sql/sql_parse.cc:
Fixed bug #18767.
Placed the code the created a fake SELECT_LEX into a separate function.
sql/sql_select.cc:
Fixed bug #18767.
Changed the condition on which a SELECT is treated as part of a UNION.
The SELECT in
(SELECT ... ORDER BY order_list1 [LIMIT n]) ORDER BY order_list2
now is handled in the same way as the first SELECT in a UNION
sequence.
sql/sql_union.cc:
Fixed bug #18767.
Changed the condition at which a SELECT is treated as part of a UNION.
The SELECT in
(SELECT ... ORDER BY order_list1 [LIMIT n]) ORDER BY order_list2
now is handled in the same way as the first SELECT in a UNION
sequence.
sql/sql_yacc.yy:
Fixed bug #18767.
Changed the condition at which a SELECT is treated as part of a UNION.
The SELECT in
(SELECT ... ORDER BY order_list1 [LIMIT n]) ORDER BY order_list2
now is handled in the same way as the first SELECT in a UNION
sequence. In the same way is handled the SELECT in
(SELECT ... LIMIT n) ORDER BY order list.
Yet if there is neither ORDER BY nor LIMIT in the single-select
union construct
(SELECT ...) ORDER BY order_list
then it is still handled as simple select with an order clause.
Fix BUG#18934: "InnoDB crashes when table uses column like DB_ROW_ID".
Also, fix memory leaks in row_create_table_for_mysql() in rare
corner cases.
innobase/dict/dict0dict.c:
Applied innodb-5.0-ss476 snapshot.
Refuse tables that use reserved column names (Bug#18934).
innobase/dict/dict0load.c:
Applied innodb-5.0-ss476 snapshot.
dict_load_table(): Refuse to load tables with other TYPE
than DICT_TABLE_ORDINARY.
innobase/dict/dict0mem.c:
Applied innodb-5.0-ss476 snapshot.
Add dict_mem_table_free(), use it instead of duplicating
the code everywhere.
innobase/ibuf/ibuf0ibuf.c:
Applied innodb-5.0-ss476 snapshot.
innobase/include/dict0dict.h:
Applied innodb-5.0-ss476 snapshot.
Refuse tables that use reserved column name (Bug#18934).
innobase/include/dict0mem.h:
Applied innodb-5.0-ss476 snapshot.
Add dict_mem_table_free(), use it instead of duplicating
the code everywhere.
innobase/include/univ.i:
Applied innodb-5.0-ss476 snapshot.
innobase/log/log0recv.c:
Applied innodb-5.0-ss476 snapshot.
innobase/row/row0mysql.c:
Applied innodb-5.0-ss476 snapshot.
Refuse tables that use reserved column names (Bug#18934).
mysql-test/r/innodb.result:
Applied innodb-5.0-ss476 snapshot.
Fix result for test case for Bug#18934.
(Other changes are to be restored by the next cset).
mysql-test/t/innodb.test:
Applied innodb-5.0-ss476 snapshot.
Fix result for test case for Bug#18934.
(Removed test case for Bug#14360 is to be restored by the next cset).
Fix BUG#16814: "SHOW INNODB STATUS format error in LATEST FOREIGN KEY ERROR section"
Add a missing newline to the LAST FOREIGN KEY ERROR section in SHOW INNODB STATUS
output.
Fix BUG#18934: "InnoDB crashes when table uses column names like DB_ROW_ID".
Refuse tables that use reserved column names.
innobase/dict/dict0dict.c:
Applied innodb-4.1-ss22 snapshot.
dict_foreign_error_report(): Always print a newline after invoking
dict_print_info_on_foreign_key_in_create_format() (Bug#16814).
Refuse tables that use reserved column names (Bug#18934).
innobase/dict/dict0mem.c:
Applied innodb-4.1-ss22 snapshot.
Refuse tables that use reserved column names (Bug#18934).
innobase/include/dict0dict.h:
Applied innodb-4.1-ss22 snapshot.
Refuse tables that use reserved column names (Bug#18934).
innobase/include/dict0mem.h:
Applied innodb-4.1-ss22 snapshot.
Refuse tables that use reserved column names (Bug#18934).
innobase/include/univ.i:
Applied innodb-4.1-ss22 snapshot.
innobase/row/row0mysql.c:
Applied innodb-4.1-ss22 snapshot.
Refuse tables that use reserved column names (Bug#18934).
Fixes for Bug#12429: Replication tests fail: "Slave_IO_Running" (?) differs related to MySQL 4.1
and Bug#16920 rpl_deadlock_innodb fails in show slave status (reported for MySQL 5.1)
mysql-test/r/rpl_deadlock.result:
Updated result
Remove duplicate test case for bug#14169
mysql-test/t/func_gconcat.test:
Remove duplicate test case for bug#14169
mysql-test/r/func_gconcat.result:
Remove duplicate test case for bug#14169
Corrected test case for the bug#14169 to make it pass in --ps-protocol mode.
mysql-test/r/func_gconcat.result:
Corrected test case for the bug#14169 to make it pass in --ps-protocol mode.
After a locking error the open table(s) were not fully
cleaned up for reuse. But they were put into the open table
cache even before the lock was tried. The next statement
reused the table(s) with a wrong lock type set up. This
tricked MyISAM into believing that it don't need to update
the table statistics. Hence CHECK TABLE reported a mismatch
of record count and table size.
Fortunately nothing worse has been detected yet. The effect
of the test case was that the insert worked on a read locked
table. (!)
I added a new function that clears the lock type from all
tables that were prepared for a lock. I call this function
when a lock failes.
No test case. One test would add 50 seconds to the
test suite. Another test requires file mode modifications.
I added a test script to the bug report. It contains three
cases for failing locks. All could reproduce a table
corruption. All are fixed by this patch.
This bug was not lock timeout specific.
sql/lock.cc:
Bug#18544 - LOCK TABLES timeout causes MyISAM table corruption
Resetting the lock type in the open table(s) lock data
after a locking error.