Commit graph

321 commits

Author SHA1 Message Date
calvin
173f74eabe branches/zip: remove duplicate "the" in comments. 2009-08-06 22:04:03 +00:00
inaam
c34ab748cc branches/zip
Change the read ahead parameter name to innodb_read_ahead_threshold.
Change the meaning of this parameter to signify the number of pages
that must be sequentially accessed for InnoDB to trigger a readahead
request.

Suggested by: Ken
2009-07-20 15:23:15 +00:00
inaam
9af090cb0e branches/zip
Fixed warnings on windows where ulint != ib_uint64_t
2009-07-13 17:04:57 +00:00
inaam
ec40f5cd73 branches/zip rb://138 (REVERT)
Revert the flush neighbors patch as it shows regression in
the benchmarks run by Michael.
2009-07-13 14:48:45 +00:00
inaam
43fceb74f2 branches/zip rb://133
This patch introduces heuristics based flushing rate of dirty pages to
avoid IO bursts at checkpoint.

1) log_capacity / log_generated per second gives us number of seconds
in which ALL dirty pages need to be flushed. Based on this rough
assumption we can say that
n_dirty_pages / (log_capacity / log_generation_rate) = desired_flush_rate

2) We use weighted averages (hard coded to 20 seconds) of
log_generation_rate to avoid resonance.

3) From the desired_flush_rate we subtract the number of pages that have
been flushed due to LRU flushing. That gives us pages that we should
flush as part of flush_list cleanup. And that is the number (capped by
maximum io_capacity) that we try to flush from the master thread.

Knobs:
======

innodb_adaptive_flushing: boolean, global, dynamic, default TRUE.
Since this heuristic is very experimental and has the potential to
dramatically change the IO pattern I think it is a good idea to leave a
knob to turn it off.

Approved by: Heikki
2009-07-08 15:11:40 +00:00
inaam
449e6af3c6 branches/zip rb://138
The current implementation is to try to flush the neighbors of every
page that we flush. This patch makes the following distinction:

1) If the flush is from flush_list AND
2) If the flush is intended to move the oldest_modification LSN ahead
(this happens when a user thread sees little space in the log file and
attempts to flush pages from the buffer pool so that a checkpoint can
be made)

THEN

Do not try to flush the neighbors. Just focus on flushing dirty pages at
the end of flush_list

Approved by: Heikki
2009-07-07 22:00:49 +00:00
marko
4a447cde2e branches/zip: lock_print_info_all_transactions(), buf_read_recv_pages():
Tolerate missing tablespaces (zip_size==ULINT_UNDEFINED).
buf_page_get_gen(): Add ut_ad(ut_is_2pow(zip_size)).

Issue #289, rb://136 approved by Sunny Bains
2009-06-29 08:54:53 +00:00
marko
17105a0ad9 branches/zip: buf_page_get_gen(): Fix a race condition when reading
buf_fix_count.  This could explain Issue #156.
Tested by Michael.
2009-06-29 08:24:27 +00:00
marko
c0bda951fa branches/zip: buf_page_get_zip(): Fix a bogus warning about
block_mutex being possibly uninitialized.
2009-06-22 08:31:35 +00:00
marko
2bb0307bde branches/zip: buf_page_get_zip(): Eliminate a buf_page_get_mutex() call.
The function must switch on the block state anyway.
2009-06-16 08:00:48 +00:00
marko
484de4894f branches/zip: buf_page_get_gen(): Reduce mutex holding time by adjusting
buf_pool->n_pend_unzip while only holding buf_pool_mutex.
2009-06-16 07:08:59 +00:00
vasil
a3548774c6 branches/zip:
Fix Mantis Issue#244 fix bug in linear read ahead (no check on access pattern)

The changes are:

1) Take into account access pattern when deciding whether or not to do linear
  read ahead.
2) Expose a knob innodb_read_ahead_factor = [0-64] default (8), dynamic,
  global to control linear read ahead behvior
3) Disable random read ahead. Keep the code for now.

Submitted by:	Inaam (rb://122)
Approved by:	Heikki (rb://122)
2009-06-05 14:13:31 +00:00
marko
68a1ee9960 branches/zip: Add some Doxygen comments for many structs, typedefs,
#defines and global variables.  Many are still missing.
2009-05-26 12:28:49 +00:00
marko
11ff89d994 branches/zip: Add @file comments, and convert decorative
/*********************************
comments to Doxygen /** style like this:
/*****************************//**

This conversion was performed by the following command:

perl -i -e 'while(<ARGV>){if (m|^/\*{30}\**$|) {
s|\*{4}$|//**| if ++$com>1; $_ .= "\@file $ARGV\n" if $com==2}
print; if(eof){$.=0;undef $com}}' */*[ch] include/univ.i
2009-05-25 09:52:29 +00:00
marko
d075e80c49 branches/zip: Split some long lines that were introduced in r5091. 2009-05-25 08:09:45 +00:00
marko
e49dee377b branches/zip: Convert the function comments to Doxygen format.
This patch was created by running the following commands:

for i in */*[ch]; do doxygenify.pl $i; done
perl -i -pe 's#\*{3} \*/$#****/#' */*[ch]

where doxygenify.pl is
https://svn.innodb.com/svn/misc/trunk/tools/doxygenify.pl r510

Verified the consistency as follows:

(0) not too many /* in: */ or /* out: */ comments left in the code:
grep -l '/\*\s*\(in\|out\)[,:/]' */*[ch]

(1) no difference when ignoring blank lines, after stripping all
C90-style /* comments */, including multi-line ones, before and after
applying this patch:

perl -i -e 'undef $/;while(<ARGV>){s#/\*(.*?)\*/##gs;print}' */*[ch]
diff -I'^\s*$' --exclude .svn -ru TREE1 TREE2

(2) after stripping @return comments and !<, generated a diff and omitted
the hunks where /* out: */ function return comments were removed:

perl -i -e'undef $/;while(<ARGV>){s#!<##g;s#\n\@return\t.*?\*/# \*/#gs;print}'\
 */*[ch]
svn diff|
perl -e 'undef $/;$_=<>;s#\n-\s*/\* out[:,]([^\n]*?)(\n-[^\n]*?)*\*/##gs;print'

Some unintended changes were left.  These will be removed in a
subsequent patch.
2009-05-25 05:30:14 +00:00
marko
79362a389d branches/zip: Remove bogus out: comments of functions returning void. 2009-05-19 07:00:51 +00:00
marko
db9dc3bb20 branches/zip: Add missing out: comments to nullary functions. 2009-05-19 06:30:02 +00:00
marko
b10bc48d35 branches/zip: Add some missing out: comments to buf0buf.h, buf0buf.c. 2009-05-18 12:36:10 +00:00
marko
a512de6783 branches/zip: buf_validate(): Add missing out: comment. 2009-05-18 12:29:51 +00:00
marko
a0714b182c branches/zip: univ.i: Define REFMAN as the base URL of the
MySQL Reference Manual and use it in every string.
This fixes Issue #221.
2009-04-16 12:02:27 +00:00
inaam
b76aa20cbc branches/zip
SHOW ENGINE INNODB MUTEX shows all mutexes and rw_locks. This can
be overwhelming particularly when the buffer pool is very large
(note that each block in buffer pool has at least one mutex, one
rw_lock and an additional mutex if rw_lock does not use atomics).
With this patch status of following mutexes and rw-locks is not shown:

1) block->mutex
2) block->lock
3) block->lock->mutex (if applicable)
4) All other mutexes and rw-locks for which number of os-waits are zero

Addresses issue# 179 rb://99

Approved by: Marko
2009-03-25 17:18:33 +00:00
marko
d90bea085a branches/zip: Remove unneeded definitions and dependencies
from UNIV_HOTBACKUP builds.
2009-03-23 14:21:34 +00:00
marko
83e98148b5 branches/zip: buf_page_print(): Clean up the code #ifdef UNIV_HOTBACKUP. 2009-03-23 10:05:47 +00:00
marko
94ca1bb10d branches/zip: recv_recover_page(): Remove compile-time constant parameters. 2009-03-20 12:48:26 +00:00
marko
bbd50cdb96 branches/zip: buf_buddy_free_low(): Correct the function comment. 2009-03-18 12:32:13 +00:00
marko
c3d8b9b07c branches/zip: buf_LRU_block_remove_hashed_page(): Add some debug assertions. 2009-03-18 10:43:54 +00:00
marko
7f61b840f3 branches/zip: buf0buddy.c: Add and adjust some debug assertions. 2009-03-17 10:34:19 +00:00
marko
ee2b2dc739 branches/zip: UT_LIST_VALIDATE(): Add the parameter ASSERTION and
adjust all callers.
2009-03-16 09:43:34 +00:00
vasil
9bc861b4e8 branches/zip:
* Remove old Innobase copyright lines from C source files
* Add a reference to the GPLv2 license as recommended by the lawyers
at Oracle Legal

[Step 1/28]
2009-02-17 08:12:02 +00:00
vasil
c6232c06fa branches/zip:
To the files touched by the Google patch from c4144 (excluding
include/os0sync.ic because later we removed Google code from that file):

* Remove the Google license
* Remove old Innobase copyright lines
* Add a reference to the Google license and to the GPLv2 license at the top,
as recommended by the lawyers at Oracle Legal.
2009-02-17 07:56:33 +00:00
inaam
a1bb700fd2 branches/zip rb://30
This patch changes the innodb mutexes and rw_locks implementation.
On supported platforms it uses GCC builtin atomics. These changes
are based on the patch sent by Mark Callaghan of Google under BSD
license. More technical discussion can be found at rb://30

Approved by: Heikki
2009-02-09 23:36:25 +00:00
marko
fd6df2ba78 branches/zip: buf_block_align(): Fix a bogus debug assertion
that was introduced in r4036, to address Issue #161.
2009-02-04 14:09:24 +00:00
calvin
f43b923008 branches/zip: fix a compiler error and a warning
Both are minor changes:
1) Compiler error introduced in r4072: double ';' at the end.
2) Warning introduced in r3613: \mem\mem0pool.c(481) : 
warning C4098: 'mem_area_free' : 'void' function returning a value

Approved by: Sunny (IM)
2009-02-03 00:35:56 +00:00
marko
6aab391620 branches/zip: Make innodb_adaptive_hash_index settable.
btr_search_disabled: Rename to btr_search_enabled and change the type
to char, so that it can be directly linked to the MySQL parameters.
Note that the variable is protected by btr_search_latch and
btr_search_enabled_mutex, a new mutex introduced in this patch.

btr_search_enabled_mutex: A new mutex, to protect btr_search_enabled
together with btr_search_latch.

buf_pool_drop_hash_index(): New function, to be called from
btr_search_disable().

btr_search_disable(), btr_search_enable(): Fix bugs.  These functions
were previously unused.

btr_search_guess_on_hash(), btr_search_build_page_hash_index():
Check btr_search_enabled once more, while holding btr_search_latch.

btr_cur_search_to_nth_level(): Note that the reads of btr_search_enabled
may be dirty and explain why it should not be a problem.

innobase_adaptive_hash_index: Remove. The variable btr_search_enabled will be used directly instead.

innodb_adaptive_hash_index_update(): New function, an update callback for
innodb_adaptive_hash_index.  This will call either btr_search_disable()
or btr_search_enable() when the value is assigned.  The functions will
be called even if the value does not appear to be changed, e.g., when
setting from TRUE to TRUE or FALSE to FALSE.

rb://85 approved by Heikki Tuuri.  This addresses Issue #163.
2009-01-30 21:30:29 +00:00
marko
2300edb00f branches/zip: buf_LRU_invalidate_tablespace(): Fix a race condition:
read zip_size while still holding block_mutex.
2009-01-27 08:05:24 +00:00
marko
b707b2e3b1 branches/zip: In r988, the function buf_block_align() was enclosed
within UNIV_DEBUG. The two remaining callers in non-debug builds,
btr_search_guess_on_hash() and btr_search_validate(), were rewritten
to call buf_page_hash_get().

To implement support for a resizeable buffer pool, the function
buf_block_align() had been rewritten to perform a page hash lookup in
the buffer pool. The caller was also made responsible for holding the
buffer pool mutex.

Because the page hash lookup is expensive and it has to be done while
holding the buffer pool mutex, implement buf_block_align() by pointer
arithmetics again, and make btr_search_guess_on_hash() call it. Note
that this will have to be adjusted if the interface to the resizeable
buffer pool is actually implemented.

rb://83 approved by Heikki Tuuri, to address Issue #161.

As a deviation from the approved patch, this patch also makes
btr_search_validate() (invoked by CHECK TABLE) check that
buf_pool->page_hash is consistent with buf_block_align().
2009-01-26 20:33:20 +00:00
marko
0dfed5a8f3 branches/zip: buf_page_get_gen(): Fix a "possibly uninitialized" warning
that was introduced in r4030.
2009-01-26 14:16:39 +00:00
marko
5dceabc908 branches/zip: buf_page_get_gen(): Remove the unused mode BUF_GET_NOWAIT.
This was noticed while investigating Issue #160.
2009-01-23 13:31:36 +00:00
marko
bef98e3442 branches/zip: Remove some redundant #include statements. 2009-01-23 09:04:49 +00:00
marko
7d6578061a branches/zip: buf0lru.c: Improve debug assertions.
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.
2009-01-15 08:37:51 +00:00
marko
31e54f1d89 branches/zip: buf_LRU_invalidate_tablespace(), buf_LRU_free_block():
Add comments and assertions that buf_LRU_block_remove_hashed_page()
will release block_mutex when it returns BUF_BLOCK_ZIP_FREE.
2009-01-15 08:28:23 +00:00
marko
2f7bcc7d99 branches/zip: In hash table lookups, assert that the traversed items
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.
2009-01-13 19:46:22 +00:00
marko
7683ebd044 branches/zip: Fix some comments to say buf_pool_mutex. 2009-01-13 08:32:24 +00:00
marko
a2e50d04fd branches/zip: buf_flush_try_neighbors(): Fix a bug
that was introduced in r3879 (rb://73).
2009-01-13 07:30:26 +00:00
marko
67d12c88f4 branches/zip: buf_flush_page(): Fix a comment that should have been fixed
in r3879.  Spotted by Sunny.
2009-01-12 11:24:37 +00:00
marko
e490df51d5 branches/zip: Simplify the flushing of dirty pages from the buffer pool.
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.
2009-01-12 10:46:44 +00:00
marko
970a439000 branches/zip: Non-functional change: Tighten debug assertions and
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).
2009-01-09 21:15:12 +00:00
marko
40168c6a49 branches/zip: Add comments related to Issue #155.
buf_flush_try_page(): Note why it is safe to access bpage without
holding buf_pool_mutex or block_mutex.
2009-01-09 21:09:06 +00:00
marko
179e75c559 branches/zip: Some non-functional changes related to Issue #155.
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.
2009-01-09 20:27:40 +00:00