@@ -387,7 +387,6 @@ fil_name_process(
387
387
@param[in] first_page_no first page number in the file
388
388
@param[in] type MLOG_FILE_NAME or MLOG_FILE_DELETE
389
389
or MLOG_FILE_CREATE2 or MLOG_FILE_RENAME2
390
- @param[in] apply whether to apply the record
391
390
@return pointer to next redo log record
392
391
@retval NULL if this log record was truncated */
393
392
static
@@ -397,8 +396,7 @@ fil_name_parse(
397
396
const byte* end,
398
397
ulint space_id,
399
398
ulint first_page_no,
400
- mlog_id_t type,
401
- bool apply)
399
+ mlog_id_t type)
402
400
{
403
401
if (type == MLOG_FILE_CREATE2) {
404
402
if (end < ptr + 4 ) {
@@ -488,9 +486,6 @@ fil_name_parse(
488
486
reinterpret_cast <char *>(new_name), new_len,
489
487
space_id, false );
490
488
491
- if (!apply) {
492
- break ;
493
- }
494
489
if (!fil_op_replay_rename (
495
490
space_id, first_page_no,
496
491
reinterpret_cast <const char *>(ptr),
@@ -583,7 +578,6 @@ fil_name_process(
583
578
@param[in] first_page_no first page number in the file
584
579
@param[in] type MLOG_FILE_NAME or MLOG_FILE_DELETE
585
580
or MLOG_FILE_CREATE2 or MLOG_FILE_RENAME2
586
- @param[in] apply whether to apply the record
587
581
@retval pointer to next redo log record
588
582
@retval NULL if this log record was truncated */
589
583
static
@@ -593,8 +587,7 @@ fil_name_parse(
593
587
const byte* end,
594
588
ulint space_id,
595
589
ulint first_page_no,
596
- mlog_id_t type,
597
- bool apply)
590
+ mlog_id_t type)
598
591
{
599
592
600
593
ulint flags = mach_read_from_4 (ptr);
@@ -674,7 +667,7 @@ fil_name_parse(
674
667
fil_name_process (
675
668
name, len, space_id, true );
676
669
677
- if (apply && recv_replay_file_ops
670
+ if (recv_replay_file_ops
678
671
&& fil_space_get (space_id)) {
679
672
dberr_t err = fil_delete_tablespace (
680
673
space_id, BUF_REMOVE_FLUSH_NO_WRITE);
@@ -1668,7 +1661,6 @@ specified.
1668
1661
@param[in] end_ptr end of buffer
1669
1662
@param[in] space_id tablespace identifier
1670
1663
@param[in] page_no page number
1671
- @param[in] apply whether to apply the record
1672
1664
@param[in,out] block buffer block, or NULL if
1673
1665
a page log record should not be applied
1674
1666
or if it is a MLOG_FILE_ operation
@@ -1683,14 +1675,10 @@ recv_parse_or_apply_log_rec_body(
1683
1675
byte* end_ptr,
1684
1676
ulint space_id,
1685
1677
ulint page_no,
1686
- bool apply,
1687
1678
buf_block_t * block,
1688
1679
mtr_t * mtr)
1689
1680
{
1690
1681
ut_ad (!block == !mtr);
1691
- #ifndef UNIV_HOTBACKUP
1692
- ut_ad (!apply || recv_sys->mlog_checkpoint_lsn != 0 );
1693
- #endif /* !UNIV_HOTBACKUP */
1694
1682
1695
1683
switch (type) {
1696
1684
case MLOG_FILE_NAME:
@@ -1700,8 +1688,7 @@ recv_parse_or_apply_log_rec_body(
1700
1688
ut_ad (block == NULL );
1701
1689
/* Collect the file names when parsing the log,
1702
1690
before applying any log records. */
1703
- return (fil_name_parse (ptr, end_ptr, space_id, page_no, type,
1704
- apply));
1691
+ return (fil_name_parse (ptr, end_ptr, space_id, page_no, type));
1705
1692
case MLOG_INDEX_LOAD:
1706
1693
#ifdef UNIV_HOTBACKUP
1707
1694
/* While scaning redo logs during backup phase a
@@ -1774,8 +1761,7 @@ recv_parse_or_apply_log_rec_body(
1774
1761
encryption key information before the page 0 is recovered.
1775
1762
Otherwise, redo will not find the key to decrypt
1776
1763
the data pages. */
1777
- if (page_no == 0 && !is_system_tablespace (space_id)
1778
- && !apply) {
1764
+ if (page_no == 0 && !is_system_tablespace (space_id)) {
1779
1765
return (fil_write_encryption_parse (ptr,
1780
1766
end_ptr,
1781
1767
space_id));
@@ -1795,18 +1781,9 @@ recv_parse_or_apply_log_rec_body(
1795
1781
1796
1782
if (block) {
1797
1783
/* Applying a page log record. */
1798
- ut_ad (apply);
1799
1784
page = block->frame ;
1800
1785
page_zip = buf_block_get_page_zip (block);
1801
1786
ut_d (page_type = fil_page_get_type (page));
1802
- } else if (apply
1803
- && !is_predefined_tablespace (space_id)
1804
- && recv_spaces.find (space_id) == recv_spaces.end ()) {
1805
- ib::fatal () << " Missing MLOG_FILE_NAME or MLOG_FILE_DELETE"
1806
- " for redo log record " << type << " (page "
1807
- << space_id << " :" << page_no << " ) at "
1808
- << recv_sys->recovered_lsn << " ." ;
1809
- return (NULL );
1810
1787
} else {
1811
1788
/* Parsing a page log record. */
1812
1789
page = NULL ;
@@ -2520,7 +2497,7 @@ recv_recover_page_func(
2520
2497
recv_parse_or_apply_log_rec_body (
2521
2498
recv->type , buf, buf + recv->len ,
2522
2499
recv_addr->space , recv_addr->page_no ,
2523
- true , block, &mtr);
2500
+ block, &mtr);
2524
2501
2525
2502
end_lsn = recv->start_lsn + recv->len ;
2526
2503
mach_write_to_8 (FIL_PAGE_LSN + page, end_lsn);
@@ -3052,7 +3029,7 @@ recv_parse_log_rec(
3052
3029
}
3053
3030
3054
3031
new_ptr = recv_parse_or_apply_log_rec_body (
3055
- *type, new_ptr, end_ptr, *space, *page_no, apply, NULL , NULL );
3032
+ *type, new_ptr, end_ptr, *space, *page_no, NULL , NULL );
3056
3033
3057
3034
if (UNIV_UNLIKELY (new_ptr == NULL )) {
3058
3035
@@ -3159,15 +3136,13 @@ enum store_t {
3159
3136
hash table to wait merging to file pages.
3160
3137
@param[in] checkpoint_lsn the LSN of the latest checkpoint
3161
3138
@param[in] store whether to store page operations
3162
- @param[in] apply whether to apply the records
3163
3139
@return whether MLOG_CHECKPOINT record was seen the first time,
3164
3140
or corruption was noticed */
3165
3141
static MY_ATTRIBUTE ((warn_unused_result))
3166
3142
bool
3167
3143
recv_parse_log_recs(
3168
3144
lsn_t checkpoint_lsn,
3169
- store_t store,
3170
- bool apply)
3145
+ store_t store)
3171
3146
{
3172
3147
byte* ptr;
3173
3148
byte* end_ptr;
@@ -3213,7 +3188,7 @@ recv_parse_log_recs(
3213
3188
page no, and a pointer to the body of the log record */
3214
3189
3215
3190
len = recv_parse_log_rec (&type, ptr, end_ptr, &space,
3216
- &page_no, apply , &body);
3191
+ &page_no, true , &body);
3217
3192
3218
3193
if (len == 0 ) {
3219
3194
return (false );
@@ -3279,9 +3254,6 @@ recv_parse_log_recs(
3279
3254
}
3280
3255
recv_sys->mlog_checkpoint_lsn
3281
3256
= recv_sys->recovered_lsn ;
3282
- #ifndef UNIV_HOTBACKUP
3283
- return (true );
3284
- #endif /* !UNIV_HOTBACKUP */
3285
3257
}
3286
3258
break ;
3287
3259
case MLOG_FILE_NAME:
@@ -3425,7 +3397,7 @@ recv_parse_log_recs(
3425
3397
completely recovered (until MLOG_MULTI_REC_END). */
3426
3398
len = recv_parse_log_rec (
3427
3399
&type, ptr, end_ptr, &space, &page_no,
3428
- apply , &body);
3400
+ true , &body);
3429
3401
3430
3402
if (recv_sys->found_corrupt_log
3431
3403
&& !recv_report_corrupt_log (
@@ -3614,7 +3586,6 @@ recv_scan_log_recs(
3614
3586
bool finished = false ;
3615
3587
ulint data_len;
3616
3588
bool more_data = false ;
3617
- bool apply = recv_sys->mlog_checkpoint_lsn != 0 ;
3618
3589
ulint recv_parsing_buf_size = RECV_PARSING_BUF_SIZE;
3619
3590
3620
3591
ut_ad (start_lsn % OS_FILE_LOG_BLOCK_SIZE == 0 );
@@ -3781,7 +3752,7 @@ recv_scan_log_recs(
3781
3752
/* Try to parse more log records */
3782
3753
3783
3754
if (recv_parse_log_recs (checkpoint_lsn,
3784
- *store_to_hash, apply )) {
3755
+ *store_to_hash)) {
3785
3756
ut_ad (recv_sys->found_corrupt_log
3786
3757
|| recv_sys->found_corrupt_fs
3787
3758
|| recv_sys->mlog_checkpoint_lsn
@@ -3843,8 +3814,7 @@ recv_group_scan_log_recs(
3843
3814
lsn_t checkpoint_lsn = *contiguous_lsn;
3844
3815
lsn_t start_lsn;
3845
3816
lsn_t end_lsn;
3846
- store_t store_to_hash = recv_sys->mlog_checkpoint_lsn == 0
3847
- ? STORE_NO : (last_phase ? STORE_IF_EXISTS : STORE_YES);
3817
+ store_t store_to_hash = last_phase ? STORE_IF_EXISTS : STORE_YES;
3848
3818
ulint available_mem = UNIV_PAGE_SIZE
3849
3819
* (buf_pool_get_n_pages ()
3850
3820
- (recv_n_pool_free_frames * srv_buf_pool_instances));
@@ -3926,6 +3896,25 @@ recv_init_missing_space(dberr_t err, const recv_spaces_t::const_iterator& i)
3926
3896
return (err);
3927
3897
}
3928
3898
3899
+ /* * Report a missing mlog_file_name or mlog_file_delete record for
3900
+ the tablespace.
3901
+ @param[in] recv_addr Hashed page file address. */
3902
+ static
3903
+ void
3904
+ recv_init_missing_mlog (
3905
+ recv_addr_t * recv_addr)
3906
+ {
3907
+ ulint space_id = recv_addr->space ;
3908
+ ulint page_no = recv_addr->page_no ;
3909
+ ulint type = UT_LIST_GET_FIRST (recv_addr->rec_list )->type ;
3910
+ ulint start_lsn = UT_LIST_GET_FIRST (recv_addr->rec_list )->start_lsn ;
3911
+
3912
+ ib::fatal () << " Missing MLOG_FILE_NAME or MLOG_FILE_DELETE "
3913
+ " for redo log record " << type << " (page "
3914
+ << space_id << " :" << page_no << " ) at "
3915
+ << start_lsn;
3916
+ }
3917
+
3929
3918
/* * Check if all tablespaces were found for crash recovery.
3930
3919
@return error code or DB_SUCCESS */
3931
3920
static MY_ATTRIBUTE ((warn_unused_result))
@@ -3981,7 +3970,12 @@ recv_init_crash_recovery_spaces(void)
3981
3970
3982
3971
recv_spaces_t ::iterator i
3983
3972
= recv_spaces.find (space);
3984
- ut_ad (i != recv_spaces.end ());
3973
+
3974
+ if (i != recv_spaces.end ()) {
3975
+ recv_init_missing_mlog (recv_addr);
3976
+ recv_addr->state = RECV_DISCARDED;
3977
+ continue ;
3978
+ }
3985
3979
3986
3980
if (i->second .deleted ) {
3987
3981
ut_ad (missing_spaces.find (space)
@@ -4153,13 +4147,13 @@ recv_recovery_from_checkpoint_start(
4153
4147
return (DB_ERROR);
4154
4148
}
4155
4149
4156
- /* Look for MLOG_CHECKPOINT. */
4157
- recv_group_scan_log_recs (group, &contiguous_lsn, false );
4158
- /* The first scan should not have stored or applied any records. */
4159
- ut_ad (recv_sys->n_addrs == 0 );
4160
- ut_ad (!recv_sys->found_corrupt_fs );
4150
+ /* * Scan the redo log from checkpoint lsn and redo log to
4151
+ the hash table. */
4152
+ rescan = recv_group_scan_log_recs (group, &contiguous_lsn, false );
4161
4153
4162
- if (recv_sys->found_corrupt_log && !srv_force_recovery) {
4154
+
4155
+ if ((recv_sys->found_corrupt_log && !srv_force_recovery)
4156
+ || recv_sys->found_corrupt_fs ) {
4163
4157
log_mutex_exit ();
4164
4158
return (DB_ERROR);
4165
4159
}
@@ -4179,16 +4173,6 @@ recv_recovery_from_checkpoint_start(
4179
4173
4180
4174
group->scanned_lsn = checkpoint_lsn;
4181
4175
rescan = false ;
4182
- } else {
4183
- contiguous_lsn = checkpoint_lsn;
4184
- rescan = recv_group_scan_log_recs (
4185
- group, &contiguous_lsn, false );
4186
-
4187
- if ((recv_sys->found_corrupt_log && !srv_force_recovery)
4188
- || recv_sys->found_corrupt_fs ) {
4189
- log_mutex_exit ();
4190
- return (DB_ERROR);
4191
- }
4192
4176
}
4193
4177
4194
4178
/* NOTE: we always do a 'recovery' at startup, but only if
0 commit comments