Commit graph

68270 commits

Author SHA1 Message Date
Jon Olav Hauglid
5e03579061 Bug #42230 during add index, cannot do queries on storage engines
that implement add_index

The problem was that ALTER TABLE blocked reads on an InnoDB table
while adding a secondary index, even if this was not needed. It is
only needed for the final step where the .frm file is updated.

The reason queries were blocked, was that ALTER TABLE upgraded the
metadata lock from MDL_SHARED_NO_WRITE (which blocks writes) to
MDL_EXCLUSIVE (which blocks all accesses) before index creation.

The way the server handles index creation, is that storage engines
publish their capabilities to the server and the server determines
which of the following three ways this can be handled: 1) build a
new version of the table; 2) change the existing table but with
exclusive metadata lock; 3) change the existing table but without
metadata lock upgrade.

For InnoDB and secondary index creation, option 3) should have been
selected. However this failed for two reasons. First, InnoDB did
not publish this capability properly.

Second, the ALTER TABLE code failed to made proper use of the
information supplied by the storage engine. A variable
need_lock_for_indexes was set accordingly, but was not later used.
This patch fixes this problem by only doing metadata lock upgrade
before index creation/deletion if this variable has been set.

This patch also changes some of the related terminology used 
in the code. Specifically the use of "fast" and "online" with
respect to ALTER TABLE. "Fast" was used to indicate that an
ALTER TABLE operation could be done without involving a
temporary table. "Fast" has been renamed "in-place" to more
accurately describe the behavior.

"Online" meant that the operation could be done without taking
a table lock. However, in the current implementation writes
are always prohibited during ALTER TABLE and an exclusive
metadata lock is held while updating the .frm, so ALTER TABLE
is not completely online. This patch replaces "online" with 
"in-place", with additional comments indicating if concurrent
reads are allowed during index creation/deletion or not.

An important part of this update of terminology is renaming
of the handler flags used by handlers to indicate if index
creation/deletion can be done in-place and if concurrent reads
are allowed. For example, the HA_ONLINE_ADD_INDEX_NO_WRITES
flag has been renamed to HA_INPLACE_ADD_INDEX_NO_READ_WRITE,
while HA_ONLINE_ADD_INDEX is now HA_INPLACE_ADD_INDEX_NO_WRITE.
Note that this is a rename to clarify current behavior, the
flag values have not changed and no flags have been removed or
added.

Test case added to innodb_mysql_sync.test.
2011-01-26 14:23:29 +01:00
Alfranio Correia
47238d4465 merge mysql-5.1 --> mysql-5.5 2011-01-26 12:44:09 +00:00
Alfranio Correia
5a19661d4f Disabled rpl_row_until and rpl_stm_until due to BUG#59543. 2011-01-26 12:37:24 +00:00
Libing Song
a64a0e0f89 Auto Merge. 2011-01-26 15:35:18 +08:00
Libing Song
1912894672 Null Merge. 2011-01-26 15:32:41 +08:00
Libing Song
c895aba35c Postfix bug#49124
Updated the copyright.
2011-01-26 15:30:06 +08:00
Bjorn Munch
6481849afa null upmerge 2011-01-25 15:08:53 +01:00
Bjorn Munch
360289d319 merge 59063 2011-01-25 14:46:45 +01:00
Bjorn Munch
fe91320f9c merge 59063 2011-01-25 14:44:26 +01:00
Bjorn Munch
4e5438ef45 null upmerge 2011-01-25 13:32:18 +01:00
Bjorn Munch
bb4d86bf10 merge from 5.5 main 2011-01-25 13:08:59 +01:00
Bjorn Munch
60faa02188 merge from 5.1 main 2011-01-25 13:07:23 +01:00
Magnus Blåudd
243b95fba5 Merge 2011-01-24 11:09:53 +01:00
245c3f497a Postfix BUG#58546
Updated Copyright.
2011-01-24 11:48:54 +08:00
Bjorn Munch
342291c0e4 upmerge 59063 2011-01-21 15:03:21 +01:00
Bjorn Munch
0850b60759 Bug #59063 rpl_migration_crash_safe fails on Windows
Race condition may occur: mtr sees the .expect file but it's empty
Fix: wait and try again if file is empty
Addendum: try again if line isn't 'wait' or 'restart'
Also added verbose printout of extra restart options
2011-01-21 13:57:21 +01:00
Martin Hansson
9ff1ace7a6 Merge. 2011-01-20 09:25:17 +01:00
Magnus Blåudd
8834fda51b Cherry pick fix fo detecting MySQL CLuster in mtr.pl 2011-01-19 15:47:56 +01:00
Martin Hansson
616e2227cc Bug#59173: Failure to handle DATE(TIME) values where Year, Month or Day is
ZERO
      
When dates are represented internally as strings, i.e. when a string constant
is compared to a date value, both values are converted to long integers,
ostensibly for fast comparisons. DATE typed integer values are converted to
DATETIME by multiplying by 1,000,000 (each digit pair representing hour,
minute and second, respectively). But the mechanism did not distuinguish
cached INTEGER values, already in correct format, from newly converted
strings.

Fixed by marking the INTEGER cache as being of DATETIME format.
2011-01-19 15:09:32 +01:00
Alexander Barkov
d967925cfc Updating Copyright information 2011-01-19 16:17:52 +03:00
Bjorn Munch
ff7df1d872 merge from 5.1-mtr 2011-01-19 12:55:37 +01:00
Bjorn Munch
084d081060 null upmerge 2011-01-19 12:02:30 +01:00
Bjorn Munch
bca3102f7e merge from 5.5 main 2011-01-19 11:21:20 +01:00
Bjorn Munch
5a9b65cb1e merge from 5.1 main 2011-01-19 11:19:54 +01:00
Libing Song
921dcabe90 Automerge 2011-01-19 01:57:58 +08:00
Anitha Gopi
72a109bff5 automerge 2011-01-18 23:33:02 +05:30
Anitha Gopi
ff7d07062d Bug#47449: This problem not seen in PB2. Remove from experimental group 2011-01-18 23:21:39 +05:30
Libing Song
2d0fcc1d44 Manual merge 2011-01-19 01:38:10 +08:00
Libing Song
5d75729c92 Bug#58546 test rpl_packet timeout failure sporadically on PB
rpl_packet got a timeout failure sporadically on PB when stopping
slave. The real reason of this bug is that STOP SLAVE stopped
IO thread first and then stopped SQL thread. It was
possible that IO thread stopped after replicating part of a
transaction which SQL thread was executing. SQL thread would
be hung if the transaction could not be rolled back safely.
            
After this patch, STOP SLAVE will stop SQL thread first and then stop IO
thread, which guarantees that IO thread will fetch the reset of the
events of the transaction that SQL thread is executing, so that SQL
thread can finish the transaction if it cannot be rolled back safely.
            
Added below auxiliary files to make the test code neater.
restart_slave_sql.inc
rpl_connection_master.inc
rpl_connection_slave.inc
rpl_connection_slave1.inc
2011-01-19 01:23:49 +08:00
John H. Embretsen
634b102533 Post push test fix for show_check.test.
Fix for bug#45740 introduced test case using SHOW TABLE STATUS against a Memory table using latin1 character in table name.
The test failed on Windows and FreeBSD due to a difference in the value for Avg_row_length.
The average row length normally depends on the values for data length and row count. According to the 5.5 manual data length is approximate with Memory tables.
With MyISAM and InnoDB the Avg_row_length is the same on Windows and Solaris.
The solution implemented by this patch is to mask out the value for Avg_row_length, as it may vary when using Memory tables.
2011-01-18 13:04:17 +01:00
Bjorn Munch
8379f01b62 upmerge undo of 59063 2011-01-18 12:39:23 +01:00
Bjorn Munch
9c7abc2549 Bug #59063 rpl_migration_crash_safe fails on Windows
Undoing the patch, it complicates the code but is not the solution

I do not beleive newline mismatch could be the cause of this failure
First, I cannot see how this could be a problem, mtr ignores the newline
  when reading the expect file, and the file is written and read on Windows.
Second, if this really was the problem it should have been deterministic:
  either the newline is correctly interepreted or it is not.
2011-01-18 12:25:07 +01:00
Bjorn Munch
813af29b73 oops forgot one file in last commit 2011-01-18 12:11:52 +01:00
Bjorn Munch
9093399b29 Some more copyright fixes in mtr 2011-01-18 12:06:25 +01:00
Bjorn Munch
89aa03aea6 Some more copyright fixes in mtr 2011-01-18 12:01:40 +01:00
Bjorn Munch
7b9c438099 Fixed copyright headers in mtr src files 2011-01-18 11:21:37 +01:00
Bjorn Munch
097445ebf5 Fixed copyright headers in mtr src files 2011-01-18 11:03:44 +01:00
Alexander Barkov
8a576b8360 Merging from 5.1. 2011-01-18 09:50:03 +03:00
Alexander Barkov
cf0e22fe75 Bug#44332 my_xml_scan reads behind the end of buffer
Problem: the scanner function tested for strings "<![CDATA[" and
"-->" without checking input string boundaries, which led to valgrind's
"Conditional jump or move depends on uninitialised value(s)" error.

Fix: Adding boundary checking.

  @ mysql-test/r/xml.result
  @ mysql-test/t/xml.test
  Adding test

  @ strings/xml.c
  Adding a helper function my_xml_parser_prefix_cmp(),
  with input string boundary check.
2011-01-18 09:38:41 +03:00
Vinay Fisrekar
3712d6c12f Merge from mysql-5.1 for
sys_vars.innodb_max_dirty_pages_pct_func fails sporadically
2011-01-18 09:30:00 +05:30
Vinay Fisrekar
f25ab9fe22 BUG#58858 : sys_vars.innodb_max_dirty_pages_pct_func fails sporadically
Committing After latest merge.      
Modified check_pct procedure to check return value of wait condition instead 
of calling "dirty_pct".
   
Adding Review comments:
1) Added comment for success variable value
2) Procedure check_pct changed For Adding BOOLEAN input and SELECT QUERY Change
2011-01-18 09:24:52 +05:30
Luis Soares
f6e9720f3c BUG#42879: CHANGE MASTER RELAY_LOG_FILE=path fails on windows
Re-enabling the test case on windows since BUG#12190 has fixed
the issue.
2011-01-17 18:51:01 +00:00
Magnus Blåudd
d30ba619eb mtr.pl fixes for ndb
- Support for graceful shutdown of cluster by using "ndb_mgm -e 'shutdown'"
2011-01-17 15:23:37 +01:00
Magnus Blåudd
abed4d1683 mtr.pl fixes for ndb
- Make it possible to use MTR_MAXNDB to set the upper limit of number of
  parallel ndb test to run.
 - Very useful on machines with many cores and lots of RAM
2011-01-17 15:20:49 +01:00
Magnus Blåudd
93486750a1 mtr.pl fixes for ndb
-  Find ndbmtd and use it round robin
2011-01-17 15:18:44 +01:00
Alexander Barkov
18e4f23a88 Bug#58371 Assertion failed: !s.uses_buffer_owned_by(this) with format string function
Introduced by the fix for bug#44766.

Problem: it's not correct to use args[0]->str_value as a buffer,
because args[0] may need this buffer for its own purposes.

Fix: adding a new class member tmp_value to use as return value.

  @ mysql-test/r/ctype_many.result
  @ mysql-test/t/ctype_many.test
  Adding tests

  @ sql/item_strfunc.cc
  Changing code into traditional style:
  use "str" as a buffer for the argument and tmp_value for the result value.

  @ sql/item_strfunc.h
  Adding tmp_value
2011-01-17 15:11:33 +03:00
Bjorn Munch
2d3b1b7fbf null upmerge 2011-01-17 11:01:25 +01:00
Bjorn Munch
15661ae0ad merge from 5.5 main 2011-01-17 10:32:16 +01:00
Alexander Barkov
1c9515f616 Bug#59149 valgrind warnings with "like .. escape .." function
Problem: when processing a query like:
  SELECT '' LIKE '1' ESCAPE COUNT(1);
escape_item->val_str() was never executed and the "escape" class member
stayed initialized, which led to valgrind uninitialized memory error.
      
Note, a query with some tables in "FROM" clause
returns ER_WRONG_ARGUMENTS in the same situation:

   SELECT '' LIKE '1' ESCAPE COUNT(1) FROM t1;
   ERROR 1210 (HY000): Incorrect arguments to ESCAPE

Fix: disallowing using aggregate functions in ESCAPE clause,
even if there are no tables used. There is no much use of that anyway.
2011-01-17 12:30:22 +03:00
Bjorn Munch
21a60acb77 merge from 5.1 main 2011-01-17 10:28:53 +01:00