diff options
author | Marko Mäkelä <marko.makela@oracle.com> | 2013-05-15 22:40:29 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@oracle.com> | 2013-05-15 22:40:29 +0300 |
commit | 205bf59a9f0e64baa69c1b5153f64031084a4229 (patch) | |
tree | a58faa564cf4ef7f58fba8395def023fd2c4278d /storage | |
parent | 1eb7e21190d0cdb69f6448402225cfb249a28853 (diff) | |
download | mariadb-git-205bf59a9f0e64baa69c1b5153f64031084a4229.tar.gz |
Bug#16736929 PAGE_ZIP_DECOMPRESS() FAILS ON EMPTY RECORD
When a record contains no user data bytes (such as when the PRIMARY
KEY is an empty string and all secondary index fields are NULL or the
empty string), page_zip_decompress() could fail to set the record
heap_no correctly.
page_zip_decompress_node_ptrs(), page_zip_decompress_sec(),
page_zip_decompress_clust(): Set heap_no also at the end of the
compressed data stream.
rb#2448 approved by Jimmy Yang and Inaam Rana
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innodb_plugin/ChangeLog | 5 | ||||
-rw-r--r-- | storage/innodb_plugin/page/page0zip.c | 45 |
2 files changed, 44 insertions, 6 deletions
diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog index 9285b9993e0..22d1067455e 100644 --- a/storage/innodb_plugin/ChangeLog +++ b/storage/innodb_plugin/ChangeLog @@ -1,3 +1,8 @@ +2013-05-15 The InnoDB Team + + * page/page0zip.c: + Fix Bug#16736929 PAGE_ZIP_DECOMPRESS() FAILS ON EMPTY RECORD + 2013-03-12 The InnoDB Team * include/page0zip.ic, page/page0zip.c: diff --git a/storage/innodb_plugin/page/page0zip.c b/storage/innodb_plugin/page/page0zip.c index ab9e8ffb49f..37e3e748f2a 100644 --- a/storage/innodb_plugin/page/page0zip.c +++ b/storage/innodb_plugin/page/page0zip.c @@ -2148,8 +2148,19 @@ page_zip_decompress_node_ptrs( - PAGE_ZIP_START - PAGE_DIR); switch (inflate(d_stream, Z_SYNC_FLUSH)) { case Z_STREAM_END: - /* Apparently, n_dense has grown - since the time the page was last compressed. */ + if (d_stream->next_out + != rec - REC_N_NEW_EXTRA_BYTES) { + /* n_dense has grown since the page + was last compressed. */ + } else { + /* Skip the REC_N_NEW_EXTRA_BYTES. */ + d_stream->next_out = rec; + + /* Set heap_no and the status bits. */ + mach_write_to_2(rec - REC_NEW_HEAP_NO, + heap_status); + heap_status += 1 << REC_HEAP_NO_SHIFT; + } goto zlib_done; case Z_OK: case Z_BUF_ERROR: @@ -2337,8 +2348,19 @@ page_zip_decompress_sec( if (UNIV_LIKELY(d_stream->avail_out)) { switch (inflate(d_stream, Z_SYNC_FLUSH)) { case Z_STREAM_END: - /* Apparently, n_dense has grown - since the time the page was last compressed. */ + if (d_stream->next_out + != rec - REC_N_NEW_EXTRA_BYTES) { + /* n_dense has grown since the page + was last compressed. */ + } else { + /* Skip the REC_N_NEW_EXTRA_BYTES. */ + d_stream->next_out = rec; + + /* Set heap_no and the status bits. */ + mach_write_to_2(rec - REC_NEW_HEAP_NO, + heap_status); + heap_status += 1 << REC_HEAP_NO_SHIFT; + } goto zlib_done; case Z_OK: case Z_BUF_ERROR: @@ -2596,8 +2618,19 @@ page_zip_decompress_clust( err = inflate(d_stream, Z_SYNC_FLUSH); switch (err) { case Z_STREAM_END: - /* Apparently, n_dense has grown - since the time the page was last compressed. */ + if (d_stream->next_out + != rec - REC_N_NEW_EXTRA_BYTES) { + /* n_dense has grown since the page + was last compressed. */ + } else { + /* Skip the REC_N_NEW_EXTRA_BYTES. */ + d_stream->next_out = rec; + + /* Set heap_no and the status bits. */ + mach_write_to_2(rec - REC_NEW_HEAP_NO, + heap_status); + heap_status += 1 << REC_HEAP_NO_SHIFT; + } goto zlib_done; case Z_OK: case Z_BUF_ERROR: |