Commit graph

377 commits

Author SHA1 Message Date
marko
4286b8286b branches/zip: Fix compilation errors when UNIV_HOTBACKUP is defined. 2006-11-30 15:25:52 +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
81d1179f04 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
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
427a413e9c branches/zip: buf_page_peek_block(): Do not invoke buf_block_get_state()
on a NULL pointer.  This error was introduced in r1082.
2006-11-30 12:40:33 +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
1d1e9b59da branches/zip: Rename ut_ulonglong_align_down() and ut_ulonglong_align_up()
to ut_uint64_align_down() and ut_uint64_align_up(), to reflect the rename
of ib_ulonglong to ib_uint64_t in r1085.
2006-11-30 09:23:47 +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
311ea6a81a 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
da966628be branches/zip: Enclose buf_block_t:in_LRU_list in #ifdef UNIV_DEBUG 2006-11-28 09:37:02 +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
b34c10581d 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
8e9b9a995f page_zip_validate(): Replace %lu with %d, because the bit-fields
introduced in r1057 are of the int type.
2006-11-24 12:51:05 +00:00
marko
3f4b80c5bd 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
30ac05d2bd branches/zip: buf_read_ahead_random(): Stop searching upon exceeding the
threshold.
2006-11-24 08:39:53 +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
7070b7af75 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
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
5aea6e2a1a 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
a658b00597 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
f4c43c6a73 branches/zip: ha_node_set_data(): Define a wrapper macro, and rename the
function to ha_node_set_data_func().  In this way, the #ifdef in the
callers can be removed.
2006-11-21 10:34:42 +00:00
marko
aa2ca9f588 branches/zip: Remove some instrumentation and reduce the output of
SHOW MUTEX STATUS in non-debug builds.  (Bug #24386)
2006-11-21 10:09:14 +00:00
marko
aa845361c3 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
2812ad43dc branches/zip: Make ibuf_validate_low() static and enclose in #ifdef UNIV_DEBUG. 2006-11-16 09:01:53 +00:00
marko
303d8f474f 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
21bf2206ec 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
8478f3824c branches/zip: btr_store_big_rec_extern_fields(): Remove the incomplete
statement that was accidentally checked in in r1022.
2006-11-16 08:41:10 +00:00
marko
ebeee34510 btr_store_big_rec_extern_fields(): Write the (space_id, page_no) of the
record on every compressed BLOB page header, so that compressed BLOBs
can be relocated or the chain of BLOB pages can be validated.
2006-11-15 21:58:01 +00:00
marko
f339090d97 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
c161077922 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
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
e3893c65df branches/zip: Correct a bug introduced in r1014: Always assign node->block
when assigning node->data.

ha_delete(), ha_search_and_delete_if_found(), ha_remove_all_nodes_to_page():
Remove the parameter buf_block_t* block, now that it is stored within the
hash data structure in debug builds.
2006-11-14 10:42:50 +00:00
marko
d25fa2c4d9 branches/zip: Remove the buf_block_align() calls from ha0ha.c that caused
an assertion failure in debug builds when a context switch occurred in
buf_LRU_search_and_free_block() before the call to
btr_search_drop_page_hash_index() managed to acquire the mutexes again.

ha_node_t: Add the field buf_block_t* block.

ha_search_and_update_if_found(): Rename to ha_search_and_update_if_found_func()
with added buf_block_t* parameter in debug builds.  Define the wrapper macro
ha_search_and_update_if_found() that always takes the buf_block_t* parameter.

ha_insert_for_fold(): Rename to ha_insert_for_fold_func()
with added buf_block_t* parameter in debug builds.  Define the wrapper macro
ha_insert_for_fold() that always takes the buf_block_t* parameter.
2006-11-13 21:53:09 +00:00
marko
7499c4bda5 branches/zip: Remove the variable innobase_buffer_pool_awe_mem_mb.
The bulk of the AWE support was removed in r976.
2006-11-13 10:03:18 +00:00
marko
f03f262d38 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
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
marko
9ba7e51e23 branches/zip: btr_cur_position(): Replace buf_block_get_frame(block)
with block->frame, because in btr_search_guess_on_hash(), it may
occur that block->buf_fix_count == 0.
2006-11-01 10:06:29 +00:00
marko
0a00463417 branches/zip: ibuf_merge_or_delete_for_page(): Replace all
calls buf_block_get_frame(block) with block->frame in order
to avoid debug assertions about block->buf_fix_count == 0.
2006-11-01 09:20:22 +00:00
marko
c2fb9e5966 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