Problems (appear only under some circumstances):
1. we get a reference to a deleted table searching in the
thd->handler_tables_hash in the mysql_ha_read().
2. DBUG_ASSERT(table->file->inited == handler::NONE); assert fails in the
close_thread_table().
Fix: end open index scans and table scans and remove references to the
tables from the handler tables hash. After this preparation it is safe
to close the tables. The close can no longer fail on open index/table
scans and the closed table will not be used again by handler functions.
sql/mysql_priv.h:
Fix for bug #21587: FLUSH TABLES causes server crash when used with HANDLER statements
- mysql_ha_mark_tables_for_reopen() introduced.
sql/sql_base.cc:
Fix for bug #21587: FLUSH TABLES causes server crash when used with HANDLER statements
- call mysql_ha_mark_tables_for_reopen() to prepare for the following close.
sql/sql_handler.cc:
Fix for bug #21587: FLUSH TABLES causes server crash when used with HANDLER statements
- mysql_ha_mark_tables_for_reopen() function introduced.
into alik.:/mnt/raid/alik/MySQL/devel/5.1-rt-merged
mysql-test/mysql-test-run.pl:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/handler.cc:
Auto merged
sql/log.cc:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_view.cc:
Auto merged
sql/table.cc:
Auto merged
server-tools/instance-manager/guardian.cc:
Manual merged.
server-tools/instance-manager/instance.cc:
Manual merged.
server-tools/instance-manager/mysql_connection.cc:
Manual merged.
Fixed some possible fatal wrong arguments to printf() style functions
Initialized some not initialized variables
Fixed bug in stored procedure and continue handlers
(Fixes Bug#22150)
include/mysql/plugin.h:
Remove compiler warning
mysql-test/mysql-test-run.pl:
Ensure that --extern works on a clean tree (when 'var' directory doesn't exists)
server-tools/instance-manager/commands.cc:
Fixed possible use of unitialized variable
server-tools/instance-manager/guardian.cc:
Fixed wrong arguments to log_info() that could cause crashes
server-tools/instance-manager/instance.cc:
Fixed wrong arguments to log_info() and log_error() that could cause crashes
server-tools/instance-manager/instance_options.cc:
Fixed wrong arguments to log_error() that could cause crashes
server-tools/instance-manager/mysql_connection.cc:
Fixed wrong arguments to log_info()
server-tools/instance-manager/parse.cc:
Fixed possible use of unitialized variable
server-tools/instance-manager/user_map.cc:
Fixed wrong arguments to log_error() that could cause crashes
sql/Makefile.am:
Fix for bison 1.875
(It write an __attribute__() tag that was causing compiler failures)
sql/ha_ndbcluster.cc:
Fixed wrong snprintf() arguments
Remoed not used variables
sql/ha_ndbcluster_binlog.cc:
Fixed compiler warning (unsigned/signed comparision)
sql/handler.cc:
Fixed wrong parameter to hton->binlog_func()
sql/item_cmpfunc.cc:
Removed compiler warnings
sql/item_timefunc.cc:
Removed compiler warnings
sql/log.cc:
fixed wrong argument to snprintf()
sql/mysqld.cc:
Removed compiler warnings
Fixed wrong arguments to printf()
sql/partition_info.cc:
Removed compiler warnings
sql/protocol.cc:
reset is_fatal_error for stored procedures
(Fix for Bug#22150)
sql/sp_head.cc:
More DBUG information
Reset is_fatal_error in case of continue handler.
(Fix for Bug#22150)
sql/sql_base.cc:
Removed compiler warnings
sql/sql_class.h:
More DBUG information
sql/sql_insert.cc:
Removed compiler warnings
Initialize not initialized variable (fatal bug)
sql/sql_parse.cc:
Added DBUG_ASSERT to detect if stored procedure code returns with a wrong state
Removed compiler warning
sql/sql_plugin.cc:
Fied wrong aruguments to printf() (Fatal bug)
sql/sql_select.cc:
Initailize not initialized variable.
Remove compiler warnings
Fixed wrong argument to printf() (Possible fatal error)
sql/sql_view.cc:
Removed compiler warnings
sql/table.cc:
Fixed wrong argument to printf() (Possible fatal)
into bodhi.local:/opt/local/work/mysql-5.1-runtime-merge
mysql-test/r/ps.result:
Auto merged
mysql-test/t/func_gconcat.test:
Auto merged
mysql-test/t/ps.test:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/log_event.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/set_var.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.h:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_update.cc:
Auto merged
sql/sql_view.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
tests/mysql_client_test.c:
Auto merged
mysql-test/r/view.result:
Manual merge.
mysql-test/t/view.test:
Manual merge.
into bodhi.local:/opt/local/work/mysql-5.0-runtime-merge
mysql-test/t/func_gconcat.test:
Auto merged
sql/item_func.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_update.cc:
Auto merged
mysql-test/r/view.result:
Manual merge.
mysql-test/t/view.test:
Manual merge.
into dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.1-opt
BitKeeper/deleted/.del-bdb.result:
Auto merged
mysql-test/r/func_gconcat.result:
Auto merged
mysql-test/r/group_min_max.result:
Auto merged
mysql-test/r/innodb.result:
Auto merged
mysql-test/r/merge.result:
Auto merged
mysql-test/r/myisam.result:
Auto merged
mysql-test/r/olap.result:
Auto merged
mysql-test/r/select.result:
Auto merged
mysql-test/r/type_decimal.result:
Auto merged
mysql-test/r/view.result:
Auto merged
mysql-test/t/func_gconcat.test:
Auto merged
mysql-test/t/group_min_max.test:
Auto merged
mysql-test/t/select.test:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/opt_range.cc:
Auto merged
sql/opt_range.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_select.h:
Auto merged
sql/sql_update.cc:
Auto merged
sql/table.cc:
Auto merged
include/my_base.h:
SCCS merged
mysql-test/include/mix1.inc:
SCCS merged
mysql-test/r/group_by.result:
SCCS merged
mysql-test/r/innodb_mysql.result:
SCCS merged
mysql-test/t/group_by.test:
SCCS merged
sql/sql_select.cc:
SCCS merged
account predicates that become sargable after reading const tables.
In some cases this resulted in choosing non-optimal execution plans.
Now info of such potentially saragable predicates is saved in
an array and after reading const tables we check whether this
predicates has become saragable.
mysql-test/r/select.result:
Added a test case for bug #19579.
mysql-test/t/select.test:
Added a test case for bug #19579.
sql/item_cmpfunc.cc:
Fixed bug #19579: at range analysis optimizer did not take into
account predicates that become sargable after reading const tables.
Added a counter of between predicates.
sql/sql_base.cc:
Fixed bug #19579: at range analysis optimizer did not take into
account predicates that become sargable after reading const tables.
Added a counter of between predicates.
sql/sql_lex.cc:
Fixed bug #19579: at range analysis optimizer did not take into
account predicates that become sargable after reading const tables.
Added a counter of between predicates.
sql/sql_lex.h:
Fixed bug #19579: at range analysis optimizer did not take into
account predicates that become sargable after reading const tables.
Added a counter of between predicates.
sql/sql_select.cc:
Fixed bug #19579: at range analysis optimizer did not take into
account predicates that become sargable after reading const tables.
Now info of such potentially saragable predicates is saved in
an array and after reading const tables we check whether this
predicates has become saragable.
into macbook.gmz:/Users/kgeorge/mysql/work/B14019-5.0-opt
mysql-test/r/func_gconcat.result:
Auto merged
mysql-test/t/func_gconcat.test:
Auto merged
sql/sql_base.cc:
Auto merged
mysql-test/r/group_by.result:
merge 4.1->5.0
mysql-test/t/group_by.test:
merge 4.1->5.0
When resolving unqualified name references MySQL was not
checking what is the item type for the reference. Thus
e.g a string literal item that has by convention a name
equal to its string value will also work as a reference to
a SELECT list item or a table field.
Fixed by allowing only Item_ref or Item_field to referenced by
(unqualified) name.
mysql-test/r/func_gconcat.result:
Bug #14019: group by converts literal string to column name
- removed undeterministic testcase : order by a constant
means no order.
mysql-test/r/group_by.result:
Bug #14019: group by converts literal string to column name
- test case
mysql-test/t/func_gconcat.test:
Bug #14019: group by converts literal string to column name
- removed undeterministic testcase : order by a constant
means no order.
mysql-test/t/group_by.test:
Bug #14019: group by converts literal string to column name
- test case
sql/sql_base.cc:
Bug #14019: group by converts literal string to column name
- resolve unqualified by name refs only for real references
In a trigger or a function used in a statement it is possible to do
SELECT from a table being modified by the statement. However,
encapsulation of such SELECT into a view and selecting from a view
instead of direct SELECT was not possible.
This happened because tables used by views (which in their turn
were used from functions/triggers) were not excluded from checks
in unique_table() routine as it happens for the rest of tables
added to the statement table list for prelocking.
With this fix we ignore all such tables in unique_table(), thus
providing consistency: inside a trigger or a functions SELECT from
a view may be used where plain SELECT is allowed. Modification of
the same table from function or trigger is still disallowed. Also,
this patch doesn't affect the case where SELECT from the table being
modified is done outside of function of trigger, such SELECTs are
still disallowed (this limitation and visibility problem when function
select from a table being modified are subjects of bug 21326). See
also bug 22427.
mysql-test/r/view.result:
Add result for bug#19111: TRIGGERs selecting from a VIEW on the
firing base table fail.
mysql-test/t/view.test:
Add test case for bug#19111: TRIGGERs selecting from a VIEW on the
firing base table fail.
sql/sql_base.cc:
In unique_table() do not check tables that are used in a stored
function or a trigger ('prelocking_placeholder' is set). If such
function or a trigger will attempt to modify a table, the error will
be given, however select is allowed there.
into dl145s.mysql.com:/data/bk/team_tree_merge/MERGE/mysql-5.1-opt
mysql-test/r/view.result:
Auto merged
mysql-test/t/view.test:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_view.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
On an INSERT into an updatable but non-insertable view an error message was
issued stating the view being not updatable. This can lead to a confusion of a
user.
A new error message is introduced. Is is showed when a user tries to insert
into a non-insertable view.
sql/sql_base.cc:
Fixed bug#5505: Wrong error message on INSERT into a view
The update_non_unique_table_error() function now issues proper
error for an INSERT.
sql/sql_insert.cc:
Fixed bug#5505: Wrong error message on INSERT into a view
Issue the ER_NON_INSERTABLE_TABLE error instead of the
ER_NON_UPDATABLE_TABLE on insert into a view.
sql/sql_view.cc:
Fixed bug#5505: Wrong error message on INSERT into a view
Issue the ER_NON_INSERTABLE_TABLE error instead of the
ER_NON_UPDATABLE_TABLE on insert into a view.
mysql-test/r/view.result:
Added the test case for bug#5505: Wrong error message on INSERT into a view
Corrected a few test cases after fixing bug#5505
mysql-test/t/view.test:
Added the test case for bug#5505: Wrong error message on INSERT into a view
Corrected a few test cases after fixing bug#5505
sql/share/errmsg.txt:
Fixed bug#5505: Wrong error message on INSERT into a view
Added the ER_NON_INSERTABLE_TABLE error definition.
into lamia.home:/home/timka/mysql/src/5.1-dbg
mysql-test/r/insert_select.result:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
The cause of the bug was an incomplete fix for bug 18080.
The problem was that setup_tables() unconditionally reset the
name resolution context to its 'tables' argument, which pointed
to the first table of an SQL statement.
The bug fix limits resetting of the name resolution context in
setup_tables() only in the cases when the context was not set
by earlier parser/optimizer phases.
mysql-test/r/insert_select.result:
Test for BUG#21774.
mysql-test/t/insert_select.test:
Test for BUG#21774.
sql/sql_base.cc:
Do not reset the name resolution contect unconditionally.
Instead set the context to 'tables' only if it was not
set before calling setup_tables().
sql/sql_insert.cc:
Added asserts to make sure that in the case of INSERT ... VALUES ...
statements it is not necessary to reset the name resolution context
to the first table, because there is only one table in the list of
tables anyway. The actual code is not removed in order not to
confuse it with the actual bug fix.
sql/sql_parse.cc:
Removed unnecessary reset of the name resolution context.
The context is anyway unconditionally reset in mysql_insert()
and mysql_prepare_insert().
After merge changes
mysql-test/r/ndb_condition_pushdown.result:
After merge changes
sql/sql_base.cc:
After merge changes
sql/opt_range.cc:
After merge changes
into moonbone.local:/work/tmp_merge-5.1-opt-mysql
BUILD/check-cpu:
Auto merged
include/config-netware.h:
Auto merged
mysql-test/r/func_time.result:
Auto merged
mysql-test/r/group_by.result:
Auto merged
mysql-test/r/join_outer.result:
Auto merged
mysql-test/r/ndb_condition_pushdown.result:
Auto merged
mysql-test/r/range.result:
Auto merged
mysql-test/r/select.result:
Auto merged
mysql-test/r/subselect.result:
Auto merged
mysql-test/r/type_datetime.result:
Auto merged
mysql-test/r/user_var.result:
Auto merged
mysql-test/r/view.result:
Auto merged
mysql-test/t/func_time.test:
Auto merged
mysql-test/t/range.test:
Auto merged
mysql-test/t/select.test:
Auto merged
mysql-test/t/type_datetime.test:
Auto merged
mysql-test/t/view.test:
Auto merged
sql/ha_innodb.cc:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/item_subselect.cc:
Auto merged
sql/item_timefunc.cc:
Auto merged
sql/opt_range.h:
Auto merged
sql/set_var.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_load.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_update.cc:
Auto merged
storage/innobase/btr/btr0btr.c:
Auto merged
storage/innobase/buf/buf0buf.c:
Auto merged
storage/innobase/dict/dict0dict.c:
Auto merged
storage/innobase/fil/fil0fil.c:
Auto merged
storage/innobase/fsp/fsp0fsp.c:
Auto merged
storage/innobase/include/buf0buf.ic:
Auto merged
storage/innobase/log/log0log.c:
Auto merged
storage/innobase/log/log0recv.c:
Auto merged
storage/innobase/os/os0file.c:
Auto merged
storage/innobase/row/row0sel.c:
Auto merged
storage/innobase/srv/srv0start.c:
Auto merged
storage/innobase/ut/ut0dbg.c:
Auto merged
tests/mysql_client_test.c:
Auto merged
client/mysqltest.c:
Manual merge
mysql-test/r/innodb_mysql.result:
Manual merge
mysql-test/t/innodb_mysql.test:
Manual merge
mysql-test/t/join_outer.test:
Manual merge
sql/item_cmpfunc.cc:
Manual merge
sql/mysql_priv.h:
Manual merge
sql/opt_range.cc:
Manual merge
sql/sql_base.cc:
Manual merge
storage/innobase/include/btr0cur.ic:
Manual merge
storage/innobase/row/row0mysql.c:
Manual merge
from cache" and #21216 "Simultaneous DROP TABLE and SHOW OPEN TABLES causes
server to crash".
Crash happened when one ran DROP DATABASE or SHOW OPEN TABLES statements
while concurrently doing DROP TABLE (or RENAME TABLE, CREATE TABLE LIKE
or any other command that takes name-lock) in other connection.
This problem was caused by the fact that table placeholders which were
added to table cache in order to obtain name-lock on table had
TABLE_SHARE::db and table_name set to 0. Therefore they broke assumption
that these members are non-0 for all tables in table cache on which some
of our code relies.
The fix sets these members for such placeholders to appropriate value making
this assumption true again. As attempt to avoid such problems in future
we introduce auxiliary TABLE_SHARE::set_table_cache_key() methods which
should be used when one wants to set TABLE_SHARE::table_cache_key and which
ensure that TABLE_SHARE::table_name/db are set properly.
Test cases for these bugs were added to 5.0 test-suite (with 5.0-specific
fix for bug #21216).
sql/lock.cc:
Our code assumes that TABLE_SHARE::table_name/db for objects in table cache
is set properly (and is non-NULL). For example look in list_open_tables()
and remove_db_from_cache(). This was not true for table placeholders that
were added to table cache for name-locking. Changed lock_table_name() to
preserve this assumption (now it uses TABLE_SHARE::set_table_cache_key()
to set all three table_cache_key/db/table_name members at once).
Also now we use my_multi_malloc() to allocate memory for TABLE and
TABLE_SHARE objects instead of using my_malloc() + summing sizes as
it automatically provides proper alignment for memory allocated.
sql/sql_base.cc:
Now we use TABLE_SHARE::set_table_cache_key() auxiliary methods to set
TABLE_SHARE::table_cache_key/db/table_name members at once.
We also use multi_alloc_root() instead of alloc_root() for allocating
memory for several objects as it is less error prone.
Finally, we also got rid of unused code in reopen_name_locked_table().
sql/sql_select.cc:
Got rid of redundant code. TABLE_SHARE::db/table_cache_key are both set to
empty string by the call to init_tmp_table_share() routine.
sql/table.cc:
Now alloc_table_share() uses auxiliary TABLE_SHARE::set_table_cache_key()
method to properly set TABLE_SHARE::table_cache_key/db/table_name members.
Also now we use multi_alloc_root() instead of alloc_root() for allocating
memory for several objects as it is more clear/less error-prone.
sql/table.h:
Added comment about importance of apropriate setting of
TABLE_SHARE::table_name/db/table_cache_key for tables in table cache.
Introduced two auxiliary TABLE_SHARE::set_table_cache_key() methods which
allow to set these three members at once.
SELECT right instead of INSERT right was required for an insert into to a view.
This wrong behaviour appeared after the fix for bug #20989. Its intention was
to ask only SELECT right for all tables except the very first for a complex
INSERT query. But that patch has done it in a wrong way and lead to asking
a wrong access right for an insert into a view.
The setup_tables_and_check_access() function now accepts two want_access
parameters. One will be used for the first table and the second for other
tables.
mysql-test/t/view.test:
Added a test case for bug#21261: Wrong access rights was required for an insert into a view
mysql-test/r/view.result:
Added a test case for bug#21261: Wrong access rights was required for an insert into a view
sql/sql_update.cc:
Fixed bug#21261: Wrong access rights was required for an insert into a view
Modified to use updated setup_tables_and_check_access() function.
sql/sql_select.cc:
Fixed bug#21261: Wrong access rights was required for an insert into a view
Modified to use updated setup_tables_and_check_access() function.
sql/sql_load.cc:
Fixed bug#21261: Wrong access rights was required for an insert into a view
Modified to use updated setup_tables_and_check_access() function.
sql/sql_insert.cc:
Fixed bug#21261: Wrong access rights was required for an insert into a view
Modified to use updated setup_tables_and_check_access() function.
sql/sql_delete.cc:
Fixed bug#21261: Wrong access rights was required for an insert into a view
Modified to use updated setup_tables_and_check_access() function.
sql/sql_base.cc:
Fixed bug#21261: Wrong access rights was required for an insert into a view
The setup_tables_and_check_access() function now accepts two want_access
parameters. One will be used for the first table and the second for other
tables.
sql/mysql_priv.h:
Fixed bug#21261: Wrong access rights was required for an insert into a view
The setup_tables_and_check_access() function now accepts two want_access
parameters.
into govinda.patg.net:/home/patg/mysql-build/mysql-5.1-engines-merge
sql/ha_myisam.cc:
Auto merged
sql/ha_myisammrg.cc:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_partition.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_trigger.cc:
Auto merged
sql/sql_view.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/table.cc:
Auto merged
storage/innobase/row/row0mysql.c:
Auto merged
into moonlight.intranet:/home/tomash/src/mysql_ab/mysql-5.1-rt-merge
sql/handler.cc:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/share/errmsg.txt:
Auto merged
into sunlight.local:/local_work/leak_fix-5.1-mysql
sql/sql_lex.h:
Auto merged
sql/sql_view.cc:
Auto merged
sql/sql_view.h:
Auto merged
sql/unireg.h:
Auto merged
sql/sql_base.cc:
Manual merge
sql/table.cc:
Manual merge
into sunlight.local:/local_work/leak_fix
sql/sql_base.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/table.cc:
Auto merged
sql/sql_view.cc:
Manually merged
Due to incorrect handling of FLUSH TABLES, log tables were marked for flush,
but not reopened. Later we started to wait for the log table to be closed
(disabled) after the flush. And as nobody disabled logs in concurrent treads,
the command lasted forever.
After internal consultations it was decided to skip logs during FLUSH TABLES.
The reasoning is that logging is done in the "log device", whatever it is
which is always active and controlled by FLUSH LOGS. So, to flush logs
one should use FLUSH LOGS, and not FLUSH TABLES.
mysql-test/r/log_tables.result:
update result file
mysql-test/t/log_tables.test:
add a test for the bug
sql/sql_base.cc:
Skip log tables during FLUSH TABLES
into chilla.local:/home/mydev/mysql-5.1-bug18775
sql/ha_myisam.cc:
Auto merged
sql/ha_myisammrg.cc:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_partition.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_trigger.cc:
Auto merged
sql/sql_view.cc:
Auto merged
sql/table.cc:
Auto merged
sql/sql_db.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Manual merge
Continued implementation of WL#1324 (table name to filename encoding)
The intermediate (not temporary) files of the new table
during ALTER TABLE was visible for SHOW TABLES. These
intermediate files are copies of the original table with
the changes done by ALTER TABLE. After all the data is
copied over from the original table, these files are renamed
to the original tables file names. So they are not temporary
files. They persist after ALTER TABLE, but just with another
name.
In 5.0 the intermediate files are invisible for SHOW TABLES
because all file names beginning with "#sql" were suppressed.
This failed since 5.1.6 because even temporary table names were
converted when making file names from them. The prefix became
converted to "@0023sql". Converting the prefix during SHOW TABLES
would suppress the listing of user tables that start with "#sql".
The solution of the problem is to continue the implementation of
the table name to file name conversion feature. One requirement
is to suppress the conversion for temporary table names.
This change is straightforward for real temporary tables as there
is a function that creates temporary file names.
But the generated path names are located in TMPDIR and have no
relation to the internal table name. This cannot be used for
ALTER TABLE. Its intermediate files need to be in the same
directory as the old table files. And it is necessary to be
able to deduce the same path from the same table name repeatedly.
Consequently the intermediate table files must be handled like normal
tables. Their internal names shall start with tmp_file_prefix
(#sql) and they shall not be converted like normal table names.
I added a flags parameter to all relevant functions that are
called from ALTER TABLE. It is used to suppress the conversion
for the intermediate table files.
The outcome is that the suppression of #sql in SHOW TABLES
works again. It does not suppress user tables as these are
converted to @0023sql on file level.
This patch does also fix ALTER TABLE ... RENAME, which could not
rename a table with non-ASCII characters in its name.
It does also fix the problem that a user could create a table like
`#sql-xxxx-yyyy`, where xxxx is mysqld's pid and yyyy is the thread
ID of some other thread, which prevented this thread from running
ALTER TABLE.
Some of the above problems are mentioned in Bug 1405, which can
be closed with this patch.
This patch does also contain some minor fixes for other forgotten
conversions. Still known problems are reported as bugs 21370,
21373, and 21387.
mysql-test/r/alter_table.result:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added test results.
mysql-test/r/backup.result:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added test results.
mysql-test/r/repair.result:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added test results.
mysql-test/t/alter_table.test:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added test cases.
mysql-test/t/backup.test:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added test cases.
mysql-test/t/repair.test:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added a test case.
sql/ha_myisam.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added missing table name mapping calls to backup() and restore().
sql/ha_myisammrg.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/ha_ndbcluster.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/ha_ndbcluster_binlog.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/ha_ndbcluster_binlog.h:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Removed unnecessary check for wrong temp file prefix.
sql/mysql_priv.h:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Extended quick_rm_table(), mysql_rename_table(), and
build_table_filename() by an flags argument, which can indicate
temporary table names that should not be converted.
Added symbolic flag values.
sql/sql_acl.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/sql_base.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Fixed a comment.
Added DBUG calls.
sql/sql_db.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/sql_delete.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/sql_insert.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/sql_partition.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/sql_rename.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/sql_show.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Reverted the former fix for this bug. tmp_file_prefix is now used
verbatim in the comparison of file names.
sql/sql_table.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added a check for a tmp_file_prefix file name to
filename_to_tablename(). These names are now accepted without
conversion.
Extended quick_rm_table(), mysql_rename_table(), and
build_table_filename() by an flags argument, which can indicate
temporary table names that should not be converted.
Removed the table to file name conversion from
build_tmptable_filename().
Disabled REPAIR TABLE ... USE_FRM for temporary tables.
Added the forgotten conversion to mysql_alter_table() for the case
of ALTER TABLE ... RENAME.
Added comments and DBUG calls.
sql/sql_trigger.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/sql_view.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Added an zero argument for the new 'flags' parameter.
sql/table.cc:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Replaced a literal ".frm" by reg_ext.
Added DBUG calls.
storage/innobase/row/row0mysql.c:
Bug#18775 - Temporary table from alter table visible to other threads
Continued implementation of WL#1324 (table name to filename encoding)
Changed back the encoded temp file prefix to #sql.
into sunlight.local:/local_work/tmp_merge-5.1-opt-mysql
client/mysql.cc:
Auto merged
mysql-test/r/date_formats.result:
Auto merged
mysql-test/r/func_gconcat.result:
Auto merged
mysql-test/r/func_group.result:
Auto merged
mysql-test/r/func_str.result:
Auto merged
mysql-test/r/group_min_max.result:
Auto merged
BitKeeper/deleted/.del-make_win_src_distribution.sh~f80d8fca44e4e5f1:
Auto merged
BitKeeper/deleted/.del-mysqld.dsp~ffdbf2d234e23e56:
Auto merged
BitKeeper/deleted/.del-mysqld_ia64.dsp~7f8cf84d81ee04e2:
Auto merged
BitKeeper/deleted/.del-mysqldump.dsp~a8bd23547d3fc27e:
Auto merged
BitKeeper/deleted/.del-mysqldump_ia64.dsp~a2aabe898be35b31:
Auto merged
mysql-test/r/innodb.result:
Auto merged
mysql-test/r/innodb_mysql.result:
Auto merged
mysql-test/r/ps_7ndb.result:
Auto merged
mysql-test/r/type_ranges.result:
Auto merged
mysql-test/r/udf.result:
Auto merged
mysql-test/r/union.result:
Auto merged
mysql-test/r/view.result:
Auto merged
mysql-test/t/date_formats.test:
Auto merged
mysql-test/t/func_gconcat.test:
Auto merged
mysql-test/t/func_group.test:
Auto merged
mysql-test/t/group_min_max.test:
Auto merged
mysql-test/t/innodb.test:
Auto merged
mysql-test/t/innodb_mysql.test:
Auto merged
mysql-test/t/mysql.test:
Auto merged
mysql-test/t/select.test:
Auto merged
mysql-test/t/sp.test:
Auto merged
mysql-test/t/view.test:
Auto merged
sql/field.cc:
Auto merged
sql/item_cmpfunc.cc:
Auto merged
sql/item_cmpfunc.h:
Auto merged
sql/item_func.cc:
Auto merged
sql/item_func.h:
Auto merged
sql/item_strfunc.cc:
Auto merged
sql/item_subselect.cc:
Auto merged
sql/item_subselect.h:
Auto merged
sql/opt_range.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_show.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/time.cc:
Auto merged
storage/ndb/test/ndbapi/Makefile.am:
Auto merged
strings/decimal.c:
Auto merged
mysql-test/r/analyse.result:
Manual merge
mysql-test/r/bigint.result:
Manual merge
mysql-test/r/create.result:
Manual merge
mysql-test/r/information_schema.result:
Manual merge
mysql-test/r/ps_2myisam.result:
Manual merge
mysql-test/r/ps_3innodb.result:
Manual merge
mysql-test/r/ps_4heap.result:
Manual merge
mysql-test/r/ps_5merge.result:
Manual merge
mysql-test/r/ps_6bdb.result:
Manual merge
mysql-test/r/rpl_insert_id.result:
Manual merge
mysql-test/r/select.result:
Manual merge
mysql-test/r/sp.result:
Manual merge
mysql-test/r/subselect.result:
Manual merge
mysql-test/t/information_schema.test:
Manual merge
mysql-test/t/rpl_insert_id.test:
Manual merge
sql/field.h:
Manual merge
sql/item.cc:
Manual merge
sql/item.h:
Manual merge
sql/item_strfunc.h:
Manual merge
sql/item_sum.cc:
Manual merge
sql/mysql_priv.h:
Manual merge
sql/share/errmsg.txt:
Manual merge
sql/sql_class.h:
Manual merge
sql/sql_select.cc:
Manual merge
- Add prelocking for stored procedures that uses sp or sf
- Update test result for sp_error(reported as bug#21294)
- Make note about new error message from sp-error(bug#17244)
mysql-test/r/sp-error.result:
Update test result(reported as bug#21294)
mysql-test/r/sp_notembedded.result:
Update test result after disabling test case
mysql-test/t/sp-error.test:
Add note about the faulty error message
mysql-test/t/sp_notembedded.test:
Disable test case until bug#17244 has been fixed
sql/sp.cc:
Add prelocking for all stored procedures that uses another sp or sf
sql/sp.h:
Add prelocking for all stored procedures that uses another sp or sf
sql/sql_base.cc:
Add prelocking for all stored procedures that uses another sp or sf
When executing INSERT over a view with calculated columns it was assuming all
elements of the fields collection are actually Item_field instances.
This may not be true when inserting into a view and that view has columns that are
such expressions that allow updating (like setting a collation for example).
Corrected to access field information through the filed_for_view_update() function and
retrieve correctly the field info even for "update-friendly" non-Item_field items.
mysql-test/r/view.result:
Bug #21086: server crashes when VIEW defined with a SELECT with COLLATE clause is called
- test suite
mysql-test/t/view.test:
Bug #21086: server crashes when VIEW defined with a SELECT with COLLATE clause is called
- test suite
sql/item_strfunc.h:
Bug #21086: server crashes when VIEW defined with a SELECT with COLLATE clause is called
- obvious typo fixed
sql/sql_base.cc:
Bug #21086: server crashes when VIEW defined with a SELECT with COLLATE clause is called
- must access field information through the filed_for_view_update() function to retrieve
correctly the field info even for "update-friendly" non-Item_field items.
The problem was that store_top_level_join_columns() incorrectly assumed
that the left/right neighbor of a nested join table reference can be only
at the same level in the join tree.
The fix checks if the current nested join table reference has no immediate
left/right neighbor, and if so chooses the left/right neighbors of the
nearest upper level, where these references are != NULL.
mysql-test/r/group_min_max.result:
Test for BUG#21007.
mysql-test/t/group_min_max.test:
Test for BUG#21007.
sql/sql_base.cc:
After computing and materializing the columns of all NATURAL joins in a FROM clause,
the procedure store_top_level_join_columns() has to change the current natural join
into a leaf table reference for name resolution. For this it needs to make the left
neighbor point to the natural join table reference, and the natural join itself point
to its left neighbor.
This fix correctly determines the left/right neighbors of a table reference, even if
the neghbors are at higher levels in the nested join tree. The rule is that if a table
reference has no immediate left/right neighbors, we recursively pick the left/right
neighbor of the level(s) above.
into dl145k.mysql.com:/data0/mkindahl/bk/mysql-5.0-rpl
ndb/include/kernel/GlobalSignalNumbers.h:
Auto merged
ndb/src/kernel/blocks/dbdict/Dbdict.cpp:
Auto merged
ndb/src/kernel/blocks/dbdict/Dbdict.hpp:
Auto merged
ndb/src/kernel/blocks/dbdih/DbdihMain.cpp:
Auto merged
ndb/src/ndbapi/ndberror.c:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/handler.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
into dl145k.mysql.com:/data0/mkindahl/bk/MERGE/mysql-5.1-merge
include/my_sys.h:
Auto merged
mysql-test/mysql-test-run.pl:
Auto merged
mysql-test/r/rpl_row_create_table.result:
Auto merged
mysql-test/t/disabled.def:
Auto merged
mysql-test/t/rpl_row_create_table.test:
Auto merged
mysys/my_malloc.c:
Auto merged
server-tools/instance-manager/parse.h:
Auto merged
sql/ha_ndbcluster.cc:
Auto merged
sql/handler.h:
Auto merged
sql/log.cc:
Auto merged
sql/log_event.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/set_var.h:
Auto merged
sql/sp.cc:
Auto merged
sql/sp_head.cc:
Auto merged
sql/sp_head.h:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_update.cc:
Auto merged
sql/sql_view.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
mysys/safemalloc.c:
Merge of mysql-5.1-new-rpl into mysql-5.1
sql/ha_federated.cc:
d
Merge of mysql-5.1-new-rpl into mysql-5.1
sql/set_var.cc:
Merge of mysql-5.1-new-rpl with mysql-5.1
sql/slave.cc:
Merge of mysql-5.1-new-rpl into mysql-5.1
sql/sql_class.h:
Merge of mysql-5.1-new-rpl into mysql-5.1
We now reset the THD members related to auto_increment+binlog in
MYSQL_LOG::write(). This is better than in THD::cleanup_after_query(),
which was not able to distinguish between SELECT myfunc1(),myfunc2()
and INSERT INTO t SELECT myfunc1(),myfunc2() from a binlogging point
of view.
Rows_log_event::exec_event() now calls lex_start() instead of
mysql_init_query() because the latter now does too much (it resets
the binlog format).
mysql-test/extra/rpl_tests/rpl_insert_id.test:
fix after merge
mysql-test/mysql-test-run.pl:
-v does not bring useful information when running valgrind; I remove it;
if you think it's useful add it back.
mysql-test/r/binlog_stm_mix_innodb_myisam.result:
Position columns of SHOW BINLOG EVENTS are replaced by # (more robust
if the size of an event changes).
mysql-test/r/rpl_insert_id.result:
fix after merge
mysql-test/r/rpl_loaddata.result:
The binlog positions change, because one event disappeared; indeed there
was this in the binlog (in the current 5.1!):
SET INSERT_ID=2;
SET INSERT_ID=1;
SET TIMESTAMP=1152540671;
load data LOCAL INFILE '/tmp/SQL_LOAD_MB-1-2' INTO table t1;
Two INSERT_ID events, useless and a bug. Goes away afer cleaning up
auto_increment handling.
mysql-test/r/rpl_switch_stm_row_mixed.result:
INSERT_ID=5 appears, it's a consequence of having merged the fix
for BUG#20341
"stored function inserting into one auto_increment puts bad data in slave".
In mixed mode, if one substatement of a stored procedure requires row-based,
the entire procedure uses row-based (was already true for stored functions);
this is a consequence of not doing the resetting of binlog format inside
lock_tables() (which didn't work with how the slave thread executes
row-based binlog events).
mysql-test/t/rpl_switch_stm_row_mixed.test:
removing the multi-row delayed insert because in RBR the number of events
which it generates, is not repeatable (probably depends on how the delayed
thread groups rows, i.e. dependent on timing).
sql/ha_partition.cc:
update to new prototype
sql/ha_partition.h:
update to new prototype of the handler:: method.
sql/handler.cc:
after-merge fixes (manually merging part which was hard to merge in fmtool)
sql/log.cc:
When we write to the binary log, THD's parameters which influenced this
write are reset: stmt_depends_on_first_successful_insert_id_in_prev_stmt
and auto_inc_intervals_in_cur_stmt_for_binlog. This is so that future
writes are not influenced by those and can write their own values.
As a consequence, when we don't write to the binlog we do not reset.
This is to abide by the rule that in a complex statement (using triggers etc),
the first top- or substatement to generate auto_increment ids
wins their writing to the binlog (that writing may be done by the statement
itself or by the caller); so for example for
INSERT INTO t SELECT myfunc() where myfunc() inserts into auto_increment
and INSERT INTO t does not, myfunc() will fill
auto_inc_intervals_in_cur_stmt_for_binlog, which will not be reset when
myfunc() ends, then INSERT INTO t will write to the binlog and thus
write the preserved auto_inc_intervals_in_cur_stmt_for_binlog.
sql/log_event.cc:
mysql_init_query() does too much now to be called in Rows_log_event::exec_event
(it call mysql_reset_thd_for_next_command() which may switch
the binlog format now).
It's ok to call it in Table_map_log_event::exec_event() but its call must
be before setting the binlog format to "row".
sql/sql_base.cc:
Resetting the binlog format in lock_tables() was a bad idea of mine;
it causes problems in execution of row-based binlog events, where
the thread sets the binlog format by itself and does not want a next
lock_tables() to reset the binlog format.
It is also misleading, for a function named lock_tables(), to reset
the binlog format.
As a consequence of this change, in mixed binlogging mode, a routine
is logged either entirely statement-based or entirely row-based, we
don't switch in the middle (this was already true for prelocked routines,
now it's also true for stored procedures).
sql/sql_class.cc:
resetting of auto_increment variables used for binlogging is now done
when writing to the binary log, no need to do the resetting at the end
of the statement. It is also more correct this way; consider
SELECT myfunc1(),myfunc2();
where both functions insert into the same auto_increment column.
Binlogging is done in 2 events: "SELECT myfunc1()" and "SELECT myfunc2()".
So each of those needs to have, in binlog, the INSERT_ID which
it inserted. But as the 2 function calls are executed under prelocked mode,
the old code didn't reset auto_inc_intervals_in_cur_stmt_for_binlog
after the first SELECT was binlogged, and so the INSERT_ID of the first
SELECT was binlogged for the first SELECT and (wrong) also for the 2nd
SELECT event.
stmt_depends_on_first_... has the same logic.
sql/sql_class.h:
clearer comment
sql/sql_delete.cc:
unneeded #ifdef. As we temporarily change the binlog format to "statement"
before calling mysql_delete(), we must restore it afterwards.
sql/sql_insert.cc:
after-merge fixes.
No need to reset auto_inc_intervals_in_cur_stmt_for_binlog for every
row in the delayed insert system thread, because we already reset it
when writing to the binlog.
sql/sql_parse.cc:
unneeded #ifdef
closing temp tables through end_thread
had a flaw in binlog-off branch of close_temporary_tables where
next table to close was reset via table->next
for (table= thd->temporary_tables; table; table= table->next)
which was wrong since the current table instance got destoyed at
close_temporary(table, 1);
The fix adapts binlog-on branch method to engage the loop's internal 'next' variable which holds table->next prior table's destoying.
sql/sql_base.cc:
no-binlog branch is fixed: scanning across temporary_tables must be careful to save next table since the current is being destroyed inside of close_temporary.
binlog-is-open case is ok.
1) Fix for BUG#19630 "stored function inserting into two auto_increment breaks
statement-based binlog":
a stored function inserting into two such tables may fail to replicate
(inserting wrong data in the slave's copy of the second table) if the slave's
second table had an internal auto_increment counter different from master's.
Because the auto_increment value autogenerated by master for the 2nd table
does not go into binlog, only the first does, so the slave lacks information.
To fix this, if running in mixed binlogging mode, if the stored function or
trigger plans to update two different tables both having auto_increment
columns, we switch to row-based for the whole function.
We don't have a simple solution for statement-based binlogging mode, there
the bug remains and will be documented as a known problem.
Re-enabling rpl_switch_stm_row_mixed.
2) Fix for BUG#20630 "Mixed binlogging mode does not work with stored
functions, triggers, views", which was a documented limitation (in mixed
mode, we didn't detect that a stored function's execution needed row-based
binlogging (due to some UUID() call for example); same for
triggers, same for views (a view created from a SELECT UUID(), and doing
INSERT INTO sometable SELECT theview; would not replicate row-based).
This is implemented by, after parsing a routine's body, remembering in sp_head
that this routine needs row-based binlogging. Then when this routine is used,
the caller is marked to require row-based binlogging too.
Same for views: when we parse a view and detect that its SELECT needs
row-based binary logging, we mark the calling LEX as such.
3) Fix for BUG#20499 "mixed mode with temporary table breaks binlog":
a temporary table containing e.g. UUID has its changes not binlogged,
so any query updating a permanent table with data from the temporary table
will run wrongly on slave. Solution: in mixed mode we don't switch back
from row-based to statement-based when there exists temporary tables.
4) Attempt to test mysqlbinlog on a binlog generated by mysqlbinlog;
impossible due to BUG#11312 and BUG#20329, but test is in place for when
they are fixed.
mysql-test/r/rpl_switch_stm_row_mixed.result:
testing BUG#19630 "stored function inserting into two auto_increment breaks
statement-based binlog",
testing BUG#20930 "Mixed binlogging mode does not work with stored functions,
triggers, views.
testing BUG#20499 "mixed mode with temporary table breaks binlog".
I have carefully checked this big result file, it is correct.
mysql-test/t/disabled.def:
re-enabling test
mysql-test/t/rpl_switch_stm_row_mixed.test:
Test for BUG#19630 "stored function inserting into two auto_increment breaks
statement-based binlog":
we test that it goes row-based, but only when needed;
without the bugfix, master and slave's data differed.
Test for BUG#20499 "mixed mode with temporary table breaks binlog":
without the bugfix, slave had 2 rows, not 3.
Test for BUG#20930 "Mixed binlogging mode does not work with stored
functions, triggers, views".
Making strings used more different, for easier tracking of "by which routine
was this binlog line generated".
Towards the end, an attempt to test mysqlbinlog on a binlog generated by
the mixed mode; attempt failed because of BUG#11312 and BUG#20929.
sql/item_create.cc:
fix for build without row-based replication
sql/set_var.cc:
cosmetic: in_sub_stmt is exactly meant to say if we are in stored
function/trigger, so better use it.
sql/sp.cc:
When a routine adds its tables to the top statement's tables, if this routine
needs row-based binlogging, mark the entire top statement as well.
Same for triggers.
Needed for making the mixed replication mode work with stored functions
and triggers.
sql/sp_head.cc:
new enum value for sp_head::m_flags, remembers if, when parsing the
routine, we found at least one element (UUID(), UDF) requiring row-based
binlogging.
sql/sp_head.h:
new enum value for sp_head::m_flags (see sp_head.cc).
An utility method, intended for attributes of a routine which need
to propagate upwards to the caller; so far only used for binlogging
information, but open to any other attribute.
sql/sql_base.cc:
For BUG#19630 "stored function inserting into two auto_increment
breaks statement-based binlog":
When we come to locking tables, we have collected all tables used by
functions, views and triggers, we detect if we're going to update two tables
having auto_increment columns. If yes, statement-based binlogging won't work
(Intvar_log_event records only one insert_id) so, if in mixed binlogging
mode, switch to row-based.
For making mixed mode work with stored functions using UUID/UDF:
when we come to locking tables, we have parsed the whole body so know if
some elements need row-based. Generation of row-based binlog events
depends on locked tables, so this is the good place to decide of the binlog
format.
sql/sql_class.h:
Fix for BUG#20499 "mixed mode with temporary table breaks binlog".
Making mixed mode work with stored functions/triggers: don't reset
back to statement-based if in executing a stored function/trigger.
sql/sql_lex.cc:
fix for build without row-based replication.
binlog_row_based_if_mixed moves from st_lex to Query_tables_list, because
that boolean should not be affected when a SELECT reads the INFORMATION_SCHEMA
and thus implicitely parses a view or routine's body: this body may
contain needing-row-based components like UUID() but the SELECT on
INFORMATION_SCHEMA should not be affected by that and should not use
row-based; as Query_tables_list is backed-up/reset/restored when parsing
the view/routine's body, so does binlog_row_based_if_mixed and the
top SELECT is not affected.
sql/sql_lex.h:
fix for build without row-based replication.
binlog_row_based_if_mixed moves from st_lex to Query_tables_list
(see sql_lex.cc)
sql/sql_parse.cc:
For the mixed mode to work with stored functions using UUID and UDF, we need
to move the switch-back-from-row-to-statement out of
mysql_execute_command() (which is executed for each statement, causing
the binlogging mode to change in the middle of the function, which would
not work)
The switch to row-based is now done in lock_tables(), no need to keep it
in mysql_execute_command(); in lock_tables() we also switch back from
row-based to statement-based (so in a stored procedure, all statements
have their binlogging mode). We must however keep a resetting in
mysql_reset_thd_for_next_command() as e.g. CREATE PROCEDURE does not call
lock_tables().
sql/sql_view.cc:
When a view's body needs row-based binlogging (e.g. the view is created
from SELECT UUID()), propagate this fact to the top st_lex.
sql/sql_yacc.yy:
use TRUE instead of 1, for binlog_row_based_if_mixed.
manual merge of 5.0 patch and fixing an issue with closing temp tables when no binlog or RBR.
Note, that despite temporary_tables is indeed double-linked list in 5.1 (patch for bug #19881) it is still enough to use only 'next' reference, as it was done for 5.0, when the list is sorted and
destoyed after.
mysql-test/r/rpl_temporary.result:
results changed
mysql-test/t/rpl_temporary.test:
fixing kill stmt for a thread with temp tables. Restoring check of temp table with accent char.
sql/sql_base.cc:
manual merge part 2. Leaving only extensively refactored close_temporary_tables from local rep.
mysql-test/r/ctype_utf8.result:
Auto merged
mysql-test/r/insert_select.result:
Auto merged
mysql-test/r/key.result:
Auto merged
mysql-test/r/view_grant.result:
Auto merged
mysql-test/t/key.test:
Auto merged
mysql-test/t/view_grant.test:
Auto merged
sql/field.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_select.cc:
Auto merged
Addendum fixes after changing the condition variable
for the global read lock.
The stress test suite revealed some deadlocks. Some were
related to the new condition variable (COND_global_read_lock)
and some were general problems with the global read lock.
It is now necessary to signal COND_global_read_lock whenever
COND_refresh is signalled.
We need to wait for the release of a global read lock if one
is set before every operation that requires a write lock.
But we must not wait if we have locked tables by LOCK TABLES.
After setting a global read lock a thread waits until all
write locks are released.
mysql-test/r/lock_multi.result:
Bug#16986 - Deadlock condition with MyISAM tables
Addendum fixes after changing the condition variable
for the global read lock.
Added test results.
mysql-test/t/lock_multi.test:
Bug#16986 - Deadlock condition with MyISAM tables
Addendum fixes after changing the condition variable
for the global read lock.
Added tests for possible deadlocks that did not occur
with the stress test suite.
mysys/thr_lock.c:
Bug#16986 - Deadlock condition with MyISAM tables
Addendum fixes after changing the condition variable
for the global read lock.
Added a protection against an infinite loop that occurs
with the test case for Bug #20662.
sql/lock.cc:
Bug#16986 - Deadlock condition with MyISAM tables
Addendum fixes after changing the condition variable
for the global read lock.
Signal COND_global_read_lock whenever COND_refresh
is signalled by using the new function broadcast_refresh().
Added the definition of a new function that signals
COND_global_read_lock whenever COND_refresh is signalled.
sql/mysql_priv.h:
Bug#16986 - Deadlock condition with MyISAM tables
Addendum fixes after changing the condition variable
for the global read lock.
Added a declaration for a new function that signals
COND_global_read_lock whenever COND_refresh is signalled.
sql/sql_base.cc:
Bug#16986 - Deadlock condition with MyISAM tables
Addendum fixes after changing the condition variable
for the global read lock.
Signal COND_global_read_lock whenever COND_refresh
is signalled by using the new function broadcast_refresh().
sql/sql_handler.cc:
Bug#16986 - Deadlock condition with MyISAM tables
Addendum fixes after changing the condition variable
for the global read lock.
Signal COND_global_read_lock whenever COND_refresh
is signalled by using the new function broadcast_refresh().
sql/sql_insert.cc:
Bug#16986 - Deadlock condition with MyISAM tables
Addendum fixes after changing the condition variable
for the global read lock.
Removed global read lock handling from inside of
INSERT DELAYED. It is handled on a higher level now.
sql/sql_parse.cc:
Bug#16986 - Deadlock condition with MyISAM tables
Addendum fixes after changing the condition variable
for the global read lock.
Wait for the release of a global read lock if one is set
before every operation that requires a write lock.
But don't wait if locked tables exist already.
sql/sql_table.cc:
Bug#16986 - Deadlock condition with MyISAM tables
Addendum fixes after changing the condition variable
for the global read lock.
Removed global read lock handling from inside of
CREATE TABLE. It is handled on a higher level now.
Signal COND_global_read_lock whenever COND_refresh
is signalled by using the new function broadcast_refresh().
schemas
The function check_one_table_access() called to check access to tables in
SELECT/INSERT/UPDATE was doing additional checks/modifications that don't hold
in the context of setup_tables_and_check_access().
That's why the check_one_table() was split into two : the functionality needed by
setup_tables_and_check_access() into check_single_table_access() and the rest of
the functionality stays in check_one_table_access() that is made to call the new
check_single_table_access() function.
mysql-test/r/view_grant.result:
Bug #20482: failure on Create join view with sources views/tables in different
schemas
- test suite for the bug
mysql-test/t/view_grant.test:
Bug #20482: failure on Create join view with sources views/tables in different
schemas
- test suite for the bug
sql/mysql_priv.h:
Bug #20482: failure on Create join view with sources views/tables in different
schemas
- check_one_table_access split into 2
sql/sql_base.cc:
Bug #20482: failure on Create join view with sources views/tables in different
schemas
- the new sub-function called
sql/sql_parse.cc:
Bug #20482: failure on Create join view with sources views/tables in different
schemas
- check_one_table_access() split into two : check_single_table_access() to
actually check access to the table(ro) and check_one_table_access() that calls
check_single_table_access() and checks also the tables belonging to sub selects
or implicitly opened tables.