Drizzled Public API Documentation

log0recv.h
Go to the documentation of this file.
1 /*****************************************************************************
2 
3 Copyright (C) 1997, 2010, Innobase Oy. 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., 51 Franklin
15 St, Fifth Floor, Boston, MA 02110-1301 USA
16 
17 *****************************************************************************/
18 
19 /**************************************************/
26 #pragma once
27 #ifndef log0recv_h
28 #define log0recv_h
29 
30 #include "univ.i"
31 #include "ut0byte.h"
32 #include "buf0types.h"
33 #include "hash0hash.h"
34 #include "log0log.h"
35 
36 #ifdef UNIV_HOTBACKUP
37 extern ibool recv_replay_file_ops;
38 
39 /*******************************************************************/
42 UNIV_INTERN
43 ibool
44 recv_read_cp_info_for_backup(
45 /*=========================*/
46  const byte* hdr,
48  ib_uint64_t* lsn,
49  ulint* offset,
50  ulint* fsp_limit,
53  ib_uint64_t* cp_no,
54  ib_uint64_t* first_header_lsn);
57 /*******************************************************************/
60 UNIV_INTERN
61 void
62 recv_scan_log_seg_for_backup(
63 /*=========================*/
64  byte* buf,
65  ulint buf_len,
66  ib_uint64_t* scanned_lsn,
68  ulint* scanned_checkpoint_no,
72  ulint* n_bytes_scanned);
75 #endif /* UNIV_HOTBACKUP */
76 /*******************************************************************/
79 UNIV_INLINE
80 ibool
82 /*=====================*/
83 #ifdef UNIV_LOG_ARCHIVE
84 /*******************************************************************/
87 UNIV_INLINE
88 ibool
89 recv_recovery_from_backup_is_on(void);
90 /*=================================*/
91 #endif /* UNIV_LOG_ARCHIVE */
92 /************************************************************************/
96 UNIV_INTERN
97 void
99 /*===================*/
100 #ifndef UNIV_HOTBACKUP
101  ibool just_read_in,
104 #endif /* !UNIV_HOTBACKUP */
105  buf_block_t* block);
106 #ifndef UNIV_HOTBACKUP
107 
115 # define recv_recover_page(jri, block) recv_recover_page_func(jri, block)
116 #else /* !UNIV_HOTBACKUP */
117 
125 # define recv_recover_page(jri, block) recv_recover_page_func(block)
126 #endif /* !UNIV_HOTBACKUP */
127 /********************************************************/
133 UNIV_INTERN
134 ulint
136 /*=====================================*/
137 #ifdef UNIV_LOG_ARCHIVE
138  ulint type,
140  ib_uint64_t limit_lsn,
142 #endif /* UNIV_LOG_ARCHIVE */
143  ib_uint64_t min_flushed_lsn,
145  ib_uint64_t max_flushed_lsn);
147 #ifdef UNIV_LOG_ARCHIVE
148 
158 # define recv_recovery_from_checkpoint_start(type,lim,min,max) \
159  recv_recovery_from_checkpoint_start_func(type,lim,min,max)
160 #else /* UNIV_LOG_ARCHIVE */
161 
171 # define recv_recovery_from_checkpoint_start(type,lim,min,max) \
172  recv_recovery_from_checkpoint_start_func(min,max)
173 #endif /* UNIV_LOG_ARCHIVE */
174 /********************************************************/
176 UNIV_INTERN
177 void
179 /*======================================*/
180 /********************************************************/
182 UNIV_INTERN
183 void
185 /*===============================*/
186 /*******************************************************/
193 UNIV_INTERN
194 ibool
196 /*===============*/
197  ulint available_memory,
199  ibool store_to_hash,
203  const byte* buf,
205  ulint len,
206  ib_uint64_t start_lsn,
207  ib_uint64_t* contiguous_lsn,
210  ib_uint64_t* group_scanned_lsn);
212 /******************************************************/
214 UNIV_INTERN
215 void
217 /*============*/
218  ib_uint64_t lsn,
223 #ifdef UNIV_LOG_ARCHIVE
224  ulint arch_log_no,
225 #endif /* UNIV_LOG_ARCHIVE */
226  ibool new_logs_created);
230 #ifdef UNIV_HOTBACKUP
231 /******************************************************/
233 UNIV_INTERN
234 void
235 recv_reset_log_files_for_backup(
236 /*============================*/
237  const char* log_dir,
238  ulint n_log_files,
239  ulint log_file_size,
240  ib_uint64_t lsn);
242 #endif /* UNIV_HOTBACKUP */
243 /********************************************************/
245 UNIV_INTERN
246 void
247 recv_sys_create(void);
248 /*=================*/
249 /**********************************************************/
251 UNIV_INTERN
252 void
253 recv_sys_close(void);
254 /*================*/
255 /********************************************************/
257 UNIV_INTERN
258 void
259 recv_sys_mem_free(void);
260 /*===================*/
261 /********************************************************/
263 UNIV_INTERN
264 void
266 /*==========*/
267  ulint available_memory);
268 #ifndef UNIV_HOTBACKUP
269 /********************************************************/
271 UNIV_INTERN
272 void
273 recv_sys_var_init(void);
274 /*===================*/
275 #endif /* !UNIV_HOTBACKUP */
276 /*******************************************************************/
279 UNIV_INTERN
280 void
282 /*=======================*/
283  ibool allow_ibuf);
290 #ifdef UNIV_HOTBACKUP
291 /*******************************************************************/
293 UNIV_INTERN
294 void
295 recv_apply_log_recs_for_backup(void);
296 /*================================*/
297 #endif
298 #ifdef UNIV_LOG_ARCHIVE
299 /********************************************************/
302 UNIV_INTERN
303 ulint
304 recv_recovery_from_archive_start(
305 /*=============================*/
306  ib_uint64_t min_flushed_lsn,
308  ib_uint64_t limit_lsn,
310  ulint first_log_no);
315 /********************************************************/
317 UNIV_INTERN
318 void
319 recv_recovery_from_archive_finish(void);
320 /*===================================*/
321 #endif /* UNIV_LOG_ARCHIVE */
322 
331 };
332 
334 typedef struct recv_struct recv_t;
336 struct recv_struct{
337  byte type;
338  ulint len;
341  ib_uint64_t start_lsn;
345  ib_uint64_t end_lsn;
351 };
352 
364 };
365 
370  enum recv_addr_state state;
372  unsigned space:32;
373  unsigned page_no:32;
376  hash_node_t addr_hash;
377 };
378 
383 #ifndef UNIV_HOTBACKUP
384  mutex_t mutex;
387 #endif /* !UNIV_HOTBACKUP */
388  ibool apply_log_recs;
393  ibool apply_batch_on;
396  ib_uint64_t lsn;
397  ulint last_log_buf_size;
400  byte* last_block;
403  byte* last_block_buf_start;
406  byte* buf;
407  ulint len;
408  ib_uint64_t parse_start_lsn;
413  ib_uint64_t scanned_lsn;
416  ulint scanned_checkpoint_no;
419  ulint recovered_offset;
422  ib_uint64_t recovered_lsn;
425  ib_uint64_t limit_lsn;
427  ibool found_corrupt_log;
432 #ifdef UNIV_LOG_ARCHIVE
433  log_group_t* archive_group;
436 #endif /* !UNIV_LOG_ARCHIVE */
437  mem_heap_t* heap;
440  ulint n_addrs;
442 };
443 
445 extern recv_sys_t* recv_sys;
446 
450 extern ibool recv_recovery_on;
460 extern ibool recv_no_ibuf_operations;
462 extern ibool recv_needed_recovery;
463 #ifdef UNIV_DEBUG
464 
466 extern ibool recv_no_log_write;
467 #endif /* UNIV_DEBUG */
468 
472 extern ibool recv_lsn_checks_on;
473 #ifdef UNIV_HOTBACKUP
474 
475 extern ibool recv_is_making_a_backup;
476 #endif /* UNIV_HOTBACKUP */
477 
478 extern ulint recv_max_parsed_page_no;
479 
482 #define RECV_PARSING_BUF_SIZE (2 * 1024 * 1024)
483 
486 #define RECV_SCAN_SIZE (4 * UNIV_PAGE_SIZE)
487 
492 extern ulint recv_n_pool_free_frames;
493 
494 #ifndef UNIV_NONINL
495 #include "log0recv.ic"
496 #endif
497 
498 #endif