hash index at shutdown
btr_search_disable(): Just drop the entire adaptive hash index,
without dropping every record separately.
buf_pool_clear_hash_index(): Renamed and simplified from
buf_pool_drop_hash_index(). Set block->index = NULL for every block in
the buffer pool. Do not release the btr_search_latch. The caller will
have to adjust other data structures.
Remove block->is_hashed. It is redundant, should be always equal to
block->index != NULL.
Remove btr_search_fully_disabled, btr_search_enabled_mutex, and
SYNC_SEARCH_SYS_CONF. We drop the AHI in one pass, without releasing
the btr_search_latch in between.
Replace void* with const rec_t* and add assertions on btr_search_latch
and btr_search_enabled to ha0ha.h, ha0ha.ic, ha0ha.c.
page_set_max_trx_id(): Ignore the adaptive hash index. I forgot to
push this in rb:750.
btr0sea.c: Always after acquiring btr_search_latch, check for
block->index==NULL or !btr_search_enabled. We can now set
block->index=NULL while only holding btr_search_latch in exclusive
mode. Always acquire btr_search_latch before reading block->index,
except in shortcuts when testing for block->index == NULL.
ha_clear(), ha_search(): Unused function, remove.
buf_page_peek_if_search_hashed(): Remove. This function may avoid
latching a page at the cost of doing a duplicate buf_pool->page_hash
lookup.
rb:775 approved by Inaam Rana
rw_lock_x_lock_func(): Assert that the thread is not already holding
the lock in a conflicting mode (RW_LOCK_SHARED).
rw_lock_s_lock_func(): Assert that the thread is not already holding
the lock in a conflicting mode (RW_LOCK_EX).
Bug 12980094 - ASSERTION IN INNODB DETECTED IN RQG_PARTITION_DDL
Bug 13034534 - RQG TESTS FAIL ON WINDOWS WITH CRASH NEAR RW_LOCK_DEBUG_PRINT
All access to struct rw_lock_debug_struct must be protected by rw_lock_debug_mutex_enter().
when buffered changes are to be discarded
sync_thread_add_level(level = SYNC_IBUF_INDEX_TREE): Relax a too strict
condition that the thread must not be holding locks below SYNC_FSP_PAGE.
It is perfectly valid to hold any latch above SYNC_IBUF_INDEX_TREE when
acquiring the insert buffer tree latch.
discarded in buf_page_create()
This bug turned out to be a false alarm, a bug in the UNIV_SYNC_DEBUG
diagnostic code. Because of this, the patch was not backported to the
built-in InnoDB in MySQL 5.1. Furthermore, there is no test case for
InnoDB Plugin in MySQL 5.1, because the delete buffering in MySQL 5.5
makes triggering the failure much easier.
When a freed page for which there exist orphaned buffered changes is
allocated and reused for something else, buf_page_create() will discard
the buffered changes by invoking ibuf_merge_or_delete_for_page().
This would violate the InnoDB latching order.
Tweak the latching order as follows. Move SYNC_IBUF_MUTEX below
SYNC_FSP_PAGE, where it logically belongs, and assign new latching
levels for the ibuf->index->lock and the insert buffer B-tree pages:
#define SYNC_IBUF_MUTEX 370 /* ibuf_mutex */
#define SYNC_IBUF_INDEX_TREE 360
#define SYNC_IBUF_TREE_NODE_NEW 359
#define SYNC_IBUF_TREE_NODE 358
btr_block_get(), btr_page_get(): In UNIV_SYNC_DEBUG, add the parameter
"index" for determining the appropriate latching order
(SYNC_IBUF_TREE_NODE or SYNC_TREE_NODE).
btr_page_alloc_for_ibuf(), btr_create(): Use SYNC_IBUF_TREE_NODE_NEW
instead of SYNC_TREE_NODE_NEW for insert buffer pages.
btr_cur_search_to_nth_level(), btr_pcur_restore_position_func(): Use
SYNC_IBUF_TREE_NODE instead of SYNC_TREE_NODE for insert buffer pages.
btr_search_guess_on_hash(): Assert that the index is not an insert buffer tree.
dict_index_add_to_cache(): Use SYNC_IBUF_INDEX_TREE for the insert
buffer tree (ibuf->index->lock).
ibuf0ibuf.c: Use SYNC_IBUF_TREE_NODE or SYNC_IBUF_TREE_NODE_NEW for
all B-tree pages.
ibuf_merge_or_delete_for_page(): Assert that the user page is
BUF_IO_READ fixed. Only in this way it is OK to latch it as
SYNC_IBUF_TREE_NODE instead of the proper SYNC_TREE_NODE (which would
violate the changed latching order).
sync_thread_add_level(): Remove the special tweak for
SYNC_IBUF_MUTEX. Add rules for the added latching levels.
rb:591 approved by Jimmy Yang
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
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
rw_lock_create_func(): Initialize lock->writer_thread, so that Valgrind
will not complain even when Valgrind instrumentation is not enabled.
Flag lock->writer_thread uninitialized, so that Valgrind can complain
when it is used uninitialized.
rw_lock_set_writer_id_and_recursion_flag(): Revert the bogus Valgrind
instrumentation that was pushed in the first attempt to fix this bug.
rw_lock_debug_print(): Add parameter FILE* for specifying the output stream.
rw_lock_list_print_info(): Invoke rw_lock_debug_print() on file, not stderr.
Detailed revision comments:
r6749 | vasil | 2010-02-20 18:45:41 +0200 (Sat, 20 Feb 2010) | 5 lines
Non-functional change: update copyright year to 2010 of the files
that have been modified after 2010-01-01 according to svn.
for f in $(svn log -v -r{2010-01-01}:HEAD |grep "^ M " |cut -b 16- |sort -u) ; do sed -i "" -E 's/(Copyright \(c\) [0-9]{4},) [0-9]{4}, (.*Innobase Oy.+All Rights Reserved)/\1 2010, \2/' $f ; done
Detailed revision comments:
r6449 | marko | 2010-01-13 22:38:53 +0200 (Wed, 13 Jan 2010) | 18 lines
branches/zip: lock_rec_validate_page(): Only validate the record
queues when the thread is not holding a space->latch.
When UNIV_DEBUG is defined while UNIV_SYNC_DEBUG is not,
latching order violations will still occur and deadlocks will be possible.
sync_thread_levels_nonempty_gen(): Renamed from
sync_thread_levels_empty_gen(). Return the violating latch or NULL
instead of FALSE or TRUE, except that there will be a ut_error before
the non-NULL return.
sync_thread_levels_empty_gen(): A macro that negates the return value of
sync_thread_levels_nonempty_gen().
sync_thread_levels_contains(): New function, based on
sync_thread_levels_nonempty_gen().
This should fix Issue #441.
Detailed revision comments:
r6446 | marko | 2010-01-13 17:20:10 +0200 (Wed, 13 Jan 2010) | 3 lines
branches/zip: Treat mem_hash_mutex specially in mutex_free(),
and explicitly free mem_hash_mutex in mem_close().
This fixes the breakage of UNIV_MEM_DEBUG that was filed as Issue #434.
Detailed revision comments:
r6130 | marko | 2009-11-02 11:42:56 +0200 (Mon, 02 Nov 2009) | 9 lines
branches/zip: Free all resources at shutdown. Set pointers to NULL, so
that Valgrind will not complain about freed data structures that are
reachable via pointers. This addresses Bug #45992 and Bug #46656.
This patch is mostly based on changes copied from branches/embedded-1.0,
mainly c5432, c3439, c3134, c2994, c2978, but also some other code was
copied. Some added cleanup code is specific to MySQL/InnoDB.
rb://199 approved by Sunny Bains
1. Undo r6031 btr/btr0btr.c changes
2. apply skipped Plug.in changes and missed revisions
Detailed revision comments:
r5865 | vasil | 2009-09-12 02:26:03 -0500 (Sat, 12 Sep 2009) | 10 lines
branches/zip:
Simplify the compile time checks by splittig them into 5 independent checks:
* Whether GCC atomics are available
* Whether pthread_t can be used by GCC atomics
* Whether Solaris libc atomics are available
* Whether pthread_t can be used by Solaris libs atomics
* Checking the size of pthread_t
r5869 | vasil | 2009-09-12 03:33:11 -0500 (Sat, 12 Sep 2009) | 15 lines
branches/zip:
Include ut0auxconf.h only if none of the macros it would define is defined.
The check when to include this header was outdated from the time when there
was only one macro involved.
Move the atomics checks that are in univ.i outside of
#if windows ... #else ... #endif
This simplifies the code and removes some duplicates like defining
HAVE_ATOMIC_BUILTINS if HAVE_WINDOWS_ATOMICS is defined in both branches.
Do not define the same macro HAVE_ATOMIC_PTHREAD_T for different events.
Instead define HAVE_IB_ATOMIC_PTHREAD_T_GCC and
HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS.
r5871 | vasil | 2009-09-12 04:25:44 -0500 (Sat, 12 Sep 2009) | 6 lines
branches/zip:
Rename HAVE_SOLARIS_ATOMICS to HAVE_IB_SOLARIS_ATOMICS and
IB_HAVE_PAUSE_INSTRUCTION to HAVE_IB_PAUSE_INSTRUCTION so they
all follow the same HAVE_IB_* convention.
r5888 | vasil | 2009-09-14 03:38:45 -0500 (Mon, 14 Sep 2009) | 40 lines
branches/zip:
Back-merge c5880 and c5881 from branches/embedded-1.0:
------------------------------------------------------------------------
r5880 | vasil | 2009-09-12 17:28:44 +0300 (Sat, 12 Sep 2009) | 18 lines
Changed paths:
M /branches/embedded-1.0/configure.in
M /branches/embedded-1.0/include/os0sync.h
M /branches/embedded-1.0/srv/srv0start.c
branches/embedded-1.0:
Clean up and simplify the code that surrounds the atomic ops:
* Simplify the code that prints what atomics are used:
Instead of repeating the same conditions on which each atomics are used
use just one printf that prints a variable defined by the code which
chooses what atomics to use.
* In os0sync.h pick up each atomic variant only if it has been selected
by autoconf (based on IB_ATOMIC_MODE_* macros). Define the startup message
to be printed.
* In configure.in: check what user has chosen and if he has chosen
something that is not available, emit an error. If nothing has been chosen
explicitly by the user, auto select an option according to the described
logic in configure.in.
------------------------------------------------------------------------
r5881 | vasil | 2009-09-12 20:08:27 +0300 (Sat, 12 Sep 2009) | 4 lines
Changed paths:
M /branches/embedded-1.0/configure.in
branches/embedded-1.0:
Fix syntax error in test program.
------------------------------------------------------------------------
r5889 | vasil | 2009-09-14 04:17:18 -0500 (Mon, 14 Sep 2009) | 5 lines
branches/zip:
Add missing return statement in the test program that could have
caused a warning.
r5893 | inaam | 2009-09-14 10:20:48 -0500 (Mon, 14 Sep 2009) | 10 lines
branches/zip rb://159
In case of pages that are not made young the counter is incremented
only when the page in question is 'old'. In case of pages that are
made young the counter is incremented in case of all pages. For apple
to apple comparison this patch changes the 'young-making' counter to
consider only 'old' blocks.
Approved by: Marko
r5537 | vasil | 2009-07-21 04:31:26 -0500 (Tue, 21 Jul 2009) | 5 lines
branches/zip:
Fixups in ChangeLog: sort filenames alphabetically and wrap to 78 chars per
line.
r5870 | vasil | 2009-09-12 04:13:44 -0500 (Sat, 12 Sep 2009) | 7 lines
branches/zip:
Define HAVE_ATOMIC_BUILTINS and INNODB_RW_LOCKS_USE_ATOMICS in os0sync.h
instead of in univ.i. The code expects os_*() macros to be present if
HAVE_ATOMIC_BUILTINS and INNODB_RW_LOCKS_USE_ATOMICS are defined. So define
them next to defining the os_*() macros.
r5696 | vasil | 2009-08-26 08:15:59 -0500 (Wed, 26 Aug 2009) | 14 lines
branches/zip:
Merge a change from MySQL:
http://lists.mysql.com/commits/80832
2968 Jonathan Perkin 2009-08-14
Build fixes for Windows, AIX, HP/UX and Sun Studio11, from Timothy Smith.
modified:
CMakeLists.txt
cmd-line-utils/readline/util.c
storage/innodb_plugin/handler/i_s.cc
storage/innodb_plugin/include/univ.i
r5897 | marko | 2009-09-15 03:29:00 -0500 (Tue, 15 Sep 2009) | 8 lines
branches/zip: Avoid bogus messages about latching order violations when
UNIV_SYNC_DEBUG is defined.
sync_thread_levels_g(): Add the parameter "warn". Do not print
anything unless it is set.
sync_thread_add_level(): Pass warn=TRUE to sync_thread_levels_g()
when the check is within an assertion; FALSE if it is not.
r5899 | marko | 2009-09-15 06:26:01 -0500 (Tue, 15 Sep 2009) | 4 lines
branches/zip: ut0ut.h: Do not #include "os0sync.h" #ifdef UNIV_HOTBACKUP.
Since r5872, the InnoDB Hot Backup build was broken.
Fix it by not defining any thread synchronization primitives in ut0ut.h.
InnoDB Hot Backup is a single-threaded program.
Note : r5865 is skipped
r5869 plug.in related changes are aslo skipped
Detailed revision comments:
r5865 | vasil | 2009-09-12 02:26:03 -0500 (Sat, 12 Sep 2009) | 10 lines
branches/zip:
Simplify the compile time checks by splittig them into 5 independent checks:
* Whether GCC atomics are available
* Whether pthread_t can be used by GCC atomics
* Whether Solaris libc atomics are available
* Whether pthread_t can be used by Solaris libs atomics
* Checking the size of pthread_t
r5866 | vasil | 2009-09-12 02:30:08 -0500 (Sat, 12 Sep 2009) | 5 lines
branches/zip:
Add the check for GCC atomics to ut0auxconf* (copied from plug.in) because
we no longer rely on MySQL's HAVE_GCC_ATOMIC_BUILTINS.
r5867 | vasil | 2009-09-12 02:43:45 -0500 (Sat, 12 Sep 2009) | 4 lines
branches/zip:
Update comment to reflect reality.
r5868 | vasil | 2009-09-12 03:01:17 -0500 (Sat, 12 Sep 2009) | 6 lines
branches/zip:
Move the check whether to include ut0auxconf.h before everything because
we are now even checking for GCC atomics, we relied on MySQL to define
this macro before.
r5869 | vasil | 2009-09-12 03:33:11 -0500 (Sat, 12 Sep 2009) | 15 lines
branches/zip:
Include ut0auxconf.h only if none of the macros it would define is defined.
The check when to include this header was outdated from the time when there
was only one macro involved.
Move the atomics checks that are in univ.i outside of
#if windows ... #else ... #endif
This simplifies the code and removes some duplicates like defining
HAVE_ATOMIC_BUILTINS if HAVE_WINDOWS_ATOMICS is defined in both branches.
Do not define the same macro HAVE_ATOMIC_PTHREAD_T for different events.
Instead define HAVE_IB_ATOMIC_PTHREAD_T_GCC and
HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS.
r5870 | vasil | 2009-09-12 04:13:44 -0500 (Sat, 12 Sep 2009) | 7 lines
branches/zip:
Define HAVE_ATOMIC_BUILTINS and INNODB_RW_LOCKS_USE_ATOMICS in os0sync.h
instead of in univ.i. The code expects os_*() macros to be present if
HAVE_ATOMIC_BUILTINS and INNODB_RW_LOCKS_USE_ATOMICS are defined. So define
them next to defining the os_*() macros.
r5871 | vasil | 2009-09-12 04:25:44 -0500 (Sat, 12 Sep 2009) | 6 lines
branches/zip:
Rename HAVE_SOLARIS_ATOMICS to HAVE_IB_SOLARIS_ATOMICS and
IB_HAVE_PAUSE_INSTRUCTION to HAVE_IB_PAUSE_INSTRUCTION so they
all follow the same HAVE_IB_* convention.
r5872 | vasil | 2009-09-12 04:35:17 -0500 (Sat, 12 Sep 2009) | 5 lines
branches/zip:
Explicitly include os0sync.h to the places where HAVE_ATOMIC_BUILTINS and
INNODB_RW_LOCKS_USE_ATOMICS are used to avoid potential problems.