Commit graph

331 commits

Author SHA1 Message Date
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
3b03315f94 branches/zip: Fix bugs #ifdef UNIV_DEBUG.
rec_convert_dtuple_to_rec_old(): Initialize the record in order to avoid
bogus Valgrind warnings about the ut_ad() in mach_write_to_1() and
mach_write_to_2().

page_zip_compress(), page_zip_write_rec(), page_zip_write_blob_ptr():
Replace ut_ad(page_validate(...)) with ut_ad(page_simple_validate_new(...)),
because otherwise crash recovery would fail.
2006-09-20 12:23:25 +00:00
marko
a169d0ec32 branches/zip: fil_create_new_single_table_tablespace():
Make page_zip->data point to an address different from page,
to avoid calling memcpy() with overlapping source and destination.
2006-09-20 11:14:54 +00:00
marko
2af802d820 branches/zip: mlog_parse_index(): After merge fix (r841):
Identify DB_TRX_ID and DB_ROLL_PTR in the index.
2006-09-20 05:05:58 +00:00
marko
660880218b branches/zip: Remove page_zip_decompress_low(). Do not call page_validate()
on the ZIP_DUMMY index.  Because it does not contain valid collation
information, the ordering check in page_validate() may fail on pages
containing non-binary data.

Instead, let the callers of page_zip_decompress() invoke page_validate()
when the index information is available.
2006-09-19 13:56:56 +00:00
marko
68a65c142c branches/zip: Merge revisions 804:838 from trunk. 2006-09-19 10:14:07 +00:00
marko
48dd1ece29 branches/zip: Merge revisions 789:804 from trunk. 2006-09-12 07:29:57 +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
d4d321ad85 branches/zip: Merge revisions 767:789 from trunk. 2006-09-04 19:47:47 +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
c3e2a8d45f branches/zip: dtuple_convert_big_rec(): Shorten the locally stored part
of externally stored columns to 108 bytes when possible.

This will unmask a bug in the handling of BLOBs on compressed tablespaces,
especially of small page sizes.  Apparently, the locally stored part must
be less than 235 bytes in size for the bug to occur.

dict_col_struct: Add field min_prefix.

dict_index_build_internal_non_clust(): Adjust min_prefix.
2006-08-31 11:00:02 +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
d8aa49be04 branches/zip: Merge revisions 765:767 from trunk. 2006-08-29 12:17:50 +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
4b252f248c branches/zip: page_zip_dir_insert(): When looking for slot_rec, use the
old value of PAGE_N_RECS.

page_zip_dir_find_free_low(): Rename to page_zip_dir_find_low().

page_zip_dir_find(): Make use of page_zip_dir_find_low().
2006-08-22 08:34:14 +00:00
marko
1180ce9805 branches/zip: Speed up the compression and decompression of leaf pages
of non-clustered indexes.  On these pages, only the bytes rec[-5..-1]
will be omitted from the compressed data stream.  Save time by not looking
for trx_id or externally stored columns.
2006-08-21 18:36:00 +00:00
marko
fb8ce59909 branches/zip: Assert that only leaf pages of clustered indexes may contain
externally stored columns.  Make some use of the fact in compression and
decompression.

rec_init_offsets(): Add ut_ad(dict_index_is_clust(index)) before flagging
external columns.

page_zip_get_trailer_len(): Assert ut_ad(!page_zip->n_blobs) unless
dict_index_is_clust(index).

page_zip_get_n_prev_extern(): Add ut_ad(dict_index_is_clust(index)).

page_zip_compress(), page_zip_decompress_low(): Add dict_index_is_clust()
assertions.  Allow completely external storage of columns.  Simplify
the computation of "externs".

page_zip_write_rec(): Store leaf node records of non-clustered indexes
with one memcpy(), avoiding rec_offs_n_extern() and the for loop.

page_zip_write_blob_ptr(): Add ut_ad(dict_index_is_clust(index)).
Simplify the computation of "externs".

page_zip_clear_rec(): Only attempt to zero out BLOB pointers when
the record belongs to a leaf page of a clustered index.

page_zip_dir_delete(): Take a fast path when the record is
not on a leaf page of a clustered index.
Simplify the computation of "externs".

page_zip_copy(): Assert that n_blobs is zero on anything else than
leaf pages of clustered indexes.
2006-08-21 10:27:15 +00:00
marko
2f08aceba7 branches/zip: page_zip_fields_decode(): Set index->type to DICT_CLUSTERED
if and only if the records on the page contain a trx_id column.
(Dummy indexes of non-leaf pages will always show up as non-clustered.)
2006-08-21 09:30:48 +00:00
marko
2998a01230 branches/zip: page_zip_dir_insert(): Remove unused parameters index, offsets. 2006-08-21 09:27:44 +00:00
marko
3a27b5c8c7 branches/zip: page_zip_decompress(): Initialize page_zip->n_blobs before
referencing it, to prevent a ut_ad() assertion on page_zip_get_trailer_len()
from failing.  Promote that assertion to ut_a().
2006-08-21 09:08:47 +00:00
marko
a9e75e633a branches/zip: dtuple_convert_big_rec(): Do not attempt to shorten records
of secondary indexes.  (This is just an optimization; the logic in the
search loop would never store such records externally.)
2006-08-21 08:41:05 +00:00
marko
7e1076c716 branches/zip: page_cur_insert_rec_low(): Replace page_zip_dir_rewrite()
with page_zip_dir_insert().  Pass page_zip to rec_set_n_owned_new()
and page_dir_slot_set_n_owned().

page_zip_dir_insert(): New function.  Shift the dense page directory and
write the inserted record there.
2006-08-18 19:30:55 +00:00
marko
244c9715f0 branches/zip: Bug fixes.
data0data.c: Add #include "page0zip.h" that was forgotten from r739.

page_cur_insert_rec_low(): Remove a memory leak when preventing
extra_size to grow.
2006-08-18 14:34:30 +00:00
marko
7b36a0aaaa branches/zip: Correct the description of DB_TOO_BIG_RECORD. 2006-08-18 10:02:50 +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
41468be960 branches/zip: Clean up debug code.
struct mtr_struct: Omit unused field "state" unless #ifdef UNIV_DEBUG.

buf_block_buf_fix_inc_debug(): Remove redundant __attribute__((unused))
and #ifdef UNIV_SYNC_DEBUG.
2006-08-16 09:35:36 +00:00
marko
3d085927ba branches/zip: Disable unused function ut_dulint_sort(). 2006-08-15 14:28:09 +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
ec6213a7c4 branches/zip: Merge revisions 713:720 from trunk. 2006-08-15 11:55:06 +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
94c15708a3 branches/zip: btr0btr.ic: Add #include "page0zip.h" so that the code
will compile with inlining disabled.
2006-08-15 08:37:54 +00:00
marko
4465e272a0 branches/zip: Allow the code to be built with function inlining enabled.
page0page.h: Add #include "page0zip.h"

page_dir_slot_get_rec(): Avoid void* arithmetics.

trx0undo.ic, trx0sys.ic: Remove unnecessary #include "page0zip.h"

page_zip_write_header(): Move prototype from page0types.h to page0zip.h
2006-08-14 08:25:46 +00:00
marko
f4f5606fb6 branches/zip: Merge revisions 634:713 from trunk. 2006-08-11 11:49:38 +00:00
marko
a150cf7ef1 branches/zip: page_copy_rec_list_start(): Replace the local variable
"old_end" with "ret".  Otherwise, a page_zip_reorganize() would make
lock_move_rec_list_start() fail.
2006-08-10 11:14:00 +00:00
marko
7255b3fdc5 branches/zip: page_zip_decompress_low(): Clear the node_ptr during
initial decompression, in case the record will be deleted and the
space will be reused by a smaller record.

page_zip_clear_rec_disable: Note the possibility of a page_zip_validate()
failure when the space of a deleted record is reused by a smaller record.
2006-08-09 11:17:59 +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
8dd095e7bb branches/zip: recv_parse_or_apply_log_rec_body(): Note that
MLOG_COMP_REC_MIN_MARK is allowed on a compressed page.
2006-08-07 11:35:03 +00:00
marko
00ddce117d branches/zip: Minor cleanup.
row_upd_sec_index_entry(): Remove redundant goto.  Replace duplicated
cleanup code with goto func_exit.

mtr_memo_slot_release(): Eliminate the #else branch of #ifdef UNIV_DEBUG
by reorganizing the code.
2006-08-07 08:12:39 +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
d97b448b22 branches/zip: dict_check_tablespaces_and_store_max_id():
Determine zip_size in kilobytes, pass on in bytes.
2006-08-04 12:35:43 +00:00
marko
bbcdac2c13 branches/zip: Fix the decompression of deleted records containing externally
stored columns.

page_zip_decompress(): We indeed need to clear the BLOB pointers of deleted
records twice.  This implies that we also need to invoke rec_get_offsets()
twice for each record on a leaf page.  Add clarifying comments.

page_zip_clear_rec(): Add the flag page_zip_clear_rec_disable for
disabling the clearing of deleted records.
2006-08-04 11:46:20 +00:00
marko
8ebc271948 branches/zip: Minor cleanup after r690. One test case still fails.
page_zip_compress_write_log(): Do not invoke page_zip_validate(), since
this is a static function and the callers already invoke page_zip_validate().

page_zip_decompress_low(): Clear the page #ifdef UNIV_ZIP_DEBUG.
Optimizations: Remove local variable "last".  Do not clear the BLOB
pointer until the modification log has been applied.  (Since r690,
it will be cleared after applying the modification log.)
Avoid calling rec_get_offsets() a second time if there are no
uncompressed columns to be restored.
2006-08-04 08:25:39 +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
marko
b355bd0fbc branches/zip: Fix some crash recovery bugs.
dict_load_table(): Initialize table->flags with zip_size.

mlog_parse_nbytes(), mlog_parse_string(): Add parameter page_zip and
write the changes also to the compressed page if one is specified.
Assert that these functions are not called on FIL_PAGE_INDEX pages.

buf_page_io_complete(): Replace block->frame with frame where appropriate.

recv_parse_or_apply_log_rec_body(): Add ut_a(!page_zip) where appropriate.

page_parse_delete_rec_list(): Add parameter page_zip.
2006-08-02 05:49:15 +00:00