Commit graph

5206 commits

Author SHA1 Message Date
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
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
Murthy Narkedimilli
c92223e198 Updated/added copyright headers 2014-01-06 10:52:35 +05:30
Arun Kuruvila
1f8d86b42e Bug #16324629 : SERVER CRASHES ON UPDATE/JOIN FEDERATED +
LOCAL TABLE WHEN ONLY 1 LOCAL ROW

Description: When updating a federated table with UPDATE...
JOIN, the server consistently crashes with Signal 11 when
only 1 row exists in the local table involved in the join 
and that 1 row can be joined with a row in the federated 
table.

Analysis: Interaction between the federated engine and the
optimizer results in the crash. In our scenario, ie, local
table having only one row, the program is following a 
different path because the table is treated as a constant
table by the join optimizer. So in this scenario 
"index_read()" is happening in the prepare phase,
since optimizer plan is different for constant table joins.
In this case, "index_read_idx_map()" (inside handler.cc) is
calling "index_read()" and inside "index_read()", matching 
rows are fetched and "stored_result" gets populated by 
calling "store_result()". And just after "index_read()", 
"index_end()" function is called. And in the "index_end()",
its freeing the "stored_result" by calling "free_result()".
So when it reaches the execution phase, in "position()" 
function, we are getting assertion at 
"DBUG_ASSERT(stored_result);". In all other scenarios (ie, 
table with more than 1 row), optimizer plan is different 
and "index_read()" is happening in the execution phase.

Fix: So my fix is to have a separate ha_federated member
function for "index_read_idx_map()" which will handle 
federated engine separately. So that position() will be 
called before index_end() call in constant table scenario.
2013-12-30 11:39:55 +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
Marc Alff
82eed657a6 Bug#17928281 'CHECK_PERFORMANCE_SCHEMA()' LEAVES 'CURRENT_THD' REFERRING
DESTRUCTED THD OBJ 

Prior to fix, function check_performance_schema() could leave
behind stale pointers in thread local storage, for the following keys:
- THR_THD (used by _current_thd)
- THR_MALLOC (used for memory allocation)
This is an unsafe practice, which can potentially cause crashes,
and that can cause other bugs when code is modified during maintenance.

With this fix, thread local storage keys used temporarily within
function check_performance_schema() are cleaned up after use.
2013-12-11 11:15:23 +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
Mattias Jonsson
6d483cf3ab 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
a91fcaf460 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
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
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
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
Yasufumi Kinoshita
f071aca09f Merge mysql-5.1 to mysql-5.5. 2013-10-07 15:17:56 +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
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
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
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
87d5dc1388 Fix FreeBSD build failure due to BUG#16752251 (only in 5.5) 2013-09-12 17:59:14 +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
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
Marko Mäkelä
1676823e01 Merge mysql-5.1 to mysql-5.5. 2013-08-21 08:48:04 +03:00
Marko Mäkelä
ec2389dce6 Bug#12560151 61132: infinite loop in buf_page_get_gen() when handling
compressed pages

After loading a compressed-only page in buf_page_get_gen() we allocate a new
block for decompression. The problem is that the compressed page is neither
buffer-fixed nor I/O-fixed by the time we call buf_LRU_get_free_block(),
so it may end up being evicted and returned back as a new block.

buf_page_get_gen(): Temporarily buffer-fix the compressed-only block
while allocating memory for an uncompressed page frame.
This should prevent this form of the infinite loop, which is more likely
with a small innodb_buffer_pool_size.

rb#2511 approved by Jimmy Yang, Sunny Bains
2013-08-21 08:22:05 +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
Marko Mäkelä
300ac936be Bug#16971045 ASSERTION FAILURES ON ROLLBACK OF AN INSERT AFTER A
FAILED BLOB WRITE

btr_store_big_rec_extern_fields(): Relax a debug assertion so that
some BLOB pointers may remain zero if an error occurs.

btr_free_externally_stored_field(), row_undo_ins(): Allow the BLOB
pointer to be zero on any rollback.

rb#3059 approved by Jimmy Yang, Kevin Lewis
2013-08-14 09:43:21 +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
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
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
Praveenkumar Hulakund
03940a7bd8 Bug#16865959 - PLEASE BACKPORT BUG 14749800.
Since log_throttle is not available in 5.5. Logging of
error message for failure of thread to create new connection
in "create_thread_to_handle_connection" is not backported.

Since, function "my_plugin_log_message" is not available in 
5.5 version and since there is incompatibility between
sql_print_XXX function compiled with g++ and alog files with
gcc to use sql_print_error, changes related to audit log
plugin is not backported.
2013-07-24 15:44:41 +05:30
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
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
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
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
Aditya A
09d03ff35f 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
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
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
Tor Didriksen
c94ccb237e Bug#16729109: FIX COMPILATION WARNINGS WITH GCC 4.8
Backport to 5.5
(external Bug#69407 Build warnings with mysql)


support-files/build-tags:
  Run etags on sql_yacc.yy, ignore other .yy files
unittest/mysys/explain_filename-t.cc:
  NO_PLAN seems to fail on some platforms, use the actual number instead.
2013-06-14 10:52:23 +02: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
Murthy Narkedimilli
b292b5d2e3 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
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