Commit graph

202 commits

Author SHA1 Message Date
Gleb Shchepa
eecf06873e Bug #44886: SIGSEGV in test_if_skip_sort_order() -
uninitialized variable used as subscript

Grouping select from a "constant" InnoDB table (a table
of a single row) joined with other tables caused a crash.
2009-06-08 01:40:53 +05:00
Georgi Kodinov
8d1b2df635 merged 36995 to 5.1-bugteam 2009-06-04 13:26:18 +03:00
Georgi Kodinov
932c7a316c Bug #36995: valgrind error in remove_const during subquery executions
When copying the Item class one must copy its attributes as well.
2009-06-04 12:52:40 +03:00
Georgi Kodinov
8fb82e3fe0 Bug #44399 : crash with statement using TEXT columns, aggregates, GROUP BY, and
HAVING
            
When calculating GROUP BY the server caches some expressions. It does
that by allocating a string slot (Item_copy_string) and assigning the 
value of the expression to it. This effectively means that the result
type of the expression can be changed from whatever it was to a string.
As this substitution takes place after the compile-time result type 
calculation for IN but before the run-time type calculations, 
it causes the type calculations in the IN function done at run time 
to get unexpected results different from what was prepared at compile time.
                  
In the CASE ... WHEN ... THEN ... statement there was a similar problem
and it was solved by artificially adding a STRING argument to the set of 
types of the IN/CASE arguments at compile time, so if any of the 
arguments of the CASE function changes its type to a string it will 
still be covered by the information prepared at compile time.
2009-05-25 11:00:40 +03:00
Sergey Glukhov
551e74c567 Bug#39793 Foreign keys not constructed when column has a '#' in a comment or default value
Internal InnoDN FK parser does not recognize '\'' as quotation symbol.
Suggested fix is to add '\'' symbol check for quotation condition
(dict_strip_comments() function).
2009-05-19 11:32:21 +05:00
Sergey Glukhov
2b373758af 5.0-bugteam->5.1-bugteam merge 2009-05-19 11:48:04 +05:00
Martin Hansson
d430002673 Merge. 2009-05-13 17:24:27 +02:00
Gleb Shchepa
2121599d38 Bug #44290: explain crashes for subquery with distinct in
SQL_SELECT::test_quick_select

The crash was caused by an incomplete cleanup of JOIN_TAB::select
during the filesort of rows for GROUP BY clause inside a subquery.
Queries where a quick index access is replaced with filesort was
was affected. For example:

  SELECT 1 FROM
    (SELECT COUNT(DISTINCT c1) FROM t1
       WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x

Quick index access related data in the SQL_SELECT::test_quick_select
function was inconsistent after an incomplete cleanup.
This function has been completed to prevent crashes in the
SQL_SELECT::test_quick_select function.
2009-05-12 22:42:31 +05:00
Martin Hansson
2afccc1b31 Bug#43580: Issue with Innodb on multi-table update
Certain multi-updates gave different results on InnoDB from
to MyISAM, due to on-the-fly updates being used on the former and
the update order matters.
Fixed by turning off on-the-fly updates when update order 
dependencies are present.
2009-05-05 11:38:19 +02:00
Kristofer Pettersson
598b11a31f Automerge 2009-03-30 10:44:17 +02:00
Kristofer Pettersson
137f1e1ed6 Bug#40127 Multiple table DELETE IGNORE hangs on foreign key constraint violation
on 5.0            
The server crashes on an assert in net_end_statement indicating that the
Diagnostics area wasn't set properly during execution.
This happened on a multi table DELETE operation using the IGNORE keyword.
The keyword is suppose to allow for execution to continue on a best effort
despite some non-fatal errors. Instead execution stopped and no client
response was sent which would have led to a protocol error if it hadn't been
for the assert.
This patch corrects this issue by checking for the existence of an IGNORE
option before setting an error state during row-by-row delete iteration.
2009-03-27 17:08:14 +01:00
Ramil Kalimullin
8d3aceb09e Merge 2009-03-27 13:34:24 +04:00
Ramil Kalimullin
2005f3c72c Fix for bug #26288: savepoint not deleted, comit on empty transaction
Problem: commit doesn't delete savepoints if there are no changes 
in the transaction.

Fix: delete them in such cases.
2009-03-27 10:24:32 +04:00
Georgi Kodinov
39dc3623b3 Bug #42419: test suite fix
Moved the test case for the bug into a separate file (and restored the 
original innodb_mysql test setup).
Used the new wait_show_condition test macro to avoid the usage of sleep
2009-02-20 11:12:06 +02:00
Georgi Kodinov
b2c161c192 Bug #42419: Server crash with "Pure virtual method called" on two concurrent
connections
The problem is that tables can enter open table cache for a thread without 
being properly cleaned up. This can happen if make_join_statistics() fails 
to read a const table because of e.g. a deadlock. It does set a member of 
TABLE structure to a value it allocates, but doesn't clean-up this setting 
on error nor does it set the rest of the members in JOIN to allow for 
automatic cleanup.
As a result when such an error occurs and the next statement depends re-uses 
the table from the open tables cache it will get it with this 
TABLE::reginfo.join_tab pointing to a memory area that's freed.
Fixed by making sure make_join_statistics() cleans up TABLE::reginfo.join_tab 
on error.
2009-02-19 17:30:03 +02:00
Davi Arnaut
577e390ece Bug#37016: TRUNCATE TABLE removes some rows but not all
The special TRUNCATE TABLE (DDL) transaction wasn't being properly
rolled back if a error occurred during row by row deletion. The
error can be caused by a foreign key restriction imposed by InnoDB
SE and would cause the server to erroneously issue a implicit
commit.

The solution is to rollback the transaction if a truncation via row
by row deletion fails, otherwise commit. All effects of a TRUNCATE 
ABLE operation are rolled back if a row by row deletion fails.
2009-01-09 08:20:32 -02:00
Davi Arnaut
dc5a0f4481 Bug#41348: INSERT INTO tbl SELECT * FROM temp_tbl overwrites
locking type of temp table

The problem is that INSERT INTO .. SELECT FROM .. and CREATE
TABLE .. SELECT FROM a temporary table could inadvertently
overwrite the locking type of the temporary table. The lock
type of temporary tables should be a write lock by default.

The solution is to reset the lock type of temporary tables
back to its default value after they are used in a statement.
2009-01-07 10:11:37 -02:00
Georgi Kodinov
b9f848c717 merged bug 37742 to 5.1-bugteam 2008-12-08 12:23:33 +02:00
Georgi Kodinov
f486bfbbdb Bug #37742: HA_EXTRA_KEYREAD flag is set when key contains only prefix of requested
column
      
When the storage engine uses secondary keys clustered with the primary key MySQL was
adding the primary key parts to each secondary key.
In doing so it was not checking whether the index was on full columns and this
resulted in the secondary keys being added to the list of covering keys even if 
they have partial columns.
Fixed by not adding a primary key part to the list of columns that can be used 
for index read of the secondary keys when the primary key part is a partial key part.
2008-11-29 15:36:17 +02:00
Sergey Glukhov
302152fc86 5.0-bugteam->5.1-bugteam merge 2008-11-27 19:03:13 +04:00
Sergey Glukhov
63bca358ca Bug#37284 Crash in Field_string::type()
The bug is repeatable with latest(1.0.1) InnoDB plugin on Linux, Win,
If MySQL is compiled with valgrind there are errors about
using of uninitialized variable(orig_table).
The fix is to set field->orig_table correct value.
2008-11-27 18:54:23 +04:00
Mats Kindahl
32c9fe6bf5 Bug #40360: Binlog related errors with binlog off
Adding missing drop of created table and tidying display.
2008-11-03 18:46:47 +01:00
Mats Kindahl
005e7fc3ba Bug #40360: Binlog related errors with binlog off
When statement-based replication is used, and the
transaction isolation level is READ-COMMITTED or stricter,
InnoDB will print an error because statement-based
replication might lead to inconsistency between master
and slave databases. However, when the binary log is not
engaged, this is not an issue and an error should
not be printed.

This patch makes thd_binlog_format() return BINLOG_FORMAT_
UNSPEC when the binary log is not engaged for the given
thread.
2008-11-03 12:14:48 +01:00
Georgi Kodinov
7a05a4f5dc Bug #39812: Make statement replication default for 5.1 (to match 5.0)
Make STMT replication default for 5.1.
Add a default of MIXED into the config files
Fix the tests that needed MIXED replication mode.
2008-10-03 15:24:19 +03:00
Mattias Jonsson
07e9a6dc2a Bug#20129: ALTER TABLE ... REPAIR PARTITION ... complains that
partition is corrupt

The main problem was that ALTER TABLE t ANALYZE/CHECK/OPTIMIZE/REPAIR
PARTITION took another code path (over mysql_alter_table instead of
mysql_admin_table) which differs in two ways:
1) alter table opens the tables in a different way than admin tables do
   resulting in returning with error before it tried the command
2) alter table does not start to send any diagnostic rows to the client
   which the lower admin functions continue to use -> resulting in
   assertion crash

The fix:
Remapped ALTER TABLE t ANALYZE/CHECK/OPTIMIZE/REPAIR PARTITION to use
the same code path as ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE t.
Adding check in mysql_admin_table to setup the partition list for
which partitions that should be used.


Partitioned tables will still not work with
REPAIR TABLE/PARTITION USE_FRM, since that requires moving partitions
to tables, REPAIR TABLE t USE_FRM, and check that the data still
fulfills the partitioning function and then move the table back to
being a partition.

NOTE: I have removed the following functions from the handler
interface:
analyze_partitions, check_partitions, optimize_partitions,
repair_partitions
Since they are not longer needed.
THIS ALTERS THE STORAGE ENGINE API
2008-08-11 20:02:03 +02:00
Georgi Kodinov
436f1dc49c Bug#37830 : ORDER BY ASC/DESC - no difference
Range scan in descending order for c <= <col> <= c type of
ranges was ignoring the DESC flag.
However some engines like InnoDB have the primary key parts 
as a suffix for every secondary key.
When such primary key suffix is used for ordering ignoring 
the DESC is not valid.
But we generally would like to do this because it's faster.
            
Fixed by performing only reverse scan if the primary key is used.
Removed some dead code in the process.
2008-07-23 14:25:00 +03:00
Georgi Kodinov
7f16afccfb merge of bug #37830 to 5.1 2008-07-17 18:51:24 +03:00
Georgi Kodinov
59ab9a0872 Bug#37830 : ORDER BY ASC/DESC - no difference
Range scan in descending order for c <= <col> <= c type of
ranges was ignoring the DESC flag.
However some engines like InnoDB have the primary key parts 
as a suffix for every secondary key.
When such primary key suffix is used for ordering ignoring 
the DESC is not valid.
But we generally would like to do this because it's faster.
      
Fixed by performing only reverse scan if the primary key is used.
Removed some dead code in the process.
2008-07-16 12:31:50 +03:00
Davi Arnaut
c20188e011 Bug#33873: Fast ALTER TABLE doesn't work with multibyte character sets
The problem was that when comparing tables for a possible
fast alter table, the comparison was being performed using
the parsed information and not the final definition.
      
The solution is to use the possible final table layout to
compare if a fast alter is possible or not.
2008-06-17 11:12:21 -03:00
sergefp@mysql.com
c21dbf27cf BUG#35850 "Performance regression in 5.1.23/5.1.24"
- Disable the "prefer full scan on clustered primary key over full scan
  of any secondary key" rule introduced by BUG#35850.
- Update test results accordingly 
(bk trigger: file this for BUG#35850)
2008-05-07 09:58:21 +04:00
davi@mysql.com/endora.local
a454190f0d Backport kostja's fix for Bug#32724 "innodb_mysql.test fails randomly".
Enable back the disabled test case.
2008-04-29 00:03:19 -03:00
kaa@kaamos.(none)
0a7052e4d3 Merge kaamos.(none):/data/src/mysql-5.1
into  kaamos.(none):/data/src/opt/mysql-5.1-opt
2008-03-12 11:19:46 +03:00
anozdrin/alik@quad.
b25de63309 Add a test case for Bug#21704: Renaming column does not update
FK definition.
2008-02-15 14:14:09 +03:00
kaa@kaamos.(none)
9f194149b8 Merge kaamos.(none):/data/src/opt/mysql-5.0-opt
into  kaamos.(none):/data/src/opt/mysql-5.1-opt
2008-02-13 12:12:00 +03:00
gshchepa/uchum@host.loc
fa1f0d6b17 innodb_mysql.test, variables.result, variables.test, innodb_mysql.result:
Minor post-fix for bug#34223.
2008-02-07 11:12:49 +04:00
igor@olga.mysql.com
b85ffdb5d5 Fixed bug #33697.
When the function test_if_skip_sort_order prefers index backward scan 
to ref access the corresponding access functions must be set accordingly.
2008-01-11 10:05:34 -08:00
gluh@eagle.(none)
d504588e79 Merge mysql.com:/home/gluh/MySQL/Merge/5.0-opt
into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt
2007-12-13 16:10:57 +04:00
gluh@eagle.(none)
4f5868114a Merge mysql.com:/home/gluh/MySQL/Merge/5.1
into  mysql.com:/home/gluh/MySQL/Merge/5.1-opt
2007-12-13 15:56:04 +04:00
gluh@eagle.(none)
e039595029 Merge mysql.com:/home/gluh/MySQL/Merge/5.0
into  mysql.com:/home/gluh/MySQL/Merge/5.0-opt
2007-12-13 14:52:49 +04:00
df@pippilotta.erinye.com
3f79b0f108 Merge pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.1
into  pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.1-build
2007-12-10 10:46:00 +01:00
igor@olga.mysql.com
c394dbe14a Fixed bug #32815.
The index (key_part_1, key_part-2) was erroneously considered as compatible
with the required ordering in the function test_test_if_order_by_key when 
a query with an ORDER BY clause contained a condition of the form
  key_part_1=const OR key_part_1 IS NULL 
and the order list contained only key_part_2. This happened because the value
of the const_key_parts field in the KEYUSE structure was not formed correctly
for the keys that could be used for ref_or_null access. 
This was fixed in the code of the update_ref_and_keys function.
The problem could not manifest itself for MyISAM databases because the
implementation of the keys_to_use_for_scanning() handler function always
returns an empty bitmap for the MyISAM engine.
2007-12-07 17:14:59 -08:00
tsmith@ramayana.hindu.god
8fc0bfb6b6 Merge ramayana.hindu.god:/home/tsmith/m/bk/51
into  ramayana.hindu.god:/home/tsmith/m/bk/maint/51-merge
2007-12-05 12:33:36 -07:00
tnurnberg@white.intern.koehntopp.de
f561e8ddf3 Merge tnurnberg@bk-internal.mysql.com:/home/bk/mysql-5.1-opt
into  mysql.com:/misc/mysql/31177/51-31177
2007-12-02 03:19:07 +01:00
tnurnberg@white.intern.koehntopp.de
9598ea4f45 Merge mysql.com:/misc/mysql/31177/50-31177
into  mysql.com:/misc/mysql/31177/51-31177
2007-12-01 15:53:56 +01:00
tnurnberg@mysql.com/white.intern.koehntopp.de
31d4e58ad4 Bug#31177: Server variables can't be set to their current values
Default values of variables were not subject to upper/lower bounds
and step, while setting variables was. Bounds and step are also
applied to defaults now; defaults are corrected quietly, values
given by the user are corrected, and a correction-warning is thrown
as needed. Lastly, very large values could wrap around, starting
from 0 again. They are bounded at the maximum value for the
respective data-type now if no lower maximum is specified in the
variable's definition.
2007-11-30 06:32:04 +01:00
df@pippilotta.erinye.com
4530750499 Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  pippilotta.erinye.com:/shared/home/df/mysql/build/mysql-5.1-build
2007-11-28 19:49:29 +01:00
istruewing@stella.local
13f317c565 Bug#32754 - InnoDB tests do not prepare or clean up correctly
Some test cases were missing preparation to deal with failed
predecessor test cases.

Added preparation (drop table if exists) to some test cases.
2007-11-27 09:25:45 +01:00
serg@janus.mylan
6f689c91d8 Merge bk-internal.mysql.com:/home/bk/mysql-5.1
into  janus.mylan:/usr/home/serg/Abk/mysql-5.1
2007-11-19 17:12:49 +01:00
mattiasj@mattiasj-laptop.(none)
32d7dd8679 Merge mattiasj-laptop.(none):/home/mattiasj/clones/mysql-5.1-main
into  mattiasj-laptop.(none):/home/mattiasj/clones/mysql-5.1-last_with_main
2007-11-12 21:09:48 +01:00
ramil/ram@mysql.com/ramil.myoffice.izhnet.ru
dc8d3d0bec Fix for bug #26447: "ALTER TABLE .. ORDER" does not work with InnoDB
and auto_increment keys

Problems: 
  1. ALTER TABLE ... ORDER BY... doesn't make sence if there's a 
     user-defined clustered index in the table.
  2. using a secondary index is slower than using a clustered one 
     for a table scan.

Fixes:
  1. raise a warning.
  2. use the clustered index.
2007-11-07 19:59:58 +04:00