Commit graph

1016 commits

Author SHA1 Message Date
Marko Mäkelä
3c5f4c30d7 Non-functional change: move a printout
from innobase_shutdown_for_mysql() to
logs_empty_and_mark_files_at_shutdown()
where the rest of the logic is located.
2011-04-06 10:34:49 +03:00
Marko Mäkelä
af7d9929fa Enable __attribute__((cold)) only for GCC 4.3 and later.
This attribute was introduced in bzr revision-id
marko.makela@oracle.com-20110405073758-b8y733yvkqum940i
and caused older GCC versions to emit warnings.
2011-04-06 09:22:36 +03:00
Marko Mäkelä
30f785bc11 Remove unused functions.
os_thread_get_curr(), os_thread_get_priority(), os_thread_set_priority(),
os_thread_get_last_error(): Remove.
2011-04-05 13:58:37 +03:00
Marko Mäkelä
5530926e72 Bug 12323643 - CLEAN UP THE INNODB THREAD SHUTDOWN AND ASSERTIONS (WL#5136)
On shutdown, do not exit threads in os_event_wait(). This method of
exiting was only used by the I/O handler threads. Exit them on a
higher level.

os_event_wait_low(), os_event_wait_time_low(): Do not exit on shutdown.

os_thread_exit(), ut_dbg_assertion_failed(), ut_print_timestamp(): Add
attribute cold, so that GCC knows that these functions are rarely
invoked and can be optimized for size.

os_aio_linux_collect(): Return on shutdown.

os_aio_linux_handle(), os_aio_simulated_handle(), os_aio_windows_handle():
Set *message1 = *message2 = NULL and return TRUE on shutdown.

fil_aio_wait(): Return on shutdown.

logs_empty_and_mark_files_at_shutdown(): Even in very fast shutdown
(innodb_fast_shutdown=2), allow the background threads to exit, but
skip the flushing and log checkpointing.

innobase_shutdown_for_mysql(): Always wait for all the threads to exit.

rb:633 approved by Sunny Bains
2011-04-05 10:37:58 +03:00
Marko Mäkelä
272fa443f8 Bug 12323643 - CLEAN UP THE INNODB THREAD SHUTDOWN AND ASSERTIONS (WL#5136)
Remove most references to thread id in InnoDB. Three references
remain: the current holder of a mutex, and the current x-lock holder
of a rw-lock, and some references in UNIV_SYNC_DEBUG checks. This
allows MySQL to change the thread associated to a client connection.

Tighten the UNIV_SYNC_DEBUG checks, trying to ensure that no InnoDB
mutex or x-lock is being held when returning control to MySQL. The
only semaphore that may be held is the btr_search_latch in shared mode.

sync_thread_levels_empty_except_dict(): A wrapper for
sync_thread_levels_empty_gen(TRUE).

sync_thread_levels_nonempty_trx(): Check that the current thread is
not holding any InnoDB semaphores, except btr_search_latch if
trx->has_search_latch.

sync_thread_levels_empty(): Unused function; remove.

trx_t: Remove mysql_thread_id and mysql_process_no.

srv_slot_t: Remove id and handle.

row_search_for_mysql(), srv_conc_enter_innodb(),
srv_conc_force_enter_innodb(), srv_conc_force_exit_innodb(),
srv_conc_exit_innodb(), srv_suspend_mysql_thread: Assert
!sync_thread_levels_nonempty_trx().

rb:634 approved by Sunny Bains
2011-04-05 10:18:43 +03:00
Vasil Dimov
1c6f766624 Merge mysql-5.5-innodb -> mysql-5.5 2011-04-04 09:12:11 +03:00
Marko Mäkelä
a120b650d2 Merge mysql-5.1-innodb to mysql-5.5-innodb. 2011-03-30 14:52:26 +03:00
Marko Mäkelä
4ffb26de4b Bug#11877216 InnoDB too eager to commit suicide on a busy server
sync_array_print_long_waits(): Return the longest waiting thread ID
and the longest waited-for lock. Only if those remain unchanged
between calls in srv_error_monitor_thread(), increment
fatal_cnt. Otherwise, reset fatal_cnt.

Background: There is a built-in watchdog in InnoDB whose purpose is to
kill the server when some thread is stuck waiting for a mutex or
rw-lock. Before this fix, the logic was flawed.

The function sync_array_print_long_waits() returns TRUE if it finds a
lock wait that exceeds 10 minutes (srv_fatal_semaphore_wait_threshold).
The function srv_error_monitor_thread() will kill the server if this
happens 10 times in a row (fatal_cnt reaches 10), checked every 30
seconds. This is wrong, because this situation does not mean that the
server is hung. If the server is very busy for a little over 15
minutes, it will be killed.

Consider this example. Thread T1 is waiting for mutex M. Some time
later, threads T2..Tn start waiting for the same mutex M. If T1 keeps
waiting for 600 seconds, fatal_cnt will be incremented to 1. So far,
so good. Now, if M is granted to T1, the server was obviously not
stuck. But, T2..Tn keeps waiting, and their wait time will be longer
than 600 seconds. If 5 minutes later, some Tn has still been waiting
for more than 10 minutes for the mutex M, the server can be killed,
even though it is not stuck.

rb:622 approved by Jimmy Yang
2011-03-30 14:25:58 +03:00
Vasil Dimov
88650f36f4 Merge mysql-5.1-innodb -> mysql-5.5-innodb 2011-03-28 12:05:02 +03:00
Marko Mäkelä
538e7d1655 Bug#11766305 - 59392: Remove thr0loc.c and ibuf_inside() [part 4 of 4]
ibuf_inside(), ibuf_enter(), ibuf_exit(): Add the parameter mtr. The
flag is no longer kept in the thread-local storage but in the
mini-transaction (mtr->inside_ibuf).

mtr_start(): Clean up the comment and remove the unused return value.
mtr_commit(): Assert !ibuf_inside(mtr) in debug builds.

ibuf_mtr_start(): Like mtr_start(), but sets the flag.
ibuf_mtr_commit(), ibuf_btr_pcur_commit_specify_mtr(): Wrappers that
assert ibuf_inside().

buf_page_get_zip(), buf_page_init_for_read(),
buf_read_ibuf_merge_pages(), fil_io(), ibuf_free_excess_pages(),
ibuf_contract_ext(): Remove assertions on ibuf_inside(), because a
mini-transaction is not available.

buf_read_ahead_linear(): Add the parameter inside_ibuf.

ibuf_restore_pos(): When this function returns FALSE, it commits mtr
and must therefore do ibuf_exit(mtr).

ibuf_delete_rec(): This function commits mtr and must therefore do
ibuf_exit(mtr).

ibuf_rec_get_page_no(), ibuf_rec_get_space(), ibuf_rec_get_info(),
ibuf_rec_get_op_type(), ibuf_build_entry_from_ibuf_rec(),
ibuf_rec_get_volume(), ibuf_get_merge_page_nos(),
ibuf_get_volume_buffered_count(), ibuf_get_entry_counter_low(): Add
the parameter mtr in debug builds, for asserting ibuf_inside(mtr).

rb:585 approved by Sunny Bains
2011-03-24 14:00:14 +02:00
Marko Mäkelä
76ec2da660 Bug#11766305 - 59392: Remove thr0loc.c and ibuf_inside() [part 3]
Remove the slot_no member of struct thr_local_struct.

enum srv_thread_type: Remove unused thread types.
srv_get_thread_type(): Unused function, remove.

thr_local_get_slot_no(), thr_local_set_slot_no(): Remove.

srv_thread_type_validate(), srv_slot_get_type(): New functions, for debugging.

srv_table_reserve_slot(): Return the srv_slot_t* directly. Do not create
thread-local storage.

srv_suspend_thread(): Get the srv_slot_t* as parameter. Return void;
the caller knows slot->event already.

srv_thread_has_reserved_slot(), srv_release_threads(): Assert
srv_thread_type_validate(type).

srv_init(): Use mem_zalloc() instead of mem_alloc(). Replace
srv_table_get_nth_slot(), because it now asserts that the kernel_mutex
is being held.

srv_master_thread(), srv_purge_thread(): Remember the slot from
srv_table_reserve_slot().

rb:629 approved by Inaam Rana
2011-03-22 13:39:16 +02:00
Marko Mäkelä
72ec03c2bd Bug#11766305 - 59392: Remove thr0loc.c and ibuf_inside() [part 2]
Add some const qualifiers to accessor and validator functions.

btr_pcur_get_up_match(), btr_pcur_get_low_match(): Add const qualifiers.

btr_pcur_get_page(), btr_pcur_get_block(), btr_pcur_get_rec(),
rec_get_start(), rec_get_end(): Define as constness-preserving macros.
In debug builds, discard the const qualifier.

page_rec_validate(), page_simple_validate_old(), page_simple_validate_new(),
page_dir_slot_check(), page_validate(): Add const qualifiers.

rb:626 approved by Sunny Bains
2011-03-21 09:56:38 +02:00
Marko Mäkelä
30a28cfbc5 Bug#11766305 - 59392: Remove thr0loc.c and ibuf_inside() [part 1]
Remove unused member mtr from btr_pcur_struct.

rb:624 approved by Sunny Bains
2011-03-21 09:27:58 +02:00
Marko Mäkelä
9a4dd4adf9 Remove trailing white space. 2011-03-15 15:24:51 +02:00
Marko Mäkelä
aacf9a8031 Merge mysql-5.1-innodb to mysql-5.5-innodb. 2011-03-15 12:26:53 +02:00
kevin.lewis@oracle.com
d072bb0d7f Bug#60196 / Bug#11831040
Setting lowercase_table_names to 2 on Windows causing Foreign Key problems

This problem was exposed by the fix for Bug#55222.  There was a codepath in dict0load.c,
dict_load_foreigns() that made sure the table name matched case sensitive in order to
load a referenced table into the dictionary as needed.  If an engine is rebooted which
accesses a table with foreign keys, and lower_case_table_names=2, then the table with
foreign keys will get an error when it is changed (insert/updated/delete).
Once the referenced tables are loaded into the dictionary cache by a select statement
on those tables, the same change would succeed because the affected code path would
not get followed.
2011-03-07 09:42:07 -06:00
Jon Olav Hauglid
c171d99ded Bug #11784056 ENABLE CONCURRENT READS WHILE CREATING
NON-PRIMARY UNIQUE INDEX USING INNODB

This patch adds the HA_INPLACE_ADD_UNIQUE_INDEX_NO_WRITE
capability flag to InnoDB, indicating that concurrent reads
can be allowed while non-primary unique indexes are created.

This is an follow-up to Bug #11751388 which enabled concurrent
reads when creating non-primary non-unique indexes.

Test case added to innodb_mysql_sync.test.
2011-03-07 14:30:49 +01:00
Vasil Dimov
c3b8964687 Merge mysql-5.5 -> mysql-5.5-innodb 2011-03-02 11:00:48 +02:00
Marko Mäkelä
97bbde6664 Merge mysql-5.1-innodb to mysql-5.5-innodb. 2011-02-28 15:39:07 +02:00
Vasil Dimov
7bb633e7c9 Use plugin_author also for the InnoDB SE plugin
Move the const variable plugin_author to a common header file that is
being included by both ha_innodb.cc and i_s.cc
2011-02-28 11:07:22 +02:00
Vasil Dimov
e4e154e92b Change InnoDB plugins author to Oracle Corporation 2011-02-28 11:02:24 +02:00
Vasil Dimov
47741182d6 Non-functional change: use plugin_author instead of hardcoded string.
plugin_author is currently defined as "Innobase Oy" so this change is
a no-op.
2011-02-28 10:39:48 +02:00
Jimmy Yang
1e26073184 Include "ha_prototypes.h" to sync/sync0rw.c for innobase_basename(). 2011-02-25 03:21:02 -08:00
Vasil Dimov
3ce27deac3 Merge mysql-5.1-innodb -> mysql-5.5-innodb 2011-02-25 11:52:47 +02:00
Jimmy Yang
afe4b605a3 Fix Bug #11765975 __FILE__ macros expanded to full path instead of relative
in CMake builds

rb://600 approved by Sunny Bains
2011-02-25 00:33:13 -08:00
Vasil Dimov
2c9f4a23bb Merge mysql-5.5-innodb -> mysql-5.5 2011-02-23 19:33:41 +02:00
Sunny Bains
759d346e67 Revert the max value of innodb_purge_batch_size to 5000. 2011-02-23 17:56:37 +11:00
Sunny Bains
669c3e7110 Add ut0bh.h and ut0bh.c. 2011-02-23 17:48:15 +11:00
Sunny Bains
8d8ebc5b01 Remove ut0bh.h and ut0bh.c and re-add so that we can sync the file ids with
the trunk.
2011-02-23 17:44:11 +11:00
Sunny Bains
165ccf3be7 Add ut0bh.ic. 2011-02-23 07:24:34 +11:00
Sunny Bains
2cc164341a Remove ut0bh.ic from 5.5 and then re-add so that the file ids are the same
in 5.5 and trunk. First we remove the file in the commit.
2011-02-23 07:14:49 +11:00
Sunny Bains
83659a7fba Add files that were missed in bug# 11798085 commit. 2011-02-22 20:17:02 +11:00
Sunny Bains
9d6d1902e0 Bug #11766227: InnoDB purge lag much worse for 5.5.8 versus 5.1
Bug #11766501: Multiple RBS break the get rseg with mininum trx_t::no code during purge
      
Bug# 59291 changes:
      
Main problem is that truncating the UNDO log at the completion of every
trx_purge() call is expensive as the number of rollback segments is increased.
We truncate after a configurable amount of pages. The innodb_purge_batch_size
parameter is used to control when InnoDB does the actual truncate. The truncate
is done once after 128 (or TRX_SYS_N_RSEGS iterations). In other words we
truncate after purge 128 * innodb_purge_batch_size. The smaller the batch
size the quicker we truncate.
      
Introduce a new parameter that allows how many rollback segments to use for
storing REDO information. This is really step 1 in allowing complete control
to the user over rollback space management.
      
New parameters:
    i) innodb_rollback_segments = number of rollback_segments to use
       (default is now 128) dynamic parameter, can be changed anytime.
       Currently there is little benefit in changing it from the default.
      
Optimisations in the patch.
      
    i. Change the O(n) behaviour of trx_rseg_get_on_id() to O(log n)
       Backported from 5.6. Refactor some of the binary heap code.
       Create a new include/ut0bh.ic file.
      
    ii. Avoid truncating the rollback segments after every purge.
      
Related changes that were moved to a separate patch:
      
    i. Purge should not do any flushing, only wait for space to be free so that
       it only does purging of records unless it is held up by a long running
       transaction that is preventing it from progressing.
      
   ii. Give the purge thread preference over transactions when acquiring the
       rseg->mutex during commit. This to avoid purge blocking unnecessarily
       when getting the next rollback segment to purge.
      
Bug #11766501 changes:
      
Add the rseg to the min binary heap under the cover of the kernel mutex and
the binary heap mutex. This ensures the ordering of the min binary heap.
      
The two changes have to be committed together because they share the same
that fixes both issues.
      
rb://567 Approved by: Inaam Rana.
2011-02-22 16:04:08 +11:00
Vasil Dimov
60a8407231 Merge mysql-5.5-innodb -> mysql-5.5 2011-02-17 13:57:26 +02:00
Marko Mäkelä
53cfea3911 Merge mysql-5.1-innodb to mysql-5.5-innodb. 2011-02-15 11:29:56 +02:00
Jimmy Yang
8586497e5d Merge from mysql-5.1-innodb to mysql-5.5-innodb 2011-02-14 02:17:51 -08:00
Vasil Dimov
4c5c1c5d0c Merge mysql-5.1-innodb -> mysql-5.5-innodb 2011-02-10 17:26:09 +02:00
Marko Mäkelä
adef5550eb Bug #59877 Wrong buffer pool selected in buf_read_ibuf_merge_pages() 2011-02-10 14:07:58 +02:00
Vasil Dimov
8a20a73a7c Increment InnoDB version from 1.1.5 to 1.1.6
InnoDB 1.1.5 was released with MySQL 5.5.9
2011-02-10 13:25:12 +02:00
Jimmy Yang
801d018411 Merge a fix for Bug #53756 ALTER TABLE ADD PRIMARY KEY affects crash recovery
This was already pushed to mysql-5.1-innodb some time ago
(revision id jimmy.yang@oracle.com-20100907054137-tpuior7hez4f5ghl)
but it was not merged to the 5.5 trees.
2011-02-10 00:58:23 -08:00
Jimmy Yang
77838ae2cd Fix Bug #59048 truncate table or create index could leave index->page
to be FIL_NULL

rb://545 approved by Sunny Bains
2011-02-09 01:15:06 -08:00
Marko Mäkelä
5dfcf7c745 Merge mysql-5.1-innodb to mysql-5.5-innodb. 2011-02-08 13:39:24 +02:00
Inaam Rana
62ec6970d9 Bug #59472 increase AIO requests per IO thread limit to 256 from 32
rb://566
approved by: Sunny

When using native aio on linux each IO helper thread should be able to
handle upto 256 IO requests. The number 256 is the same which is used
for simulated aio as well. In case of windows where we also use native
aio this limit is 32 because of OS constraints. It seems that we are
using the limit of 32 for all the platforms where we are using native
aio. The fix is to use 256 on all platforms except windows (when native
aio is enabled on windows)
2011-02-07 18:43:00 -05:00
kevin.lewis@oracle.com
c8ac9f10c1 Bug#59699 - Hidden bug would cause a crash for unknown tablespace flags.
The bug would cause a crash of InnoDB if a non-standard or unknown table
flags existed in a SYS_TABLES record. This is important because the next
file version, Cheetah, will identify itself by expanding this field.  So
unless this is fixed, an older engine that tries to open a table in a
tablespace with a newer file version will crash instead of report an error
and refuse to open the table, as it should do.

Reviewed at RB://583.    Approved by Marko.
2011-02-04 08:59:30 -06:00
Marko Mäkelä
1129d230f7 Merge mysql-5.1-innodb to mysql-5.5-innodb. 2011-02-02 15:58:01 +02:00
Vasil Dimov
428063064f Replay a lost change (fix for Bug#56947 InnoDB leaks memory... in 5.5)
This change was originally done in
marko.makela@oracle.com-20101011085943-50pskvsbbsujbukg
but was later lost during the merge process.
2011-02-01 18:28:41 +02:00
Marko Mäkelä
6268a3e437 Merge mysql-5.1-innodb to mysql-5.5-innodb. 2011-01-31 10:23:38 +02:00
Vasil Dimov
102c39d344 Merge mysql-5.5-innodb -> mysql-5.5 2011-01-30 18:51:37 +02:00
Jimmy Yang
fe4e126849 Fix Bug #59390 row_merge_build_indexes() fails to register tmpfd for PFS
rb://582 approved by Marko
2011-01-28 01:38:21 -08:00
Jimmy Yang
5d2239e118 Merge from mysql-5.1-innodb to mysql-5.5-innodb 2011-01-28 01:10:40 -08:00