Commit graph

364 commits

Author SHA1 Message Date
Inaam Rana
fce189fadb Merge from 5.1 the fix for Bug 12356373 2011-07-19 10:54:59 -04:00
Marko Mäkelä
0f37ccb30f Bug #12612184 BLOB debug code cleanup:
Refactor the !rec_offs_any_extern relaxation in row_build().

trx_assert_active(trx_id): Assert that the given transaction is active.
(In the 5.1 built-in InnoDB, there is no trx->is_recovered field.)

trx_assert_recovered(trx_id): Assert that the given transaction is
active and has been recovered after a crash.

row_build(): Replace a bunch of code with an assertion that invokes
trx_assert_active() or trx_assert_recovered() and row_get_rec_trx_id().

row_get_trx_id_offset(): Make the function inlined. Remove the unused
parameter rec, and make all parameters const.

row_get_rec_trx_id(), row_get_rec_roll_ptr(): Make all parameters const.

rb:691 approved by Jimmy Yang
2011-06-29 09:57:15 +03:00
Marko Mäkelä
417a267927 Re-enable the debug assertions for Bug#12650861.
Replace UNIV_BLOB_NULL_DEBUG with UNIV_DEBUG||UNIV_BLOB_LIGHT_DEBUG. 
Fix known bogus failures.

btr_cur_optimistic_update(): If rec_offs_any_null_extern(), assert that
the current transaction is an incomplete transaction that is being
rolled back in crash recovery.

row_build(): If rec_offs_any_null_extern(), assert that the transaction
that last updated the record was recovered during crash recovery
(and will soon be rolled back).
2011-06-16 11:51:04 +03:00
Marko Mäkelä
5b4ceba58d Bug#12612184 Race condition after btr_cur_pessimistic_update()
btr_cur_compress_if_useful(), btr_compress(): Add the parameter ibool
adjust. If adjust=TRUE, adjust the cursor position after compressing
the page.

btr_lift_page_up(): Return a pointer to the father page.

BTR_KEEP_POS_FLAG: A new flag for btr_cur_pessimistic_update().

btr_cur_pessimistic_update(): If *big_rec != NULL and flags &
BTR_KEEP_POS_FLAG, keep the cursor positioned on the updated record.
Also, do not release the index tree x-lock if *big_rec != NULL.

btr_cur_mtr_commit_and_start(): Commits and restarts a
mini-transaction so that it will retain an x-lock on index->lock and
the page of the cursor. This is invoked when
btr_cur_pessimistic_update() returns *big_rec != NULL.

In all callers of btr_cur_pessimistic_update() that do not pass
BTR_KEEP_POS_FLAG, assert that *big_rec == NULL.

btr_cur_compress(): Unused function [in the built-in MySQL 5.1], remove.

page_rec_get_nth(): Return the nth record on the page (an inverse
function of page_rec_get_n_recs_before()). Refactored from
page_get_middle_rec().

page_get_middle_rec(): Invoke page_rec_get_nth().

page_cur_insert_rec_zip_reorg(): Make use of the page directory
shortcuts in page_rec_get_nth() instead of scanning the whole list of
records.

row_ins_clust_index_entry_by_modify(): Pass BTR_KEEP_POS_FLAG to
btr_cur_pessimistic_update().

row_ins_index_entry_low(): If row_ins_clust_index_entry_by_modify()
returns a big_rec, invoke btr_cur_mtr_commit_and_start() in order to
commit and start the mini-transaction without releasing the x-locks on
index->lock and the cursor page, and write the big_rec. Releasing the
page latch in mtr_commit() caused a race condition.

row_upd_clust_rec(): Pass BTR_KEEP_POS_FLAG to
btr_cur_pessimistic_update(). If it returns a big_rec, invoke
btr_cur_mtr_commit_and_start() in order to commit and start the
mini-transaction without releasing the x-locks on index->lock and the
cursor page, and write the big_rec. Releasing the page latch in
mtr_commit() caused a race condition.

sync_thread_add_level(): Add the parameter ibool relock. When TRUE,
bypass the latching order rules.

rw_lock_add_debug_info(): For nested X-lock requests, pass relock=TRUE
to sync_thread_add_level().

rb:678 approved by Jimmy Yang
2011-06-16 10:27:21 +03:00
Marko Mäkelä
a862937699 Introduce UNIV_BLOB_NULL_DEBUG for temporarily hiding Bug#12650861.
Some ut_a(!rec_offs_any_null_extern()) assertion failures are indicating
genuine BLOB bugs, others are bogus failures when rolling back incomplete
transactions at crash recovery. This needs more work, and until I get a
chance to work on it, other testing must not be disrupted by this.
2011-06-15 10:16:59 +03:00
Marko Mäkelä
6348b7375a BLOB instrumentation for Bug#12612184 Race condition in row_upd_clust_rec()
If UNIV_DEBUG or UNIV_BLOB_LIGHT_DEBUG is enabled, add
!rec_offs_any_null_extern() assertions, ensuring that records do not
contain null pointers to externally stored columns in inappropriate
places.

btr_cur_optimistic_update(): Assert !rec_offs_any_null_extern().
Incomplete records must never be updated or deleted. This assertion
will cover also the pessimistic route.

row_build(): Assert !rec_offs_any_null_extern(). Search tuples must
never be built from incomplete index entries.

row_rec_to_index_entry(): Assert !rec_offs_any_null_extern() unless
ROW_COPY_DATA is requested. ROW_COPY_DATA is used for
multi-versioning, and therefore it might be valid to copy the most
recent (uncommitted) version while it contains a null pointer to
off-page columns.

row_vers_build_for_consistent_read(),
row_vers_build_for_semi_consistent_read(): Assert !rec_offs_any_null_extern()
on all versions except the most recent one.

trx_undo_prev_version_build(): Assert !rec_offs_any_null_extern() on
the previous version.

rb:682 approved by Sunny Bains
2011-06-09 13:31:15 +03:00
Marko Mäkelä
6ebb38a21d Merge mysql-5.1 to mysql-5.5. 2011-06-29 16:53:16 +03:00
Marko Mäkelä
1b686f2a48 Merge mysql-5.1 to mysql-5.5. 2011-06-29 10:04:00 +03:00
Marko Mäkelä
8c988dc61b Bug#12699505 Memory leak in row_create_index_for_mysql()
DB_COL_APPEARS_TWICE_IN_INDEX: Remove. This condition is already
checked and reported by MySQL before passing the index definition to
the storage engine.

row_create_index_for_mysql(): Remove the redundant check for
DB_COL_APPEARS_TWICE_IN_INDEX. When enforcing the column prefix index
limit, invoke dict_mem_index_free(index) to plug the memory leak. In
the loop, use index->n_def instead of dict_index_get_n_fields(index),
because the latter would be 0 for indexes that have not been copied to
the data dictionary cache.

innodb-use-sys-malloc.test:

Add test cases for attempting to trigger the error checks in
row_create_index_for_mysql(). Before MySQL 5.5 and WL#5743, the leak
is only reproducible if ha_innobase::max_supported_key_part_length()
returned a higher limit than the one used in
row_create_index_for_mysql().

In MySQL 5.5 and later, the leak is reproducible with
innodb_large_prefix=true.

rb:688 approved by Jimmy Yang
2011-06-28 15:28:21 +03:00
Marko Mäkelä
7545f86670 Merge mysql-5.1 to mysql-5.5.
This patch was already pushed to mysql-5.5 by Inaam Rana.
2011-06-23 15:57:25 +03:00
Inaam Rana
9df4c14354 merge from mysql-5.1
Bug 12635227 - 61188: DROP TABLE EXTREMELY SLOW
2011-06-17 16:29:19 -04:00
Marko Mäkelä
f43adb8072 Merge mysql-5.1 to mysql-5.5. 2011-06-16 15:13:24 +03:00
Marko Mäkelä
3400e0be0a Merge mysql-5.1 to mysql-5.5. 2011-06-16 12:07:49 +03:00
Marko Mäkelä
d5d2c4fa74 Merge mysql-5.1 to mysql-5.5. 2011-06-15 10:30:19 +03:00
Marko Mäkelä
34baff7743 Merge mysql-5.1 to mysql-5.5. 2011-06-09 13:59:02 +03:00
Marko Mäkelä
9d820f416b Non-functional change: Unbreak the Hot Backup build.
page_rec_write_field(): Omit the definition if UNIV_HOTBACKUP is defined.
2011-06-06 16:24:01 +03:00
Vasil Dimov
0e5617e5aa Increment InnoDB version from 1.1.7 to 1.1.8
InnoDB 1.1.7 was released with MySQL 5.5.13
2011-06-03 13:47:46 +03:00
Jimmy Yang
9e2b7fa7d5 Implement worklog #5743 InnoDB: Lift the limit of index key prefixes.
With this change, the index prefix column length lifted from 767 bytes
to 3072 bytes if "innodb_large_prefix" is set to "true".

rb://603 approved by Marko
2011-05-31 02:12:32 -07:00
Marko Mäkelä
53e9aabe12 Bug#12606344 - ADD VALGRIND DIAGNOSTICS TO MTR_START, MTR_COMMIT
mtr_start(): Declare the mtr memory area uninitialized in Valgrind
before initializing the fields.

mtr_commit(): Declare everything uninitialized except
mtr->start_lsn, mtr->end_lsn and mtr->state.
2011-05-31 10:55:29 +03:00
Marko Mäkelä
0f95f99b03 Bug#12584374 LOCK_VALIDATE TRIPS ASSERTION !BLOCK->PAGE.FILE_PAGE_WAS_FREED
lock_clust_rec_some_has_impl(), row_get_rec_trx_id(),
lock_rec_queue_validate(), lock_table_other_has_incompatible(),
lock_table_has_to_wait_in_queue(), lock_table_queue_validate():
Add const qualifiers.

row_get_trx_id_offset(): Add const qualifiers. Keep the parameter rec
only in UNIV_DEBUG builds. Inline the function.

lock_rec_validate_page(): Take the buffer block as a parameter, to
avoid a buf_page_get_gen() call in most cases.

lock_rec_validate_page_low(): A version of lock_rec_validate_page()
that assumes that the lock system mutexes are already being held.

lock_rec_get_next_on_page_const(): A const variant of
lock_rec_get_next_on_page().

lock_validate(): Do not release the lock system mutex while
buffer-fixing the block for the lock_rec_validate_page() call.
Releasing the mutex apparently caused the assertion failure.

rb:665 approved by Sunny Bains
2011-05-24 14:11:21 +03:00
Marko Mäkelä
34e5d4740e Backport an InnoDB Bug #58815 (Bug #11765812) work-around from mysql-trunk:
------------------------------------------------------------
revno 2876.244.305
revision id marko.makela@oracle.com-20110413082211-e6ouhjz5rmqxcqap
parent  marko.makela@oracle.com-20110413075948-kvytmc37ye1nt7d9
committer  Marko Mäkelä <marko.makela@oracle.com>
branch nick 5.6-innodb
timestamp Wed 2011-04-13 11:22:11 +0300
message:
  Suppress the Bug #58815 (Bug #11765812) assertion failure.

  buf_page_get_gen(): Introduce BUF_GET_POSSIBLY_FREED for suppressing the
  check that the file page must not have been freed.

  btr_estimate_n_rows_in_range_on_level(): Pass BUF_GET_POSSIBLY_FREED and
  explain in the comments why this is needed and why it should be mostly
  harmless to ignore the problem. If InnoDB had always initialized all
  unused fields in data files, no problem would exist.

  This change does not fix the bug, it just "shoots the messenger".

  rb:647 approved by Jimmy Yang
2011-05-24 11:41:31 +03:00
Marko Mäkelä
33a0d8690c A non-functional change related to Bug#11830883
page_rec_write_field(): Renamed from page_rec_write_index_page_no()
and inlined.
2011-05-09 11:12:26 +03:00
Jimmy Yang
7cb397c5e0 Merge from mysql-5.1-innodb to mysql-5.5-innodb 2011-05-04 03:47:30 -07:00
unknown
6ed10ee5dd Bug#60309 - Bug#12356829: MYSQL 5.5.9 FOR MAC OSX HAS BUG WITH FOREIGN KEY CONSTRAINTS
The innoDB global variable srv_lower_case_table_names is set to the value of lower_case_table_names declared in mysqld.h server in ha_innodb.cc.  Since this variable can change at runtime, it is reset for each handler call to ::create, ::open, ::rename_table & ::delete_table.

But it is possible for tables to be implicitly opened before an explicit handler call is made when an engine is first started or restarted.  I was able to reproduce that with the testcase in this patch on a version of InnoDB from 2 weeks ago.  It seemed like the change buffer entries for the secondary key was getting put into pages after the restart.  (But I am not sure, I did not write down the call stack while it was reproducing.)  In the current code, the implicit open, which is actually a call to dict_load_foreigns(), does not occur with this testcase.

The change is to replace srv_lower_case_table_names by an interface function in innodb.cc that retrieves the server global variable when it is needed.
2011-04-26 12:55:52 -05:00
Marko Mäkelä
460a7197bb Merge mysql-5.1-innodb to mysql-5.5-innodb. 2011-04-11 17:03:32 +03:00
Vasil Dimov
3dc70ced6f Increment InnoDB version from 1.1.6 to 1.1.7
InnoDB 1.1.6 was released with MySQL 5.5.11
2011-04-08 10:23:46 +03:00
Marko Mäkelä
0ff2a182b6 Bug #11766513 - 59641: Prepared XA transaction in system after hard crash
causes future shutdown hang

InnoDB would hang on shutdown if any XA transactions exist in the
system in the PREPARED state. This has been masked by the fact that
MySQL would roll back any PREPARED transaction on shutdown, in the
spirit of Bug #12161 Xa recovery and client disconnection.

[mysql-test-run] do_shutdown_server: Interpret --shutdown_server 0 as
a request to kill the server immediately without initiating a
shutdown procedure.

xid_cache_insert(): Initialize XID_STATE::rm_error in order to avoid a
bogus error message on XA ROLLBACK of a recovered PREPARED transaction.

innobase_commit_by_xid(), innobase_rollback_by_xid(): Free the InnoDB
transaction object after rolling back a PREPARED transaction.

trx_get_trx_by_xid(): Only consider transactions whose
trx->is_prepared flag is set. The MySQL layer seems to prevent
attempts to roll back connected transactions that are in the PREPARED
state from another connection, but it is better to play it safe. The
is_prepared flag was introduced in the InnoDB Plugin.

trx_n_prepared: A new counter, counting the number of InnoDB
transactions in the PREPARED state.

logs_empty_and_mark_files_at_shutdown(): On shutdown, allow
trx_n_prepared transactions to exist in the system.

trx_undo_free_prepared(), trx_free_prepared(): New functions, to free
the memory objects of PREPARED transactions on shutdown. This is not
needed in the built-in InnoDB, because it would collect all allocated
memory on shutdown. The InnoDB Plugin needs this because of
innodb_use_sys_malloc.

trx_sys_close(): Invoke trx_free_prepared() on all remaining
transactions.
2011-04-07 21:12:54 +03:00
Marko Mäkelä
2b8312e50c 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ä
0edf090a9e 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ä
67496884ae 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ä
6fe99e2dda 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
Marko Mäkelä
e2f148784f Merge mysql-5.1-innodb to mysql-5.5-innodb. 2011-03-30 14:52:26 +03:00
Marko Mäkelä
ddec6ecdd8 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
Marko Mäkelä
85dbe88d2f 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ä
a4d2a3a3b4 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ä
0cedc70904 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ä
0dc3b27245 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
Vasil Dimov
e84efcaf3f Merge mysql-5.5 -> mysql-5.5-innodb 2011-03-02 11:00:48 +02:00
Marko Mäkelä
a26c0f5cd5 Merge mysql-5.1-innodb to mysql-5.5-innodb. 2011-02-28 15:39:07 +02:00
Jimmy Yang
56845ed3b4 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
19372f1094 Merge mysql-5.5-innodb -> mysql-5.5 2011-02-23 19:33:41 +02:00
Sunny Bains
e9678ae8e7 Add ut0bh.h and ut0bh.c. 2011-02-23 17:48:15 +11:00
Sunny Bains
c08a820d14 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
da66465afd Add ut0bh.ic. 2011-02-23 07:24:34 +11:00
Sunny Bains
cfcd6eadef 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
a5cd4872ba Add files that were missed in bug# 11798085 commit. 2011-02-22 20:17:02 +11:00
Sunny Bains
b3c9cc6f21 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
0047afa3b2 Merge mysql-5.5-innodb -> mysql-5.5 2011-02-17 13:57:26 +02:00
Marko Mäkelä
18e7b61e64 Merge mysql-5.1-innodb to mysql-5.5-innodb. 2011-02-15 11:29:56 +02:00
Vasil Dimov
f887a28cb2 Merge mysql-5.1-innodb -> mysql-5.5-innodb 2011-02-10 17:26:09 +02:00