Commit b013f0d3 authored by marko's avatar marko

branches/zip: page0zip.c: Add some Valgrind instrumentation.

parent 7d5f2f84
......@@ -679,6 +679,10 @@ page_zip_compress_node_ptrs(
/* Only leaf nodes may contain externally stored columns. */
ut_ad(!rec_offs_any_extern(offsets));
UNIV_MEM_VALID(rec, rec_offs_data_size(offsets));
UNIV_MEM_VALID(rec - rec_offs_extra_size(offsets),
rec_offs_extra_size(offsets));
/* Compress the extra bytes. */
c_stream->avail_in = rec - REC_N_NEW_EXTRA_BYTES
- c_stream->next_in;
......@@ -737,6 +741,7 @@ page_zip_compress_sec(
- c_stream->next_in;
if (UNIV_LIKELY(c_stream->avail_in)) {
UNIV_MEM_VALID(c_stream->next_in, c_stream->avail_in);
err = deflate(c_stream, Z_NO_FLUSH);
if (UNIV_UNLIKELY(err != Z_OK)) {
break;
......@@ -777,6 +782,10 @@ page_zip_compress_clust_ext(
int err;
ulint i;
UNIV_MEM_VALID(rec, rec_offs_data_size(offsets));
UNIV_MEM_VALID(rec - rec_offs_extra_size(offsets),
rec_offs_extra_size(offsets));
for (i = 0; i < rec_offs_n_fields(offsets); i++) {
ulint len;
const byte* src;
......@@ -912,6 +921,9 @@ page_zip_compress_clust(
ULINT_UNDEFINED, &heap);
ut_ad(rec_offs_n_fields(offsets)
== dict_index_get_n_fields(index));
UNIV_MEM_VALID(rec, rec_offs_data_size(offsets));
UNIV_MEM_VALID(rec - rec_offs_extra_size(offsets),
rec_offs_extra_size(offsets));
/* Compress the extra bytes. */
c_stream->avail_in = rec - REC_N_NEW_EXTRA_BYTES
......@@ -956,6 +968,9 @@ page_zip_compress_clust(
== rec_get_nth_field(rec, offsets,
trx_id_col + 1, &len));
ut_ad(len == DATA_ROLL_PTR_LEN);
UNIV_MEM_VALID(rec, rec_offs_data_size(offsets));
UNIV_MEM_VALID(rec - rec_offs_extra_size(offsets),
rec_offs_extra_size(offsets));
/* Compress any preceding bytes. */
c_stream->avail_in = src - c_stream->next_in;
......@@ -1136,6 +1151,7 @@ page_zip_compress(
trx_id_col = ULINT_UNDEFINED;
}
UNIV_MEM_VALID(c_stream.next_in, c_stream.avail_in);
err = deflate(&c_stream, Z_FULL_FLUSH);
if (err != Z_OK) {
goto zlib_error;
......@@ -1186,6 +1202,7 @@ page_zip_compress(
- (c_stream.next_in - page);
ut_a(c_stream.avail_in <= UNIV_PAGE_SIZE - PAGE_ZIP_START - PAGE_DIR);
UNIV_MEM_VALID(c_stream.next_in, c_stream.avail_in);
err = deflate(&c_stream, Z_FINISH);
if (UNIV_UNLIKELY(err != Z_STREAM_END)) {
......@@ -2730,6 +2747,9 @@ page_zip_write_rec_ext(
ulint n_ext = rec_offs_n_extern(offsets);
ut_ad(rec_offs_validate(rec, index, offsets));
UNIV_MEM_VALID(rec, rec_offs_data_size(offsets));
UNIV_MEM_VALID(rec - rec_offs_extra_size(offsets),
rec_offs_extra_size(offsets));
externs -= (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN)
* (page_dir_get_n_heap(page) - PAGE_HEAP_NO_USER_LOW);
......@@ -2862,6 +2882,10 @@ page_zip_write_rec(
ut_ad(page_zip_header_cmp(page_zip, page));
ut_ad(page_simple_validate_new((page_t*) page));
UNIV_MEM_VALID(rec, rec_offs_data_size(offsets));
UNIV_MEM_VALID(rec - rec_offs_extra_size(offsets),
rec_offs_extra_size(offsets));
slot = page_zip_dir_find(page_zip, page_offset(rec));
ut_a(slot);
/* Copy the delete mark. */
......@@ -3111,6 +3135,10 @@ page_zip_write_blob_ptr(
ut_ad(page_is_leaf(page));
ut_ad(dict_index_is_clust(index));
UNIV_MEM_VALID(rec, rec_offs_data_size(offsets));
UNIV_MEM_VALID(rec - rec_offs_extra_size(offsets),
rec_offs_extra_size(offsets));
blob_no = page_zip_get_n_prev_extern(page_zip, rec, index)
+ rec_get_n_extern_new(rec, index, n);
ut_a(blob_no < page_zip->n_blobs);
......@@ -3346,6 +3374,10 @@ page_zip_write_trx_id_and_roll_ptr(
#endif
mach_write_to_7(field + DATA_TRX_ID_LEN, roll_ptr);
memcpy(storage, field, DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN);
UNIV_MEM_VALID(rec, rec_offs_data_size(offsets));
UNIV_MEM_VALID(rec - rec_offs_extra_size(offsets),
rec_offs_extra_size(offsets));
}
#ifdef UNIV_ZIP_DEBUG
......@@ -3380,6 +3412,10 @@ page_zip_clear_rec(
heap_no = rec_get_heap_no_new(rec);
ut_ad(heap_no >= PAGE_HEAP_NO_USER_LOW);
UNIV_MEM_VALID(rec, rec_offs_data_size(offsets));
UNIV_MEM_VALID(rec - rec_offs_extra_size(offsets),
rec_offs_extra_size(offsets));
if (
#ifdef UNIV_ZIP_DEBUG
!page_zip_clear_rec_disable &&
......@@ -3595,6 +3631,10 @@ page_zip_dir_delete(
ut_ad(rec_offs_validate(rec, index, offsets));
ut_ad(rec_offs_comp(offsets));
UNIV_MEM_VALID(rec, rec_offs_data_size(offsets));
UNIV_MEM_VALID(rec - rec_offs_extra_size(offsets),
rec_offs_extra_size(offsets));
slot_rec = page_zip_dir_find(page_zip, page_offset(rec));
ut_a(slot_rec);
......
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