Commit b152ee56 authored by marko's avatar marko

branches/zip: Zero out the BLOB pointers when decoding deleted records.

Improve diagnostics.

btr_cur_pessimistic_update(): Add page_zip_validate() assertion.

page_zip_decompress(): Initialize all BLOB pointers.

page_zip_clear_rec(): Add page_zip_header_cmp() assertion.

page_delete_rec_list_end(): Add page_zip_validate() assertion.
parent b355bd0f
...@@ -2161,6 +2161,9 @@ btr_cur_pessimistic_update( ...@@ -2161,6 +2161,9 @@ btr_cur_pessimistic_update(
} }
return_after_reservations: return_after_reservations:
#ifdef UNIV_ZIP_DEBUG
ut_a(!page_zip || page_zip_validate(page_zip, page));
#endif /* UNIV_ZIP_DEBUG */
mem_heap_free(heap); mem_heap_free(heap);
if (n_extents > 0) { if (n_extents > 0) {
......
...@@ -913,6 +913,9 @@ page_delete_rec_list_end( ...@@ -913,6 +913,9 @@ page_delete_rec_list_end(
offsets = rec_get_offsets(rec, index, offsets, offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap); ULINT_UNDEFINED, &heap);
rec = rec_get_next_ptr(rec, TRUE); rec = rec_get_next_ptr(rec, TRUE);
#ifdef UNIV_ZIP_DEBUG
ut_a(page_zip_validate(page_zip, page));
#endif /* UNIV_ZIP_DEBUG */
page_cur_delete_rec(&cur, index, offsets, page_cur_delete_rec(&cur, index, offsets,
page_zip, mtr); page_zip, mtr);
} while (ut_align_offset(rec, UNIV_PAGE_SIZE) } while (ut_align_offset(rec, UNIV_PAGE_SIZE)
......
...@@ -1906,11 +1906,13 @@ page_zip_decompress_low( ...@@ -1906,11 +1906,13 @@ page_zip_decompress_low(
ulint len; ulint len;
byte* dst; byte* dst;
rec_t* rec = *recs++; rec_t* rec = *recs++;
ibool exists = !page_zip_dir_find_free(
page_zip, ut_align_offset(
rec, UNIV_PAGE_SIZE));
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap);
if (UNIV_UNLIKELY(trx_id_col != ULINT_UNDEFINED)) { if (UNIV_UNLIKELY(trx_id_col != ULINT_UNDEFINED)) {
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap);
dst = rec_get_nth_field(rec, offsets, dst = rec_get_nth_field(rec, offsets,
trx_id_col, &len); trx_id_col, &len);
ut_ad(len >= DATA_TRX_ID_LEN ut_ad(len >= DATA_TRX_ID_LEN
...@@ -1918,42 +1920,31 @@ page_zip_decompress_low( ...@@ -1918,42 +1920,31 @@ page_zip_decompress_low(
storage -= DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN; storage -= DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN;
memcpy(dst, storage, memcpy(dst, storage,
DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN); DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN);
}
if (UNIV_LIKELY(!page_zip_dir_find_free( /* Check if there are any externally stored
page_zip, ut_align_offset( columns in this existing (not deleted)
rec, UNIV_PAGE_SIZE)))) { record. For each externally stored column,
restore or clear the BTR_EXTERN_FIELD_REF. */
goto process_externs; for (i = 0; i < rec_offs_n_fields(offsets); i++) {
if (!rec_offs_nth_extern(offsets, i)) {
continue;
} }
} else if (UNIV_LIKELY(!page_zip_dir_find_free( dst = rec_get_nth_field(rec, offsets, i, &len);
page_zip, ut_align_offset( ut_ad(len >= BTR_EXTERN_FIELD_REF_SIZE);
rec, UNIV_PAGE_SIZE)))) { dst += len - BTR_EXTERN_FIELD_REF_SIZE;
offsets = rec_get_offsets(rec, index, offsets,
ULINT_UNDEFINED, &heap);
process_externs:
/* Check if there are any externally stored
columns in this existing (not deleted)
record. For each externally stored column,
restore the BTR_EXTERN_FIELD_REF separately. */
for (i = 0; i < rec_offs_n_fields(offsets);
i++) {
if (!rec_offs_nth_extern(offsets, i)) {
continue;
}
dst = rec_get_nth_field(
rec, offsets, i, &len);
ut_ad(len > BTR_EXTERN_FIELD_REF_SIZE);
dst += len - BTR_EXTERN_FIELD_REF_SIZE;
if (UNIV_LIKELY(exists)) {
externs -= BTR_EXTERN_FIELD_REF_SIZE; externs -= BTR_EXTERN_FIELD_REF_SIZE;
memcpy(dst, externs, memcpy(dst, externs,
BTR_EXTERN_FIELD_REF_SIZE); BTR_EXTERN_FIELD_REF_SIZE);
page_zip->n_blobs++; page_zip->n_blobs++;
} else {
memset(dst, 0,
BTR_EXTERN_FIELD_REF_SIZE);
} }
} }
} while (--n_dense); } while (--n_dense);
...@@ -2696,6 +2687,7 @@ page_zip_clear_rec( ...@@ -2696,6 +2687,7 @@ page_zip_clear_rec(
ut_align_offset(rec, UNIV_PAGE_SIZE))); ut_align_offset(rec, UNIV_PAGE_SIZE)));
ut_ad(page_zip_dir_find_free(page_zip, ut_ad(page_zip_dir_find_free(page_zip,
ut_align_offset(rec, UNIV_PAGE_SIZE))); ut_align_offset(rec, UNIV_PAGE_SIZE)));
ut_ad(page_zip_header_cmp(page_zip, page));
heap_no = rec_get_heap_no_new(rec); heap_no = rec_get_heap_no_new(rec);
ut_ad(heap_no >= 2); /* exclude infimum and supremum */ ut_ad(heap_no >= 2); /* exclude infimum and supremum */
......
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