diff options
author | Thirunarayanan Balathandayuthapani <thiru@mariadb.com> | 2019-01-31 02:20:51 +0530 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-02-01 08:53:50 +0200 |
commit | f669cecbe30da820b93ebff0d3ed27d578627e47 (patch) | |
tree | 131e489c964bb37f59143e221d22943bf7808b82 | |
parent | 20e19f69750466ac2c9bbf82ef5ba396fc842a08 (diff) | |
download | mariadb-git-f669cecbe30da820b93ebff0d3ed27d578627e47.tar.gz |
MDEV-18415 mariabackup.mdev-14447 test case fails with Table 'test.t' doesn't exist in engine
- Added retry logic if validation of first page fails with checksum
mismatch.
-rw-r--r-- | extra/mariabackup/xtrabackup.cc | 15 | ||||
-rw-r--r-- | mysql-test/suite/mariabackup/mdev-14447.result | 1 | ||||
-rw-r--r-- | mysql-test/suite/mariabackup/mdev-14447.test | 14 | ||||
-rw-r--r-- | storage/innobase/buf/buf0buf.cc | 10 | ||||
-rw-r--r-- | storage/innobase/include/fsp0file.h | 19 |
5 files changed, 53 insertions, 6 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 87f8822c38b..6ba5d950104 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -3092,7 +3092,16 @@ xb_load_single_table_tablespace( die("Can't open datafile %s", name); } - err = file->validate_first_page(&flush_lsn); + for (int i = 0; i < 10; i++) { + err = file->validate_first_page(&flush_lsn); + if (err != DB_CORRUPTION) { + break; + } + + my_sleep(1000); + } + + bool is_empty_file = file->exists() && file->is_empty_file(); if (err == DB_SUCCESS && file->space_id() != SRV_TMP_SPACE_ID) { os_offset_t node_size = os_file_get_size(file->handle()); @@ -3124,9 +3133,7 @@ xb_load_single_table_tablespace( delete file; - if (err != DB_SUCCESS && err != DB_CORRUPTION && xtrabackup_backup) { - /* allow corrupted first page for xtrabackup, it could be just - zero-filled page, which we restore from redo log later */ + if (err != DB_SUCCESS && xtrabackup_backup && !is_empty_file) { die("Failed to not validate first page of the file %s, error %d",name, (int)err); } } diff --git a/mysql-test/suite/mariabackup/mdev-14447.result b/mysql-test/suite/mariabackup/mdev-14447.result index 3bca7eb5701..6600c13ed74 100644 --- a/mysql-test/suite/mariabackup/mdev-14447.result +++ b/mysql-test/suite/mariabackup/mdev-14447.result @@ -7,6 +7,7 @@ COMMIT; SELECT count(*) FROM t; count(*) 100000 +FOUND 1 /Checksum mismatch in datafile/ in backup.log # Prepare full backup, apply incremental one # Restore and check results # shutdown server diff --git a/mysql-test/suite/mariabackup/mdev-14447.test b/mysql-test/suite/mariabackup/mdev-14447.test index 689b578f2ab..96d12368547 100644 --- a/mysql-test/suite/mariabackup/mdev-14447.test +++ b/mysql-test/suite/mariabackup/mdev-14447.test @@ -1,3 +1,4 @@ +--source include/have_debug.inc call mtr.add_suppression("InnoDB: New log files created"); let $basedir=$MYSQLTEST_VARDIR/tmp/backup; @@ -9,16 +10,26 @@ echo # Create full backup , modify table, then create incremental/differential b --disable_result_log exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir; --enable_result_log + BEGIN; INSERT INTO t select uuid(), uuid(), uuid(), uuid() from seq_1_to_100000; COMMIT; SELECT count(*) FROM t; -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir; +let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log; + +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir --dbug=+d,page_intermittent_checksum_mismatch 2> $backuplog; + +--let SEARCH_RANGE = 10000000 +--let SEARCH_PATTERN=Checksum mismatch in datafile +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +remove_file $backuplog; --disable_result_log echo # Prepare full backup, apply incremental one; exec $XTRABACKUP --prepare --verbose --apply-log-only --target-dir=$basedir; + exec $XTRABACKUP --prepare --verbose --apply-log-only --target-dir=$basedir --incremental-dir=$incremental_dir ; echo # Restore and check results; @@ -36,7 +47,6 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir= echo # restart server; --source include/start_mysqld.inc - --enable_result_log SELECT count(*) FROM t; DROP TABLE t; diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 8dc2fd20dbe..e97a36efa56 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1103,6 +1103,16 @@ buf_page_is_corrupted( if (srv_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_CRC32) { + + DBUG_EXECUTE_IF( + "page_intermittent_checksum_mismatch", { + static int page_counter; + if (page_counter++ == 2) { + checksum_field2++; + } + }); + + crc32 = buf_page_check_crc32(read_buf, checksum_field2); crc32_inited = true; diff --git a/storage/innobase/include/fsp0file.h b/storage/innobase/include/fsp0file.h index 9bc7b4bf9c9..0cb6ccaf86c 100644 --- a/storage/innobase/include/fsp0file.h +++ b/storage/innobase/include/fsp0file.h @@ -314,6 +314,25 @@ public: return(m_last_os_error); } + /** Check whether the file is empty. + @return true if file is empty */ + bool is_empty_file() const + { +#ifdef _WIN32 + os_offset_t offset = + (os_offset_t) m_file_info.nFileSizeLow + | ((os_offset_t) m_file_info.nFileSizeHigh << 32); + + return (offset == 0); +#else + return (m_file_info.st_size == 0); +#endif + } + + /** Check if the file exist. + @return true if file exists. */ + bool exists() const { return m_exists; } + /** Test if the filepath provided looks the same as this filepath by string comparison. If they are two different paths to the same file, same_as() will be used to show that after the files are opened. |