Commit graph

13 commits

Author SHA1 Message Date
Sergey Vojtovich
282497dd6d MDEV-6720 - enable connection log in mysqltest by default 2016-03-31 10:11:16 +04:00
Sergei Golubchik
c8ee83ee8a after merge test case fixes 2014-05-08 10:25:16 +02:00
Sergei Golubchik
914a2b38bf merge of "BUG# 13975227: ONLINE OPTIMIZE TABLE FOR INNODB TABLES"
revno: 5820
committer: Nisha Gopalakrishnan <nisha.gopalakrishnan@oracle.com>
branch nick: mysql-5.6-13975225
timestamp: Mon 2014-02-17 15:12:16 +0530
message:
  BUG# 13975227: ONLINE OPTIMIZE TABLE FOR INNODB TABLES
2014-05-07 22:36:25 +02:00
Sergei Golubchik
2492d007d5 fix innodb_mysql_sync test - update from 5.6 2013-07-10 17:10:22 +02:00
Sergei Golubchik
1efdd5a572 rename debug variable to debug_dbug, to make test pass in release builds
(and to follow the naming conventons).
keep old debug variable, but mark it as deprecated.
2011-12-15 22:07:58 +01:00
Jon Olav Hauglid
edcd89ee1e Bug#11853126 RE-ENABLE CONCURRENT READS WHILE CREATING
SECONDARY INDEX IN INNODB

This is a follow-up patch.

This patch moves part of the new test coverage to a test
file that is only run on debug builds since it used debug-
only features and therefore broke the test case on
release builds.
2011-06-01 13:52:20 +02:00
Jon Olav Hauglid
9b076952ec Bug#11853126 RE-ENABLE CONCURRENT READS WHILE CREATING
SECONDARY INDEX IN INNODB

The patches for Bug#11751388 and Bug#11784056 enabled concurrent
reads while creating secondary indexes in InnoDB. However, they
introduced a regression. This regression occured if ALTER TABLE
failed after the index had been added, for example during the
lock upgrade needed to update .FRM. If this happened, InnoDB
and the server got out of sync with regards to which indexes
actually existed. Therefore the patch for Bug#11815600 again
disabled concurrent reads.

This patch re-enables concurrent reads. The original regression
is fixed by splitting the ADD INDEX operation into two parts.
First the new index is created but not made active. This is
done while concurrent reads are allowed. The second part of
the operation makes the index active (or reverts the change).
This is done after lock upgrade, which prevents the original
regression.

In order to implement this change, the patch changes the storage
API for in-place index creation. handler::add_index() is split
into two functions, handler_add_index() and
handler::final_add_index(). The former for creating indexes without
making them visible and the latter for commiting (i.e. making
visible) new indexes or reverting the changes.

Large parts of this patch were written by Marko Mäkelä.

Test case added to innodb_mysql_lock.test.
2011-06-01 10:06:55 +02:00
Jon Olav Hauglid
fc6ef378d4 Bug#11815600 [ERROR] INNODB COULD NOT FIND INDEX PRIMARY
KEY NO 0 FOR TABLE IN ERROR LOG 

With the changes made by the patches for Bug#11751388 and
Bug#11784056, concurrent reads are allowed while secondary
indexes are created in InnoDB. This means that the metadata
lock on the affected table is not upgraded to exclusive
until the .FRM is updated at the end of ALTER TABLE processing.

The problem was that if this lock upgrade failed for some
reason (e.g. timeout), the index information in the server
and inside InnoDB would be out of sync. This would happen
since the add index operation already was committed inside 
InnoDB but the table metadata inside the server had not been
updated yet.

This patch fixes the problem by (for now) reverting the
effects of the patches for Bug#11751388 and Bug#11784056.
Concurrent reads will now again be blocked during creation
of secondary indexes in InnoDB.

Test case added to innodb_mysql_lock.test.
2011-03-09 16:06:13 +01:00
Jon Olav Hauglid
e99f2b1c4e 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
Jon Olav Hauglid
6bbfe7c62a Bug #58933 Assertion `thd- >is_error()' fails on shutdown with ongoing
OPTIMIZE TABLE

OPTIMIZE TABLE for InnoDB tables is handled as recreate + analyze.
The triggered assert checked that an error had been reported if either
recreate or analyze failed. However the assert failed to take into
account that they could have failed because OPTIMIZE TABLE had been
victim of KILL QUERY, KILL CONNECTION or server shutdown.

This patch adjusts the assert to take this possibility into account.
The problem was only noticeable on debug versions of the server.

Test case added to innodb_mysql_sync.test.
2011-01-10 14:12:23 +01:00
Jon Olav Hauglid
9b5d1d98da Bug #53757 assert in mysql_truncate_by_delete
The assert was triggered if a connection executing TRUNCATE
on a InnoDB table was killed during open_tables.

This bug was fixed in the scope of Bug #45643
"InnoDB does not support replication of TRUNCATE TABLE".

This patch adds test coverage to innodb_mysql_sync.test.
2010-06-25 09:07:18 +02:00
Jon Olav Hauglid
cf8df9ca44 Bug #47459 Assertion in Diagnostics_area::set_eof_status on OPTIMIZE TABLE
This assertion could be triggered during execution of OPTIMIZE TABLE for
InnoDB tables. As part of optimize for InnoDB tables, the table is recreated
and then opened again. If the reopen failed for any reason, the assertion
would be triggered. This could for example be caused by a concurrent DROP
TABLE executed by a different connection. The reason for the assertion was
that any failures during reopening were ignored.

This patch fixes the problem by making sure that the result of reopening the
table is checked and that any error messages are sent to the client.

Test case added to innodb_mysql_sync.test.
2010-04-15 18:53:57 +02:00
Jon Olav Hauglid
4235167fcf Backport of revno: 2599.169.2
Bug #42074 concurrent optimize table and 
           alter table = Assertion failed: thd->is_error()

This assertion could occur if OPTIMIZE TABLE was started on a InnoDB table
and the table was altered to different storage engine after OPTIMIZE
had started. This allowed OPTIMIZE to pass the initial checks for 
storage engine support, but fail once it reached "recreate+analyze"
if this operation was not supported by the new storage engine.
The bug had no consequences for non-debug builds of the server.

In detail, the assertion was triggered when ha_analyze() returned 
HA_ADMIN_NOT_IMPLEMENTED. This led to a code path which included an 
assert checking for diagnostics area contents. Since this area had 
not been filled, the assertion was triggered. The diagnostics area 
is in this case only used to provide more detailed information about 
why optimize failed. The triggered code path sends this information 
to the client and clears the diagnostic area.

This patch fixed the problem by adding an error message to the diagnostic 
area if ha_analyze() fails. This error message contains the error code
returned by ha_analyze().

Test case added to innodb_mysql_sync.test.
2009-12-09 09:32:29 +01:00