Commit de011c21 authored by marko's avatar marko

branches/zip: page_cur_insert_rec_zip(): When allocating insert_buf

from the free list, zero out the DB_TRX_ID and DB_ROLL_PTR of the
deleted record if the new record would not overwrite these
fields. This fixes a harmless content mismatch reported by
page_zip_validate() that was reported as Issue #111.
rb://55 approved by Sunny Bains.
parent e6acdb3c
......@@ -907,7 +907,7 @@ page_cur_insert_rec_low(
ulint* offsets,/* in/out: rec_get_offsets(rec, index) */
mtr_t* mtr) /* in: mini-transaction handle, or NULL */
{
byte* insert_buf = NULL;
byte* insert_buf;
ulint rec_size;
page_t* page; /* the relevant page */
rec_t* last_insert; /* cursor position at previous
......@@ -1172,7 +1172,7 @@ page_cur_insert_rec_zip(
ulint* offsets,/* in/out: rec_get_offsets(rec, index) */
mtr_t* mtr) /* in: mini-transaction handle, or NULL */
{
byte* insert_buf = NULL;
byte* insert_buf;
ulint rec_size;
page_t* page; /* the relevant page */
rec_t* last_insert; /* cursor position at previous
......@@ -1285,6 +1285,41 @@ page_cur_insert_rec_zip(
rec_get_next_ptr(free_rec, TRUE),
rec_size);
if (page_is_leaf(page) && dict_index_is_clust(index)) {
/* Zero out the DB_TRX_ID and DB_ROLL_PTR
columns of free_rec, in case it will not be
overwritten by insert_rec. */
ulint trx_id_col;
ulint trx_id_offs;
ulint len;
trx_id_col = dict_index_get_sys_col_pos(index,
DATA_TRX_ID);
ut_ad(trx_id_col > 0);
ut_ad(trx_id_col != ULINT_UNDEFINED);
trx_id_offs = rec_get_nth_field_offs(foffsets,
trx_id_col, &len);
ut_ad(len == DATA_TRX_ID_LEN);
if (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN + trx_id_offs
+ rec_offs_extra_size(foffsets) > rec_size) {
/* We will have to zero out the
DB_TRX_ID and DB_ROLL_PTR, because
they will not be fully overwritten by
insert_rec. */
memset(free_rec + trx_id_offs, 0,
DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN);
}
ut_ad(free_rec + trx_id_offs + DATA_TRX_ID_LEN
== rec_get_nth_field(free_rec, foffsets,
trx_id_col + 1, &len));
ut_ad(len == DATA_ROLL_PTR_LEN);
}
if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap);
}
......
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