Commit graph

82 commits

Author SHA1 Message Date
marko
f8da258f4e branches/zip: Since r1057, page_zip_des_init() affects
buf_block_get_state().

buf_block_init(), buf_page_init_for_backup_restore(): Assign
block->page.zip.state after invoking page_zip_des_init(&block->page).
2006-11-24 13:02:31 +00:00
marko
53853ee573 branches/zip: Replace all references to block->space and block->offset,
which should have been replaced in r1057.
2006-11-24 12:49:59 +00:00
marko
9580b5f26f branches/zip: buf_read_ahead_random(): Stop searching upon exceeding the
threshold.
2006-11-24 08:39:53 +00:00
marko
8332c45ce4 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
c476d38e07 branches/zip: Remove buf_block_t:magic_n.
buf_block_state_valid(): New macro for replacing the magic_n check
2006-11-23 15:14:45 +00:00
marko
c5be47e7f6 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
6c8dfab1dc 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
95cd37e28e branches/zip: Rebuild buf_pool->page_hash after resizing the buffer pool.
buf_pool_page_hash_rebuild(): New function.
2006-11-21 15:38:18 +00:00
marko
97c15d9fe5 branches/zip: When shrinking the buffer pool, disable and purge the adaptive
hash index, because it might occupy the chunk we would like to free.

TODO: In btr_search_check_free_space_in_heap(), release the block if
btr_search_latch is not immediately available.

buf_pool_shrink(): Split from buf_pool_resize().

btr_search_disabled: New variable, similar to srv_use_adaptive_hash_indexes
that was removed earlier.

btr_search_disable(): New function: disable and purge the adaptive hash index.

btr_search_enable(): New function: enable the adaptive hash index.

ha_clear(): New function: Empty a hash table and free the memory heaps.
2006-11-21 14:40:14 +00:00
marko
add0bdeb07 branches/zip: buf_pool_resize(): When shrinking the buffer pool, do not
assume that non-file pages are free.  After trying to free or flush
file pages, do not proceed to buf_chunk_free(), because the calls will
temporarily release buf_pool->mutex.  Do not flush if there are non-free
blocks, because it would not achieve anything.
2006-11-16 11:23:20 +00:00
marko
03bdaaf509 branches/zip: Introduce a new preprocessor symbol, UNIV_BUF_DEBUG, and
enclose buf_validate() and friends in it.
2006-11-16 09:00:30 +00:00
marko
97b49ef91f branches/zip: Add #define UNIV_DEBUG_FILE_ACCESSES to univ.i and
enclose all related debug code in #ifdef UNIV_DEBUG_FILE_ACCESSES.
This should have no effect on the behaviour, as the symbol is
not defined by default.  It only reduces the size of buf_block_t
and removes some assignments and debug functions.
2006-11-16 08:48:28 +00:00
marko
e2c305f32b branches/zip: Improve the shrinking of the buffer pool.
buf_LRU_block_free_non_file_page(): Deallocate block->page_zip.data
to avoid ut_a(!block->page_zip.data) in buf_chunk_free().

buf_chunk_free(): Add the assertion ut_a(!block->in_LRU_list).

buf_pool_resize(): When shrinking the buffer pool and there are
non-free blocks in the candidate chunk, free the clean blocks
and move the dirty blocks to the end of the LRU list and request a flush.
Proceed if the chunk becomes free, and retry otherwise.
2006-11-15 21:49:14 +00:00
marko
274f2bc6a1 branches/zip: buf_LRU_free_block(): New function, split from
buf_LRU_search_and_free_block().
2006-11-15 21:41:27 +00:00
marko
2018ce35b3 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
1bb75bc187 branches/zip: buf_LRU_block_free_non_file_page(),
buf_LRU_block_remove_hashed_page(): Overwrite (space_id,page_no)
when freeing a buffer block.  This will help catching non-file
pages being passed to buf_block_align().
2006-11-13 09:55:31 +00:00
marko
19420d4621 branches/zip: Merge revisions 968:1009 from trunk. 2006-11-10 11:15:59 +00:00
marko
42bd3289a3 branches/zip: os_mem_alloc_large(), os_mem_free_large():
On POSIX, use mmap() and munmap().  On Windows, use VirtualAlloc()
and VirtualFree().  Only on Netware, use ut_malloc_low() and ut_free().
The lower-level functions on POSIX and Windows allow InnoDB to return
memory to the operating system when the buffer pool is shrunk.
2006-11-01 08:13:58 +00:00
marko
839ef125e1 branches/zip: Enclose some more debug code in #ifdef UNIV_SYNC_DEBUG
to allow the code to be built with UNIV_DEBUG but without UNIV_SYNC_DEBUG.
2006-10-31 16:51:16 +00:00
marko
fc2c6729b4 branches/zip: Remove buf_pool->frame_zero and buf_pool->high_end. 2006-10-31 09:59:15 +00:00
marko
d266262af6 branches/zip: Prepare for buffer pool allocation in several chunks.
buf_pool_t: Remove n_frames, max_size, and blocks_of_frames.
The current buffer pool size is in curr_size.

buf_pool_init(): Remove parameter max_size.

buf_pool_get_max_size(), buf_pool_is_block(): Remove.

buf_block_align(): Do not assume that the buffer pool is allocated
in one chunk.  Replace dependency on buf_pool->blocks_of_frames
with a call to buf_page_hash_get().
2006-10-30 15:15:19 +00:00
marko
89bacf3402 branches/zip: Remove support for AWE (Intel PAE on Win32).
Removal of the variable innobase_buffer_pool_awe_mem_mb requires
coordination with MySQL AB.
2006-10-30 13:48:08 +00:00
marko
5c2bb5e94b branches/zip: Minor cleanup.
btr_pcur_restore_position(): Add const qualifiers.

buf_LRU_block_remove_hashed_page(): Reduce the amount
of buf_page_hash_get() calls and add a UNIV_UNLIKELY hint
to an assertion-like test.
2006-10-30 09:19:41 +00:00
marko
bb6ea0c07b branches/zip: Clean up things found in an inlined build.
buf0lru.c: Always #include "srv0srv.h"

buf_block_get_lock_mutex(), buf_frame_get_lock_mutex(): Remove.

mtr0log.ic: Remove #include "page0page.h" and replace the page_
functions with lower-level ones to break an #include cycle.

dict0dict.ic: Remove unnecessary #include "trx0undo.h" and "trx0sys.h"
that would create an #include cycle.
2006-10-25 11:03:27 +00:00
marko
483a57089e branches/zip: buf_page_get_release_on_io(), buf_page_get_gen():
Replace buf_frame_t* guess with buf_block_t* guess in order to avoid
a buf_block_align() call.

trx_undo_t: Replace page_t* guess_page with buf_block_t* guess_block.

btr_search_t: Replace page_t* root_guess with buf_block_t* root_guess.
2006-10-23 19:34:45 +00:00
marko
22015f3949 branches/zip: Minor cleanup.
buf_calc_page_new_checksum(), buf_calc_page_old_checksum(),
buf_page_is_corrupted(), buf_page_print():
Add const qualifier to byte* parameter.

page_parse_create_zip(): Remove this declaration of non-existing function.

page_rec_check(), page_rec_print(), row_vers_impl_x_locked_off_kernel():
Add const qualifier to rec_t* parameter.

row_vers_old_has_index_entry(): Add const qualifier to dtuple_t* parameter.

row_sel_sec_rec_is_for_blob(): Add const qualifiers.

Replace some occurrences of mtr_memo_contains_page() with mtr_memo_contains().
2006-10-23 19:14:36 +00:00
marko
cdb096b609 branches/zip: Remove many fil_space_get_zip_size() calls.
ibuf_page(), ibuf_page_low(), ibuf_free_excess_pages(), ibuf_insert(),
buf_read_page(), buf_read_ahead_linear(), buf_read_recv_pages():
Add parameter zip_size.
2006-10-19 11:07:50 +00:00
marko
24d0bbf86c branches/zip: Remove some more buf_block_align() calls.
btr_search_build_page_hash_index(), fsp_parse_init_file_page(),
ibuf_parse_bitmap_init(): Replace page_t* with buf_block_t*.

buf_read_ibuf_merge_pages(): Add const qualifiers.  Retrieve zip_size.

ibuf_merge_or_delete_for_page(): Replace page_t* with buf_block_t*.
Add parameter zip_size.
2006-10-19 08:27:34 +00:00
marko
f8b304727e branches/zip: ha_create(): Remove parameter in_btr_search, which was
passed as TRUE.

Enclose hash_table_t::adaptive and buf_block_t::n_pointers in
#ifdef UNIV_DEBUG.

btr_search_drop_page_hash_index(): Enclose the corruption check
(which depends on buf_block_t::n_pointers) in #ifdef UNIV_DEBUG.
2006-10-18 18:52:04 +00:00
marko
67740324ca branches/zip: Allow compilation with UNIV_DEBUG without defining
the symbol UNIV_DEBUG_PRINT, which was introduced in r729.

buf_LRU_print(), buf_print(): Replace #ifdef UNIV_DEBUG_PRINT
with #if defined UNIV_DEBUG || defined UNIV_DEBUG_PRINT.
2006-10-17 12:13:15 +00:00
marko
f4051140c8 branches/zip: Remove more references to buf_block_align().
ibuf_reset_free_bits(): Remove, as there already is a similar function
ibuf_reset_free_bits_with_type().

ibuf_reset_free_bits_with_type(), ibuf_set_free_bits(),
ibuf_update_free_bits_if_full(), btr_leaf_page_release(),
buf_page_make_young(): Replace page_t with buf_block_t.

btr_compress(): Replace btr_page_get() with btr_block_get().
2006-10-13 07:45:52 +00:00
marko
5669dc3d2a branches/zip: Reduce the number of buf_block_align() calls.
btr_block_get(): New function to return buf_block_t.

btr_page_alloc(), buf_page_get_release_on_io(), buf_page_get_gen(),
buf_page_create(), fseg_create(), fseg_create_general(): Return buf_block_t.

buf_page_get_known_nowait(): Expect buf_block_t instead of buf_frame_t.

buf_frame_get_newest_modification(): Replace with
buf_block_get_newest_modification().

buf_page_dbg_add_level(): Replace with buf_block_dbg_add_level().

buf_block_get_zip_size(): New function.

buf_block_get_page_zip(): Reintroduce.

recv_recover_page(): Replace page, space, page_no with block.

ibuf_bitmap_page_init(): Replace page, zip_size with block.

ibuf_parse_bitmap_init(): Remove the parameter zip_size.

btr_search_drop_page_hash_index(): Replace page with block.
2006-10-12 11:05:22 +00:00
marko
736a8ffb01 branches/zip: Replace buf_frame_get_page_no() and buf_frame_get_space_id()
with page_get_page_no() and page_get_space_id().  We want to avoid
buf_block_align() calls, and the page_no and space_id are now stamped
on the pages early on.
2006-10-12 07:02:36 +00:00
marko
6241b552aa branches/zip: Stamp (space_id, page_no) on buffer pool pages early on.
buf_flush_init_for_writing(): Remove parameters space, page_no.

fsp_init_file_page_low(): Wriet space_id and page_no to the page.

fil_create_new_single_table_tablespace(): Write space_id to the page.
2006-10-10 12:26:37 +00:00
marko
d374183221 branches/zip: buf_block_get_page_zip(): Replace with buf_frame_get_page_zip(). 2006-10-09 15:37:19 +00:00
marko
679d6e8238 branches/zip: Remove compilation errors with -DUNIV_HOTBACKUP.
dict_load_foreigns(): Enclose in #ifndef UNIV_HOTBACKUP.

fil_extend_tablespaces_to_stored_len(): Pass zip_size to fil_read().

buf_page_init_for_backup_restore(): Add parameter zip_size.
Enclose the declaration in buf0buf.h in #ifdef UNIV_HOTBACKUP.

recv_apply_log_recs_for_backup(): Replace the local variable "page"
with the local variable "block".  Add local variable zip_size.
2006-10-06 11:23:19 +00:00
marko
71e8ea627c branches/zip: Replace FIL_PAGE_ZBLOB_SPACE_ID and FIL_PAGE_ZBLOB_DATA
with FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID and FIL_PAGE_DATA.  The doublewrite
buffer needs to read the space_id in order to determine the type of the page.
Because FIL_PAGE_TYPE could contain garbage in MySQL/InnoDB 5.0 and earlier
versions, we cannot trust fil_page_get_type().  Instead, we have to always
store the space_id at the same location.  This modification wastes 12 bytes
per compressed BLOB page (1.2% on 1-kilobyte pages).
2006-09-27 10:51:05 +00:00
marko
ff0acd76af branches/zip: Instrument the buffer pool allocator and deallocator
for more accurate Valgrind debugging.

univ.i: Introduce UNIV_DEBUG_VALGRIND, UNIV_MEM_VALID, and UNIV_MEM_INVALID.

buf_LRU_block_free_non_file_page(): Invalidate the buffer frame
with UNIV_MEM_INVALID().

buf_LRU_get_free_block(): Declare the buffer frame valid
with UNIV_MEM_VALID().

Other memory is allocated and deallocated via malloc() and free(),
which are already overridden by Valgrind.  Without the added
instrumentation, accesses to free pages in the buffer pool cannot
be caught.

The diagnostics could probably be improved further by declaring all
non-latched buffer frames invalid.
2006-09-20 12:42:08 +00:00
marko
68a65c142c branches/zip: Merge revisions 804:838 from trunk. 2006-09-19 10:14:07 +00:00
marko
38e09b2fea branches/zip: Merge revisions 720:765 from trunk and reindent the code
as per revisions r763:765.
2006-08-29 09:30:31 +00:00
marko
4858179f05 branches/zip: btr_cur_pessimistic_insert(): Prior to splitting, ensure that
the record will fit on an empty compressed page.

buf_block_alloc(), buf_block_free(), buf_frame_alloc(), buf_frame_free():
Make inlined.
2006-08-17 11:57:51 +00:00
marko
79c2ea8582 branches/zip: buf_LRU_print(): Terminate every displayed entry with a newline. 2006-08-15 14:27:19 +00:00
marko
96826e51c0 branches/zip: Introduce the symbol UNIV_DEBUG_PRINT for enabling debug
print functions.

buf_LRU_print(), buf_print(): Replace #ifdef UNIV_DEBUG
with #ifdef UNIV_DEBUG_PRINT.
2006-08-15 11:54:20 +00:00
marko
f4f5606fb6 branches/zip: Merge revisions 634:713 from trunk. 2006-08-11 11:49:38 +00:00
marko
e148206ae2 branches/zip: Improve diagnostics.
buf_LRU_get_free_block(): When zip_size changes, initialize all fields
of page_zip.  This avoids an assertion failure in page_create_zip() when
a block with an originally larger zip_size is reallocated.

fsp_get_space_header(): Assert that the stored space id matches.

xdes_get_state(): Assert that the state is valid.
2006-08-09 08:55:00 +00:00
marko
b355bd0fbc branches/zip: Fix some crash recovery bugs.
dict_load_table(): Initialize table->flags with zip_size.

mlog_parse_nbytes(), mlog_parse_string(): Add parameter page_zip and
write the changes also to the compressed page if one is specified.
Assert that these functions are not called on FIL_PAGE_INDEX pages.

buf_page_io_complete(): Replace block->frame with frame where appropriate.

recv_parse_or_apply_log_rec_body(): Add ut_a(!page_zip) where appropriate.

page_parse_delete_rec_list(): Add parameter page_zip.
2006-08-02 05:49:15 +00:00
marko
fbce3ef82e branches/zip: buf_flush_init_for_writing(): Invoke page_zip_calc_checksum()
on page_zip->data, so that the freshly written fields will be included.

page_cur_delete_rec(): Add a page_zip_validate() assertion to the end.
2006-08-01 12:05:04 +00:00
marko
a9792eeb08 branches/zip: Bug fixes.
buf_page_io_complete(): On FIL_PAGE_TYPE_ZBLOB (compressed BLOB pages),
read the space_id from a different location.

page_zip_compress(), page_zip_write_rec(), page_zip_write_blob_ptr():
Replace page_simple_validate_new() with page_validate().

page_zip_clear_rec(): When running out of log space, do not attempt to
recompress the page, because the directory slots might be unbalanced and
the page_validate() assertion in page_zip_compress() would fail.
Instead, clear the BLOB pointers of the deleted record on the
uncompressed page, so that page_zip_validate() will succeed.

page_zip_validate(): Remove the comment about page_zip_clear_rec().
A mismatch always indicates a serious inconsistency.
2006-08-01 07:58:38 +00:00
marko
6e2fa8bc85 branches/zip: Stamp some header fields to compressed BLOB pages.
buf_flush_init_for_writing(): On FIL_PAGE_TYPE_ZBLOB, write to
page_zip->data instead of page.

page_zip_write_rec(), page_zip_write_blob_ptr(), page_zip_write_node_ptr():
Add ut_ad(page_simple_validate_new()).
2006-07-31 18:27:17 +00:00
marko
0c0e7b92d8 branches/zip: buf_page_io_complete(): Copy also uninitialized pages to
uncompressed storage, to avoid bogus warnings about page number mismatch.
2006-06-21 12:38:42 +00:00