branches/zip: btr_page_split_and_insert(): Implement fallbacks for

page_move_rec_list_start() and page_move_rec_list_end().  Relax the
conditions on insert_will_fit if page_zip is set.

page_delete_rec_list_start(): Make public.

page_zip_copy(): Clear REC_INFO_MIN_REC_FLAG if FIL_PAGE_PREV != FIL_NULL.
This commit is contained in:
marko 2006-05-15 11:43:35 +00:00
parent 9c7913d92a
commit 64678b8bc9
4 changed files with 61 additions and 17 deletions

View file

@ -1787,7 +1787,7 @@ func_start:
NULL, NULL, tuple, heap);
}
if (insert_will_fit && page_is_leaf(page)) {
if (insert_will_fit && page_is_leaf(page) && !page_zip) {
mtr_memo_release(mtr, dict_tree_get_lock(tree),
MTR_MEMO_X_LOCK);
@ -1801,7 +1801,21 @@ func_start:
new_page, new_page_zip,
move_limit, page_zip,
cursor->index, mtr))) {
ut_error;
/* For some reason, compressing new_page failed,
even though it should contain fewer records than
the original page. Copy the page byte for byte
and then delete the records from both pages
as appropriate. Deleting will always succeed. */
ut_a(new_page_zip);
page_zip_copy(new_page_zip, new_page,
page_zip, page, mtr);
page_delete_rec_list_end(move_limit - page
+ new_page, cursor->index,
ULINT_UNDEFINED, ULINT_UNDEFINED,
new_page_zip, mtr);
page_delete_rec_list_start(move_limit, cursor->index,
page_zip, mtr);
}
left_page = new_page;
@ -1815,7 +1829,21 @@ func_start:
new_page, new_page_zip,
move_limit, page_zip,
cursor->index, mtr))) {
ut_error;
/* For some reason, compressing new_page failed,
even though it should contain fewer records than
the original page. Copy the page byte for byte
and then delete the records from both pages
as appropriate. Deleting will always succeed. */
ut_a(new_page_zip);
page_zip_copy(new_page_zip, new_page,
page_zip, page, mtr);
page_delete_rec_list_start(move_limit - page
+ new_page, cursor->index,
new_page_zip, mtr);
page_delete_rec_list_end(move_limit, cursor->index,
ULINT_UNDEFINED, ULINT_UNDEFINED,
page_zip, mtr);
}
left_page = page;
@ -1888,7 +1916,7 @@ insert_failed:
buf_frame_get_page_no(page)); */
n_iterations++;
ut_ad(n_iterations < 2);
ut_ad(!insert_will_fit);
ut_ad(!insert_will_fit || insert_page_zip);
goto func_start;
}

View file

@ -700,6 +700,18 @@ page_delete_rec_list_end(
mtr_t* mtr) /* in: mtr */
__attribute__((nonnull(1, 2, 6)));
/*****************************************************************
Deletes records from page, up to the given record, NOT including
that record. Infimum and supremum records are not deleted. */
void
page_delete_rec_list_start(
/*=======================*/
rec_t* rec, /* in: record on page */
dict_index_t* index, /* in: record descriptor */
page_zip_des_t* page_zip,/* in/out: compressed page of rec, or NULL */
mtr_t* mtr) /* in: mtr */
__attribute__((nonnull(1, 2, 4)));
/*****************************************************************
Moves record list end to another page. Moved records include
split_rec. */

View file

@ -64,18 +64,6 @@ Assuming a page size of 8 kB, a typical index page of a secondary
index contains 300 index entries, and the size of the page directory
is 50 x 4 bytes = 200 bytes. */
/*****************************************************************
Deletes records from page, up to the given record, NOT including
that record. Infimum and supremum records are not deleted. */
static
void
page_delete_rec_list_start(
/*=======================*/
rec_t* rec, /* in: record on page */
dict_index_t* index, /* in: record descriptor */
page_zip_des_t* page_zip,/* in/out: compressed page of rec, or NULL */
mtr_t* mtr); /* in: mtr */
/*******************************************************************
Looks for the directory slot which owns the given record. */
@ -996,7 +984,7 @@ page_delete_rec_list_end(
/*****************************************************************
Deletes records from page, up to the given record, NOT including
that record. Infimum and supremum records are not deleted. */
static
void
page_delete_rec_list_start(
/*=======================*/

View file

@ -2957,6 +2957,22 @@ page_zip_copy(
page_zip->m_start = src_zip->m_start;
page_zip->m_end = src_zip->m_end;
if (!page_is_leaf(src)
&& UNIV_UNLIKELY(mach_read_from_4((byte*) src
+ FIL_PAGE_PREV) == FIL_NULL)
&& UNIV_LIKELY(mach_read_from_4(page
+ FIL_PAGE_PREV) != FIL_NULL)) {
/* Clear the REC_INFO_MIN_REC_FLAG of the first user record. */
ulint offs = rec_get_next_offs(
page + PAGE_NEW_INFIMUM, TRUE);
if (UNIV_LIKELY(offs != PAGE_NEW_SUPREMUM)) {
rec_t* rec = page + offs;
ut_a(rec[-REC_N_NEW_EXTRA_BYTES]
& REC_INFO_MIN_REC_FLAG);
rec[-REC_N_NEW_EXTRA_BYTES] &= ~ REC_INFO_MIN_REC_FLAG;
}
}
#if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
ut_a(page_zip_validate(page_zip, page));
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */