Commit graph

364 commits

Author SHA1 Message Date
Jan Lindström
3486135bb5 MDEV-6928: Add trx pointer to struct mtr_t
Merge Facebook commit 25295d003cb0c17aa8fb756523923c77250b3294
authored by Steaphan Greene from https://github.com/facebook/mysql-5.6

This adds a pointer to the trx to each mtr.
This allows the trx to be accessed in parts of the code
where it was otherwise not available. This is needed later.
2014-10-24 22:26:31 +03:00
Jan Lindström
7e71dfa9f5 MDEV-6933: Spurious lock_wait_timeout_thread wakeup in lock_wait_suspend_thread()
Merged Facebooks commit 6e06bbfa315ffb97d713dd6e672d6054036ddc21
authored by Inaam Rana from https://github.com/facebook/mysql-5.6.

Fixes MySQL bug http://bugs.mysql.com/bug.php?id=72123

lock_timeout thread works in a tight loop waking up every second
and checking for lock_wait_timeout. In addition, when a mysql
thread is forced to wait on a lock, it signals the lock_timeout thread
as well. This call is not required. In a heavily contended workload
each thread going to wait will signal the lock_timeout thread making
it work all the time. As lock_timeout thread scans the array of
waiting threads under lock_sys::wait_mutex which is already very
hot in contneded loads, these extra scans can cause significanct
performance regression.

Also, in various codepaths lock_timeout thread is signalled where
actual intention was to signal the innodb monitor thread.
2014-10-24 17:56:04 +03:00
Sergei Golubchik
22f9353bfd xtradb/innodb: fix to compile with VS 2008
and compiler warnings
2014-10-04 15:26:04 +02:00
Sergei Golubchik
75796d9ecb InnoDB 5.6.20 2014-09-11 16:42:54 +02:00
Sergei Golubchik
6fb17a0601 5.5.39 merge 2014-08-07 18:06:56 +02:00
Sergei Golubchik
2023fac281 innodb-5.6.19 2014-08-06 20:05:10 +02: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
Sergei Golubchik
5d16592d44 mysql-5.5.38 merge 2014-06-03 09:55:08 +02:00
Sergei Golubchik
8ee9d19607 innodb 5.6.17 2014-05-07 17:32:23 +02:00
Sergei Golubchik
e2e5d07b28 MDEV-6184 10.0.11 merge
InnoDB 5.6.16
2014-05-06 09:57:39 +02: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
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
Sergei Golubchik
cb67dcb618 mysql-5.5.37 selective merge 2014-03-27 22:26:58 +01:00
Sergei Golubchik
15ee97214d InnoDB 5.6.15 merge.
update test results
2014-02-26 19:36:33 +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
Sergei Golubchik
d929342b0f Merge the server part of MySQL WL#5522 - InnoDB transportable tablespaces.
Syntax. Server support. Test cases.
InnoDB bugfixes:
* don't mess around with system sprintf's, always use my_error() for errors.
* don't use InnoDB internal error codes where OS error codes are expected.
* don't say "file not found", when it was.
2014-02-02 10:00:36 +01:00
Sergei Golubchik
27d45e4696 MDEV-5574 Set AUTO_INCREMENT below max value of column.
Update InnoDB to 5.6.14
Apply MySQL-5.6 hack for MySQL Bug#16434374
Move Aria-only HA_RTREE_INDEX from my_base.h to maria_def.h (breaks an assert in InnoDB)
Fix InnoDB memory leak
2014-02-01 09:33:26 +01:00
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
Sergei Golubchik
37d240ecf9 MySQL-5.5.35 merge 2014-01-22 15:29:36 +01:00
Elena Stepanova
71f4a24d06 MDEV-5452 10.0 does not build on openSUSE 13.1
Also known as MySQL#70047 and BUG#17316314 (srv_buf_size not declared).
The workaround is taken from MySQL 5.6 tree: 

  BUG#17316314 - SRV_BUF_SIZE NOT DECLARED
  Temporary fix. Disabling FALLOC_FL_PUNCH_HOLE for now
2013-12-17 14:40:56 +04:00
Sergei Golubchik
d28d3ba40d 10.0-base merge 2013-12-16 13:02:21 +01:00
Sergei Golubchik
fa3f8a18b2 mysql-5.5.34 merge
(some patches reverted, test case added)
2013-11-19 13:16:25 +01:00
Mattias Jonsson
6d483cf3ab post-push fix for bug#17565888/bug#14621190 2013-10-28 17:08:31 +01: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
Jan Lindström
c75e92fd6f MDEV-5141: Failing assertion: ib_table->stat_initialized in file ha_innodb.cc line 11042 on concurrent ALTER and SELECT from I_S
Analysis: After ALTER TABLE the table statistics needs to be rebuilt and therefore stat_initialized is set false.  It will be rebuilt when the table is loaded again and table is closed when alter table is completed. However, during alter table table could be used by concurrent SELECT from I_S. Therefore, we need to rebuild transient table statistics meanwhile until table can be reloaded.
2013-10-17 12:17:32 +03: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
Sergei Golubchik
b838d081ad mysql-5.5.33 merge 2013-09-06 22:31:30 +02:00
Jan Lindström
c8b87ca16f MDEV-4133: Review InnoDB tablespace allocation patch by Toshikuni Fukaya. If innodb_use_posix_fallocate is set we use posix_fallocate call to extent tablespace allocation instead of pwrite. 2013-08-23 09:03:57 +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ä
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ä
49ffda0969 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ä
60e1a532e5 Merge mysql-5.1 to mysql-5.5. 2013-08-14 10:24:36 +03:00
Annamalai Gurusami
b89e6ccfc4 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
Sergei Golubchik
b7b5f6f1ab 10.0-monty merge
includes:
* remove some remnants of "Bug#14521864: MYSQL 5.1 TO 5.5 BUGS PARTITIONING"
* introduce LOCK_share, now LOCK_ha_data is strictly for engines
* rea_create_table() always creates .par file (even in "frm-only" mode)
* fix a 5.6 bug, temp file leak on dummy ALTER TABLE
2013-07-21 16:39:19 +02:00
Sergei Golubchik
005c7e5421 mysql-5.5.32 merge 2013-07-16 19:09:54 +02:00
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
Murthy Narkedimilli
b292b5d2e3 Fixing the bug 16919882 - WRONG FSF ADDRESS IN LICENSES HEADERS 2013-06-10 22:29:41 +02:00
Sergei Golubchik
b381cf843c mysql-5.5.31 merge 2013-05-07 13:05:09 +02:00
Annamalai Gurusami
2c551d0e9c Bug #16722314 FOREIGN KEY ID MODIFIED DURING EXPORT
Bug #16754901 PARS_INFO_FREE NOT CALLED IN DICT_CREATE_ADD_FOREIGN_TO_DICTIONARY

Merging the fix from mysql-5.5 to mysql-5.5.32-release.
2013-05-06 20:31:26 +05:30
Annamalai Gurusami
1b26d59192 Merge from mysql-5.1 to mysql-5.5 2013-05-06 19:57:49 +05:30
Annamalai Gurusami
bf7325bb6b Bug #16722314 FOREIGN KEY ID MODIFIED DURING EXPORT
Bug #16754901 PARS_INFO_FREE NOT CALLED IN DICT_CREATE_ADD_FOREIGN_TO_DICTIONARY

Problem:

There are two situations here.  The constraint name is explicitly
given by the user and the constraint name is automatically generated
by InnoDB.  In the case of generated constraint name, it is formed by
adding table name as prefix.  The table names are stored internally in
my_charset_filename.  In the case of constraint name explicitly given
by the user, it is stored in UTF8 format itself.  So, in some
situations the constraint name is in utf8 and in some situations it is
in my_charset_filename format.  Hence this problem.

Solution:

Always store the foreign key constraint name in UTF-8 even when
automatically generated.

Bug #16754901 PARS_INFO_FREE NOT CALLED IN DICT_CREATE_ADD_FOREIGN_TO_DICTIONARY

Problem:

There was a memory leak in the function dict_create_add_foreign_to_dictionary().
The allocated pars_info_t object is not freed in the error code path.

Solution:

Allocate the pars_info_t object after the error checking.

rb#2368 in review
2013-05-06 16:28:56 +05:30
Sergei Golubchik
a9035be5b7 10.0-base merge 2013-04-15 15:09:22 +02:00
Michael Widenius
068c61978e Temporary commit of 10.0-merge 2013-03-26 00:03:13 +02: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
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
Sergei Golubchik
8161c6772d merge with mysql-5.5.30 minus few incorrect or not applicable changesets 2013-02-28 18:42:49 +01: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
Sergei Golubchik
ab83952f29 10.0-base merge 2013-01-31 09:48:19 +01:00