Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00026 #pragma once
00027 #ifndef log0recv_h
00028 #define log0recv_h
00029
00030 #include "univ.i"
00031 #include "ut0byte.h"
00032 #include "buf0types.h"
00033 #include "hash0hash.h"
00034 #include "log0log.h"
00035
00036 #ifdef UNIV_HOTBACKUP
00037 extern ibool recv_replay_file_ops;
00038
00039
00042 UNIV_INTERN
00043 ibool
00044 recv_read_cp_info_for_backup(
00045
00046 const byte* hdr,
00048 ib_uint64_t* lsn,
00049 ulint* offset,
00050 ulint* fsp_limit,
00053 ib_uint64_t* cp_no,
00054 ib_uint64_t* first_header_lsn);
00057
00060 UNIV_INTERN
00061 void
00062 recv_scan_log_seg_for_backup(
00063
00064 byte* buf,
00065 ulint buf_len,
00066 ib_uint64_t* scanned_lsn,
00068 ulint* scanned_checkpoint_no,
00072 ulint* n_bytes_scanned);
00075 #endif
00076
00079 UNIV_INLINE
00080 ibool
00081 recv_recovery_is_on(void);
00082
00083 #ifdef UNIV_LOG_ARCHIVE
00084
00087 UNIV_INLINE
00088 ibool
00089 recv_recovery_from_backup_is_on(void);
00090
00091 #endif
00092
00096 UNIV_INTERN
00097 void
00098 recv_recover_page_func(
00099
00100 #ifndef UNIV_HOTBACKUP
00101 ibool just_read_in,
00104 #endif
00105 buf_block_t* block);
00106 #ifndef UNIV_HOTBACKUP
00107
00115 # define recv_recover_page(jri, block) recv_recover_page_func(jri, block)
00116 #else
00117
00125 # define recv_recover_page(jri, block) recv_recover_page_func(block)
00126 #endif
00127
00133 UNIV_INTERN
00134 ulint
00135 recv_recovery_from_checkpoint_start_func(
00136
00137 #ifdef UNIV_LOG_ARCHIVE
00138 ulint type,
00140 ib_uint64_t limit_lsn,
00142 #endif
00143 ib_uint64_t min_flushed_lsn,
00145 ib_uint64_t max_flushed_lsn);
00147 #ifdef UNIV_LOG_ARCHIVE
00148
00158 # define recv_recovery_from_checkpoint_start(type,lim,min,max) \
00159 recv_recovery_from_checkpoint_start_func(type,lim,min,max)
00160 #else
00161
00171 # define recv_recovery_from_checkpoint_start(type,lim,min,max) \
00172 recv_recovery_from_checkpoint_start_func(min,max)
00173 #endif
00174
00176 UNIV_INTERN
00177 void
00178 recv_recovery_from_checkpoint_finish(void);
00179
00180
00182 UNIV_INTERN
00183 void
00184 recv_recovery_rollback_active(void);
00185
00186
00193 UNIV_INTERN
00194 ibool
00195 recv_scan_log_recs(
00196
00197 ulint available_memory,
00199 ibool store_to_hash,
00203 const byte* buf,
00205 ulint len,
00206 ib_uint64_t start_lsn,
00207 ib_uint64_t* contiguous_lsn,
00210 ib_uint64_t* group_scanned_lsn);
00212
00214 UNIV_INTERN
00215 void
00216 recv_reset_logs(
00217
00218 ib_uint64_t lsn,
00223 #ifdef UNIV_LOG_ARCHIVE
00224 ulint arch_log_no,
00225 #endif
00226 ibool new_logs_created);
00230 #ifdef UNIV_HOTBACKUP
00231
00233 UNIV_INTERN
00234 void
00235 recv_reset_log_files_for_backup(
00236
00237 const char* log_dir,
00238 ulint n_log_files,
00239 ulint log_file_size,
00240 ib_uint64_t lsn);
00242 #endif
00243
00245 UNIV_INTERN
00246 void
00247 recv_sys_create(void);
00248
00249
00251 UNIV_INTERN
00252 void
00253 recv_sys_close(void);
00254
00255
00257 UNIV_INTERN
00258 void
00259 recv_sys_mem_free(void);
00260
00261
00263 UNIV_INTERN
00264 void
00265 recv_sys_init(
00266
00267 ulint available_memory);
00268 #ifndef UNIV_HOTBACKUP
00269
00271 UNIV_INTERN
00272 void
00273 recv_sys_var_init(void);
00274
00275 #endif
00276
00279 UNIV_INTERN
00280 void
00281 recv_apply_hashed_log_recs(
00282
00283 ibool allow_ibuf);
00290 #ifdef UNIV_HOTBACKUP
00291
00293 UNIV_INTERN
00294 void
00295 recv_apply_log_recs_for_backup(void);
00296
00297 #endif
00298 #ifdef UNIV_LOG_ARCHIVE
00299
00302 UNIV_INTERN
00303 ulint
00304 recv_recovery_from_archive_start(
00305
00306 ib_uint64_t min_flushed_lsn,
00308 ib_uint64_t limit_lsn,
00310 ulint first_log_no);
00315
00317 UNIV_INTERN
00318 void
00319 recv_recovery_from_archive_finish(void);
00320
00321 #endif
00322
00324 typedef struct recv_data_struct recv_data_t;
00326 struct recv_data_struct{
00327 recv_data_t* next;
00331 };
00332
00334 typedef struct recv_struct recv_t;
00336 struct recv_struct{
00337 byte type;
00338 ulint len;
00339 recv_data_t* data;
00341 ib_uint64_t start_lsn;
00345 ib_uint64_t end_lsn;
00349 UT_LIST_NODE_T(recv_t)
00350 rec_list;
00351 };
00352
00354 enum recv_addr_state {
00356 RECV_NOT_PROCESSED,
00358 RECV_BEING_READ,
00360 RECV_BEING_PROCESSED,
00363 RECV_PROCESSED
00364 };
00365
00367 typedef struct recv_addr_struct recv_addr_t;
00369 struct recv_addr_struct{
00370 enum recv_addr_state state;
00372 unsigned space:32;
00373 unsigned page_no:32;
00374 UT_LIST_BASE_NODE_T(recv_t)
00375 rec_list;
00376 hash_node_t addr_hash;
00377 };
00378
00380 typedef struct recv_sys_struct recv_sys_t;
00382 struct recv_sys_struct{
00383 #ifndef UNIV_HOTBACKUP
00384 mutex_t mutex;
00387 #endif
00388 ibool apply_log_recs;
00393 ibool apply_batch_on;
00396 ib_uint64_t lsn;
00397 ulint last_log_buf_size;
00400 byte* last_block;
00403 byte* last_block_buf_start;
00406 byte* buf;
00407 ulint len;
00408 ib_uint64_t parse_start_lsn;
00413 ib_uint64_t scanned_lsn;
00416 ulint scanned_checkpoint_no;
00419 ulint recovered_offset;
00422 ib_uint64_t recovered_lsn;
00425 ib_uint64_t limit_lsn;
00427 ibool found_corrupt_log;
00432 #ifdef UNIV_LOG_ARCHIVE
00433 log_group_t* archive_group;
00436 #endif
00437 mem_heap_t* heap;
00439 hash_table_t* addr_hash;
00440 ulint n_addrs;
00442 };
00443
00445 extern recv_sys_t* recv_sys;
00446
00450 extern ibool recv_recovery_on;
00460 extern ibool recv_no_ibuf_operations;
00462 extern ibool recv_needed_recovery;
00463 #ifdef UNIV_DEBUG
00464
00466 extern ibool recv_no_log_write;
00467 #endif
00468
00472 extern ibool recv_lsn_checks_on;
00473 #ifdef UNIV_HOTBACKUP
00474
00475 extern ibool recv_is_making_a_backup;
00476 #endif
00477
00478 extern ulint recv_max_parsed_page_no;
00479
00482 #define RECV_PARSING_BUF_SIZE (2 * 1024 * 1024)
00483
00486 #define RECV_SCAN_SIZE (4 * UNIV_PAGE_SIZE)
00487
00492 extern ulint recv_n_pool_free_frames;
00493
00494 #ifndef UNIV_NONINL
00495 #include "log0recv.ic"
00496 #endif
00497
00498 #endif