summaryrefslogtreecommitdiff
path: root/extra
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2017-05-30 11:30:43 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2017-06-01 14:07:48 +0300
commit1af8bf39ca2513bfdf43a55af0b6af10d32dcebb (patch)
treec81834c9c28c535589cb57531de986c74d9e89b3 /extra
parent473f4a65e185ac0b03b8689ec833abeecac0cb9d (diff)
downloadmariadb-git-1af8bf39ca2513bfdf43a55af0b6af10d32dcebb.tar.gz
MDEV-12113: install_db shows corruption for rest encryption with innodb_data_file_path=ibdata1:3M;
Problem was that FIL_PAGE_FLUSH_LSN_OR_KEY_VERSION field that for encrypted pages even in system datafiles should contain key_version except very first page (0:0) is after encryption overwritten with flush lsn. Ported WL#7990 Repurpose FIL_PAGE_FLUSH_LSN to 10.1 The field FIL_PAGE_FLUSH_LSN_OR_KEY_VERSION is consulted during InnoDB startup. At startup, InnoDB reads the FIL_PAGE_FLUSH_LSN_OR_KEY_VERSION from the first page of each file in the InnoDB system tablespace. If there are multiple files, the minimum and maximum LSN can differ. These numbers are passed to InnoDB startup. Having the number in other files than the first file of the InnoDB system tablespace is not providing much additional value. It is conflicting with other use of the field, such as on InnoDB R-tree index pages and encryption key_version. This worklog will stop writing FIL_PAGE_FLUSH_LSN_OR_KEY_VERSION to other files than the first file of the InnoDB system tablespace (page number 0:0) when system tablespace is encrypted. If tablespace is not encrypted we continue writing FIL_PAGE_FLUSH_LSN_OR_KEY_VERSION to all first pages of system tablespace to avoid unnecessary warnings on downgrade. open_or_create_data_files(): pass only one flushed_lsn parameter xb_load_tablespaces(): pass only one flushed_lsn parameter. buf_page_create(): Improve comment about where FIL_PAGE_FIL_FLUSH_LSN_OR_KEY_VERSION is set. fil_write_flushed_lsn(): A new function, merged from fil_write_lsn_and_arch_no_to_file() and fil_write_flushed_lsn_to_data_files(). Only write to the first page of the system tablespace (page 0:0) if tablespace is encrypted, or write all first pages of system tablespace and invoke fil_flush_file_spaces(FIL_TYPE_TABLESPACE) afterwards. fil_read_first_page(): read flush_lsn and crypt_data only from first datafile. fil_open_single_table_tablespace(): Remove output of LSN, because it was only valid for the system tablespace and the undo tablespaces, not user tablespaces. fil_validate_single_table_tablespace(): Remove output of LSN. checkpoint_now_set(): Use fil_write_flushed_lsn and output a error if operation fails. Remove lsn variable from fsp_open_info. recv_recovery_from_checkpoint_start(): Remove unnecessary second flush_lsn parameter. log_empty_and_mark_files_at_shutdown(): Use fil_writte_flushed_lsn and output error if it fails. open_or_create_data_files(): Pass only one flushed_lsn variable.
Diffstat (limited to 'extra')
-rw-r--r--extra/mariabackup/xb0xb.h7
-rw-r--r--extra/mariabackup/xtrabackup.cc13
2 files changed, 9 insertions, 11 deletions
diff --git a/extra/mariabackup/xb0xb.h b/extra/mariabackup/xb0xb.h
index c6e4ae22de6..4aadee82b05 100644
--- a/extra/mariabackup/xb0xb.h
+++ b/extra/mariabackup/xb0xb.h
@@ -27,13 +27,12 @@ extern pfs_os_file_t files[1000];
extern const char *innodb_checksum_algorithm_names[];
extern TYPELIB innodb_checksum_algorithm_typelib;
extern dberr_t open_or_create_data_files(
- ibool* create_new_db,
+ bool* create_new_db,
#ifdef UNIV_LOG_ARCHIVE
lsn_t* min_arch_log_no,
lsn_t* max_arch_log_no,
-#endif
- lsn_t* min_flushed_lsn,
- lsn_t* max_flushed_lsn,
+#endif
+ lsn_t* flushed_lsn,
ulint* sum_of_new_sizes)
;
int
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index 16a39c58d5c..5b3f1527133 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -309,8 +309,7 @@ my_bool xtrabackup_rebuild_indexes = FALSE;
my_bool xtrabackup_incremental_force_scan = FALSE;
/* The flushed lsn which is read from data files */
-lsn_t min_flushed_lsn= 0;
-lsn_t max_flushed_lsn= 0;
+lsn_t flushed_lsn= 0;
/* The size of archived log file */
ib_int64_t xtrabackup_arch_file_size = 0ULL;
@@ -3249,7 +3248,7 @@ xb_load_tablespaces(void)
/*=====================*/
{
ulint i;
- ibool create_new_db;
+ bool create_new_db;
ulint err;
ulint sum_of_new_sizes;
lsn_t min_arch_logno, max_arch_logno;
@@ -3265,7 +3264,7 @@ xb_load_tablespaces(void)
err = open_or_create_data_files(&create_new_db,
&min_arch_logno, &max_arch_logno,
- &min_flushed_lsn, &max_flushed_lsn,
+ &flushed_lsn,
&sum_of_new_sizes);
if (err != DB_SUCCESS) {
msg("xtrabackup: Could not open or create data files.\n"
@@ -6475,13 +6474,13 @@ skip_check:
metadata_last_lsn);
xtrabackup_archived_to_lsn = metadata_last_lsn;
}
- if (xtrabackup_archived_to_lsn < min_flushed_lsn) {
+ if (xtrabackup_archived_to_lsn < flushed_lsn) {
msg("xtrabackup: error: logs applying "
"lsn limit " UINT64PF " is less than "
"min_flushed_lsn " UINT64PF
", there is nothing to do\n",
xtrabackup_archived_to_lsn,
- min_flushed_lsn);
+ flushed_lsn);
goto error_cleanup;
}
}
@@ -6492,7 +6491,7 @@ skip_check:
*/
xtrabackup_apply_log_only = srv_apply_log_only = true;
- if (!xtrabackup_arch_search_files(min_flushed_lsn)) {
+ if (!xtrabackup_arch_search_files(flushed_lsn)) {
goto error_cleanup;
}