1 /******************************************************
2 Copyright (c) 2012 Percona LLC and/or its affiliates.
3 
4 Declarations of XtraBackup functions called by InnoDB code.
5 
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; version 2 of the License.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
18 
19 *******************************************************/
20 
21 #ifndef xb0xb_h
22 #define xb0xb_h
23 
24 extern bool innodb_log_checksums_specified;
25 extern bool innodb_checksum_algorithm_specified;
26 
27 extern bool opt_lock_ddl_per_table;
28 
29 extern bool use_dumped_tablespace_keys;
30 
31 /** Fetch tablespace key from "xtrabackup_keys".
32 @param[in]	space_id	tablespace id
33 @param[out]	key		fetched tablespace key
34 @param[out]	key		fetched tablespace iv */
35 bool xb_fetch_tablespace_key(ulint space_id, byte *key, byte *iv)
36     MY_ATTRIBUTE((warn_unused_result));
37 
38 /** Save tablespace key for later use.
39 @param[in]  space_id    tablespace id
40 @param[in]  key     tablespace key
41 @param[in]  key     tablespace iv */
42 void xb_insert_tablespace_key(ulint space_id, const byte *key, const byte *iv);
43 
44 /** Fetch tablespace key from "xtrabackup_keys" and set the encryption
45 type for the tablespace.
46 @param[in]	space		tablespace
47 @return DB_SUCCESS or error code */
48 dberr_t xb_set_encryption(fil_space_t *space)
49     MY_ATTRIBUTE((warn_unused_result));
50 
51 /** Add file to tablespace map.
52 @param[in]	file_name	file name
53 @param[in]	tablespace_name	corresponding tablespace name */
54 void xb_tablespace_map_add(const char *file_name, const char *tablespace_name);
55 
56 /** Delete tablespace from mapping.
57 @param[in]	tablespace_name	tablespace name */
58 void xb_tablespace_map_delete(const char *tablespace_name);
59 
60 /** Lookup backup file name for given file.
61 @param[in]	file_name	file name
62 @return		local file name */
63 std::string xb_tablespace_backup_file_path(const std::string &file_name);
64 
65 /************************************************************************
66 Checks if a table specified as a name in the form "database/name" (InnoDB 5.6)
67 or "./database/name.ibd" (InnoDB 5.5-) should be skipped from backup based on
68 the --tables or --tables-file options.
69 @return TRUE if the table should be skipped. */
70 bool check_if_skip_table(
71     /******************/
72     const char *name); /*!< in: path to the table */
73 
74 #endif
75