Commit graph

67592 commits

Author SHA1 Message Date
Dmitry Lenev
602a22259e Fix for bug #57985 "ONLINE/FAST ALTER PARTITION can fail and
leave the table unusable".
 
Failing ALTER statement on partitioned table could have left
this table in an unusable state. This has happened in cases
when ALTER was executed using "fast" algorithm, which doesn't 
involve copying of data between old and new versions of table, 
and the resulting new table was incompatible with partitioning
function in some way.
 
The problem stems from the fact that discrepancies between new 
table definition and partitioning function are discovered only 
when the table is opened. In case of "fast" algorithm this has
happened too late during ALTER's execution, at the moment when
all changes were already done and couldn't have been reverted.
 
In the cases when "slow" algorithm, which copies data, is used 
such discrepancies are detected at the moment new table
definition is opened implicitly when new version of table is
created in storage engine. As result ALTER is aborted before 
any changes to table were done.
 
This fix tries to address this issue by ensuring that "fast"
algorithm behaves similarly to "slow" algorithm and checks
compatibility between new definition and partitioning function 
by trying to open new definition after .FRM file for it has 
been created.
 
Long term we probably should implement some way to check
compatibility between partitioning function and new table
definition which won't involve opening it, as this should
allow much cleaner fix for this problem.

mysql-test/r/partition_innodb.result:
  Added test for bug #57985 "ONLINE/FAST ALTER PARTITION can
  fail and leave the table unusable".
mysql-test/t/partition_innodb.test:
  Added test for bug #57985 "ONLINE/FAST ALTER PARTITION can
  fail and leave the table unusable".
sql/sql_table.cc:
  Ensure that in cases when .FRM for partitioned table is
  created without creating table in storage engine (e.g.
  during "fast" ALTER TABLE) we still open table definition. 
  This allows to check that definition of created table/.FRM 
  is compatible with its partitioning function.
2010-11-19 10:26:09 +03:00
Jon Olav Hauglid
7771250d2b Merge from mysql-5.5-bugteam to mysql-5.5-runtime
No conflicts
2010-11-18 17:52:53 +01:00
Jon Olav Hauglid
2215dc3cc1 Merge from mysql-5.5-runtime to mysql-5.5-bugteam
No conflicts
2010-11-18 16:01:58 +01:00
Alexander Barkov
a6f40e5071 Auto-merge 2010-11-18 17:10:43 +03:00
Vasil Dimov
4ea01e28d7 Merge mysql-5.1-bugteam -> mysql-5.5-bugteam (empty) 2010-11-18 16:12:13 +02:00
Alexander Barkov
185e189da3 Bug#57306 SHOW PROCESSLIST does not display string literals well.
Problem: Extended characters outside of ASCII range where not displayed
properly in SHOW PROCESSLIST, because thd_info->query was always sent as 
system_character_set (utf8). This was wrong, because query buffer
is never converted to utf8 - it is always have client character set.

Fix: sending query buffer using query character set

  @ sql/sql_class.cc
  @ sql/sql_class.h
    Introducing a new class CSET_STRING, a LEX_STRING with character set.
    Adding set_query(&CSET_STRING)
    Adding reset_query(), to use instead of set_query(0, NULL).

  @ sql/event_data_objects.cc
    Using reset_query()

  @ sql/log_event.cc
    Using reset_query()
    Adding charset argument to set_query_and_id().

  @ sql/slave.cc
    Using reset_query().

  @ sql/sp_head.cc
    Changing backing up and restore code to use CSET_STRING.

  @ sql/sql_audit.h
    Using CSET_STRING.
    In the "else" branch it's OK not to use
    global_system_variables.character_set_client.
    &my_charset_latin1, which is set in constructor, is fine
    (verified with Sergey Vojtovich).

  @ sql/sql_insert.cc
    Using set_query() with proper character set: table_name is utf8.

  @ sql/sql_parse.cc
    Adding character set argument to set_query_and_id().
    (This is the main point where thd->charset() is stored
     into thd->query_string.cs, for use in "SHOW PROCESSLIST".)
    Using reset_query().
    
  @ sql/sql_prepare.cc
    Storing client character set into thd->query_string.cs.

  @ sql/sql_show.cc
    Using CSET_STRING to fetch and send charset-aware query information
    from threads.

  @ storage/myisam/ha_myisam.cc
    Using set_query() with proper character set: table_name is utf8.

  @ mysql-test/r/show_check.result
  @ mysql-test/t/show_check.test
    Adding tests
2010-11-18 17:08:32 +03:00
Vasil Dimov
cae834561e Merge mysql-5.1-bugteam from bk-internal into my local repo 2010-11-18 16:04:53 +02:00
Vasil Dimov
c8353d51ae Merge mysql-5.5-bugteam from bk-internal into my local repo 2010-11-18 16:02:30 +02:00
Vasil Dimov
759c5b0a1f Merge mysql-5.1-bugteam -> mysql-5.5-bugteam (empty) 2010-11-18 15:48:45 +02:00
Vasil Dimov
5aa89abf59 Merge mysql-5.5-innodb -> mysql-5.5-bugteam 2010-11-18 15:47:05 +02:00
Vasil Dimov
dacd97b487 Merge mysql-5.1-innodb -> mysql-5.1-bugteam 2010-11-18 15:45:36 +02:00
Davi Arnaut
e0a17f5698 In certain phases of query processing, a interrupted error might
be sent to a user even if its the connection that is actually
being killed.
2010-11-18 11:41:08 -02:00
Alexander Barkov
eab35cc8cf Merging from mysql-5.1-bugteam. 2010-11-18 16:35:15 +03:00
Alexander Barkov
8f4af42145 Bug#57279 updatexml dies with: Assertion failed: str_arg[length] == 0
Problem: crash in Item_float constructor on DBUG_ASSERT due
to not null-terminated string parameter.

Fix: making Item_float::Item_float non-null-termintated parameter safe:
- Using temporary buffer when generating error

modified:
  @ mysql-test/r/xml.result
  @ mysql-test/t/xml.test
  @ sql/item.cc
2010-11-18 16:11:18 +03:00
Magne Mahre
54d6357837 Bug#58199 name_const in the having clause crashes
NAME_CONST(..) was used wrongly in a HAVING clause, and
should have caused a user error.  Instead, it caused a
segmentation fault.
      
During parsing, the value parameter to NAME_CONST was
specified to be an uninitialized Item_ref object (it
would be resolved later).   During the semantic analysis,
the object is tested, and since it was not initialied,
the server seg.faulted.
      
The fix is to check if the object is initialized
before testing it.  The same pattern has already been
applied to most other methods in the Item_ref class.
      
Bug was introduced by the optimization done as part of
Bug#33546.
2010-11-18 14:02:24 +01:00
Davi Arnaut
c45458524c Fix a debug assertion caused by a missing DBUG_RETURN macro.
sql/sql_acl.cc:
  Must use DBUG_RETURN in a function instrumented with DBUG_ENTER.
2010-11-17 19:02:48 -02:00
Tor Didriksen
36ab257491 Bug #58137 char(0) column cause: my_gcvt: Assertion `width > 0 && to != ((void *)0)' failed
mysql-test/r/func_math.result:
  Add test for Bug #58137
mysql-test/t/func_math.test:
  Add test for Bug #58137
sql/field.cc:
  Skip calling my_gcvt() if we are trying to insert a double into a char(0) column.
2010-11-17 16:39:35 +01:00
Davi Arnaut
cd9bee8da2 Merge of mysql-5.1-bugteam into mysql-5.5-bugteam. 2010-11-17 07:50:19 -02:00
Davi Arnaut
c324624291 Bug#57994: Compiler flag change build error : my_redel.c
Use __builtin_stpcpy only if the system supports stpcpy.
This is necessary as in some cases a call to stpcpy will
be emitted if the built-in can not optimized.

include/m_string.h:
  The expansion of stpcpy (in glibc) causes warnings if the
  return value of strmov is not being used. Since stpcpy is
  a GNU extension and the expansion ends up using a built-in
  provided by GCC, use the compiler provided built-in directly
  when possible. Nonetheless, the C library must have stpcpy
  as a call be emitted if the built-in can not optimized.
2010-11-17 07:41:29 -02:00
Davi Arnaut
247a696d79 Bug#57058: SERVER_QUERY_WAS_SLOW not wired up.
Finalize the server flags after any kind of command is executed.
To avoid updating the flag multiple times, reorganize code so that
its invoked only once for each command.

sql/log_event.cc:
  Explicit update after the query is executed in the slave.
sql/sql_parse.cc:
  Reorganize so that the status flag is updated for any command and
  not done twice for a query command.
2010-11-16 19:57:18 -02:00
Jon Olav Hauglid
b5ec360731 Merge from mysql-5.5-bugteam to mysql-5.5-runtime
No conflicts
2010-11-17 17:42:28 +01:00
Jon Olav Hauglid
1e9f239e8f Bug #57663 Concurrent statement using stored function and DROP DATABASE
breaks SBR

The problem was that DROP DATABASE ignored any metadata locks on stored
functions and procedures held by other connections. This made it
possible for DROP DATABASE to drop functions/procedures that were in use
by other connections and therefore break statement based replication.
(DROP DATABASE could appear in the binlog before a statement using a
dropped function/procedure.)

This problem was an issue left unresolved by the patch for Bug#30977
where metadata locks for stored functions/procedures were introduced.

This patch fixes the problem by making sure DROP DATABASE takes
exclusive metadata locks on all stored functions/procedures to be
dropped.

Test case added to sp-lock.test.
2010-11-17 15:37:23 +01:00
Mats Kindahl
9aa70e5188 Merging with mysql-5.5-bugteam 2010-11-16 12:19:24 +01:00
Mats Kindahl
4ea1b2fcb1 Merging with mysql-5.5-bugfixing. 2010-11-16 12:12:09 +01:00
Mats Kindahl
34b8e774b8 Bug #58173: Valgrind warning in load_defaults()
Memory was allocated for storing path names inside
fn_expand(), which were not free:ed anywhere.

This patch fixes the problem by storing the path
names in statically allocated buffers instead,
which is automatically free:ed when the server
exits.
2010-11-16 11:58:39 +01:00
Jon Olav Hauglid
0ef8d8e26c Bug #57663 Concurrent statement using stored function and DROP DATABASE
breaks SBR

This pre-requisite patch refactors the code for dropping tables, used
by DROP TABLE and DROP DATABASE. The patch moves the code for acquiring
metadata locks out of mysql_rm_table_part2() and makes it the
responsibility of the caller. This in preparation of changing the
DROP DATABASE implementation to acquire all metadata locks before any
changes are made. mysql_rm_table_part2() is renamed
mysql_rm_table_no_locks() to reflect the change.
2010-11-16 11:00:12 +01:00
Davi Arnaut
0d0b3f8aca Merge of mysql-5.1-bugteam into mysql-5.5-bugteam. 2010-11-16 07:45:07 -02:00
Jon Olav Hauglid
0caa22b145 Merge from mysql-5.5-bugteam to mysql-5.5-runtime
No conflicts
2010-11-16 10:05:19 +01:00
Marc Alff
d6d16303cd Local merge 2010-11-16 06:59:26 +01:00
Marc Alff
030c757f9f Local merge 2010-11-16 06:45:24 +01:00
Mattias Jonsson
7bf0df4667 disabled main.create-big as pre-push fix 2010-11-16 02:01:49 +01:00
Mattias Jonsson
717fa1902f Manual merge of bug#58197 to mysql-5.5.
Including adding test in 5.5 requiring --big-test
flag from mysql-test-run.pl and also disabled
tests that fails.

mysql-test/collections/default.weekly:
  Added all tests requiring --big-test in alphabetical order
mysql-test/r/information_schema-big.result:
  Updated result
mysql-test/r/variables-big.result:
  updated results
mysql-test/t/disabled.def:
  Added tests that fails (has not been run
  regularly since they need --big-test)
2010-11-16 01:11:06 +01:00
Mattias Jonsson
6780abfce6 merge 2010-11-15 23:57:14 +01:00
Mattias Jonsson
a94819be10 merge 2010-11-15 23:38:26 +01:00
Mattias Jonsson
80257cd48a merge 2010-11-15 17:44:27 +01:00
Mattias Jonsson
3df98a289c merge 2010-11-15 17:13:53 +01:00
Jorgen Loland
1945734c2d Bug#54812: assert in Diagnostics_area::set_ok_status
during EXPLAIN

Before the patch, send_eof() of some subclasses of 
select_result (e.g., select_send::send_eof()) could 
handle being called after an error had occured while others 
could not. The methods that were not well-behaved would trigger
an ASSERT on debug builds. Release builds were not affected.

Consider the following query as an example for how the ASSERT
could be triggered:

A user without execute privilege on f() does
   SELECT MAX(key1) INTO @dummy FROM t1 WHERE f() < 1;
resulting in "ERROR 42000: execute command denied to user..." 

The server would end the query by calling send_eof(). The 
fact that the error had occured would make the ASSERT trigger. 

select_dumpvar::send_eof() was the offending method in the
bug report, but the problem also applied to other 
subclasses of select_result. This patch uniforms send_eof() 
of all subclasses of select_result to handle being called 
after an error has occured. 

mysql-test/r/not_embedded_server.result:
  Added test for BUG#54812
mysql-test/t/not_embedded_server.test:
  Added test for BUG#54812
sql/sql_class.cc:
  send_eof() of all subclasses of select_result can now handle being
  called after an error has occured.
sql/sql_insert.cc:
  send_eof() of all subclasses of select_result can now handle being
  called after an error has occured.
  Also fix call to abort() in select_create::send_eof(), which was supposed to abort the result set, not terminate the server. This call to abort() should have been changed when the function was renamed from abort_result_set() but was forgotten. New test case added by BUG#54812 covered this line and terminated server.
sql/sql_prepare.cc:
  send_eof() of all subclasses of select_result can now handle being
  called after an error has occured.
sql/sql_update.cc:
  send_eof() of all subclasses of select_result can now handle being
  called after an error has occured.
2010-11-15 16:18:04 +01:00
Mattias Jonsson
47b514ffce Bug#58197: main.variables-big fails on windows
The test result differs on windows, since
it writes out 'localhost:<port>' instead of
only 'localhost', since it uses tcp/ip instead
of unix sockets on windows.

Fixed by replacing that column.

Also requires --big-test from some long running tests
and added a weekly run of all test requiring --big-test.

mysql-test/collections/default.weekly:
  Added a run of big-test (already exists in 5.5).
mysql-test/r/variables-big.result:
  Updated results
mysql-test/suite/parts/t/part_supported_sql_func_innodb.test:
  requiring --big-test since the test takes long time
mysql-test/suite/parts/t/partition_alter1_1_2_innodb.test:
  requiring --big-test since the test takes long time
mysql-test/suite/parts/t/partition_alter1_2_innodb.test:
  requiring --big-test since the test takes long time
mysql-test/suite/parts/t/partition_alter4_innodb.test:
  requiring --big-test since the test takes long time
mysql-test/t/disabled.def:
  Disabled two tests since they fail and was already
  reported as bugs (but was never run since they requires
  --big-test flag).
mysql-test/t/variables-big.test:
  Replacing column 3 in process list since it
  is not the same on windows as in unix.
2010-11-15 16:17:38 +01:00
Jon Olav Hauglid
a3d9a26d3b Bug #57663 Concurrent statement using stored function and DROP DATABASE
breaks SBR

This pre-requisite patch removes obsolete and dead code used to remove
raid subdirectories and files during DROP DATABASE.

Other parts of the raid code have already been removed in WL#5498
and the support for MyISAM raid tables was removed in 5.0.
2010-11-15 12:32:49 +01:00
Jimmy Yang
f64026427e Fix Bug #16290 Unclear error message when adding foreign key constraint
rb://502 approved by Sunny Bains
2010-11-14 23:08:04 -08:00
Vladislav Vaintroub
9893c5a248 merge 2010-11-13 23:17:22 +01:00
Vladislav Vaintroub
f0c2b9c5c6 add missing COMPONENT to all CMake INSTALL commands 2010-11-13 23:16:52 +01:00
Vladislav Vaintroub
1b6bf12b11 Bug#58178: "make package" is broken with cmake 2.8.3
Problem:  with "make package" , many small packages are 
generated, one per CMake COMPONENT, instead of expected single
package. This is due to the new (in cmake 2.8.3) component-based 
install for archive( e.g ZIP,TGZ ) CPack generators.

See http://public.kitware.com/Bug/view.php?id=11452 for discussion.

Fix: use CPACK_MONOLITHIC_INSTALL=1 to enforce single package.
Reset this variable temporarily to 0 for  MSI creation  (MSI needs 
COMPONENTs)
2010-11-13 19:38:39 +01:00
Alexander Nozdrin
3fa437cf40 Fix for Bug#56934 (mysql_stmt_fetch() incorrectly fills MYSQL_TIME
structure buffer).

This is a follow-up for WL#4435. The bug actually existed not only
MYSQL_TYPE_DATETIME type. The problem was that Item_param::set_value()
was written in an assumption that it's working with expressions, i.e.
with basic data types.

There are two different quick fixes here:
  a) Change Item_param::make_field() -- remove setting of
     Send_field::length, Send_field::charsetnr, Send_field::flags and
     Send_field::type.

     That would lead to marshalling all data using basic types to the client
     (MYSQL_TYPE_LONGLONG, MYSQL_TYPE_DOUBLE, MYSQL_TYPE_STRING and
     MYSQL_TYPE_NEWDECIMAL). In particular, that means, DATETIME would be
     sent as MYSQL_TYPE_STRING, TINYINT -- as MYSQL_TYPE_LONGLONG, etc.

     That could be Ok for the client, because the client library does
     reverse conversion automatically (the client program would see DATETIME
     as MYSQL_TIME object). However, there is a problem with metadata --
     the metadata would be wrong (misleading): it would say that DATETIME is
     marshaled as MYSQL_TYPE_DATETIME, not as MYSQL_TYPE_STRING.

  b) Set Item_param::param_type properly to actual underlying field type.
     That would lead to double conversion inside the server: for example,
     MYSQL_TIME-object would be converted into STRING-object
     (in Item_param::set_value()), and then converted back to MYSQL_TIME-object
     (in Item_param::send()).

     The data however would be marshalled more properly, and also metadata would
     be correct.

This patch implements b).

There is also a possibility to avoid double conversion either by clonning
the data field, or by storing a reference to it and using it on Item::send()
time. That requires more work and might be done later.
2010-11-13 18:05:02 +03:00
Joerg Bruehe
b4d5039e71 Patch for bug#57596
MySQL-shared RPM no longer provides mysql-shared

The spec file is changed to explicitly "provide" "mysql-shared"
by the "shared" sub-RPM.
2010-11-12 22:22:55 +01:00
Konstantin Osipov
86bc11a54f Fix a compilation failure of non-debug build introduced
by the patch for Bug#57058.


sql/sql_error.cc:
  Delete assignment of a removed class member.
2010-11-12 17:20:12 +03:00
Dmitry Lenev
2f5b308f3b Follow-up for patch fixing bug #57006 "Deadlock between
HANDLER and FLUSH TABLES WITH READ LOCK" and bug #54673
"It takes too long to get readlock for 'FLUSH TABLES
WITH READ LOCK'".

Disable execution of flush_read_lock.test on embedded
server. This test uses too many statements which are
not supported by embedded server.
2010-11-12 16:57:08 +03:00
Konstantin Osipov
78fa2e4d6d Implement a fix for Bug#57058 -- send SERVER_QUERY_WAS_SLOW over
network when a query was slow.

When a query is slow, sent a special flag to the client
indicating this fact.

Add a test case.
Implement review comments.



include/mysql_com.h:
  Clear SERVER_QUERY_WAS_SLOW at end of each statement.
  Since this patch removes the technique when 
  thd->server_status is modified briefly only to
  execute my_eof(), reset more server status
  bit that may remain in the status from
  execution of the previous statement.
sql/protocol.cc:
  Always use thd->server_status to 
  in net_* functions to send the latest
  status to the client.
sql/sp_head.cc:
  Calculate if a query was slow before
  sending EOF packet.
sql/sql_cursor.cc:
  Remove juggling with thd->server_status.
  The extra status bits are reset at
  start of the next statement.
sql/sql_db.cc:
  Remove juggling with thd->server_status.
  The extra status bits are reset at
  start of the next statement.
sql/sql_error.cc:
  Remove m_server_status member,
  it's not really part of the Diagnostics_area.
sql/sql_error.h:
  Remove server_status member, it's
  not part of the Diagnostics_area.
  The associated hack is removed as well.
sql/sql_parse.cc:
  Do not calculate if a query was
  slow twice. Use a status flag in thd->server_status.
tests/mysql_client_test.c:
  Add a test case for Bug#57058.
  Check that the status is present
  at the client, when sent.
2010-11-12 15:56:21 +03:00
Vladislav Vaintroub
36fffdeaa2 Bug#58074: ADD_VERSION_INFO cmake/mysql_version.cmake fails if LINK_FLAGS are modified
Backport version info handling  (Windows-specific) from next-mr. 
Instead of adding ".res" object as linker flag, add  resource file (.rc) file to the source list.
This is more obvious and less error prone method.
2010-11-12 13:42:50 +01:00
Jon Olav Hauglid
f11b9a88eb Merge from mysql-5.5-bugteam to mysql-5.5-runtime
Text conflict in mysql-test/suite/perfschema/r/dml_setup_instruments.result
Text conflict in mysql-test/suite/perfschema/r/global_read_lock.result
Text conflict in mysql-test/suite/perfschema/r/server_init.result
Text conflict in mysql-test/suite/perfschema/t/global_read_lock.test
Text conflict in mysql-test/suite/perfschema/t/server_init.test
2010-11-12 12:23:17 +01:00