InnoDB Plugin  1.0
log0recv.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (c) 1997, 2014, 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 #include <list>
35 
36 #ifdef UNIV_HOTBACKUP
37 extern ibool recv_replay_file_ops;
38 
39 /*******************************************************************/
42 UNIV_INTERN
43 ibool
44 recv_read_checkpoint_info_for_backup(
45 /*=================================*/
46  const byte* hdr,
48  lsn_t* lsn,
49  lsn_t* offset,
50  lsn_t* cp_no,
51  lsn_t* first_header_lsn)
54  __attribute__((nonnull));
55 /*******************************************************************/
58 UNIV_INTERN
59 void
60 recv_scan_log_seg_for_backup(
61 /*=========================*/
62  byte* buf,
63  ulint buf_len,
64  lsn_t* scanned_lsn,
66  ulint* scanned_checkpoint_no,
70  ulint* n_bytes_scanned);
73 #endif /* UNIV_HOTBACKUP */
74 /*******************************************************************/
77 UNIV_INLINE
78 ibool
80 /*=====================*/
81 #ifdef UNIV_LOG_ARCHIVE
82 /*******************************************************************/
85 UNIV_INLINE
86 ibool
87 recv_recovery_from_backup_is_on(void);
88 /*=================================*/
89 #endif /* UNIV_LOG_ARCHIVE */
90 /************************************************************************/
94 UNIV_INTERN
95 void
97 /*===================*/
98 #ifndef UNIV_HOTBACKUP
99  ibool just_read_in,
102 #endif /* !UNIV_HOTBACKUP */
103  buf_block_t* block);
104 #ifndef UNIV_HOTBACKUP
105 
113 # define recv_recover_page(jri, block) recv_recover_page_func(jri, block)
114 #else /* !UNIV_HOTBACKUP */
115 
123 # define recv_recover_page(jri, block) recv_recover_page_func(block)
124 #endif /* !UNIV_HOTBACKUP */
125 /********************************************************/
131 UNIV_INTERN
132 dberr_t
134 /*=====================================*/
135 #ifdef UNIV_LOG_ARCHIVE
136  ulint type,
138  lsn_t limit_lsn,
140 #endif /* UNIV_LOG_ARCHIVE */
141  lsn_t min_flushed_lsn,
143  lsn_t max_flushed_lsn);
145 #ifdef UNIV_LOG_ARCHIVE
146 
156 # define recv_recovery_from_checkpoint_start(type,lim,min,max) \
157  recv_recovery_from_checkpoint_start_func(type,lim,min,max)
158 #else /* UNIV_LOG_ARCHIVE */
159 
169 # define recv_recovery_from_checkpoint_start(type,lim,min,max) \
170  recv_recovery_from_checkpoint_start_func(min,max)
171 #endif /* UNIV_LOG_ARCHIVE */
172 /********************************************************/
174 UNIV_INTERN
175 void
177 /*======================================*/
178 /********************************************************/
180 UNIV_INTERN
181 void
183 /*===============================*/
184 /*******************************************************/
191 UNIV_INTERN
192 ibool
194 /*===============*/
195  ulint available_memory,
197  ibool store_to_hash,
201  const byte* buf,
203  ulint len,
204  lsn_t start_lsn,
205  lsn_t* contiguous_lsn,
208  lsn_t* group_scanned_lsn);
210 /******************************************************/
212 UNIV_INTERN
213 void
215 /*============*/
216 #ifdef UNIV_LOG_ARCHIVE
217  ulint arch_log_no,
218  ibool new_logs_created,
222 #endif /* UNIV_LOG_ARCHIVE */
223  lsn_t lsn);
228 #ifdef UNIV_HOTBACKUP
229 /******************************************************/
231 UNIV_INTERN
232 void
233 recv_reset_log_files_for_backup(
234 /*============================*/
235  const char* log_dir,
236  ulint n_log_files,
237  lsn_t log_file_size,
238  lsn_t lsn);
240 #endif /* UNIV_HOTBACKUP */
241 /********************************************************/
243 UNIV_INTERN
244 void
245 recv_sys_create(void);
246 /*=================*/
247 /**********************************************************/
249 UNIV_INTERN
250 void
251 recv_sys_close(void);
252 /*================*/
253 /********************************************************/
255 UNIV_INTERN
256 void
257 recv_sys_mem_free(void);
258 /*===================*/
259 /********************************************************/
261 UNIV_INTERN
262 void
264 /*==========*/
265  ulint available_memory);
266 #ifndef UNIV_HOTBACKUP
267 /********************************************************/
269 UNIV_INTERN
270 void
271 recv_sys_var_init(void);
272 /*===================*/
273 #endif /* !UNIV_HOTBACKUP */
274 /*******************************************************************/
277 UNIV_INTERN
278 void
280 /*=======================*/
281  ibool allow_ibuf);
288 #ifdef UNIV_HOTBACKUP
289 /*******************************************************************/
291 UNIV_INTERN
292 void
293 recv_apply_log_recs_for_backup(void);
294 /*================================*/
295 #endif
296 #ifdef UNIV_LOG_ARCHIVE
297 /********************************************************/
300 UNIV_INTERN
301 ulint
302 recv_recovery_from_archive_start(
303 /*=============================*/
304  lsn_t min_flushed_lsn,
306  lsn_t limit_lsn,
308  ulint first_log_no);
313 /********************************************************/
315 UNIV_INTERN
316 void
317 recv_recovery_from_archive_finish(void);
318 /*===================================*/
319 #endif /* UNIV_LOG_ARCHIVE */
320 
322 struct recv_data_t{
327 };
328 
330 struct recv_t{
331  byte type;
332  ulint len;
335  lsn_t start_lsn;
339  lsn_t end_lsn;
343  UT_LIST_NODE_T(recv_t)
345 };
346 
358 };
359 
361 struct recv_addr_t{
362  enum recv_addr_state state;
364  unsigned space:32;
365  unsigned page_no:32;
366  UT_LIST_BASE_NODE_T(recv_t)
368  hash_node_t addr_hash;
369 };
370 
371 struct recv_dblwr_t {
372  void add(byte* page);
373 
374  byte* find_page(ulint space_id, ulint page_no);
375 
376  std::list<byte *> pages; /* Pages from double write buffer */
377 
378  void operator() () {
379  pages.clear();
380  }
381 };
382 
384 struct recv_sys_t{
385 #ifndef UNIV_HOTBACKUP
386  ib_mutex_t mutex;
389  ib_mutex_t writer_mutex;
392 #endif /* !UNIV_HOTBACKUP */
393  ibool apply_log_recs;
398  ibool apply_batch_on;
401  lsn_t lsn;
402  ulint last_log_buf_size;
405  byte* last_block;
408  byte* last_block_buf_start;
411  byte* buf;
412  ulint len;
413  lsn_t parse_start_lsn;
418  lsn_t scanned_lsn;
421  ulint scanned_checkpoint_no;
424  ulint recovered_offset;
427  lsn_t recovered_lsn;
430  lsn_t limit_lsn;
432  ibool found_corrupt_log;
437 #ifdef UNIV_LOG_ARCHIVE
438  log_group_t* archive_group;
441 #endif /* !UNIV_LOG_ARCHIVE */
442  mem_heap_t* heap;
445  ulint n_addrs;
448  recv_dblwr_t dblwr;
449 };
450 
452 extern recv_sys_t* recv_sys;
453 
457 extern ibool recv_recovery_on;
470 #ifdef UNIV_DEBUG
471 
473 extern ibool recv_no_log_write;
474 #endif /* UNIV_DEBUG */
475 
480 #ifdef UNIV_HOTBACKUP
481 
482 extern ibool recv_is_making_a_backup;
483 #endif /* UNIV_HOTBACKUP */
484 
485 extern ulint recv_max_parsed_page_no;
486 
489 #define RECV_PARSING_BUF_SIZE (2 * 1024 * 1024)
490 
493 #define RECV_SCAN_SIZE (4 * UNIV_PAGE_SIZE)
494 
499 extern ulint recv_n_pool_free_frames;
500 
501 #ifndef UNIV_NONINL
502 #include "log0recv.ic"
503 #endif
504 
505 #endif