Commit 0c26b8f1 authored by marko's avatar marko

branches/zip: btr_copy_externally_stored_field(): Correct the

reporting and handling of inflate() errors.
parent 23128a45
...@@ -4229,6 +4229,7 @@ btr_copy_externally_stored_field( ...@@ -4229,6 +4229,7 @@ btr_copy_externally_stored_field(
#endif /* UNIV_SYNC_DEBUG */ #endif /* UNIV_SYNC_DEBUG */
if (UNIV_UNLIKELY(zip_size)) { if (UNIV_UNLIKELY(zip_size)) {
int err; int err;
ulint next_page_no;
if (UNIV_UNLIKELY(fil_page_get_type(page) if (UNIV_UNLIKELY(fil_page_get_type(page)
!= FIL_PAGE_TYPE_ZBLOB)) { != FIL_PAGE_TYPE_ZBLOB)) {
...@@ -4241,7 +4242,7 @@ btr_copy_externally_stored_field( ...@@ -4241,7 +4242,7 @@ btr_copy_externally_stored_field(
(ulong) page_no, (ulong) space_id); (ulong) page_no, (ulong) space_id);
} }
page_no = mach_read_from_4(page + offset); next_page_no = mach_read_from_4(page + offset);
if (UNIV_LIKELY(offset == FIL_PAGE_NEXT)) { if (UNIV_LIKELY(offset == FIL_PAGE_NEXT)) {
/* When the BLOB begins at page header, /* When the BLOB begins at page header,
...@@ -4260,14 +4261,14 @@ btr_copy_externally_stored_field( ...@@ -4260,14 +4261,14 @@ btr_copy_externally_stored_field(
case Z_OK: case Z_OK:
break; break;
case Z_STREAM_END: case Z_STREAM_END:
if (page_no == FIL_NULL) { if (next_page_no == FIL_NULL) {
goto end_of_blob; goto end_of_blob;
} }
/* fall through */ /* fall through */
default: default:
inflate_error:
mtr_commit(&mtr); mtr_commit(&mtr);
inflateEnd(&d_stream); inflateEnd(&d_stream);
inflate_error:
ut_print_timestamp(stderr); ut_print_timestamp(stderr);
fprintf(stderr, fprintf(stderr,
" InnoDB: inflate() of" " InnoDB: inflate() of"
...@@ -4279,7 +4280,7 @@ btr_copy_externally_stored_field( ...@@ -4279,7 +4280,7 @@ btr_copy_externally_stored_field(
return(buf); return(buf);
} }
if (page_no == FIL_NULL) { if (next_page_no == FIL_NULL) {
err = inflate(&d_stream, Z_FINISH); err = inflate(&d_stream, Z_FINISH);
if (UNIV_UNLIKELY(err != Z_STREAM_END)) { if (UNIV_UNLIKELY(err != Z_STREAM_END)) {
...@@ -4301,6 +4302,7 @@ btr_copy_externally_stored_field( ...@@ -4301,6 +4302,7 @@ btr_copy_externally_stored_field(
/* On other BLOB pages except the first /* On other BLOB pages except the first
the BLOB header always is at the page header: */ the BLOB header always is at the page header: */
page_no = next_page_no;
offset = FIL_PAGE_NEXT; offset = FIL_PAGE_NEXT;
} else { } else {
byte* blob_header = page + offset; byte* blob_header = page + offset;
......
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