1 | /****************************************************** |
2 | Copyright (c) 2011-2015 Percona LLC and/or its affiliates. |
3 | |
4 | Declarations for xtrabackup.cc |
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 XB_XTRABACKUP_H |
22 | #define XB_XTRABACKUP_H |
23 | |
24 | #include <my_getopt.h> |
25 | #include "datasink.h" |
26 | #include "xbstream.h" |
27 | #include "changed_page_bitmap.h" |
28 | |
29 | struct xb_delta_info_t |
30 | { |
31 | xb_delta_info_t(page_size_t page_size, ulint space_id) |
32 | : page_size(page_size), space_id(space_id) {} |
33 | |
34 | page_size_t page_size; |
35 | ulint space_id; |
36 | }; |
37 | |
38 | /* value of the --incremental option */ |
39 | extern lsn_t incremental_lsn; |
40 | |
41 | extern char *xtrabackup_target_dir; |
42 | extern char *xtrabackup_incremental_dir; |
43 | extern char *xtrabackup_incremental_basedir; |
44 | extern char *innobase_data_home_dir; |
45 | extern char *innobase_buffer_pool_filename; |
46 | extern char *xb_plugin_dir; |
47 | extern uint opt_protocol; |
48 | extern ds_ctxt_t *ds_meta; |
49 | extern ds_ctxt_t *ds_data; |
50 | |
51 | /* The last checkpoint LSN at the backup startup time */ |
52 | extern lsn_t checkpoint_lsn_start; |
53 | |
54 | extern xb_page_bitmap *changed_page_bitmap; |
55 | |
56 | extern char *xtrabackup_incremental; |
57 | extern my_bool xtrabackup_incremental_force_scan; |
58 | |
59 | extern lsn_t metadata_from_lsn; |
60 | extern lsn_t metadata_to_lsn; |
61 | extern lsn_t metadata_last_lsn; |
62 | |
63 | extern xb_stream_fmt_t xtrabackup_stream_fmt; |
64 | extern ibool xtrabackup_stream; |
65 | |
66 | extern char *xtrabackup_tables; |
67 | extern char *xtrabackup_tables_file; |
68 | extern char *xtrabackup_databases; |
69 | extern char *xtrabackup_databases_file; |
70 | extern char *xtrabackup_tables_exclude; |
71 | extern char *xtrabackup_databases_exclude; |
72 | |
73 | extern ibool xtrabackup_compress; |
74 | |
75 | extern my_bool xtrabackup_backup; |
76 | extern my_bool xtrabackup_prepare; |
77 | extern my_bool xtrabackup_copy_back; |
78 | extern my_bool xtrabackup_move_back; |
79 | extern my_bool xtrabackup_decrypt_decompress; |
80 | |
81 | extern char *innobase_data_file_path; |
82 | extern longlong innobase_page_size; |
83 | |
84 | extern int xtrabackup_parallel; |
85 | |
86 | extern my_bool xb_close_files; |
87 | extern const char *xtrabackup_compress_alg; |
88 | #ifdef __cplusplus |
89 | extern "C" { |
90 | #endif |
91 | extern uint xtrabackup_compress_threads; |
92 | extern ulonglong xtrabackup_compress_chunk_size; |
93 | #ifdef __cplusplus |
94 | } |
95 | #endif |
96 | extern my_bool xtrabackup_export; |
97 | extern char *; |
98 | extern ulint xtrabackup_log_copy_interval; |
99 | extern char *xtrabackup_stream_str; |
100 | extern long xtrabackup_throttle; |
101 | extern longlong xtrabackup_use_memory; |
102 | |
103 | extern my_bool opt_galera_info; |
104 | extern my_bool opt_slave_info; |
105 | extern my_bool opt_no_lock; |
106 | extern my_bool opt_safe_slave_backup; |
107 | extern my_bool opt_rsync; |
108 | extern my_bool opt_force_non_empty_dirs; |
109 | extern my_bool opt_noversioncheck; |
110 | extern my_bool opt_no_backup_locks; |
111 | extern my_bool opt_decompress; |
112 | extern my_bool opt_remove_original; |
113 | extern my_bool opt_lock_ddl_per_table; |
114 | |
115 | extern char *opt_incremental_history_name; |
116 | extern char *opt_incremental_history_uuid; |
117 | |
118 | extern char *opt_user; |
119 | extern char *opt_password; |
120 | extern char *opt_host; |
121 | extern char *opt_defaults_group; |
122 | extern char *opt_socket; |
123 | extern uint opt_port; |
124 | extern char *opt_log_bin; |
125 | |
126 | extern const char *query_type_names[]; |
127 | |
128 | enum query_type_t {QUERY_TYPE_ALL, QUERY_TYPE_UPDATE, |
129 | QUERY_TYPE_SELECT}; |
130 | |
131 | extern TYPELIB query_type_typelib; |
132 | |
133 | extern ulong opt_lock_wait_query_type; |
134 | extern ulong opt_kill_long_query_type; |
135 | |
136 | extern uint opt_kill_long_queries_timeout; |
137 | extern uint opt_lock_wait_timeout; |
138 | extern uint opt_lock_wait_threshold; |
139 | extern uint opt_debug_sleep_before_unlock; |
140 | extern uint opt_safe_slave_backup_timeout; |
141 | |
142 | extern const char *opt_history; |
143 | |
144 | enum binlog_info_enum { BINLOG_INFO_OFF, BINLOG_INFO_LOCKLESS, BINLOG_INFO_ON, |
145 | BINLOG_INFO_AUTO}; |
146 | |
147 | extern ulong opt_binlog_info; |
148 | |
149 | void xtrabackup_io_throttling(void); |
150 | my_bool xb_write_delta_metadata(const char *filename, |
151 | const xb_delta_info_t *info); |
152 | |
153 | /************************************************************************ |
154 | Checks if a table specified as a name in the form "database/name" (InnoDB 5.6) |
155 | or "./database/name.ibd" (InnoDB 5.5-) should be skipped from backup based on |
156 | the --tables or --tables-file options. |
157 | |
158 | @return TRUE if the table should be skipped. */ |
159 | my_bool |
160 | check_if_skip_table( |
161 | /******************/ |
162 | const char* name); /*!< in: path to the table */ |
163 | |
164 | |
165 | /************************************************************************ |
166 | Checks if a database specified by path should be skipped from backup based on |
167 | the --databases, --databases_file or --databases_exclude options. |
168 | |
169 | @return TRUE if the table should be skipped. */ |
170 | my_bool |
171 | check_if_skip_database_by_path( |
172 | const char* path /*!< in: path to the db directory. */ |
173 | ); |
174 | |
175 | /************************************************************************ |
176 | Check if parameter is set in defaults file or via command line argument |
177 | @return true if parameter is set. */ |
178 | bool |
179 | check_if_param_set(const char *param); |
180 | |
181 | #if defined(HAVE_OPENSSL) |
182 | extern my_bool opt_ssl_verify_server_cert; |
183 | #endif |
184 | |
185 | |
186 | my_bool |
187 | xb_get_one_option(int optid, |
188 | const struct my_option *opt __attribute__((unused)), |
189 | char *argument); |
190 | |
191 | const char* |
192 | xb_get_copy_action(const char *dflt = "Copying" ); |
193 | |
194 | void mdl_lock_init(); |
195 | void mdl_lock_table(ulint space_id); |
196 | void mdl_unlock_all(); |
197 | bool ends_with(const char *str, const char *suffix); |
198 | #endif /* XB_XTRABACKUP_H */ |
199 | |