Commit graph

46 commits

Author SHA1 Message Date
marko
c8bbe754b9 branches/zip: Minor performance tuning based on measurement data
on mispredicted branches: opcontrol --event=BR_CND_MISSP_EXEC:45000

UT_SORT_FUNCTION_BODY(): Copy the array with memcpy(3).

cmp_dtuple_rec_with_match(), cmp_rec_rec_with_match(),
cmp_debug_dtuple_rec_with_match(): Add UNIV_UNLIKELY hints around
tests for REC_INFO_MIN_REC_FLAG.
2007-10-26 14:05:54 +00:00
marko
021fea8f15 branches/zip: Add UNIV_UNLIKELY hints to help branch prediction. 2007-10-26 12:31:48 +00:00
marko
8bed4c4c3f branches/zip: Do not access the fields of dfield_t directly.
dfield_dup(): New function for duplicating the data pointed to by dfield_t.

dfield_set_len(), dfield_set_data(): Add Valgrind instrumentation.
2007-10-23 06:46:12 +00:00
marko
df4c733df7 branches/zip: Initialize dfield_t::ext as soon as possible. This should
fix the bugs introduced in r1591.

row_rec_to_index_entry_low(): Clear "n_ext".  Do not allow it to be NULL.
Add const qualifier to dict_index_t*.

row_rec_to_index_entry(): Add the parameters "offsets" and "n_ext".

btr_cur_optimistic_update(): Add an assertion that there are no externally
stored columns.  Remove the unreachable call to btr_cur_unmark_extern_fields()
and the preceding unnecessary call to rec_get_offsets().

btr_push_update_extern_fields(): Remove the parameters index, offsets.
Only report the additional externally stored columns of the update vector.

row_build(), trx_undo_rec_get_partial_row(): Flag externally stored columns
also with dfield_set_ext().

rec_copy_prefix_to_dtuple(): Assert that there are no externally stored
columns in the prefix.

row_build_row_ref(): Note and assert that the index is a secondary index,
and assert that there are no externally stored columns.

row_build_row_ref_fast(): Assert that there are no externally stored columns.

rec_offs_get_n_alloc(): Expose the function.

row_build_row_ref_in_tuple(): Assert that there are no externally stored
columns in a record of a secondary index.

row_build_row_ref_from_row(): Assert that there are no externally stored
columns.

row_upd_check_references_constraints(): Add the parameter offsets, to
avoid a redundant call to rec_get_offsets().

row_upd_del_mark_clust_rec(): Add the parameter offsets.  Remove
duplicated code.

row_ins_index_entry_set_vals(): Copy the external storage flag.

sel_pop_prefetched_row(): Assert that there are no externally stored
columns.

row_scan_and_check_index(): Copy offsets to a temporary heap across
the invocation of row_rec_to_index_entry().
2007-10-17 12:13:29 +00:00
marko
22b01120b8 branches/zip: Define the macro rec_offs_init() and use it for initializing
offsets_[] arrays, as suggested by Vasil.

rec_offs_set_n_alloc(): Declare as a public function.  Assert that
n_alloc > REC_OFFS_HEADER_SIZE.

rec_offs_get_n_alloc(): Assert that n_alloc > REC_OFFS_HEADER_SIZE.
2007-09-28 07:05:57 +00:00
marko
ff9f1a140b branches/zip: Add some const qualifiers to input parameters.
rec_get_converted_size_comp(), rec_convert_dtuple_to_rec_comp(),
rec_convert_dtuple_to_rec_new(), rec_convert_dtuple_to_rec(): Add a
const qualifier to dict_index_t*.

row_search_on_row_ref(): Add const qualifiers to the dict_table_t*
and dtuple_t* parameters.  Note that pcur is an "out" parameter
and mtr is "in/out".
2007-09-26 09:12:23 +00:00
marko
5c9122e753 branches/zip: Add some const qualifiers or in/out comments to the
dict_index_t* and dict_table_t* parameters of some functions.
2007-09-24 13:29:18 +00:00
marko
5c749fa375 branches/zip: Reduce internal memory fragmentation.
mem_alloc2(): New macro.  This is a variant of mem_alloc() that
returns the allocated size, which is equal to or greater than
the requested size.

mem_alloc_func(): Add the output parameter *size for the allocated size.
When it is set, adjust the parameter passed to mem_heap_alloc().

rec_copy_prefix_to_buf_old(), rec_copy_prefix_to_buf(): Use mem_alloc2()
instead of mem_alloc().
2007-09-21 12:45:46 +00:00
marko
a44c590508 branches/zip: Add diagnostic printout.
rec_print_comp(): New function, sliced from rec_print_new().

rec_print_old(), rec_print_comp(): Print the untruncated length of the column.

row_merge_print_read, row_merge_print_write, row_merge_print_cmp:
New flags, to enable debug printout in UNIV_DEBUG builds.

row_merge_tuple_print(): New function for UNIV_DEBUG builds.

row_merge_read_rec(): Obey row_merge_print_read.

row_merge_buf_write(), row_merge_write_rec_low(),
row_merge_write_eof(): Obey row_merge_print_write.

row_merge_cmp(): Obey row_merge_print_cmp.
2007-09-21 08:07:58 +00:00
marko
15b12a703a branches/zip: cmp_rec_rec_simple(): Compare n_uniq columns instead of
all columns present in offsets.  Add a const qualifier to the
dict_index_t* parameter.
2007-09-19 11:31:00 +00:00
marko
52c0513083 branches/zip: rec_init_offsets(): Fix a bug that was introduced in r1518:
Correctly handle node pointer records containing variable-length columns
with two-byte length.
2007-09-19 09:05:16 +00:00
marko
5288876e23 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
f839b3f390 branches/zip: Merge 1556:1571 from trunk. 2007-06-12 10:59:01 +00:00
marko
fd91f7bb76 branches/zip: Reimplement merge sort in fast index creation.
The creation of the primary key does not work.  We will have to flag
externally stored columns and copy the externally stored part from
the old table.

row_build_index_for_mysql(): Rename to row_merge_build_indexes().
Move from row0mysql.c to row0merge.c.

Remove private declarations from row0merge.h.  Make many functions static
in row0merge.c.

cmp_rec_rec_simple(): A new comparison function.

dict_index_get_min_size(): New function.

OS_FILE_FROM_FD(fd): A macro for converting from int to os_file_t.

rec_convert_dtuple_to_rec_comp(): Make the interface lower-level.

rec_get_converted_size_comp(): Return also extra_size.

UT_SORT_FUNCTION_BODY(): Remove reference to an obsolete test program.

row_rec_to_index_entry_low(): New function.

row0merge.c: Implement merge sort based on file streams instead of
fixed-size blocks.  Sort the small blocks as arrays of dfield_t*,
because it is faster than invoking rec_get_offsets() for every
comparison.
2007-06-08 07:37:07 +00:00
marko
2d90ae68e7 branches/zip: Merge 1553:1556 from trunk. 2007-06-08 07:05:17 +00:00
marko
7fbc04fcdc branches/zip: Merge 1533:1553 from trunk. 2007-06-06 11:07:37 +00:00
marko
d75e64f98a branches/zip: Merge 1493:1533 from trunk.
Make use of UT_BITS_IN_BYTES().
2007-05-29 08:48:16 +00:00
marko
f1706a1355 branches/zip: rec_get_offsets_reverse(): Fix the type of the parameter
node_ptr.
2007-05-22 11:55:07 +00:00
marko
2a77ce2769 branches/zip: Refactor some code for handling records in ROW_FORMAT=COMPACT.
rec_get_converted_size_new(): Rename to rec_get_converted_size_comp().
Add const qualifier to dtuple.  Remove the assertion
dict_table_is_comp(index->table), because this function will be invoked
when populating the temporary files in fast index creation.

rec_convert_dtuple_to_rec_new(): Rename to rec_convert_dtuple_to_rec_comp().
Add parameter "extra".

rec_init_offsets_comp_ordinary(): New function.  Used in rec_init_offsets().
2007-05-22 11:12:35 +00:00
marko
e7284367dc 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
65a34315bf branches/zip: Clean up.
cmp_rec_rec_with_match(): Initialize ret=0.  Remove assignments ret=0.

rec_init_offsets(): Remove bogus comment.
2007-04-17 08:21:28 +00:00
marko
33c1125d55 branches/zip: Merge revisions 1322:1402 from trunk. 2007-04-02 05:39:41 +00:00
marko
e45f4cdaeb branches/zip: Speed up rec_offs_any_extern() and rec_offs_n_extern()
by adding the REC_OFFS_EXTERNAL flag to rec_offs_base(offsets)[0].

This reduces the processor usage of page_zip_write_rec() by about 40%
in one test case.  The code could be sped up further by testing
rec_offs_any_extern() outside of loops that check rec_offs_nth_extern().
The vast majority of records does not contain any externally stored columns.
2007-02-02 16:20:48 +00:00
marko
c712838401 branches/zip: Merge revisions 1165:1206 from trunk. 2007-01-18 12:58:39 +00:00
marko
e24afbc387 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
a3d72680f6 branches/zip: Add const qualifiers to read-only pointers.
rec_get_nth_field_offs_old(): Split from rec_get_nth_field_old().

rec_get_nth_field_old(): Reimplement as a constness-preserving macro.

dict_drop_index_tree(), dict_truncate_index_tree(): Note that rec is
an in/out parameter, as the B-tree root page number will be updated.
2006-10-26 08:52:14 +00:00
marko
98a829723c branches/zip: Add const qualifiers to function parameters, mostly dtuple_t. 2006-10-20 08:30:07 +00:00
marko
e8a779e73e 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
6bf52fdaca 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
a54a2bead6 branches/zip: Add const qualifiers to read-only rec_t* parameters
of rec accessor functions.
2006-10-16 11:42:46 +00:00
marko
77ebaf6f33 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
9b59bd8575 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
9a16aac783 branches/zip: Merge revisions 804:838 from trunk. 2006-09-19 10:14:07 +00:00
marko
64f3cee67f 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
20de0a2ad7 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
6748a82b84 branches/zip: Remove GCC 4.0.4 warnings from
make AM_CFLAGS='-std=c89 -Wall -W -pedantic'
2006-05-10 13:58:35 +00:00
marko
df85f7287c branches/zip: Minor fixes
trx-undo_prev_version_build(): Pass offsets==NULL to
rec_set_field_extern_bits().

rec_set_field_extern_bits(), rec_set_field_extern_bits_new():
Accept offsets==NULL.

row_upd_rec_in_place(): Remove the bogus comment that the function
would only be invoked on a clustered index.  Remove the related
debug assertion.
2006-03-16 09:44:52 +00:00
marko
2e08171ada branches/zip: Bug fixes for BLOB handling. At least one bug remains:
page_zip_dir_delete() will need to handle BLOBs.

rec_set_field_extern_bits(), rec_set_field_extern_bits_new():
Add parameter offsets.

rec_offs_set_nth_extern(): New function to set an extern bit in offsets.
This will be called when an extern bit is set in a record.

page_cur_rec_insert(), page_cur_insert_rec_low(): Document that the
parameter "offsets" is in/out.

page_zip_dir_delete(): Note that the array of BLOB pointers will need
to be shifted.

page0zip.ic: Document the entry type for clearing a record.

page_zip_available(): Add parameter "index".  Remove parameters
"is_leaf" and "is_clustered".

page_zip_get_trailer_len(): New function for computing the trailer length
of the compressed page.

page_zip_apply_log(): Implement the modification log entry type for
clearing the data bytes of a record.

page_zip_decompress(): Initialize n_blobs when actually copying the
BLOB pointers to place.

page_zip_validate(): Add diagnostic messages for failures.  Check
also m_start, m_end, and n_blobs.

page_zip_write_blob_ptr(): Add page_zip_validate() assertion.
2006-03-14 14:38:45 +00:00
marko
748da76442 branches/zip: Bug fixes
rec_get_offsets_reverse(): Calculate extra_size correctly.

page_zip_apply_log(): Fix an off-by-one error in comparison.
Replace heap_status with hs where possible.
Increment the heap_no in heap_status correctly.

page_zip_decompress(): Eliminate the local variable "err".
Check for Z_STREAM_END only at the start of a record, so that
incomplete records will always be detected.

page_zip_write_rec(): Calculate the address of "storage" in the
same way as elsewhere.  Add TODO comments regarding the handling
of the uncompressed fields (BLOB pointers, trx_id, and roll_ptr).
2006-03-03 14:32:27 +00:00
marko
82d38b63e3 branches/zip: Merge revisions 236:247 from trunk. 2006-02-27 09:33:26 +00:00
marko
f40121415d branches/zip: Merge revisions 200:236 from trunk. 2006-02-23 19:25:29 +00:00
marko
c04ddfef05 branches/zip: Try to synchronize the updates of uncompressed and
compressed pages.

btr_root_raise_and_insert(): Distinguish root_page_zip and new_page_zip.

btr_cur_set_ownership_of_extern_field(): Do not log the write on the
uncompressed page if it will be logged for page_zip.

lock_rec_insert_check_and_lock(), lock_sec_rec_modify_check_and_lock():
Update the max_trx_id field also on the compressed page.

mlog_write_ulint(): Add UNIV_UNLIKELY hints.  Remove trailing white space.

mlog_log_string(): Remove trailing white space.

rec_set_field_extern_bits(): Remove parameter mtr, as the write will either
occur in the heap, or it will be logged at a higher level.

recv_parse_or_apply_log_rec_body(),
page_zip_write_header(): Add log record type MLOG_ZIP_WRITE_HEADER.

page_header_set_field(): Pass mtr=NULL to page_zip_write_header().

page_header_reset_last_insert(): Pass mtr to page_zip_write_header().

btr_page_set_index_id(), btr_page_set_level(),
btr_page_set_next(), btr_page_set_prev(): Pass mtr to page_zip_write_header().

row_upd_rec_sys_fields(): Pass mtr=NULL to page_zip_write_trx_id() and
page_zip_write_roll_ptr(), since the write will be logged at a higher level.

page_zip_write_header(): Add parameter mtr.
page_zip_write_header_log(): New function.

Remove rec_set_nth_field_extern_bit().
Make rec_set_nth_field_extern_bit_old() static.
Rename rec_set_nth_field_extern_bit_new()
to rec_set_field_extern_bits_new() and make it static.

row_ins_index_entry_low(): Remove bogus TODO comment.
2006-02-22 13:02:40 +00:00
marko
062c64e87e branches/zip: Prepare for in-place updates of B-tree node pointers,
BLOB pointers, trx_id, and roll_ptr.

btr_empty(), btr_create(), page_create(): Add parameter "index", as some
index information will be encoded on the compressed page.

Define REC_NODE_PTR_SIZE as 4.

Allow btr_page_reorganize() and btr_page_reorganize_low() to fail.

Define the error code DB_ZIP_OVERFLOW.

Make row_ins_index_entry_low() static.

page0zip: Encode the index, log reorganized records, and store uncompressed
fields separately from the compressed data stream.
2006-02-10 15:06:17 +00:00
marko
e12d8a0f10 branches/zip: Merge revisions 9:72 from trunk. 2005-11-29 12:30:46 +00:00
marko
88e6d6863d branches/zip:
Initial import of the zip-like compression of B-tree pages.
2005-10-27 11:48:10 +00:00
osku
c307820962 Import 5.0 code. 2005-10-27 07:29:40 +00:00