Commit d3e06dbb authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-27924 page_zip_copy_recs() corrupts ROW_FORMAT=COMPRESSED block descriptor

In commit aaef2e1d (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.
parent 92f79a22
/***************************************************************************** /*****************************************************************************
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 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 the terms of the GNU General Public License as published by the Free Software
...@@ -119,6 +119,16 @@ struct page_zip_des_t ...@@ -119,6 +119,16 @@ struct page_zip_des_t
- reinterpret_cast<char*>(this)); - 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: private:
friend buf_pool_t; friend buf_pool_t;
friend buf_page_t; friend buf_page_t;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc. 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 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 the terms of the GNU General Public License as published by the Free Software
...@@ -4562,7 +4562,7 @@ page_zip_copy_recs( ...@@ -4562,7 +4562,7 @@ page_zip_copy_recs(
to the compressed data page. */ to the compressed data page. */
{ {
page_zip_t* data = page_zip->data; 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; page_zip->data = data;
} }
ut_ad(page_zip_get_trailer_len(page_zip, dict_index_is_clust(index)) ut_ad(page_zip_get_trailer_len(page_zip, dict_index_is_clust(index))
......
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