@@ -2507,9 +2507,11 @@ recv_sys_t::parse_mtr_result recv_sys_t::parse(source &l, bool if_exists)
2507
2507
ut_ad (log_sys.is_latest ());
2508
2508
2509
2509
alignas (8 ) byte iv[MY_AES_BLOCK_SIZE];
2510
- byte *decrypt_buf= storing != BACKUP
2511
- ? static_cast <byte*>(alloca (srv_page_size)) : nullptr ;
2512
-
2510
+ byte *decrypt_buf=
2511
+ static_cast <byte*>(alloca (storing == BACKUP
2512
+ ? 1 /* type,length*/ + 5 /* space_id*/ +
2513
+ 5 /* page_no*/ + 1 /* rlen*/
2514
+ : srv_page_size));
2513
2515
const lsn_t start_lsn{lsn};
2514
2516
2515
2517
/* Check that the entire mini-transaction is included within the buffer */
@@ -2599,7 +2601,10 @@ recv_sys_t::parse_mtr_result recv_sys_t::parse(source &l, bool if_exists)
2599
2601
ut_d(std::set<page_id_t> modified);
2600
2602
#endif
2601
2603
2602
- uint32_t space_id= 0 , page_no= 0 , last_offset= 0 ;
2604
+ uint32_t space_id= 0 , page_no= 0 ;
2605
+ /* The end offset the last write (always 0 in storing==BACKUP).
2606
+ The value 1 means that no "same page" record is allowed. */
2607
+ uint last_offset= 0 ;
2603
2608
bool got_page_op= false ;
2604
2609
2605
2610
for (l= begin;; l+= rlen)
@@ -2712,8 +2717,7 @@ recv_sys_t::parse_mtr_result recv_sys_t::parse(source &l, bool if_exists)
2712
2717
{
2713
2718
mach_write_to_4 (iv + 8 , space_id);
2714
2719
mach_write_to_4 (iv + 12 , page_no);
2715
- byte eb[1 /* type,length*/ + 5 /* space_id*/ + 5 /* page_no*/ + 1 /* rlen*/ ];
2716
- if (*l.copy_if_needed (iv, eb, recs, 1 ) == TRIM_PAGES)
2720
+ if (*l.copy_if_needed (iv, decrypt_buf, recs, 1 ) == TRIM_PAGES)
2717
2721
undo_space_trunc (space_id);
2718
2722
}
2719
2723
continue ;
@@ -2762,10 +2766,10 @@ recv_sys_t::parse_mtr_result recv_sys_t::parse(source &l, bool if_exists)
2762
2766
case FREE_PAGE:
2763
2767
ut_ad (freed.emplace (id).second );
2764
2768
/* the next record must not be same_page */
2765
- last_offset= 1 ;
2769
+ if (storing != BACKUP) last_offset= 1 ;
2766
2770
goto free_or_init_page;
2767
2771
case INIT_PAGE:
2768
- last_offset= FIL_PAGE_TYPE;
2772
+ if (storing != BACKUP) last_offset= FIL_PAGE_TYPE;
2769
2773
free_or_init_page:
2770
2774
if (UNIV_UNLIKELY (rlen != 0 ))
2771
2775
goto record_corrupted;
@@ -2797,7 +2801,8 @@ recv_sys_t::parse_mtr_result recv_sys_t::parse(source &l, bool if_exists)
2797
2801
erase (r);
2798
2802
continue ;
2799
2803
}
2800
- cl= l.copy_if_needed (iv, decrypt_buf, recs, rlen);
2804
+ if (storing == YES)
2805
+ cl= l.copy_if_needed (iv, decrypt_buf, recs, rlen);
2801
2806
break ;
2802
2807
case EXTENDED:
2803
2808
if (storing == NO)
@@ -2811,7 +2816,8 @@ recv_sys_t::parse_mtr_result recv_sys_t::parse(source &l, bool if_exists)
2811
2816
continue ;
2812
2817
if (UNIV_UNLIKELY (!rlen))
2813
2818
goto record_corrupted;
2814
- cl= l.copy_if_needed (iv, decrypt_buf, recs, rlen);
2819
+ if (storing == YES || rlen == 1 )
2820
+ cl= l.copy_if_needed (iv, decrypt_buf, recs, rlen);
2815
2821
if (rlen == 1 && *cl == TRIM_PAGES)
2816
2822
{
2817
2823
if (!srv_is_undo_tablespace (space_id) ||
@@ -2825,15 +2831,15 @@ recv_sys_t::parse_mtr_result recv_sys_t::parse(source &l, bool if_exists)
2825
2831
truncated_undo_spaces[space_id - srv_undo_space_id_start]=
2826
2832
{ start_lsn, page_no };
2827
2833
/* the next record must not be same_page */
2828
- last_offset= 1 ;
2834
+ if (storing != BACKUP) last_offset= 1 ;
2829
2835
if (undo_space_trunc)
2830
2836
undo_space_trunc (space_id);
2831
2837
continue ;
2832
2838
}
2833
2839
/* This record applies to an undo log or index page, and it
2834
2840
may be followed by subsequent WRITE or similar records for the
2835
2841
same page in the same mini-transaction. */
2836
- last_offset= FIL_PAGE_TYPE;
2842
+ if (storing != BACKUP) last_offset= FIL_PAGE_TYPE;
2837
2843
break ;
2838
2844
case OPTION:
2839
2845
/* OPTION records can be safely ignored in recovery */
@@ -2850,6 +2856,8 @@ recv_sys_t::parse_mtr_result recv_sys_t::parse(source &l, bool if_exists)
2850
2856
case WRITE:
2851
2857
case MEMMOVE:
2852
2858
case MEMSET:
2859
+ if (storing == BACKUP)
2860
+ continue ;
2853
2861
if (storing == NO && UNIV_LIKELY (page_no != 0 ))
2854
2862
/* fil_space_set_recv_size_and_flags() is mandatory for storing==NO.
2855
2863
It is only applicable to page_no == 0. Other than that, we can just
0 commit comments