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