Commit graph

52 commits

Author SHA1 Message Date
marko
a0c093d93d branches/zip: buf_LRU_invalidate_tablespace(): After freeing a
compressed-only page, restart the scan of the LRU list, because
prev_bpage may have been relocated.

buf_LRU_block_remove_hashed_page(): Note that other compressed pages
or compressed-only blocks may be relocated when freeing a compressed
page or a compressed-only block descriptor.
2007-01-09 15:52:08 +00:00
marko
69afb619cc branches/zip: buf_LRU_free_block(): Correct the logic for releasing
dirty uncompressed blocks.  Move the page_zip_validate() call to
a more appropriate place, buf_LRU_block_remove_hashed_page().

buf_LRU_block_remove_hashed_page(): Allow bpage->oldest_modification != 0
for uncompressed pages if there is a compressed page that will be preserved.
Release the mutexes before calling buf_print() and buf_LRU_print().

page_zip_validate(): Remove the assertion containing the
buf_frame_get_page_zip() call.  We might already be holding buf_pool->mutex.
2007-01-09 12:47:15 +00:00
marko
f54da50c1e branches/zip: buf_buddy_alloc_clean(): Restart the scan after a
successful buf_LRU_free_block().

buf_LRU_free_block(): Note that buf_pool->mutex may be temporarily released.
2007-01-09 12:39:50 +00:00
marko
d3917bb5c3 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
5a094438a5 branches/zip: Maintain a valid checksum for compressed-only pages kept in
the buffer pool.

buf_LRU_free_block(): When preserving the compressed page, compute the
checksum.  Also assert page_zip_validate().

buf_zip_decompress(): Add parameter "check" for enabling checksum tests.
Before decompressing a compressed-only page from the buffer pool, verify
the compressed page checksum.
2007-01-08 17:08:57 +00:00
marko
186549b911 branches/zip: buf_LRU_free_block(): Check if the block has been reloaded
to the buffer pool while we were not holding buf_pool->mutex.  If it was,
do not attempt to preserve the compressed page.
2007-01-08 14:58:20 +00:00
marko
91c87cd343 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
ede8e7bcd0 branches/zip: Fix two bugs in the relocation of block descriptors.
Improve diagnostics.

buf_buddy_relocate(): Do not assume all small blocks to contain only one
buf_page_t object.  Require an exact size match, as in the case of
compressed pages.

buf_relocate(): Relocate buf_pool->LRU_old if needed.
Validate the LRU list in debug builds.

buf_LRU_block_remove_hashed_page(): Do not overwrite FIL_PAGE_OFFSET
or FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID.  The memory will be invalidated
in debug builds of buf_buddy_free().

buf0buddy.c: Add assertions for not holding buf_pool->zip_mutex.
The calling thread should not be holding any block->mutex, but it might
be too time-consuming to assert against that, even #ifdef UNIV_SYNC_DEBUG.
2007-01-04 15:45:42 +00:00
marko
bb9217faa6 branches/zip: Before calling buf_buddy_alloc() or buf_buddy_free(),
release any block mutexes but hold the buf_pool->mutex.
2007-01-03 15:54:05 +00:00
marko
f890ec156c branches/zip: Use the buddy allocator for managing compressed pages.
There is something wrong with the management of compressed-only blocks
(BUF_BLOCK_ZIP_PAGE).  To disable the creation of such blocks, set zip=TRUE
in buf_LRU_block_remove_hashed_page().

buf_LRU_block_remove_hashed_page(): Release buf_pool->zip_mutex when
freeing a compressed-only page and its control block, with buf_buddy_free().
Adapt callers.

buf_LRU_block_free_hashed_page(): Change the parameter type from buf_page_t*
to buf_block_t*.

buf_LRU_free_block(): Move below the definition of buf_LRU_add_block_low().
Allocate block descriptor for compressed-only blocks.

buf_LRU_block_free_non_file_page(): Replace ut_free() with buf_buddy_free().

buf_zip_decompress(): New function, split from buf_page_io_complete().

buf_page_init_for_read(): Do not allocate the compressed page until it is
really needed, to avoid the overhead of the buddy allocator.  Decompress
compressed-only blocks that are needed again.

buf_page_create(): Do not allocate the compressed page until it is
really needed, to avoid the overhead of the buddy allocator.

buf_validate(): Replace some equality tests on the lengths of the LRU
list and the flush lists with greater-or-equal tests, since the counted
numbers do not include control blocks for compressed-only pages.
2007-01-03 13:10:46 +00:00
marko
492cd8ce19 branches/zip: Minor improvements.
buf_LRU_block_remove_hashed_page(): Return the new state of the block.

Only call buf_LRU_block_free_hashed_page()
if buf_LRU_block_remove_hashed_page() did not return BUF_BLOCK_ZIP_FREE,
that is, the control block was not freed.

buf_LRU_insert_zip_clean(): New function, for inserting a compressed-only
block into buf_pool->zip_clean in the LRU order.

buf_LRU_block_remove_hashed_page(), buf_LRU_free_block():
Add the flag "zip" for controlling if the compressed page of an uncompressed
page should be removed.  For now, assume zip==TRUE.

buf_LRU_get_free_block(): Replace the test for UT_LIST_GET_LEN(buf_pool->free)
with a test for the return value of buf_LRU_get_free_only().  Do not
free zip.data, as it must already have been freed.

buf_flush_insert_into_flush_list(), buf_flush_insert_sorted_into_flush_list():
Remove compressed-only blocks from the buf_pool->zip_clean list.

buf_flush_remove(): Restore compressed-only blocks to
the buf_pool->zip_clean list.

buf_page_init_for_read(): Uncompress compressed-only blocks when possible.
Currently, there cannot be any compressed-only blocks in the buffer pool;
they would be inserted by buf_LRU_free_block(bpage, zip=FALSE).
2006-12-15 15:05:18 +00:00
marko
0fb620f58d 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
cb530ba3e7 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
f9a10f4cef branches/zip: Implement the whole allocation algorithm of compressed pages.
buf_LRU_free_block(): Free compressed-only pages and their
descriptors with buf_buddy_free().

buf_LRU_get_free_only(): New function for returning a block from
buf_pool->free if one is available.  Split from buf_LRU_get_free_block().

buf_buddy_alloc_zip(): Rename from buf_buddy_alloc_low() and make static.
Remove parameter "split".  Always try to split.

buf_buddy_free_block(): Rename to buf_buddy_block_free().

buf_buddy_block_register(): New function for registering buf_block_t
objects reserved by the allocator.

buf_buddy_alloc_from(): New function for allocating an object from a
bigger object, and putting the unused parts on the free list.

buf_buddy_alloc_clean_zip(): New function for allocating memory by
replacing an unmodified compressed page.

buf_buddy_alloc_low(): New function for allocating memory, either from
the free lists of compressed pages, from the global free list, or from
unmodified pages in the buffer pool.
2006-12-11 14:27:43 +00:00
marko
a9e16776e3 branches/zip: buf_page_t: Rename free_or_flush_list to list
and document the possible list memberships.
2006-12-05 12:31:38 +00:00
marko
0b88392a78 branches/zip: buf_LRU_free_block(): Note that
buf_LRU_block_remove_hashed_page() changes the state of the block.
This error was introduced in r1090.
2006-12-04 13:12:07 +00:00
marko
2696aa6d60 branches/zip: Remove buf_block_t:free_list. Rename buf_page_t:flush_list
to free_or_flush_list.  The list node pointers can be shared, because a
block can never be belong to both lists at the same time.
2006-12-04 12:44:06 +00:00
marko
7b32620f7d branches/zip: page_zip_des_t: Enclose m_start in #ifdef UNIV_DEBUG.
Add m_nonempty for facilitating the test in page_zip_alloc().  This
reduces the combined size of the bit-fields to 32 bits.  Thus,
sizeof(page_zip_des_t) == 2 machine words on 32-bit and wider systems.
2006-11-30 14:09:29 +00:00
marko
aedce8cde3 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
519ba6f47c 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
8e77f38e21 branches/zip: Make buf_block_t:old a bit-field. Document the mutex protection
of the fields "freed_page_clock" and "old".
2006-11-28 10:02:03 +00:00
marko
620df99df0 branches/zip: Enclose buf_block_t:in_LRU_list in #ifdef UNIV_DEBUG 2006-11-28 09:37:02 +00:00
marko
b03460d90d 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
0d7111c9cd 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
7593a465db 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
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
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
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
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
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
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
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
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
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
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
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
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
1dd4d56863 branches/zip: Write compressed pages to disk.
os_aio_simulated_handle(): Temporarily disable os_file_check_page_trailers(),
which cannot be invoked on compressed pages.

dict_table_add_system_columns(): New function, split from
dict_table_add_to_cache().

mlog_parse_index(): Add system columns to the dummy table and identify
DB_TRX_ID and DB_ROLL_PTR in the dummy index.

buf_LRU_get_free_block(): Note that page_zip->data should be allocated from
an aligned memory pool.

buf_flush_buffered_writes(): Write compressed pages to disk.

buf_flush_post_to_doublewrite_buf(): Copy compressed pages to the
doublewrite buffer.  Zero fill any excess space.

buf_flush_init_for_writing(): Treat all compressed pages the same.

buf_read_page_low(): Read compressed pages from disk.

buf_page_io_complete(): Process compressed pages.

trx_sys_doublewrite_init_or_restore_page(): Process compressed pages.

mlog_write_initial_log_record_fast(): Enable a debug printout
#ifdef UNIV_LOG_DEBUG.

fsp_header_init(), fsp_fill_free_list(): Pass the compressed page size
to buf_page_create().

page_zip_compress_write_log(): Flatten the if-else if-else logic.

page_zip_parse_write_blob_ptr(): Do not test page_zip if page==NULL.

page_zip_parse_write_node_ptr(): Do not test page_zip if page==NULL.
Invoke mlog_close() correctly.

row_sel_store_row_id_to_prebuilt(): Add UNIV_UNLIKELY hint to an
assertion-like test.
2006-05-30 09:04:57 +00:00
marko
a9ee619a9b branches/zip: Minor improvements.
Introduce FIL_PAGE_ZBLOB_DATA as a synonym for FIL_PAGE_FILE_FLUSH_LSN.

btr_store_big_rec_extern_fields(): Make the assertion about
dict_table_zip_size() more accurate.

buf_LRU_get_free_block(), buf_block_alloc(): Add parameter zip_size.

buf_calc_zblob_page_checksum(): Remove. Replace with page_zip_calc_checksum().

buf_page_init(): Remove parameter zip_size.

buf_page_io_complete(): Add a placeholder for handling compressed pages.

trx_doublewrite_page_inside(): Remove redundant function.

page_zip_write_rec(): Relax an overly tight assertion about blob_no.
2006-05-04 11:44:49 +00:00
marko
0c4dfda3be branches/zip: Merge revisions 265:459 from trunk. 2006-04-12 09:32:17 +00:00