mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
e6b3e38d62
The new option --log-innodb-page-corruption is introduced. When this option is set, backup is not interrupted if innodb corrupted page is detected. Instead it logs all found corrupted pages in innodb_corrupted_pages file in backup directory and finishes with error. For incremental backup corrupted pages are also copied to .delta file, because we can't do LSN check for such pages during backup, innodb_corrupted_pages will also be created in incremental backup directory. During --prepare, corrupted pages list is read from the file just after redo log is applied, and each page from the list is checked if it is allocated in it's tablespace or not. If it is not allocated, then it is zeroed out, flushed to the tablespace and removed from the list. If all pages are removed from the list, then --prepare is finished successfully and innodb_corrupted_pages file is removed from backup directory. Otherwise --prepare is finished with error message and innodb_corrupted_pages contains the list of the pages, which are detected as corrupted during backup, and are allocated in their tablespaces, what means backup directory contains corrupted innodb pages, and backup can not be considered as consistent. For incremental --prepare corrupted pages from .delta files are applied to the base backup, innodb_corrupted_pages is read from both base in incremental directories, and the same action is proceded for corrupted pages list as for full --prepare. innodb_corrupted_pages file is modified or removed only in base directory. If DDL happens during backup, it is also processed at the end of backup to have correct tablespace names in innodb_corrupted_pages.
58 lines
1.9 KiB
C
58 lines
1.9 KiB
C
/******************************************************
|
|
XtraBackup: hot backup tool for InnoDB
|
|
(c) 2009-2013 Percona LLC and/or its affiliates.
|
|
Originally Created 3/3/2009 Yasufumi Kinoshita
|
|
Written by Alexey Kopytov, Aleksandr Kuzminsky, Stewart Smith, Vadim Tkachenko,
|
|
Yasufumi Kinoshita, Ignacio Nin and Baron Schwartz.
|
|
|
|
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 Foundation; version 2 of the License.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA
|
|
|
|
*******************************************************/
|
|
|
|
/* Page write filter interface */
|
|
|
|
#ifndef XB_WRITE_FILT_H
|
|
#define XB_WRITE_FILT_H
|
|
|
|
#include "fil_cur.h"
|
|
#include "datasink.h"
|
|
#include "xtrabackup.h"
|
|
|
|
/* Incremental page filter context */
|
|
typedef struct {
|
|
ulint delta_buf_size;
|
|
byte *delta_buf;
|
|
ulint npages;
|
|
CorruptedPages *corrupted_pages;
|
|
} xb_wf_incremental_ctxt_t;
|
|
|
|
/* Page filter context used as an opaque structure by callers */
|
|
typedef struct {
|
|
xb_fil_cur_t *cursor;
|
|
xb_wf_incremental_ctxt_t wf_incremental_ctxt;
|
|
} xb_write_filt_ctxt_t;
|
|
|
|
|
|
typedef struct {
|
|
my_bool (*init)(xb_write_filt_ctxt_t *ctxt, char *dst_name,
|
|
xb_fil_cur_t *cursor, CorruptedPages *corrupted_pages);
|
|
my_bool (*process)(xb_write_filt_ctxt_t *ctxt, ds_file_t *dstfile);
|
|
my_bool (*finalize)(xb_write_filt_ctxt_t *, ds_file_t *dstfile);
|
|
void (*deinit)(xb_write_filt_ctxt_t *);
|
|
} xb_write_filt_t;
|
|
|
|
extern xb_write_filt_t wf_write_through;
|
|
extern xb_write_filt_t wf_incremental;
|
|
|
|
#endif /* XB_WRITE_FILT_H */
|