Commit graph

130 commits

Author SHA1 Message Date
marko
438cb8a6c1 branches/zip: Remove all buf_block_align() calls from lock0lock.c.
Replace all page_t* parameters with buf_block_t*, and replace many
rec_t* parameters with heap_no.  This eliminates also many
rec_get_heap_no() calls, which became more expensive with the
introduction of ROW_FORMAT=COMPACT in MySQL/InnoDB 5.0.3.

page_rec_get_heap_no(), lock_get_min_heap_no(): New functions.
2006-10-24 06:45:52 +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
1834af7672 branches/zip: Minor cleanup.
page_set_max_trx_id(): Replace page_t* parameter with buf_block_t*,
to avoid a buf_block_align() call.

Replace some occurrences of page_get_page_no() with buf_block_get_page_no().

page_cur_delete_rec(): Replace buf_block_align() with page_cur_get_block().
2006-10-23 18:26:10 +00:00
marko
40b401a682 branches/zip: Fix some bugs.
btr_cur_pessimistic_insert(): Remove local variable "block".  Replace
an extraneous call to btr_cur_position() [with wrong "block", in r948]
with a debug assertion that the cursor is positioned on the preceding
record after the page split.

btr_pcur_restore_position(): Do not use btr_pcur_get_page(), because
the debug assertion there could fail.  This bug was introduced in r928.
2006-10-23 11:38:32 +00:00
marko
f1348098a0 branches/zip: btr_search_drop_page_hash_index(): Do not call
buf_block_get_frame(), because it will lead to debug assertion failure
when buf_fix_count == 0.  This bug was introduced in r908.
2006-10-20 13:49:42 +00:00
marko
b6e26f24d7 branches/zip: Remove some more buf_block_align() calls.
btr_cur_t: Move page_block to page_cur_t::block.

page_cur_get_block(), page_cur_get_page_zip(): New functions.

page_cur_position(): Add parameter block.

Remove many page_zip parameters, now that there is page_cur_get_page_zip().
Replace some page, page_zip parameters with block.

Add some const qualifiers to function parameters and remove casts.

PAGE_HEAP_NO_INFIMUM, PAGE_HEAP_NO_SUPREMUM, PAGE_HEAP_NO_USER_LOW:
New constants.

Replace some cursor code in low-level diagnostic functions with
direct management of rec, because buf_block_t::buf_fix_count may be 0
when the functions are called, and debug assertions would fail.
2006-10-20 12:45:53 +00:00
marko
bb9b1b0c48 branches/zip: btr_search_guess_on_hash(): Do not call buf_block_get_frame(),
because it will lead to debug assertion failure when buf_fix_count == 0.
This bug was introduced in r912.
2006-10-20 12:22:42 +00:00
marko
baeb31b952 branches/zip: btr_cur_open_at_index_side(): Correct a debug assertion
added in r928.  Do not call btr_cur_get_block() in the debug assertion,
because the debug assertion there would fail.
2006-10-20 11:54:13 +00:00
marko
d6c684798e branches/zip: Add const qualifiers to function parameters, mostly dtuple_t. 2006-10-20 08:30:07 +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
fbe4fe6022 branches/zip: Remove the casts introduced in r920 and r925. Replace the
accessors returning pointers with macros that preserve const qualifiers.
In UNIV_DEBUG builds, retain the accessors and cast away constness there.

dfield_get_type(), dfield_get_data(), dtuple_get_nth_field(),
dict_table_get_nth_col(), dict_table_get_sys_col(): Implement as macro
unless #ifdef UNIV_DEBUG.

rec_get_nth_field(): Replace with rec_get_nth_field_offs() that does not
do pointer arithmetics.  Implement rec_get_nth_field() as a macro.
2006-10-19 07:27:26 +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
120e544dc1 branches/zip: btr_cur_t: replace left_page with left_block, to avoid
calling buf_block_align() in btr_pcur_move_backward_from_page().
Also, enclose some assertions about page_is_comp() in #ifdef UNIV_BTR_DEBUG.
2006-10-18 17:43:04 +00:00
marko
d583b1803c branches/zip: Eliminate many buf_block_align() calls.
Replace page_t* or page_zip_des_t* parameters in some functions with
buf_block_t*.

buf_frame_get_page_zip(): Disable unless #ifdef UNIV_DEBUG || UNIV_ZIP_DEBUG.

btr_cur_t: Add buf_block_t* page_block.

btr_pcur_get_block(), btr_cur_get_block(), btr_cur_get_page_zip():
New functions.

btr_cur_position(): Add the parameter block.
2006-10-18 11:39:31 +00:00
marko
8f07794024 branches/zip: Introduce const qualifiers to many read-only parameters
and modify some functions to return const pointers.  Add const qualifiers
to local variable declarations or casts to remove the const qualifier
in those places where write access is needed.
2006-10-17 12:24:13 +00:00
marko
e5b6c39477 branches/zip: Remove some more buf_block_align() calls.
Replace buf_frame_modify_clock_inc() with buf_block_modify_clock_inc().
Replace buf_frame_get_lock_hash_val() with buf_block_get_lock_hash_val().
Replace buf_frame_get_lock_mutex() with buf_block_get_lock_mutex().

page_create_zip(), page_create(), page_create_low(), btr_page_free(),
btr_page_free_low(): Replace page_t with buf_block_t.
2006-10-13 11:55:27 +00:00
marko
968de5a54e branches/zip: Eliminate some more buf_block_align() calls.
ibuf_update_free_bits_low(), ibuf_update_free_bits_for_two_pages_low(),
ibuf_set_free_bits_low(): Replace page_t with buf_block_t.
2006-10-13 09:15:17 +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
fcaa035f29 branches/zip: Eliminate some more buf_block_align() calls.
mlog_write_initial_log_record_fast(): Remove the buf_block_align() call
unless #ifdef UNIV_DEBUG.

btr_cur_update_in_place(): Replace buf_frame_get_page_zip() with
buf_block_get_page_zip().

btr_page_create(), btr_page_empty(): Replace the parameter page with block.

btr_attach_half_pages(): Use btr_block_get() instead of btr_page_get().
Remove buf_block_align() calls.

btr_cur_latch_leaves(): Remove duplicated code.  Use btr_block_get()
instead of btr_page_get().  Remove buf_block_align() calls.
2006-10-12 18:39:43 +00:00
marko
06bb7e6ea5 branches/zip: Replace buf_frame_alloc() and buf_frame_free()
with buf_block_alloc() and buf_block_free(), in order to
avoid buf_block_align() calls.
2006-10-12 12:38:29 +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
334b002c5c branches/zip: Add function mtr_memo_contains_page() #ifdef UNIV_DEBUG.
Replace ut_ad(mtr_memo_contains(mtr, buf_block_align(ptr), ...))
with ut_ad(mtr_memo_contains_page(mtr, ptr, ...)) in order to reduce the
number of buf_block_align() calls.
2006-10-09 19:36:58 +00:00
marko
469a27ac2a branches/zip: Replace buf_frame_align() with page_align(), page_offset(),
ut_align_down(), or ut_align_offset().
2006-10-09 16:22:47 +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
66ae0ded70 branches/zip: Fix all bugs detected by mysql-test-run. The exactly same set
of tests are failing with trunk -r869, with this revision using uncompressed
storage, and with this revision hard-wired to use 1-kilobyte compressed pages
and innodb_file_per_table.

btr_push_update_extern_fields(): Do not call ut_ulint_sort() if n_pushed == 0.

btr_copy_externally_stored_field_prefix_low(): Replace ut_max() with ut_min().
2006-10-02 08:42:42 +00:00
marko
174bd7b7ca branches/zip: dtuple_convert_big_rec(): Do not store anything locally
of externally stored columns, and fix bugs introduced in r873.  (Bug #22496)

btr_page_get_sure_split_rec(), btr_page_insert_fits(),
rec_get_converted_size(), rec_convert_dtuple_to_rec(),
rec_convert_dtuple_to_rec_old(), rec_convert_dtuple_to_rec_new():
Add parameters ext and n_ext.  Flag external fields during the
conversion.

rec_set_field_extern_bits(), rec_set_field_extern_bits_new(),
rec_offs_set_nth_extern(), rec_set_nth_field_extern_bit_old():
Remove.  The bits are set by rec_convert_dtuple_to_rec().

page_cur_insert_rec_low(): Remove the parameters ext and n_ext.

btr_cur_add_ext(): New utility function for updating and sorting ext[].
Low-level functions now expect the array to be in ascending order
for performance reasons.  Used in btr_cur_optimistic_insert(),
btr_cur_pessimistic_insert(), and btr_cur_pessimistic_update().

btr_cur_optimistic_insert(): Remove some defensive code, because we cannot
compute the added parameters of rec_get_converted_size().

btr_push_update_extern_fields(): Sort the array.  Require the array to
be twice the maximum usage, so that ut_ulint_sort() can be used.

dtuple_convert_big_rec(): Allocate new space for the BLOB pointer,
to avoid overwriting prefix indexes to the same column.  Adapt
dtuple_convert_back_big_rec().

row_build_index_entry(): Fetch the columns also for prefix indexes of
the clustered index.

page_zip_apply_log(), page_zip_decompress_clust(): Allow externally
stored fields to lack a locally stored part.
2006-09-29 10:40:42 +00:00
marko
60504d8efa btr_page_get_sure_split_rec(): Revert the change from r875:
"On compressed pages, return NULL if incl_data > free_space."

btr_page_split_and_insert(): Remove the limit check of n_iterations
on compressed pages.  After enough many invocations of
btr_page_get_sure_split_rec(), the record will finally fit.
2006-09-28 11:02:04 +00:00
marko
44e33c235f branches/zip: btr_page_get_sure_split_rec(): Rewrite the
for (;;) { ... if (condition) { ... return }} loop as
do { ... } while (!condition); ... return.

On compressed pages, return NULL if incl_data > free_space.
2006-09-28 10:40:07 +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
7edc6be45b branches/zip: Add const qualifiers to the pointer parameters of
mach_read_...() functions.  Remove unnecessary casts.
2006-09-26 07:39:02 +00:00
marko
c66a0754b9 branches/zip: Implement the ability to fetch a prefix of an externally
stored column.  This is the first part of fixing Bug #22496.

btr_copy_externally_stored_field_prefix(): New function.

btr_copy_externally_stored_field(): Split to
btr_copy_externally_stored_field_prefix_low().

row_sel_sec_rec_is_for_blob(): New function, used by
row_sel_sec_rec_is_for_clust_rec() in selects via
a secondary index.
2006-09-26 06:22:16 +00:00
marko
8e59e994ac branches/zip: Minor cleanup in update related code.
btr_push_update_extern_fields(): Instead of iterating all upd_get_n_fields(),
stop at the first match.

row_search_index_entry(): Simplify the return statements.

row_upd_sec_step(): Eliminate the local variable "err".

row_upd_clust_step(): Add a UNIV_UNLIKELY hint.
2006-09-25 12:17:33 +00:00
marko
5a21753bcb branches/zip: page_zip_empty_size(): New function to compute the
guaranteed free space available for inserting one record.

btr_page_get_sure_split_rec(), btr_cur_pessimistic_insert():
Use page_zip_empty_size().

btr_page_split_and_insert(): Relax a debug assertion that there should
be at least two user records on the page.  On compressed pages, we may
be able to write only one record.
2006-09-20 14:26:53 +00:00
marko
68a65c142c branches/zip: Merge revisions 804:838 from trunk. 2006-09-19 10:14:07 +00:00
marko
090a1db9ad branches/zip: btr_store_big_rec_extern_fields(): When adjusting the
"next BLOB page" pointer, write it also to the compressed page,
which is the one that will be flushed to disk.
2006-09-06 14:17:20 +00:00
marko
50e286c04d branches/zip: btr_copy_externally_stored_field(): Add diagnostics for
unexpected end of compressed BLOB.
2006-09-06 09:51:00 +00:00
marko
0c26b8f1a4 branches/zip: btr_copy_externally_stored_field(): Correct the
reporting and handling of inflate() errors.
2006-09-05 19:41:05 +00:00
marko
23128a45c1 branches/zip: Split lines before operators, not after them. 2006-09-05 19:37:43 +00:00
marko
78357aa7c3 branches/zip: btr_cur_optimistic_insert(): When returning DB_FAIL,
always convert back big_rec_vec.
2006-09-05 12:49:35 +00:00
marko
da79b9060c branches/zip: btr_cur_optimistic_insert(): Add a closing parenthesis that
was accidentally omitted in r766.
2006-09-04 19:06:58 +00:00
marko
ff61ba46d9 branches/zip: Avoid overwriting an existing big_rec when calling
dtuple_convert_big_rec().  This should never happen, though.
2006-08-31 10:53:00 +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
800047591a branches/zip: btr_page_get_sure_split_rec(): Align the variable declarations
according to InnoDB formatting rules.
2006-08-17 08:28:05 +00:00
marko
4fb0e5e762 branches/zip: Account for the compressed page size when checking if a
record will fit or need external storage.

btr_page_get_sure_split_rec(): Estimate the free space of an empty
compressed page.

page_zip_rec_needs_ext(): New function, to replace existing tests whether
external storage is needed.
2006-08-17 08:14:38 +00:00
marko
f4f5606fb6 branches/zip: Merge revisions 634:713 from trunk. 2006-08-11 11:49:38 +00:00
marko
09e017ca70 branches/zip: btr_cur_search_to_nth_level(): Do not invoke page_zip_validate()
if rw_latch == RW_NO_LATCH.
2006-08-07 08:07:47 +00:00
marko
b152ee5655 branches/zip: Zero out the BLOB pointers when decoding deleted records.
Improve diagnostics.

btr_cur_pessimistic_update(): Add page_zip_validate() assertion.

page_zip_decompress(): Initialize all BLOB pointers.

page_zip_clear_rec(): Add page_zip_header_cmp() assertion.

page_delete_rec_list_end(): Add page_zip_validate() assertion.
2006-08-03 08:06:45 +00:00