1
1
/*****************************************************************************
2
2
3
3
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
4
+ Copyright (c) 2017, MariaDB Corporation.
4
5
5
6
This program is free software; you can redistribute it and/or modify it under
6
7
the terms of the GNU General Public License as published by the Free Software
@@ -65,7 +66,7 @@ this must be less than UNIV_PAGE_SIZE as it is stored in the buffer pool */
65
66
#define RECV_READ_AHEAD_AREA 32
66
67
67
68
/** The recovery system */
68
- UNIV_INTERN recv_sys_t * recv_sys = NULL ;
69
+ UNIV_INTERN recv_sys_t * recv_sys ;
69
70
/** TRUE when applying redo log records during crash recovery; FALSE
70
71
otherwise. Note that this is FALSE while a background thread is
71
72
rolling back incomplete transactions. */
@@ -121,9 +122,6 @@ UNIV_INTERN ibool recv_is_making_a_backup = FALSE;
121
122
UNIV_INTERN ibool recv_is_from_backup = FALSE;
122
123
# define buf_pool_get_curr_size () (5 * 1024 * 1024)
123
124
#endif /* !UNIV_HOTBACKUP */
124
- /** The following counter is used to decide when to print info on
125
- log scan */
126
- static ulint recv_scan_print_counter ;
127
125
128
126
/** The type of the previous parsed redo log record */
129
127
static ulint recv_previous_parsed_rec_type ;
@@ -275,8 +273,6 @@ recv_sys_var_init(void)
275
273
276
274
recv_no_ibuf_operations = FALSE;
277
275
278
- recv_scan_print_counter = 0 ;
279
-
280
276
recv_previous_parsed_rec_type = 999999 ;
281
277
282
278
recv_previous_parsed_rec_offset = 0 ;
@@ -342,6 +338,7 @@ recv_sys_init(
342
338
recv_sys -> last_block = ut_align (recv_sys -> last_block_buf_start ,
343
339
OS_FILE_LOG_BLOCK_SIZE );
344
340
recv_sys -> found_corrupt_log = FALSE;
341
+ recv_sys -> progress_time = ut_time ();
345
342
346
343
recv_max_page_lsn = 0 ;
347
344
@@ -1490,6 +1487,7 @@ recv_recover_page_func(
1490
1487
ibool success ;
1491
1488
#endif /* !UNIV_HOTBACKUP */
1492
1489
mtr_t mtr ;
1490
+ ib_time_t time ;
1493
1491
1494
1492
mutex_enter (& (recv_sys -> mutex ));
1495
1493
@@ -1669,6 +1667,8 @@ recv_recover_page_func(
1669
1667
1670
1668
mtr_commit (& mtr );
1671
1669
1670
+ time = ut_time ();
1671
+
1672
1672
mutex_enter (& (recv_sys -> mutex ));
1673
1673
1674
1674
if (recv_max_page_lsn < page_lsn ) {
@@ -1677,11 +1677,16 @@ recv_recover_page_func(
1677
1677
1678
1678
recv_addr -> state = RECV_PROCESSED ;
1679
1679
1680
- ut_a (recv_sys -> n_addrs );
1681
- recv_sys -> n_addrs -- ;
1682
-
1683
- mutex_exit (& (recv_sys -> mutex ));
1680
+ ut_a (recv_sys -> n_addrs > 0 );
1681
+ if (-- recv_sys -> n_addrs && recv_sys -> progress_time - time >= 15 ) {
1682
+ recv_sys -> progress_time = time ;
1683
+ ut_print_timestamp (stderr );
1684
+ fprintf (stderr ,
1685
+ " InnoDB: To recover: " ULINTPF " pages from log\n" ,
1686
+ recv_sys -> n_addrs );
1687
+ }
1684
1688
1689
+ mutex_exit (& recv_sys -> mutex );
1685
1690
}
1686
1691
1687
1692
#ifndef UNIV_HOTBACKUP
@@ -1727,9 +1732,6 @@ recv_read_in_area(
1727
1732
}
1728
1733
1729
1734
buf_read_recv_pages (FALSE, space , zip_size , page_nos , n );
1730
- /*
1731
- fprintf(stderr, "Recv pages at %lu n %lu\n", page_nos[0], n);
1732
- */
1733
1735
return (n );
1734
1736
}
1735
1737
@@ -1753,7 +1755,6 @@ recv_apply_hashed_log_recs(
1753
1755
recv_addr_t * recv_addr ;
1754
1756
ulint i ;
1755
1757
ulint n_pages ;
1756
- ibool has_printed = FALSE;
1757
1758
mtr_t mtr ;
1758
1759
loop :
1759
1760
mutex_enter (& (recv_sys -> mutex ));
@@ -1773,6 +1774,16 @@ recv_apply_hashed_log_recs(
1773
1774
recv_no_ibuf_operations = TRUE;
1774
1775
}
1775
1776
1777
+ if (recv_sys -> n_addrs ) {
1778
+ ut_print_timestamp (stderr );
1779
+ fprintf (stderr ,
1780
+ " InnoDB: %s" ULINTPF " pages from redo log\n" ,
1781
+ allow_ibuf
1782
+ ? "Starting final batch to recover "
1783
+ : "Starting a batch to recover " ,
1784
+ recv_sys -> n_addrs );
1785
+ }
1786
+
1776
1787
recv_sys -> apply_log_recs = TRUE;
1777
1788
recv_sys -> apply_batch_on = TRUE;
1778
1789
@@ -1786,16 +1797,6 @@ recv_apply_hashed_log_recs(
1786
1797
ulint page_no = recv_addr -> page_no ;
1787
1798
1788
1799
if (recv_addr -> state == RECV_NOT_PROCESSED ) {
1789
- if (!has_printed ) {
1790
- ut_print_timestamp (stderr );
1791
- fputs (" InnoDB: Starting an"
1792
- " apply batch of log records"
1793
- " to the database...\n"
1794
- "InnoDB: Progress in percents: " ,
1795
- stderr );
1796
- has_printed = TRUE;
1797
- }
1798
-
1799
1800
mutex_exit (& (recv_sys -> mutex ));
1800
1801
1801
1802
if (buf_page_peek (space , page_no )) {
@@ -1821,16 +1822,6 @@ recv_apply_hashed_log_recs(
1821
1822
1822
1823
recv_addr = HASH_GET_NEXT (addr_hash , recv_addr );
1823
1824
}
1824
-
1825
- if (has_printed
1826
- && (i * 100 ) / hash_get_n_cells (recv_sys -> addr_hash )
1827
- != ((i + 1 ) * 100 )
1828
- / hash_get_n_cells (recv_sys -> addr_hash )) {
1829
-
1830
- fprintf (stderr , "%lu " , (ulong )
1831
- ((i * 100 )
1832
- / hash_get_n_cells (recv_sys -> addr_hash )));
1833
- }
1834
1825
}
1835
1826
1836
1827
/* Wait until all the pages have been processed */
@@ -1844,11 +1835,6 @@ recv_apply_hashed_log_recs(
1844
1835
mutex_enter (& (recv_sys -> mutex ));
1845
1836
}
1846
1837
1847
- if (has_printed ) {
1848
-
1849
- fprintf (stderr , "\n" );
1850
- }
1851
-
1852
1838
if (!allow_ibuf ) {
1853
1839
/* Flush all the file pages to disk and invalidate them in
1854
1840
the buffer pool */
@@ -1876,10 +1862,6 @@ recv_apply_hashed_log_recs(
1876
1862
1877
1863
recv_sys_empty_hash ();
1878
1864
1879
- if (has_printed ) {
1880
- fprintf (stderr , "InnoDB: Apply batch completed\n" );
1881
- }
1882
-
1883
1865
mutex_exit (& (recv_sys -> mutex ));
1884
1866
}
1885
1867
#else /* !UNIV_HOTBACKUP */
@@ -1903,10 +1885,6 @@ recv_apply_log_recs_for_backup(void)
1903
1885
1904
1886
block = back_block1 ;
1905
1887
1906
- fputs ("InnoDB: Starting an apply batch of log records"
1907
- " to the database...\n"
1908
- "InnoDB: Progress in percents: " , stderr );
1909
-
1910
1888
n_hash_cells = hash_get_n_cells (recv_sys -> addr_hash );
1911
1889
1912
1890
for (i = 0 ; i < n_hash_cells ; i ++ ) {
@@ -2697,10 +2675,10 @@ recv_scan_log_recs(
2697
2675
#ifndef UNIV_HOTBACKUP
2698
2676
if (recv_log_scan_is_startup_type
2699
2677
&& !recv_needed_recovery ) {
2700
-
2678
+ ut_print_timestamp ( stderr );
2701
2679
fprintf (stderr ,
2702
- "InnoDB: Log scan progressed "
2703
- " past the checkpoint lsn %llu\n" ,
2680
+ " InnoDB: Starting crash recovery "
2681
+ " from checkpoint LSN= %llu\n" ,
2704
2682
recv_sys -> scanned_lsn );
2705
2683
recv_init_crash_recovery ();
2706
2684
}
@@ -2751,19 +2729,6 @@ recv_scan_log_recs(
2751
2729
2752
2730
* group_scanned_lsn = scanned_lsn ;
2753
2731
2754
- if (recv_needed_recovery
2755
- || (recv_is_from_backup && !recv_is_making_a_backup )) {
2756
- recv_scan_print_counter ++ ;
2757
-
2758
- if (finished || (recv_scan_print_counter % 80 == 0 )) {
2759
-
2760
- fprintf (stderr ,
2761
- "InnoDB: Doing recovery: scanned up to"
2762
- " log sequence number %llu\n" ,
2763
- * group_scanned_lsn );
2764
- }
2765
- }
2766
-
2767
2732
if (more_data && !recv_sys -> found_corrupt_log ) {
2768
2733
/* Try to parse more log records */
2769
2734
@@ -2854,17 +2819,6 @@ recv_init_crash_recovery(void)
2854
2819
2855
2820
recv_needed_recovery = TRUE;
2856
2821
2857
- ut_print_timestamp (stderr );
2858
-
2859
- fprintf (stderr ,
2860
- " InnoDB: Database was not"
2861
- " shut down normally!\n"
2862
- "InnoDB: Starting crash recovery.\n" );
2863
-
2864
- fprintf (stderr ,
2865
- "InnoDB: Reading tablespace information"
2866
- " from the .ibd files...\n" );
2867
-
2868
2822
fil_load_single_table_tablespaces ();
2869
2823
2870
2824
/* If we are using the doublewrite method, we will
@@ -2877,8 +2831,7 @@ recv_init_crash_recovery(void)
2877
2831
fprintf (stderr ,
2878
2832
"InnoDB: Restoring possible"
2879
2833
" half-written data pages from"
2880
- " the doublewrite\n"
2881
- "InnoDB: buffer...\n" );
2834
+ " the doublewrite buffer...\n" );
2882
2835
trx_sys_doublewrite_init_or_restore_pages (TRUE);
2883
2836
}
2884
2837
}
0 commit comments