Commit 08851238 authored by marko's avatar marko

branches/zip: page_cur_insert_rec_low(): Replace rec_t* current_rec

with rec_t** current_rec.  Reposition *current_rec after calling
page_zip_reorganize().
parent c1ffbbd9
...@@ -178,9 +178,9 @@ page_cur_insert_rec_low( ...@@ -178,9 +178,9 @@ page_cur_insert_rec_low(
/*====================*/ /*====================*/
/* out: pointer to record if succeed, NULL /* out: pointer to record if succeed, NULL
otherwise */ otherwise */
rec_t* current_rec,/* in: current record after which the rec_t** current_rec,/* in/out: pointer to current record after
new record is inserted */ which the new record is inserted */
buf_block_t* block, /* in: buffer block of current_rec, or NULL buf_block_t* block, /* in: buffer block of *current_rec, or NULL
if the compressed page is not to be updated */ if the compressed page is not to be updated */
dict_index_t* index, /* in: record descriptor */ dict_index_t* index, /* in: record descriptor */
rec_t* rec, /* in: pointer to a physical record */ rec_t* rec, /* in: pointer to a physical record */
......
...@@ -235,7 +235,7 @@ page_cur_tuple_insert( ...@@ -235,7 +235,7 @@ page_cur_tuple_insert(
index, tuple, ext, n_ext); index, tuple, ext, n_ext);
offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap); offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
rec = page_cur_insert_rec_low(cursor->rec, cursor->block, rec = page_cur_insert_rec_low(&cursor->rec, cursor->block,
index, rec, offsets, mtr); index, rec, offsets, mtr);
mem_heap_free(heap); mem_heap_free(heap);
return(rec); return(rec);
...@@ -257,7 +257,7 @@ page_cur_rec_insert( ...@@ -257,7 +257,7 @@ page_cur_rec_insert(
ulint* offsets,/* in/out: rec_get_offsets(rec, index) */ ulint* offsets,/* in/out: rec_get_offsets(rec, index) */
mtr_t* mtr) /* in: mini-transaction handle, or NULL */ mtr_t* mtr) /* in: mini-transaction handle, or NULL */
{ {
return(page_cur_insert_rec_low(cursor->rec, cursor->block, return(page_cur_insert_rec_low(&cursor->rec, cursor->block,
index, rec, offsets, mtr)); index, rec, offsets, mtr));
} }
...@@ -893,9 +893,9 @@ page_cur_insert_rec_low( ...@@ -893,9 +893,9 @@ page_cur_insert_rec_low(
/*====================*/ /*====================*/
/* out: pointer to record if succeed, NULL /* out: pointer to record if succeed, NULL
otherwise */ otherwise */
rec_t* current_rec,/* in: current record after which the rec_t** current_rec,/* in/out: pointer to current record after
new record is inserted */ which the new record is inserted */
buf_block_t* block, /* in: buffer block of current_rec, or NULL buf_block_t* block, /* in: buffer block of *current_rec, or NULL
if the compressed page is not to be updated */ if the compressed page is not to be updated */
dict_index_t* index, /* in: record descriptor */ dict_index_t* index, /* in: record descriptor */
rec_t* rec, /* in: pointer to a physical record */ rec_t* rec, /* in: pointer to a physical record */
...@@ -918,11 +918,11 @@ page_cur_insert_rec_low( ...@@ -918,11 +918,11 @@ page_cur_insert_rec_low(
ut_ad(rec_offs_validate(rec, index, offsets)); ut_ad(rec_offs_validate(rec, index, offsets));
page = page_align(current_rec); page = page_align(*current_rec);
ut_ad(dict_table_is_comp(index->table) ut_ad(dict_table_is_comp(index->table)
== (ibool) !!page_is_comp(page)); == (ibool) !!page_is_comp(page));
ut_ad(!page_rec_is_supremum(current_rec)); ut_ad(!page_rec_is_supremum(*current_rec));
#ifdef UNIV_ZIP_DEBUG #ifdef UNIV_ZIP_DEBUG
ut_a(!page_zip || page_zip_validate(page_zip, page)); ut_a(!page_zip || page_zip_validate(page_zip, page));
#endif /* UNIV_ZIP_DEBUG */ #endif /* UNIV_ZIP_DEBUG */
...@@ -1021,21 +1021,21 @@ use_heap: ...@@ -1021,21 +1021,21 @@ use_heap:
rec_offs_make_valid(insert_rec, index, offsets); rec_offs_make_valid(insert_rec, index, offsets);
/* 4. Insert the record in the linked list of records */ /* 4. Insert the record in the linked list of records */
ut_ad(current_rec != insert_rec); ut_ad(*current_rec != insert_rec);
{ {
/* next record after current before the insertion */ /* next record after current before the insertion */
rec_t* next_rec = page_rec_get_next(current_rec); rec_t* next_rec = page_rec_get_next(*current_rec);
#ifdef UNIV_DEBUG #ifdef UNIV_DEBUG
if (page_is_comp(page)) { if (page_is_comp(page)) {
ut_ad(rec_get_status(current_rec) ut_ad(rec_get_status(*current_rec)
<= REC_STATUS_INFIMUM); <= REC_STATUS_INFIMUM);
ut_ad(rec_get_status(insert_rec) < REC_STATUS_INFIMUM); ut_ad(rec_get_status(insert_rec) < REC_STATUS_INFIMUM);
ut_ad(rec_get_status(next_rec) != REC_STATUS_INFIMUM); ut_ad(rec_get_status(next_rec) != REC_STATUS_INFIMUM);
} }
#endif #endif
page_rec_set_next(insert_rec, next_rec); page_rec_set_next(insert_rec, next_rec);
page_rec_set_next(current_rec, insert_rec); page_rec_set_next(*current_rec, insert_rec);
} }
page_header_set_field(page, page_zip, PAGE_N_RECS, page_header_set_field(page, page_zip, PAGE_N_RECS,
...@@ -1047,7 +1047,7 @@ use_heap: ...@@ -1047,7 +1047,7 @@ use_heap:
rec_set_n_owned_new(insert_rec, NULL, 0); rec_set_n_owned_new(insert_rec, NULL, 0);
rec_set_heap_no_new(insert_rec, heap_no); rec_set_heap_no_new(insert_rec, heap_no);
if (UNIV_LIKELY_NULL(page_zip)) { if (UNIV_LIKELY_NULL(page_zip)) {
page_zip_dir_insert(page_zip, current_rec, free_rec, page_zip_dir_insert(page_zip, *current_rec, free_rec,
insert_rec); insert_rec);
} }
} else { } else {
...@@ -1068,7 +1068,7 @@ use_heap: ...@@ -1068,7 +1068,7 @@ use_heap:
PAGE_NO_DIRECTION); PAGE_NO_DIRECTION);
page_header_set_field(page, page_zip, PAGE_N_DIRECTION, 0); page_header_set_field(page, page_zip, PAGE_N_DIRECTION, 0);
} else if ((last_insert == current_rec) } else if ((last_insert == *current_rec)
&& (page_header_get_field(page, PAGE_DIRECTION) && (page_header_get_field(page, PAGE_DIRECTION)
!= PAGE_LEFT)) { != PAGE_LEFT)) {
...@@ -1135,13 +1135,18 @@ use_heap: ...@@ -1135,13 +1135,18 @@ use_heap:
if (page_zip_reorganize(block, index, mtr)) { if (page_zip_reorganize(block, index, mtr)) {
/* The page was reorganized: /* The page was reorganized:
Seek to insert_pos to find insert_rec. */ Seek to insert_pos to find insert_rec,
and update *current_rec. */
insert_rec = page + PAGE_NEW_INFIMUM; insert_rec = page + PAGE_NEW_INFIMUM;
do { while (--insert_pos) {
insert_rec = page + rec_get_next_offs( insert_rec = page + rec_get_next_offs(
insert_rec, TRUE); insert_rec, TRUE);
} while (--insert_pos); }
*current_rec = insert_rec;
insert_rec = page
+ rec_get_next_offs(insert_rec, TRUE);
return(insert_rec); return(insert_rec);
} }
...@@ -1160,7 +1165,7 @@ use_heap: ...@@ -1160,7 +1165,7 @@ use_heap:
/* 9. Write log record of the insert */ /* 9. Write log record of the insert */
if (UNIV_LIKELY(mtr != NULL)) { if (UNIV_LIKELY(mtr != NULL)) {
page_cur_insert_rec_write_log(insert_rec, rec_size, page_cur_insert_rec_write_log(insert_rec, rec_size,
current_rec, index, mtr); *current_rec, index, mtr);
} }
return(insert_rec); return(insert_rec);
......
...@@ -540,7 +540,7 @@ page_copy_rec_list_end_no_locks( ...@@ -540,7 +540,7 @@ page_copy_rec_list_end_no_locks(
rec_t* ins_rec; rec_t* ins_rec;
offsets = rec_get_offsets(cur1_rec, index, offsets, offsets = rec_get_offsets(cur1_rec, index, offsets,
ULINT_UNDEFINED, &heap); ULINT_UNDEFINED, &heap);
ins_rec = page_cur_insert_rec_low(cur2, NULL, index, ins_rec = page_cur_insert_rec_low(&cur2, NULL, index,
cur1_rec, offsets, mtr); cur1_rec, offsets, mtr);
if (UNIV_UNLIKELY(!ins_rec)) { if (UNIV_UNLIKELY(!ins_rec)) {
/* Track an assertion failure reported on the mailing /* Track an assertion failure reported on the mailing
...@@ -705,7 +705,7 @@ page_copy_rec_list_start( ...@@ -705,7 +705,7 @@ page_copy_rec_list_start(
rec_t* cur1_rec = page_cur_get_rec(&cur1); rec_t* cur1_rec = page_cur_get_rec(&cur1);
offsets = rec_get_offsets(cur1_rec, index, offsets, offsets = rec_get_offsets(cur1_rec, index, offsets,
ULINT_UNDEFINED, &heap); ULINT_UNDEFINED, &heap);
cur2 = page_cur_insert_rec_low(cur2, NULL, index, cur2 = page_cur_insert_rec_low(&cur2, NULL, index,
cur1_rec, offsets, mtr); cur1_rec, offsets, mtr);
ut_a(cur2); ut_a(cur2);
......
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