Commit graph

1342 commits

Author SHA1 Message Date
Annamalai Gurusami
1b892c7759 Merge from mysql-5.1 to mysql-5.5 2013-04-24 08:42:59 +02:00
unknown
d20ec0f5ba Bug :#16005310 FIx bug - INNODB_ROW_LOCK_TIME_MAX SEEMS TO HAVE AN OVERFLOW
Solution:Set diff_time to 0 if finish_time < start_time
2013-04-11 10:50:50 +08:00
Annamalai Gurusami
036787a919 Merge from mysql-5.1 to mysql-5.5 2013-03-29 22:11:33 +05:30
Annamalai Gurusami
27277df73b Bug #16244691 SERVER GONE AWAY ERROR OCCURS DEPENDING ON THE NUMBER OF
TABLE/KEY RELATIONS

The DICT_FK_MAX_RECURSIVE_LOAD was reduced from 250 to 33 in rb#2058.
But in optimized build, this recursive depth is still too deep and
resulted in stack overflow.  So reducing this depth to 20 now.
2013-03-29 22:01:10 +05:30
Annamalai Gurusami
f4b97d10a7 Bug #16244691 SERVER GONE AWAY ERROR OCCURS DEPENDING ON THE NUMBER OF
TABLE/KEY RELATIONS

Problem:

When there are many tables, linked together through the foreign key
constraints, then loading one table will recursively open other tables.  This
can sometimes lead to thread stack overflow.  In such situations the server
will exit.

I see the stack overflow problem when the thread_stack is 196608 (the default
value for 32-bit systems).  I don't see the problem when the thread_stack is
set to 262144 (the default value for 64-bit systems).

Solution:

Currently, in InnoDB, there is a macro DICT_FK_MAX_RECURSIVE_LOAD which defines
the maximum number of tables that will be loaded recursively because of foreign
key relations.  This is currently set to 250.  We can reduce this number to 33
(anything more than 33 does not solve the problem for the default value).  We
can keep it small enough so that thread stack overflow does not happen for the
default values.  Reducing the DICT_FK_MAX_RECURSIVE_LOAD will not affect the
functionality of InnoDB.  The tables will eventually be loaded. 

rb#2058 approved by Marko
2013-03-28 10:42:42 +05:30
Annamalai Gurusami
efff966148 Merge from mysql-5.1 to mysql-5.5 2013-03-28 10:25:23 +05:30
Annamalai Gurusami
38e97daee1 Bug #16244691 SERVER GONE AWAY ERROR OCCURS DEPENDING ON THE NUMBER OF
TABLE/KEY RELATIONS

Problem:

When there are many tables, linked together through the foreign key
constraints, then loading one table will recursively open other tables.  This
can sometimes lead to thread stack overflow.  In such situations the server
will exit.

I see the stack overflow problem when the thread_stack is 196608 (the default
value for 32-bit systems).  I don't see the problem when the thread_stack is
set to 262144 (the default value for 64-bit systems).

Solution:

Currently, in InnoDB, there is a macro DICT_FK_MAX_RECURSIVE_LOAD which defines
the maximum number of tables that will be loaded recursively because of foreign
key relations.  This is currently set to 250.  We can reduce this number to 33
(anything more than 33 does not solve the problem for the default value).  We
can keep it small enough so that thread stack overflow does not happen for the
default values.  Reducing the DICT_FK_MAX_RECURSIVE_LOAD will not affect the
functionality of InnoDB.  The tables will eventually be loaded. 

rb#2058 approved by Marko
2013-03-27 11:11:38 +05:30
Murthy Narkedimilli
8afe262ae5 Fix for Bug 16395495 - OLD FSF ADDRESS IN GPL HEADER 2013-03-19 15:53:48 +01:00
Murthy Narkedimilli
fe85f54640 Bug 16395495 - OLD FSF ADDRESS IN GPL HEADER 2013-03-19 13:29:12 +01:00
Vasil Dimov
57059380b5 Fix Bug#16400412 UNNECESSARY DICT_UPDATE_STATISTICS DURING CONCURRENT
UPDATES

After checking that the table has changed too much in
row_update_statistics_if_needed() and calling dict_update_statistics(),
also check if the same condition holds after acquiring the table stats
latch. This is to avoid multiple threads concurrently entering and
executing the stats update code.

Approved by:	Marko (rb:2186)
2013-03-18 17:20:30 +02:00
Aditya A
59bc951a1f Bug#16268289 LOCK_REC_VALIDATE_PAGE() MAY DEREFERENCE A POINTER TO A
FREED LOCK

ANALYIS
-------

In 5.5 code the lock_rec_block_validate() is called after releasing
the kernel mutex. There is a chance that the lock might be invalid so,
we are getting the valgrind error on invalid read on lock->index.

FIX
---

Fix would be to copy the lock->index when we are holding the kernel mutex 
and then pass it to the lock_rec_block_validate(). This implementation
is present in 5.1 code.  

[ Approved by sunny rb.no.oracle.com/rb/r/2152/ ]
2013-03-13 11:43:21 +05:30
Marko Mäkelä
d910c5acaf Bug#16409715 ASSERT SYNC_THREAD_LEVELS_G(ARRAY, LEVEL - 1, TRUE),
IBUF, FREE SPACE MANAGEMENT

ibuf_merge_or_delete_for_page(): Declare the user index page latched
for UNIV_SYNC_DEBUG after opening the change buffer cursor. This
should avoid the bogus latching order violation.

ibuf_delete_rec(): Add assertions to the callers, checking that the
mini-transaction was committed when the function returned TRUE. This
is a non-functional change, just clarifying the code.

rb#2136 approved by Kevin Lewis
2013-03-12 13:58:10 +02:00
Marko Mäkelä
b5f4385ee3 Merge mysql-5.1 to mysql-5.5. 2013-03-12 13:57:02 +02:00
Aditya A
b6b3d6e243 BUG#16069598 - SERVER CRASH BY NULL POINTER DEREFERENCING IN
MEM_HEAP_CREATE_BLOCK() 

PROBLEM
-------

If we give start mysqld with the option --innodb_log_buffer_size=50GB
,then  mem_area_alloc() function fails to allocate memory and returns
NULL.In debug version we assert at this point,but there is no check in
release version and we get a segmentation fault.

FIX
---
Added a log message saying that we are unable to allocate memory.
After this message we assert.

[Approved by Kevin http://rb.no.oracle.com/rb/r/2065 ]
2013-03-07 14:44:35 +05:30
Annamalai Gurusami
775dbed9d0 Bug #16133801 UNEXPLAINABLE INNODB UNIQUE INDEX LOCKS ON DELETE +
INSERT WITH SAME VALUES

Problem:

When a transaction is in READ COMMITTED isolation level, gap locks are still
taken in the secondary index, when row is inserted.  This happens when the
secondary index is scanned for duplicate.  

The function row_ins_scan_sec_index_for_duplicate() always calls the 
function row_ins_set_shared_rec_lock() with LOCK_ORDINARY irrespective of
the transaction isolation level.

Solution:

The function row_ins_scan_sec_index_for_duplicate() calls the 
function row_ins_set_shared_rec_lock() with LOCK_ORDINARY or 
LOCK_REC_NOT_GAP based on the transaction isolation level.

rb://2035 approved by Krunal and Marko
2013-03-06 11:49:57 +05:30
Inaam Rana
e283b56a46 Bug#16068056 INNODB CALLS BUF_VALIDATE() TOO OFTEN WITH UNIV_DEBUG
Approved by: Marko Makela (patch in bug report)

Reduce the number of debug buf_validate() calls
2013-03-05 10:47:49 -05:00
unknown
e1e43631f8 Bug #16305265 HANG IN RENAME TABLE
This is a deadlock that will also be fixed in the server by
Bug #11844915 - HANG IN THDVAR MUTEX ACQUISITION.
So this is a simple alternate method of fixing the same problem,
but from within InnoDB.

The simple change is to make rename table start a transaction
before locking dict_sys->mutex since thd_supports_xa() can call
THDVAR which can lock a mutex, LOCK_global_system_variables, that
is used in the server by many other activities.  At least one of
those, sys_var::update(), can call back into InnoDB and try to
lock dict_sys->mutex while holding LOCK_global_system_variables.

The other bug fix for 11844915 eliminates the use of
LOCK_global_system_variables for calls to THDVAR.

Approved by marko in http://rb.no.oracle.com/rb/r/2000/
2013-02-27 12:44:58 -06:00
Marko Mäkelä
a0d7f34ba6 Merge mysql-5.1 to mysql-5.5. 2013-02-27 10:04:43 +02:00
Satya Bodapati
6ca27ddec0 Testcase fix for BUG#14147491
The random failure will be fixed by Bug#16263506 and this patch

Approved by Marko. rb#1988
2013-02-20 18:25:18 +05:30
Annamalai Gurusami
84ef847056 Merge from mysql-5.1 to mysql-5.5 2013-02-14 16:35:40 +05:30
Annamalai Gurusami
b2e8e0de4f Merge from mysql-5.1 to mysql-5.5. 2013-02-12 15:35:56 +05:30
Annamalai Gurusami
8aecb30cdd Bug #11753153 INNODB GENERATES SYMBOLS THAT ARE TOO LONG, INVALID DDL
FROM SHOW CREATE

Problem: The length of the internally generated foreign key name 
is not checked. 

Solution: The length of the internally generated foreign key name is
checked.  If it is greater than the allowed limit, an error message
is reported. Also, the constraint name is printed in the same manner
as the table name, using the system charset information.

rb://1969 approved by Marko.
2013-02-12 14:52:48 +05:30
Marko Mäkelä
a6fb71e249 Bug#16292043 RACE CONDITION IN SRV_EXPORT_INNODB_STATUS() WHEN ACCESSING PURGE_SYS->VIEW
srv_export_innodb_status(): Read the purge_sys fields while holding
purge_sys->latch.

Approved by Sunny Bains
2013-02-08 09:22:46 +02:00
Marko Mäkelä
bf4c0a1a46 Merge mysql-5.1 to mysql-5.5. 2013-02-08 09:33:21 +02:00
unknown
6f83811d25 Bug#16263506 - INNODB; USE ABORT() ON ALL PLATFORMS INSTEAD OF
DEREFERENCING UT_DBG_NULL_PTR
The abort() call is standard C but InnoDB only uses it in GCC
environments.  UT_DBG_USE_ABORT is not defined the code crashed
by dereferencing a null pointer instead of calling abort().
Other code throughout MySQL including ndb, sql, mysys and other
places call abort() directly.

This bug also affects innodb.innodb_bug14147491.test which fails
randomly on windows because of this issue. 

Approved by marko in http://rb.no.oracle.com/rb/r/1936/
2013-02-06 13:49:56 -06:00
Inaam Rana
50c27a1492 Bug#16249505 INNODB REPORTS THAT IT'S GOING TO WAIT FOR I/O BUT THE
I/O IS ASYNC

rb://1934
approved by: Mikael Ronstrom (over email)
    
When submitting AIO read request don't signal that the thread is
about to wait on DISKIO
2013-02-01 09:47:16 -05:00
Aditya A
db107cb36b Bug#14756795 SELECT FROM NEW INNODB I_S TABLES CRASHES SERVER
WITH --SKIP-INNODB

Description
-----------

If the server is started with skip-innodb or InnoDB otherwise fails to
start, any one of these queries will crash the server:

For (5.5) 
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRU;
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS;

In (5.6+) ,following queries will also crash the server.

SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_INDEXES;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FIELDS;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_DATAFILES;
SELECT * FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESPACES;

FIX
----

When Innodb is not active we must prevent it from processing
these tables,so we return a warning saying that innodb is not
active.

Approved by marko (http://rb.no.oracle.com/rb/r/1891)
2013-01-30 10:53:43 +05:30
Satya Bodapati
d63f54c67d Bug#16183892 - INNODB PURGE BUFFERING IS NOT CRASH-SAFE
With innodb_change_buffering enabled, Innodb buffers
all modifications to secondary index leaf pages when
the leaf pages are not in buffer pool.

Crash InnoDB while an IBUF_OP_DELETE is being applied.
Restart and note that the same record can be applied
again which may lead to crash.

Mark the change buffer record processed, so that it will
not be merged again in case the server crashes between
the following mtr_commit() and the subsequent mtr_commit()
of deleting the change buffer record.

Testcase: No testcase because it is difficult to get the
timing right with the two asyncronous task purge and change
buffering

Approved by Marko. rb#1893
2013-01-28 20:13:44 +05:30
Yasufumi Kinoshita
7ebefeec6f Merge mysql-5.1 to mysql-5.5. 2013-01-23 15:00:46 +09:00
Marko Mäkelä
f3e2ac3067 Merge mysql-5.1 to mysql-5.5. 2013-01-21 15:19:18 +02:00
Marko Mäkelä
49adfa3d19 Bug#16138582 MTR_MEMO_RELEASE AND DYN_ARRAY TOGETHER ARE VERY INEFFICIENT
Get rid of O(n^2) scan in dyn array (mtr->memo) operations, accessing
the dyn array blocks directly.

dyn_array_get_last_block(), dyn_array_get_next_block(),
dyn_array_get_prev_block(): Define as a constness-preserving macro.

Add const qualifiers to many dyn_array functions.

mtr_memo_slot_release_func(): Renamed from mtr_memo_slot_release():
Make mtr_t* a debug-only parameter. Assume that slot->object != NULL.

mtr_memo_pop_all(): Access the dyn_array blocks directly, replacing
O(n^2) operation with O(n).

mtr_memo_release(): Access the dyn_array blocks directly, replacing
O(n^2) operation with O(n). This caused the performance problem.

rb#1540 approved by Jimmy Yang
2013-01-17 17:30:13 +02:00
Krunal Bauskar krunal.bauskar@oracle.com
07f6a96b59 Merge from mysql-5.1 to mysql-5.5 2013-01-14 10:57:04 +05:30
Krunal Bauskar krunal.bauskar@oracle.com
54c47527e2 - BUG#1608883: KILLING A QUERY INSIDE INNODB CAUSES IT TO EVENTUALLY CRASH
WITH AN ASSERTION

  Recently we added check to handle kill query signal for long operating
  queries. 
  While the query interruption is reported it must to ensure cursor is restore
  to proper state for HANDLER interface to work correctly. 
  Normal select query will not face this problem, as on recieving interrupt,
  select query is aborted and new select query result in re-initialization
  (including cursor).

  rb://1836. Approved by Marko.
2013-01-14 10:49:51 +05:30
Annamalai Gurusami
9a0f3d3d53 Bug #16004999 ASSERT STATE == TRX_STATE_NOT_STARTED, UNLOCK_ROW()
Problem:

During the index intersect access method, the SQL layer will access one row,
that satisfies a set of conditions, using an index i1.  And then it will try to
access the same row, with other set of conditions using the next index i2.  If
the fetch from i2 fails (we are talking about an error situation here and not
simply an unmatched row situation), then it will unlock the row accessed via
i1.  This will work in all situations except deadlock error.

When a deadlock happens, InnoDB will rollback the transaction.  InnoDB intimates
the SQL layer about this through the THD::transaction_rollback_request member.
But this is not currently used by the SQL layer.

Solution:

When an error happens, the SQL layer must check the 
THD::transaction_rollback_request member, before calling handler::unlock_row().
We have also added a debug assert in ha_innobase::unlock_row() checking that
it must be called only when the transaction is in active state.

rb#1773 approved by Marko and Sunny.
2013-01-10 10:28:04 +05:30
Sunny Bains
24e053deb4 Merge from mysql-5.1 to mysql-5.5. 2013-01-10 10:11:53 +11:00
Sunny Bains
df5444d47c Bug#13997024 SEGV IN SYNC_ARRAY_CELL_PRINT PRINTING OUT LONG SEMAPHORE WAIT DATA
Backport fix from mysql-5.6.
2013-01-10 10:01:50 +11:00
Satya Bodapati
d95914b648 Merge Post Fix for BUG#14628410 from mysql-5.1 to mysql-5.5 2013-01-04 17:34:02 +05:30
Annamalai Gurusami
c7fd61814f Bug #14556349 RENAME OF COMPRESSED TABLE AND INSERT BUFFER MERGE CAUSE
HANG

Problem Statement:

When the operation RENAME TABLE is about rename the tablespace of the
table, it will stop all i/o operations on the tablespace temporarily.
For this the fil_space_t::stop_ios member is used.

Once the fil_space_t::stop_ios member is set to TRUE in the RENAME
TABLE operation, it is expected that no new i/o operation will be done
on the tablespace and all pending i/o operation can be completed on
the tablespace.

If the pending i/o operations initiate any new i/o operations then
there will be deadlock.  The RENAME TABLE operation will be waiting
for pending i/o on the tablespace to be completed, and the pending i/o
operations will be waiting on the RENAME TABLE operation to set the
file_space_t::stop_ios flag to be set to FALSE.

But in the given scenario the pending i/o operations did not initiate
new i/o.  But they where still unnecessarily checking the
fil_space_t::stop_ios flag.  This resulted in deadlock.

Solution:

I noticed that this deadlock happens in fil_space_get_size() and
fil_space_get_zip_size() in the i/o threads.  These functions check
the stop_ios flag even when no i/o will be initiated.  I modified
these functions to ensure that they check the stop_ios flag only when
they will be initiating an i/o operation.  This solves the problem.

rb://1635 (mysql-5.5)
rb://1660 (mysql-trunk) approved by Inaam, Jimmy, and ima.
2012-12-20 11:59:36 +05:30
Vasil Dimov
d485482a5f Fix Bug#16021177 DICT_LOAD_FOREIGNS() PASSES UNALIGNED MEMORY TO
DTUPLE_CREATE_FROM_MEM()

Align to word-size the memory occupied by tuple_buf[] memory chunk.
I confirm that this change fixes the SIGBUS on Solaris.

Approved by:	Marko (via IM)
2012-12-19 13:46:00 +02:00
Vasil Dimov
e8ec0212bb Merge mysql-5.1 -> mysql-5.5 2012-12-18 21:02:56 +02:00
Vasil Dimov
5395f4a597 Merge mysql-5.1 -> mysql-5.5 2012-12-18 16:52:58 +02:00
Bill Qu
c3e918ea90 Approved by Jimmy and Inaam. rb#1576 2012-12-17 23:13:46 +08:00
Inaam Rana
7d9836f76e merge from 5.1 2012-12-14 11:29:07 +05:00
Marko Mäkelä
c85f51f92a Follow-up fix to Bug#14628410: Remove the Windows InnoDB Plugin specific
implementation of innobase_mysql_tmpfile() from MySQL 5.5 onwards.
2012-12-13 17:12:21 +02:00
Satya Bodapati
bf42e842e5 Merge fix for Bug#14628410 from mysql-5.1 to mysql-5.5 2012-12-13 18:56:47 +05:30
Annamalai Gurusami
2f7295575d Merging from mysql-5.1 to mysql-5.5. 2012-12-11 10:51:24 +05:30
Yasufumi Kinoshita
859ff1ec36 UNIV_DEBUG build of some environments needs
#include "read0read.h"
for srv0srv.c and trx0rec.c.
This is only for mysql-5.5
2012-12-04 12:32:58 +09:00
Inaam Rana
a418755a1a merge from 5.1 2012-11-30 16:28:58 +05:00
Yasufumi Kinoshita
ddf518c567 Bug#59354 : Bug #12659252 : ASSERT !OTHER_LOCK AT LOCK_REC_ADD_TO_QUEUE DURING A DELETE OPERATION
The converted implicit lock should wait for the prior conflicting lock if found.

rb://1437 approved by Marko
2012-11-28 17:07:02 +09:00
Yasufumi Kinoshita
8dd87e690d Bug#59354 : Bug #12659252 : ASSERT !OTHER_LOCK AT LOCK_REC_ADD_TO_QUEUE DURING A DELETE OPERATION
The converted implicit lock should wait for the prior conflicting lock if found.

rb://1437 approved by Marko
2012-11-28 17:05:23 +09:00