Commit graph

62957 commits

Author SHA1 Message Date
Staale Smedseng
3b3983a408 Bug #53899 Wrong mysql_stmt_errno() after connection loss with
automatic reconnect

A client with automatic reconnect enabled will see the error
message "Lost connection to MySQL server during query" if the
connection is lost between mysql_stmt_prepare() and
mysql_stmt_execute(). The mysql_stmt_errno() number, however,
is 0 -- not the corresponding value 2013.

This patch checks for the case where the prepared statement
has been pruned due to a connection loss (i.e., stmt->mysql
has been set to NULL) during a call to cli_advanced_command(),
and avoids changing the last_errno to the result of the last
reconnect attempt.
2010-06-30 11:16:06 +02:00
Marko Mäkelä
5a25f40815 ChangeLog entry for Bug #54408 2010-06-29 16:12:19 +03:00
Marko Mäkelä
c8e48de261 Bug#54408: txn rollback after recovery: row0umod.c:673
dict_table_get_format(index->table)

The REDUNDANT and COMPACT formats store a local 768-byte prefix of
each externally stored column. No row_ext cache is needed, but we
initialized one nevertheless. When the BLOB pointer was zero, we would
ignore the locally stored prefix as well. This triggered an assertion
failure in row_undo_mod_upd_exist_sec().

row_build(): Allow ext==NULL when a REDUNDANT or COMPACT table
contains externally stored columns.

row_undo_search_clust_to_pcur(), row_upd_store_row(): Invoke
row_build() with ext==NULL on REDUNDANT and COMPACT tables.

rb://382 approved by Jimmy Yang
2010-06-29 16:00:58 +03:00
Marko Mäkelä
c43070dabe ChangeLog entry for Bug #54358 2010-06-29 15:56:53 +03:00
Marko Mäkelä
7271bcb4ec Bug#54358: READ UNCOMMITTED access failure of off-page DYNAMIC or COMPRESSED
columns

When the server crashes after a record stub has been inserted and
before all its off-page columns have been written, the record will
contain incomplete off-page columns after crash recovery. Such records
may only be accessed at the READ UNCOMMITTED isolation level or when
rolling back a recovered transaction in recv_recovery_rollback_active().
Skip these records at the READ UNCOMMITTED isolation level.

TODO: Add assertions for checking the above assumptions hold when an
incomplete BLOB is encountered.

btr_rec_copy_externally_stored_field(): Return NULL if the field is
incomplete.

row_prebuilt_t::templ_contains_blob: Clarify what "BLOB" means in this
context. Hint: MySQL BLOBs are not the same as InnoDB BLOBs.

row_sel_store_mysql_rec(): Return FALSE if not all columns could be
retrieved. Previously this function always returned TRUE.  Assert that
the record is not delete-marked.

row_sel_push_cache_row_for_mysql(): Return FALSE if not all columns
could be retrieved.

row_search_for_mysql(): Skip records containing incomplete off-page
columns. Assert that the transaction isolation level is READ
UNCOMMITTED.

rb://380 approved by Jimmy Yang
2010-06-29 15:55:18 +03:00
Dmitry Shulga
48a74d7472 Fixed bug #51855. Race condition in XA START. If several threads
concurrently execute the statement XA START 'x', then mysqld
server could crash.
2010-06-29 16:32:03 +07:00
Martin Hansson
8a2f3f4b5e Fix of bad merge of test case for Bug#41660 (test case moved). 2010-06-29 10:28:17 +02:00
Jimmy Yang
67d06a5459 Change the table name in innodb_bug54044 to lower case to avoid
platform dependent diffs.
2010-06-29 00:13:18 -07:00
Jimmy Yang
dec24a7dd8 Check in fix for bug #53756: "ALTER TABLE ADD PRIMARY KEY affects
crash recovery"

rb://369 approved by Marko
2010-06-28 19:41:37 -07:00
Luis Soares
d370a1fb50 BUG 53657: automerge bzr bundle from bug report into mysql-5.1-bugteam. 2010-06-28 23:09:00 +01:00
Davi Arnaut
1b504ab0b1 Revert Bug#48321 due to build breakage and failing tests. 2010-06-28 17:59:41 -03:00
Davi Arnaut
aa1dddd5ca Merge of mysql-5.0-bugteam into mysql-5.1-bugteam. 2010-06-28 17:29:19 -03:00
Davi Arnaut
20cc561dfa Bug#54457: Test suite broken for 32-bit build
The default value of the myisam_max_extra_sort_file_size could be
higher than the maximum accepted value, leading to warnings upon
the server start.

The solution is to simply set the value to the maximum value in a
32-bit built (2147483647, one less than the current). This should
be harmless as the option is currently unused in 5.1.
2010-06-28 16:20:28 -03:00
Davi Arnaut
07767edcce Bug#54041: MySQL 5.0.92 fails when tests from Connector/C suite run
The problem was that a user could supply supply data in chunks
via the COM_STMT_SEND_LONG_DATA command to prepared statement
parameter other than of type TEXT or BLOB. This posed a problem
since other parameter types aren't setup to handle long data,
which would lead to a crash when attempting to use the supplied
data.

Given that long data can be supplied at any stage of a prepared
statement, coupled with the fact that the type of a parameter
marker might change between consecutive executions, the solution
is to validate at execution time each parameter marker for which
a data stream was provided. If the parameter type is not TEXT or
BLOB (that is, if the type is not able to handle a data stream),
a error is returned.
2010-06-28 12:21:28 -03:00
Alfranio Correia
353e11070f merge mysql-5.1-bugteam (local) --> mysql-5.1-bugteam 2010-06-27 18:31:42 +01:00
899a1d694f The following statements support the CURRENT_USER() where a user is needed.
DROP USER 
RENAME USER CURRENT_USER() ...
GRANT ... TO CURRENT_USER()
REVOKE ... FROM CURRENT_USER()
ALTER DEFINER = CURRENT_USER() EVENTbut, When these statements are binlogged, CURRENT_USER() just is binlogged
as 'CURRENT_USER()', it is not expanded to the real user name. When slave 
executes the log event, 'CURRENT_USER()' is expand to the user of slave 
SQL thread, but SQL thread's user name always NULL. This breaks the replication.

After this patch, session's user will be written into query log events 
if these statements call CURREN_USER() or 'ALTER EVENT' does not assign a definer.
2010-06-27 12:42:06 +08:00
Jon Olav Hauglid
9fa66b6440 Bug #54360 Deadlock DROP/ALTER/CREATE DATABASE with open HANDLER
This deadlock happened if DROP DATABASE was blocked due to an open
HANDLER table from a different connection. While DROP DATABASE
is blocked, it holds the LOCK_mysql_create_db mutex. This results
in a deadlock if the connection with the open HANDLER table tries
to execute a CREATE/ALTER/DROP DATABASE statement as they all
try to acquire LOCK_mysql_create_db.

This patch makes this deadlock scenario very unlikely by closing and
marking for re-open all HANDLER tables for which there are pending
conflicing locks, before LOCK_mysql_create_db is acquired.
However, there is still a very slight possibility that a connection
could access one of these HANDLER tables between closing/marking for
re-open and the acquisition of LOCK_mysql_create_db.

This patch is for 5.1 only, a separate and complete fix will be
made for 5.5+.

Test case added to schema.test.
2010-06-26 19:36:00 +02:00
Georgi Kodinov
2b2e09086c merge 2010-06-25 16:20:22 +03:00
Georgi Kodinov
dd6d026fad Bug #53095: SELECT column_name FROM INFORMATION_SCHEMA.STATISTICS
returns nothing
      
When looking for table or database names inside INFORMATION_SCHEMA
we must convert the table and database names to lowercase (just as it's
done in the rest of the server) when lowercase_table_names is non-zero.
This will allow us to find the same tables that we would find if there
is no condition.

Fixed by converting to lower case when extracting the database and 
table name conditions.
Test case added.
2010-06-25 15:59:44 +03:00
363a2ccc0c Postfix for bug#48321
Some test cases set ANSI_QUOTES in sql_mode.
So we have to use single quotes to quote literal strings.
2010-07-04 16:17:53 +08:00
42eecc539a The following statements support the CURRENT_USER() where a user is needed.
DROP USER 
RENAME USER CURRENT_USER() ...
GRANT ... TO CURRENT_USER()
REVOKE ... FROM CURRENT_USER()
ALTER DEFINER = CURRENT_USER() EVENTbut, When these statements are binlogged, CURRENT_USER() just is binlogged
as 'CURRENT_USER()', it is not expanded to the real user name. When slave 
executes the log event, 'CURRENT_USER()' is expand to the user of slave 
SQL thread, but SQL thread's user name always NULL. This breaks the replication.

After this patch, session's user will be written into query log events 
if these statements call CURREN_USER() or 'ALTER EVENT' does not assign a definer.
2010-07-04 12:02:49 +08:00
Davi Arnaut
fb8df6c7b4 Fix somewhat bogus GCC warning. Although needless as the base
class is mostly empty, initialize the base class explicitly in
the copy constructor.
2010-07-03 10:20:05 -03:00
Davi Arnaut
082036ac6b Bug#53445: Build with -Wall and fix warnings that it generates
If bzero is not available, resort to memset. Also, remove dead
bzero.c
2010-07-02 18:42:32 -03:00
Davi Arnaut
93fb8bb235 Bug#53445: Build with -Wall and fix warnings that it generates
Apart strict-aliasing warnings, fix the remaining warnings
generated by GCC 4.4.4 -Wall and -Wextra flags.

One major source of warnings was the in-house function my_bcmp
which (unconventionally) took pointers to unsigned characters
as the byte sequences to be compared. Since my_bcmp and bcmp
are deprecated functions whose only difference with memcmp is
the return value, every use of the function is replaced with
memcmp as the special return value wasn't actually being used
by any caller.

There were also various other warnings, mostly due to type
mismatches, missing return values, missing prototypes, dead
code (unreachable) and ignored return values.
2010-07-02 15:30:47 -03:00
Sunny Bains
442ba20a92 Fix bug#54583. This change reverses rsvn:1350 by getting rid of a bogus assertion
and clarifies the invariant in dict_table_get_on_id().
      
In Mar 2007 Marko observed a crash during recovery, the crash resulted from
an UNDO operation on a system table. His solution was to acquire an X lock on
the data dictionary, this in hindsight was an overkill. It is unclear what
caused the crash, current hypothesis is that it was a memory corruption.
      
The X lock results in performance issues by when undoing changes due to
rollback during normal operation on regular tables.
      
Why the change is safe:
======================
The InnoDB code has changed since the original X lock change was made. In the
new code we always lock the data dictionary in X mode during startup when
UNDOing operations on the system tables (this is a given). This ensures that
the crash Marko observed cannot happen as long as all transactions that update
the system tables follow the standard rules by setting the appropriate DICT_OP
flag when writing the log records when they make the changes.
      
If transactions violate the above mentioned rule then during recovery (at
startup) the rollback code (see trx0roll.c) will not acquire the X lock
and we will see the crash again.  This will however be a different bug.
2010-06-25 18:18:41 +10:00
Vasil Dimov
93abdd67e5 Merge a lost changeset inaam.rana@oracle.com-20100624124843-m7ouqwe5zqcqapn1
(no changed files)
2010-06-25 11:10:44 +03:00
Vasil Dimov
011e57d24c Merge a lost changeset inaam.rana@oracle.com-20100624124450-2m3mg1238ewvakgx 2010-06-25 11:08:52 +03:00
Vasil Dimov
182a7b57d8 Merge a lost changeset marko.makela@oracle.com-20100624104820-p4ojmxcmq8qeos6d 2010-06-25 11:06:02 +03:00
Vasil Dimov
15c0777d71 Merge a lost changeset marko.makela@oracle.com-20100624104620-pklunowaigv7quu9 2010-06-25 11:03:38 +03:00
Vasil Dimov
ff9159f7d1 Merge a lost changeset jimmy.yang@oracle.com-20100624021010-oh2hnp8e1xbaax6u 2010-06-25 11:02:31 +03:00
Sergey Glukhov
700f8add12 Bug#54422 query with = 'variables'
During creation of the table list of
processed tables hidden I_S table 'VARIABLES'
is erroneously added into the table list.
it leads to ER_UNKNOWN_TABLE error in
TABLE_LIST::add_table_to_list() function.
The fix is to skip addition of hidden I_S
tables into the table list.
2010-06-25 12:01:47 +04:00
Ramil Kalimullin
479d24a213 Accidentally pushed test changes (#54459) removed. 2010-06-24 21:13:08 +04:00
Martin Hansson
dac59fa9c3 Bug#41660: Sort-index_merge for non-first join table may
require O(#scans) memory

When an index merge operation was restarted, it would
re-allocate the Unique object controlling the duplicate row
ID elimination. Fixed by making the Unique object a member
of QUICK_INDEX_MERGE_SELECT and thus reusing it throughout
the lifetime of this object.
2010-06-24 15:21:23 +02:00
Inaam Rana
39dfb2b810 merge 2010-06-24 08:48:43 -04:00
Inaam Rana
dfed638267 Add ChangeLog for bug#39168 2010-06-24 08:44:50 -04:00
Ramil Kalimullin
a08780df98 Automerge. 2010-06-24 15:26:14 +04:00
Marko Mäkelä
1910056fdc Add ChangeLog entry for Bug#54679 2010-06-24 13:48:20 +03:00
Alexey Kopytov
8b9e56b773 Automerge. 2010-06-24 14:47:09 +04:00
Marko Mäkelä
d2dfe0b8be Bug#54679: alter table causes compressed row_format to revert to compact
ha_innobase::create(): Add the local variable row_type = form->s->row_type.
Adjust it to ROW_TYPE_COMPRESSED when ROW_FORMAT is not specified or inherited
but KEY_BLOCK_SIZE is. Observe the inherited ROW_FORMAT even when it is not
explicitly specified.

innodb_bug54679.test: New test, to test the bug and to ensure that there are
no regressions. (The only difference in the test result without the patch
applied is that the first ALTER TABLE changes ROW_FORMAT to Compact.)
2010-06-24 13:46:20 +03:00
Jimmy Yang
c7afb80fe0 Fix Bug #54044 Create temporary tables and using innodb crashes. 2010-06-24 01:20:25 -07:00
Ramil Kalimullin
e233dc2bfd Fix for bug #54459: Assertion failed: param.sort_length,
file .\filesort.cc, line 149 (part II)

Problem: the server didn't disregard sort order 
for some zero length tuples.

Fix: skip sort order in such a case 
(zero length NOT NULL string functions).
2010-06-24 12:00:48 +04:00
Jimmy Yang
1b5d6a33b6 Move the fix for bug #54044 to security branch, and revert commit -r3520:3521. 2010-06-23 19:10:10 -07:00
Georgi Kodinov
c38864d426 Bug #53814: NUMERIC_PRECISION for unsigned bigint field is 19,
should be 20

Fixed the numeric precision of the unsigned BIGINT column to 
be 20 instead of 19.
2010-06-23 19:25:31 +03:00
Alexey Kopytov
0860015560 Manual merge. 2010-07-15 17:01:44 +04:00
Alexey Kopytov
b5f79c395a Null merge. 2010-07-15 16:39:48 +04:00
Davi Arnaut
d5e8508f90 Bug#42733: Type-punning warnings when compiling MySQL --
strict aliasing violations.

Post-merge fix: include my_compiler.h before my_attribute.h
as the latter will undef __attribute__ if the compiler is not
GCC. Based on the compiler version, in my_compiler.h we know
for sure whether the aligned attribute is supported. Furthermore,
undefining attribute might cause bugs if some system header
uses it.
2010-07-14 16:39:40 -03:00
Davi Arnaut
21f63caf8e Bug#42733: Type-punning warnings when compiling MySQL --
strict aliasing violations.

Another rather noisy violation of strict aliasing rules
is the spatial code which makes use of stack-based memory
(of type Geometry_buffer) to provide placement for Geometry
objects. Although a placement new is allowed to dynamically
change the type of a object, the object returned by the
new placement was being ignored and the original stack-based
object was being casted to the new type, thus violating strict
aliasing rules.

The solution is to reorganize the code so that the object
returned by the new placement is used instead of casting the
original object. Also, to ensure that the stack-based object
is properly aligned with respect to the objects it provides
placement for, a set of compiler-dependent macros and types
are introduced so that the alignment of objects can be inquired
and specified.
2010-07-14 09:27:13 -03:00
Davi Arnaut
dbef812ab9 Bug#48327: Some crashes specific to FreeBSD ("embedded")
Backport fixes from ndb: Rework the constructors of some static
object's to not call dbug functions since the constructors will
be called before main, and consequently, before the dbug library
is initialized.
2010-07-14 10:10:12 -03:00
Georgi Kodinov
b4766fc36a Bug #51876: crash/memory underrun when loading data with ucs2
and reverse() function
      
3 problems fixed : 
1. The reported problem : caused by incorrect parsing of 
the file as ucs data resulting in wrong length of the parsed
string. Fixed by truncating the invalid trailing bytes 
(non-complete multibyte characters) when reading from the file
2. LOAD DATA when reading from a proper UCS2 file wasn't 
recognizing the new line characters. Fixed by first looking 
if a byte is a new line (or any other special) character before
reading it as a part of a multibyte character.
3. When using user variables to hold the column data in LOAD
DATA the character set of the user variable was set incorrectly
to the database charset. Fixed by setting it to the charset
specified by LOAD DATA (if any).
2010-07-14 14:54:51 +03:00
Georgi Kodinov
16a7308825 Bug #53493 : add_to_status does not handle the longlong fields in STATUS_VAR
bytes_received/bytes_sent are ulonglong so they cannot be handled by the 
ulong handling code in add_to_status/add_diff_to_status().

Fixed by adding code to handle these two variables in 
add_to_status()/add_diff_to_status() and making sure they are not a subject
to the ulong handling code.
2010-07-14 11:50:17 +03:00