Commit graph

27652 commits

Author SHA1 Message Date
Georgi Kodinov
dd2e3db48f merge 2010-10-04 15:42:16 +03:00
Vasil Dimov
babfc48c6e Merge mysql-5.1-innodb -> mysql-5.1-bugteam 2010-10-04 14:26:56 +03:00
Marko Mäkelä
fe2ff69061 Merge Bug#56716 from 5.1 2010-10-04 13:38:05 +03:00
Marko Mäkelä
fe0b669416 Bug#56716 InnoDB locks a record gap without locking the table
row_search_for_mysql(): Acquire an intention lock on the table
before locking the first record gap.
2010-10-04 13:06:41 +03:00
Marko Mäkelä
484e61a778 Bug#56716 InnoDB locks a record gap without locking the table
row_search_for_mysql(): Acquire an intention lock on the table
before locking the first record gap.
2010-10-04 13:05:21 +03:00
Sergey Glukhov
fa97a2f1b7 result fix 2010-10-04 12:51:26 +04:00
Bjorn Munch
e688b6c299 merge from 5.5-mtr 2010-10-04 10:40:28 +02:00
Jon Olav Hauglid
c4a18b6af3 Bug #51099 Assertion in mysql_multi_delete_prepare()
This assert was triggered if DELETE was done on a view that
referenced another view which in turn (directly or indirectly)
referenced more than one table.

Delete from a view referencing more than one table (a join view)
is not supported and is supposed to give ER_VIEW_DELETE_MERGE_VIEW
error. Before this error was reported from the multi table 
delete code, an assert verified that the view from the DELETE statement
had more than one underlying table. However, this assert did not take
into account that the view could refer to another view which in turn
referenced the actual tables.

This patch fixes the problem by adjusting the assert to take this
possibility into account. This problem was only noticeable on debug
builds of the server. On release builds, ER_VIEW_DELETE_MERGE_VIEW
was correctly reported.

Test case added to delete.test.
2010-10-04 10:25:04 +02:00
Bjorn Munch
d1fb8a8606 Small test fix after 56753 2010-10-03 19:39:28 +02:00
Bjorn Munch
687696a97a merge from 5.1-mtr 2010-10-03 19:37:58 +02:00
Alexander Nozdrin
228b127d2e Auto-merge from mysql-5.5-bugteam. 2010-10-02 22:21:41 +04:00
Alexey Kopytov
49e715258f Manual merge from mysql-5.1-bugteam into mysql-5.5-bugteam.
conflicts:
   conflict      dbug/dbug.c
   conflict      sql/sql_load.cc
2010-10-02 00:12:27 +04:00
Alexey Kopytov
e1e838169a Automerge. 2010-10-01 23:56:55 +04:00
Mattias Jonsson
16076e6a6f Minor update of test to pass both with and without --ps-protocol 2010-10-01 21:32:40 +02:00
Mattias Jonsson
ac5a175b92 merge 2010-10-01 18:36:53 +02:00
Mattias Jonsson
c0c524c3c5 merge 2010-10-01 18:29:40 +02:00
Mattias Jonsson
790dd097c3 minor test result update after merge 2010-10-01 18:10:45 +02:00
Mattias Jonsson
a37418bc45 merge 2010-10-01 16:06:10 +02:00
Mattias Jonsson
199fb36567 Manual merge into mysql-5.5-bugteam 2010-10-01 15:59:07 +02:00
Mattias Jonsson
cddd0d685f merge 2010-10-01 15:41:27 +02:00
Vasil Dimov
66bde6c26b Merge mysql-5.5-innodb -> mysql-5.5-bugteam 2010-10-01 16:36:35 +03:00
Mattias Jonsson
141d83127d merge 2010-10-01 15:32:03 +02:00
Mattias Jonsson
1045f4526f merge 2010-10-01 15:25:13 +02:00
Vasil Dimov
1ca8c7b5ef Merge mysql-5.1-innodb -> mysql-5.1-bugteam 2010-10-01 15:39:44 +03:00
Mattias Jonsson
0ac0817348 Manual merge of bug#51851 from mysql-5.1-bugteam into mysql-5.5-bugteam 2010-10-01 14:16:00 +02:00
Mattias Jonsson
460fcf7c5e merge 2010-10-01 13:39:49 +02:00
Mattias Jonsson
a01773dbee Bug#51851: Server with SBR locks mutex twice on
LOAD DATA into partitioned MyISAM table

Problem was that both partitioning and myisam
used the same table_share->mutex for different protections
(auto inc and repair).

Solved by adding a specific mutex for the partitioning
auto_increment.

Also adding destroying the ha_data structure in
free_table_share (which is to be propagated
into 5.5).

This is a 5.1 ONLY patch, already fixed in 5.5+.
2010-10-01 13:39:04 +02:00
Mattias Jonsson
2a67a3a7f5 Bug#56172: Server crashes in ha_partition::reset on
REBUILD PARTITION under LOCK TABLE

Collapsed patch including updates from the reviews.

In case of failure in ALTER ... PARTITION under LOCK TABLE
the server could crash, due to it had modified the locked
table object, which was not reverted in case of failure,
resulting in a bad table definition used after the failed
command.

Solved by instead of altering the locked table object and
its partition_info struct, creating an internal temporary
intermediate table object used for altering,
just like the non partitioned mysql_alter_table.
So if an error occur before the alter operation is complete,
the original table is not modified at all.
But if the alter operation have succeeded so far that it
must be completed as whole,
the table is properly closed and reopened.
(The completion on failure is done by the ddl_log.)
2010-10-01 13:22:11 +02:00
Sergey Glukhov
86ef233232 Bug#54488 crash when using explain and prepared statements with subqueries
The crash happens because original join table is replaced with temporary table
at execution stage and later we attempt to use this temporary table in
select_describe. It might happen that
Item_subselect::update_used_tables() method which sets const_item flag
is not called by some reasons (no where/having conditon in subquery for example).
It prevents JOIN::join_tmp creation and breaks original join.
The fix is to call ::update_used_tables() before ::const_item() check.
2010-10-01 14:08:38 +04:00
Jon Olav Hauglid
fbfbc7ee9b Merge from mysql-5.5-runtime to mysql-5.5-bugteam. 2010-10-01 11:23:43 +02:00
Mattias Jonsson
d7bfd59a5a Bug#55458: Partitioned MyISAM table gets crashed by multi-table update
Bug#57113: ha_partition::extra(ha_extra_function):
            Assertion `m_extra_cache' failed

Fix for bug#55458 included DBUG_ASSERTS causing
debug builds of the server to crash on
another multi-table update.

Removed the asserts since they where wrong.
(updated after testing the patch in 5.5).
2010-09-30 15:57:33 +02:00
Bernt M. Johnsen
2dd56c26cb Bug#56375 Ignore socket path since it may vary. Added some comments to
inline perl in the test.
2010-09-30 15:52:39 +02:00
Dmitry Lenev
8322cad015 Reverted a temporary workaround for bug #56405 "Deadlock
in the MDL deadlock detector".

It is no longer needed as a better fix for this bug has
been pushed.
2010-09-30 17:29:12 +04:00
Georgi Kodinov
b2437d07e6 merge 2010-09-30 14:06:50 +03:00
Bjorn Munch
32da790381 upmerge 52828 2010-09-30 12:53:36 +02:00
Jon Olav Hauglid
a53f61e6e8 Merge from mysql-5.5-bugteam to mysql-5.5-runtime 2010-09-30 12:43:43 +02:00
Bjorn Munch
87234b74ca Bug #52828 Tests that use perl fail when perl is not in path
Trying to run perl fails, just like it does when perl is started but fails
Trap the case that perl was not found/could not be started, and skip test
Also force a restart of servers since test may already have done something
mtr now also appends path of current perl to PATH to aid mysqltest
2010-09-30 12:42:37 +02:00
Bjorn Munch
b094cad9b0 Small test fix after 56753 2010-09-30 10:28:22 +02:00
Georgi Kodinov
216418e7b2 merge 2010-09-29 17:26:32 +03:00
Georgi Kodinov
9d8098e0c6 merge 2010-09-29 14:48:57 +03:00
Bjorn Munch
de5390a5d1 merge from 5.5 2010-09-29 13:14:21 +02:00
Bjorn Munch
1a75a23ce1 merge from 5.1 2010-09-29 12:56:10 +02:00
Jon Olav Hauglid
4228b8bbdd Followup to Bug#46165 server crash in dbug
This patch moves the regression test from variables.test to
variables_debug.test as the debug system variable is not 
available on release builds.
2010-09-29 10:07:56 +02:00
Alexander Nozdrin
a79093cd94 Auto-merge from mysql-5.5-merge. 2010-09-28 19:15:58 +04:00
Bjorn Munch
cf362a41b9 upmerge 56125,56921 2010-09-28 16:00:11 +02:00
Bjorn Munch
f643d1b6d3 Bug #56125 MTR2 start-and-exit removes server tmpdir, server becomes not operational
This happens when creating new tmpdir due to too long socket path
Don't delete it if --start-and-exit, but warn user to do it.
2010-09-28 15:58:01 +02:00
Jon Olav Hauglid
92b247814a Bug #46165 server crash in dbug
This crash occured if the same debug trace file was closed twice,
leading to the same memory being free'd twice. This could occur
if the "debug" server system variable refered to the same trace
file in both global and session scope.

Example of an order of events that would lead to a crash:
1) Enable debug tracing to a trace file (global scope)
2) Enable debug tracing to the same trace file (session scope)
3) Reset debug settings (global scope)
4) Reset debug settings (session scope)

This caused a crash because the trace file was, by mistake, closed
in 3), leading to the same memory being free'd twice when the file
was closed again in 4).

Internally, the debug settings are stored in a stack, with session
settings (if any) on top and the global settings below. Each connection
has its own stack. When a set of settings is changed, it must be 
determined if its debug trace file is to be closed. Before, this was done
by only checking below on the settings stack. So if the global settings
were changed, an existing debug trace file reference in session settings
would be missed. This caused the file to be closed even if it was in use,
leading to a crash later when it was closed again.

This patch fixes the problem by preventing the trace file from being shared
between global and session settings. If session debug settings are set without
specifying a new trace file, stderr is used for output. This is a change
in behaviour and should be reflected in the documentation.

Test case added to variables.test.
2010-09-28 11:07:58 +02:00
Vasil Dimov
3a43a2e265 Merge mysql-5.5-bugfixing -> mysql-5.5-innodb 2010-09-28 09:40:57 +03:00
Vasil Dimov
7535f1eec9 Merge mysql-5.1-bugteam -> mysql-5.1-innodb 2010-09-28 09:38:33 +03:00
Marc Alff
6a707718b9 Added missing paterns 2010-09-27 18:23:54 -06:00
Sergey Vojtovich
19463ba418 WL#5496 - Plugin LOAD_OPTION in INFORMATION_SCHEMA.PLUGINS
This patch implements I_S.PLUGINS.LOAD_OPTION column
as specified by WL#5496.
2010-09-27 17:03:27 +04:00
Sergey Vojtovich
42d46376af WL#5341 - Sticky plugins
This patch implements "permanent" load option for
plugins as specified by WL#5341.
2010-09-27 16:55:09 +04:00
Bjorn Munch
3a404d4966 Bug #57036 Add checks in mysqltest that variables treated as ints are in fact ints
Adds boolean flag is_int and a separete function to check for int value
Added tests to mysqltest.test
2010-09-27 14:36:16 +02:00
Alexey Botchkov
4a2dd398e2 log_tables_debug.test fix.
per-file comments:
  mysql-test/t/log_tables_debug.test
        This test shouldn't be run at the embedded server.
2010-09-27 15:18:10 +05:00
Dmitry Lenev
afa568c24b Fix compile warning about passing NULL to non-pointer
argument of inline_mysql_mutex_init in sql_base.cc.

When initializing LOCK_dd_owns_lock_open mutex pass
correct PSI key instead of NULL value.
2010-09-24 20:26:24 +04:00
Konstantin Osipov
5b06699029 Merge 5.5 -> 5.5-merge. 2010-09-24 17:18:45 +04:00
Mattias Jonsson
3c8814cbc8 Bug#56659: Mismatch of CAPITAL vs small letters in "unified filelist" partitioning output
Update to previous patch according to reviewers comments.

Removing parts.partition_alter4_innodb from default.experimental
(Also closed bug#45299 as a duplicate of bug#56659 as a result of this.)
Adding run of tests requiring --big-test flag to default.weekly to keep the coverage.
2010-09-24 11:39:47 +02:00
Jon Olav Hauglid
11c4d8ba1f Bug #54920 Stored functions are allowed in HANDLER statements,
but broken.

Before this patch, it was allowed to use stored functions in
HANDLER ... READ statements. The problem was that this functionality
was not really supported by the code. Proper locking would for example
not be performed, and it was also possible to break replication by
having stored functions that performed updates.

This patch disallows the use of stored functions in HANDLER ... READ.
Any such statement will now give an ER_NOT_SUPPORTED_YET error.
This is an incompatible change and should be reflected in the
documentation.

Test case added to handler_myisam/handler_innodb.test.
2010-09-24 09:18:16 +02:00
Jon Olav Hauglid
4ecf1d32ac Merge from mysql-5.5-bugfixing to mysql-5.5-runtime. 2010-09-24 08:46:43 +02:00
Mats Kindahl
246b7b0b7d Merging into mysql-5.5-bugfixing. 2010-09-23 14:38:24 +02:00
Jon Olav Hauglid
9b9299f8d5 Followup to Bug #56422 CHECK TABLE run when the table is locked
reports corruption along with timeout

This patch updates the result file for the
parts.partition_special_innodb test case which was, by mistake,
not updated in the original patch.
2010-09-23 11:13:21 +02:00
Sergey Glukhov
5539072560 Bug#54494 crash with explain extended and prepared statements
In case of outer join and emtpy WHERE conditon
'always true' condition is created for WHERE clasue.
Later in mysql_select() original SELECT_LEX WHERE
condition is overwritten with created cond.
However SELECT_LEX condition is also used as inital
condition in mysql_select()->JOIN::prepare().
On second execution of PS modified SELECT_LEX condition
is taken and it leads to crash.
The fix is to restore original SELECT_LEX condition
(set to NULL if original cond is NULL) in
 reinit_stmt_before_use().
HAVING clause is fixed too for safety reason
(no test case as I did not manage to think out
 appropriate example).
2010-09-23 10:43:51 +04:00
Alexey Kopytov
a1f1e77c38 Bug #56709: Memory leaks at running the 5.1 test suite
Fixed a number of memory leaks discovered by valgrind.
2010-09-22 23:33:18 +04:00
Bjorn Munch
80d666bc21 Bug #56921 It should be possible to log connection statements in mysqltest
Added --enable-connect-log, somewhet similar to --enable-query-log
If query log is disabled, disable connect log too
Also some related cleanup in mysqltest.test: removing duplicate test loop
2010-09-22 10:57:10 +02:00
Jon Olav Hauglid
5d06dddff3 Bug #56494 Segfault in upgrade_shared_lock_to_exclusive() for
REPAIR of merge table
Bug #56422 CHECK TABLE run when the table is locked reports
           corruption along with timeout

The crash happened if a table maintenance statement (ANALYZE TABLE,
REPAIR TABLE, etc.) was executed on a MERGE table and opening and 
locking a child table failed. This could for example happen if a child
table did not exist or if a lock timeout happened while waiting for
a conflicting metadata lock to disappear.

Since opening and locking the MERGE table and its children failed,
the tables would be closed and the metadata locks released.
However, TABLE_LIST::table for the MERGE table would still be set,
with its value invalid since the tables had been closed.
This caused the table maintenance statement to try to continue
and upgrade the metadata lock on the MERGE table. But since the lock
already had been released, this caused a segfault.

This patch fixes the problem by setting TABLE_LIST::table to NULL 
if open_and_lock_tables() fails. This prevents maintenance
statements from continuing and trying to upgrade the metadata lock.

The patch includes a 5.5 version of the fix for
Bug #46339 crash on REPAIR TABLE merge table USE_FRM.
This bug caused REPAIR TABLE ... USE_FRM to give an assert 
when used on merge tables.

The patch also enables the CHECK TABLE statement for log tables.
Before, CHECK TABLE for log tables gave ER_CANT_LOCK_LOG_TABLE,
yet still counted the statement as successfully executed.
With the changes to table maintenance statement error handling
in this patch, CHECK TABLE would no longer be considered as
successful in this case. This would have caused upgrade scripts
to mistakenly think that the general and slow logs are corrupted
and have to be repaired. Enabling CHECK TABLES for log tables
prevents this from happening.

Finally, the patch changes the error message from "Corrupt" to
"Operation failed" for a number of issues not related to table
corruption. For example "Lock wait timeout exceeded" and 
"Deadlock found trying to get lock".

Test cases added to merge.test and check.test.
2010-09-22 10:15:41 +02:00
Ingo Struewing
386d50478c Bug#46339 - crash on REPAIR TABLE merge table USE_FRM
Merge from saved bundle.
2010-09-21 16:37:18 +02:00
Bjorn Munch
d7672f40be test fixes after 56753 2010-09-21 11:18:53 +02:00
Bjorn Munch
8102240ce9 test fixes after 56753 2010-09-21 11:16:20 +02:00
Georgi Kodinov
dc0b8f7ada merge of mysql-5.5 into mysql-5.5-wl1054 2010-09-20 17:17:32 +03:00
Georgi Kodinov
702d559fd5 Bug #56798 : Wrong credentials assigned when using a proxy user.
Fixed incorrect handling of user credentials when authenticating
via proxy user. Now the server will use the proxies user's 
access mask and host to update the security context runtime 
structure when logging in.

Fixed a compilation warning with the embedded library.

Fixed a crash when doing a second GRANT PROXY on ''@'' due to 
incomplete equality check logic.
2010-09-20 16:51:42 +03:00
Bjorn Munch
c8969a422c small test fix after 56753 2010-09-20 10:21:55 +02:00
Bjorn Munch
b10fe70cae Bug #56787 MTR completion report should be more informative
Added counts of skipped test, inclusing how many by test itself
Also fixed misspelling in the (hitherto unused) variable name
2010-09-20 10:12:39 +02:00
Bjorn Munch
0eaa320c2c upmerge 56753 2010-09-20 10:08:32 +02:00
Bjorn Munch
4d18d6e0cb merge from 5.5 2010-09-20 10:06:17 +02:00
Alfranio Correia
c316b68146 merge mysql-5.1-bugteam --> mysql-5.5-merge 2010-09-17 21:22:34 +01:00
Alfranio Correia
6baf9d5a61 merge mysql-5.1-bugteam (local) --> mysql-5.1-bugteam 2010-09-17 14:55:23 +01:00
Jimmy Yang
76ea88cdb6 Temporarily backout the Information Schema System Table Information Schema
interface related change, will put back in once gain approval.
2010-09-16 19:24:32 -07:00
Marc Alff
fd6497b3d8 Bug#56832 perfschema.server_init test output not consistent
Before this fix, the test output for perfschema.server_init would
vary between executions, because some of the objects tested were
not guaranteed to exist in all configurations / code paths.

This fix removes these weak tests.

Also, comments referring to abandonned code have been cleaned up.
2010-09-16 19:04:34 -06:00
Jon Olav Hauglid
1818165cdb Merge from mysql-5.5-bugfixing to mysql-5.5-runtime. 2010-09-16 16:16:29 +02:00
Dmitry Lenev
355b74d2a6 Fix for merge.test failures in mysql-5.5-runtime
tree for embedded server

Test case for bug #56251 "Deadlock with INSERT
DELAYED and MERGE tables" can't be run against
embedded server. Embedded server converts all
DELAYED INSERTs into ordinary INSERTs and this
test can't work properly if such conversion
happens.

Moved this test from merge.test to delayed.test
which is skipped if test suite is run with
--embedded-server option.
2010-09-16 18:06:46 +04:00
Sergey Glukhov
dcad3feb1c 5.1-bugteam->5.5-merge 2010-09-16 16:20:35 +04:00
Sergey Glukhov
86d7cbd450 Bug#50402 Optimizer producing wrong results when using Index Merge on InnoDB
Subselect executes twice, at JOIN::optimize stage
and at JOIN::execute stage. At optimize stage
Innodb prebuilt struct which is used for the
retrieval of column values is initialized in.
ha_innobase::index_read(), prebuilt->sql_stat_start is true.
After QUICK_ROR_INTERSECT_SELECT finished his job it
restores read_set/write_set bitmaps with initial values
and deactivates one of the handlers used by
QUICK_ROR_INTERSECT_SELECT in JOIN::cleanup
(it's the case when we reuse original handler as one of
 handlers required by QUICK_ROR_INTERSECT_SELECT object).
On second subselect execution inactive handler is activated
in  QUICK_RANGE_SELECT::reset, file->ha_index_init().
In ha_index_init Innodb prebuilt struct is reinitialized
with inappropriate read_set/write_set bitmaps. Further
reinitialization in ha_innobase::index_read() does not
happen as prebuilt->sql_stat_start is false.
It leads to partial retrieval of required field values
and we get a mix of field values from different records
in the record buffer.
The fix is to reset
read_set/write_set bitmaps as these values
are required for proper intialization of
internal InnoDB struct which is used for
the retrieval of column values
(see build_template(), ha_innodb.cc)
2010-09-16 16:13:53 +04:00
Magne Mahre
327eb7b680 Merge from 5.1-bugteam 2010-09-16 13:00:53 +02:00
Magne Mahre
f43d6c2b73 Bug #54606 innodb fast alter table + pack_keys=0 prevents
adding new indexes

A fast alter table requires that the existing (old) table
and indices are unchanged (i.e only new indices can be
added).  To verify this, the layout and flags of the old
table/indices are compared for equality with the new.

The PACK_KEYS option is a no-op in InnoDB, but the flag
exists, and is used in the table compare.  We need to
check this (table) option flag before deciding whether an 
index should be packed or not.  If the table has
explicitly set PACK_KEYS to 0, the created indices should
not be marked as packed/packable.
2010-09-16 12:51:08 +02:00
Jon Olav Hauglid
f14d947c98 Bug #56595 RENAME TABLE causes assert on OS X
The problem was that RENAME TABLE caused an assert if the system variable
lower_case_table_names was 2 (default on Mac OS X) and the old table name
was given in upper case. This caused lowercase_table2.test to fail.

The assert checks that an exclusive metadata lock is held by the connection
trying to do RENAME TABLE - specificially during updates of table triggers.
The assert was triggered since the check is case sensitive and the lock
was held on the normalized (lower case) version of the table name.

This patch fixes the problem by making sure a normalized version of the
table name is used for the metadata lock check, while using a non-normalized
version of the table name for the rename of trigger files. The same is done
for ALTER TABLE ... RENAME.

Regression testing for the bug itself is already covered by
lowercase_table2.test. Additional coverage added to lowercase_fs_off.test.
2010-09-16 11:11:13 +02:00
Marc Alff
2e4717ffcd Bug#56761 Segfault on CHECKSUM TABLE performance_schema.EVENTS_WAITS_HISTORY EXTENDED
Before this fix, the server could crash inside a memcpy when reading data
from the EVENTS_WAITS_CURRENT / HISTORY / HISTORY_LONG  tables.

The root cause is that the length used in a memcpy could be corrupted,
when another thread writes data in the wait record being read.
Reading unsafe data is ok, per design choice, and the code does sanitize
the data in general, but did not sanitize the length given to memcpy.

The fix is to also sanitize the schema name / object name / file name
length when extracting the data to produce a row.
2010-09-15 12:20:48 -06:00
Dmitry Lenev
6d5065a9f4 Fix for bug #56251 "Deadlock with INSERT DELAYED and MERGE
tables".

Attempting to issue an INSERT DELAYED statement for a MERGE
table might have caused a deadlock if it happened as part of
a transaction or under LOCK TABLES, and there was a concurrent
DDL or LOCK TABLES ... WRITE statement which tried to lock one
of its underlying tables.

The problem occurred when a delayed insert handler thread tried
to open a MERGE table and discovered that to do this it had also
to open all underlying tables and hence acquire metadata
locks on them. Since metadata locks on the underlying tables were
not pre-acquired by the connection thread executing INSERT DELAYED,
attempts to do so might lead to waiting. In this case the
connection thread had to wait for the delayed insert thread.
If the thread which was preventing the lock on the underlying table
from being acquired had to wait for the connection thread (due to
this or other metadata locks), a deadlock occurred. 
This deadlock was not detected by the MDL deadlock detector since 
waiting for the handler thread by the connection thread is not
represented in the wait-for graph.

This patch solves the problem by ensuring that the delayed
insert handler thread never tries to open underlying tables 
of a MERGE table. Instead open_tables() is aborted right after
the parent table is opened and a ER_DELAYED_NOT_SUPPORTED 
error is emitted (which is passed to the connection thread and
ultimately to the user).
2010-09-15 18:15:31 +04:00
Bjorn Munch
38604de3a0 Bug #56753 mtr silently ignores junk after backticks
When stepping backward to end of `` expression, check for illegal chars
2010-09-15 14:56:22 +02:00
Mattias Jonsson
bde21e5810 Bug#56659: Mismatch of CAPITAL vs small letters in "unified filelist" partitioning output
Bug#56657: Test still uses "--exec rm -f ..." which is non-portable
Bug#56601: Test uses Unix path for temporary file, fails, and writes misleading message

Several tests that was written in a non portable way (failed on windows)

Fixed by
1) backporting the fix for replace_result to also apply to list_files
(mysqltest from mysql-trunk)
2) replacing all #p#/#sp#/#tmp# to #P#/#SP#/#TMP#/
(innodb always converts filenames to lower case in windows).
3) replacing '--exec rm -f' with '--remove_files_wildcard'
4) replacing a perl snippet with '--write_file'
2010-09-15 10:22:12 +02:00
Marc Alff
3e70a34f30 Local merge 2010-09-14 15:40:50 -06:00
Mattias Jonsson
9cb34e683b post push patch, fixing test result for bug#53806/46754. 2010-09-14 10:56:11 +02:00
Marc Alff
651d597e2f Bug#53102 perfschema.pfs_upgrade fails when executed direct after mysql_upgrade
Implemented post review comments.

Added --force to the mysql_upgrade command in the test scripts,
so that the test output does not depends on whether other tests involving an
upgrade have been executed or not in the same test suite execution.
2010-09-13 17:19:39 -06:00
Mattias Jonsson
061769d7b6 merge 2010-09-13 16:07:50 +02:00
Mattias Jonsson
640454b373 merge 2010-09-13 15:56:56 +02:00
Mattias Jonsson
99e507e8a4 merge 2010-09-13 15:14:17 +02:00
Martin Hansson
c09489ebb2 Merge of fix for Bug#50394. 2010-09-13 14:46:55 +02:00
Martin Hansson
20bdf7636b Bug #50394: Regression in EXPLAIN with index scan, LIMIT, GROUP BY and
ORDER BY computed col
      
GROUP BY implies ORDER BY in the MySQL dialect of SQL. Therefore, when an
index on the first table in the query is used, and that index satisfies
ordering according to the GROUP BY clause, the query optimizer estimates the
number of tuples that need to be read from this index. If there is a LIMIT
clause, table statistics on tables following this 'sort table' are employed.

There may be a separate ORDER BY clause however, which mandates reading the
whole 'sort table' anyway. But the previous estimate was left untouched.

Fixed by removing the estimate from EXPLAIN output if GROUP BY is used in
conjunction with an ORDER BY clause that mandates using a temporary table.
2010-09-13 13:33:19 +02:00
Jon Olav Hauglid
20b7be9263 Bug #56448 Assertion failed: ! is_set() with second xa end
The problem was that issuing XA END when the XA transaction was
already ended, caused an assertion. This assertion tests that 
the server does not try to send OK to the client if there has
already been an error reported. The bug was only noticeable on
debug versions of the server.

The reason for the problem was that the trans_xa_end() function
reported success if the transaction was at XA_IDLE state at the
end regardless of any errors occured during processing of
trans_xa_end(). So if the transaction state was XA_IDLE already,
reported errors would be ignored.

This patch fixes the problem by having trans_xa_end() take into
consideration any reported errors. The patch also fixes a similar
bug with XA PREPARE.

Test case added to xa.test.
2010-09-13 13:31:22 +02:00
Gleb Shchepa
83c5552b4f manual merge 5.1-bugteam --> 5.5-merge (bug 55779) 2010-09-13 11:30:10 +04:00
Gleb Shchepa
79c1faa05e Bug #55779: select does not work properly in mysql server
Version "5.1.42 SUSE MySQL RPM"

When a query was using a DATE or DATETIME value formatted
using different formatting than "yyyy-mm-dd HH:MM:SS", a
query with a greater-or-equal '>=' condition matched only
greater values in an indexed TIMESTAMP column.

The problem was introduced by the fix for the bug 46362
and partially solved (for DATE and DATETIME columns only)
by the fix for the bug 47925.

The stored_field_cmp_to_item function has been modified
to take into account TIMESTAMP columns like we do for
DATE and DATETIME columns.
2010-09-13 11:18:35 +04:00
Joerg Bruehe
f6bddff896 Automerge (most) changes of the 5.5.6-rc release build to main 5.5.
This is not the final merge!
2010-09-10 20:48:13 +02:00
Alfranio Correia
b5bc68c524 merge mysql-5.1-security --> mysql-5.5-security
Disabled the test case.
2010-09-10 11:56:02 +01:00
Alfranio Correia
821ac1e933 BUG#55675 rpl.rpl_log_pos fails sporadically with error binlog truncated in the middle
Disabled the test case.
2010-09-10 11:49:57 +01:00
Mattias Jonsson
a30b3b43d6 merge 2010-09-10 11:52:35 +02:00
Mattias Jonsson
4770f8d415 merge 2010-09-10 11:50:38 +02:00
Bjorn Munch
d898106014 merge 55178,55413,56383 2010-09-10 09:59:40 +02:00
Bjorn Munch
4b1d6118e8 merge 55178,55413,56383 2010-09-10 09:58:26 +02:00
Jon Olav Hauglid
e01a1bfdb8 Merge from mysql-5.5-bugfixing to mysql-5.5-runtime. 2010-09-10 09:26:00 +02:00
Marc Alff
2779f0aad1 Bug#56324 Race Condition while shutting down MySQL: "PSI_server"
Before this fix, the server could crash during shutdown,
due to race conditions, that occured when killing the server.

In particular, the performance schema instrumentation handle,
PSI_server, and the performance schema itself would be cleaned up
too soon, causing race conditions with a running kill server thread.

The specifics of the race condition found are that:
the main thread executing "PSI_server= NULL" can cause crashes in
other threads still running, which are executing
"if (PSI_server != NULL) PSI_server->xxx()"
as part of the performance schema instrumentation.

While the bug was reported for the kill server thread,
in theory the same crash could happen with the signal thread,
as found by code analysis.

The correct fix would be to only shutdown the performance schema
and set PSI_server to NULL after every other thread is guaranteed
to be completed, including the kill_server_thread.

However, due to the existing mysqld server design, this is not the case.
See in particular bug number 56666.

The work around used to fix this race condition is to simply not
perform the call to shutdown_performance_schema() when the server exits,
and to keep the PSI_server pointer unchanged.

This will cause memory leaks to be reported by tools like valgrind,
but no memory leak actually happen because the process is about to exit().

As a result, the file mysql-test/valgrind.supp has been updated
to filter out these false positive messages.

This code has been tested with running in a loop the following
tests in parallel, which have been known to fail with race conditions
in the past:
- rpl_change_master
- binlog_max_extension
- events_restart
- rpl_heartbeat_basic
and no crash of test failure has been seen with the changed code.
2010-09-09 15:33:35 -06:00
Marc Alff
712a8a2eb9 local merge 2010-09-09 09:26:55 -06:00
Alexey Kopytov
637c7529de Manual merge of the fix for bug #54190 and the addendum patch
to 5.5 (removed one test case as it is no longer valid).
2010-09-09 19:00:33 +04:00
Dmitry Lenev
3326614df1 Fix for bug #55273 "FLUSH TABLE tm WITH READ LOCK for Merge
table causes assert failure".

Attempting to use FLUSH TABLE table_list WITH READ LOCK
statement for a MERGE table led to an assertion failure if
one of its children was not present in the list of tables
to be flushed. The problem was not visible in non-debug builds.

The assertion failure was caused by the fact that in such
situations FLUSH TABLES table_list WITH READ LOCK implementation
tried to use (e.g. lock) such child tables without acquiring
metadata lock on them. This happened because when opening tables
we assumed metadata locks on all tables were already acquired
earlier during statement execution and a such assumption was
false for MERGE children.

This patch fixes the problem by ensuring at open_tables() time
that we try to acquire metadata locks on all tables to be opened. 
For normal tables such requests are satisfied instantly since
locks are already acquired for them. For MERGE children metadata
locks are acquired in normal fashion.

Note that FLUSH TABLES merge_table WITH READ LOCK will lock for
read both the MERGE table and its children but will flush only 
the MERGE table. To flush children one has to mention them in table
list explicitly. This is expected behavior and it is consistent with
usage patterns for this statement (e.g. in mysqlhotcopy script).
2010-09-09 18:29:14 +04:00
Alexey Kopytov
df198b5f6a Automerge. 2010-09-09 16:48:06 +04:00
Alexey Kopytov
9066714c81 Bug #54190: Comparison to row subquery produces incorrect
result

Row subqueries producing no rows were not handled as UNKNOWN
values in row comparison expressions.

That was a result of the following two problems:

1. Item_singlerow_subselect did not mark the resulting row
value as NULL/UNKNOWN when no rows were produced.

2. Arg_comparator::compare_row() did not take into account that
a whole argument may be NULL rather than just individual scalar
values.

Before bug#34384 was fixed, the above problems were hidden
because an uninitialized (i.e. without any stored value) cached
object would appear as NULL for scalar values in a row subquery
returning an empty result. After the fix
Arg_comparator::compare_row() would try to evaluate
uninitialized cached objects.

Fixed by removing the aforementioned problems.
2010-09-09 16:46:13 +04:00
Ramil Kalimullin
5eb7154faa Automerge. 2010-09-09 16:43:45 +04:00
Evgeny Potemkin
89b53f9908 Auto-merged. 2010-09-09 16:02:02 +04:00
Ramil Kalimullin
9080f681b4 Fix for bug#56679: gis.test: valgrind error
Item_func_spatial_collection::fix_length_and_dec()
changed to use argument's print() method to print
the ER_ILLEGAL_VALUE_FOR_TYPE error.
2010-09-09 13:40:17 +04:00
Marc Alff
92c6d9fc75 Bug#56528 Increased server footprint with MTR
With recent changes in the performance schema default sizing parameters,
the memory used by a mysqld binary increased accordingly.

This negatively affects the MTR test suite,
because running several tests in parallel now consumes more ressources.

The fix is to leave the default production values unchanged,
and to configure the MTR environment to limit memory
used when running tests in the test suite, which is ok
because only a few objects are typically used within a test script.

This fix:
- changed the default configuration in MTR to use less memory
- adjusted the performance schema tests accordingly

Note that 1,000 mutex instances was too short and caused test failures
in the past in team trees, so the default used is now 10,000 in MTR.

The amount of memory used by the performance schema itself
can be observed with the statement SHOW ENGINE PERFORMANCE_SCHEMA STATUS
2010-09-08 12:01:12 -06:00
Jon Olav Hauglid
51a3375c98 Bug #56292 Deadlock with ALTER TABLE and MERGE tables
ALTER TABLE on a MERGE table could cause a deadlock with two
other connections if we reached a situation where:

1) A connection doing ALTER TABLE can't upgrade to MDL_EXCLUSIVE on the
parent table, but holds TL_READ_NO_INSERT on the child tables.
2) A connection doing DELETE on a child table can't get TL_WRITE on it
since ALTER TABLE holds TL_READ_NO_INSERT.
3) A connection doing SELECT on the parent table can't get TL_READ on 
the child tables since TL_WRITE is ahead in the lock queue, but holds
MDL_SHARED_READ on the parent table preventing ALTER TABLE from upgrading.

For regular tables, this deadlock is avoided by having ALTER TABLE
take a MDL_SHARED_NO_WRITE metadata lock on the table. This prevents
DELETE from acquiring MDL_SHARED_WRITE on the table before ALTER TABLE
tries to upgrade to MDL_EXCLUSIVE. In the example above, SELECT would
therefore not be blocked by the pending DELETE as DELETE would not be
able to enter TL_WRITE in the table lock queue.

This patch fixes the problem for merge tables by using the same metadata
lock type for child tables as for the parent table. The child tables will
in this case therefore be locked with MDL_SHARED_NO_WRITE, preventing
DELETE from acquiring a metadata lock and enter into the table lock queue.

Change in behavior: By taking the same metadata lock for child tables
as for the parent table, LOCK TABLE on the parent table will now also
implicitly lock the child tables. Since LOCK TABLE on the parent table
now takes more than one metadata lock, it is possible for LOCK TABLE
... WRITE on the parent table or child tables to give ER_LOCK_DEADLOCK
error.

Test case added to mdl_sync.test.
Merge.test/.result has been updated to reflect the change to LOCK TABLE.
2010-09-08 10:25:37 +02:00
Kristofer Pettersson
ccc7ae0e17 merge 5.1-security => 5.5-security 2010-09-08 09:36:39 +02:00
Sergey Vojtovich
f7da62d2ad main.gis-rtree, main.type_float and main.type_newdecimal
were marked as experimental due to BUG38965.
2010-09-08 00:16:10 +04:00
Kristofer Pettersson
dc285eb7cd Post fix following fix for bug55531: Disabling testcase for
bug 55568 because {1} isn't a valid geometry for a geometry
collection.
2010-09-07 15:43:00 +02:00
Kristofer Pettersson
3a643b0a34 Manual resolve of mysql-test/r/gis.result 2010-09-07 13:34:18 +02:00
Martin Hansson
06b70326ce Merge of fix for Bug#51070. 2010-09-07 12:17:12 +02:00
Kristofer Pettersson
5caea4a995 Bug#55531 crash with conversions of geometry types / strings
Convertion from a floating point number to a string caused a
crash.

During rare circumstances a String object could crash when
it was requested to allocate new memory.
A crash could occcur in Field_double::val_str() because of
a pointer referencing memory inside a String object which was
of unknown size.
And finally, the geometric collection should not accept
arguments which are non geometric.
2010-09-07 11:37:46 +02:00
Martin Hansson
babebf9ceb Bug#51070: Query with a NOT IN subquery predicate returns a wrong result set
The EXISTS transformation has additional switches to catch the known corner
cases that appear when transforming an IN predicate into EXISTS. Guarded
conditions are used which are deactivated when a NULL value is seen in the
outer expression's row. When the inner query block supplies NULL values,
however, they are filtered out because no distinction is made between the
guarded conditions; guarded NOT x IS NULL conditions in the HAVING clause that
filter out NULL values cannot be de-activated in isolation from those that
match values or from the outer expression or NULL's.

The above problem is handled by making the guarded conditions remember whether
they have rejected a NULL value or not, and index access methods are taking
this into account as well. 

The bug consisted of 

1) Not resetting the property for every nested loop iteration on the inner
   query's result.

2) Not propagating the NULL result properly from inner query to IN optimizer.

3) A hack that may or may not have been needed at some point. According to a
   comment it was aimed to fix #2 by returning NULL when FALSE was actually
   the result. This caused failures when #2 was properly fixed. The hack is
   now removed.

The fix resolves all three points.
2010-09-07 11:21:09 +02:00
Dmitry Shulga
417092560c Auto-merge from mysql-5.1-bugteam. 2010-09-07 16:00:41 +07:00
Dmitry Shulga
70807d1473 Fixed bug #55421 - Protocol::end_statement(): Assertion `0' on
multi-table UPDATE IGNORE.
The problem was that if there was an active SELECT statement
during trigger execution, an error risen during the execution
may cause a crash. The fix is to temporary reset LEX::current_select
before trigger execution and restore it afterwards. This way
errors risen during the trigger execution are processed as
if there was no active SELECT.
2010-09-07 15:53:46 +07:00
Martin Hansson
3825f36429 Merge of fix for Bug#54543. Test case only (bug is not present in this tree). 2010-09-07 10:00:52 +02:00
Martin Hansson
3d5b9792e6 Bug#54543: update ignore with incorrect subquery leads to assertion failure:
inited==INDEX

When an error occurs while sending the data in a temporary table there was no
cleanup performed. This caused a failed assertion in the case when different
access methods were used for populating the table vs. retrieving the data from
the table if IGNORE was specified and sql_safe_updates = 0. In this case
execution continues, but the handler expects to continue with the access
method used for row retrieval.

Fixed by doing the cleanup even if errors occur.
2010-09-07 09:58:05 +02:00
Evgeny Potemkin
e408bf4e14 Bug#56271: Wrong comparison result with STR_TO_DATE function
The Item_func_str_to_date class wasn't providing correct integer DATETIME
representation as expected. This led to wrong comparison result and didn't
allowed the STR_TO_DATE function to be used with indexes.
Also, STR_TO_DATE function was inconsisted on throwing warnings/errors.
Fixed now.

val_int and result_as_longlong methods were added to the Item_func_str_to_date
class.
2010-09-07 10:45:00 +04:00
Jimmy Yang
1566c3657e Port fix for bug #53756 from 5.1 built-in to 5.1 plugin. 2010-09-06 22:41:37 -07:00
Georgi Kodinov
1f84bb0c0f merge 2010-09-06 17:04:32 +02:00
Mats Kindahl
788d3c4518 Bug #55966: "plugin" tests fail in 5.5
On Solaris with version 3.4.6, the ha_example.so shared library is built
with DTrace and the server is built without DTrace support. This occurs
because dtrace.cmake disables DTrace support for 3.4.6, but still set
HAVE_DTRACE, which causes probes_mysql.h to include probes_mysql_dtrace.h
instead of probes_mysql_nodtrace.h.

This patch fixes this by not setting HAVE_DTRACE on Solaris for GCC 3.4.6.
2010-09-06 14:45:12 +02:00
Ramil Kalimullin
df798550cc Automerge. 2010-09-06 13:54:44 +04:00
Jon Olav Hauglid
dd4cd40a87 Merge from mysql-5.5-bugfixing to mysql-5.5-runtime. 2010-09-03 09:42:51 +02:00
Vladislav Vaintroub
08e1a5b770 Small fixes in CMake:
create data dir correctly in initial_database target on Windows
 handle case where INSTALL_MYSQLTESTDIR is empty (e.g someone does not want
 to install tests)
2010-09-03 00:17:08 +02:00
Georgi Kodinov
684c3e9e3d merge from 5.5-merge 2010-09-02 16:57:59 +03:00
Alfranio Correia
1ce9eb084f BUG#55961 Savepoint Identifier should be enclosed with backticks
Added backticks to the savepoint identifier.
2010-09-02 14:05:06 +01:00
Jimmy Yang
edbae904ff Merge from mysql-5.1-bugteam to mysql-5.1-security 2010-09-01 17:43:02 -07:00
Magne Mahre
24fc7ca4c8 Bug#39932 "create table fails if column for FK is in different
case than in corr index".
      
Server was unable to find existing or explicitly created supporting
index for foreign key if corresponding statement clause used field
names in case different than one used in key specification and created
yet another supporting index.
In cases when name of constraint (and thus name of generated index)
was the same as name of existing/explicitly created index this led
to duplicate key name error.
      
The problem was that unlike all other code Key_part_spec::operator==()
compared field names in case sensitive fashion. As result routines
responsible for getting rid of redundant generated supporting indexes
for foreign key were not working properly for versions of field names
using different cases.

(backported from mysql-trunk)
2010-09-01 19:38:34 +02:00
Bjorn Munch
4698ed2be8 upmerge 56383 2010-09-01 15:52:31 +02:00
Bjorn Munch
2154211192 merge from 5.5 2010-09-01 15:49:43 +02:00
Alexander Nozdrin
7405361bc3 Auto-merge from mysql-5.5. 2010-09-01 17:12:42 +04:00
Jon Olav Hauglid
370eaa56aa Merge from mysql-5.5-bugfixing to mysql-5.5-runtime. 2010-09-01 14:45:13 +02:00
Alexander Nozdrin
157f080614 Cherry-picking patch for Bug#55980.
Original changeset:
------------------------------------------------------------
revno: 3197
revision-id: alik@sun.com-20100831135426-h5a4s2w6ih1d8q2x
parent: magnus.blaudd@sun.com-20100830120632-u3xzy002mdwueli8
committer: Alexander Nozdrin <alik@sun.com>
branch nick: mysql-5.5-bugfixing
timestamp: Tue 2010-08-31 17:54:26 +0400
message:
  Bug#55980 Character sets: supplementary character _bin ordering is wrong
  
  Problem:
  - ORDER BY for utf8mb4_bin, utf16_bin and utf32_bin returned
    results in a wrong order, because old functions
    (supporting only BMP range) were used to handle these collations.
  - Additionally, utf16_bin did not sort supplementary characters
    between U+D700 and U+E000, as WL#1213 specification specified.
------------------------------------------------------------
2010-08-31 18:22:03 +04:00
Alexander Nozdrin
b75958e665 Disable mysqlhotcopy* test cases due to Bug 54129. 2010-08-31 18:05:35 +04:00
Alexander Nozdrin
8da22a75f3 Bug#55980 Character sets: supplementary character _bin ordering is wrong
Problem:
- ORDER BY for utf8mb4_bin, utf16_bin and utf32_bin returned
  results in a wrong order, because old functions
  (supporting only BMP range) were used to handle these collations.
- Additionally, utf16_bin did not sort supplementary characters
  between U+D700 and U+E000, as WL#1213 specification specified.
2010-08-31 17:54:26 +04:00
Alexander Nozdrin
55c1da5a7e Cherry-picking patch for Bug#56137 from mysql-5.5-runtime.
------------------------------------------------------------
revno: 3124
revision-id: dlenev@mysql.com-20100831090419-rzr5ktekby2gspm1
parent: alik@sun.com-20100827083901-x4wvtc10u9p7gcs9
committer: Dmitry Lenev <dlenev@mysql.com>
branch nick: mysql-5.5-rt-56137
timestamp: Tue 2010-08-31 13:04:19 +0400
message:
  Bug #56137 "Assertion `thd->lock == 0' failed on upgrading 
  from 5.1.50 to 5.5.6".
  
  Debug builds of the server aborted due to an assertion
  failure when DROP DATABASE statement was run on an
  installation which had outdated or corrupt mysql.proc table.
  Particularly this affected the mysql_upgrade tool which is
  run as part of 5.1 to 5.5 upgrade.
  
  The problem was that sp_drop_db_routines(), which was invoked
  during dropping of the database, could have returned without
  closing and unlocking mysql.proc table in cases when this
  table was not up-to-date with the current server. As a result
  further attempt to open and lock the mysql.event table, which
  was necessary to complete dropping of the database, ended up
  with an assert.
  
  This patch solves this problem by ensuring that
  sp_drop_db_routines() always closes mysql.proc table and
  releases metadata locks on it. This is achieved by changing
  open_proc_table_for_update() function to close tables and
  release metadata locks acquired by it in case of failure.
  This step also makes behavior of the latter function
  consistent with behavior of open_proc_table_for_read()/
  open_and_lock_tables().
  
  
  Test case for this bug was added to sp-destruct.test.
------------------------------------------------------------
2010-08-31 17:49:41 +04:00
Alexander Nozdrin
00eb62847d Cherry-pick patch for Bug#56120 from mysql-5.5-bugfixing. 2010-08-31 17:47:10 +04:00
Bjorn Munch
e59b1980e6 Bug #56383 provide option to restart mysqld after each mtr test
Added --force-restart
2010-08-31 11:27:57 +02:00
Dmitry Lenev
26bc3b34d5 Bug #56137 "Assertion `thd->lock == 0' failed on upgrading
from 5.1.50 to 5.5.6".

Debug builds of the server aborted due to an assertion
failure when DROP DATABASE statement was run on an
installation which had outdated or corrupt mysql.proc table.
Particularly this affected the mysql_upgrade tool which is
run as part of 5.1 to 5.5 upgrade.

The problem was that sp_drop_db_routines(), which was invoked
during dropping of the database, could have returned without
closing and unlocking mysql.proc table in cases when this
table was not up-to-date with the current server. As a result
further attempt to open and lock the mysql.event table, which
was necessary to complete dropping of the database, ended up
with an assert.

This patch solves this problem by ensuring that
sp_drop_db_routines() always closes mysql.proc table and
releases metadata locks on it. This is achieved by changing
open_proc_table_for_update() function to close tables and
release metadata locks acquired by it in case of failure.
This step also makes behavior of the latter function
consistent with behavior of open_proc_table_for_read()/
open_and_lock_tables().


Test case for this bug was added to sp-destruct.test.
2010-08-31 13:04:19 +04:00
Alexander Nozdrin
e4a7db6c67 Auto-merge from mysql-5.5-merge. 2010-08-31 11:55:41 +04:00
Gleb Shchepa
4c47c78c41 automerge 5.1-bugteam --> 5.5-merge (bug 53034) 2010-08-31 02:22:01 +04:00
Gleb Shchepa
9554b7ac6e Bug #53034: Multiple-table DELETE statements not accepting
"Access compatibility" syntax

The "wild" "DELETE FROM table_name.* ... USING ..." syntax
for multi-table DELETE statements is documented but it was
lost in the fix for the bug 30234.

The table_ident_opt_wild parser rule has been added
to restore the lost syntax.
2010-08-31 02:16:38 +04:00
Mattias Jonsson
e7dc80b807 Bug#50036: Inconsistent errors when using TIMESTAMP columns/expressions
It was hard to understand what the error really meant.

The error checking in partitioning is done in several different
parts during the execution of a query which can make it
hard to return useful errors.

Added a new error for bad VALUES part in the per PARTITION clause.
Using the more verbose error that a column is not allowed in
the partitioning function instead of just that the function is
not allowed.
2010-08-30 17:33:55 +02:00
Alexander Nozdrin
dc195adf34 Auto-merge from mysql-5.5-merge. 2010-08-30 18:07:40 +04:00
Bjorn Munch
8ee29b7e6a upmerge 55178,55413 2010-08-30 15:19:46 +02:00
Bjorn Munch
c3f69b4191 merge 55413 2010-08-30 11:26:40 +02:00
Bjorn Munch
fd9b6b8e07 Bug #55178 Set timeout on test-to-test-basis
Allow --testcase-timeout=<mins> to be set in .opt file for test
2010-08-30 11:25:10 +02:00
Dmitry Shulga
05482f3c7b Follow-up for Bug#29751: FLUSH LOGS doesn't create -old file,
so test case has to be updated.
2010-08-30 16:09:28 +07:00
Alexander Nozdrin
862af4eeaa Auto-merge from mysql-5.5. 2010-08-30 12:36:02 +04:00
Alexander Nozdrin
a87059b940 Disable 'plugin*' tests due to Bug 55966. 2010-08-30 12:32:53 +04:00
Alexander Nozdrin
2c89cb23af Auto-merge from mysql-5.5-bugfixing. 2010-08-30 12:27:27 +04:00
Ramil Kalimullin
03d0aedd8e Automerge. 2010-08-30 12:08:28 +04:00
Ramil Kalimullin
9c6143ef80 Fix for bug #51875: crash when loading data into geometry function polyfromwkb
Check for number of line strings in the incoming polygon data (wkb) and
for number of points in the incoming linestring wkb.
2010-08-30 11:51:46 +04:00
Alexey Kopytov
0a95aff58a Automerge. 2010-08-30 11:36:04 +04:00
Alexey Kopytov
d5b40686b0 Automerge. 2010-08-30 11:19:09 +04:00
0688c086a0 Bug #54579 Wrong unsafe warning for INSERT DELAYED in SBR
The lock_type is upgrade to TL_WRITE from TL_WRITE_DELAYED for
INSERT DELAYED when inserting multi values in one statement.
It's safe. But it causes an unsafe warning in SBR.
      
Make INSERT DELAYED safe by logging it as INSERT without DELAYED.
2010-08-30 14:03:28 +08:00
Alexander Nozdrin
19908377b8 Update result files. 2010-08-28 20:36:17 +04:00
Vasil Dimov
74c32d69b0 Merge mysql-5.1-innodb -> mysql-5.1-bugteam 2010-08-28 00:58:46 +03:00
Marc Alff
7357081989 local merge 2010-08-27 15:23:37 -06:00
Sergey Vojtovich
ab2414577a Merge 5.1-bugteam to 5.5-merge. 2010-08-27 15:33:32 +04:00
Alexey Kopytov
b409a2218e Bug #54465: assert: field_types == 0 || field_types[field_pos]
== MYSQL_TYPE_LONGLONG

A MIN/MAX() function with a subquery as its argument could lead
to a debug assertion on debug builds or wrong data on release
ones.

The problem was a combination of the following factors:

- Item_sum_hybrid::fix_fields() might use the argument
(args[0]) to calculate 'hybrid_field_type' which was later used
to decide how the data should be sent to the client.

- Item_sum::make_field() might use the argument again to
calculate the field's type when sending result set metadata to
the client.

- The argument could be changed in between these two calls via
  Item::set_arg() leading to inconsistent metadata being
  reported.

Here is what was happening for the bug's test case:

1. Item_sum_hybrid::fix_fields() calculates hybrid_field_type
as MYSQL_TYPE_LONGLONG based on args[0] which is an
Item::SUBSELECT_ITEM at that time.

2. A temporary table is created to execute the
query. create_tmp_field_from_item() creates a Field_long object
according to the subselect's max_length.

3. The subselect item in Item_sum_hybrid is replaced by the
Item_field object referencing the newly created Field_long.

4. Item_sum::make_field() rightfully returns the
MYSQL_TYPE_LONG type when calculating the result set metadata.

5. When sending the actual data, Item::send() relies on the
virtual field_type() function which in our case returns
previously calculated hybrid_field_type == MYSQL_TYPE_LONGLONG.

It looks like the only solution is to never refer to the
argument's metadata after the result metadata has been
calculated in fix_fields(), since the argument itself may be
different by then. In this sense, Item_sum::make_field() should
never be used, because it may rely on the argument's metadata
and is only called after fix_fields(). The "default"
implementation in Item::make_field() should be used instead as
it relies only on field_type(), but not on the argument's type.

Fixed by removing Item_sum::make_field() so that the superclass
implementation Item::make_field() is always used.
2010-08-27 13:44:35 +04:00
Mattias Jonsson
380c9d0dae Bug#53806: Wrong estimates for range query in partitioned MyISAM table
Bug#46754: 'rows' field doesn't reflect partition pruning
  
Update of test results after fixing the above bugs.
(fix in separate commit).
2010-08-27 10:43:51 +02:00
Marc Alff
fe3221d6a9 local merge 2010-08-26 15:21:23 -06:00
Alexander Nozdrin
c88cfec29c Enable plugin tests (Bug 55966) to check if they still fail. 2010-08-26 19:29:44 +04:00
Mattias Jonsson
50150fd66a Bug#53806: Wrong estimates for range query in partitioned MyISAM table
Bug#46754: 'rows' field doesn't reflect partition pruning

The EXPLAIN's result in 'rows' field
was evaluated to number of rows when the table was opened
(not from the table cache) and only the partitions left
after pruning was updated with its correct number
of rows.

The evaluation of the 'rows' field was using handler::records()
which is a potentially expensive call, and ignores the partitioning
pruning.

The fix was to use the handlers stats.records after updating it
with ::info(HA_STATUS_VARIABLE) instead.
2010-08-26 17:14:18 +02:00
Marc Alff
81cdce4d22 local merge 2010-08-26 08:41:24 -06:00
Alexey Kopytov
2df3a61c3f Automerge. 2010-08-26 16:36:48 +04:00
Alexander Barkov
3509fecfc1 Bug#42511 mysqld: ctype-ucs2.c:2044: my_strnncollsp_utf32: Assertion (tlen % 4) == 0' fai
Problem: trailing spaces were stripped using 8-bit code,
so the truncation result length was incorrect, which led
to an assertion failure.
Fix: using multi-byte safe code.
2010-08-26 16:36:33 +04:00
Alexey Kopytov
d39dbd1084 Automerge. 2010-08-26 16:35:38 +04:00
Sergey Vojtovich
0648087ca0 Fixed race condition in a test case for BUG#55580. 2010-08-26 15:23:44 +04:00
Alexey Kopytov
d63b9feb10 Automerge. 2010-08-26 14:17:27 +04:00
Alexey Kopytov
6c6a3e8f44 Bug #53544: Server hangs during JOIN query in stored procedure
called twice in a row

Queries with nested joins could cause an infinite loop in the
server when used from SP/PS.

When flattening nested joins, simplify_joins() tracks if the
name resolution list needs to be updated by setting
fix_name_res to TRUE if the current loop iteration has done any
transformations to the join table list. The problem was that
the flag was not reset before the next loop iteration leading
to unnecessary "fixing" of the name resolution list which in
turn could lead to a loop (i.e. circularly-linked part) in that
list. This was causing problems on subsequent execution when
used together with stored procedures or prepared statements.

Fixed by making sure fix_name_res is reset on every loop
iteration.
2010-08-26 14:13:02 +04:00
Evgeny Potemkin
151af144ff Bug #55656: mysqldump can be slower after bug 39653 fix.
After fix for bug 39653 the shortest available secondary index was used for
full table scan. Primary clustered key was used only if no secondary index
can be used. However, when chosen secondary index includes all fields of the
table being scanned it's better to use primary index since the amount of
data to scan is the same but the primary index is clustered.
Now the find_shortest_key function takes this into account.
2010-08-26 13:31:04 +04:00
Marc Alff
4c2de881de Bug#55873 short startup options do not work in 5.5
Before this fix, the server did not recognize 'short' (as in -a)
options but only 'long' (as in --ansi) options
in the startup command line, due to earlier changes in 5.5
introduced for the performance schema.

The root cause is that handle_options() did not honor the
my_getopt_skip_unknown flag when parsing 'short' options.

The fix changes handle_options(), so that my_getopt_skip_unknown is
honored in all cases.

Note that there are limitations to this,
see the added doxygen documentation in handle_options().

The current usage of handle_options() by the server to
parse early performance schema options fits within the limitations.
This has been enforced by an assert for PARSE_EARLY options, for safety.
2010-08-25 18:59:28 -06:00
Marc Alff
b4dd6de474 Bug#52312 lost Handler_read_last status variable
Before this fix, the ha_read_last_count status variable was defined and
updated internally, for never exposed as a system variable.

This fix exposes the system variable as "Handler_read_last",
for completness of the Handler_read_* system variables interface.

Adjusted tests results accordingly.
2010-08-25 13:00:38 -06:00
Alexey Kopytov
df389d0135 Bug#55077: Assertion failed: width > 0 && to != ((void *)0),
file .\dtoa.c

The assertion failure was correct because the 'width' argument
of my_gcvt() has the signed integer type, whereas the unsigned
value UINT_MAX32 was being passed by the caller
(Field_double::val_str()) leading to a negative width in
my_gcvt().

The following chain of problems was found by further analysis:

1. The display width for a floating point number is calculated
in Field_double::val_str() as either field_length or the
maximum possible length of string representation of a floating
point number, whichever is greater. Since in the bug's test
case field_length is UINT_MAX32, we get the same value as the
display width. This does not make any sense because for numeric
values field_length only matters for ZEROFILL columns,
otherwise it does not make sense to allocate that much memory
just to print a number. Field_float::val_str() has a similar
problem.

2. Even if the above wasn't the case, we would still get a
crash on a slightly different test case when trying to allocate
UINT_MAX32 bytes with String::alloc() because the latter does
not handle such large input values correctly due to alignment
overflows.

3. Even when String::alloc() is fixed to return an error when
an alignment overflow occurs, there is still a problem because
almost no callers check its return value, and
Field_double::val_str() is not an exception (same for
Field_float::val_str()).

4. Even if all of the above wasn't the case, creating a
Field_double object with UINT_MAX32 as its field_length does
not make much sense either, since the .frm code limits it to
MAX_FIELD_CHARLENGTH (255) bytes. Such a beast can only be
created by create_tmp_field_from_item() from an Item with
REAL_RESULT as its result_type() and UINT_MAX32 as its
max_length.

5. For the bug's test case, the above condition (REAL_RESULT
Item with max_length = UINT_MAX32) was a result of
Item_func_if::fix_length_and_dec() "shortcutting" aggregation
of argument types when one of the arguments was a constant
NULL. In this case, the attributes of the aggregated type were
simply copied from the other, non-NULL argument, but max_length
was still calculated as per the general, non-shortcut case, by
choosing the greatest of argument's max_length, which is
obviously not correct.

The patch addresses all of the above problems, even though
fixing the assertion failure for the particular test case would
require only a subset of the above problems to be solved.
2010-08-25 19:57:53 +04:00
Bjorn Munch
16b7af9ae0 Cherry pick 55501 2010-08-25 16:34:31 +02:00
Alexey Botchkov
f0d2765cc3 mysqlhotcopy tests fixed.
The 'mysqlhotcopy' tool gets into bin/ directory after the installation
from the scripts/.
So check for it in that in the mysql-test-run.pl.

per-file comments:
  mysql-test/mysql-test-run.pl
Check the bin/ for mysqlhotcopy presence.
2010-08-25 18:55:22 +05:00
Alfranio Correia
4f37e847d6 Post-fix push for BUG#53452.
Updated the result files for ndb test cases.
2010-08-25 15:13:20 +01:00
Alexander Nozdrin
593c6db299 Auto-merge from mysql-5.5-merge. 2010-08-25 14:22:34 +04:00
Alexander Nozdrin
640528ea5d Revert patch for Bug#56120 temporarily. 2010-08-25 13:17:45 +04:00
Alexey Botchkov
9492861342 mysql.test fixed.
Parts that aren't supposed to work on Windows moved to the separate
mysql_not_windows.test.
2010-08-25 13:17:15 +05:00
Marc Alff
d2df3a8ac5 Bug#55576 Two perfschema tests failed on mysql-next-mr-innodb PB2 tests
Before this fix, some tests failed due to lack of instrumentation slots
in the performance schema, because the default sizing was too low.

Now that more code has been instrumented, the default sizing has to be adjusted
to match the current instrumentation consumption.

This change:
- increases the number of rwlock classes from 20 to 30,
- increases the number of rwlock and mutex instances to 1 million.
Both are to account for the volume of data instrumented
when the innodb storage engine is used (because of the innodb buffer pool).

Adjusted the test output accordingly.
2010-08-24 18:21:43 -06:00
Evgeny Potemkin
b7f0ce88d0 Auto-merged. 2010-08-24 22:20:45 +04:00
Dmitry Lenev
6c50022ac8 Fixed --ps-protocol failures of test for bug#54332 "Deadlock
with two connections doing LOCK TABLE+INSERT DELAYED".

Disabled --ps-protocol for this part of the test as INSERT
DELAYED simply doesn't work with it under LOCK TABLES.
2010-08-24 20:20:00 +04:00
Alexey Kopytov
756076bd23 Bug #54802: 'NOT BETWEEN' evaluation is incorrect
Queries involving predicates of the form "const NOT BETWEEN
not_indexed_column AND indexed_column" could return wrong data
due to incorrect handling by the range optimizer.

For "c NOT BETWEEN f1 AND f2" predicates, get_mm_tree()
produces a disjunction of the SEL_ARG trees for "f1 > c" and
"f2 < c". If one of the trees is empty (i.e. one of the
arguments is not sargable) the resulting tree should be empty
as well, since the whole expression in this case is not
sargable.

The above logic is implemented in get_mm_tree() as follows. The
initial state of the resulting tree is NULL (aka empty). We
then iterate through arguments and compute the corresponding
SEL_ARG tree (either "f1 > c" or "f2 < c"). If the resulting
tree is NULL, it is simply replaced by the generated
tree. Otherwise it is replaced by a disjunction of itself and
the generated tree. The obvious flaw in this implementation is
that if the first argument is not sargable and thus produces a
NULL tree, the resulting tree will simply be replaced by the
tree for the second argument. As a result, "c NOT BETWEEN f1
AND f2" will end up as just "f2 < c".

Fixed by adding a check so that when the first argument
produces an empty tree for the NOT BETWEEN case, the loop is
aborted with an empty tree as a result. The whole idea of using
a loop for 2 arguments does not make much sense, but it was
probably used to avoid code duplication for several BETWEEN
variants.
2010-08-24 19:51:32 +04:00
Gleb Shchepa
7a343e0c82 automerge local --> 5.1-bugteam (bug 53034) 2010-08-31 02:32:03 +04:00