Commit c1ffbbd9 authored by marko's avatar marko

branches/zip: Remove all references to buf_block_align() except those

from the adaptive hash index [btr_search_guess_on_hash() and
btr_search_validate()].  Some references to buf_block_align() remain
in debug builds.

btr_store_big_rec_extern_fields(): Add the parameter rec_block.

page_rec_get_next_low(): Do not assume that the page has been
allocated from the buffer pool when printing the diagnostic information.

page_cur_insert_rec_low(): Replace the parameter page_zip_des_t* page_zip
with the parameter buf_block_t* block.
parent 833c4543
......@@ -3578,6 +3578,7 @@ btr_store_big_rec_extern_fields(
/* out: DB_SUCCESS or error */
dict_index_t* index, /* in: index of rec; the index tree
MUST be X-latched */
buf_block_t* rec_block, /* in/out: block containing rec */
rec_t* rec, /* in/out: record */
const ulint* offsets, /* in: rec_get_offsets(rec, index);
the "external storage" flags in offsets
......@@ -3599,16 +3600,15 @@ btr_store_big_rec_extern_fields(
ulint i;
mtr_t mtr;
page_zip_des_t* page_zip;
buf_block_t* rec_block;
z_stream c_stream;
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(mtr_memo_contains(local_mtr, dict_index_get_lock(index),
MTR_MEMO_X_LOCK));
ut_ad(mtr_memo_contains_page(local_mtr, rec, MTR_MEMO_PAGE_X_FIX));
ut_ad(mtr_memo_contains(local_mtr, rec_block, MTR_MEMO_PAGE_X_FIX));
ut_ad(buf_block_get_frame(rec_block) == page_align(rec));
ut_a(dict_index_is_clust(index));
rec_block = buf_block_align(rec);
page_zip = buf_block_get_page_zip(rec_block);
ut_a(dict_table_zip_size(index->table)
== buf_block_get_zip_size(rec_block));
......
......@@ -476,6 +476,7 @@ btr_store_big_rec_extern_fields(
/* out: DB_SUCCESS or error */
dict_index_t* index, /* in: index of rec; the index tree
MUST be X-latched */
buf_block_t* rec_block, /* in/out: block containing rec */
rec_t* rec, /* in: record */
const ulint* offsets, /* in: rec_get_offsets(rec, index);
the "external storage" flags in offsets
......
......@@ -180,7 +180,8 @@ page_cur_insert_rec_low(
otherwise */
rec_t* current_rec,/* in: current record after which the
new record is inserted */
page_zip_des_t* page_zip,/* in: compressed page, or NULL */
buf_block_t* block, /* in: buffer block of current_rec, or NULL
if the compressed page is not to be updated */
dict_index_t* index, /* in: record descriptor */
rec_t* rec, /* in: pointer to a physical record */
ulint* offsets,/* in/out: rec_get_offsets(rec, index) */
......
......@@ -235,8 +235,7 @@ page_cur_tuple_insert(
index, tuple, ext, n_ext);
offsets = rec_get_offsets(rec, index, NULL, ULINT_UNDEFINED, &heap);
rec = page_cur_insert_rec_low(cursor->rec,
buf_block_get_page_zip(cursor->block),
rec = page_cur_insert_rec_low(cursor->rec, cursor->block,
index, rec, offsets, mtr);
mem_heap_free(heap);
return(rec);
......@@ -258,8 +257,7 @@ page_cur_rec_insert(
ulint* offsets,/* in/out: rec_get_offsets(rec, index) */
mtr_t* mtr) /* in: mini-transaction handle, or NULL */
{
return(page_cur_insert_rec_low(cursor->rec,
buf_block_get_page_zip(cursor->block),
return(page_cur_insert_rec_low(cursor->rec, cursor->block,
index, rec, offsets, mtr));
}
......@@ -671,12 +671,11 @@ page_rec_get_next_low(
fprintf(stderr,
"InnoDB: Next record offset is nonsensical %lu"
" in record at offset %lu\n"
"InnoDB: rec address %p, first buffer frame %p\n"
"InnoDB: buffer pool high end %p, buf fix count %lu\n",
(ulong)offs, (ulong)(rec - page),
(void*) rec, (void*) buf_pool->frame_zero,
(void*) buf_pool->high_end,
(ulong) buf_block_align(rec)->buf_fix_count);
"InnoDB: rec address %p, space id %lu, page %lu\n",
(ulong)offs, (ulong) page_offset(rec),
(void*) rec,
(ulong) page_get_space_id(rec),
(ulong) page_get_page_no(rec));
buf_page_print(page, 0);
ut_error;
......
......@@ -895,7 +895,8 @@ page_cur_insert_rec_low(
otherwise */
rec_t* current_rec,/* in: current record after which the
new record is inserted */
page_zip_des_t* page_zip,/* in: compressed page, or NULL */
buf_block_t* block, /* in: buffer block of current_rec, or NULL
if the compressed page is not to be updated */
dict_index_t* index, /* in: record descriptor */
rec_t* rec, /* in: pointer to a physical record */
ulint* offsets,/* in/out: rec_get_offsets(rec, index) */
......@@ -911,7 +912,9 @@ page_cur_insert_rec_low(
rec_t* insert_rec; /* inserted record */
ulint heap_no; /* heap number of the inserted
record */
page_zip_des_t* page_zip_orig = page_zip;
page_zip_des_t* page_zip;
page_zip = block ? buf_block_get_page_zip(block) : NULL;
ut_ad(rec_offs_validate(rec, index, offsets));
......@@ -1116,20 +1119,19 @@ page_cur_insert_rec_low(
if (UNIV_LIKELY_NULL(page_zip)) {
page_zip_write_rec(page_zip, insert_rec, index, offsets, 1);
} else if (UNIV_LIKELY_NULL(page_zip_orig)) {
} else if (UNIV_LIKELY_NULL(block)
&& UNIV_LIKELY_NULL(buf_block_get_page_zip(block))) {
ut_a(page_is_comp(page));
page_zip = buf_block_get_page_zip(block);
/* Recompress or reorganize and recompress the page. */
if (UNIV_UNLIKELY
(!page_zip_compress(page_zip_orig, page, index, mtr))) {
(!page_zip_compress(page_zip, page, index, mtr))) {
/* Before trying to reorganize the page,
store the number of preceding records on the page. */
ulint insert_pos
= page_rec_get_n_recs_before(insert_rec);
buf_block_t* block
= buf_block_align(page);
ut_ad(buf_block_get_page_zip(block) == page_zip_orig);
if (page_zip_reorganize(block, index, mtr)) {
/* The page was reorganized:
......@@ -1137,7 +1139,7 @@ page_cur_insert_rec_low(
insert_rec = page + PAGE_NEW_INFIMUM;
do {
insert_rec = rec_get_next_ptr(
insert_rec = page + rec_get_next_offs(
insert_rec, TRUE);
} while (--insert_pos);
......@@ -1145,7 +1147,7 @@ page_cur_insert_rec_low(
}
/* Out of space: restore the page */
if (!page_zip_decompress(page_zip_orig, page)) {
if (!page_zip_decompress(page_zip, page)) {
ut_error; /* Memory corrupted? */
}
ut_ad(page_validate(page, index));
......
......@@ -2145,8 +2145,9 @@ row_ins_index_entry_low(
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap);
err = btr_store_big_rec_extern_fields(index, rec,
offsets, big_rec, &mtr);
err = btr_store_big_rec_extern_fields(
index, btr_cur_get_block(&cursor),
rec, offsets, big_rec, &mtr);
if (modify) {
dtuple_big_rec_free(big_rec);
......
......@@ -1607,7 +1607,7 @@ row_upd_clust_rec(
ut_a(btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, mtr));
rec = btr_cur_get_rec(btr_cur);
err = btr_store_big_rec_extern_fields(
index, rec,
index, btr_cur_get_block(btr_cur), rec,
rec_get_offsets(rec, index, offsets_,
ULINT_UNDEFINED, &heap),
big_rec, mtr);
......
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