Commit graph

228 commits

Author SHA1 Message Date
marko
4a7bd430ba branches/innodb+: Refuse to buffer deletes if that could lead to B-tree
pages becoming empty.  Remove work-arounds for empty pages.  This fixes
Issue #82.

ibuf_get_volume_buffered(): Add the output parameter n_recs, for returning
the minimum number of records on the page.

ibuf_insert_low(): Refuse to buffer IBUF_OP_DELETE if the page could
become empty.

btr_page_get_father_node_ptr(): Remove the work-around for the page
being empty.

page_zip_dir_delete(): Revert to the version from branches/zip.
Always invoke page_zip_clear_rec().
2008-10-23 10:22:46 +00:00
marko
a980b544cd branches/innodb+: Merge revisions 2774:2799 from branches/zip:
------------------------------------------------------------------------
  r2781 | marko | 2008-10-13 13:40:57 +0300 (Mon, 13 Oct 2008) | 1 line

  branches/zip: page_cur_delete_rec(): Call page_zip_validate_low().
  ------------------------------------------------------------------------
  r2783 | vasil | 2008-10-13 18:34:34 +0300 (Mon, 13 Oct 2008) | 9 lines

  branches/zip:

  Remove mysql-test/patches/bug37312.diff because MySQL "fixed"
  Bug#37312 by removing the test.

  http://bugs.mysql.com/37312
  http://lists.mysql.com/commits/54462
  ------------------------------------------------------------------------
  r2784 | marko | 2008-10-13 21:35:30 +0300 (Mon, 13 Oct 2008) | 1 line

  branches/zip: Add missing NULL check to the assertion added in r2781.
  ------------------------------------------------------------------------
  r2785 | marko | 2008-10-13 22:29:12 +0300 (Mon, 13 Oct 2008) | 2 lines

  branches/zip: page_cur_delete_rec(): Remove the bogus page_zip_validate_low()
  assertion that was added in r2781 and explain why it was bogus.
  ------------------------------------------------------------------------
  r2786 | calvin | 2008-10-14 19:14:47 +0300 (Tue, 14 Oct 2008) | 7 lines

  branches/zip: fix Mantis issue #96 Problem compiling ha_innodb.cc
  on 64-bit Windows

  Change the definition of srv_replication_delay from ulint to ulong.
  ulint is 64-bit on Win64.

  Approved by:	Heikki (on IM)
  ------------------------------------------------------------------------
  r2787 | calvin | 2008-10-14 19:19:41 +0300 (Tue, 14 Oct 2008) | 7 lines

  branches/zip: fix compiler warning

  Change the definition of add_on from ulint to ullint, to eliminate
  the warning in .\btr\btr0cur.c:
  conversion from 'ullint' to 'ulint', possible loss of data

  Approved by:	Heikki (on IM)
  ------------------------------------------------------------------------
  r2793 | marko | 2008-10-15 10:00:06 +0300 (Wed, 15 Oct 2008) | 2 lines

  branches/zip: row_create_table_for_mysql(), row_create_index_for_mysql():
  Note that the dictionary object will be freed.
  ------------------------------------------------------------------------
  r2794 | marko | 2008-10-15 10:32:40 +0300 (Wed, 15 Oct 2008) | 9 lines

  branches/zip: When invoking page_zip_copy_recs(), update the lock table
  and the adaptive hash index.  This should fix Issue #95 and Issue #87.

  page_zip_copy_recs(): Copy PAGE_MAX_TRX_ID as well, to have similar behavior
  to page_copy_rec_list_start() and page_copy_rec_list_end().

  btr_root_raise_and_insert(), btr_page_split_and_insert(), btr_lift_page_up():
  Update the lock table and the adaptive hash index.
  ------------------------------------------------------------------------
  r2797 | marko | 2008-10-15 13:21:54 +0300 (Wed, 15 Oct 2008) | 3 lines

  branches/zip: Introduce UNIV_ZIP_COPY for invoking page_zip_copy_recs()
  more often in B-tree operations.
  ------------------------------------------------------------------------
  r2799 | marko | 2008-10-15 14:27:42 +0300 (Wed, 15 Oct 2008) | 25 lines

  branches/zip: When the server crashes while freeing an externally stored
  column of a compressed table, the BTR_EXTERN_LEN field in the BLOB pointer
  will be written as 0.  Tolerate this in the functions that deal with
  externally stored columns.  This fixes Issue #80 and was posted at rb://26.

  Note that the clustered index record is always deleted or purged last,
  after any secondary index records referring to it have been deleted.

  btr_free_externally_stored_field(): On an uncompressed table, zero out
  the BTR_EXTERN_LEN, so that half-deleted BLOBs can be detected after
  crash recovery.

  btr_copy_externally_stored_field_prefix(): Return 0 if the BLOB has been
  half-deleted.

  row_upd_ext_fetch(): Assert that the externally stored column exists.

  row_ext_cache_fill(): Allow btr_copy_externally_stored_field_prefix()
  to return 0.

  row_sel_sec_rec_is_for_blob(): Return FALSE if the BLOB has been half-deleted.
  This is correct, because the clustered index record would have been deleted
  or purged last, after any secondary index records referring to it had been
  deleted.
  ------------------------------------------------------------------------
2008-10-15 12:09:17 +00:00
marko
f7e76f23c1 branches/innodb+: Merge revisions 2678:2774 from branches/zip. 2008-10-11 19:37:21 +00:00
marko
99d6926335 branches/innodb+: page_zip_dir_delete(): Do not clear the last record on
a secondary index leaf page, because that could break delete buffering.

btr_page_get_father_node_ptr(): Remove a TODO comment regarding this.
2008-09-30 11:21:39 +00:00
marko
8638150c6c branches/innodb+: Merge 2579:2637 from branches/zip. 2008-09-17 19:52:30 +00:00
sunny
d0e8003b2f branches/innodb+: Merge revisions 2460:2579 from branches/zip
The followin mysql-tests failed (and they are known to fail):
main.information_schema        	[ fail ]
main.innodb_file_per_table_basic[ fail ]
main.type_bit_innodb           	[ fail ]

Tested against : MYSQL_SERVER_VERSION  "5.1.28"
2008-08-09 00:15:46 +00:00
inaam
c5dacc2914 branches/innodb+: Merge revisions 2344:2454 from branches/zip 2008-05-14 15:43:19 +00:00
marko
0c5b8df908 branches/innodb+: Merge revisions 2340:2343 from branches/zip 2008-03-03 12:57:07 +00:00
marko
5cf58ce919 branches/innodb+: Merge revisions 2322:2340 from branches/zip 2008-03-03 10:25:27 +00:00
sunny
57fc43166d branches/innodb+: Merge revisions 2315:2322 from branches/zip 2008-02-27 06:50:51 +00:00
marko
1d1dc31a06 branches/zip: Introduce UNIV_INTERN, a linkage specifier for InnoDB-global
symbols.  Use it for all definitions of non-static variables and functions.

lexyy.c, make_flex.sh: Declare yylex as UNIV_INTERN, not static.  It is
referenced from pars0grm.c.

Actually, according to
	nm .libs/ha_innodb.so|grep -w '[ABCE-TVXYZ]'
the following symbols are still global:

* The vtable for class ha_innodb
* pars0grm.c: The function yyparse() and the variables yychar, yylval, yynerrs

The required changes to the Bison-generated file pars0grm.c will be addressed
in a separate commit, which will add a script similar to make_flex.sh.

The class ha_innodb is renamed from class ha_innobase by a #define.  Thus,
there will be no clash with the builtin InnoDB.  However, there will be some
overhead for invoking virtual methods of class ha_innodb.  Ideas for making
the vtable hidden are welcome.  -fvisibility=hidden is not available in GCC 3.
2008-02-06 14:17:36 +00:00
marko
4800aa4672 branches/zip: page_zip_reorganize(): Drop the adaptive search index before
attempting to reorganize the page, not after the reorganization has succeeded.
2008-01-07 13:40:12 +00:00
marko
97f96fb6d0 branches/zip: page0zip.c: Add page_zip_fail() diagnostics to hopefully all
decompression failures.

page_zip_fields_decode(): Add page_zip_fail() diagnostics.

page_zip_apply_log(): Remove double space in page_zip_fail() printout.

page_zip_decompress_node_ptrs(), page_zip_decompress_sec(),
page_zip_decompress_clust_ext(), page_zip_decompress_clust(),
page_zip_decompress(): Add page_zip_fail() diagnostics for inflate()
failures and other errors.
2008-01-03 10:13:11 +00:00
marko
5c7fb88749 branches/zip: Allow the uncompressed page size to be settable by setting
just one parameter: UNIV_PAGE_SIZE_SHIFT.

UNIV_PAGE_SIZE, BUF_BUDDY_SIZES: Define in terms of UNIV_PAGE_SIZE_SHIFT.

BUF_BUDDY_LOW_SHIFT: New macro, to simplify the definition of BUF_BUDDY_LOW
and BUF_BUDDY_SIZES.

PAGE_ZIP_DIR_SLOT_MASK: Relax the compile-time check.  This bitmask must be
one less than a power of two, and at least UNIV_PAGE_SIZE - 1.
2007-12-20 13:23:23 +00:00
marko
9e26020ceb branches/zip: page_zip_decompress(): Implement a proper check if there
is an overlap between BLOB pointers and the modification log or the
zlib stream.

page_zip_decompress_clust_ext(): Remove the improper check.  The
d_stream->avail_in cannot be decremented here, because we do not know
at this point if the record is deleted.  No space is reserved for the
BLOB pointers in deleted records.

page_zip_decompress_clust(): Check for the overlap here, right before
copying the BLOB pointers.

page_zip_decompress_clust(): Also check that the target column is long
enough, and return FALSE instead of ut_ad() failure.
2007-12-13 13:12:20 +00:00
vasil
85f1c90d74 branches/zip:
Add some clarification to a comment.
2007-12-13 13:04:47 +00:00
marko
c2505f9bb3 branches/zip: page_zip_decompress_node_ptrs(): Remove the local variable
is_clust, to avoid a warning about unused variable when the definition
of page_zip_fail() is empty.
2007-12-13 12:45:43 +00:00
marko
3802ff3f8c branches/zip: page0zip.c: Add more page_zip_fail() diagnostics to
some decompression functions.

page_zip_apply_log_ext(), page_zip_apply_log(): Call page_zip_fail()
with appropriate diagnostics before returning NULL.

page_zip_decompress_node_ptrs(), page_zip_decompress_sec(),
page_zip_decompress_clust(): When detecting that the zlib stream
followed by the modification log overlaps the trailer, do not
let an assertion fail, but invoke page_zip_fail() and return FALSE.
Corrupt data should never lead into assertion failures in decompression
functions.
2007-12-13 11:32:11 +00:00
marko
48eb4c4b67 branches/zip: page0zip.c: Define and use the auxiliary macros
ASSERT_ZERO() and ASSERT_ZERO_BLOB() for asserting that certain
blocks of memory are filled with zero.
2007-12-13 10:57:30 +00:00
marko
4e37e2f826 branches/zip: Minor cleanup.
buf_page_get_release_on_io(): Removed this unused function.

ibuf_build_entry_from_ibuf_rec(): Justify why it is not necessary to
add system columns to the dummy table pointed to by the dummy secondary index.

page_zip_rec_set_deleted(): Add a page_zip_validate() assertion.
2007-11-28 11:22:25 +00:00
marko
7be8ffc2c6 branches/zip: Introduce the function page_zip_fail_func() and
the wrapper macro page_zip_fail() for displaying error messages.
When the error output is enabled (at compile-time), a breakpoint
may be set in page_zip_fail_func to easily debug all decompression
errors in the context where they occur.
2007-11-15 10:56:34 +00:00
marko
58bea7acaf branches/zip: Undo r2079 and fix the cause of uninitialized data bytes
in page_zip_decompress().

page_zip_decompress_clust(), page_zip_decompress_clust_ext(): Zero-fill
the columns DB_TRX_ID and DB_ROLL_PTR on the uncompressed page.
2007-11-09 15:32:37 +00:00
marko
97a03baf41 branches/zip: page_zip_decompress(): Note that the uncompressed page
may contain uninitialized bytes when the space of a deleted record
is reused by a shorter record.
2007-11-09 12:09:29 +00:00
marko
96c6fe18b1 branches/zip: Improve Valgrind instrumentation.
page_zip_get_trailer_len(), page_zip_write_header(): Correct the
UNIV_MEM_ASSERT_RW() assertions.

page_zip_validate(): Read the validity bits of page, page_zip, and
page_zip->data.
2007-11-07 15:58:39 +00:00
marko
cf7d407119 branches/zip: Improve Valgrind instrumentation.
page_zip_decompress(): Assert that the uncompressed page is completely defined.

page_zip_validate(): Assert that the compressed and uncompressed pages are
completely defined.  Fetch the "valid" bits, so that they can be examined
when run under valgrind --db-attach=yes.
2007-11-07 14:14:47 +00:00
marko
98546caa6f branches/zip: page_zip_apply_log(): Write the status bits of the record
before invoking rec_get_offsets().
2007-11-07 13:50:53 +00:00
marko
4b23d55164 branches/zip: page_zip_compress(): Do not call deflate(&c_stream, Z_FULL_FLUSH)
unless more than 6 bytes are available for the output.  This should remove
the possibility that deflate() returns Z_OK without consuming all input.
2007-11-05 12:12:28 +00:00
marko
63968a86e6 branches/zip: page_zip_compress(): Flag the compressed stream completely
initialized, although Valgrind believes that some bits in the 7th or 8th
bytes from the end are uninitialized.  (They might be, but the decompressor
should not care about those bits after encountering the end-of-stream marker
in the compressed bit stream.)
2007-10-31 20:49:16 +00:00
marko
d1ef07b308 branches/zip: Check that page_zip->data is defined, not page_zip itself. 2007-10-31 16:14:18 +00:00
marko
589393da83 branches/zip: Improve Valgrind instrumentation.
btr_cur_optimistic_insert(): On compressed tablespaces, check that both
the compressed and the uncompressed page are completely initialized in
the beginning of the function.

page_zip_compress(): After successful compression, check that the compressed
page is completely initialized.
2007-10-31 14:27:59 +00:00
marko
15d01d3e31 branches/zip: Add some more Valgrind instrumentation.
page_zip_write_rec(), page_zip_write_blob_ptr(), page_zip_write_node_ptr(),
page_zip_write_trx_id_and_roll_ptr(), page_zip_clear_rec(),
page_zip_rec_set_deleted(), page_zip_rec_set_owned(), page_zip_dir_insert(),
page_zip_dir_delete(), page_zip_dir_add_slot(), page_zip_reorganize(),
page_zip_copy(), page_zip_get_trailer_len(), page_zip_write_header():
Assert that the complete contents of the compressed page is defined.
2007-10-31 13:19:38 +00:00
marko
f8e3c447a3 branches/zip: Improve Valgrind instrumentation.
page_zip_compress(): Assert that the contents of the uncompressed page
is entirely initialized.

page_zip_decompress(): Assert that the contents of the compressed page
is entirely initialized.  Assert that the uncompressed page is entirely
writeable.  Flag the uncompressed page uninitialized in the beginning.
2007-10-31 12:42:38 +00:00
marko
6eb43b3d44 branches/zip: Correct the Valgrind instrumentation of r2041.
Use UNIV_MEM_ASSERT_RW() instead of UNIV_MEM_VALID().  The latter
flags memory defined; the former checks that it is defined.
2007-10-31 10:44:15 +00:00
marko
b013f0d321 branches/zip: page0zip.c: Add some Valgrind instrumentation. 2007-10-30 08:19:48 +00:00
marko
65d4e6308e branches/zip: Remove const warnings reported by GCC 4.2.1.
page_cur_set_before_first(), page_cur_set_after_last(),
page_cur_position(): Add const qualifiers to buf_block_t and rec.
A better solution would be to define a const_page_cur_t and a
set of accessors, but it would lead to severe code duplication.

page_rec_get_n_recs_before(): Add const qualifiers.

page_dir_get_nth_slot(): Define as a const-preserving macro.

page_dir_slot_get_rec(), page_dir_slot_get_n_owned(),
page_dir_find_owner_slot(), page_check_dir(): Add const qualifiers.

page_rec_get_next_low(): Add const qualifiers.

page_rec_get_next_const(), page_rec_get_prev_const(): New functions,
based on the const-less page_rec_get_next() and page_rec_get_prev().

page_cur_get_page(), page_cur_get_block(), page_cur_get_page_zip(),
page_cur_get_rec(): Define as const-preserving macros.

page_cur_try_search_shortcut(), page_cur_search_with_match():
Add const qualifiers.

buf_page_get_mutex(): Add a const qualifier to buf_page_t*.

rec_get_next_ptr_const(): Const variant of rec_get_next_ptr().
2007-10-18 07:12:05 +00:00
marko
c8f0dbb1ba branches/zip: Correct the Valgrind instrumentation that was added in r1947. 2007-10-05 11:22:23 +00:00
marko
b7469c6c2f branches/zip: Add some Valgrind instrumentation.
dtuple_validate(): Detect uninitialized data.

page_cur_insert_rec_low(), page_cur_insert_rec_zip(): Assert that the
record being inserted is valid before and after insertion.
2007-10-05 08:53:28 +00:00
marko
2ddbc912e7 branches/zip: Silence most GCC 4.2.1 warnings about const pointers.
For some reason, GCC 4.2.1 ignores casts (for removing constness)
in calls to inline functions.

page_align(), ut_align_down(): Make the parameter const void*, but still
return a non-const pointer.  This is ugly, but these functions cannot be
replaced with a const-preserving macro in a portable way, given that
the pointer argument is not always pointing to bytes.

buf_block_get_page_zip(): Implement as a const-preserving macro.

buf_frame_get_page_zip(), buf_block_align(): Add const qualifiers.

lock_rec_get_prev(): Silence GCC 4.2.1 warnings.

mlog_write_initial_log_record(), mlog_write_initial_log_record_fast(),
mtr_memo_contains(): Add const qualifier to the pointer.

page_header_get_ptr(): Rewrite as page_header_get_offs(), and
implement as a macro that calls this function.
2007-10-03 12:22:29 +00:00
marko
3877f6910f 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
8634d343f7 branches/zip: Rename mem_heap_calloc() and mem_calloc() to
mem_heap_zalloc() and mem_zalloc(), because calloc() in the C runtime
library takes two size parameters, not one.

mem_heap_zalloc(): Add debug assertions.  Document that the return value
is never NULL.
2007-08-16 13:25:56 +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
8b40a79c64 branches/zip: Enable calls to inlined InnoDB functions in ha_innodb.cc,
now that all of InnoDB code is built from a single Makefile and it should
not be possible to build the modules with mutually incompatible options.

#define INSIDE_HA_INNOBASE_CC: Remove.

srv_sizeof_trx_t_in_ha_innodb_cc: Remove.

dict_table_get_low_noninlined(): Remove.  This function was unused.

Remove all _noninline functions.  Remove the _noninline suffix from
all function calls in ha_innodb.cc.
2007-06-20 08:26:26 +00:00
marko
f24fa9e6b0 branches/zip: Define mem_heap_calloc() and mem_calloc(). Use them
when allocating zero-filled memory.
2007-06-19 09:39:27 +00:00
marko
a8a3521b09 branches/zip: Merge 1556:1571 from trunk. 2007-06-12 10:59:01 +00:00
marko
42e1de99df branches/zip: Revert r1523. Passing extra parameters to SORT_FUN and CMP_FUN
of UT_SORT_FUNCTION_BODY is best done by defining SORT_FUN and CMP_FUN as
macros when needed.  The solution of r1523 allows for only one extra parameter.
2007-05-28 07:42:28 +00:00
marko
1b83baaddf branches/zip: UT_SORT_FUNCTION_BODY(): Add the parameter CTX, which will be
needed in row0merge.c for merge sorting the small blocks in main memory.
Pass CTX also to SORT_FUN.  Adjust all users.
2007-05-24 13:14:57 +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
d5c198ea28 branches/zip: Minor cleanup.
page_cur_tuple_insert(), page_cur_rec_insert(): Improve the documentation.
Note that the physical position of page_cursor may change.

page_cur_rec_insert(), page_cur_insert_rec_low(), page_cur_insert_rec_zip():
Add a const qualifier to the parameter rec.
2007-05-15 09:31:41 +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