if() treated any non-numeric string as false
Fixed to treat those as true instead
Added some test cases
Fixed missing $ in variable name in include/mix2.inc
Add code to waiting for a set of errors.
Add code to waiting for an error instead of waiting for io thread to stop, as
after 'START SLAVE', the status of io thread is still not running.
But it doesn't mean slave io thread encounters an error.
without FOR UPDATE is causing a lock".
SELECT statements with subqueries referencing InnoDB tables
were acquiring shared locks on rows in these tables when they
were executed in REPEATABLE-READ mode and with statement or
mixed mode binary logging turned on.
This was a regression which were introduced when fixing
bug 39843.
The problem was that for tables belonging to subqueries
parser set TL_READ_DEFAULT as a lock type. In cases when
statement/mixed binary logging at open_tables() time this
type of lock was converted to TL_READ_NO_INSERT lock at
open_tables() time and caused InnoDB engine to acquire
shared locks on reads from these tables. Although in some
cases such behavior was correct (e.g. for subqueries in
DELETE) in case of SELECT it has caused unnecessary locking.
This patch implements minimal version of the fix for the
specific problem described in the bug-report which supposed
to be not too risky for pushing into 5.1 tree.
The 5.5 tree already contains a more appropriate solution
which also addresses other related issues like bug 53921
"Wrong locks for SELECTs used stored functions may lead
to broken SBR".
This patch tries to solve the problem by ensuring that
TL_READ_DEFAULT lock which is set in the parser for
tables participating in subqueries at open_tables()
time is interpreted as TL_READ_NO_INSERT or TL_READ.
TL_READ is used only if we know that this is a SELECT
and that this particular table is not used by a stored
function.
Test coverage is added for both InnoDB and MyISAM.
This patch introduces an "incompatible" change in locking
scheme for subqueries used in SELECT ... FOR UPDATE and
SELECT .. IN SHARE MODE.
In 4.1 (as well as in 5.0 and 5.1 before fix for bug 39843)
the server would use a snapshot InnoDB read for subqueries
in SELECT FOR UPDATE and SELECT .. IN SHARE MODE statements,
regardless of whether the binary log is on or off.
If the user required a different type of read (i.e. locking
read), he/she could request so explicitly by providing FOR
UPDATE/IN SHARE MODE clause for each individual subquery.
The patch for bug 39843 broke this behaviour (which was not
documented or tested), and started to use locking reads for
all subqueries in SELECT ... FOR UPDATE/IN SHARE MODE.
This patch restores 4.1 behaviour.
This patch should be mostly null-merged into 5.5 tree.
mysql-test/include/check_concurrent_insert.inc:
Added auxiliary script which allows to check if statement
reading table allows concurrent inserts in it.
mysql-test/include/check_no_concurrent_insert.inc:
Added auxiliary script which allows to check that statement
reading table doesn't allow concurrent inserts in it.
mysql-test/include/check_no_row_lock.inc:
Added auxiliary script which allows to check if statement
reading table doesn't take locks on its rows.
mysql-test/include/check_shared_row_lock.inc:
Added auxiliary script which allows to check if statement
reading table takes shared locks on some of its rows.
mysql-test/r/bug39022.result:
After bug #46947 'Embedded SELECT without FOR UPDATE is
causing a lock' was fixed test case for bug 39022 has to
be adjusted in order to trigger execution path on which
original problem was encountered.
mysql-test/r/innodb_mysql_lock2.result:
Added coverage for handling of locking in various cases when
we read data from InnoDB tables (includes test case for
bug #46947 'Embedded SELECT without FOR UPDATE is causing a
lock').
mysql-test/r/lock_sync.result:
Added coverage for handling of locking in various cases when
we read data from MyISAM tables.
mysql-test/t/bug39022.test:
After bug #46947 'Embedded SELECT without FOR UPDATE is
causing a lock' was fixed test case for bug 39022 has to
be adjusted in order to trigger execution path on which
original problem was encountered.
mysql-test/t/innodb_mysql_lock2.test:
Added coverage for handling of locking in various cases when
we read data from InnoDB tables (includes test case for
bug #46947 'Embedded SELECT without FOR UPDATE is causing a
lock').
mysql-test/t/lock_sync.test:
Added coverage for handling of locking in various cases when
we read data from MyISAM tables.
sql/mysql_priv.h:
Function read_lock_type_for_table() now takes pointers to
LEX and TABLE_LIST elements as its arguments since to
correctly determine lock type it needs to know what
statement is being performed and whether table element for
which lock type to be determined belongs to prelocking list.
sql/sql_base.cc:
Changed read_lock_type_for_table() to return a weak TL_READ
type of lock in cases when we are executing SELECT (and so
won't update tables directly) and table doesn't belong to
statement's prelocking list and thus can't be used by a
stored function. It is OK to do so since in this case table
won't be used by statement or function call which will be
written to the binary log, so serializability requirements
for it can be relaxed.
One of results from this change is that SELECTs on InnoDB
tables no longer takes shared row locks for tables which
are used in subqueries (i.e. bug #46947 is fixed).
Another result is that for similar SELECTs on MyISAM tables
concurrent inserts are allowed.
In order to implement this change signature of
read_lock_type_for_table() function was changed to
take pointers to LEX and TABLE_LIST objects.
sql/sql_update.cc:
Function read_lock_type_for_table() now takes pointers to
LEX and TABLE_LIST elements as its arguments since to
correctly determine lock type it needs to know what
statement is being performed and whether table element for
which lock type to be determined belongs to prelocking list.
Some of the test cases reference to binlog position and
these position numbers are written into result explicitly.
It is difficult to maintain if log event format changes.
There are a couple of cases explicit position number appears,
we handle them in different ways
A. 'CHANGE MASTER ...' with MASTER_LOG_POS or/and RELAY_LOG_POS options
Use --replace_result to mask them.
B. 'SHOW BINLOG EVENT ...'
Replaced by show_binlog_events.inc or wait_for_binlog_event.inc.
show_binlog_events.inc file's function is enhanced by given
$binlog_file and $binlog_limit.
C. 'SHOW SLAVE STATUS', 'show_slave_status.inc' and 'show_slave_status2.inc'
For the test cases just care a few items in the result of 'SHOW SLAVE STATUS',
only the items related to each test case are showed.
'show_slave_status.inc' is rebuild, only the given items in $status_items
will be showed.
'check_slave_is_running.inc' and 'check_slave_no_error.inc'
and 'check_slave_param.inc' are auxiliary files helping
to show running status and error information easily.
mysql-test/extra/binlog_tests/binlog.test:
It only cares whether current binlog file index is changed, so it is ok
with 'show_master_status.inc' instead of 'show mater status'.
mysql-test/extra/binlog_tests/blackhole.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/extra/rpl_tests/rpl_deadlock.test:
Use 'check_slave_is_running.inc' instead of 'show_slave_status2.inc'.
mysql-test/extra/rpl_tests/rpl_extraMaster_Col.test:
Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/extra/rpl_tests/rpl_extraSlave_Col.test:
Use 'wait_for_slave_sql_error.inc' and 'ait_for_slave_sql_error_and_skip.inc' instead of 'show slave status'.
mysql-test/extra/rpl_tests/rpl_flsh_tbls.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/extra/rpl_tests/rpl_get_master_version_and_clock.test:
It is need now to give a error number, so use 'wait_for_slave_io_to_stop.inc'
instead of 'wait_for_slave_io_error.inc'.
mysql-test/extra/rpl_tests/rpl_insert_delayed.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/extra/rpl_tests/rpl_log.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
se 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/extra/rpl_tests/rpl_max_relay_size.test:
se 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/extra/rpl_tests/rpl_ndb_apply_status.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/extra/rpl_tests/rpl_reset_slave.test:
Use 'show_slave_status.inc' instead of 'show_slave_status2.inc' statement.
Use 'check_slave_no_error.inc' to simplify the check that there is no error.
mysql-test/extra/rpl_tests/rpl_row_basic.test:
Use 'check_slave_is_running.inc' to verify that Slave threads are running well.
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
mysql-test/extra/rpl_tests/rpl_row_tabledefs.test:
Use 'show_slave_error_status_and_skip.inc' instead of 'show slave status'.
mysql-test/include/check_slave_is_running.inc:
To make sure both sql and io thread are running well. If not, the test will be aborted.
mysql-test/include/check_slave_no_error.inc:
To make sure both sql and io thread have no error. If not, the test will be aborted.
mysql-test/include/get_relay_log_pos.inc:
According to the position of a log event in master binlog file,
find the peer position of a log event in relay log file.
mysql-test/include/rpl_stmt_seq.inc:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/include/show_binlog_events.inc:
Add two options $binlog_file and $binlog_limit for showing binlog events from different binlog files or/and given different limits on position or row number.
mysql-test/include/show_rpl_debug_info.inc:
Add 'SELECT NOW()' in the debug information.
mysql-test/include/show_slave_status.inc:
It's more clean and tidy Only the given columns of slave status are printed.
mysql-test/include/test_fieldsize.inc:
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
There is no need to print the result of 'show slave stutus'.
mysql-test/include/wait_for_binlog_event.inc:
Use show_rpl_debug_info.inc instead of 'SHOW BINLOG EVENTS'.
mysql-test/include/wait_for_slave_io_error.inc:
Add $slave_io_errno and $show_slave_io_error, it waits only a given error.
mysql-test/include/wait_for_slave_param.inc:
Use die instead of exit.
mysql-test/include/wait_for_slave_sql_error.inc:
Add $slave_sql_errno and $show_slave_sql_error, it waits only a given error.
mysql-test/include/wait_for_status_var.inc:
Use die instead of exit.
mysql-test/r/flush_block_commit_notembedded.result:
It checks whether somethings are binlogged, so we using 'show_binlog_event.inc' instead of 'show master status'.
mysql-test/r/multi_update.result:
It checks whether somethings are binlogged, so we using 'show_binlog_event.inc' instead of 'show master status'.
mysql-test/suite/binlog/r/binlog_innodb.result:
It checks whether somethings are binlogged, so we using 'show_binlog_event.inc' instead of 'show master status'.
mysql-test/suite/binlog/r/binlog_row_binlog.result:
Position in the result of 'show master status' is replaced by '#'.
mysql-test/suite/binlog/r/binlog_stm_binlog.result:
Position in the result of 'show master status' is replaced by '#'.
mysql-test/suite/binlog/t/binlog_innodb.test:
It checks whether somethings are binlogged, so we use 'show_binlog_event.inc' instead of 'show master status'.
mysql-test/suite/binlog/t/binlog_stm_binlog.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/bugs/r/rpl_bug36391.result:
Position in the result of 'show master status' is replaced by '#'.
mysql-test/suite/bugs/t/rpl_bug12691.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/bugs/t/rpl_bug36391.test:
'show master status' is replaced by 'show_master_status.inc'.
Position in the result of 'show master status' is replaced by '#'.
mysql-test/suite/engines/funcs/r/rpl_000015.result:
It checks whether somethings are binlogged,
so we using 'show_binlog_event.inc' instead of 'show master status'.
mysql-test/suite/engines/funcs/t/rpl_000015.test:
Use 'check_slave_is_running.inc' to verify that Slave threads are running well.
mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test:
Use 'query_vertical SHOW SLAVE STATUS' instead of 'show slave status'.
There is no status columns in the result file, for no slave exists on master's server.
mysql-test/suite/engines/funcs/t/rpl_change_master.test:
This test just care whether Read_Master_Log_Pos is equal to Exec_Master_Log_Pos after 'CHANGE MASTER ..'. So 'show slave status' is removed and just check the value of Read_Master_Log_Pos and Exec_Master_Log_Pos.
mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test:
We doesn't really need the statement.
mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test:
Just show Relay_Log_File, running status and error informations.
Use 'check_slave_is_running.inc' to verify that Slave threads are running well.
mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/engines/funcs/t/rpl_log_pos.test:
Mask the explicit positions in the result file.
Use 'check_slave_no_error.inc' to simplify the check that there is no error.
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
There is no need to print the result of 'show slave stutus'.
mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/engines/funcs/t/rpl_row_drop.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test:
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
There is no need to print the result of 'show slave stutus'.
mysql-test/suite/engines/funcs/t/rpl_row_until.test:
Use 'check_slave_param.inc' to check whether SQL Thread stop at a right position, and use binlog position variables instead of explicit number in the 'CHANGE MASTER' statements.
Mask the explicit binary log positions in the result file.
mysql-test/suite/engines/funcs/t/rpl_server_id1.test:
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
There is no need to print the result of 'show slave stutus'.
Use 'check_slave_no_error.inc' to simplify the check that there is no error.
mysql-test/suite/engines/funcs/t/rpl_server_id2.test:
It doesn't really need in this test.
mysql-test/suite/engines/funcs/t/rpl_slave_status.test:
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
There is no need to print the result of 'show slave stutus'.
mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/manual/t/rpl_replication_delay.test:
Use 'show_slave_status.inc' instead of 'show slave status'.
mysql-test/suite/parts/t/rpl_partition.test:
Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl/include/rpl_mixed_ddl.inc:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/include/rpl_mixed_dml.inc:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/t/rpl_000015.test:
Use 'show_slave_status.inc' instead of 'show_slave_status2.inc'.
mysql-test/suite/rpl/t/rpl_binlog_grant.test:
Use 'wait_for_binlog_event.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/t/rpl_bug33931.test:
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
There is no need to print the result of 'show slave stutus'.
mysql-test/suite/rpl/t/rpl_change_master.test:
This test just care whether Read_Master_Log_Pos is equal to Exec_Master_Log_Pos after 'CHANGE MASTER ..'. So 'show slave status' is removed and just check the value of Read_Master_Log_Pos and Exec_Master_Log_Pos.
mysql-test/suite/rpl/t/rpl_critical_errors.test:
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
There is no need to print the result of 'show slave stutus'.
mysql-test/suite/rpl/t/rpl_dual_pos_advance.test:
Mask the explicit position numbers in result file.
It is restricted running on SBR, for it want to binlog 'set @a=1' statement.
mysql-test/suite/rpl/t/rpl_empty_master_crash.test:
It doesn't need in this test.
mysql-test/suite/rpl/t/rpl_flushlog_loop.test:
UUse 'check_slave_is_running.inc' and 'show_slave_status.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl/t/rpl_get_master_version_and_clock.test:
Use 'wait_for_slave_io_error.inc' to wait the given io thread error happening.
mysql-test/suite/rpl/t/rpl_grant.test:
It doesn't need in this test.
mysql-test/suite/rpl/t/rpl_incident.test:
Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl/t/rpl_known_bugs_detection.test:
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
There is no need to print the result of 'show slave stutus'.
mysql-test/suite/rpl/t/rpl_loaddata_fatal.test:
Use 'wait_for_slave_sql_error_and_skip.inc' to wait the given sql thread error happening and then skip the event. There is no need to print the result of 'show slave stutus'.
mysql-test/suite/rpl/t/rpl_log_pos.test:
Use 'wait_for_slave_io_error.inc' to wait the given io thread error happening.
There is no need to print the result of 'show slave status'.
mysql-test/suite/rpl/t/rpl_rbr_to_sbr.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/t/rpl_replicate_do.test:
Use 'show_slave_status.inc' instead of 'show slave status'.
mysql-test/suite/rpl/t/rpl_rotate_logs.test:
Use 'show_slave_status.inc' instead of 'show_slave_status2.inc'.
mysql-test/suite/rpl/t/rpl_row_basic_11bugs.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/t/rpl_row_create_table.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/t/rpl_row_drop.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/t/rpl_row_until.test:
Use 'check_slave_param.inc' to check whether SQL Thread stop at a right position, and use binlog position variables instead of explicit number in the 'CHANGE MASTER' statements.
mysql-test/suite/rpl/t/rpl_skip_error.test:
Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl/t/rpl_slave_load_remove_tmpfile.test:
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
There is no need to print the result of 'show slave status'.
mysql-test/suite/rpl/t/rpl_slave_skip.test:
Use 'check_slave_param.inc' to check whether SQL Thread stop at a right position, and mask the explicit position number in the 'CHANGE MASTER' statements.
mysql-test/suite/rpl/t/rpl_sp.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/suite/rpl/t/rpl_ssl.test:
Use 'show_slave_status.inc' instead of 'show slave status'.
mysql-test/suite/rpl/t/rpl_ssl1.test:
Use 'show_slave_status.inc' instead of 'show slave status'.
mysql-test/suite/rpl/t/rpl_stm_until.test:
Use 'check_slave_param.inc' to check whether SQL Thread stop at a right position, and use binlog position variables instead of explicit number in the 'CHANGE MASTER' statements.
mysql-test/suite/rpl/t/rpl_temporary_errors.test:
Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl_ndb/t/rpl_ndb_basic.test:
Use 'wait_for_slave_sql_error.inc' to wait the given sql thread error happening.
There is no need to print the result of 'show slave status'.
mysql-test/suite/rpl_ndb/t/rpl_ndb_circular.test:
Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl_ndb/t/rpl_ndb_circular_simplex.test:
Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl_ndb/t/rpl_ndb_idempotent.test:
Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl_ndb/t/rpl_ndb_multi.test:
Mask master_log_pos and master_log_file
mysql-test/suite/rpl_ndb/t/rpl_ndb_sync.test:
Use 'check_slave_is_running.inc' instead of 'show slave status' statement.
mysql-test/suite/rpl_ndb/t/rpl_truncate_7ndb.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/t/alter_table-big.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/t/create-big.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/t/ctype_cp932_binlog_stm.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
mysql-test/t/flush_block_commit_notembedded.test:
It checks whether somethings are binlogged,
so we using 'show_binlog_event.inc' instead of 'show master status'.
mysql-test/t/multi_update.test:
It checks whether somethings are binlogged,
so we using 'wait_binlog_event.inc' instead of 'show master status'.
mysql-test/t/sp_trans_log.test:
Use 'show_binlog_events.inc' instead of 'show binlog events' statement.
they are ignored to a new test suite "innodb_plugin".
Remove a hack in mtr that was deployed to run the builtin InnoDB tests against
the InnoDB Plugin. Also detect if a test is an 'innodb plugin test' and if so
then transparently replace the builtin InnoDB with the InnoDB Plugin.
This has been back-ported from 6.0 as the problems proved to afflict
5.1 as well.
The fix exposed two new bugs. They were reported as follows.
Bug no 52174: Sometimes wrong plan when reading a MAX value
from non-NULL index
Bug no 52173: Reading NULL value from non-NULL index gives wrong
result in embedded server
Both bugs taken together affect a much smaller class of queries than #47762,
so the fix stays for now.
NULL column for NULL
The optimization to read MIN() and MAX() values from an
index did not properly handle comparisons with NULL
values. Fixed by giving up the particular optimization step
if there are non-NULL safe comparisons with NULL values, as
the result is NULL anyway.
Also, Oracle copyright notice was added to all files.
The problem is that not all column names retrieved from a SELECT
statement can be used as view column names due to length and format
restrictions. The server failed to properly check the conformity
of those automatically generated column names before storing the
final view definition on disk.
Since columns retrieved from a SELECT statement can be anything
ranging from functions to constants values of any format and length,
the solution is to rewrite to a pre-defined format any names that
are not acceptable as a view column name.
The name is rewritten to "Name_exp_%u" where %u translates to the
position of the column. To avoid this conversion scheme, define
explict names for the view columns via the column_list clause.
Also, aliases are now only generated for top level statements.
mysql-test/include/view_alias.inc:
Add test case for Bug#40277
mysql-test/r/compare.result:
Bug#40277: SHOW CREATE VIEW returns invalid SQL
mysql-test/r/group_by.result:
Bug#40277: SHOW CREATE VIEW returns invalid SQL
mysql-test/r/ps.result:
Bug#40277: SHOW CREATE VIEW returns invalid SQL
mysql-test/r/subselect.result:
Bug#40277: SHOW CREATE VIEW returns invalid SQL
mysql-test/r/subselect3.result:
Bug#40277: SHOW CREATE VIEW returns invalid SQL
mysql-test/r/type_datetime.result:
Bug#40277: SHOW CREATE VIEW returns invalid SQL
mysql-test/r/union.result:
Bug#40277: SHOW CREATE VIEW returns invalid SQL
mysql-test/r/view.result:
Add test case result for Bug#40277
mysql-test/r/view_alias.result:
Add test case result for Bug#40277
mysql-test/t/view_alias.test:
Add test case for Bug#40277
sql/sql_view.cc:
Check if auto generated column names are conforming. Also, the
make_unique_view_field_name function is not used as it uses the
original name to construct a new one, which does not work if the
name is invalid.
backporting of bug@30703 to 5.1.
The fixes are backed up with a regression test.
mysql-test/include/test_fieldsize.inc:
waiting to stop is to be actually exclusively for SQL thread.
mysql-test/suite/rpl/r/rpl_show_slave_running.result:
new results file is added.
mysql-test/suite/rpl/t/rpl_show_slave_running.test:
regression test for bug#30703 is added.
sql/mysqld.cc:
refining `show status like slave_running' handler to correspond to one of
`show slave status'.
sql/slave.cc:
A dbug-sync point is added to complement the regression test.
write()/read()
Sometimes stop/restart master or stop/restart salve can cause
network error, which can cause the 'invalid file descriptor
-1 in syscall write()/read()' warnings. All involved test
cases except rpl_slave_load_remove_tmpfile belong to the
kind of network error. So they are expected.
The 'rpl_slave_load_remove_tmpfile' belongs to file error,
but it is testing the file error as following code:
DBUG_EXECUTE_IF("remove_slave_load_file_before_write",
my_close(fd,MYF(0)); fd= -1; my_delete(fname, MYF(0)););
So it's expected too.
To fix the problem, add the valgrind warnings to the global
suppression list to suppress it.
mysql-test/include/mtr_warnings.sql:
Added code to suppress valgrind warnings: invalid file
descriptor -1 in syscall write()/read().
The test case rpl_binlog_corruption fails on windows because when
adding a line to the binary log index file it gets terminated
with a CR+LF (which btw, is the normal case in windows, but not on
Unixes - LF). This causes mismatch between the relay log names,
causing mysqld to report that it cannot find the log file.
We fix this by creating the instrumented index file through
mysql, ie, using SELECT ... INTO DUMPFILE ..., as opposed on
relying on ultimatly OS commands like: -- echo "..." >
index. These changes go into the file and make the procedure
platform independent:
include/setup_fake_relay_log.inc
Side note: when using SELECT ... INTO DUMPFILE ..., one needs to
check if mysqld is running with secure_file_priv. If it is, we do
it in two steps: 1. create the file on the allowed location;
2. move it to the datadir. If it is not, then we just create the
file directly on the datadir (so previous step 2. is not needed).
Manually deleteing one or more entries from 'master-bin.index', will
cause master infinitely loop to send one binlog file.
When starting a dump session, master opens index file and search the binlog file
which is being requested by the slave. The position of the binlog file in the
index file is recorded. it will be used to find the next binlog file when current
binlog file has dumped completely. As only the position is used, it may
not get the correct file if some entries has been removed manually from the index file.
the master will reopen the current binlog file which has been dump completely
and redump it if it can not get the next binlog file's name from index file.
It obviously is a logical error.
Even though it is allowed to manually change index file,
but it is not recommended. so after this patch, master
sends a fatal error to slave and close the dump session if a new binlog file
has been generated and master can not get it from the index file.
mysql-test/include/kill_query.inc:
Error 1034 can be generated when change MyISAM table indexes was interrupted
mysql-test/r/rpl_killed_ddl.result:
table t4 may not exists because the ALTER above was interrupted
mysql-test/t/rpl_killed_ddl.test:
table t4 may not exists because the ALTER above was interrupted
BUG#47983: rpl_extraColmaster_myisam failed in PB2 with "Found
warnings!!"
BUG 45214 fixed the case when get_master_version_and_clock
function, used by the slave, would not report errors. The slave
now detects them and if related to transient network failures, it
prints some warnings and retries to connect. On the other hand,
if not network related, it just gives up and fails.
As such, sometimes, in PB2, the slave comes across some transient
communication issues between master and slave, while calling
get_master_version_and_clock, causing warnings print outs to the
error log. Nevertheless, in such cases slave retries to connect,
in which it succeeds, and the test case continues as it normally
would. But then, at the end of a successful test run, MTR checks
the error log, finds the unexpected warnings and considers them
harmful. This causes MTR to report error and, consequently, PB2
to report a failing test.
We fix this by adding to the global warnings suppress list the
warnings related to transient network failures only, which are
reported while in function get_master_version_and_clock.
Problem 1:
column_priv_hash uses utf8_general_ci collation
for the key comparison. The key consists of user name,
db name and table name. Thus user with privileges on table t1
is able to perform the same operation on T1
(the similar situation with user name & db name, see acl_cache).
So collation which is used for column_priv_hash and acl_cache
should be case sensitive.
The fix:
replace system_charset_info with my_charset_utf8_bin for
column_priv_hash and acl_cache
Problem 2:
The same situation with proc_priv_hash, func_priv_hash,
the only difference is that Routine name is case insensitive.
So the fix is to use my_charset_utf8_bin for
proc_priv_hash & func_priv_hash and convert routine name into lower
case before writing the element into the hash and
before looking up the key.
Additional fix: mysql.procs_priv Routine_name field collation
is changed to utf8_general_ci.
It's necessary for REVOKE command
(to find a field by routine hash element values).
Note:
It's safe for lower-case-table-names mode too because
db name & table name are converted into lower case
(see GRANT_NAME::GRANT_NAME).
mysql-test/include/have_case_insensitive_fs.inc:
test case
mysql-test/r/case_insensitive_fs.require:
test case
mysql-test/r/grant_lowercase_fs.result:
test result
mysql-test/r/lowercase_fs_off.result:
test result
mysql-test/r/ps_grant.result:
test result
mysql-test/r/system_mysql_db.result:
changed Routine_name field collation to case insensitive
mysql-test/t/grant_lowercase_fs.test:
test case
mysql-test/t/lowercase_fs_off.test:
test case
scripts/mysql_system_tables.sql:
changed Routine_name field collation to case insensitive
scripts/mysql_system_tables_fix.sql:
changed Routine_name field collation to case insensitive
sql/sql_acl.cc:
Problem 1:
column_priv_hash uses utf8_general_ci collation
for the key comparison. The key consists of user name,
db name and table name. Thus user with privileges on table t1
is able to perform the same operation on T1
(the similar situation with user name & db name, see acl_cache).
So collation which is used for column_priv_hash and acl_cache
should be case sensitive.
The fix:
replace system_charset_info with my_charset_utf8_bin for
column_priv_hash and acl_cache
Problem 2:
The same situation with proc_priv_hash, func_priv_hash,
the only difference is that Routine name is case insensitive.
So the fix is to use my_charset_utf8_bin for
proc_priv_hash & func_priv_hash and convert routine name into lower
case before writing the element into the hash and
before looking up the key.
Additional fix: mysql.procs_priv Routine_name field collation
is changed to utf8_general_ci.
It's necessary for REVOKE command
(to find a field by routine hash element values).
Note:
It's safe for lower-case-table-names mode too because
db name & table name are converted into lower case
(see GRANT_NAME::GRANT_NAME).
- Remove the "hack" from mtr.pl that skipped searching for the .dll files
when embedded and windows. Now the variables will be preoperly initialized.
- Make the tests detect that they can't run on windows+embedded
Mask part of EXPLAIN output with '#' to account for varying row count estimation.
mysql-test/include/mix1.inc:
Mask 'rows' column in EXPLAIN output (number varies sometimes between 1 and 2).
mysql-test/r/innodb_mysql.result:
Update result file after masking of rows estimation in EXPLAIN output.
Backport from 6.0 to 5.1.
Only those sync points are included, which are used in debug_sync.test.
The Debug Sync Facility allows to place synchronization points
in the code:
open_tables(...)
DEBUG_SYNC(thd, "after_open_tables");
lock_tables(...)
When activated, a sync point can
- Send a signal and/or
- Wait for a signal
Nomenclature:
- signal: A value of a global variable that persists
until overwritten by a new signal. The global
variable can also be seen as a "signal post"
or "flag mast". Then the signal is what is
attached to the "signal post" or "flag mast".
- send a signal: Assign the value (the signal) to the global
variable ("set a flag") and broadcast a
global condition to wake those waiting for
a signal.
- wait for a signal: Loop over waiting for the global condition until
the global value matches the wait-for signal.
Please find more information in the top comment in debug_sync.cc
or in the worklog entry.
.bzrignore:
WL#4259 - Debug Sync Facility
Added the symbolic link libmysqld/debug_sync.cc.
CMakeLists.txt:
WL#4259 - Debug Sync Facility
Added definition for ENABLED_DEBUG_SYNC.
configure.in:
WL#4259 - Debug Sync Facility
Added definition for ENABLED_DEBUG_SYNC.
include/my_sys.h:
WL#4259 - Debug Sync Facility
Added definition for the DEBUG_SYNC_C macro.
libmysqld/CMakeLists.txt:
WL#4259 - Debug Sync Facility
Added sql/debug_sync.cc.
libmysqld/Makefile.am:
WL#4259 - Debug Sync Facility
Added sql/debug_sync.cc.
mysql-test/include/have_debug_sync.inc:
WL#4259 - Debug Sync Facility
New include file.
mysql-test/mysql-test-run.pl:
WL#4259 - Debug Sync Facility
Added option --debug_sync_timeout.
mysql-test/r/debug_sync.result:
WL#4259 - Debug Sync Facility
New test result.
mysql-test/r/have_debug_sync.require:
WL#4259 - Debug Sync Facility
New require file.
mysql-test/t/debug_sync.test:
WL#4259 - Debug Sync Facility
New test file.
mysys/my_static.c:
WL#4259 - Debug Sync Facility
Added definition for debug_sync_C_callback_ptr.
mysys/thr_lock.c:
WL#4259 - Debug Sync Facility
Added sync point "wait_for_lock".
sql/CMakeLists.txt:
WL#4259 - Debug Sync Facility
Added debug_sync.cc and debug_sync.h.
sql/Makefile.am:
WL#4259 - Debug Sync Facility
Added debug_sync.cc and debug_sync.h.
sql/debug_sync.cc:
WL#4259 - Debug Sync Facility
New source file.
sql/debug_sync.h:
WL#4259 - Debug Sync Facility
New header file.
sql/mysqld.cc:
WL#4259 - Debug Sync Facility
Added opt_debug_sync_timeout.
Added calls to debug_sync_init() and debug_sync_end().
Fixed a purecov comment (unrelated).
sql/set_var.cc:
WL#4259 - Debug Sync Facility
Added server variable "debug_sync".
sql/set_var.h:
WL#4259 - Debug Sync Facility
Added declaration for server variable "debug_sync".
sql/share/errmsg.txt:
WL#4259 - Debug Sync Facility
Added error messages ER_DEBUG_SYNC_TIMEOUT and ER_DEBUG_SYNC_HIT_LIMIT.
sql/sql_base.cc:
WL#4259 - Debug Sync Facility
Added sync points "after_flush_unlock" and "before_lock_tables_takes_lock".
sql/sql_class.cc:
WL#4259 - Debug Sync Facility
Added initialization for debug_sync_control to THD::THD.
Added calls to debug_sync_init_thread() and debug_sync_end_thread().
sql/sql_class.h:
WL#4259 - Debug Sync Facility
Added element debug_sync_control to THD.
storage/myisam/myisamchk.c:
Fixed a typo in an error message string (unrelated).
All statements executed by mysql_upgrade are binlogged and then are replicated to slave.
This will result in some errors. The report of this bug has demonstrated some examples.
Master and slave should be upgraded separately. All statements executed by
mysql_upgrade will not be binlogged.
--write-binlog and --skip-write-binlog options are added into mysql_upgrade.
These options control whether sql statements are binlogged or not.
Invalid (old?) table or database name in logs
Problem was still not completely fixed, due to
qouting.
This is the server side only fix (in explain_filename),
the change from filename_to_tablename to use explain_filename
in the InnoDB code must be done before the bug is
fixed.
mysql-test/include/have_not_innodb_plugin.inc:
Bug#32430: 'show innodb status' causes errors
Invalid (old?) table or database name in logs
Added include file to allow test for only the
'old' built-in innodb engine
mysql-test/r/not_true.require:
Bug#32430: 'show innodb status' causes errors
Invalid (old?) table or database name in logs
Added require to match 'not' TRUE
mysql-test/r/partition_innodb_builtin.result:
Bug#32430: 'show innodb status' causes errors
Invalid (old?) table or database name in logs
New result file for partitioning specific to
the 'old' built-in innodb engine
mysql-test/r/partition_innodb_plugin.result:
Bug#32430: 'show innodb status' causes errors
Invalid (old?) table or database name in logs
New result file for partitioning specific to
the new plugin innodb engine
mysql-test/t/disabled.def:
Bug#32430: 'show innodb status' causes errors
Invalid (old?) table or database name in logs
Disabling the new test until the fix is
included in the InnoDB source too.
mysql-test/t/partition_innodb_builtin.test:
Bug#32430: 'show innodb status' causes errors
Invalid (old?) table or database name in logs
New test file for partitioning specific to
the 'old' built-in innodb engine
mysql-test/t/partition_innodb_plugin.test:
Bug#32430: 'show innodb status' causes errors
Invalid (old?) table or database name in logs
New test file for partitioning specific to
the new plugin innodb engine
sql/mysql_priv.h:
Bug#32430: 'show innodb status' causes errors
Invalid (old?) table or database name in logs
Added thd as a parameter to explain_filename
to be able to use the correct quote character
sql/sql_table.cc:
Bug#32430: 'show innodb status' causes errors
Invalid (old?) table or database name in logs
Changed explain_filename, so that it does qouting
correctly according to the sessions qoute char.
The plugin feature is disabled, you need HAVE_DLOPEN
Selectively skip tests that require dynamic loading (ie: static builds).
mysql-test/include/have_dynamic_loading.inc:
Add require file.
mysql-test/t/ps_not_windows.test:
Test requires dynamic loading support.
binlog
Mixing transactional (T) and non-transactional (N) tables on behalf of a
transaction may lead to inconsistencies among masters and slaves in STATEMENT
mode. The problem stems from the fact that although modifications done to
non-transactional tables on behalf of a transaction become immediately visible
to other connections they do not immediately get to the binary log and therefore
consistency is broken. Although there may be issues in mixing T and M tables in
STATEMENT mode, there are safe combinations that clients find useful.
In this bug, we fix the following issue. Mixing N and T tables in multi-level
(e.g. a statement that fires a trigger) or multi-table table statements (e.g.
update t1, t2...) were not handled correctly. In such cases, it was not possible
to distinguish when a T table was updated if the sequence of changes was N and T.
In a nutshell, just the flag "modified_non_trans_table" was not enough to reflect
that both a N and T tables were changed. To circumvent this issue, we check if an
engine is registered in the handler's list and changed something which means that
a T table was modified.
Check WL 2687 for a full-fledged patch that will make the use of either the MIXED or
ROW modes completely safe.
mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result:
Truncate statement is wrapped in BEGIN/COMMIT.
mysql-test/suite/binlog/r/binlog_stm_mix_innodb_myisam.result:
Truncate statement is wrapped in BEGIN/COMMIT.