Commit graph

55290 commits

Author SHA1 Message Date
Mats Kindahl
95833a74d0 Bug #40004 Replication failure with no PK + no indexes
In certain situations, a scan of the table will return the error
code HA_ERR_RECORD_DELETED, and this error code is not 
correctly caught in the Rows_log_event::find_row() function, which
causes an error to be returned for this case.

This patch fixes the problem by adding code to either ignore the
record and continuing with the next one, the the event of a table
scan, or change the error code to HA_ERR_KEY_NOT_FOUND, in the event
that a key lookup is attempted.
2008-10-20 20:50:08 +02:00
Kristofer Pettersson
4236c9c0b2 5.0 -> 5.1 NULL MERGE. 2008-10-20 15:45:18 +02:00
Georgi Kodinov
41f139bbc1 merge 5.0-bugteam -> bug 38693-5.0-bugteam 2008-10-20 16:26:07 +03:00
Kristofer Pettersson
1da6d9f171 Auto commit 2008-10-20 13:39:33 +02:00
Georgi Kodinov
a0e3001cdb Bug #33811: Call to stored procedure with SELECT * / RIGHT JOIN
fails after the first time
  
Two separate problems : 
  1. When flattening joins the linked list used for name resolution 
  (next_name_resolution_table) was not updated.
  Fixed by updating the pointers when extending the table list
  
  2. The items created by expanding a * (star) as a column reference
  were marked as fixed, but no cached table was assigned to them 
  (unlike what Item_field::fix_fields does).
  Fixed by assigning a cached table (so the re-preparation is done
  faster).
  
Note that the fix for #2 hides the fix for #1 in most cases
(except when a table reference cannot be cached).
2008-10-17 17:55:06 +03:00
Ramil Kalimullin
bde82a86f4 Fix for bug #40053: 'check table .. for upgrade' doesn't detect
collation change made in 5.1.24-rc

Problem: 'CHECK TABLE ... FOR UPGRADE' did not check for 
incompatible collation changes made in MySQL 5.1.24-rc.

Fix: add the check.
2008-10-17 17:45:17 +05:00
Georgi Kodinov
42db42facf merged 5.0-bugteam -> 5.1-bugteam 2008-10-17 11:49:23 +03:00
Georgi Kodinov
3345b64f4e merged 5.0-bugteam -> bug 39958 2008-10-17 11:47:35 +03:00
Serge Kozlov
7f3582ff85 Bug#39593. Removed test case rpl_row_stop_middle with result file 2008-10-16 22:40:15 +04:00
Gleb Shchepa
56aa88b346 merge 5.0-bugteam --> 5.1-bugteam (bug 39844) 2008-10-16 23:04:31 +05:00
Gleb Shchepa
c411a11e5c Bug #39844: Query Crash Mysql Server 5.0.67
Server crashed during a sort order optimization
of a dependent subquery:

SELECT
    (SELECT t1.a FROM t1, t2
      WHERE t1.a = t2.b AND t2.a = t3.c
      ORDER BY t1.a)
  FROM t3;


Bitmap of tables, that the reference to outer table
column uses, in addition to the regular table bit
has the OUTER_REF_TABLE_BIT bit set.
The only_eq_ref_tables function traverses this map
bit by bit simultaneously with join->map2table list.
Obviously join->map2table never contains an entry
for the OUTER_REF_TABLE_BIT pseudo-table, so the
server crashed there.


The only_eq_ref_tables function has been modified
to traverse regular table bits only like the
update_depend_map function (resetting of the
OUTER_REF_TABLE_BIT there is enough, but
resetting of the whole set of PSEUDO_TABLE_BITS
is used there for sure).
2008-10-16 21:37:17 +05:00
Georgi Kodinov
adfa153bcc Bug #39958: Test "windows" lacks a cleanup
Added the missing DROP TABLE
2008-10-16 14:16:27 +03:00
Davi Arnaut
7b327a5821 Merge mysql-5.0-bugteam into mysql-5.1-bugteam. 2008-10-15 22:50:56 -03:00
Davi Arnaut
459b8b3dd2 Bug#38477: my_pthread_setprio can change dispatch class on Solaris, not just priority
The problem is that the function used by the server to increase
the thread's priority (pthread_setschedparam) has the unintended
side-effect of changing the calling thread scheduling policy,
possibly overwriting a scheduling policy set by a sysadmin.

The solution is to rely on the pthread_setschedprio function, if
available, as it only changes the scheduling priority and does not
change the scheduling policy. This function is usually available on
Solaris and Linux, but it use won't work by default on Linux as the
the default scheduling policy only accepts a static priority 0 -- this
is acceptable for now as priority changing on Linux is broken anyway.
2008-10-15 19:28:26 -03:00
Davi Arnaut
28f29b7313 Bug#38941: fast mutexes in MySQL 5.1 have mutex contention when calling random()
The problem is that MySQL's 'fast' mutex implementation uses the
random() routine to determine the spin delay. Unfortunately, the
routine interface is not thead-safe and some implementations (eg:
glibc) might use a internal lock to protect the RNG state, causing
excessive locking contention if lots of threads are spinning on
a MySQL's 'fast' mutex. The code was also misusing the value
of the RAND_MAX macro, this macro represents the largest value
that can be returned from the rand() function, not random().

The solution is to use the quite simple Park-Miller random number
generator. The initial seed is set to 1 because the previously used
generator wasn't being seeded -- the initial seed is 1 if srandom()
is not called.

Futhermore, the 'fast' mutex implementation has several shortcomings
and provides no measurable performance benefit. Therefore, its use is
not recommended unless it provides directly measurable results.
2008-10-15 19:21:00 -03:00
Davi Arnaut
4ab10baace Bug#37075: offset of limit clause might be truncated on 32-bits server w/o big tables
The problem is that the offset argument of the limit clause
might be truncated on a 32-bits server built without big
tables support. The truncation was happening because the
original 64-bits long argument was being cast to a 32-bits
(ha_rows) offset counter.

The solution is to check if the conversing resulted in value
truncation and if so, the offset is set to the maximum possible
value that can fit on the type.
2008-10-15 18:34:51 -03:00
Horst Hunger
d320ca5c48 Merge to update the tree before a push. 2008-10-15 21:26:32 +02:00
Horst Hunger
2f99a53eeb Final patch for bug#36733 containing all changes. 2008-10-15 20:58:53 +02:00
Georgi Kodinov
b204dc43cc Bug #38693: leaked memory with blobs!
If delayed insert fails to upgrade the lock it was not
freeing the temporary memory storage used to keep
newly constructed blob values in memory.
Fixed by iterating over the remaining rows in the delayed
insert rowset and freeing the blob storage for each row.

No test suite because it involves concurrent delayed inserts 
on a table and cannot easily be made deterministic. 

Added a correct valgrind suppression for Fedora 9.
2008-10-15 16:55:52 +03:00
Kristofer Pettersson
2c576fa9d2 automerge 2008-10-15 12:06:44 +02:00
Kristofer Pettersson
00b75c2075 automerge 2008-10-15 09:55:15 +02:00
Joerg Bruehe
5d4e10c353 Merge Kent's patch to "zlib/gzio.c" from 5.0-build to 5.1-build 2008-10-14 22:34:11 +02:00
Chad MILLER
6597382c2a Merge fix for bug 34129. 2008-10-14 15:59:01 -04:00
Chad MILLER
628a7dd2bc In mysqldumpslow, consume arbitrary whitespace in the Query_time line. 2008-10-14 15:52:52 -04:00
Davi Arnaut
d4c75b7d0f Bug#38823: Invalid memory access when a SP statement does wildcard expansion
The problem is that field names constructed due to wild-card
expansion done inside a stored procedure could point to freed
memory if the expansion was performed after the first call to
the stored procedure.

The problem was solved by patch for Bug#38691. The solution
was to allocate the database, table and field names in the
in the statement memory instead of table memory.
2008-10-14 11:04:36 -03:00
Kent Boortz
36e4c7d281 The header "config.h" needs to be included "early" to control other headers.
This time the inclusion of <stdio.h> before "config.h" enabled legacy large
file support, seek64() and similar, on AIX breaking the compile of "gzio.c"
2008-10-13 14:23:39 +02:00
Georgi Kodinov
9f71b9c5cd merged 5.0-bugteam -> 5.1->bugteam 2008-10-13 13:24:04 +03:00
Georgi Kodinov
9031c8c1d8 merged 5.1-main -> 5.1-bugteam 2008-10-13 13:22:36 +03:00
Joerg Bruehe
8d949612de Merge a merge changeset - no changes. 2008-10-12 11:36:27 +02:00
kent.boortz@sun.com
d8e9fef0fa More portable sh in configure script 2008-10-11 23:51:58 +02:00
kent.boortz@sun.com
a7a050770a Made dist support script more portable sh 2008-10-11 20:28:13 +02:00
kent.boortz@sun.com
71b125ce18 Aligned declaration and defintion of ha_change_partitions(), to avoid link
error using SunStudio 12.
2008-10-11 18:35:49 +02:00
Joerg Bruehe
6e3695aa83 Merge main 5.1 -> 5.1-build
Merge conflict in the tests "<engine>_storedproc": These tests are deleted.
2008-10-11 17:06:47 +02:00
Build Team
b5720ac48f Added "-rc" to the version
Removed use of __FUNCTION__
2008-10-11 01:12:39 +02:00
Mattias Jonsson
f113311d4b Bug#39434: ALTER TABLE CHECK/OPTIMIZE/ANALYZE PARTITION work
on non-partitioned table

Problem was that partitioning specific commands was accepted
for non partitioned tables and treated like
ANALYZE/CHECK/OPTIMIZE/REPAIR TABLE, after bug-20129 was fixed,
which changed the code path from mysql_alter_table to
mysql_admin_table.

Solution was to check if the table was partitioned before
trying to execute the admin command
2008-10-10 20:12:38 +02:00
Joerg Bruehe
194d6875c6 Merge from main 5.0 branch -> 5.0-build
Merge conflicts in test "create:
- for "create.result", handled correctly by "bzr extmerge" (using "kdiff3"),
- for "create.test", not reported as a conflict, but merged wrong
  (new block at the test end got duplicated), fixed manually.

Test on Linux (Debian, PowerPC) was ok.
2008-10-10 19:20:42 +02:00
Georgi Kodinov
702ae189a3 merged 5.0-main -> 5.0-bugteam 2008-10-10 17:27:16 +03:00
Georgi Kodinov
e142ffdea1 merged 5.1-bugteam -> bug 34773 tree 2008-10-10 16:07:53 +03:00
kent.boortz@sun.com
b532dbeaa3 Raise version number after cloning 5.1.29-rc 2008-10-10 13:54:46 +02:00
Gleb Shchepa
a99bc69558 manual merge 5.0-bugteam --> 5.1-bugteam 2008-10-10 16:48:47 +05:00
Gleb Shchepa
fe3aee301d automerge 5.0-bugteam --> 5.1-bugteam 2008-10-10 16:44:10 +05:00
Kristofer Pettersson
74a74cbe49 Bug#39451 Debug builds broken with Sun Studio compiler
Debug builds of MySQL 5.1, 6.0 with Sun Studio 12 broke because of
use of gcc specific feature.
      
The fix is to replace __FUNCTION__ with the corresponding character
string
2008-10-10 13:00:27 +02:00
Gleb Shchepa
27f4c34beb Bug #37894: Assertion in init_read_record_seq in handler.h line 1444
Select with a "NULL NOT IN" condition containing complex
subselect from the same table as in the outer select failed
with an assertion.


The failure was caused by a concatenation of circumstances:
1) an inner select was optimized by make_join_statistics to use
   the QUICK_RANGE_SELECT access method (that implies an index
   scan of the table);
2) a subselect was independent (constant) from the outer select;
3) a condition was pushed down into inner select.

During the evaluation of a constant IN expression an optimizer
temporary changed the access method from index scan to table
scan, but an engine handler was already initialized for index
access by make_join_statistics. That caused an assertion.


Unnecessary index initialization has been removed from
the QUICK_RANGE_SELECT::init method (QUICK_RANGE_SELECT::reset
reinvokes this initialization).
2008-10-10 15:27:58 +05:00
Gleb Shchepa
e7520c4b7e Bug #39283: Date returned as VARBINARY to client for queries
with COALESCE and JOIN

The server returned to a client the VARBINARY column type
instead of the DATE type for a result of the COALESCE,
IFNULL, IF, CASE, GREATEST or LEAST functions if that result
was filesorted in an anonymous temporary table during
the query execution.

For example:
  SELECT COALESCE(t1.date1, t2.date2) AS result
    FROM t1 JOIN t2 ON t1.id = t2.id ORDER BY result;


To create a column of various date/time types in a
temporary table the create_tmp_field_from_item() function
uses the Item::tmp_table_field_from_field_type() method
call. However, fields of the MYSQL_TYPE_NEWDATE type were
missed there, and the VARBINARY columns were created
by default.
Necessary condition has been added.
2008-10-10 15:13:12 +05:00
Mattias Jonsson
44630e09ee Bug#37721: ORDER BY when WHERE contains non-partitioned
index column

There was actually two problems
1) when clustered pk, order by non pk index should also
compare with pk as last resort to differ keys from each
other
2) bug in the index search handling in ha_partition (was
found when extending the test case

Solution to 1 was to include the pk in key compare if
clustered pk and search on other index.

Solution for 2 was to remove the optimization from
ordered scan to unordered scan if clustered pk.
2008-10-10 12:01:01 +02:00
Georgi Kodinov
ac0027ae0c Bug #32124 addendum #2
- fixed an unitialized memory read
 - fixed a compilation warning
 - added a suppression for FC9 x86_64
2008-10-10 12:52:23 +03:00
Gleb Shchepa
ac1c5f5046 manual merge 5.0-5.1.29-rc --> 5.1-5.1.29-rc 2008-10-09 20:57:41 +05:00
Gleb Shchepa
0b38c93d6e Bug#38499: flush tables and multitable table update with
derived table cause crash

When a multi-UPDATE command fails to lock some table, and
subsequently succeeds, the tables need to be reopened if
they were altered. But the reopening procedure failed for
derived tables.

Extra cleanup has been added.
2008-10-09 20:24:31 +05:00
Georgi Kodinov
a8c96e6891 merged 5.1-bugteam -> 32124 2008-10-09 18:07:50 +03:00
Georgi Kodinov
5d1d105762 Bug #32124 addendum
Fixed the handling of system variable retrieval
in prepared statements : added a cleanup method
that clears up the cache and restores the 
original scope of the variable (which is overwritten
at fix_fields()).
2008-10-09 18:03:23 +03:00