Commit graph

72 commits

Author SHA1 Message Date
marko
3bb405841f branches/zip: Implement wrappers for all operations on the buffer pool mutex.
buf_pool->mutex: Rename to buf_pool_mutex, so that the wrappers will have
to be used when changes are merged from other source trees.

buf_pool->zip_mutex: Rename to buf_pool_zip_mutex.

buf_pool_mutex_own(), buf_pool_mutex_enter(), buf_pool_mutex_exit():
Wrappers for buf_pool_mutex.
2008-01-10 09:37:13 +00:00
marko
247d1449d1 branches/zip: Minor cleanup.
buf_page_get_release_on_io(): Removed this unused function.

ibuf_build_entry_from_ibuf_rec(): Justify why it is not necessary to
add system columns to the dummy table pointed to by the dummy secondary index.

page_zip_rec_set_deleted(): Add a page_zip_validate() assertion.
2007-11-28 11:22:25 +00:00
marko
3fce4dc28a branches/zip: buf_page_hash_get(): Fix a debug assertion that was
accidentally negated in r2043.
2007-11-05 10:17:38 +00:00
marko
a2d23f497c branches/zip: buf_block_align(): Add missing type conversion. 2007-10-31 12:23:03 +00:00
marko
7319444c08 branches/zip: Improve Valgrind instrumentation.
buf_LRU_free_block(): Check that the block descriptor contains valid data.

buf_buddy_relocate(): Check that the source block contains valid data.

buf_page_get_gen(): Do not dereference bpage after calling buf_relocate().
This avoids a bogus Valgrind warning; the memory itself was valid.

buf_page_hash_get(): Check that the returned block descriptor contains
valid data.
2007-10-30 09:27:09 +00:00
marko
d967aaa65b branches/zip: Remove const warnings reported by GCC 4.2.1.
page_cur_set_before_first(), page_cur_set_after_last(),
page_cur_position(): Add const qualifiers to buf_block_t and rec.
A better solution would be to define a const_page_cur_t and a
set of accessors, but it would lead to severe code duplication.

page_rec_get_n_recs_before(): Add const qualifiers.

page_dir_get_nth_slot(): Define as a const-preserving macro.

page_dir_slot_get_rec(), page_dir_slot_get_n_owned(),
page_dir_find_owner_slot(), page_check_dir(): Add const qualifiers.

page_rec_get_next_low(): Add const qualifiers.

page_rec_get_next_const(), page_rec_get_prev_const(): New functions,
based on the const-less page_rec_get_next() and page_rec_get_prev().

page_cur_get_page(), page_cur_get_block(), page_cur_get_page_zip(),
page_cur_get_rec(): Define as const-preserving macros.

page_cur_try_search_shortcut(), page_cur_search_with_match():
Add const qualifiers.

buf_page_get_mutex(): Add a const qualifier to buf_page_t*.

rec_get_next_ptr_const(): Const variant of rec_get_next_ptr().
2007-10-18 07:12:05 +00:00
vasil
abceb43b98 branches/zip:
Non-functional change: fix compiler warning:

buf0buf.ic:637: warning: assignment discards qualifiers from pointer target type
2007-10-11 11:54:51 +00:00
marko
6557ba5342 branches/zip: Silence most GCC 4.2.1 warnings about const pointers.
For some reason, GCC 4.2.1 ignores casts (for removing constness)
in calls to inline functions.

page_align(), ut_align_down(): Make the parameter const void*, but still
return a non-const pointer.  This is ugly, but these functions cannot be
replaced with a const-preserving macro in a portable way, given that
the pointer argument is not always pointing to bytes.

buf_block_get_page_zip(): Implement as a const-preserving macro.

buf_frame_get_page_zip(), buf_block_align(): Add const qualifiers.

lock_rec_get_prev(): Silence GCC 4.2.1 warnings.

mlog_write_initial_log_record(), mlog_write_initial_log_record_fast(),
mtr_memo_contains(): Add const qualifier to the pointer.

page_header_get_ptr(): Rewrite as page_header_get_offs(), and
implement as a macro that calls this function.
2007-10-03 12:22:29 +00:00
marko
3d57033064 branches/zip: Optimize buf_page_try_get_func().
buf_block_hash_get(): New function, similar to buf_page_hash_get().

buf_page_get_block(): Remove the const qualifiers.  This is a low-level
function, and the operations on block->mutex are non-const.

buf_page_try_get_func(): Implement with lower-level predicates, somewhat
similar to buf_page_get_known_nowait().

lock_rec_print(): Remove the unused variable zip_size and the
call to fil_space_get_zip_size().  Adapt to buf_page_try_get() returning
a const pointer.
2007-10-01 07:32:45 +00:00
marko
1110b563b2 branches/zip: Introduce the function buf_block_fix_dec(), similar to
buf_block_fix_inc(), and use it.
2007-10-01 07:25:02 +00:00
marko
20d7ea9851 branches/zip: Add the function buf_page_get_block(), for converting
from buf_page_t* to buf_block_t*.

buf_page_can_relocate(): Replace the incorrect __attribute__((const))
with __attribute__((pure)).
2007-09-28 12:04:04 +00:00
marko
44f9d06969 branches/zip: Define buf_block_get_frame() as a const-preserving macro. 2007-09-28 06:26:21 +00:00
inaam
ae1bf9e3e9 branches/zip: undo changes made in r1763.
These should have gone in branches/fts

Spotted by: Marko and Ken
2007-09-11 00:38:13 +00:00
inaam
8d96873f9d branches/zip: The freed_page_clock for both buf_pool and block starts ticking
only after the buffer_cache has warmed up. During the initial warmup
phase these values are set to zero. We should recommend to move the
block to the start of the LRU in this case.

Also added some comments to buf0buf.c about the LRU logic.

reviewed by: Sunny
2007-08-27 19:41:56 +00:00
marko
d662c3c656 branches/zip: Merge 1575:1664 from trunk. 2007-08-01 11:18:43 +00:00
marko
0106316096 branches/zip: Add explicit type casts to *.ic, because C++ does not allow
implicit type conversion from void*.  Inlining is enabled in ha_innodb.cc
since r1587.
2007-08-01 10:38:07 +00:00
marko
54113d6d9f branches/zip: HASH_SEARCH(): Add the parameter TYPE, for the type of DATA.
C++ requires explicit type casts when converting from void*, and *.ic files
are now inlined in ha_innodb.cc.

fil_space_get_by_id(), fil_space_get_by_name(): New inline functions, to
replace occurrences of the HASH_SEARCH() macro in fil0fil.c.  This should
improve readability.
2007-08-01 08:13:22 +00:00
marko
87e42d059a branches/zip: buf_page_io_query(): Shorten the code by using a local variable. 2007-05-06 12:30:10 +00:00
marko
3b5c872916 branches/zip: buf_page_t: Add the in_page_hash and in_zip_hash
for extra validation in UNIV_DEBUG builds.
2007-01-24 10:36:05 +00:00
marko
88efbdb335 branches/zip: When retrieving compressed BLOBs, avoid allocating
uncompressed page frames.

buf_page_get_zip(), buf_page_release_zip(): New functions, used
by btr_copy_zblob_prefix().

btr_copy_zblob_prefix(): Do not call inflateEnd().
2007-01-18 23:10:49 +00:00
marko
d8536b0de8 branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. 2007-01-18 18:29:12 +00:00
marko
fff329cd3d branches/zip: Remove the fil_space_get_zip_size() call from
buf_page_get_gen().  This saves one mutex operation per block request.

buf_page_get_gen(), various macros and functions: Add parameter zip_size.

btr_node_ptr_get_child(): Add parameter index.

fil_space_get_latch(): Add optional output parameter zip_size.

fil_space_get_zip_size(): Return 0 for space id==0, because the
system tablespace is never compressed.

fsp_header_init(): Remove the parameter zip_size.

ibuf_free_excess_pages(): Remove the parameter zip_size.

trx_rseg_t, trx_undo_t: Add field zip_size.

xdes_lst_get_next(): Remove, unused.
2007-01-18 09:59:00 +00:00
marko
8af159117e branches/zip: buf_page_t: Introduce the field in_flush_list #ifdef UNIV_DEBUG.
buf_flush_batch(): Remove the local variable "found".
2007-01-09 12:35:42 +00:00
marko
62391d4280 branches/zip: buf_page_peek(): Return TRUE also if the page exists in the
buffer pool in compressed form only.

buf_page_peek_block(): Remove.

mutex_enter_fast_func: Remove.
2007-01-05 11:19:56 +00:00
marko
14b99876d0 branches/zip: Allow dirty blocks to be relocated. Allow a transition
to BUF_BLOCK_ZIP_DIRTY (discarding the uncompressed page corresponding
to a modified compressed page that has not been flushed to disk).

buf_page_can_relocate(): New function, modelled after
buf_flush_ready_for_replace().

buf_LRU_free_block(): Allow the transition to BUF_BLOCK_ZIP_DIRTY.

buf_flush_insert_into_flush_list(): Make the prototype public.

buf_buddy_relocate(): Remove an unnecessary switch statement.
Use buf_page_can_relocate() instead of buf_flush_ready_for_replace().

buf_page_peek(): Made UNIV_INLINE.

Document UNIV_ZIP_DEBUG.
2007-01-04 21:40:10 +00:00
marko
b6711d691e branches/zip: Minor improvements.
buf_flush_remove(): New function, for removing a block from the flush list.
Sliced from buf_flush_write_complete().

buf_page_set_state(): Allow transitions between BUF_BLOCK_ZIP_PAGE
and BUF_BLOCK_ZIP_DIRTY.
2006-12-15 14:47:04 +00:00
marko
2208d25976 branches/zip: Make use of the previously unused state BUF_BLOCK_MEMORY.
buf_LRU_get_free_block(): Document that the block is in the state
BUF_BLOCK_READY_FOR_USE.

buf_block_alloc(): Change the state of the block to BUF_BLOCK_MEMORY
and document it.

Replace those invocations of buf_block_alloc() with
buf_LRU_get_free_block() where the allocated block is used for buffer
pool input and output.  However, temporary copies of B-tree pages
during reorganization are not used for file I/O, and such blocks are
still allocated with buf_block_alloc().
2006-12-13 14:58:54 +00:00
marko
e8babaee1b branches/zip: Add the first bits of the binary buddy system for allocating
compressed pages from the buffer pool.

Makefile.am: Add buf0buddy.h, buf0buddy.ic.

buf/Makefile.am: Add buf0buddy.c.

Introduce the constants BUF_BUDDY_LOW and BUF_BUDDY_SIZES.

buf_pool_t: Add zip_mutex and the lists zip_clean and zip_free[].

buf_page_get_mutex(): Return &buf_pool->zip_mutex instead of NULL.

buf_buddy_get_offset(), buf_buddy_get(), buf_buddy_get_slot(),
buf_buddy_alloc_free(), buf_buddy_alloc_free_low(): New functions.
2006-12-07 13:29:04 +00:00
marko
db53c1eb92 branches/zip: enum buf_page_state: Add BUF_BLOCK_ZIP_FREE, BUF_BLOCK_ZIP_DIRTY. 2006-12-05 12:10:30 +00:00
marko
1cd9bbd727 branches/zip: buf_page_get_io_fix(): Remove UNIV_SYNC_DEBUG assertions,
as the field will be read without mutex protection in buf_page_io_complete().
2006-12-04 12:38:27 +00:00
marko
6a7be34b6b branches/zip: Allow some functions to work on compressed-only pages
(state == BUF_BLOCK_ZIP_PAGE).  Make use of buf_page_in_file()
and buf_page_get_mutex().

buf_block_get_newest_modification(): Rename to
buf_page_get_newest_modification().
2006-11-30 15:09:33 +00:00
marko
881fd8c6a5 branches/zip: buf_page_t: Move "old" to the same machine word with
LRU_position and possibly freed_page_clock.  All these fields are
protected by buf_pool->mutex rather than buf_page_get_mutex().

buf_page_set_accessed(): Add a mutex_own() assertion.
2006-11-30 13:27:34 +00:00
marko
ac694c106a branches/zip: Move the fields related to the least-recently-used algorithm
of the buffer pool from buf_block_t to buf_page_t.  Replace some buf_block_t*
parameters with buf_page_t*.  Add accessor functions.
2006-11-30 12:27:49 +00:00
marko
cf7b6e9153 branches/zip: Move all fields that are not needed in compression or
decompression from page_zip_des_t to buf_page_t, because the fields
needed in compression are modified without holding the block mutex.
All writes to bit-fields sharing a machine word must be protected
by the same mutex or rw-lock.
2006-11-30 10:33:35 +00:00
marko
61a48f1e14 branches/zip: Make buf_block_buf_fix_inc() a macro wrapper for
buf_block_buf_fix_inc_func() to eliminate an #ifdef in every invocation.
2006-11-30 09:24:57 +00:00
marko
5e9d893508 branches/zip: Replace ib_ulonglong with ib_uint64_t, since we want exactly
64 bits.  "long long" might be longer than 64 bits on some systems.
2006-11-29 14:52:16 +00:00
marko
3fe8f14c20 branches/zip: Make buf_pool->page_hash point to buf_page_t instead of
buf_block_t.  Move the fields "hash" and "file_page_was_freed" from
buf_block_t to buf_page_t.

buf_page_in_file(): New function, for checking block state in assertions.
2006-11-29 13:23:28 +00:00
marko
7d1227c32b branches/zip: Allow the code to compile with debugging enabled. This
was broken in r1066.
2006-11-28 11:08:33 +00:00
marko
b239ac283b branches/zip: Move the page flushing fields from buf_block_t to
buf_page_t and page_zip_des_t.
2006-11-27 14:12:09 +00:00
marko
82dfd0f6c7 branches/zip: page_zip_des_t: Rename "size" to "ssize" and reduce the
storage size from 16 to 3 bits.

page_zip_get_size(), page_zip_set_size(): New functions.

Replace direct references to page_zip_des_t:size with calls to
buf_block_get_zip_size(), page_zip_get_size(), and page_zip_set_size().
2006-11-27 13:44:32 +00:00
marko
109570b94a branches/zip: Introduce the unsigned 64-bit data type ib_ulonglong
for log sequence numbers, to replace dulint.
2006-11-24 13:05:01 +00:00
marko
dccaa03753 branches/zip: Introduce buf_page_t, a common structure for compressed-only
and uncompressed buffer pool pages.

buf_block_t: Replace page_zip, space, and offset with buf_page_t page.
Replace some integers with bit-fields.

enum buf_block_state: Rename to buf_page_state.  Add BUF_BLOCK_ZIP_PAGE.

page_zip_des_t: Add the field "state".  Make the integer fields bit-fields.

page_zip_copy(): Document which fields are copied.
2006-11-24 08:32:18 +00:00
marko
383b7da81c branches/zip: buf_block_set_state(): Allow the state transition from
BUF_BLOCK_READY_FOR_USE to BUF_BLOCK_NOT_USED.
2006-11-23 15:12:53 +00:00
marko
df5ea1215c branches/zip: Remove bogus debug assertions.
buf_block_get_space(), buf_block_get_page_no():
Remove ut_ad(block->buf_fix_count > 0), because since r1052
these functions are also used in low-level code.
2006-11-23 15:10:51 +00:00
marko
0cd924d44f branches/zip: Remove most direct references to block->state.
buf_block_set_state(): New function.  Also checks the state transitions.

buf_block_set_file_page(): New function.
2006-11-23 14:12:58 +00:00
marko
816089073b branches/zip: Replace most references to block->state, block->offset,
and block->space with buf_block_get_state(block), buf_block_get_page_no(block),
and buf_block_get_space(block).

enum buf_block_state: Replaces the #define'd buf_block_t.state values.

buf_block_get_state(): New function.

buf_block_get_frame(): Add __attribute__((const)).
2006-11-23 13:26:01 +00:00
marko
819a91b23b branches/zip: Fix errors when compiling with UNIV_DEBUG and UNIV_SYNC_DEBUG.
buf0buf.ic: Remove the extern declaration of buf_dbg_counter.
It was declared static in buf0buf.c in r1025.

ha0ha.c: #include "btr0sea.h" #ifdef UNIV_SYNC_DEBUG.  Assertions on
btr_search_latch were added in r1041.
2006-11-22 13:08:38 +00:00
marko
879b1fd73d branches/zip: Implement resizeable buffer pool.
mysql.patch: Patch to change or add variables to MySQL

innodb.patch: Patch to make the master thread poll requests to resize
the buffer pool.

Replace srv_pool_size and innobase_buffer_pool_size
with srv_buf_pool_size, srv_buf_pool_old_size,
and srv_buf_pool_curr_size.

Add buf_chunk_t, a collection of buf_block_t.
2006-11-14 14:27:26 +00:00
marko
4574bdda81 branches/zip: Merge revisions 968:1009 from trunk. 2006-11-10 11:15:59 +00:00
marko
fc86d41650 branches/zip: buf_block_align(): Remove from non-debug builds.
btr_search_guess_on_hash(), btr_search_validate(): Instead of
buf_block_align(), call buf_page_hash_get(), and allow it to return NULL.
2006-11-02 09:06:49 +00:00