buf_LRU_block_free_non_file_page(): ut_ad(block) before dereferencing block.
buf_LRU_block_remove_hashed_page(): Forbid buf_pool_mutex_exit() while
calling buf_buddy_free(). Callers of buf_LRU_block_remove_hashed_page()
assume that the buffer pool mutex will not be released and reacquired.
satisfy some conditions when UNIV_DEBUG is defined.
HASH_SEARCH(): New parameter: ASSERTION. All users will pass an appropriate
ut_ad() or nothing.
dict_table_add_to_columns(): Assert that the table being added to the data
dictionary cache is not already being pointed to by the name_hash and
id_hash tables.
HASH_SEARCH_ALL(): New macro, for use in dict_table_add_to_columns().
dict_mem_table_free(): Set ut_d(table->cached = FALSE), so that we can
check ut_ad(table->cached) when traversing the hash tables, as in
HASH_SEARCH(name_hash, dict_sys->table_hash, ...) and
HASH_SEARCH(id_hash, dict_sys->table_id_hash, ...).
dict_table_get_low(), dict_table_get_on_id_low(): Assert
ut_ad(!table || table->cached).
fil_space_get_by_id(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(hash, fil_system->spaces, ...).
fil_space_get_by_name(): Check ut_ad(space->magic_n == FIL_SPACE_MAGIC_N)
in HASH_SEARCH(name_hash, fil_system->name_hash, ...).
buf_buddy_block_free(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->zip_hash, ...).
buf_page_hash_get(): Check that the blocks are in valid state in
HASH_SEARCH(hash, buf_pool->page_hash, ...).
get_share(), free_share(): Check ut_ad(share->use_count > 0) in
HASH_SEARCH(table_name_hash, innobase_open_tables, ...).
This was posted as rb://75 for tracking down errors similar to Issue #153.
buf_flush_try_page(): Rename to buf_flush_page(), and change the
return type to void. Replace the parameters space, offset with bpage,
and remove the second page hash lookup. Note and assert that both
buf_pool_mutex and block_mutex must now be held upon entering the
function. They will still be released by this function.
buf_flush_try_neighbors(): Replace buf_flush_try_page() with
buf_flush_page(). Make the logic easier to follow by not negating the
precondition of buf_flush_page().
rb://73 approved by Sunny Bains. This is related to Issue #157.
remove dead code.
buf_flush_ready_for_flush(), buf_flush_try_page(): Assert that
flush_type is one of BUF_FLUSH_LRU or BUF_FLUSH_LIST. The flush_type
comes from buf_flush_batch(), which already asserts this. The
assertion holds for all calls in the source code.
buf_flush_try_page(): Remove the dead case BUF_FLUSH_SINGLE_PAGE
of switch (flush_type).
buf_page_struct: Note that space and offset are also protected by
buf_pool_mutex. They are only assigned to by
buf_block_set_file_page(). Thus, it suffices for buf_flush_batch() to
hold just buf_pool_mutex when checking these fields.
buf_flush_try_page(): Rename "locked" to "is_s_latched", per Heikki's request.
buf_flush_batch(): Move the common statement mutex_exit(block_mutex)
from all if-else if-else branches before the if block. Remove the
redundant test (buf_pool->init_flush[flush_type] == FALSE) that was
apparently copied from buf_flush_write_complete().
buf_flush_write_block_low(): Note why it is safe not to hold buf_pool_mutex
or block_mutex. Enumerate the assumptions in debug assertions.
buf_flush_insert_sorted_into_flush_list(): Remove unused code.
Change the parameter to buf_block_t* block and assert that
block->state == BUF_BLOCK_FILE_PAGE. This is part of Issue #155.
Originally, there were provisions in InnoDB for multiple insert buffer
B-trees, apparently one for each tablespace.
When Heikki implemented innodb_file_per_table (multiple InnoDB
tablespaces) in MySQL 4.1, he made the insert buffer live only in the
system tablespace (space 0) but left the provisions in the code.
When Osku Salerma implemented delete buffering, he also cleaned up the
insert buffer subsystem so that only one insert buffer B-tree exists.
This patch applies the clean-up to the InnoDB Plugin.
Having a separate patch of the insert buffer clean-up should help us
better compare the essential changes of the InnoDB Plugin and InnoDB+
and to track down bugs that are specific to InnoDB+.
IBUF_SPACE_ID: New constant, defined as 0.
ibuf_data_t: Remove.
ibuf_t: Add the applicable fields from ibuf_data_t. There is only one
insert buffer tree from now on.
ibuf_page_low(), ibuf_page(): Merge to a single function ibuf_page().
fil_space_t: Remove ibuf_data.
fil_space_get_ibuf_data(): Remove. There is only one ibuf_data, for
space IBUF_SPACE_ID.
fil_ibuf_init_at_db_start(): Remove.
ibuf_init_at_db_start(): Fuse with ibuf_data_init_for_space().
ibuf_validate_low(): Remove. There is only one ibuf tree.
ibuf_free_excess_pages(), ibuf_header_page_get(),
ibuf_free_excess_pages(): Remove the parameter space, which was always
0.
ibuf_tree_root_get(): Remove the parameters space and data. There is
only one ibuf tree, for space IBUF_SPACE_ID.
ibuf_data_sizes_update(): Rename to ibuf_size_update(), and remove the
parameter data. There is only one ibuf data struct.
ibuf_build_entry_pre_4_1_x(): New function, refactored from
ibuf_build_entry_from_ibuf_rec().
ibuf_data_enough_free_for_insert(), ibuf_data_too_much_free(): Remove
the parameter data. There is only one insert buffer tree.
ibuf_add_free_page(), ibuf_remove_free_page(): Remove the parameters
space and data. There is only one insert buffer tree.
ibuf_get_merge_page_nos(): Add parenthesis, to reduce diffs to
branches/innodb+.
ibuf_contract_ext(): Do not pick an insert buffer tree at random.
There is only one.
ibuf_print(): Print the single insert buffer tree.
rb://19 approved by Heikki on IM
------------------------------------------------------------------------
r2742 | inaam | 2008-10-08 22:02:15 +0300 (Wed, 08 Oct 2008) | 11 lines
branches/5.1:
Fix Bug#39939 DROP TABLE/DISCARD TABLESPACE takes long time in
buf_LRU_invalidate_tablespace()
Improve implementation of buf_LRU_invalidate_tablespace by attempting
hash index drop in batches instead of doing it one by one.
Reviewed by: Heikki, Sunny, Marko
Approved by: Heikki
------------------------------------------------------------------------
r2744 | marko | 2008-10-09 10:53:09 +0300 (Thu, 09 Oct 2008) | 5 lines
branches/5.1: ha_innobase::delete_all_rows(): In response to a user asking
<http://forums.innodb.com/read.php?4,215,215> why DELETE FROM t is not
mapped to TRUNCATE TABLE t as it is in MyISAM, note in a comment that
DELETE is transactional while TRUNCATE is not.
------------------------------------------------------------------------
buf_block_dbg_add_level(block, level): Define as an empty macro when
UNIV_SYNC_DEBUG is not defined. Remove #ifdef UNIV_SYNC_DEBUG around
all invocations.
cache, especially buf_pool->LRU_old and bpage->old.
buf_LRU_old_adjust_len(), buf_LRU_remove_block(): Check that blocks in
buf_pool->LRU_old have the "old" flag set and the blocks preceding
buf_pool->LRU_old have the "old" flag clear.
buf_LRU_add_block_low(), buf_relocate(): Check that buf_pool->LRU_old
is the first block in the LRU list whose "old" flag is set.
buf_LRU_free_block(): When replacing a control block in the LRU list
with a control block for a compressed page, assert that the "old"
flags in the neighboring LRU list entries grow monotonically.
buf_page_set_old(): Assert that the "old" flags in the neighboring LRU
list entries grow monotonically.
buf_pool->LRU_old_len. However, we forgot to check if buf_pool->LRU_old
happens to point to b's successor in the LRU list. If it does, we must
assign buf_pool->LRU_old = b. The following invariants hold:
In the LRU list, the "old" flag should grow monotonically, i.e., it is 0
for the first few items and 1 from thereafter.
If buf_pool->LRU_old != NULL, it must point to the first item with old=1
in the LRU list, and there must be buf_pool->LRU_old_len old items in the list.
This should fix Mantis issue#50 and issue#68.
buf_flush_init_for_writing(), buf_LRU_block_remove_hashed_page():
Dump the page frame featuring the incorrect FIL_PAGE_TYPE along with the
page_zip->data that might contain an earlier version of the page.
an incorrect value. This is to track down Mantis issue#63 and issue#65.
buf_LRU_block_remove_hashed_page(),
buf_flush_init_for_writing(): dump the compressed page before ut_error.
(r2478 was skipped for the obvious reason)
------------------------------------------------------------------------
r2464 | vasil | 2008-05-19 17:59:42 +0300 (Mon, 19 May 2008) | 9 lines
branches/5.1:
Fix Bug#36600 SHOW STATUS takes a lot of CPU in buf_get_latched_pages_number
by removing the Innodb_buffer_pool_pages_latched variable from
SHOW STATUS output in non-UNIV_DEBUG compilation.
Approved by: Heikki
------------------------------------------------------------------------
r2466 | calvin | 2008-05-20 01:37:14 +0300 (Tue, 20 May 2008) | 12 lines
branches/5.1:
Fix Bug#11894 innodb_file_per_table crashes w/ Windows .sym symbolic
link hack
The crash was due to un-handled error 3 (path not found). In the case
of file per table, change the call to os_file_handle_error_no_exit()
from os_file_handle_error(). Also, checks for full path pattern during
table create (Windows only), which is used in symbolic link and temp
table creation.
Approved by: Heikki
------------------------------------------------------------------------
r2478 | sunny | 2008-05-23 08:29:08 +0300 (Fri, 23 May 2008) | 3 lines
branches/5.1: Fix for bug# 36793. This is a back port from branches/zip. This
code has been tested on a big-endian machine too.
------------------------------------------------------------------------
r2480 | vasil | 2008-05-27 11:40:07 +0300 (Tue, 27 May 2008) | 11 lines
branches/5.1:
Fix Bug#36819 ut_usectime does not handle errors from gettimeofday
by retrying gettimeofday() several times if it fails in ut_usectime().
If it fails on all calls then return error to the caller to be handled
at higher level.
Update the variable innodb_row_lock_time_max in SHOW STATUS output only
if ut_usectime() was successful.
------------------------------------------------------------------------
r2482 | sunny | 2008-05-28 12:18:35 +0300 (Wed, 28 May 2008) | 5 lines
branches/5.1: Fix for Bug#35602, "Failed to read auto-increment value from
storage engine". The test for REPLACE was an error of ommission since it's
classified as a simple INSERT. For REPLACE statements we don't acquire
the special AUTOINC lock for AUTOINC_NEW_STYLE_LOCKING with this fix.
------------------------------------------------------------------------
r2485 | vasil | 2008-05-28 16:01:14 +0300 (Wed, 28 May 2008) | 9 lines
branches/5.1:
Fix Bug#36149 Read buffer overflow in srv0start.c found during "make test"
Use strncmp(3) instead of memcmp(3) to avoid reading past end of the string
if it is empty (*str == '\0'). This bug is _not_ a buffer overflow.
Discussed with: Sunny (via IM)
------------------------------------------------------------------------
that in the fix but the earlier check fails because it tries to be too
strict and assumes that if the block is on the clean list then it can
only be in state io fix NONE.
INNODB_COMPRESSION_BUDDY and INNODB_COMPRESSION_BUDDY_RESET.
buf_buddy_stat_struct, buf_buddy_stat_t, buf_buddy_stat[]:
Statistics of the buddy system grouped by block size.
i_s_innodb_compression_buddy, i_s_innodb_compression_buddy_reset:
New INFORMATION_SCHEMA plugins.
i_s_compression_buddy_fields_info[]: Define the fields:
size, used, free, relocated, relocated_sec.
i_s_compression_buddy_fill_low(), i_s_compression_buddy_fill(),
i_s_compression_buddy_reset_fill(): Fill the fields.
i_s_compression_buddy_init(), i_s_compression_buddy_reset_init():
Initialize the tables.
Compute BUF_READ_AHEAD_RANDOM_AREA and BUF_READ_AHEAD_LINEAR_AREA
only once. The definition of BUF_READ_AHEAD_AREA depends on
buf_pool->curr_size, which could change while this code is running.
blocks that contains uncompressed and compressed frames. This patch was
designed by Heikki and Inaam, implemented by Inaam, and refined and reviewed
by Marko and Sunny.
buf_buddy_n_frames, buf_buddy_min_n_frames, buf_buddy_max_n_frames: Remove.
buf_page_belongs_to_unzip_LRU(): New predicate:
bpage->zip.data && buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE.
buf_pool_t, buf_block_t: Add the linked list unzip_LRU. A block in the
regular LRU list is in unzip_LRU iff buf_page_belongs_to_unzip_LRU() holds.
buf_LRU_free_block(): Add a third return value to refine the case
"cannot free the block".
buf_LRU_search_and_free_block(): Update the documentation to reflect the
implementation.
buf_LRU_stat_t, buf_LRU_stat_cur, buf_LRU_stat_sum, buf_LRU_stat_arr[]:
Statistics for the unzip_LRU algorithm.
buf_LRU_stat_update(): New function: Update the statistics. Called once
per second by srv_error_monitor_thread().
buf_LRU_validate(): Validate the unzip_LRU list as well.
buf_LRU_evict_from_unzip_LRU(): New predicate: Use the unzip_LRU before
falling back to the regular LRU?
buf_LRU_free_from_unzip_LRU_list(), buf_LRU_free_from_common_LRU_list():
Subfunctions of buf_LRU_search_and_free_block().
buf_LRU_search_and_free_block(): Reimplement. Try to evict an uncompressed
page from the unzip_LRU list before falling back to evicting an entire block
from the common LRU list.
buf_unzip_LRU_remove_block_if_needed(): New function.
buf_unzip_LRU_add_block(): New function: Add a block to the unzip_LRU list.
buf_buddy_relocated_duration[],
page_zip_compress_duration[]
page_zip_decompress_duration[]: Record the total duration of the operations.
buf_buddy_relocate(), page_zip_compress(), page_zip_decompress():
Add ut_time_us() instrumentation.
i_s_zip_fields_info[], i_s_zip_fill_low(): Move the columns containing
cumulated statistics last. Add relocated_usec, compressed_usec, and
decompressed_usec.
buf_LRU_old_adjust_len(): Replace a constant ut_ad() with a preprocessor check.
buf_LRU_free_block(): Remove the check for the unlikely case
buf_pool->LRU_old == prev_b in order to simplify the function.
The check was implemented as part of r2306.
symbols. Use it for all definitions of non-static variables and functions.
lexyy.c, make_flex.sh: Declare yylex as UNIV_INTERN, not static. It is
referenced from pars0grm.c.
Actually, according to
nm .libs/ha_innodb.so|grep -w '[ABCE-TVXYZ]'
the following symbols are still global:
* The vtable for class ha_innodb
* pars0grm.c: The function yyparse() and the variables yychar, yylval, yynerrs
The required changes to the Bison-generated file pars0grm.c will be addressed
in a separate commit, which will add a script similar to make_flex.sh.
The class ha_innodb is renamed from class ha_innobase by a #define. Thus,
there will be no clash with the builtin InnoDB. However, there will be some
overhead for invoking virtual methods of class ha_innodb. Ideas for making
the vtable hidden are welcome. -fvisibility=hidden is not available in GCC 3.
stored columns (BLOBs).
btr_copy_blob_prefix(), btr_copy_zblob_prefix(),
btr_copy_externally_stored_field_prefix_low(),
btr_copy_externally_stored_field_prefix(),
btr_copy_externally_stored_field(),
btr_rec_copy_externally_stored_field():
Note that the page containing the clustered index record that points to
the BLOB must be latched.
btr_copy_zblob_prefix(): Note that there is no latch on the page, and thus
all accesses to a given page via this function must be covered by the same
set of locks or latches.
btr_copy_zblob_prefix(): Note that the block acquired by
buf_page_get_zip() is protected by an exclusive table lock or
or by a latch on the clustered index record.