Commit graph

472 commits

Author SHA1 Message Date
marko
5fc003b65d branches/zip: Make mutex_own() work with UNIV_DEBUG, without UNIV_SYNC_DEBUG. 2007-01-18 18:29:12 +00:00
marko
ca662b43e6 branches/zip: buf_LRU_free_block(): Allocate a control block for the
compressed page also when freeing an unmodified uncompressed page.
2007-01-18 15:43:59 +00:00
marko
ffc0bc3eaf branches/zip: Free buffer blocks that are no longer needed for BLOB storage.
btr_blob_free(): New function to commit a mini-transaction and to free
an uncompressed BLOB block, or the entire block.

btr_store_big_rec_extern_fields(): Replace the existing code with
btr_blob_free().  The old code may have contained a race condition.

btr_free_externally_stored_field(): Completely free the buffer blocks
allocated for the freed BLOB.
2007-01-18 14:02:56 +00:00
marko
8f65d7a661 branches/zip: Merge revisions 1165:1206 from trunk. 2007-01-18 12:58:39 +00:00
marko
f116afa724 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
fd687bbedd branches/zip: btr_cur_pessimistic_delete(): Correct a comment. 2007-01-18 08:35:57 +00:00
marko
ccbb93c016 branches/zip: btr_copy_externally_stored_field_prefix_low():
Split the code to subroutines.

btr_copy_blob_prefix(): New function: copy the prefix of the externally
stored part of an uncompressed BLOB.

btr_copy_zblob_prefix(): New function: copy the prefix of the externally
stored part of a compressed BLOB.

btr_blob_get_part_len(), btr_blob_get_next_page_no(): Add const qualifier
to the parameter.
2007-01-17 09:07:20 +00:00
marko
d3d728955b branches/zip: buf_flush_write_block_low(): When flushing a compressed page
that also exists in uncompressed form in the buffer pool, pass the
compressed frame to fil_io() instead of the uncompressed one when
not using the doublewrite buffer.
2007-01-16 22:19:29 +00:00
marko
e77a82a054 branches/zip: buf_flush_write_block_low(): Avoid recomputing the compressed
page checksum of compressed-only blocks.  Pass the compressed page frame
to fil_io() when needed.

page_zip_calc_checksum(): Skip also FIL_PAGE_LSN and FIL_PAGE_FILE_FLUSH_LSN.

buf_flush_init_for_writing(): Expect page to be non-NULL.
2007-01-16 21:51:40 +00:00
marko
a85fd29415 branches/zip: Allow dirty compressed-only blocks to exist in the buffer pool
and to be flushed to disk.

buf_LRU_free_block(): Enable the freeing of uncompressed pages of
compressed tablespaces.

trx_doublewrite->buf_block_arr[]: Change the type from buf_block_t*
to buf_page_t*.

buf_flush_ready_for_flush(): Add debug assertion.

buf_flush_buffered_writes(), buf_flush_try_page(): Support blocks of type
BUF_BLOCK_ZIP_DIRTY.

buf_flush_post_to_doublewrite_buf(), buf_flush_write_block_low():
Change the type of the parameter from buf_block_t* to buf_page_t*.

buf_flush_init_for_writing(): Allow page to be NULL if page_zip_ is non-NULL.
2007-01-16 18:02:49 +00:00
marko
94e49a71b2 branches/zip: Note that b (the newly created control block for the
compressed page) is not protected by block_mutex.  Before releasing
buf_pool->mutex, we can simply assign b->io_fix.  After reacquiring
buf_pool->mutex, we also have to acquire buf_pool->zip_mutex.
2007-01-16 16:39:53 +00:00
marko
9fe82e80e3 branches/zip: buf_LRU_free_block(): When preserving the compressed page
of a block, do not release buf_pool->mutex between the time the old control
block is removed from buf_pool->page_hash and the new control block is
added to it.  Prevent operations on the compressed-only block while calling
btr_search_drop_page_hash_index() or page_zip_calc_checksum().

buf_LRU_invalidate_tablespace(): Revert the change done in r1223.
buf_pool->zip_mutex will have been released by
buf_LRU_block_remove_hashed_page() when it returns BUF_BLOCK_ZIP_FREE.
2007-01-16 16:24:47 +00:00
marko
c3599a3ab1 branches/zip: buf_flush_remove(): buf_page_get_mutex(bpage) must have been
acquired by the caller.

buf_LRU_invalidate_tablespace(): Do not leak buf_pool->zip_mutex when
rescanning the LRU list.
2007-01-16 14:37:40 +00:00
marko
91546e7d10 branches/zip: buf_LRU_free_block(): When freeing the uncompressed page
of a dirty block, relocate the control blocks on buf_pool->flush_list
instead of calling buf_flush_insert_into_flush_list().
2007-01-16 14:11:21 +00:00
marko
b68c70121e branches/zip: buf_page_init_for_read(): X-latch the block before
invoking buf_buddy_alloc().  An IO-fixed block must also be x-latched
when block->mutex and buf_pool->mutex are released.

buf_page_create(): Protect the block during buf_buddy_alloc() by
IO-fixing and X-latching it.
2007-01-16 13:45:52 +00:00
marko
631a11391e branches/zip: btr0cur.c: Add missing #include "buf0lru.h" that
should have been added in r1218.
2007-01-16 13:23:10 +00:00
marko
8efb68f1c9 branches/zip: buf_page_init_for_read(): IO-fix the block during
buf_zip_decompress().  This will prevent btr_cur_search_to_nth_level()
from accessing a half-decompressed leaf page.  Internal B-tree nodes
(non-leaf pages) in B-tree searches are only protected by the tree
latch (index->lock) and by buffer-fixing.
2007-01-16 12:40:15 +00:00
marko
ccd2090964 branches/zip: btr_store_big_rec_extern_fields(): Release the uncompressed
page frame to save memory.
2007-01-16 11:56:33 +00:00
marko
82f4ef9596 branches/zip: buf_LRU_block_remove_hashed_page(): When preserving the
compressed page, copy the contents from the uncompressed page if necessary.
2007-01-16 10:24:13 +00:00
marko
69f0212f4b branches/zip: buf_buddy_alloc_clean(): Remove bogus assertion ut_a(bpage)
and update the comments.
2007-01-16 08:59:39 +00:00
marko
6604943597 branches/zip: When adding a page to the buffer pool, add it to
buf_pool->page_hash and buf_pool->LRU before releasing buf_pool->mutex.

buf_page_init_for_read(), buf_page_create(): Allocate the compressed
page after the block has been added to the buffer pool.  Document the
reason for this.
2007-01-15 16:51:39 +00:00
marko
ac24d86c49 branches/zip: buf_LRU_free_block(): Flag the buffer frame fully initialized
when calling btr_search_drop_page_hash_index() and uninitialized after that.
2007-01-14 20:32:44 +00:00
marko
ef4abdf10d branches/zip: Make Valgrind diagnostics more accurate.
buf_page_init(): Declare block->frame valid only in the system tablespace.

trx_sysf_create(): Declare the rest of the page valid, although it is
uninitialized.
2007-01-13 21:15:55 +00:00
marko
6df0fc42ed branches/zip: Improve Valgrind diagnostics.
buf_buddy_relocate(): Document that src may have been split and some of
it may be in buf_pool->zip_free[j] for some j<i, thus mach_read_from_4()
may be reading from free memory.  Check buffer pages only for addressability,
not for being completely initialized.  Ensure that block descriptors are
completely initialized.

buf_buddy_remove_from_free(): Check prev->state and next->state in
UNIV_DEBUG && UNIV_DEBUG_VALGRIND builds.

buf_buddy_free_low(): Flag the entire block valid prior to invoking
buf_buddy_remove_from_free() in order to avoid a Valgrind warning about
the debug assertion on bpage->state.  Remove the Valgrind check for
buddy being completely allocated.  If it has been split to smaller blocks,
some of those blocks may be free.
2007-01-12 22:23:12 +00:00
marko
1e07a36bee branches/zip: trx_sys_create_doublewrite_buf(): Revert the change of r1208.
We cannot clear the page with memset(), because the page number and
tablespace id have already been stamped on it.
2007-01-12 20:40:42 +00:00
marko
5559afc6d4 branches/zip: buf_buddy_relocate(): Add Valgrind checks. 2007-01-12 14:30:18 +00:00
marko
1ca38a9404 branches/zip: Add the buf_pool->zip_free[] accessor functions
buf_buddy_add_to_free() and buf_buddy_remove_from_free().
Remove some bogus Valgrind warnings.  Improve Valgrind instrumentation.
2007-01-12 14:18:22 +00:00
marko
2b82ae8cb4 branches/zip: Improve Valgrind instrumentation of allocated memory.
UNIV_MEM_FREE(): Declare a memory area free.
UNIV_MEM_ALLOC(): Declare a memory area allocated (but uninitialized).
UNIV_MEM_DESC(): Associate a memory area with a control block.
UNIV_MEM_UNDESC(): Unassociate a control block.

trx_sys_create_doublewrite_buf(): Clear the buffer with memset().

buf_page_init(): Add a bogus UNIV_MEM_VALID(block->frame) to silence
valid warnings about InnoDB data pages containing uninitialized data.

buf_LRU_get_free_only(): Add UNIV_MEM_ALLOC(block->frame).

buf_LRU_get_free_block(): Add UNIV_MEM_DESC(block->page.zip.data, block).

buf_LRU_free_block(): Add UNIV_MEM_DESC(b->zip.data, b) when allocating
a compressed-only control block for a compressed page.

buf_LRU_block_free_non_file_page(): Replace UNIV_MEM_INVALID() with
UNIV_MEM_FREE().

buf_LRU_block_remove_hashed_page(): Add UNIV_MEM_UNDESC(bpage) when
deallocating a compressed-only control block.  Add
UNIV_MEM_INVALID(block->frame).  (The frame should be flagged free
by buf_LRU_block_free_non_file_page() moments later.)

buf0buddy.c: Disable some extra checks in Valgrind-instrumented builds.
Add UNIV_MEM_VALID(), UNIV_MEM_INVALID(), UNIV_MEM_FREE(), UNIV_MEM_ALLOC()
as necessary.
2007-01-12 12:36:40 +00:00
marko
9478ec03e9 branches/zip: buf_relocate(): Copy the block. Invalidate the source block.
buf_buddy_block_free(), buf_buddy_free_low(): Flag the freed bytes
uninitialized.

buf_page_init_for_read(), buf_buddy_relocate(): Do not refer to bpage
after invoking buf_relocate().

buf_buddy_relocate(): Flag src uninitialized.
2007-01-12 09:14:15 +00:00
marko
225e82c112 branches/zip: buf_page_io_complete(): Change the parameter type from
buf_block_t* to buf_page_t*.  Handle compressed-only blocks.
2007-01-10 14:36:39 +00:00
marko
8c0f676265 branches/zip: buf_page_init(): Improve diagnostic output in case of
buf_pool->page_hash corruption.
2007-01-10 14:36:15 +00:00
marko
020b6035be branches/zip: buf_page_init_for_read(): Increment the buf_fix_count
during the buf_zip_decompress() call.  Otherwise, the block may end
up being freed by another thread.  This bug was caught by the
page_zip_validate() check in buf_LRU_block_remove_hashed_page().
2007-01-10 12:50:10 +00:00
marko
1f7bc8e232 branches/zip: Remove a race condition.
buf_page_init_for_read(): Protect the buf_zip_decompress() call with
an X-lock on the block.

page_zip_validate(): Move the page_is_comp() assertion after the
page header comparison.
2007-01-10 10:08:34 +00:00
marko
b25ed2dac6 branches/zip: buf_buddy_free(): Add debug code for detecting live
objects in the free area.
2007-01-09 16:11:11 +00:00
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
4c529eb09f branches/zip: Replace an ut_a() with ut_d(). This mistake was made in r1188. 2007-01-09 12:56:12 +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
9d9714b8f3 branches/zip: page_zip_fields_decode(): Do not dereference a null pointer. 2007-01-08 12:32:31 +00:00
marko
e5c3aa1224 branches/zip: Make zlib use InnoDB memory heaps.
page_zip_malloc(): Replace ut_malloc(...) with mem_heap_alloc(opaque, ...).

page_zip_free(): Dummy function (cannot deallocate from InnoDB memory
heaps, and zlib seems to defer deallocation to the very end anyway).

page_zip_compress(): Create a big enough heap for the needs of zlib.
Replace deflateInit() with deflateInit2().

page_zip_decompress(): Create a big enough heap for the needs of zlib.
Replace inflateInit() with inflateInit2().
2007-01-05 21:15:05 +00:00
marko
0583d98529 branches/zip: buf_get_latched_pages_number(): Count compressed-only blocks too. 2007-01-05 21:00:07 +00:00
marko
e81c916b27 branches/zip: mem_heap_create_block(), mem_heap_create_func():
Remove the unused parameter init_block.

mem_heap_fast_create(): Remove.

struct mem_block_info_struct: Remove the field init_block.
2007-01-05 20:59:40 +00:00
marko
27ded6f71e branches/zip: Support compressed-only pages in buf_page_create().
buf_page_get_gen(): Note that buf_read_page() may uncompress
a compressed-only page.

buf_page_create(): Test buf_page_in_file() instead of BUF_BLOCK_FILE_PAGE.
2007-01-05 14:03:44 +00:00
marko
13d6355676 branches/zip: buf_validate(): Validate also the compressed-only blocks. 2007-01-05 12:13:28 +00:00
marko
51d0b62947 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
e2db2a873f branches/zip: buf_pool_page_hash_rebuild(): Rebuild also buf_pool->zip_hash
and add compressed-only pages to buf_pool->page_hash.

BUF_POOL_ZIP_FOLD(), BUF_POOL_ZIP_FOLD_PTR(), BUF_POOL_ZIP_FOLD_BPAGE():
Macros for computing buf_pool->zip_hash fold values.  Make use of these
in buf0buddy.c.

buf0buddy.c: Replace some ptr == ut_align_down(ptr, ...) in assertions with
!ut_align_offset(ptr, ...).
2007-01-05 10:49:56 +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