Commit 64678b8b authored by marko's avatar marko

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.
parent 9c7913d9
...@@ -1787,7 +1787,7 @@ btr_page_split_and_insert( ...@@ -1787,7 +1787,7 @@ btr_page_split_and_insert(
NULL, NULL, tuple, heap); 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_release(mtr, dict_tree_get_lock(tree),
MTR_MEMO_X_LOCK); MTR_MEMO_X_LOCK);
...@@ -1801,7 +1801,21 @@ btr_page_split_and_insert( ...@@ -1801,7 +1801,21 @@ btr_page_split_and_insert(
new_page, new_page_zip, new_page, new_page_zip,
move_limit, page_zip, move_limit, page_zip,
cursor->index, mtr))) { 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; left_page = new_page;
...@@ -1815,7 +1829,21 @@ btr_page_split_and_insert( ...@@ -1815,7 +1829,21 @@ btr_page_split_and_insert(
new_page, new_page_zip, new_page, new_page_zip,
move_limit, page_zip, move_limit, page_zip,
cursor->index, mtr))) { 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; left_page = page;
...@@ -1888,7 +1916,7 @@ btr_page_split_and_insert( ...@@ -1888,7 +1916,7 @@ btr_page_split_and_insert(
buf_frame_get_page_no(page)); */ buf_frame_get_page_no(page)); */
n_iterations++; n_iterations++;
ut_ad(n_iterations < 2); ut_ad(n_iterations < 2);
ut_ad(!insert_will_fit); ut_ad(!insert_will_fit || insert_page_zip);
goto func_start; goto func_start;
} }
......
...@@ -700,6 +700,18 @@ page_delete_rec_list_end( ...@@ -700,6 +700,18 @@ page_delete_rec_list_end(
mtr_t* mtr) /* in: mtr */ mtr_t* mtr) /* in: mtr */
__attribute__((nonnull(1, 2, 6))); __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 Moves record list end to another page. Moved records include
split_rec. */ split_rec. */
......
...@@ -64,18 +64,6 @@ Assuming a page size of 8 kB, a typical index page of a secondary ...@@ -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 index contains 300 index entries, and the size of the page directory
is 50 x 4 bytes = 200 bytes. */ 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. */ Looks for the directory slot which owns the given record. */
...@@ -996,7 +984,7 @@ page_delete_rec_list_end( ...@@ -996,7 +984,7 @@ page_delete_rec_list_end(
/***************************************************************** /*****************************************************************
Deletes records from page, up to the given record, NOT including Deletes records from page, up to the given record, NOT including
that record. Infimum and supremum records are not deleted. */ that record. Infimum and supremum records are not deleted. */
static
void void
page_delete_rec_list_start( page_delete_rec_list_start(
/*=======================*/ /*=======================*/
......
...@@ -2957,6 +2957,22 @@ page_zip_copy( ...@@ -2957,6 +2957,22 @@ page_zip_copy(
page_zip->m_start = src_zip->m_start; page_zip->m_start = src_zip->m_start;
page_zip->m_end = src_zip->m_end; 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 #if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG
ut_a(page_zip_validate(page_zip, page)); ut_a(page_zip_validate(page_zip, page));
#endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */ #endif /* UNIV_DEBUG || UNIV_ZIP_DEBUG */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment