Commit graph

58081 commits

Author SHA1 Message Date
Georgi Kodinov
83984db0fc merged 5.0-bugteam -> 5.1-bugteam 2009-08-27 10:46:35 +03:00
Alfranio Correia
dbcfef4cf2 BUG#28976 Mixing trans and non-trans tables in one transaction results in incorrect
binlog

Mixing transactional (T) and non-transactional (N) tables on behalf of a
transaction may lead to inconsistencies among masters and slaves in STATEMENT
mode. The problem stems from the fact that although modifications done to
non-transactional tables on behalf of a transaction become immediately visible
to other connections they do not immediately get to the binary log and therefore
consistency is broken. Although there may be issues in mixing T and M tables in
STATEMENT mode, there are safe combinations that clients find useful.

In this bug, we fix the following issue. Mixing N and T tables in multi-level
(e.g. a statement that fires a trigger) or multi-table table statements (e.g.
update t1, t2...) were not handled correctly. In such cases, it was not possible
to distinguish when a T table was updated if the sequence of changes was N and T.
In a nutshell, just the flag "modified_non_trans_table" was not enough to reflect
that both a N and T tables were changed. To circumvent this issue, we check if an
engine is registered in the handler's list and changed something which means that
a T table was modified.

Check WL 2687 for a full-fledged patch that will make the use of either the MIXED or
ROW modes completely safe.
2009-08-27 00:13:03 +01:00
Mattias Jonsson
f56dc20835 merge 2009-08-26 14:45:50 +02:00
Mattias Jonsson
b19ad3f807 merge 2009-08-26 14:40:18 +02:00
Mattias Jonsson
401fb7c6fb Bug#20577: Partitions: use of to_days() function leads to selection failures
Problem was that the partition containing NULL values
was pruned away, since '2001-01-01' < '2001-02-00' but
TO_DAYS('2001-02-00') is NULL.

Added the NULL partition for RANGE/LIST partitioning on TO_DAYS()
function to be scanned too.

Also fixed a bug that added ALLOW_INVALID_DATES to sql_mode
(SELECT * FROM t WHERE date_col < '1999-99-99' on a RANGE/LIST
partitioned table would add it).
2009-08-26 12:59:49 +02:00
Mattias Jonsson
3b756a01a0 Bug#46362: Endpoint should be set to false for TO_DAYS(DATE)
There were a problem since pruning uses the field
for comparison (while evaluate_join_record uses longlong),
resulting in pruning failures when comparing DATE to DATETIME.

Fix was to always comparing DATE vs DATETIME as DATETIME,
by adding ' 00:00:00' to the DATE string.

And adding optimization for comparing with 23:59:59, so that
DATETIME_col > '2001-02-03 23:59:59' ->
TO_DAYS(DATETIME_col) > TO_DAYS('2001-02-03 23:59:59') instead
of '>='.
2009-08-26 12:51:23 +02:00
Davi Arnaut
31afccc407 Bug#45261: Crash, stored procedure + decimal
The problem was that creating a DECIMAL column from a decimal
value could lead to a failed assertion as decimal values can
have a higher precision than those attached to a table. The
assert could be triggered by creating a table from a decimal
with a large (> 30) scale. Also, there was a problem in
calculating the number of digits in the integral and fractional
parts if both exceeded the maximum number of digits permitted
by the new decimal type.

The solution is to ensure that truncation procedure is executed
when deducing a DECIMAL column from a decimal value of higher
precision. If the integer part is equal to or bigger than the
maximum precision for the DECIMAL type (65), the integer part
is truncated to fit and the fractional becomes zero. Otherwise,
the fractional part is truncated to fit into the space left
after the integer part is copied.

This patch borrows code and ideas from Martin Hansson's patch.
2009-08-24 16:47:08 -03:00
Georgi Kodinov
e4f8deb226 Bug #37044: Read overflow in opt_range.cc found during "make test"
The code was using a special global buffer for the value of IS NULL ranges.
This was not always long enough to be copied by a regular memcpy. As a 
result read buffer overflows may occur.
Fixed by setting the null byte to 1 and setting the rest of the field disk image
to NULL with a bzero (instead of relying on the buffer and memcpy()).
2009-08-24 15:28:03 +03:00
Alfranio Correia
793e523b4e auto-merge mysql-5.1-bugteam (local) --> mysql-5.1-bugteam 2009-08-24 11:37:44 +01:00
Alfranio Correia
bb14ffb452 auto-merge mysql-5.1-bugteam (local) --> mysql-5.1-bugteam 2009-08-24 10:24:52 +01:00
Jonathan Perkin
c4fa4f31ae Apply changes from mysql-5.1.38-release clone:
- Add conditionals for bundled zlib and innodb plugin.
 - Apply patch from bug#46834 to install the test suite in RPMs.
 - Add plugins to RPMs.  Disable example plugins.
2009-08-24 10:13:34 +01:00
Anurag Shekhar
90032c1007 Bug #44723 Larger read_buffer_size values can cause performance
decrease for INSERTs


Bulk inserts (multiple row, CREATE ... SELECT, INSERT ... SELECT) into
MyISAM tables were performed inefficiently. This was mainly affecting
use cases where read_buffer_size was considerably large (>256K) and low
number of rows was inserted (e.g. 30-100).

The problem was that during I/O cache initialization (this happens
before each bulk insert) allocated I/O buffer was unnecessarily
initialized to '\0'.

This was happening because of mess in flag values. MyISAM informs I/O
cache to wait for free space (if out of disk space) by passing
MY_WAIT_IF_FULL flag. Since MY_WAIT_IF_FULL and MY_ZEROFILL have the
same values, memory allocator was initializing memory to '\0'.

The performance gain provided with this patch may only be visible with
non-debug binaries, since safemalloc always initializes allocated memory
to 0xA5A5...
2009-08-24 13:15:51 +05:30
Mattias Jonsson
001007caac merge 2009-08-21 18:00:38 +02:00
Mattias Jonsson
586ee5d616 Bug#46639: 1030 (HY000): Got error 124 from storage engine on
INSERT ... SELECT ...

Problem was that when bulk insert is used on an empty
table/partition, it disables the indexes for better
performance, but in this specific case it also tries
to read from that partition using an index, which is
not possible since it has been disabled.

Solution was to allow index reads on disabled indexes
if there are no records.

Also reverted the patch for bug#38005, since that was a workaround
in the partitioning engine instead of a fix in myisam.
2009-08-21 17:38:29 +02:00
Georgi Kodinov
d5bda7c313 reverted the fix for bug #46019 from 5.1-bugteam 2009-08-21 17:41:48 +03:00
Georgi Kodinov
9a856bd483 automerge 2009-08-21 17:12:03 +03:00
Georgi Kodinov
37cff7c047 Revert of the fix for bug #46019. 2009-08-21 17:10:55 +03:00
Martin Hansson
2749874edb Merge. 2009-08-21 14:31:40 +02:00
Martin Hansson
a1589a1061 Merge. 2009-08-21 12:13:03 +02:00
Joerg Bruehe
7ae2baea09 Upmerge a merge changeset from 5.0 to 5.1, no code change involved. 2009-08-21 11:56:44 +02:00
Ramil Kalimullin
f59400f4c3 Fix for bug #46456 [Ver->Prg]: HANDLER OPEN + TRUNCATE + DROP
(temporary) TABLE, crash

Problem: if one has an open "HANDLER t1", further "TRUNCATE t1" 
doesn't close the handler and leaves handler table hash in an 
inconsistent state, that may lead to a server crash.

Fix: TRUNCATE should implicitly close all open handlers.

Doc. request: the fact should be described in the manual accordingly.
2009-08-21 10:55:35 +05:00
Joerg Bruehe
56d903a9a3 Merge the correction for the bug#37098 fix into 5.0-build 2009-08-20 22:07:40 +02:00
Joerg Bruehe
6a02c3bce2 automerge the correction for bug#37098 into 5.1-build 2009-08-20 21:58:27 +02:00
Joerg Bruehe
d2d5cdc45e Merge the correction to the bug#37098 fix from 5.0 to 5.1. 2009-08-20 21:41:12 +02:00
Joerg Bruehe
55f7c2f35f Get rid of manual pages which aren't used.
This is a partial correction to the original fix for bug#37098
   Get rid of "Installed (but unpackaged)" files in the RPM build
which used a wrong variable.
2009-08-20 21:08:09 +02:00
Georgi Kodinov
f4676ae522 merge of bug #46019 to 5.1-bugteam 2009-08-20 17:11:22 +03:00
Martin Hansson
85609034cb Bug#46616: Merge 2009-08-20 14:30:59 +02:00
Martin Hansson
ea6dc4145c Bug#46616: Assertion `!table->auto_increment_field_not_null' on
view manipulations
      
The bespoke flag was not properly reset after last call to 
fill_record. Fixed by resetting in caller mysql_update.
2009-08-20 13:56:29 +02:00
Alfranio Correia
f132d6b4c1 BUG#45694 Deadlock in replicated statement is not retried
If the SQL Thread fails to execute an event due to a temporary error (e.g.
ER_LOCK_DEADLOCK) and the option "--slave_transaction_retries" is set the SQL
Thread should not be aborted and the transaction should be restarted from the
beginning and re-executed.

Unfortunately, a wrong interpretation of the THD::is_fatal_error was preventing
this behavior. In a nutshell, "this variable is set to TRUE if an execution of a
compound statement cannot continue. In particular, it is used to disable access
to the CONTINUE or EXIT handlers of stored routines. So even temporary errors
may have this variable set.

To fix the bug, we have done what follows:

   DBUG_ENTER("has_temporary_error");

-  if (thd->is_fatal_error)
-    DBUG_RETURN(0);
-
   DBUG_EXECUTE_IF("all_errors_are_temporary_errors",
                   if (thd->main_da.is_error())
                   {
2009-08-19 16:38:18 +01:00
Georgi Kodinov
8dba7d18b4 Bug #46807: subselect test fails on PB-2 with a crash
The check for stack overflow was independent of the size of the 
structure stored in the heap. 
Fixed by adding sizeof(PARAM) to the requested free heap size.
2009-08-19 17:53:43 +03:00
Georgi Kodinov
4207e50e23 Bug #46019: ERROR 1356 When selecting from within another
view that has Group By
      
Table access rights checking function check_grant() assumed
that no view is opened when it's called.
This is not true with nested views where the inner view
needs materialization. In this case the view is already 
materialized when check_grant() is called for it.
This caused check_grant() to not look for table level
grants on the materialized view table.
Fixed by checking if a view is already materialized and if 
it is check table level grants using the original table name
(not the ones of the materialized temp table).
2009-08-19 15:14:57 +03:00
Georgi Kodinov
0c8690e569 backport of Chad's fix for bug #39326 to 5.0-bugteam 2009-08-19 10:59:17 +03:00
Georgi Kodinov
43851cb811 automere 2009-08-17 17:21:08 +03:00
Georgi Kodinov
88322d00fc automerge 2009-08-17 17:14:51 +03:00
Georgi Kodinov
cf35148fb7 automerge 2009-08-17 17:13:08 +03:00
Ramil Kalimullin
4dcaa978e3 Automerge 2009-08-14 14:13:16 +05:00
Davi Arnaut
1cf02d95a7 Merge from mysql-5.0-bugteam. 2009-08-13 17:45:01 -03:00
Joerg Bruehe
3a3d5de4d0 Upmerge 5.0-build into 5.1-build
This involves merge changesets and backports into QSP builds only,
does not cause a contents change in 5.1
2009-08-13 22:33:00 +02:00
Joerg Bruehe
20efa8d972 Merge main 5.1 into 5.1-build 2009-08-13 22:25:58 +02:00
Davi Arnaut
97dbd987f0 Bug#46013: rpl_extraColmaster_myisam fails on pb2
Bug#45243: crash on win in sql thread clear_tables_to_lock() -> free()
Bug#45242: crash on win in mysql_close() -> free()
Bug#45238: rpl_slave_skip, rpl_change_master failed (lost connection) for STOP SLAVE
Bug#46030: rpl_truncate_3innodb causes server crash on windows
Bug#46014: rpl_stm_reset_slave crashes the server sporadically in pb2

When killing a user session on the server, it's necessary to
interrupt (notify) the thread associated with the session that
the connection is being killed so that the thread is woken up
if waiting for I/O. On a few platforms (Mac, Windows and HP-UX)
where the SIGNAL_WITH_VIO_CLOSE flag is defined, this interruption
procedure is to asynchronously close the underlying socket of
the connection.

In order to enable this schema, each connection serving thread
registers its VIO (I/O interface) so that other threads can
access it and close the connection. But only the owner thread of
the VIO might delete it as to guarantee that other threads won't
see freed memory (the thread unregisters the VIO before deleting
it). A side note: closing the socket introduces a harmless race
that might cause a thread attempt to read from a closed socket,
but this is deemed acceptable.

The problem is that this infrastructure was meant to only be used
by server threads, but the slave I/O thread was registering the
VIO of a mysql handle (a client API structure that represents a
connection to another server instance) as a active connection of
the thread. But under some circumstances such as network failures,
the client API might destroy the VIO associated with a handle at
will, yet the VIO wouldn't be properly unregistered. This could
lead to accesses to freed data if a thread attempted to kill a
slave I/O thread whose connection was already broken.

There was a attempt to work around this by checking whether
the socket was being interrupted, but this hack didn't work as
intended due to the aforementioned race -- attempting to read
from the socket would yield a "bad file descriptor" error.

The solution is to add a hook to the client API that is called
from the client code before the VIO of a handle is deleted.
This hook allows the slave I/O thread to detach the active vio
so it does not point to freed memory.
2009-08-13 17:07:20 -03:00
Ramil Kalimullin
1aec6f7acf Fix for bug #46614: Assertion in show_create_trigger()
on SHOW CREATE TRIGGER + MERGE table

Problem: SHOW CREATE TRIGGER erroneously relies on fact
that we have the only underlying table for a trigger
(wrong for merge tables).

Fix: remove erroneous assert().
2009-08-14 00:49:28 +05:00
Alfranio Correia
d7c288f600 BUG#46130 Slave does not correctly handle "expected errors"
In STATEMENT based replication, a statement that failed on the master but that
updated non-transactional tables is written to binary log with the error code
appended to it. On the slave, the statement is executed and the same error is
expected. However, when an "expected error" did not happen on the slave and was
either ignored or was related to a concurrency issue on the master, the slave
did not rollback the effects of the statement and as such inconsistencies might
happen.

To fix the problem, we automatically rollback a statement that should have
failed on a slave but succeded and whose expected failure is either ignored or
stems from a concurrency issue on the master.
2009-08-13 17:21:01 +01:00
10e90a1fe5 BUG#45574 CREATE IF NOT EXISTS is not binlogged if the object exists
There is an inconsistency with DROP DATABASE|TABLE|EVENT IF EXISTS and
CREATE DATABASE|TABLE|EVENT IF NOT EXISTS. DROP IF EXISTS statements are
binlogged even if either the DB, TABLE or EVENT does not exist. In
contrast, Only the CREATE EVENT IF NOT EXISTS is binlogged when the EVENT
exists.  

This patch fixes the following cases for all the replication formats:
CREATE DATABASE IF NOT EXISTS.
CREATE TABLE IF NOT EXISTS,
CREATE TABLE IF NOT EXISTS ... LIKE,
CREAET TABLE IF NOT EXISTS ... SELECT.
2009-08-13 10:48:57 +08:00
Alexander Nozdrin
69d0ddaed6 Ignore auto-generated file: libmysqld/examples/mysqltest.cc 2009-08-12 23:45:01 +04:00
Alexander Nozdrin
14345a2005 Fix 5.1 build error. 2009-08-12 23:43:20 +04:00
Mattias Jonsson
602404b37a merge 2009-08-12 18:53:33 +02:00
Daniel Fischer
cb0df3eed7 Create separate vardirs during collections test runs. 2009-08-12 17:10:15 +02:00
karen.langford@sun.com
21cbee126a Raise version number after cloning 5.1.38 2009-08-12 16:41:07 +02:00
Konstantin Osipov
a75f934228 A follow up patch for the follow up patch for Bug#45829
"CREATE TABLE TRANSACTIONAL PAGE_CHECKSUM ROW_FORMAT=PAGE accepted, 
does nothing".

Put back stubs for members of structures that are shared between
sql/ and pluggable storage engines. to not break ABI unnecessarily.
To be NULL-merged into 5.4, where we do break the ABI already.
2009-08-12 17:11:06 +04:00
Sergey Vojtovich
68b96702a0 Disable main.index_merge_innodb with InnoDB plugin. The test case is
not ready to run with innoplug-1.0.4.
2009-08-12 17:46:12 +05:00