Commit graph

187 commits

Author SHA1 Message Date
marko
e507ea0dd4 branches/zip: btr_cur_mark_dtuple_inherited_extern(): Initialize len.
This was broken in r1591.
2007-08-01 07:53:27 +00:00
marko
632ec54002 branches/zip: Make merge sort handle externally stored columns.
Some things still fail in innodb-index.test, and there seems to be
a race condition (data dictionary lock wait) when running with --valgrind.

dfield_t: Add an "external storage" flag, dfield->ext.

dfield_is_null(), dfield_is_ext(), dfield_set_ext(), dfield_set_null():
New functions.

dfield_copy(), dfield_copy_data(): Add const qualifiers, fix in/out comments.

data_write_sql_null(): Use memset().

big_rec_field_t: Replace byte* data with const void* data.

ut_ulint_sort(): Remove.

upd_field_t: Remove extern_storage.

upd_node_t: Replace ext_vec, n_ext_vec with n_ext.

row_merge_copy_blobs(): New function.

row_ins_index_entry(): Add the parameter "ibool foreign" for suppressing
foreign key checks during fast index creation or when inserting into
secondary indexes.

btr_page_insert_fits(): Add const qualifiers.

btr_cur_add_ext(), upd_ext_vec_contains(): Remove.

dfield_print_also_hex(), dfield_print(): Replace if...else if with switch.
Observe dfield_is_ext().
2007-06-21 09:43:15 +00:00
marko
96f554c52a branches/zip: btr_rec_copy_externally_stored_field(): Add const qualifier
to rec_t*.  Remove the ut_ad(rec_offs_validate()), because this function
will be called from row0merge.c on a record that lacks the
REC_N_NEW_EXTRA_BYTES.
2007-06-21 08:58:41 +00:00
marko
7e687905be branches/zip: Add some const qualifiers, mainly to upd_t*.
upd_get_n_fields(), upd_get_nth_field(): Add const qualifiers.
2007-06-19 12:44:45 +00:00
marko
ab2f114ad9 branches/zip: Merge 1533:1553 from trunk. 2007-06-06 11:07:37 +00:00
marko
efb7461351 branches/zip: btr_cur_optimistic_insert(): Set the insert buffer free bits
exactly.  Rename the local variable "ulint level" to "ibool leaf".
Document that if the function returns DB_SUCCESS on a compressed page that
is covered by the insert buffer, the mini-transaction must be committed
before latching any further pages.  Verify that this is the case on all
execution paths.
2007-05-16 12:01:31 +00:00
marko
382cb9fdf1 branches/zip: Document and obey the rules for modifying the free bits in
the insert buffer bitmap.

ibuf_set_free_bits_func(): Never disable redo logging.

ibuf_update_free_bits_zip(): Remove.

btr_page_reorganize_low(), page_zip_reorganize(): Do not update the insert
buffer bitmap.  Instead, document that callers will have to take care of it,
and adapt the callers.

btr_compress(): On error, reset the insert buffer free bits.

btr_cur_insert_if_possible(): Do not modify the insert buffer bitmap.

btr_compress(), btr_cur_optimistic_insert(): On compressed pages,
reset the insert buffer bitmap.  Document why.

btr_cur_update_alloc_zip(): Document why it is necessary and sufficient
to reset the insert buffer free bits.

btr_cur_update_in_place(), btr_cur_optimistic_update(),
btr_cur_pessimistic_update(): Update the free bits in the same
mini-transaction.  Document that the mini-transaction must be
committed before latching any further pages.  Verify that this
is the case in all execution paths.

row_ins_sec_index_entry_by_modify(), row_ins_clust_index_entry_by_modify(),
row_undo_mod_clust_low(): Because these functions call
btr_cur_update_in_place(), btr_cur_optimistic_update(), or
btr_cur_pessimistic_update(), document that the mini-transaction must be
committed before latching any further pages.  Verify that this is the case
in all execution paths.
2007-05-16 09:23:53 +00:00
marko
88df83bb3b branches/zip: Merge revisions 1402:1493 from trunk.
Remove mysql.patch, because the configuration parameter interface has changed.
2007-05-14 09:07:15 +00:00
marko
4df65a761e branches/zip: ibuf_set_free_bits_func(): Disable redo logging when
crash recovery is in progress.  This avoids a hang when
btr_parse_page_reorganize(), called from an I/O handler thread,
attempts to acquire log_sys->mutex while it is being held by
the main thread (the one that runs innobase_init()).  This change
was committed accidentally.  It may be unsafe to clear
mtr.modifications, because buf_page_release() at mtr_commit() may
forget to put modified pages to the flush list.

Cleanup: Remove the "type" parameter from many ibuf functions.
Let the caller check that !dict_index_is_clust().  This should avoid
function calls and register spilling.

ibuf_set_free_bits_func(), ibuf_set_free_bits(): Remove the parameter "type".

ibuf_reset_free_bits_with_type(): Rename to ibuf_reset_free_bits().
Remove the parameter "type".

ibuf_update_free_bits_if_full(), ibuf_update_free_bits_zip(),
ibuf_update_free_bits_low(), ibuf_update_free_bits_for_two_pages_low():
Remove the parameter "index".
2007-05-06 12:39:46 +00:00
marko
a369b00981 branches/zip: btr_cur_pessimistic_update(): Add parameter heap.
Previously, when big_rec was returned, the fields would point to
freed memory.  The memory heap was allocated locally, and the data tuple
was allocated from the heap, and the big_rec would point to some fields
in the data tuple.

row_ins_clust_index_entry_by_modify(): Add parameter heap,
for the same reason.
2007-03-28 19:35:52 +00:00
marko
94d4f12919 branches/zip: Minor cleanup.
btr_rec_free_updated_extern_fields(): Remove the parameter
do_not_free_inherited, which is always passed as TRUE.

btr_cur_unmark_extern_fields(): Invoke rec_offs_any_extern().

btr_cur_unmark_dtuple_extern_fields(): Remove a local variable.
2007-03-14 12:34:55 +00:00
marko
5f44e6b308 branches/zip: ibuf_update_free_bits_if_full(): Remove the zip_size
parameter.  Add ibuf_update_free_bits_zip() for compressed pages.
2007-03-01 11:28:30 +00:00
marko
abc7f6c997 btr_cur_optimistic_insert(): When inserting into a compressed page,
pass max_ins_size=UNIV_PAGE_SIZE and increase=ULINT_UNDEFINED to
ibuf_update_free_bits_if_full().  Otherwise, a bogus assertion failure
may occur when the page is recompressed and there is more space available
in the modification log after inserting the record.
2007-02-28 13:19:13 +00:00
marko
d32cd9647b branches/zip: Note that page_cur_tuple_insert() can fail without attempting
to reorganize a compressed page.  This mistake was made in r1308.
2007-02-28 11:08:59 +00:00
marko
d52f32b31f branches/zip: Prepare for a negative return from page_zip_max_ins_size(). 2007-02-27 10:21:44 +00:00
marko
71cbde3b08 branches/zip: btr_cur_insert_if_possible(): Update the free bits on
compressed secondary index pages after attempting the insert.

btr_cur_update_alloc_zip(): Reset the insert buffer free bits if there is
insufficient space available on secondary index pages.  Do not update
the bits after successful operation.

btr_cur_update_in_place(): Update the free bits in the index buffer.

btr_cur_optimistic_update(): First check rec_offs_any_extern(), because
checking it is cheaper than checking the "external storage" flags of the
update vector.  Update the insert buffer free bits in any case after
successfully calling btr_cur_update_alloc_zip().
2007-02-27 07:25:24 +00:00
marko
62db6d6b37 branches/zip: Update the insert buffer free bits when recompressing
a page during update-in-place.

page_zip_alloc(): Rename to btr_cur_update_alloc_zip().
Invoke ibuf_update_free_bits_if_full().
2007-02-26 09:35:02 +00:00
marko
0f792cb278 branches/zip: Many places: Avoid re-reorganizing compressed pages after
failing insert.  Reorganization will have been attempted in
page_cur_tuple_insert() or page_cur_rec_insert().

page_zip_reorganize(): Recompute the insert buffer free bits for
leaf pages of secondary indexes.

ibuf_data_enough_free_for_insert(): Simplify.
2007-02-20 15:01:47 +00:00
marko
cef74ef732 branches/zip: Fix bugs related to the insert buffering of
compressed tablespaces.

btr_page_reorganize_low(): Recompute the insert buffer free bits
for compressed pages belonging to a non-clustered index.

btr_cur_optimistic_insert(): Determine if the page was reorganized by
page_cur_tuple_insert(). Do not attempt to reorganize compressed pages,
because that will be attempted by page_cur_tuple_insert().
2007-02-20 13:36:17 +00:00
marko
92193389c3 branches/zip: btr_cur_optimistic_insert(): If btr_page_reorganize()
fails, reset the insert buffer free bits for the page.
2007-02-20 11:30:13 +00:00
marko
efd79c7a86 branches/zip: Enable the insert buffer on compressed tablespaces.
page_zip_max_ins_size(): New function.

btr_cur_optimistic_insert(), btr_cur_optimistic_delete(),
btr_page_split_and_insert(), btr_compress(): Do not update the
ibuf free bits for non-leaf pages or pages belonging to a clustered index.
The insert buffer only covers operations on leaf pages of secondary indexes.
For pages covered by the insert buffer, limit the max_ins_size to
page_zip_max_ins_size().

buf_page_get_gen(): Merge the insert buffer after decompressing the page.

buf_page_io_complete(): Relax the assertion about ibuf_count.  For
compressed-only pages, the insert buffer merge takes place
in buf_page_get_gen().

ibuf_index_page_calc_free_bits(), ibuf_index_page_calc_free_from_bits(),
ibuf_index_page_calc_free(), ibuf_update_free_bits_if_full(),
ibuf_update_free_bits_low(), ibuf_update_free_bits_for_two_pages_low(),
ibuf_set_free_bits_low(): Add the parameter zip_size.  Limit the maximum
insert size to page_zip_max_ins_size().
2007-02-19 20:32:06 +00:00
marko
9b2643705a branches/zip: btr_cur_optimistic_insert(): After dtuple_convert_big_rec(),
invoke btr_cur_add_ext() so that rec_size will be computed correctly.
Prepare to free the memory heap when handling errors.
2007-02-12 12:04:49 +00:00
marko
9a94888273 branches/zip: btr_search_guess_on_hash(): Eliminate two local variables
and optimize one test.
2007-01-31 14:28:37 +00:00
marko
36734f3420 branches/zip: btr_cur_optimistic_insert(): Optimize some tests,
eliminate some local variables, and add branching hints.
2007-01-31 14:12:57 +00:00
marko
6e2c59d421 branches/zip: Make zlib use InnoDB memory heaps when processing BLOBs.
page_zip_set_alloc(): New function, to configure zlib to use a memory heap.

btr_store_big_rec_extern_fields(): Reduce memLevel, so that a heap of
256 kilobytes will suffice.  Use page_zip_set_alloc().

btr_copy_externally_stored_field_prefix_low(): Use page_zip_set_alloc().

page_zip_compress(), page_zip_decompress(): Use page_zip_set_alloc().
2007-01-29 08:51:20 +00:00
marko
adbd5c3a85 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
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
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
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
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
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
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
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
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
620f54ee69 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
60e9ce2fe2 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
8e8719dabe 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
51fbf7601c 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
ac05c89b24 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
e5eb6187b1 branches/zip: ha_delete_hash_node(): Do not call buf_block_align().
Instead, get buf_block_t* as a parameter.

Without this patch, buf_page_hash_get() would return NULL in
buf_block_align().  The function buf_LRU_search_and_free_block()
invokes buf_LRU_block_remove_hashed_page(), which removes the
hash mapping needed by buf_page_hash_get().
2006-10-30 19:46:31 +00:00
marko
bac65733cd branches/zip: Always call buf_block_align() while holding buf_pool->mutex.
This was forgotten from r977.
2006-10-30 16:18:23 +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