Commit graph

543 commits

Author SHA1 Message Date
marko
0e31dbaca0 branches/zip: Clean up fast index creation.
row_merge_remove_index(), row_merge_rename_index(): Remove risky sprintf()
calls.  Make use of named literals and que_eval_sql().
2007-04-11 12:42:54 +00:00
marko
e2a6db409f branches/zip: Some more cleanup of fast index creation.
Move more definitions from row0mysql.h to row0mysql.c.  Remove the
unused definition of merge_thread.

merge_index_def_t: Replace merge_index_field_t** with merge_index_field_t*.
Use mem_heap_strdup() when copying strings.

ha_innobase::add_index(): Avoid excessive use of current_thd.
2007-04-11 12:17:55 +00:00
marko
f2bcb9cab9 branches/zip: row_merge_sort_linked_list_in_disk(): Remove some unnecessary
assignments.  A memory leak remains at "goto error_handling": the memory
allocated with row_merge_block_create() in the beginning of this function
will not be freed.
2007-04-11 09:42:50 +00:00
marko
d33e525a08 branches/zip: Initial clean up of the merge sort subsystem.
Define the merge_rec_ structures in row0merge.c instead of
row0merge.h.  They are not used in the interface defined in row0merge.h.

row_merge_create_file_structure(): Rename to row_merge_file_create().
Input a pointer to a pre-allocated block of memory.

row_merge_read_clustered_index(): Replace merge_file_t** with merge_file_t*.

row_merge_sort_and_insert_thread(): Remove the declaration.
This function was never defined or called.

row_merge_is_index_usable(): Correct the formatting.

row_build_index_for_mysql(): Allocate an array of merge_file_t instead
of an array of pointers to merge_file_t.
2007-04-11 08:16:14 +00:00
marko
43382b1aba branches/zip: Rename INFORMATION_SCHEMA.INNODB_BUDDY to INNODB_ZIP. 2007-04-10 08:23:11 +00:00
marko
35db9631fd branches/zip: Add statistics on page compression and decompression counts.
ha_innodb.cc: Add the columns COMPRESSED, COMPRESSED_OK, DECOMPRESSED
to INFORMATION_SCHEMA.INNODB_BUDDY.

page_zip_compress_count[], page_zip_compress_ok[]: New statistic counters,
incremented in page_zip_compress().

page_zip_decompress_count[]: New statistic counter,
incremented in page_zip_decompress().
2007-04-10 08:11:49 +00:00
marko
1ac0e7f098 branches/zip: Fix the merge of branches/fast-index-creation -r1413 in r1414.
innodb.test: The error code 1540 has been renumbered to 1542.
innodb.result: Adjust the expected value of Innodb_buffer_pool_pages_total.
Something may have changed in the BLOB handling in branches/zip.

ha_innodb.cc: Add ha_innobase:: prefix to some DBUG_ENTER macros.

row_merge_create_temporary_table(): Free the heap only after invoking
row_create_table_for_mysql().  The table->col_names points to the heap
until the system columns are added by row_create_table_for_mysql().

TODO: use the filename-safe encoding in temporary table names.  Test
extensively under Valgrind and fix all errors found.  Eliminate
merge_rec_t and rewrite row0merge.c to write the records directly to
the merge blocks.
2007-04-04 14:26:06 +00:00
marko
fc65b08f53 branches/zip: Merge branches/fast-index-creation -r1413.
Fix some bugs.  The tests innodb and innodb-index fail, but that might
be due to an old MySQL source tree being used.
2007-04-04 11:05:33 +00:00
marko
4d6805f2a8 branches/zip: Merge revisions 1322:1402 from trunk. 2007-04-02 05:39:41 +00:00
marko
d753d3e83c branches/zip: Make TRUNCATE TABLE recreate single-table tablespaces.
dict_truncate_index_tree(): Add the parameter space for specifying the
new tablespace identifier of a single-table tablespace that has been
recreated.  When SYS_INDEXES.PAGE_NO == FIL_NULL, do not abort but
create the index tree.

fil_discard_tablespace(): Pass the return code from fil_delete_tablespace().

row_truncate_table_for_mysql(): Attempt to discard and recreate
single-table tablespaces.  Reassign the tablespace identifier both in
the data dictionary (SYS_TABLES and SYS_INDEXES) and in the data
dictionary cache.
2007-03-29 08:51:13 +00:00
marko
dc2e916070 branches/zip: Minor cleanup in rollback.
trx_undo_left(): Add const qualifiers.

trx_undo_page_report_insert(): Use exact trx_undo_left() limit.
Remove a duplicated trx_undo_left() check.

trx_undo_page_report_modify(): Eliminate the local variable len.
Document that no prefix for BLOBs needs to be stored in the undo log.
Lump two trx_undo_left() checks together.
2007-03-29 07:13:22 +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
acb39de88b branches/zip: Make dtuple_big_rec_free() an inline function. 2007-03-28 18:31:16 +00:00
marko
b4715b5d5e branches/zip: buf_LRU_block_free_non_file_page(): Flag block->frame
allocated before overwriting some fields and flagging the frame freed.
Some of the buffer frame may have been flagged freed by the user
(such as mem_heap).
2007-03-28 11:07:28 +00:00
marko
8256b83f77 branches/zip: Add Valgrind instrumentation to the InnoDB memory management
functions.

ut_malloc_low(): Flag the block with UNIV_MEM_ALLOC().  Do not flag the
block with UNIV_MEM_FREE() in ut_free(), because it would cause bogus
Valgrind warnings in the underlying memory allocator.

mem_pool_create(): Flag the data area with UNIV_MEM_FREE().

mem_pool_fill_free_list(): Flag the area header with UNIV_MEM_ALLOC().

mem_area_alloc(): Flag the data area with UNIV_MEM_ALLOC().

mem_area_free(): Flag the data area with UNIV_MEM_FREE().

mem_heap_alloc(): Flag the buffer with UNIV_MEM_ALLOC().

mem_heap_block_free(): Flag the block with UNIV_MEM_FREE().

mem_heap_free_top(): Flag the block with UNIV_MEM_FREE().
2007-03-28 09:02:55 +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
72b15b170a branches/zip: Add the pseudo table INFORMATION_SCHEMA.INNODB_BUDDY
for displaying buddy allocator statistics.

buf_buddy_used[], buf_buddy_relocated[]: Declare as global symbols.

mysql_declare_plugin(innobase): Add MYSQL_INFORMATION_SCHEMA_PLUGIN
for innobase_is_buddy ("INNODB_BUDDY").
2007-03-12 12:01:45 +00:00
marko
bab6e2faf5 branches/zip: dict_mem_table_free(): Remove the call
ut_free(table->col_names) that should have been removed in r1264,
which made the temporary memory allocations use a caller-supplied heap.
2007-03-05 09:13:33 +00:00
marko
9b765549b4 branches/zip: Merge revisions 1271:1322 from trunk. 2007-03-01 13:53:57 +00:00
marko
d5028fac23 branches/zip: ibuf_set_free_bits(): Rename to ibuf_set_free_bits_func(),
and remove the max_val parameter unless #ifdef UNIV_IBUF_DEBUG
2007-03-01 11:33:26 +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
a1475f6990 branches/zip: dict_table_copy_types(), dict_index_copy_types(): Add const
qualifiers.  Correct the documentation of the parameters.
2007-02-28 16:04:19 +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
eddd572abd branches/zip: Split UNIV_IBUF_COUNT_DEBUG from UNIV_IBUF_DEBUG. 2007-02-27 11:56:38 +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
eb02061cdf branches/zip: page_cur_rec_field_extends(): Fix compilation errors that
were introduced when reducing the memory footprint of the data dictionary
cache (Bug #20877), around r834.  This function is only compiled if
PAGE_CUR_LE_OR_EXTENDS is defined in page0cur.h.
2007-02-20 13:50:39 +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
ea9a89da09 branches/zip: page_zip_get_trailer_len(), page_zip_available():
Replace the parameter "dict_index_t* index" with "ibool is_clust".

dict_index_is_clust(): Add __attribute__((pure)).
2007-02-19 14:51:44 +00:00
marko
df5a9376ea branches/zip: buf_LRU_search_and_free_block(): Do not try to preserve
compressed pages, because doing so would require a call to
buf_buddy_alloc(), which in turn can invoke buf_LRU_get_free_block()
and buf_LRU_search_and_free_block(), potentially infinite recursion.
2007-02-19 14:23:32 +00:00
marko
9c663a0c46 branches/zip: buf_LRU_search_and_free_block(): Avoid freeing compressed-only
pages when they do not occupy too much of the buffer pool.

buf0buddy.c, buf0buddy.h: Export buf_buddy_n_frames and buf_buddy_min_n_frames.
2007-02-16 09:22:50 +00:00
marko
5e0dcfae3f branches/zip: Add statistic counters to the buddy allocator.
buf_buddy_n_frames: Number of buffer frames allocated for the buddy system
buf_buddy_used[]: Counts of allocated blocks, by buddy size.
buf_buddy_relocated[]: Counts of blocks relocated, bu buddy size.

buf_buddy_alloc_clean(): Note the added configuration parameter
buf_buddy_min_n_frames: Preferred minimum buf_buddy_n_frames
2007-02-13 12:41:02 +00:00
marko
6f6aefb553 branches/zip: buf_LRU_get_free_block(): Add an UNIV_UNLIKELY hint
around zip_size.  zip_size will be 0 most of the time.
2007-02-13 11:21:57 +00:00
marko
0aff0fdfd2 branches/zip: buf_page_get_gen(): After allocating an uncompressed page for
decompression, check that the compressed block has not been
buffer-fixed or I/O-fixed.  This race condition was introduced in r1286.
2007-02-13 11:15:27 +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
75cf6705ac branches/zip: buf_page_init_for_read(): Defer the costly calls to
buf_buddy_alloc() until after the block has been found not to exist
in the buffer pool.

buf_buddy_alloc(), buf_buddy_alloc_low(): Make lru an output parameter.
Improve documentation.

buf_page_init_for_read(): Simplify the code.  Check buf_page_hash_get()
again if buf_buddy_alloc() released buf_pool->mutex.
2007-02-08 14:19:55 +00:00
marko
5035ff1af4 branches/zip: buf_page_create(): Do not IO-fix or X-latch the block
when not invoking buf_buddy_alloc().
2007-02-08 12:33:54 +00:00
marko
76fa1cfbdd branches/zip: buf_page_init_for_read(): Do not allocate an uncompressed page
frame when reading compressed pages, unless crash recovery is in progress.

buf_page_read_low(): Adapt for buf_page_init_for_read() returning
buf_page_t* instead of buf_block_t*.
2007-02-08 12:03:03 +00:00
marko
bedc6a976b branches/zip: buf_page_init_for_read(), buf_page_create(): Note in the
function comments that buf_page_init_for_read() does not perform the
state transition to FILE_PAGE.  This should have been done in r1286.
2007-02-08 09:08:11 +00:00
marko
1f0b739f4f branches/zip: Do not decompress blocks in buf_page_init_for_read(),
but in buf_page_get_gen().  Adjust comments.  This prevents
unnecessary decompression in read-ahead when the compressed block
exists in the buffer pool.

If the block does not exist in the buffer pool, read-ahead will still
allocate an uncompressed page and decompress the block.

Move buf_block_init_low() and buf_zip_decompress() earlier in the file,
because some compilers are unable to inline functions that are defined
after the invocation.

buf_page_get_gen(): Decompress the block if needed.

buf_page_init_for_read(): Do not decompress.
2007-02-07 13:59:43 +00:00
marko
52f7bb36ca branches/zip: page_zip_write_rec(): Treat records containing externally
stored columns as a special case.

page_zip_write_rec_ext(): New function for writing records containing
externally stored columns.
2007-02-05 14:05:39 +00:00
marko
8fb1f51344 branches/zip: page_zip_decompress_clust(): Optimize the case when the
record does not contain externally stored columns.

page_zip_decompress_clust_ext(): New function for decompressing records
containing externally stored columns.
2007-02-05 13:20:00 +00:00
marko
2633b08830 branches/zip: ha_innobase::create(): Do not test create_info->used_fields
before testing create_info->avg_row_length, because otherwise the table
would be converted to uncompressed format by CREATE INDEX and possibly
other statements.
2007-02-05 12:17:11 +00:00
marko
ec06cfdb00 branches/zip: Introduce separate functions for handling records containing
externally stored columns.

page_zip_compress_clust_ext(), page_zip_apply_log_ext():
New functions.

page_zip_compress_clust(), page_zip_apply_log(): Check rec_offs_any_extern()
and avoid invoking the costly loop in most cases.

Similar optimizations can be made in page_zip_decompress_clust() and
page_zip_write_rec().
2007-02-05 11:19:25 +00:00
marko
8ef3075630 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