Commit graph

58157 commits

Author SHA1 Message Date
Davi Arnaut
050c36c7de 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.

server-tools/instance-manager/mysql_connection.cc:
  Add stub method required for linking.
sql-common/client.c:
  Invoke hook.
sql/client_settings.h:
  Export hook.
sql/slave.cc:
  Introduce hook that clears the active VIO before it is freed
  by the client API.
2009-08-13 17:07:20 -03:00
Ramil Kalimullin
3b1280fa7e 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().


mysql-test/r/merge.result:
  Fix for bug #46614: Assertion in show_create_trigger() 
  on SHOW CREATE TRIGGER + MERGE table
    - test result.
mysql-test/t/merge.test:
  Fix for bug #46614: Assertion in show_create_trigger() 
  on SHOW CREATE TRIGGER + MERGE table
    - test case.
sql/sql_show.cc:
  Fix for bug #46614: Assertion in show_create_trigger() 
  on SHOW CREATE TRIGGER + MERGE table
    - unnecessary assert() removed as we may have more than 1 
  tables open e.g. for a merge table.
2009-08-14 00:49:28 +05:00
Alfranio Correia
78585a25ff 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
Bjorn Munch
2000cef72a Bug #44979 Enhance MTR --experimental to support platform qualifier
Adding @<platform> syntax
2009-08-13 15:29:19 +02:00
unknown
fce4fa362c 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.

sql/sql_insert.cc:
  Part of the code was moved from the create_table_from_items to select_create::prepare.
  When replication is row based, CREATE TABLE IF NOT EXISTS.. SELECT is binlogged if the table exists.
2009-08-13 10:48:57 +08:00
Jonathan Perkin
00eec234ee Apply build fix 2009-08-12 22:06:44 +02:00
Alexander Nozdrin
09d042249a Ignore auto-generated file: libmysqld/examples/mysqltest.cc 2009-08-12 23:45:01 +04:00
Alexander Nozdrin
b05eeab593 Fix 5.1 build error. 2009-08-12 23:43:20 +04:00
Mattias Jonsson
89260b24c9 merge 2009-08-12 18:53:33 +02:00
Daniel Fischer
b50f05e67a Create separate vardirs during collections test runs. 2009-08-12 17:10:15 +02:00
unknown
606c7e0d12 Raise version number after cloning 5.1.38 2009-08-12 16:41:07 +02:00
Konstantin Osipov
b28f09bd8c 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
3adae7f2cf 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
Konstantin Osipov
1402275a53 A follow up patch for Bug#45829 "CREATE TABLE TRANSACTIONAL
PAGE_CHECKSUM ROW_FORMAT=PAGE accepted, does nothing"
Remove unused code that would lead to warnings when compiling
sql_yacc.yy.


sql/handler.h:
  Remove unused defines.
sql/sql_yacc.yy:
  Remove unused grammar.
sql/table.h:
  Remove unused TABLE members.
2009-08-12 14:57:41 +04:00
Mattias Jonsson
abc73040b5 manual merge 2009-08-12 12:03:05 +02:00
Mattias Jonsson
f09fc50004 merge 2009-08-12 11:46:08 +02:00
unknown
7b8d509b2d Manual Merge 2009-08-12 13:31:56 +08:00
unknown
0d821fafe9 BUG#45516 SQL thread does not use database charset properly
Replication SQL thread does not set database default charset to 
thd->variables.collation_database properly, when executing LOAD DATA binlog.
This bug can be repeated by using "LOAD DATA" command in STATEMENT mode.
        
This patch adds code to find the default character set of the current database 
then assign it to thd->db_charset when slave server begins to execute a relay log.
The test of this bug is added into rpl_loaddata_charset.test
2009-08-12 11:54:05 +08:00
Bjorn Munch
b742c771af Bug #44012 mtr: test cases that are not supposed to return output always fail
Output would match an empty result file but we don't check
Allow empty output IFF there is an empty result file.
2009-08-11 23:41:44 +02:00
Joerg Bruehe
adaa961a3f Merge main 5.0 with 5.0-build,
automerge didn't handle this correctly,
so test "view" was corrected manually.
2009-08-11 18:59:20 +02:00
Davi Arnaut
4d6f57bfca Merge from mysql-5.0-bugteam. 2009-08-11 13:29:45 -03:00
Davi Arnaut
54958e8851 Merge from mysql-5.0-bugteam. 2009-08-11 13:22:28 -03:00
Davi Arnaut
d33a57a694 Fix tree name. 2009-08-11 13:14:27 -03:00
Joerg Bruehe
b43fb3e915 Correct a merge error that happened during a backport for 5.0.82sp1:
The test for the 45806 entry in our bug DB got applied twice,
in different places for the "view.test" and "view.result" files.

The fix is to simply remove the erroneous insertion.
2009-08-11 18:13:53 +02:00
Davi Arnaut
81b5dd8285 Update test case result due to mis-merge. 2009-08-11 13:13:06 -03:00
Vladislav Vaintroub
6e7de781d7 merge fix to define __NT__ on Windows 2009-08-11 17:47:33 +02:00
Vladislav Vaintroub
171b5d52af Always compile with __NT__ on windows. in 5.1 itthis #define is
widely used, in replication (delete_allow_opened) and for named
pipe support. We do not support Win9x anymore.
2009-08-11 17:44:13 +02:00
Davi Arnaut
b928a3295c Merge from mysql-5.1-bugteam. 2009-08-11 11:29:07 -03:00
Davi Arnaut
99734bed40 Update README. 2009-08-11 11:25:40 -03:00
Bjorn Munch
1d99f9eae5 Bug #45847 make --gdb disable all the timeouts by default
Set to one week for testcase and suite timeout
Also set one day timeout for PID file creation (not currently needed in 5.1 but might become, and is needed in azalea)
2009-08-11 15:59:05 +02:00
Sergey Vojtovich
24e418df69 Merge mysql-5.1-innodb_plugin to mysql-5.1. 2009-08-11 18:05:25 +05:00
Bjorn Munch
013717d110 Bug #44479 mysql-test-run does not detect that external server has Innodb support
Variable name mismatch
Map variable have_innodb=YES to innodb=ON
2009-08-11 12:59:43 +02:00
unknown
a2daa87980 Raise version number after cloning 5.0.85 2009-08-11 07:16:52 +02:00
Davi Arnaut
a51887143a Merge from mysql-5.0-bugteam. 2009-08-10 19:47:28 -03:00
unknown
0a7219d50c Merge 2009-08-10 20:53:26 +02:00
Davi Arnaut
19b325499e Manual merge. 2009-08-10 15:46:20 -03:00
Martin Hansson
527e5fd3a2 Merge 2009-08-10 16:08:51 +02:00
Davi Arnaut
c7163c630a Bug#45010: invalid memory reads during parsing some strange statements
The problem is that the lexer could inadvertently skip over the
end of a query being parsed if it encountered a malformed multibyte
character. A specially crated query string could cause the lexer
to jump up to six bytes past the end of the query buffer. Another
problem was that the laxer could use unfiltered user input as
a signed array index for the parser maps (having upper and lower
bounds 0 and 256 respectively).

The solution is to ensure that the lexer only skips over well-formed
multibyte characters and that the index value of the parser maps
is always a unsigned value.

mysql-test/r/ctype_recoding.result:
  Update test case result: ending backtick is not skipped over anymore.
sql/sql_lex.cc:
  Characters being analyzed must be unsigned as they can be
  used as indexes for the parser maps. Only skip over if the
  string is a valid multi-byte sequence.
tests/mysql_client_test.c:
  Add test case for Bug#45010
2009-08-07 23:32:01 -03:00
Mattias Jonsson
f42fab1b76 Bug#32430: 'show innodb status' causes errors
Invalid (old?) table or database name in logs

Post push patch.

Bug was that a non partitioned table file was not
converted to system_charset, (due to table_name_len was not set).

Also missing DBUG_RETURN.

And Innodb adds quotes after calling the function,
so I added one more mode where explain_filename does not
add quotes. But it still appends the [sub]partition name
as a comment.

Also caught a minor quoting bug, the character '`' was
not quoted in the identifier. (so 'a`b' was quoted as `a`b`
and not `a``b`, this is mulitbyte characters aware.)

sql/mysql_priv.h:
  Bug#32430: 'show innodb status' causes errors
  Invalid (old?) table or database name in logs
  
  Added an unquoted mode
sql/share/errmsg.txt:
  Bug#32430: 'show innodb status' causes errors
  Invalid (old?) table or database name in logs
  
  Removed the quoting of identifier, only leaving the translated word.
sql/sql_table.cc:
  Bug#32430: 'show innodb status' causes errors
  Invalid (old?) table or database name in logs
  
  Fixed quoting of '`'
  Added DBUG_RETURN.
  Corrected table_name_len.
  Added unquoted mode.
2009-08-07 15:08:32 +02:00
Martin Hansson
4c3917b6f8 Bug#46454: MySQL wrong index optimisation leads to incorrect result & crashes
Problem 1:
When the 'Using index' optimization is used, the optimizer may still - after
cost-based optimization - decide to use another index in order to avoid using
a temporary table. But when this happens, the flag to the storage engine to 
read index only (not table) was still set. Fixed by resetting the flag in the 
storage engine and TABLE structure in the above scenario, unless the new index
allows for the same optimization.
Problem 2:
When a 'ref' access method was employed by cost-based optimizer, (when the column
is non-NULLable), it was assumed that it needed no initialization if 'quick' access
methods (since they are based on range scan). When ORDER BY optimization overrides 
the decision, however, it expects to have this initialized and hence crashes. 
Fixed in 5.1 (was fixed in 6.0 already) by initializing 'quick' even when there's 
'ref' access. 

mysql-test/r/order_by.result:
  Bug#46454: Test result.
mysql-test/t/order_by.test:
  Bug#46454: Test case.
sql/sql_select.cc:
  Bug#46454: 
  Problem 1 fixed in make_join_select()
  Problem 2 fixed in test_if_skip_sort_order()
sql/table.h:
  Bug#46454: Added comment to field.
2009-08-07 13:51:40 +02:00
Ignacio Galarza
466847a0b8 Auto-merge 2009-08-06 10:54:53 -04:00
Ignacio Galarza
a791f20089 Bug #27535 Installing Windows service with --defaults-file option - quotation marks issues
- Remove offensive quotes.
2009-08-06 10:24:28 -04:00
Mattias Jonsson
dd10de57d3 Bug#46478: timestamp field incorrectly defaulted
when partition is reoganized.

Problem was that table->timestamp_field_type was not changed
before copying rows between partitions.

fixed by setting it to TIMESTAMP_NO_AUTO_SET as the first thing
in fast_alter_partition_table, so that all if-branches is covered.
2009-08-06 14:28:39 +02:00
Satya B
d933cb1669 Fix for BUG#45816 - assertion failure with index containing double
column on partitioned table
      
      
An assertion 'ASSERT_COULUMN_MARKED_FOR_READ' is failed if the query 
is executed with index containing double column on partitioned table.
The problem is that assertion expects all the fields which are read,
to be in the read_set.
      
In this query only the field 'a' is in the readset as the tables in
the query are joined by the field 'a' and so the assertion fails 
expecting other field 'b'.
      
Since the function cmp() is just comparison of two parameters passed, 
the assertion is not required.
      
Fixed by removing the assertion in the double fields comparision
function and also fixed the index initialization to do ordered
index scan with RW LOCK which ensures all the fields from a key are in
the read_set.
 

Note: this bug is not reproducible with other datatypes because the
      assertion doesn't exist in comparision function for other 
      datatypes.

mysql-test/r/partition.result:
  Testcase for BUG#45816
mysql-test/t/partition.test:
  Testcase for BUG#45816
sql/field.cc:
  Removed the assertion ASSERT_COLUMN_MARED_FOR_READ in Field_double::cmp()
  function
sql/ha_partition.cc:
  Fixed index_int() method to make it initialize the read_set properly if
  ordered index scan with RW lock is requested.
2009-08-06 17:01:26 +05:30
Bjorn Munch
6ddeb379fe Bug #45771 AIX and i5/OS Perl bug: check_socket_path_length in MTR fails
Bug in Perl
Scrap attempt to do this smartly on AIX, just drop the test and assume it's OK
This commit undoes the previous push and adds a line to ignore on AIX
2009-08-06 09:30:53 +02:00
unknown
70cd97722d Bug #45630 rpl_trigger.test causes valgrind failures within nptl_pthread_exit_hack_handler
The server shutdown and start code triggered the valgrind failures 
within nptl_pthread_exit_hack_handler on Ubuntu 9.04, x86 (but not amd64) 
in rpl_trigger.test file.

For fixing the bug, suppress valgrind failures within nptl_pthread_exit_hack_handler 
on Ubuntu 9.04, x86 (but not amd64). Because the server shutdown and start
code has been heavily used in mysql test set.

mysql-test/valgrind.supp:
  Add code for suppressing valgrind failures within nptl_pthread_exit_hack_handler on Ubuntu 9.04, x86 (but not amd64).
2009-08-06 11:07:09 +08:00
Jim Winstead
d58d9a5471 Merge approved bug fix 2009-08-05 13:30:14 -07:00
Bjorn Munch
47227d7f6a Bug #45771 AIX and i5/OS Perl bug: check_socket_path_length in MTR fails
Bug is actually in Perl
Fixed by trapping and ignoring error from IO::Socket::UNIX
2009-08-05 09:41:40 +02:00
Davi Arnaut
c1433ba201 Merge from mysql-5.1-bugteam. 2009-08-04 17:43:17 -03:00
Davi Arnaut
039a659608 Merge from mysql-5.0-bugteam. 2009-08-04 10:53:15 -03:00