Commit 01103556 authored by marko's avatar marko

branches/zip: Fix a bug in consistent reads of rows containing BLOB data.

btr_rec_copy_externally_stored_field(): Add parameter zip_size.
Do not call buf_block_align(rec), because rec can also be in
dynamically allocated memory.  buf_block_align() can only be invoked
on addresses inside the buffer pool.

page_zip_clear_rec(): Improve formatting.
parent a2121234
...@@ -4264,13 +4264,14 @@ btr_rec_copy_externally_stored_field( ...@@ -4264,13 +4264,14 @@ btr_rec_copy_externally_stored_field(
/* out: the field copied to heap */ /* out: the field copied to heap */
rec_t* rec, /* in: record */ rec_t* rec, /* in: record */
const ulint* offsets,/* in: array returned by rec_get_offsets() */ const ulint* offsets,/* in: array returned by rec_get_offsets() */
ulint zip_size,/* in: nonzero=compressed BLOB page size,
zero for uncompressed BLOBs */
ulint no, /* in: field number */ ulint no, /* in: field number */
ulint* len, /* out: length of the field */ ulint* len, /* out: length of the field */
mem_heap_t* heap) /* in: mem heap */ mem_heap_t* heap) /* in: mem heap */
{ {
ulint local_len; ulint local_len;
byte* data; byte* data;
page_zip_des_t* page_zip;
ut_ad(rec_offs_validate(rec, NULL, offsets)); ut_ad(rec_offs_validate(rec, NULL, offsets));
ut_a(rec_offs_nth_extern(offsets, no)); ut_a(rec_offs_nth_extern(offsets, no));
...@@ -4286,9 +4287,6 @@ btr_rec_copy_externally_stored_field( ...@@ -4286,9 +4287,6 @@ btr_rec_copy_externally_stored_field(
data = rec_get_nth_field(rec, offsets, no, &local_len); data = rec_get_nth_field(rec, offsets, no, &local_len);
page_zip = buf_block_get_page_zip(buf_block_align(rec));
return(btr_copy_externally_stored_field(len, data, return(btr_copy_externally_stored_field(len, data,
page_zip ? page_zip->size : 0, zip_size, local_len, heap));
local_len, heap));
} }
...@@ -508,6 +508,8 @@ btr_rec_copy_externally_stored_field( ...@@ -508,6 +508,8 @@ btr_rec_copy_externally_stored_field(
/* out: the field copied to heap */ /* out: the field copied to heap */
rec_t* rec, /* in: record */ rec_t* rec, /* in: record */
const ulint* offsets,/* in: array returned by rec_get_offsets() */ const ulint* offsets,/* in: array returned by rec_get_offsets() */
ulint zip_size,/* in: nonzero=compressed BLOB page size,
zero for uncompressed BLOBs */
ulint no, /* in: field number */ ulint no, /* in: field number */
ulint* len, /* out: length of the field */ ulint* len, /* out: length of the field */
mem_heap_t* heap); /* in: mem heap */ mem_heap_t* heap); /* in: mem heap */
......
...@@ -2700,8 +2700,7 @@ page_zip_clear_rec( ...@@ -2700,8 +2700,7 @@ page_zip_clear_rec(
memset(storage - (heap_no - 1) * REC_NODE_PTR_SIZE, memset(storage - (heap_no - 1) * REC_NODE_PTR_SIZE,
0, REC_NODE_PTR_SIZE); 0, REC_NODE_PTR_SIZE);
} } else if (dict_index_is_clust(index)) {
else if (dict_index_is_clust(index)) {
/* Clear trx_id and roll_ptr on the compressed page. */ /* Clear trx_id and roll_ptr on the compressed page. */
byte* storage = page_zip->data + page_zip->size byte* storage = page_zip->data + page_zip->size
- (page_dir_get_n_heap(page) - 2) - (page_dir_get_n_heap(page) - 2)
......
...@@ -210,7 +210,9 @@ row_build( ...@@ -210,7 +210,9 @@ row_build(
&& rec_offs_nth_extern(offsets, i)) { && rec_offs_nth_extern(offsets, i)) {
field = btr_rec_copy_externally_stored_field( field = btr_rec_copy_externally_stored_field(
rec, offsets, i, &len, heap); rec, offsets,
dict_table_zip_size(table),
i, &len, heap);
} }
dfield_set_data(dfield, field, len); dfield_set_data(dfield, field, len);
......
...@@ -321,7 +321,9 @@ row_sel_fetch_columns( ...@@ -321,7 +321,9 @@ row_sel_fetch_columns(
heap = mem_heap_create(1); heap = mem_heap_create(1);
data = btr_rec_copy_externally_stored_field( data = btr_rec_copy_externally_stored_field(
rec, offsets, field_no, &len, heap); rec, offsets,
dict_table_zip_size(index->table),
field_no, &len, heap);
ut_a(len != UNIV_SQL_NULL); ut_a(len != UNIV_SQL_NULL);
...@@ -2613,8 +2615,10 @@ row_sel_store_mysql_rec( ...@@ -2613,8 +2615,10 @@ row_sel_store_mysql_rec(
already run out of memory in the next call, which already run out of memory in the next call, which
causes an assert */ causes an assert */
data = btr_rec_copy_externally_stored_field(rec, data = btr_rec_copy_externally_stored_field(
offsets, templ->rec_field_no, &len, rec, offsets,
dict_table_zip_size(prebuilt->table),
templ->rec_field_no, &len,
heap); heap);
ut_a(len != UNIV_SQL_NULL); ut_a(len != UNIV_SQL_NULL);
......
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