MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
log0recv.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 1997, 2012, Oracle and/or its affiliates. All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify it under
6 the terms of the GNU General Public License as published by the Free Software
7 Foundation; version 2 of the License.
8 
9 This program is distributed in the hope that it will be useful, but WITHOUT
10 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License along with
14 this program; if not, write to the Free Software Foundation, Inc.,
15 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
16 
17 *****************************************************************************/
18 
19 /**************************************************/
26 #ifndef log0recv_h
27 #define log0recv_h
28 
29 #include "univ.i"
30 #include "ut0byte.h"
31 #include "buf0types.h"
32 #include "hash0hash.h"
33 #include "log0log.h"
34 
35 #ifdef UNIV_HOTBACKUP
36 extern ibool recv_replay_file_ops;
37 
38 /*******************************************************************/
41 UNIV_INTERN
42 ibool
43 recv_read_checkpoint_info_for_backup(
44 /*=================================*/
45  const byte* hdr,
47  lsn_t* lsn,
48  lsn_t* offset,
49  lsn_t* cp_no,
50  lsn_t* first_header_lsn)
53  __attribute__((nonnull));
54 /*******************************************************************/
57 UNIV_INTERN
58 void
59 recv_scan_log_seg_for_backup(
60 /*=========================*/
61  byte* buf,
62  ulint buf_len,
63  lsn_t* scanned_lsn,
65  ulint* scanned_checkpoint_no,
69  ulint* n_bytes_scanned);
72 #endif /* UNIV_HOTBACKUP */
73 /*******************************************************************/
76 UNIV_INLINE
77 ibool
79 /*=====================*/
80 #ifdef UNIV_LOG_ARCHIVE
81 /*******************************************************************/
84 UNIV_INLINE
85 ibool
86 recv_recovery_from_backup_is_on(void);
87 /*=================================*/
88 #endif /* UNIV_LOG_ARCHIVE */
89 /************************************************************************/
93 UNIV_INTERN
94 void
96 /*===================*/
97 #ifndef UNIV_HOTBACKUP
98  ibool just_read_in,
101 #endif /* !UNIV_HOTBACKUP */
102  buf_block_t* block);
103 #ifndef UNIV_HOTBACKUP
104 
112 # define recv_recover_page(jri, block) recv_recover_page_func(jri, block)
113 #else /* !UNIV_HOTBACKUP */
114 
122 # define recv_recover_page(jri, block) recv_recover_page_func(block)
123 #endif /* !UNIV_HOTBACKUP */
124 /********************************************************/
130 UNIV_INTERN
131 dberr_t
133 /*=====================================*/
134 #ifdef UNIV_LOG_ARCHIVE
135  ulint type,
137  lsn_t limit_lsn,
139 #endif /* UNIV_LOG_ARCHIVE */
140  lsn_t min_flushed_lsn,
142  lsn_t max_flushed_lsn);
144 #ifdef UNIV_LOG_ARCHIVE
145 
155 # define recv_recovery_from_checkpoint_start(type,lim,min,max) \
156  recv_recovery_from_checkpoint_start_func(type,lim,min,max)
157 #else /* UNIV_LOG_ARCHIVE */
158 
168 # define recv_recovery_from_checkpoint_start(type,lim,min,max) \
169  recv_recovery_from_checkpoint_start_func(min,max)
170 #endif /* UNIV_LOG_ARCHIVE */
171 /********************************************************/
173 UNIV_INTERN
174 void
176 /*======================================*/
177 /********************************************************/
179 UNIV_INTERN
180 void
182 /*===============================*/
183 /*******************************************************/
190 UNIV_INTERN
191 ibool
193 /*===============*/
194  ulint available_memory,
196  ibool store_to_hash,
200  const byte* buf,
202  ulint len,
203  lsn_t start_lsn,
204  lsn_t* contiguous_lsn,
207  lsn_t* group_scanned_lsn);
209 /******************************************************/
211 UNIV_INTERN
212 void
214 /*============*/
215 #ifdef UNIV_LOG_ARCHIVE
216  ulint arch_log_no,
217  ibool new_logs_created,
221 #endif /* UNIV_LOG_ARCHIVE */
222  lsn_t lsn);
227 #ifdef UNIV_HOTBACKUP
228 /******************************************************/
230 UNIV_INTERN
231 void
232 recv_reset_log_files_for_backup(
233 /*============================*/
234  const char* log_dir,
235  ulint n_log_files,
236  lsn_t log_file_size,
237  lsn_t lsn);
239 #endif /* UNIV_HOTBACKUP */
240 /********************************************************/
242 UNIV_INTERN
243 void
244 recv_sys_create(void);
245 /*=================*/
246 /**********************************************************/
248 UNIV_INTERN
249 void
250 recv_sys_close(void);
251 /*================*/
252 /********************************************************/
254 UNIV_INTERN
255 void
256 recv_sys_mem_free(void);
257 /*===================*/
258 /********************************************************/
260 UNIV_INTERN
261 void
263 /*==========*/
264  ulint available_memory);
265 #ifndef UNIV_HOTBACKUP
266 /********************************************************/
268 UNIV_INTERN
269 void
270 recv_sys_var_init(void);
271 /*===================*/
272 #endif /* !UNIV_HOTBACKUP */
273 /*******************************************************************/
276 UNIV_INTERN
277 void
279 /*=======================*/
280  ibool allow_ibuf);
287 #ifdef UNIV_HOTBACKUP
288 /*******************************************************************/
290 UNIV_INTERN
291 void
292 recv_apply_log_recs_for_backup(void);
293 /*================================*/
294 #endif
295 #ifdef UNIV_LOG_ARCHIVE
296 /********************************************************/
299 UNIV_INTERN
300 ulint
301 recv_recovery_from_archive_start(
302 /*=============================*/
303  lsn_t min_flushed_lsn,
305  lsn_t limit_lsn,
307  ulint first_log_no);
312 /********************************************************/
314 UNIV_INTERN
315 void
316 recv_recovery_from_archive_finish(void);
317 /*===================================*/
318 #endif /* UNIV_LOG_ARCHIVE */
319 
321 struct recv_data_t{
326 };
327 
329 struct recv_t{
330  byte type;
331  ulint len;
334  lsn_t start_lsn;
338  lsn_t end_lsn;
344 };
345 
357 };
358 
360 struct recv_addr_t{
361  enum recv_addr_state state;
363  unsigned space:32;
364  unsigned page_no:32;
365  UT_LIST_BASE_NODE_T(recv_t)
367  hash_node_t addr_hash;
368 };
369 
371 struct recv_sys_t{
372 #ifndef UNIV_HOTBACKUP
373  ib_mutex_t mutex;
376  ib_mutex_t writer_mutex;
379 #endif /* !UNIV_HOTBACKUP */
380  ibool apply_log_recs;
385  ibool apply_batch_on;
388  lsn_t lsn;
389  ulint last_log_buf_size;
392  byte* last_block;
395  byte* last_block_buf_start;
398  byte* buf;
399  ulint len;
400  lsn_t parse_start_lsn;
405  lsn_t scanned_lsn;
408  ulint scanned_checkpoint_no;
411  ulint recovered_offset;
414  lsn_t recovered_lsn;
417  lsn_t limit_lsn;
419  ibool found_corrupt_log;
424 #ifdef UNIV_LOG_ARCHIVE
425  log_group_t* archive_group;
428 #endif /* !UNIV_LOG_ARCHIVE */
432  ulint n_addrs;
434 };
435 
437 extern recv_sys_t* recv_sys;
438 
442 extern ibool recv_recovery_on;
452 extern ibool recv_no_ibuf_operations;
454 extern ibool recv_needed_recovery;
455 #ifdef UNIV_DEBUG
456 
458 extern ibool recv_no_log_write;
459 #endif /* UNIV_DEBUG */
460 
464 extern ibool recv_lsn_checks_on;
465 #ifdef UNIV_HOTBACKUP
466 
467 extern ibool recv_is_making_a_backup;
468 #endif /* UNIV_HOTBACKUP */
469 
470 extern ulint recv_max_parsed_page_no;
471 
474 #define RECV_PARSING_BUF_SIZE (2 * 1024 * 1024)
475 
478 #define RECV_SCAN_SIZE (4 * UNIV_PAGE_SIZE)
479 
484 extern ulint recv_n_pool_free_frames;
485 
486 #ifndef UNIV_NONINL
487 #include "log0recv.ic"
488 #endif
489 
490 #endif