Skip to content

Commit

Permalink
MDEV-27924 page_zip_copy_recs() corrupts ROW_FORMAT=COMPRESSED block …
Browse files Browse the repository at this point in the history
…descriptor

In commit aaef2e1 (MDEV-27058)
we failed to introduce a special copy constructor that would
preserve the "page_zip_des_t::fix" field that only exists there
in order to avoid alignment loss on 64-bit systems.

page_zip_copy_recs(): Invoke the special copy constructor.

The block descriptor corruption causes assertion failures when
running ./mtr --suite=innodb_zip while InnoDB has been built
with UNIV_ZIP_COPY. Normally, calls to page_zip_copy_recs()
occur very rarely on page splits.
  • Loading branch information
dr-m committed Feb 23, 2022
1 parent 92f79a2 commit d3e06db
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion storage/innobase/include/page0types.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2019, 2021, MariaDB Corporation.
Copyright (c) 2019, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Expand Down Expand Up @@ -119,6 +119,16 @@ struct page_zip_des_t
- reinterpret_cast<char*>(this));
}

page_zip_des_t() = default;
page_zip_des_t(const page_zip_des_t&) = default;

/* Initialize everything except the member "fix". */
page_zip_des_t(const page_zip_des_t& old, bool) {
memcpy((void*) this, (void*) &old,
reinterpret_cast<char*>(&fix)
- reinterpret_cast<char*>(this));
}

private:
friend buf_pool_t;
friend buf_page_t;
Expand Down
4 changes: 2 additions & 2 deletions storage/innobase/page/page0zip.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2014, 2021, MariaDB Corporation.
Copyright (c) 2014, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Expand Down Expand Up @@ -4562,7 +4562,7 @@ page_zip_copy_recs(
to the compressed data page. */
{
page_zip_t* data = page_zip->data;
new (page_zip) page_zip_des_t(*src_zip);
new (page_zip) page_zip_des_t(*src_zip, false);
page_zip->data = data;
}
ut_ad(page_zip_get_trailer_len(page_zip, dict_index_is_clust(index))
Expand Down

0 comments on commit d3e06db

Please sign in to comment.