Commit graph

3081 commits

Author SHA1 Message Date
Sergei Golubchik
6ef139780d MDEV-6497 InnoDB deadlocks on UNINSTALL PLUGIN
Free the trx of the current thd (if any) in innobase_end()
2014-07-29 09:09:52 +02:00
Jan Lindström
c104965746 Fix test failure caused by simulated compression failure on
IBUF_DUMMY table.
2014-07-25 09:34:05 +03:00
Jan Lindström
7bf45bec54 Fix too agressive long semaphore wait output and add guard against introducing
compression failures on insert buffer.
2014-07-24 14:35:09 +03:00
Jan Lindström
be00265557 Fix compiler errors on product build. 2014-07-23 13:52:17 +03:00
unknown
de0c78c019 BUG#18942294 - SEGV IN DICT_FIND_TABLE_BY_SPACE TRYING TO MARK SPACE CORRUPT
IN RECOVERY

During redo log processing, the data dictionary is not available. We should
check it in dict_find_table_by_space() to prevent SEGV error.

rb#5678, approved by Jimmy.
2014-07-08 15:10:15 +08:00
bin.x.su@oracle.com
95ec5bdd71 BUG#18942294 - SEGV IN DICT_FIND_TABLE_BY_SPACE TRYING TO MARK SPACE CORRUPT
IN RECOVERY

During redo log processing, the data dictionary is not available. We should
check it in dict_find_table_by_space() to prevent SEGV error.

rb#5678, approved by Jimmy.
2014-07-08 15:10:15 +08:00
Annamalai Gurusami
301032d20a Bug #19140907 DUPLICATES IN UNIQUE SECONDARY INDEX BECAUSE OF FIX OF BUG#68021
Problem:

When a unique secondary index is scanned for duplicate checking, gap locks
were not taken if the transaction had isolation level <= READ COMMITTED. 
This change was done while fixing Bug #16133801 UNEXPLAINABLE INNODB UNIQUE
INDEX LOCKS ON DELETE + INSERT WITH SAME VALUES (rb#2035). Because of this
the duplicate check logic failed, and resulted in duplicate values in unique
secondary index.

Solution:

When a unique secondary index is scanned for duplicate checking, gap locks
must be taken irrespective of the transaction isolation level.  This is
achieved by reverting rb#2035.

rb#5910 approved by Jimmy
2014-07-03 10:13:29 +05:30
Annamalai Gurusami
76e690fb37 Bug #19140907 DUPLICATES IN UNIQUE SECONDARY INDEX BECAUSE OF FIX OF BUG#68021
Problem:

When a unique secondary index is scanned for duplicate checking, gap locks
were not taken if the transaction had isolation level <= READ COMMITTED. 
This change was done while fixing Bug #16133801 UNEXPLAINABLE INNODB UNIQUE
INDEX LOCKS ON DELETE + INSERT WITH SAME VALUES (rb#2035). Because of this
the duplicate check logic failed, and resulted in duplicate values in unique
secondary index.

Solution:

When a unique secondary index is scanned for duplicate checking, gap locks
must be taken irrespective of the transaction isolation level.  This is
achieved by reverting rb#2035.

rb#5910 approved by Jimmy
2014-07-03 10:13:29 +05:30
Gopal Shankar
119984db0c Bug#18776592 INNODB: FAILING ASSERTION: PRIMARY_KEY_NO == -1 ||
PRIMARY_KEY_NO == 0 

This bug is a backport of the following revision of 5.6 source tree:
# committer: Gopal Shankar <gopal.shankar@oracle.com>
# branch nick: priKey56
# timestamp: Wed 2013-05-29 11:11:46 +0530
# message:
#   Bug#16368875 INNODB: FAILING ASSERTION:
2014-06-25 09:50:17 +05:30
Gopal Shankar
e107c24f1c Bug#18776592 INNODB: FAILING ASSERTION: PRIMARY_KEY_NO == -1 ||
PRIMARY_KEY_NO == 0 

This bug is a backport of the following revision of 5.6 source tree:
# committer: Gopal Shankar <gopal.shankar@oracle.com>
# branch nick: priKey56
# timestamp: Wed 2013-05-29 11:11:46 +0530
# message:
#   Bug#16368875 INNODB: FAILING ASSERTION:
2014-06-25 09:50:17 +05:30
Jan Lindström
ebf3437810 MDEV-5673: Crash while parallel dropping multiple tables under heavy load
Improve long semaphore wait output to include all semaphore waits
and try to find out if there is a sequence of waiters.
2014-07-23 09:04:59 +03:00
Jan Lindström
67eb6f33a9 MDEV-5670: Assertion failure in file buf0lru.c line 2355
Add more status information if repeatable.
2014-07-22 22:08:06 +03:00
unknown
71a596b90c Makes innodb/xtradb compilable in 5.5 2014-07-15 12:37:34 +03:00
Jan Lindström
970163d0be MDEV-6348: mariadb crash signal 11
Analysis: sync array output function, should make sure that all 
used pointers are valid before using them.
2014-07-08 17:21:13 +03:00
Jan Lindström
8d8c456dbb MDEV-5621: Server random crash on ALTER TABLE
This is not a real fix, instead try to gather additional information
at the point when dictionary content is not what we expect it to be.
2014-07-04 12:25:32 +03:00
Jan Lindström
c922048368 MDEV-6191: row_search_for_mysql comment and code consistency about isolation level
and gap locks
2014-07-04 08:42:59 +03:00
Annamalai Gurusami
b5299f3559 Bug #18806829 OPENING INNODB TABLES WITH MANY FOREIGN KEY REFERENCES IS
SLOW/CRASHES SEMAPHORE

Problem:

There are 2 lakh tables - fk_000001, fk_000002 ... fk_200000.  All of them
are related to the same parent_table through a foreign key constraint.
When the parent_table is loaded into the dictionary cache, all the child table
will also be loaded.  This is taking lot of time.  Since this operation happens
when the dictionary latch is taken, the scenario leads to "long semaphore wait"
situation and the server gets killed.

Analysis:

A simple performance analysis showed that the slowness is because of the
dict_foreign_find() function.  It does a linear search on two linked list
table->foreign_list and table->referenced_list, looking for a particular
foreign key object based on foreign->id as the key.  This is called two
times for each foreign key object.

Solution:

Introduce a rb tree in table->foreign_rbt and table->referenced_rbt, which
are some sort of index on table->foreign_list and table->referenced_list
respectively, using foreign->id as the key.  These rbt structures will be
solely used by dict_foreign_find().  

rb#5599 approved by Vasil
2014-06-10 09:35:50 +05:30
Annamalai Gurusami
ada5a9a2cf Bug #18806829 OPENING INNODB TABLES WITH MANY FOREIGN KEY REFERENCES IS
SLOW/CRASHES SEMAPHORE

Problem:

There are 2 lakh tables - fk_000001, fk_000002 ... fk_200000.  All of them
are related to the same parent_table through a foreign key constraint.
When the parent_table is loaded into the dictionary cache, all the child table
will also be loaded.  This is taking lot of time.  Since this operation happens
when the dictionary latch is taken, the scenario leads to "long semaphore wait"
situation and the server gets killed.

Analysis:

A simple performance analysis showed that the slowness is because of the
dict_foreign_find() function.  It does a linear search on two linked list
table->foreign_list and table->referenced_list, looking for a particular
foreign key object based on foreign->id as the key.  This is called two
times for each foreign key object.

Solution:

Introduce a rb tree in table->foreign_rbt and table->referenced_rbt, which
are some sort of index on table->foreign_list and table->referenced_list
respectively, using foreign->id as the key.  These rbt structures will be
solely used by dict_foreign_find().  

rb#5599 approved by Vasil
2014-06-10 09:35:50 +05:30
Sergei Golubchik
5d16592d44 mysql-5.5.38 merge 2014-06-03 09:55:08 +02:00
Jan Lindström
1adf9e7984 MDEV-6257: MariaDB 5.5 fails to start with 10.0 InnoDB log files
Analysis: Can't disable the error message because you may get database
started with incorrect log file size. 

Fix: Thus only improve the error message to give more information 
to users.
2014-05-22 16:20:56 +03:00
Jan Lindström
75137522b9 MDEV-6257: MariaDB 5.5 fails to start with 10.0 InnoDB log files
Analysis: By default 10.0 creates 48M log files and 5.5 assumes they
are 5M.

Fix: Remove the error and do size comparison later.
2014-05-21 13:14:43 +03:00
Thirunarayanan B
0df90f2a6f Bug #17858679 TOO MANY TIMES OF MEMSET DECREASE
THE PERFORMANCE UNDER HEAVY INSERT
	Fixing the build problem in 5.5.
2014-04-01 11:36:58 +05:30
Thirunarayanan B
5e9a285164 Bug #17858679 TOO MANY TIMES OF MEMSET DECREASE
THE PERFORMANCE UNDER HEAVY INSERT
	Fixing the build problem in 5.5.
2014-04-01 11:36:58 +05:30
Thirunarayanan B
5541d7c656 Bug #17858679 TOO MANY TIMES OF MEMSET DECREASE
THE PERFORMANCE UNDER HEAVY INSERT
Problem:
	There are three memset call to allocate memory for system fields
in each insert.

Solution:
	Instead of calling it in 3 times, we can combine it into
one memset call. It will reduce the CPU usage under heavy insert.

	Approved by Marko rb-4916
2014-04-01 10:46:13 +05:30
Thirunarayanan B
cacd22428c Bug #17858679 TOO MANY TIMES OF MEMSET DECREASE
THE PERFORMANCE UNDER HEAVY INSERT
Problem:
	There are three memset call to allocate memory for system fields
in each insert.

Solution:
	Instead of calling it in 3 times, we can combine it into
one memset call. It will reduce the CPU usage under heavy insert.

	Approved by Marko rb-4916
2014-04-01 10:46:13 +05:30
Jan Lindström
772aa0c575 MDEV-6160: InnoDB: Failing assertion: page_is_comp(next_page) == page_is_comp(page)
This is not yet a fix. This is change to print additional information at the point
when this assertion is going to happen. Print as much information about the pages
and index to find out why next page is not a compact format.
2014-04-28 08:30:05 +03:00
Sergei Golubchik
cb67dcb618 mysql-5.5.37 selective merge 2014-03-27 22:26:58 +01:00
Satya Bodapati
a559f6abf7 Bug#18124788 - COMPRESSED TABLES REGRESSION FROM 5.6.13
After incrementing the number of pending uncompression operations,
buffer pool zip mutex can be released immediately.

Approved by Vasil. rb#4514
2014-02-28 12:45:53 +05:30
Satya Bodapati
30d5c84b7d Bug#18124788 - COMPRESSED TABLES REGRESSION FROM 5.6.13
After incrementing the number of pending uncompression operations,
buffer pool zip mutex can be released immediately.

Approved by Vasil. rb#4514
2014-02-28 12:45:53 +05:30
Murthy Narkedimilli
075a2fb716 Updated/added copyright header. Added line "use is subject to license terms"
to copyright header.
2014-02-17 18:19:04 +05:30
Murthy Narkedimilli
42bfa90874 Updated/added copyright header. Added line "use is subject to license terms"
to copyright header.
2014-02-17 18:19:04 +05:30
Thirunarayanan B
9ea02a1c09 Bug #18010711 UNIQUE PREFIX INDEX ON BINARY COLUMN:
FAILING ASSERTION: FLEN == LEN

Problem:
       Broken invariant triggered when building a unique index on a
binary column and the input data contains duplicate keys. This was broken
in debug builds only.

Fix:
       Fixed length of the binary datatype can be greater than length of
the shorter prefix on which index is being created.
2014-02-17 13:45:34 +05:30
Thirunarayanan B
255e450651 Bug #18010711 UNIQUE PREFIX INDEX ON BINARY COLUMN:
FAILING ASSERTION: FLEN == LEN

Problem:
       Broken invariant triggered when building a unique index on a
binary column and the input data contains duplicate keys. This was broken
in debug builds only.

Fix:
       Fixed length of the binary datatype can be greater than length of
the shorter prefix on which index is being created.
2014-02-17 13:45:34 +05:30
Jan Lindström
752ba087c8 MDEV-5746: Slow file extend when innodb_use_fallocate=1 and SSD
file storage.

Analysis: posix_fallocate was called using 0 as offset and len as
desired size. This is not optimal for SSDs.

Fix: Call posix_fallocate with correct offset i.e. current file size
and extend the file from there len bytes.
2014-02-26 13:49:50 +02:00
Jan Lindström
e479829a15 MDEV-5742: Assertion failure node->n_pending on fil0fil.c line 5039
on debug build when innodb_use_fallocate=1

Analysis: There was merge error that caused additional call to 
fil_node_complete_io.

Fixed by removing incorrect call and fixed calculation of extended
file size.
2014-02-26 12:06:12 +02:00
Sergei Golubchik
84651126c0 MySQL-5.5.36 merge
(without few incorrect bugfixes and with 1250 files where only a copyright year was changed)
2014-02-17 11:00:51 +01:00
Annamalai Gurusami
6193c63211 Bug#18185930 UPD_NODE_INSERT_BLOB CAUSES BTR_EXTERN_OWNER_FLAG ASSERTION
Problem:

In the clustered index, when an update operation is done the overall
scenario (after rb#4479) is as follows:

1.  Delete mark the old record that is to be updated.
2.  The old record disowns the blobs.
3.  Insert the new record into clustered index.
4.  For non-updated blobs, new record must own it. Verified by assert.
5.  For non-updated blobs, in new record marked as inherited.

Scenario involving DB_LOCK_WAIT:

If step 3 times out, then we will skip 1 and 2 and will continue from
step 3.  This skipping is achieved by the UPD_NODE_INSERT_BLOB state.
In this case, step 4 is not correct.  Because of step 1, the new
record need not own the blobs.  Hence the assert failure.

Solution:

The assert in step 4 is removed.  Instead code is added to ensure that
the record owns the blob.  

Note:

This is a regression caused by rb#4479.

rb#4571 approved by Marko
2014-02-11 16:44:37 +05:30
Annamalai Gurusami
723c0a1ba5 Bug#18185930 UPD_NODE_INSERT_BLOB CAUSES BTR_EXTERN_OWNER_FLAG ASSERTION
Problem:

In the clustered index, when an update operation is done the overall
scenario (after rb#4479) is as follows:

1.  Delete mark the old record that is to be updated.
2.  The old record disowns the blobs.
3.  Insert the new record into clustered index.
4.  For non-updated blobs, new record must own it. Verified by assert.
5.  For non-updated blobs, in new record marked as inherited.

Scenario involving DB_LOCK_WAIT:

If step 3 times out, then we will skip 1 and 2 and will continue from
step 3.  This skipping is achieved by the UPD_NODE_INSERT_BLOB state.
In this case, step 4 is not correct.  Because of step 1, the new
record need not own the blobs.  Hence the assert failure.

Solution:

The assert in step 4 is removed.  Instead code is added to ensure that
the record owns the blob.  

Note:

This is a regression caused by rb#4479.

rb#4571 approved by Marko
2014-02-11 16:44:37 +05:30
Thirunarayanan B
7acdf29cb4 Bug #14049391 INNODB MISCALCULATES AUTO-INCREMENT AFTER DECREASING
AUTO_INCREMENT_INCREMENT
Problem:
=======
When auto_increment_increment system variable decreases,
immediate next value of auto increment column is not affected.

Solution:
========
	Get the previous inserted value of auto increment column by
subtracting the previous auto_increment_increment from next
auto increment value. After that calculate the current autoinc value
using newly changed auto_increment_increment variable.

	Approved by Sunny [rb#4394]
2014-02-10 10:13:35 +05:30
Thirunarayanan B
7c12a9e5c3 Bug #14049391 INNODB MISCALCULATES AUTO-INCREMENT AFTER DECREASING
AUTO_INCREMENT_INCREMENT
Problem:
=======
When auto_increment_increment system variable decreases,
immediate next value of auto increment column is not affected.

Solution:
========
	Get the previous inserted value of auto increment column by
subtracting the previous auto_increment_increment from next
auto increment value. After that calculate the current autoinc value
using newly changed auto_increment_increment variable.

	Approved by Sunny [rb#4394]
2014-02-10 10:13:35 +05:30
Annamalai Gurusami
d13408f8e4 Bug #14668683 ASSERT REC_GET_DELETED_FLAG(REC, PAGE_IS_COMP(PAGE))
Problem:

The function row_upd_changes_ord_field_binary() is used to decide whether to
use row_upd_clust_rec_by_insert() or row_upd_clust_rec().  The function
row_upd_changes_ord_field_binary() does not make use of charset information.
Based on binary comparison it decides that r1 and r2 differ in their ordering
fields.

In the function row_upd_clust_rec_by_insert(), an update is done by delete +
insert.  These operations internally make use of cmp_dtuple_rec_with_match()
to compare records r1 and r2.  This comparison takes place with the use of
charset information.

This means that it is possible for the deleted record to be reused in the
subsequent insert.  In the given scenario, the characters 'a' and 'A' are
considered equal in the my_charset_latin1.  When this happens, the ownership
information of externally stored blobs are not correctly handled.

Solution:

When an update is done by delete followed by insert, disown the relevant
externally stored fields during the delete marking itself (within the same
mtr).  If the insert succeeds, then nothing with respect to blob ownership
needs to be done.  If the insert fails, then the disown done earlier will be
removed when the operation is rolled back.

rb#4479 approved by Marko.
2014-01-30 12:38:13 +05:30
Annamalai Gurusami
761735d9b9 Bug #14668683 ASSERT REC_GET_DELETED_FLAG(REC, PAGE_IS_COMP(PAGE))
Problem:

The function row_upd_changes_ord_field_binary() is used to decide whether to
use row_upd_clust_rec_by_insert() or row_upd_clust_rec().  The function
row_upd_changes_ord_field_binary() does not make use of charset information.
Based on binary comparison it decides that r1 and r2 differ in their ordering
fields.

In the function row_upd_clust_rec_by_insert(), an update is done by delete +
insert.  These operations internally make use of cmp_dtuple_rec_with_match()
to compare records r1 and r2.  This comparison takes place with the use of
charset information.

This means that it is possible for the deleted record to be reused in the
subsequent insert.  In the given scenario, the characters 'a' and 'A' are
considered equal in the my_charset_latin1.  When this happens, the ownership
information of externally stored blobs are not correctly handled.

Solution:

When an update is done by delete followed by insert, disown the relevant
externally stored fields during the delete marking itself (within the same
mtr).  If the insert succeeds, then nothing with respect to blob ownership
needs to be done.  If the insert fails, then the disown done earlier will be
removed when the operation is rolled back.

rb#4479 approved by Marko.
2014-01-30 12:38:13 +05:30
unknown
93609b57c6 BUG 18117322 - DEFINE INNODB_THREAD_SLEEP_DELAY MAX VALUE
The maximum value for innodb_thread_sleep_delay is 4294967295 (32-bit) or
18446744073709551615 (64-bit) microseconds. This is way too big, since
the max value of innodb_thread_sleep_delay is limited by
innodb_adaptive_max_sleep_delay if that value is set to non-zero value
(its default is 150,000).

Solution
The maximum value of innodb_thread_sleep_delay should be the same as
the maximum value of innodb_adaptive_max_sleep_delay, which is 1000000.

Approved by Jimmy, rb#4429
2014-01-24 09:57:25 +08:00
bin.x.su@oracle.com
de6cdc7952 BUG 18117322 - DEFINE INNODB_THREAD_SLEEP_DELAY MAX VALUE
The maximum value for innodb_thread_sleep_delay is 4294967295 (32-bit) or
18446744073709551615 (64-bit) microseconds. This is way too big, since
the max value of innodb_thread_sleep_delay is limited by
innodb_adaptive_max_sleep_delay if that value is set to non-zero value
(its default is 150,000).

Solution
The maximum value of innodb_thread_sleep_delay should be the same as
the maximum value of innodb_adaptive_max_sleep_delay, which is 1000000.

Approved by Jimmy, rb#4429
2014-01-24 09:57:25 +08:00
Sergei Golubchik
37d240ecf9 MySQL-5.5.35 merge 2014-01-22 15:29:36 +01:00
Aditya A
dc1365d6b4 Bug#16287752 INNODB_DATA_FILE_PATH MINIMUM SIZE
IN DOCUMENTATION
Problem 
-------
The documentation says that we support 'K' prefix 
while specifiying size for innodb datafile in the
server variable for innodb_data_file_path ,but the
function srv_parse_megabytes() only handles only 
'M' (megabytes) and 'G' (gigabytes) .

Fix
---
Modify srv_parse_megabytes() to handle Kilobytes. 

Add in documentation that while specifying size 
in KB it should be mentioned in multiples of 1024
other wise they will be rounded off to nearest
MB (megabyte) boundry .(eg if size mentioned
as 2313KB will be considered as 2 MB ).

[ Approved by Marko #rb 2387 ]
2014-01-08 22:25:41 +05:30
Aditya A
657ffcd74c Bug#16287752 INNODB_DATA_FILE_PATH MINIMUM SIZE
IN DOCUMENTATION
Problem 
-------
The documentation says that we support 'K' prefix 
while specifiying size for innodb datafile in the
server variable for innodb_data_file_path ,but the
function srv_parse_megabytes() only handles only 
'M' (megabytes) and 'G' (gigabytes) .

Fix
---
Modify srv_parse_megabytes() to handle Kilobytes. 

Add in documentation that while specifying size 
in KB it should be mentioned in multiples of 1024
other wise they will be rounded off to nearest
MB (megabyte) boundry .(eg if size mentioned
as 2313KB will be considered as 2 MB ).

[ Approved by Marko #rb 2387 ]
2014-01-08 22:25:41 +05:30
Aditya A
64b697ca99 Bug#12762390 SHOW INNODB STATUS REPORTS NON-FK
ERRORS IN THE FK SECTION

ANALYSIS
--------

Any error during the renaming of the table was 
incorrectly logged in the dict_foreign_err_file
and it showed up in foreign key section when
we give the query "show engine innodb status".

FIX
---
Prevent renaming error from being logged in 
dict_foreign_err_file section.  

[Aprooved by marko #rb 2501 ]
2013-12-29 16:55:24 +05:30
Aditya A
96ae8409e1 Bug#12762390 SHOW INNODB STATUS REPORTS NON-FK
ERRORS IN THE FK SECTION

ANALYSIS
--------

Any error during the renaming of the table was 
incorrectly logged in the dict_foreign_err_file
and it showed up in foreign key section when
we give the query "show engine innodb status".

FIX
---
Prevent renaming error from being logged in 
dict_foreign_err_file section.  

[Aprooved by marko #rb 2501 ]
2013-12-29 16:55:24 +05:30
Elena Stepanova
253ed701e9 A fix for MySQL#65146 introduced a new warning.
Minor wording changes in skip messages.
2013-11-28 19:54:07 +04:00
Sergei Golubchik
fa3f8a18b2 mysql-5.5.34 merge
(some patches reverted, test case added)
2013-11-19 13:16:25 +01:00
unknown
f4cf756204 Testcase i_innodb.innodb-alter-restart.test fails on some Windows platforms
possibly since it was introduced in the patch for Bug#16720368 around 
2013-04-30.  This fix is simply to adjust the mtr.add_suppression() lines
in the testcase and to add a missing "\n" in the error message.

Approved by Marko in RB 3746
2013-10-29 11:39:04 -05:00
kevin.lewis@oracle.com
5253ec162c Testcase i_innodb.innodb-alter-restart.test fails on some Windows platforms
possibly since it was introduced in the patch for Bug#16720368 around 
2013-04-30.  This fix is simply to adjust the mtr.add_suppression() lines
in the testcase and to add a missing "\n" in the error message.

Approved by Marko in RB 3746
2013-10-29 11:39:04 -05:00
Mattias Jonsson
6d483cf3ab post-push fix for bug#17565888/bug#14621190 2013-10-28 17:08:31 +01:00
Mattias Jonsson
e8077731bd post-push fix for bug#17565888/bug#14621190 2013-10-28 17:08:31 +01:00
Mattias Jonsson
7a524cee32 post-push fix for bug17565888. 2013-10-19 15:29:51 +02:00
Mattias Jonsson
aceb173714 post-push fix for bug17565888. 2013-10-19 15:29:51 +02:00
Mattias Jonsson
a91fcaf460 post-push fix for bug17565888.
Too restrictive assertion, failing during purge
2013-10-18 23:49:35 +02:00
Mattias Jonsson
6be5ea37d0 post-push fix for bug17565888.
Too restrictive assertion, failing during purge
2013-10-18 23:49:35 +02:00
Mattias Jonsson
e6a734a7cf post-push fix for bug17565888.
Too restrictive assertion, can fail during purge
2013-10-18 23:39:15 +02:00
Mattias Jonsson
4ff62c01ce post-push fix for bug17565888.
Too restrictive assertion, can fail during purge
2013-10-18 23:39:15 +02:00
Mattias Jonsson
20f579ea16 Bug#17565888: UP TO 75% INCREASE IN DBT3 QUERY (Q7) EXECUTION TIME
Regression from bug#14621190 due to disabled optimistic restoration
of cursor, which required full key lookup instead of verifying
if previously positioned btree cursor could be reused.

Fixed by enable optimistic restore and adjust cursor afterward.

rb#3324 approved by Marko.
2013-10-18 19:25:59 +02:00
Mattias Jonsson
f4fd68857b Bug#17565888: UP TO 75% INCREASE IN DBT3 QUERY (Q7) EXECUTION TIME
Regression from bug#14621190 due to disabled optimistic restoration
of cursor, which required full key lookup instead of verifying
if previously positioned btree cursor could be reused.

Fixed by enable optimistic restore and adjust cursor afterward.

rb#3324 approved by Marko.
2013-10-18 19:25:59 +02:00
Anil Toshniwal
7c3d3f192e Bug#17513737 INTRODUCE CHECK TABLE...QUICK
--Implemented CHECK TABLE...QUICK.
  Introduce CHECK TABLE...QUICK that would skip the btr_validate_index()
  and btr_search_validate() call, and count the no. of records in each index.

Approved by Marko and Kevin. (rb#3567).
2013-10-17 18:09:04 +05:30
Anil Toshniwal
ccfd3a0e75 Bug#17513737 INTRODUCE CHECK TABLE...QUICK
--Implemented CHECK TABLE...QUICK.
  Introduce CHECK TABLE...QUICK that would skip the btr_validate_index()
  and btr_search_validate() call, and count the no. of records in each index.

Approved by Marko and Kevin. (rb#3567).
2013-10-17 18:09:04 +05:30
Praveenkumar Hulakund
c66a037dca Bug#17474166 - EXECUTING STATEMENT LIKE 'SHOW ENGINE INNODB'
AND 'KILL SESSION' LEAD TO CRASH               

Analysis:
--------
This situation occurs when the connection executes query 
"show engine innodb status" and this connection is killed by
executing statement "kill <con>" by another connection.

In function "innodb_show_status", function "stat_print"
is called to print the status but return value of function
is not checked.  After killing connection, if write to 
connection fails then error is returned and same is set
in Diagnostic area. Since FALSE is returned from
"innodb_show_status" now, assert to check no error
is set in function "set_eof_status" (called from
my_eof) is failing. 

Fix:
----
Changed code to check return value of function "stat_print"
in "innodb_show_status".
2013-10-09 13:32:31 +05:30
Praveenkumar Hulakund
5411549732 Bug#17474166 - EXECUTING STATEMENT LIKE 'SHOW ENGINE INNODB'
AND 'KILL SESSION' LEAD TO CRASH               

Analysis:
--------
This situation occurs when the connection executes query 
"show engine innodb status" and this connection is killed by
executing statement "kill <con>" by another connection.

In function "innodb_show_status", function "stat_print"
is called to print the status but return value of function
is not checked.  After killing connection, if write to 
connection fails then error is returned and same is set
in Diagnostic area. Since FALSE is returned from
"innodb_show_status" now, assert to check no error
is set in function "set_eof_status" (called from
my_eof) is failing. 

Fix:
----
Changed code to check return value of function "stat_print"
in "innodb_show_status".
2013-10-09 13:32:31 +05:30
Yasufumi Kinoshita
f071aca09f Merge mysql-5.1 to mysql-5.5. 2013-10-07 15:17:56 +09:00
Yasufumi Kinoshita
0369cf932d Merge mysql-5.1 to mysql-5.5. 2013-10-07 15:17:56 +09:00
Yasufumi Kinoshita
1fbe6c5005 Bug#17431533 : FAILING ASSERTION: INDEX->PAGE != 0XFFFFFFFF AFTER DISCARDING TABLESPACE
ha_innobase::records_in_range() should return HA_POS_ERROR for the table during discarded without requesting pages.
The later other handler method should treat the error correctly.

Approved by Sunny in rb#3433
2013-10-07 15:16:31 +09:00
Yasufumi Kinoshita
4db0c831a5 Bug#17431533 : FAILING ASSERTION: INDEX->PAGE != 0XFFFFFFFF AFTER DISCARDING TABLESPACE
ha_innobase::records_in_range() should return HA_POS_ERROR for the table during discarded without requesting pages.
The later other handler method should treat the error correctly.

Approved by Sunny in rb#3433
2013-10-07 15:16:31 +09:00
Mattias Jonsson
6ca4be9c03 Bug#14621190: HA_INNOBASE::INDEX_NEXT SKIPS A RECORD IF PREVIOUS
INDEX_READ_MAP HAD NO MATCH

If index_read_map is called for exact search and no matching records
exists it will position the cursor on the next record, but still having the
relative position to BTR_PCUR_ON.
This will make a call for index_next to read yet another next record,
instead of returning the record the cursor points to.

Fixed by setting pcur->rel_pos = BTR_PCUR_BEFORE if an exact
[prefix] search is done, but failed.

Also avoids optimistic restoration if rel_pos != BTR_PCUR_ON,
since btr_cur may be different than old_rec.

rb#3324, approved by Marko and Jimmy
2013-10-01 10:05:45 +02:00
Mattias Jonsson
261268d84c Bug#14621190: HA_INNOBASE::INDEX_NEXT SKIPS A RECORD IF PREVIOUS
INDEX_READ_MAP HAD NO MATCH

If index_read_map is called for exact search and no matching records
exists it will position the cursor on the next record, but still having the
relative position to BTR_PCUR_ON.
This will make a call for index_next to read yet another next record,
instead of returning the record the cursor points to.

Fixed by setting pcur->rel_pos = BTR_PCUR_BEFORE if an exact
[prefix] search is done, but failed.

Also avoids optimistic restoration if rel_pos != BTR_PCUR_ON,
since btr_cur may be different than old_rec.

rb#3324, approved by Marko and Jimmy
2013-10-01 10:05:45 +02:00
Yasufumi Kinoshita
d4800a57ba Adjustment for fix for Bug#11758196
log_buffer_extend() should fill the new buffer with 0.
2013-09-30 15:02:54 +09:00
Yasufumi Kinoshita
b9284e0240 Adjustment for fix for Bug#11758196
log_buffer_extend() should fill the new buffer with 0.
2013-09-30 15:02:54 +09:00
Yasufumi Kinoshita
e64b9e1250 Bug#11758196 : INNODB ASSERTION FAILURE WHEN CONVERTING FROM MYISAM TO INNODB
Changed to try to extend log buffer instead of crash, when log size is too large for the size.

Approved by Marko in rb#3229
2013-09-30 13:41:48 +09:00
Yasufumi Kinoshita
47312f19cb Bug#11758196 : INNODB ASSERTION FAILURE WHEN CONVERTING FROM MYISAM TO INNODB
Changed to try to extend log buffer instead of crash, when log size is too large for the size.

Approved by Marko in rb#3229
2013-09-30 13:41:48 +09:00
Satya Bodapati
436fd04b02 Merge fix for BUG#17446090 from mysql-5.1 to mysql-5.5
The testcase for this bug fails randomly due to two reasons.
1. Due to ibuf merge happening background
2. Due to dict stats update which brings the evicted page back into
   buffer pool.

Fix ibuf_contract_ext() to not do any merges with ibuf_debug enabled and
also changed dict_stats_update() to return fake statistics without
bringing the secondary index pages into buffer pool.

Approved by Marko. rb#3419
2013-09-27 18:32:13 +05:30
Satya Bodapati
57df886c9f Merge fix for BUG#17446090 from mysql-5.1 to mysql-5.5
The testcase for this bug fails randomly due to two reasons.
1. Due to ibuf merge happening background
2. Due to dict stats update which brings the evicted page back into
   buffer pool.

Fix ibuf_contract_ext() to not do any merges with ibuf_debug enabled and
also changed dict_stats_update() to return fake statistics without
bringing the secondary index pages into buffer pool.

Approved by Marko. rb#3419
2013-09-27 18:32:13 +05:30
Satya Bodapati
87d5dc1388 Fix FreeBSD build failure due to BUG#16752251 (only in 5.5) 2013-09-12 17:59:14 +05:30
Satya Bodapati
7a2d321751 Fix FreeBSD build failure due to BUG#16752251 (only in 5.5) 2013-09-12 17:59:14 +05:30
Satya Bodapati
b904197361 Additional Fix to BUG#16755251 for 5.1 build failure and
disable testcase due to BUG#17446090
2013-09-12 12:28:16 +05:30
Satya Bodapati
64a845e0a6 Additional Fix to BUG#16755251 for 5.1 build failure and
disable testcase due to BUG#17446090
2013-09-12 12:28:16 +05:30
Satya Bodapati
f166ec71b7 Bug#16752251 - INNODB DOESN'T REDO-LOG INSERT BUFFER MERGE OPERATION IF
IT IS DONE IN-PLACE

With change buffer enabled, InnoDB doesn't write a transaction log
record when it merges a record from the insert buffer to an secondary
index page if the insertion is performed as an update-in-place.

Fixed by logging the 'update-in-place' operation on secondary index
pages.

Approved by Marko. rb#2429
2013-09-11 16:57:02 +05:30
Satya Bodapati
59402fe0a7 Bug#16752251 - INNODB DOESN'T REDO-LOG INSERT BUFFER MERGE OPERATION IF
IT IS DONE IN-PLACE

With change buffer enabled, InnoDB doesn't write a transaction log
record when it merges a record from the insert buffer to an secondary
index page if the insertion is performed as an update-in-place.

Fixed by logging the 'update-in-place' operation on secondary index
pages.

Approved by Marko. rb#2429
2013-09-11 16:57:02 +05:30
Satya Bodapati
a88bac6c66 Merge fix for BUG#16752251 from mysql-5.1 to mysql-5.5 2013-09-11 17:02:18 +05:30
Satya Bodapati
9910b732a7 Merge fix for BUG#16752251 from mysql-5.1 to mysql-5.5 2013-09-11 17:02:18 +05:30
Sergei Golubchik
b838d081ad mysql-5.5.33 merge 2013-09-06 22:31:30 +02:00
Sergei Golubchik
a73972bfea don't decide on extended keys by DB_TYPE_INNODB, use hton->flags 2013-08-26 21:13:17 +04:00
Marko Mäkelä
1676823e01 Merge mysql-5.1 to mysql-5.5. 2013-08-21 08:48:04 +03:00
Marko Mäkelä
c6177ded7e Merge mysql-5.1 to mysql-5.5. 2013-08-21 08:48:04 +03:00
Marko Mäkelä
553988a26e Merge mysql-5.1 to mysql-5.5. 2013-08-16 15:49:13 +03:00
Marko Mäkelä
780babc06a Merge mysql-5.1 to mysql-5.5. 2013-08-16 15:49:13 +03:00
Marko Mäkelä
fb2a2d2562 Bug#17312846 CHECK TABLE ASSERTION FAILURE
DICT_TABLE_GET_FORMAT(CLUST_INDEX->TABLE) >= 1

The function row_sel_sec_rec_is_for_clust_rec() was incorrectly
preparing to compare a NULL column prefix in a secondary index with a
non-NULL column in a clustered index.

This can trigger an assertion failure in 5.1 plugin and later. In the
built-in InnoDB of MySQL 5.1 and earlier, we would apparently only do
some extra work, by trimming the clustered index field for the
comparison.

The code might actually have worked properly apart from this debug
assertion failure. It is merely doing some extra work in fetching a
BLOB column, and then comparing it to NULL (which would return the
same result, no matter what the BLOB contents is).

While the test case involves CHECK TABLE, this could theoretically
occur during any read that uses a secondary index on a column prefix
of a column that can be NULL.

rb#3101 approved by Mattias Jonsson
2013-08-16 15:45:41 +03:00
Marko Mäkelä
55129f676a Bug#17312846 CHECK TABLE ASSERTION FAILURE
DICT_TABLE_GET_FORMAT(CLUST_INDEX->TABLE) >= 1

The function row_sel_sec_rec_is_for_clust_rec() was incorrectly
preparing to compare a NULL column prefix in a secondary index with a
non-NULL column in a clustered index.

This can trigger an assertion failure in 5.1 plugin and later. In the
built-in InnoDB of MySQL 5.1 and earlier, we would apparently only do
some extra work, by trimming the clustered index field for the
comparison.

The code might actually have worked properly apart from this debug
assertion failure. It is merely doing some extra work in fetching a
BLOB column, and then comparing it to NULL (which would return the
same result, no matter what the BLOB contents is).

While the test case involves CHECK TABLE, this could theoretically
occur during any read that uses a secondary index on a column prefix
of a column that can be NULL.

rb#3101 approved by Mattias Jonsson
2013-08-16 15:45:41 +03:00
Marko Mäkelä
49ffda0969 Merge mysql-5.1 to mysql-5.5. 2013-08-15 15:34:12 +03:00
Marko Mäkelä
dfed175c40 Merge mysql-5.1 to mysql-5.5. 2013-08-15 15:34:12 +03:00
Marko Mäkelä
318096074e Bug#17302896 DOUBLE PURGE ON ROLLBACK OF UPDATING A DELETE-MARKED RECORD
There was a race condition in the rollback of TRX_UNDO_UPD_DEL_REC.

Once row_undo_mod_clust() has rolled back the changes by the rolling-back
transaction, it attempts to purge the delete-marked record, if possible, in a
separate mini-transaction.

However, row_undo_mod_remove_clust_low() fails to check if the DB_TRX_ID of
the record that it found after repositioning the cursor, is still the same.
If it is not, it means that the record was purged and another record was
inserted in its place.

So, the rollback would have performed an incorrect purge, breaking the
locking rules and causing corruption.

The problem was found by creating a table that contains a unique
secondary index and a primary key, and two threads running REPLACE
with only one value for the unique column, so that the uniqueness
constraint would be violated all the time, leading to statement
rollback.

This bug exists in all InnoDB versions (I checked MySQL 3.23.53).
It has become easier to repeat in 5.5 and 5.6 thanks to scalability
improvements and a dedicated purge thread.

rb#3085 approved by Jimmy Yang
2013-08-15 15:23:23 +03:00
Marko Mäkelä
5163c4a143 Bug#17302896 DOUBLE PURGE ON ROLLBACK OF UPDATING A DELETE-MARKED RECORD
There was a race condition in the rollback of TRX_UNDO_UPD_DEL_REC.

Once row_undo_mod_clust() has rolled back the changes by the rolling-back
transaction, it attempts to purge the delete-marked record, if possible, in a
separate mini-transaction.

However, row_undo_mod_remove_clust_low() fails to check if the DB_TRX_ID of
the record that it found after repositioning the cursor, is still the same.
If it is not, it means that the record was purged and another record was
inserted in its place.

So, the rollback would have performed an incorrect purge, breaking the
locking rules and causing corruption.

The problem was found by creating a table that contains a unique
secondary index and a primary key, and two threads running REPLACE
with only one value for the unique column, so that the uniqueness
constraint would be violated all the time, leading to statement
rollback.

This bug exists in all InnoDB versions (I checked MySQL 3.23.53).
It has become easier to repeat in 5.5 and 5.6 thanks to scalability
improvements and a dedicated purge thread.

rb#3085 approved by Jimmy Yang
2013-08-15 15:23:23 +03:00
Marko Mäkelä
60e1a532e5 Merge mysql-5.1 to mysql-5.5. 2013-08-14 10:24:36 +03:00
Marko Mäkelä
e96dc0c901 Merge mysql-5.1 to mysql-5.5. 2013-08-14 10:24:36 +03:00
Mattias Jonsson
8808c6b350 Bug#17228383: VALGRIND WARNING IN IBUF_DELETE_REC
Since the mtr_t struct is marked as invalid in DEBUG_VALGRIND build
during mtr_commit, checking mtr->inside_ibuf will cause this warning.
Also since mtr->inside_ibuf cannot be set in mtr_commit (assert check)
and mtr->state is set to MTR_COMMITTED, the 'ut_ad(!ibuf_inside(&mtr))'
check is not needed if 'ut_ad(mtr.state == MTR_COMMITTED)' is also
checked.
2013-08-12 10:52:08 +02:00
Mattias Jonsson
343f74b90f Bug#17228383: VALGRIND WARNING IN IBUF_DELETE_REC
Since the mtr_t struct is marked as invalid in DEBUG_VALGRIND build
during mtr_commit, checking mtr->inside_ibuf will cause this warning.
Also since mtr->inside_ibuf cannot be set in mtr_commit (assert check)
and mtr->state is set to MTR_COMMITTED, the 'ut_ad(!ibuf_inside(&mtr))'
check is not needed if 'ut_ad(mtr.state == MTR_COMMITTED)' is also
checked.
2013-08-12 10:52:08 +02:00
Elena Stepanova
b9f61c14b7 Deliberate change in behavior introduced in MySQL 5.5.31 along with the
partitioning enhancement for Bug#14521864
2013-08-05 20:31:29 +04:00
Elena Stepanova
f596d28df6 Deliberate change in behavior introduced along with the fix for MDEV-4310 2013-08-05 18:30:12 +04:00
Aditya A
1c4a3c52fd Bug#13417564 SKIP SLEEP IN SRV_MASTER_THREAD WHEN
SHUTDOWN IS IN PROGRESS 

PROBLEM
-------
 In the background thread srv_master_thread() we have a 
 a one second delay loop which will continuously monitor
 server activity .If the server is inactive (with out any
 user activity) or in a shutdown state we do some background
 activity like flushing the changes.In the current code
 we are not checking if server is in shutdown state before
 sleeping for one second.

FIX
---
If server is in shutdown state ,then dont go to one second
sleep.
2013-07-29 14:45:06 +05:30
Aditya A
f7940e407a Bug#13417564 SKIP SLEEP IN SRV_MASTER_THREAD WHEN
SHUTDOWN IS IN PROGRESS 

PROBLEM
-------
 In the background thread srv_master_thread() we have a 
 a one second delay loop which will continuously monitor
 server activity .If the server is inactive (with out any
 user activity) or in a shutdown state we do some background
 activity like flushing the changes.In the current code
 we are not checking if server is in shutdown state before
 sleeping for one second.

FIX
---
If server is in shutdown state ,then dont go to one second
sleep.
2013-07-29 14:45:06 +05:30
Annamalai Gurusami
b89e6ccfc4 Merge from mysql-5.1 to mysql-5.5 2013-07-25 15:31:06 +05:30
Annamalai Gurusami
00bd412b5f Merge from mysql-5.1 to mysql-5.5 2013-07-25 15:31:06 +05:30
Annamalai Gurusami
a1ccfcf84d Bug #17076737 DUPLICATE CONSTRAINTS DISPLAYED WHEN NAME INCLUDES "_IBFK_"
Problem:

When the user specified foreign key name contains "_ibfk_", InnoDB wrongly
tries to rename it. 

Solution:

When a table is renamed, all its associated foreign keys will also be renamed,
only if the foreign key names are automatically generated.  If the foreign key
names are given by the user, even if it has _ibfk_ in it, it must not be
renamed.

rb#2935 approved by Jimmy, Krunal and Satya
2013-07-25 14:53:23 +05:30
Annamalai Gurusami
0c1ca4f0db Bug #17076737 DUPLICATE CONSTRAINTS DISPLAYED WHEN NAME INCLUDES "_IBFK_"
Problem:

When the user specified foreign key name contains "_ibfk_", InnoDB wrongly
tries to rename it. 

Solution:

When a table is renamed, all its associated foreign keys will also be renamed,
only if the foreign key names are automatically generated.  If the foreign key
names are given by the user, even if it has _ibfk_ in it, it must not be
renamed.

rb#2935 approved by Jimmy, Krunal and Satya
2013-07-25 14:53:23 +05:30
Sergei Golubchik
005c7e5421 mysql-5.5.32 merge 2013-07-16 19:09:54 +02:00
Jimmy Yang
5d95304c05 Fix Bug #16710923 - FALSE REPORTS OF DB_FOREIGN_EXCEED_MAX_CASCADE
rb://2582 approved by Inaam
2013-07-10 14:00:30 +08:00
Jimmy Yang
3d65807816 Fix Bug #16710923 - FALSE REPORTS OF DB_FOREIGN_EXCEED_MAX_CASCADE
rb://2582 approved by Inaam
2013-07-10 14:00:30 +08:00
Annamalai Gurusami
0d71a36d46 Bug #14017206 WITH CONSISTENT SNAPSHOT DOES NOT WORK WITH ISOLATION LEVEL
SERIALIZABLE

Problem:

The documentation claims that WITH CONSISTENT SNAPSHOT will work for both
REPEATABLE READ and SERIALIZABLE isolation levels.  But it will work only
for REPEATABLE READ isolation level.  Also, the clause WITH CONSISTENT
SNAPSHOT is silently ignored when it is not applicable to the given isolation
level.  

Solution:

Generate a warning when the clause WITH CONSISTENT SNAPSHOT is ignored.

rb#2797 approved by Kevin.

Note: Support team wanted to push this to 5.5+.
2013-07-10 10:49:17 +05:30
Annamalai Gurusami
64c58c13d5 Bug #14017206 WITH CONSISTENT SNAPSHOT DOES NOT WORK WITH ISOLATION LEVEL
SERIALIZABLE

Problem:

The documentation claims that WITH CONSISTENT SNAPSHOT will work for both
REPEATABLE READ and SERIALIZABLE isolation levels.  But it will work only
for REPEATABLE READ isolation level.  Also, the clause WITH CONSISTENT
SNAPSHOT is silently ignored when it is not applicable to the given isolation
level.  

Solution:

Generate a warning when the clause WITH CONSISTENT SNAPSHOT is ignored.

rb#2797 approved by Kevin.

Note: Support team wanted to push this to 5.5+.
2013-07-10 10:49:17 +05:30
Aditya A
eee10f381a Bug#17033706 SINCE 5.5.32 & 5.6.12, INNODB CANT START WITH OWN
MULTI-FILE TABLESPACE

ANALYSIS
--------

When a tablespace has multiple data files, InnoDB fails to 
open the tablespace.  This is because for each ibd file, 
the first page is checked.But the first page of all ibd file
need not be the first page of the tablespace.  Only the first
page of the tablespace contains the tablespace header. When 
we check the first page of an ibd file that is not the first
page of the tablespace, then the "tablespace flags" is not
really available.This was wrongly used to check if a page is
corrupt or not.

FIX
---
Use the tablespace flags only if the page number is 0 
in a tablespace.  

[Approved by Inaam rb#2836 ]
2013-07-05 14:30:15 +05:30
Aditya A
37d9d24392 Bug#17033706 SINCE 5.5.32 & 5.6.12, INNODB CANT START WITH OWN
MULTI-FILE TABLESPACE

ANALYSIS
--------

When a tablespace has multiple data files, InnoDB fails to 
open the tablespace.  This is because for each ibd file, 
the first page is checked.But the first page of all ibd file
need not be the first page of the tablespace.  Only the first
page of the tablespace contains the tablespace header. When 
we check the first page of an ibd file that is not the first
page of the tablespace, then the "tablespace flags" is not
really available.This was wrongly used to check if a page is
corrupt or not.

FIX
---
Use the tablespace flags only if the page number is 0 
in a tablespace.  

[Approved by Inaam rb#2836 ]
2013-07-05 14:30:15 +05:30
unknown
3684c2b182 Bug 16876388 - PLEASE BACKPORT BUG#16208542 TO 5.5
Straight forward backport.

Approved by Jimmy, rb#2656
2013-06-25 09:42:54 +08:00
bin.x.su@oracle.com
7b66df16a1 Bug 16876388 - PLEASE BACKPORT BUG#16208542 TO 5.5
Straight forward backport.

Approved by Jimmy, rb#2656
2013-06-25 09:42:54 +08:00
Aditya A
09d03ff35f Bug#11829813 UNUSED MUTEX COMMIT_THREADS_M
[Merge from 5.1]
2013-06-19 14:55:46 +05:30
Aditya A
0c13218b89 Bug#11829813 UNUSED MUTEX COMMIT_THREADS_M
[Merge from 5.1]
2013-06-19 14:55:46 +05:30
Aditya A
b3e74a0798 Bug#11829813 UNUSED MUTEX COMMIT_THREADS_M
Analysis
--------
The pthread_mutex commit_threads_m was initiliazed but never
used. 

Fix
---
Removing the commit_threads_m mutex from the code base.

[ Approved by Marko rb#2475]
2013-06-19 14:43:15 +05:30
Aditya A
dc6961263a Bug#11829813 UNUSED MUTEX COMMIT_THREADS_M
Analysis
--------
The pthread_mutex commit_threads_m was initiliazed but never
used. 

Fix
---
Removing the commit_threads_m mutex from the code base.

[ Approved by Marko rb#2475]
2013-06-19 14:43:15 +05:30
Vasil Dimov
9696ca9d87 Fix Bug#16907783 5.5 STILL CRASHES IN DICT_UPDATE_STATISTICS WITH CONCURRENT
DDL AND I_S QUERIES

Skip partially created indexes (ones whose name starts with TEMP_INDEX_PREFIX)
from stats gathering.

Because InnoDB reports HA_INPLACE_ADD_INDEX_NO_WRITE to MySQL, the latter
allows parallel execution of ha_innobase::add_index() and ha_innobase::info().

Reviewed by:	Inaam (rb:2613)
2013-06-18 17:12:28 +03:00
Vasil Dimov
0818d6c7e2 Fix Bug#16907783 5.5 STILL CRASHES IN DICT_UPDATE_STATISTICS WITH CONCURRENT
DDL AND I_S QUERIES

Skip partially created indexes (ones whose name starts with TEMP_INDEX_PREFIX)
from stats gathering.

Because InnoDB reports HA_INPLACE_ADD_INDEX_NO_WRITE to MySQL, the latter
allows parallel execution of ha_innobase::add_index() and ha_innobase::info().

Reviewed by:	Inaam (rb:2613)
2013-06-18 17:12:28 +03:00
unknown
e0c68b1504 Bug#16914007-INNODB: CHECK TABLE SHOULD MARK AN INDEX AS CORRUPTED
IF IT HAS A WRONG COUNT

If CHECK TABLE finds that a secondary index contains the wrong
number of entries, it used to report an error but not mark the
index as corrupt. The error means that the index should be rebuilt,
which can be done with ALTER TABLE DROP INDEX and ALTER TABLE ADD
INDEX.  But just in case the DBA does not pay any attention to the
output of CHECK TABLE, the secondary index should be marked as
corrupted so that it is not used again.

Approved by Inaam in RB:2607
2013-06-14 13:33:37 -05:00
kevin.lewis@oracle.com
4afea94567 Bug#16914007-INNODB: CHECK TABLE SHOULD MARK AN INDEX AS CORRUPTED
IF IT HAS A WRONG COUNT

If CHECK TABLE finds that a secondary index contains the wrong
number of entries, it used to report an error but not mark the
index as corrupt. The error means that the index should be rebuilt,
which can be done with ALTER TABLE DROP INDEX and ALTER TABLE ADD
INDEX.  But just in case the DBA does not pay any attention to the
output of CHECK TABLE, the secondary index should be marked as
corrupted so that it is not used again.

Approved by Inaam in RB:2607
2013-06-14 13:33:37 -05:00
Annamalai Gurusami
d9a71d5cbe Bug #16417635 INNODB FAILS TO MERGE UNDER-FILLED PAGES DEPENDING
ON DELETION ORDER

Problem:

When a InnoDB index page is under-filled, we will merge it with either
the left sibling node or the right sibling node.  But this checking is
incorrect.  When the left sibling node is available, even if merging
is not possible with left sibling node, we do not check for the 
possibility of merging with the right sibling node.  

Solution:

If left sibling node is available, and merging with left sibling node
is not possible, then check if merge with right sibling node is
possible.

rb#2506 approved by jimmy & ima.
2013-06-13 11:14:13 +05:30
Annamalai Gurusami
9f3ceb97a7 Bug #16417635 INNODB FAILS TO MERGE UNDER-FILLED PAGES DEPENDING
ON DELETION ORDER

Problem:

When a InnoDB index page is under-filled, we will merge it with either
the left sibling node or the right sibling node.  But this checking is
incorrect.  When the left sibling node is available, even if merging
is not possible with left sibling node, we do not check for the 
possibility of merging with the right sibling node.  

Solution:

If left sibling node is available, and merging with left sibling node
is not possible, then check if merge with right sibling node is
possible.

rb#2506 approved by jimmy & ima.
2013-06-13 11:14:13 +05:30
Murthy Narkedimilli
b292b5d2e3 Fixing the bug 16919882 - WRONG FSF ADDRESS IN LICENSES HEADERS 2013-06-10 22:29:41 +02:00
Murthy Narkedimilli
cf2d852653 Fixing the bug 16919882 - WRONG FSF ADDRESS IN LICENSES HEADERS 2013-06-10 22:29:41 +02:00
Murthy Narkedimilli
af23963e64 Bug 16919882 - WRONG FSF ADDRESS IN LICENSES HEADERS 2013-06-11 01:13:07 +05:30
Murthy Narkedimilli
8325f2cf78 Bug 16919882 - WRONG FSF ADDRESS IN LICENSES HEADERS 2013-06-11 01:13:07 +05:30
Marko Mäkelä
90f3f080af Bug#16859867 INNODB_BUG14529666 FAILS SPORADICALLY IN VALGRIND
i_s_innodb_buffer_page_get_info(): Do not read the buffer block frame
contents of read-fixed blocks, because it may be invalid or
uninitialized. When we are going to decompress or read a block, we
will put it into buf_pool->page_hash and buf_pool->LRU, read-fix the
block and release the mutexes for the duration of the reading or
decompression.

rb#2500 approved by Jimmy Yang
2013-05-24 13:58:42 +03:00
Marko Mäkelä
7c6595890d Bug#16859867 INNODB_BUG14529666 FAILS SPORADICALLY IN VALGRIND
i_s_innodb_buffer_page_get_info(): Do not read the buffer block frame
contents of read-fixed blocks, because it may be invalid or
uninitialized. When we are going to decompress or read a block, we
will put it into buf_pool->page_hash and buf_pool->LRU, read-fix the
block and release the mutexes for the duration of the reading or
decompression.

rb#2500 approved by Jimmy Yang
2013-05-24 13:58:42 +03:00
Annamalai Gurusami
5ca36b3b46 Bug #12762377 FOREIGN KEYS NOT CONSTRUCTED WHEN APOSTROPHES ARE
ESCAPED WITH BACKSLASH

Problem:

When the CREATE TABLE statement used COMMENTS with escape sequences like
'foo\'s', InnoDB did not parse is correctly when trying to extract the
foreign key information.  Because of this, the foreign keys specified
in the CREATE TABLE statement were not created.

Solution:

Make the InnoDB internal parser aware of escape sequences. 

rb#2457 approved by Kevin.
2013-05-18 10:20:56 +05:30
Annamalai Gurusami
00cf6212e5 Bug #12762377 FOREIGN KEYS NOT CONSTRUCTED WHEN APOSTROPHES ARE
ESCAPED WITH BACKSLASH

Problem:

When the CREATE TABLE statement used COMMENTS with escape sequences like
'foo\'s', InnoDB did not parse is correctly when trying to extract the
foreign key information.  Because of this, the foreign keys specified
in the CREATE TABLE statement were not created.

Solution:

Make the InnoDB internal parser aware of escape sequences. 

rb#2457 approved by Kevin.
2013-05-18 10:20:56 +05:30
Annamalai Gurusami
9904193de2 Fixing a compiler warning issue. At the end of the function
ibuf_insert_to_index_page_low() add a DBUG_RETURN(NULL).
2013-05-16 16:56:02 +05:30
Annamalai Gurusami
2ee012b2e8 Fixing a compiler warning issue. At the end of the function
ibuf_insert_to_index_page_low() add a DBUG_RETURN(NULL).
2013-05-16 16:56:02 +05:30
Annamalai Gurusami
59b43c7965 Bug #16806366 BOGUS CALL TO LOCK_REC_RESTORE_FROM_PAGE_INFIMUM IN
INSERT BUFFER MERGE

Problem:

When the record is merged from the change buffer to the actual page,
in a particular condition, it is assumed that the deleted rec will
be re-used by the inserted rec.  With this assumption the lock is
restored on the pointer to the deleted rec itself, thinking that
it is pointing to the newly inserted rec.

Solution:

Just before restoring the lock, update the rec pointer to point
to the newly inserted record.  An assert has been added to verify
this.  This assert will fail without the fix and will pass with
the fix.

rb#2449 in review by Marko and Jimmy
2013-05-16 14:05:05 +05:30
Annamalai Gurusami
c43ce72cdb Bug #16806366 BOGUS CALL TO LOCK_REC_RESTORE_FROM_PAGE_INFIMUM IN
INSERT BUFFER MERGE

Problem:

When the record is merged from the change buffer to the actual page,
in a particular condition, it is assumed that the deleted rec will
be re-used by the inserted rec.  With this assumption the lock is
restored on the pointer to the deleted rec itself, thinking that
it is pointing to the newly inserted rec.

Solution:

Just before restoring the lock, update the rec pointer to point
to the newly inserted record.  An assert has been added to verify
this.  This assert will fail without the fix and will pass with
the fix.

rb#2449 in review by Marko and Jimmy
2013-05-16 14:05:05 +05:30
Annamalai Gurusami
6057702766 Merge from mysql-5.1 to mysql-5.5 2013-05-16 13:58:26 +05:30
Annamalai Gurusami
f4f7cd05ce Merge from mysql-5.1 to mysql-5.5 2013-05-16 13:58:26 +05:30
Annamalai Gurusami
e8fa04cee0 Bug #16806366 BOGUS CALL TO LOCK_REC_RESTORE_FROM_PAGE_INFIMUM IN
INSERT BUFFER MERGE

Problem:

When the record is merged from the change buffer to the actual page,
in a particular condition, it is assumed that the deleted rec will
be re-used by the inserted rec.  With this assumption the lock is
restored on the pointer to the deleted rec itself, thinking that
it is pointing to the newly inserted rec.

Solution:

Just before restoring the lock, update the rec pointer to point
to the newly inserted record.  An assert has been added to verify
this.  This assert will fail without the fix and will pass with
the fix.

rb#2449 in review by Marko and Jimmy
2013-05-16 10:26:09 +05:30
Annamalai Gurusami
614395bc36 Bug #16806366 BOGUS CALL TO LOCK_REC_RESTORE_FROM_PAGE_INFIMUM IN
INSERT BUFFER MERGE

Problem:

When the record is merged from the change buffer to the actual page,
in a particular condition, it is assumed that the deleted rec will
be re-used by the inserted rec.  With this assumption the lock is
restored on the pointer to the deleted rec itself, thinking that
it is pointing to the newly inserted rec.

Solution:

Just before restoring the lock, update the rec pointer to point
to the newly inserted record.  An assert has been added to verify
this.  This assert will fail without the fix and will pass with
the fix.

rb#2449 in review by Marko and Jimmy
2013-05-16 10:26:09 +05:30
Annamalai Gurusami
5e3dd90fb1 Bug #16411457 MASTER THREAD CANNOT EXIT FLUSH_LOOP WHEN
INNODB_FAST_SHUTDOWN IS 2

Problem:

When innodb_fast_shutdown is set to 2 and the master thread enters
flush loop, under some circumstances it will not be able to exit it.
This may lead to a shutdown hanging.

This is happening because of the following:

1. In the flush_loop block of code, if the srv_fast_shutdown is
   equal to 2 (very fast shutdown), then we do not flush dirty
   pages in buffer pool to disk.
 
2. In the same flush_loop block of code, if the number of dirty
   pages is more than user specified limit, we go to step 1.

This results in infinite loop.

Solution:

When we are in the process of doing a very fast shutdown, don't
do step 2 above.

rb#2328 approved by Inaam.
2013-05-16 10:01:06 +05:30
Annamalai Gurusami
fce64480c8 Bug #16411457 MASTER THREAD CANNOT EXIT FLUSH_LOOP WHEN
INNODB_FAST_SHUTDOWN IS 2

Problem:

When innodb_fast_shutdown is set to 2 and the master thread enters
flush loop, under some circumstances it will not be able to exit it.
This may lead to a shutdown hanging.

This is happening because of the following:

1. In the flush_loop block of code, if the srv_fast_shutdown is
   equal to 2 (very fast shutdown), then we do not flush dirty
   pages in buffer pool to disk.
 
2. In the same flush_loop block of code, if the number of dirty
   pages is more than user specified limit, we go to step 1.

This results in infinite loop.

Solution:

When we are in the process of doing a very fast shutdown, don't
do step 2 above.

rb#2328 approved by Inaam.
2013-05-16 10:01:06 +05:30
Marko Mäkelä
09510e3e7a Merge mysql-5.1 to mysql-5.5. 2013-05-15 22:50:44 +03:00
Marko Mäkelä
d5372672da Merge mysql-5.1 to mysql-5.5. 2013-05-15 22:50:44 +03:00