The problem was that the test was trying to obtain a lock on
a table in one connection without ensuring that a insert which
was executed in another connection had released the lock on the
same table.
The solution is to add a dummy select query after the insert to
ensure that the table is unlocked and closed by the time it tries
to lock it again. This is enough to prevent test failures described
in the bug report. As an extra safety measure, concurrent inserts
are disabled.
Remove comments that calculated the Table_locks_immediate. This
value is not tested anymore and it's calculation did not reflect
the actual value.
mysql-test/r/status.result:
Update test case result.
mysql-test/t/status.test:
Issue a dummy select to ensure that tables are unlocked after a
insert and disable concurrent inserts as a extra-safety.
The test failed originally -- did not reset binlogging - for the reason
identified by bug@15580.
However it never can be run on the embedded platfrom for yet another cause -
the embedded can not KILL query.
Comments added to the test particularly relating `reset master'
to the mentioned bug.
mysql-test/suite/binlog/t/binlog_killed.test:
adding commets explaining why the test has to have include/not_embedded.inc guard.
DBUG_EXECUTE_IF macro. The usage of the former caused breakage in other
trees as it got removed from the dbug library.
sql/sql_base.cc:
Rework code to remove unreliable usage of _db_script_keyword_.
mysql-test-run.pl --start-and-exit starts but does not exit
Instead, it hangs with ActiveState perl. The error is
believed to be a bug in ActiveState implementation.
Workaround is using POSIX::_exit, as described here
http://www.perlmonks.org/?node_id=334610
Thanks to Philip Stoev for the idea of the patch.
The '@' symbol can not be used in the host name according to rfc952.
The fix:
added function check_host_name(LEX_STRING *str)
which checks that all symbols in host name string are valid and
host name length is not more than max host name length
(just moved check_string_length() function from the parser into check_host_name()).
mysql-test/r/create.result:
test result
mysql-test/t/create.test:
test case
sql/mysql_priv.h:
added function check_host_name(LEX_STRING *str)
sql/sql_parse.cc:
added function check_host_name(LEX_STRING *str)
which checks that all symbols in host name string are valid and
host name length is not more than max host name length(HOSTNAME_LENGTH).
sql/sql_yacc.yy:
using newly added function check_host_name()
The problem:
I_S views table does not check the presence of SHOW_VIEW_ACL|SELECT_ACL
privileges for a view. It leads to discrepancy between SHOW CREATE VIEW
and I_S.VIEWS.
The fix:
added appropriate check.
mysql-test/r/information_schema_db.result:
test result
mysql-test/t/information_schema_db.test:
test case
sql/sql_show.cc:
The problem:
I_S views table does not check the presence of SHOW_VIEW_ACL|SELECT_ACL
privileges for a view. It leads to discrepancy between SHOW CREATE VIEW
and I_S.VIEWS.
The fix:
added appropriate check.
When analyzing the possible index use cases the server was re-using an internal structure.
This is wrong, as this internal structure gets updated during the analysis.
Fixed by making a copy of the internal structure for every place it needs to be used.
Also stopped the generation of empty SEL_TREE structures that unnecessary
complicate the analysis.
mysql-test/r/index_merge.result:
Bug#37943: test case
mysql-test/t/index_merge.test:
Bug#37943: test case
sql/opt_range.cc:
Bug#37943:
- Make copy constructors for SEL_TREE and sub-structures and use them when OR-ing trees.
- don't generate empty SEL_TREEs. Return NULL instead.
Re-enabling failing test case because server logs were lost in pushbuild, so we need to run it again.
mysql-test/suite/rpl/t/disabled.def:
Re-enabling failing test case because server logs were lost in pushbuild, so we need to run it again.
This patch contains fixes for two problems:
1. As originally reported, the server crashed on Mac OS X when trying to access
an EXAMPLE table after the EXAMPLE plugin was installed.
It turned out that the dynamically loaded EXAMPLE plugin called the
function hash_earch() from a Mac OS X system library, instead of
hash_earch() from MySQL's mysys library. Makefile.am in storage/example
does not include libmysys. So the Mac OS X linker arranged the hash_search()
function to be linked to the system library when the shared object is
loaded.
One possible solution would be to include libmysys into the linkage of
dynamic plugins. But then we must have a libmysys.so, which must be
used by the server too. This could have a minimal performance impact,
but foremost the change seems to bee too risky at the current state of
MySQL 5.1.
The selected solution is to rename MySQL's hash_search() to my_hash_search()
like it has been done before with hash_insert() and hash_reset().
Since this is the third time, we need to rename a hash_*() function,
I did renamed all hash_*() functions to my_hash_*().
To avoid changing a zillion calls to these functions, and announcing
this to hundreds of developers, I added defines that map the old names
to the new names.
This change is in hash.h and hash.c.
2. The other problem was improper implementation of the handlerton-to-plugin
mapping. We use a fixed-size array to hold a plugin reference for each
handlerton. On every install of a handler plugin, we allocated a new slot
of the array. On uninstall we did not free it. After some uninstall/install
cycles the array overflowed. We did not check for overflow.
One fix is to check for overflow to stop the crashes.
Another fix is to free the array slot at uninstall and search for a free slot
at plugin install.
This change is in handler.cc.
include/hash.h:
Bug#37958 - test main.plugin crash on Mac OS X when selecting from EXAMPLE engine.
Renamed hash_*() functions to my_hash_*().
Added defines that map old names to new names.
mysys/hash.c:
Bug#37958 - test main.plugin crash on Mac OS X when selecting from EXAMPLE engine.
Renamed hash_*() functions to my_hash_*().
sql/handler.cc:
Bug#37958 - test main.plugin crash on Mac OS X when selecting from EXAMPLE engine.
Protect against a failing ha_initialize_handlerton() in ha_finalize_handlerton().
Free hton2plugin slot on uninstall of a handler plugin.
Reuse freed slost of the hton2plugin array.
Protect against array overrun.
Link with mtmalloc on Solaris as it is done in our release builds.
Replace deprecated flag with the newer option as already done in
other scripts.
BUILD/compile-solaris-amd64-forte:
Link to mtmalloc and replace deprecated flag.
BUILD/compile-solaris-amd64-forte-debug:
Replace deprecated flag.
BUILD/compile-solaris-sparc:
Link to mtmalloc.
BUILD/compile-solaris-sparc-forte:
Link to mtmalloc
Post-merge bug fix: lock_type is a enumeration type and not a bit mask.
sql/sql_cache.cc:
Check for lock type explicitly. Also err on the safe side and
invalidate the query cache for any write lock.
Server created "arc" directories inside database directories and
maintained there useless copies of .frm files.
Creation and renaming procedures of those copies as well as
creation of "arc" directories has been discontinued.
Removal procedure has been kept untouched to be able to
cleanup existent database directories by the DROP DATABASE
query. Also view renaming procedure has been updated to remove
these directories.
sql/parse_file.cc:
Fixed bug #17823: 'arc' directories inside database directories.
View/table creation and renaming procedures maintained
backup copies of .frm files. Those copies are unused yet,
so this feature was incomplete and unnecessary.
1. Unwanted code has been hidden by FRM_ARCHIVE ifdefs
(the FRM_ARCHIVE macro is not defined).
2. Renaming procedure has been modified to remove obsolete
"arc" directories.
sql/parse_file.h:
Fixed bug #17823: 'arc' directories inside database directories.
The "thd" parameter has been added to the rename_in_schema_file()
function.
sql/sql_db.cc:
Fixed bug #17823: 'arc' directories inside database directories.
Scope of the mysql_rm_arc_files() function has been changed to
global for use from the parse_file.cc file.
sql/sql_view.cc:
Fixed bug #17823: 'arc' directories inside database directories.
Added the "thd" argument to rename_in_schema_file() calls.
JOIN for the subselect wasn't cleaned if we came upon an error
during sub_select() execution. That leads to the assertion failure
in close_thread_tables()
part of the 6.0 code backported
per-file comments:
mysql-test/r/sp-error.result
Bug#37949 Crash if argument to SP is a subquery that returns more than one row
test result
mysql-test/t/sp-error.test
Bug#37949 Crash if argument to SP is a subquery that returns more than one row
test case
sql/sp_head.cc
Bug#37949 Crash if argument to SP is a subquery that returns more than one row
lex->unit.cleanup() call added if not substatement
The problem is that when statement-based replication was enabled,
statements such as INSERT INTO .. SELECT FROM .. and CREATE TABLE
.. SELECT FROM need to grab a read lock on the source table that
does not permit concurrent inserts, which would in turn be denied
if the source table is a log table because log tables can't be
locked exclusively.
The solution is to not take such a lock when the source table is
a log table as it is unsafe to replicate log tables under statement
based replication. Furthermore, the read lock that does not permits
concurrent inserts is now only taken if statement-based replication
is enabled and if the source table is not a log table.
include/thr_lock.h:
Introduce yet another lock type that my get upgraded depending
on the binary log format. This is not a optimal solution but
can be easily improved later.
mysql-test/r/log_tables.result:
Add test case result for Bug#34306
mysql-test/suite/binlog/r/binlog_stm_row.result:
Add test case result for Bug#34306
mysql-test/suite/binlog/t/binlog_stm_row.test:
Add test case for Bug#34306
mysql-test/t/log_tables.test:
Add test case for Bug#34306
sql/lock.cc:
Assert that TL_READ_DEFAULT is not a real lock type.
sql/mysql_priv.h:
Export new function.
sql/mysqld.cc:
Remove using_update_log.
sql/sql_base.cc:
Introduce function that returns the appropriate read lock type
depending on how the statement is going to be replicated. It will
only take a TL_READ_NO_INSERT log if the binary is enabled and the
binary log format is statement-based and the table is not a log table.
sql/sql_parse.cc:
Remove using_update_log.
sql/sql_update.cc:
Use new function to choose read lock type.
sql/sql_yacc.yy:
The lock type is now decided at open_tables time. This old behavior was
actually misleading as the binary log format can be dynamically switched
and this would not change for statements that have already been parsed
when the binary log format is changed (ie: prepared statements).
In order to improve the performance when replicating to partitioned
myisam tables with row-based format, the number of rows of current
rows log event is estimated and used to setup storage engine for bulk
inserts.
Machines with hostname set to "localhost" cause uniqueness errors in
the SQL bootstrap data.
Now, insert zero lines for cases where the (lowercased) hostname is
the same as an already-inserted 'localhost' name. Also, fix a few tests
that expect certain local accounts to have a certain host name.