summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2018-12-18 18:07:17 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2018-12-18 18:07:17 +0530
commit171271edf8204d6a958a00631ea6ce4050f84b9e (patch)
tree2d0725dd2fe4375349d9c087788ac2154bd1605b /extra
parent84f119f25c6464b791ae7b494d6dadf0c5974477 (diff)
downloadmariadb-git-171271edf8204d6a958a00631ea6ce4050f84b9e.tar.gz
MDEV-18025 Mariabackup fails to detect corrupted page_compressed=1 tables
Problem: ======= Mariabackup seems to fail to verify the pages of compressed tables. The reason is that both fil_space_verify_crypt_checksum() and buf_page_is_corrupted() will skip the validation for compressed pages. Fix: ==== Mariabackup should call fil_page_decompress() for compressed and encrypted compressed page. After that, call buf_page_is_corrupted() to check the page corruption.
Diffstat (limited to 'extra')
-rw-r--r--extra/mariabackup/fil_cur.cc29
1 files changed, 25 insertions, 4 deletions
diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc
index c2693e6f616..b677e9973b7 100644
--- a/extra/mariabackup/fil_cur.cc
+++ b/extra/mariabackup/fil_cur.cc
@@ -31,6 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include "fil_cur.h"
#include "fil0crypt.h"
+#include "fil0pagecompress.h"
#include "common.h"
#include "read_filt.h"
#include "xtrabackup.h"
@@ -346,6 +347,7 @@ read_retry:
for (page = cursor->buf, i = 0; i < npages;
page += cursor->page_size, i++) {
ulint page_no = cursor->buf_page_no + i;
+ ulint page_type = mach_read_from_2(page + FIL_PAGE_TYPE);
if (cursor->space_id == TRX_SYS_SPACE
&& page_no >= FSP_EXTENT_SIZE
@@ -367,12 +369,31 @@ read_retry:
memcpy(tmp_page, page, cursor->page_size);
if (!fil_space_decrypt(space, tmp_frame,
- tmp_page, &decrypted)
- || buf_page_is_corrupted(true, tmp_page,
- cursor->zip_size,
- space)) {
+ tmp_page, &decrypted)) {
goto corrupted;
}
+
+ if (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) {
+ goto page_decomp;
+ }
+
+ if (buf_page_is_corrupted(
+ true, tmp_page, cursor->zip_size, space)) {
+ goto corrupted;
+ }
+
+ } else if (page_type == FIL_PAGE_PAGE_COMPRESSED) {
+ memcpy(tmp_page, page, cursor->page_size);
+page_decomp:
+ ulint decomp = fil_page_decompress(tmp_frame, tmp_page);
+
+ if (!decomp
+ || (decomp != srv_page_size && cursor->zip_size)
+ || buf_page_is_corrupted(
+ true, tmp_page, cursor->zip_size, space)) {
+ goto corrupted;
+ }
+
} else if (buf_page_is_corrupted(true, page, cursor->zip_size,
space)) {
corrupted: