diff options
16 files changed, 244 insertions, 83 deletions
diff --git a/mysql-test/include/have_unzip.inc b/mysql-test/include/have_unzip.inc deleted file mode 100644 index a3308524679..00000000000 --- a/mysql-test/include/have_unzip.inc +++ /dev/null @@ -1,3 +0,0 @@ -# -# empty. the real check happens in suite.pm -# diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm index 134a0d6d438..f501e610e53 100644 --- a/mysql-test/suite.pm +++ b/mysql-test/suite.pm @@ -68,8 +68,6 @@ sub skip_combinations { unless $::mysqld_variables{'version-ssl-library'} =~ /OpenSSL (\S+)/ and $1 ge "1.0.1d"; - $skip{'include/have_unzip.inc'} = 'no unzip executable' unless `unzip`; - %skip; } diff --git a/mysql-test/suite/innodb/r/log_corruption.result b/mysql-test/suite/innodb/r/log_corruption.result index 64a8824189f..18029f58d36 100644 --- a/mysql-test/suite/innodb/r/log_corruption.result +++ b/mysql-test/suite/innodb/r/log_corruption.result @@ -11,7 +11,9 @@ # Test a corrupted MLOG_FILE_NAME record. # valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2 # Test a corrupted MLOG_FILE_NAME record. -# valid header, invalid checkpoint 1, valid checkpoint 2 +# valid header, invalid checkpoint 1, valid checkpoint 2, invalid block +# valid header, invalid checkpoint 1, valid checkpoint 2, invalid log record +ib_buffer_pool ib_logfile0 ib_logfile1 ibdata1 diff --git a/mysql-test/suite/innodb/std_data/log_corruption.zip b/mysql-test/suite/innodb/std_data/log_corruption.zip Binary files differdeleted file mode 100644 index 6f126c2edf0..00000000000 --- a/mysql-test/suite/innodb/std_data/log_corruption.zip +++ /dev/null diff --git a/mysql-test/suite/innodb/std_data/log_corruption0.zip b/mysql-test/suite/innodb/std_data/log_corruption0.zip Binary files differdeleted file mode 100644 index c003a18a1b2..00000000000 --- a/mysql-test/suite/innodb/std_data/log_corruption0.zip +++ /dev/null diff --git a/mysql-test/suite/innodb/std_data/log_corruption1.zip b/mysql-test/suite/innodb/std_data/log_corruption1.zip Binary files differdeleted file mode 100644 index 35a02adaa6d..00000000000 --- a/mysql-test/suite/innodb/std_data/log_corruption1.zip +++ /dev/null diff --git a/mysql-test/suite/innodb/std_data/log_corruption2.zip b/mysql-test/suite/innodb/std_data/log_corruption2.zip Binary files differdeleted file mode 100644 index 4e4180ac4a3..00000000000 --- a/mysql-test/suite/innodb/std_data/log_corruption2.zip +++ /dev/null diff --git a/mysql-test/suite/innodb/std_data/log_corruption3.zip b/mysql-test/suite/innodb/std_data/log_corruption3.zip Binary files differdeleted file mode 100644 index 2337c81a80b..00000000000 --- a/mysql-test/suite/innodb/std_data/log_corruption3.zip +++ /dev/null diff --git a/mysql-test/suite/innodb/std_data/log_corruption4.zip b/mysql-test/suite/innodb/std_data/log_corruption4.zip Binary files differdeleted file mode 100644 index 86002d7d42a..00000000000 --- a/mysql-test/suite/innodb/std_data/log_corruption4.zip +++ /dev/null diff --git a/mysql-test/suite/innodb/std_data/log_corruption4a.zip b/mysql-test/suite/innodb/std_data/log_corruption4a.zip Binary files differdeleted file mode 100644 index 6d072f3029f..00000000000 --- a/mysql-test/suite/innodb/std_data/log_corruption4a.zip +++ /dev/null diff --git a/mysql-test/suite/innodb/std_data/log_corruption5.zip b/mysql-test/suite/innodb/std_data/log_corruption5.zip Binary files differdeleted file mode 100644 index bbf0238efc9..00000000000 --- a/mysql-test/suite/innodb/std_data/log_corruption5.zip +++ /dev/null diff --git a/mysql-test/suite/innodb/std_data/log_corruption6.zip b/mysql-test/suite/innodb/std_data/log_corruption6.zip Binary files differdeleted file mode 100644 index 04dd687e7c9..00000000000 --- a/mysql-test/suite/innodb/std_data/log_corruption6.zip +++ /dev/null diff --git a/mysql-test/suite/innodb/t/log_corruption.test b/mysql-test/suite/innodb/t/log_corruption.test index 664894f2c41..0a02b4bae2b 100644 --- a/mysql-test/suite/innodb/t/log_corruption.test +++ b/mysql-test/suite/innodb/t/log_corruption.test @@ -1,4 +1,3 @@ ---source include/have_unzip.inc --source include/have_innodb.inc --source include/have_innodb_16k.inc @@ -25,95 +24,224 @@ secure_file_priv= skip_aria core_file "; +close OUT or die; +die unless open OUT, ">", "$ENV{bugdir}/ib_buffer_pool"; +close OUT or die; + +# Create a dummy system tablespace file using the default innodb_page_size=16k +die unless open OUT, ">", "$ENV{bugdir}/ibdata1"; +binmode OUT; + +# Tablespace header page with valid FSP_SIZE=768 pages. +# Also, write a dummy FSEG_MAGIC_N at offset 60 to keep fseg_inode_try_get() +# happy when fseg_n_reserved_pages() is following an invalid pointer +# from the all-zero change buffer header page (page 3). +print OUT pack("Nx[42]Nx[10]Nx[16312]Nx[4]", + 0xdeadbeef, # checksum + 768, # FSP_PAGE_SIZE + 97937874, # FSEG_MAGIC_N + 0xdeadbeef); # checksum +# Dummy pages 1..6. +print OUT chr(0) x (6 * 16384); +# Dictionary header page. +print OUT pack("NNx[62]Nx[8]Nx[16290]Nx[4]", + 0xdeadbeef, # checksum + 7, # FIL_PAGE_OFFSET + 8, # DICT_HDR_TABLES + 9, # DICT_HDR_INDEXES + 0xdeadbeef); # checksum + +# Empty SYS_TABLES page (page 8). +print OUT pack("NNNNx[8]nx[12]nnx[31]Cx[20]", + 0xdeadbeef, # checksum + 8, # FIL_PAGE_OFFSET + ~0, ~0, # FIL_PAGE_PREV, FIL_PAGE_NEXT + 17855, # FIL_PAGE_TYPE == FIL_PAGE_INDEX + 2, # PAGE_N_DIR_SLOTS + 124, # PAGE_HEAP_TOP + 1); # PAGE_INDEX_ID == DICT_TABLES_ID +print OUT pack("nxnn", 0x801, 3, 116), "infimum"; +print OUT pack("xnxnxx", 0x901, 0x803), "supremum"; +print OUT pack("x[16248]nnNx[4]", 116, 101, 0xdeadbeef); + +# Empty SYS_INDEXES page (page 9). +print OUT pack("NNNNx[8]nx[12]nnx[31]Cx[20]", + 0xdeadbeef, # checksum + 9, # FIL_PAGE_OFFSET + ~0, ~0, # FIL_PAGE_PREV, FIL_PAGE_NEXT + 17855, # FIL_PAGE_TYPE == FIL_PAGE_INDEX + 2, # PAGE_N_DIR_SLOTS + 124, # PAGE_HEAP_TOP + 3); # PAGE_INDEX_ID == DICT_INDEXES_ID + +print OUT pack("nxnn", 0x801, 3, 116), "infimum"; +print OUT pack("xnxnxx", 0x901, 0x803), "supremum"; +print OUT pack("x[16248]nnNx[4]", 116, 101, 0xdeadbeef); +print OUT chr(0) x (759 * 16384); +close OUT or die; + +# Create a dummy second redo log file +die unless open OUT, ">", "$ENV{bugdir}/ib_logfile1"; +binmode OUT; +print OUT chr(0) x 1048576; +close OUT or die; + +# Create a redo log from before MySQL 5.7.9 +die unless open OUT, ">", "$ENV{bugdir}/ib_logfile0"; +binmode OUT; +print OUT pack("x[9]nx[5]", 0x1286), " ", chr(0) x 492; +print OUT pack("x[13]nCNnxxNNx[256]", 0x1286, 12, 0x80c, 0xf0, ~0, ~0); +print OUT pack("H*x[1240]", "590DBAACFE922582"); +print OUT pack("H*x[5]", "800009440022000c0000000138"); +print OUT pack("H*x[475]H*", "12860cb7809781e80006626f677573", "089C0ADA"); +print OUT chr(0) x 1046016; +close OUT or die; EOF --echo # redo log from before MySQL 5.7.9 ---exec unzip $MTR_SUITE_DIR/std_data/log_corruption.zip -d $bugdir > $SEARCH_FILE --error 1 --exec $MYSQLD $args let SEARCH_PATTERN=InnoDB: Upgrade after a crash is not supported. This redo log was created before MySQL 5\\.7\\.9\\.; --source include/search_pattern_in_file.inc --echo # redo log from before MySQL 5.7.9, with corrupted log checkpoint ---remove_file $bugdir/ib_logfile0 ---copy_file $bugdir/ib_logfile1 $bugdir/ib_logfile0 +--move_file $bugdir/ib_logfile0 $bugdir/ib_logfile +--copy_file $bugdir/ib_logfile1 $bugdir/ib_logfile0 --error 1 --exec $MYSQLD $args let SEARCH_PATTERN=InnoDB: Upgrade after a crash is not supported. This redo log was created before MySQL 5\\.7\\.9, and we did not find a valid checkpoint; --source include/search_pattern_in_file.inc +let SEARCH_PATTERN=Plugin 'InnoDB' registration as a STORAGE ENGINE failed; +--source include/search_pattern_in_file.inc +let SEARCH_PATTERN=Unknown/unsupported storage engine: InnoDB; +--source include/search_pattern_in_file.inc --echo # redo log from before MySQL 5.7.9, with corrupted log block --remove_file $bugdir/ib_logfile0 ---exec unzip $MTR_SUITE_DIR/std_data/log_corruption0.zip -d $bugdir > $SEARCH_FILE +--move_file $bugdir/ib_logfile $bugdir/ib_logfile0 +perl; +die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; +binmode OUT; +die unless seek(OUT, 0x800, 0); +print OUT pack("Nx[508]", 0xc0deba5e); +close OUT or die; +EOF + --error 1 --exec $MYSQLD $args let SEARCH_PATTERN=InnoDB: Upgrade after a crash is not supported. This redo log was created before MySQL 5\\.7\\.9, and it appears corrupted; --source include/search_pattern_in_file.inc --echo # redo log from "after" MySQL 5.7.9, but with invalid header checksum ---remove_file $bugdir/ib_logfile0 ---exec unzip $MTR_SUITE_DIR/std_data/log_corruption1.zip -d $bugdir > $SEARCH_FILE +perl; +die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; +binmode OUT; +print OUT pack("N",2); +close OUT or die; +EOF --error 1 --exec $MYSQLD $args let SEARCH_PATTERN=InnoDB: Invalid redo log header checksum; --source include/search_pattern_in_file.inc --echo # distant future redo log format, with valid header checksum ---remove_file $bugdir/ib_logfile0 ---exec unzip $MTR_SUITE_DIR/std_data/log_corruption2.zip -d $bugdir > $SEARCH_FILE +perl; +die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; +binmode OUT; +print OUT pack("Nx[5]nx[5]", ~0, 0x1286); +print OUT "malicious intentions, or perhaps not"; +print OUT pack("x[456]N", 0x8a1bb475); +close OUT or die; +EOF --error 1 --exec $MYSQLD $args let SEARCH_PATTERN=InnoDB: Unsupported redo log format. The redo log was created with malicious intentions, or perhaps\. Please follow the instructions at http://dev.mysql.com/doc/refman/5.7/en/upgrading-downgrading.html; --source include/search_pattern_in_file.inc --echo # valid header, but old-format checkpoint blocks ---remove_file $bugdir/ib_logfile0 ---exec unzip $MTR_SUITE_DIR/std_data/log_corruption3.zip -d $bugdir > $SEARCH_FILE +perl; +die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; +binmode OUT; +# header block +print OUT pack("Nx[5]nx[5]", 1, 0x1286); +print OUT "malicious intentions, or perhaps not"; +print OUT pack("x[456]N", 0xd42d53a2); +# old-format checkpoint block 1 +print OUT pack("x[13]nCNnxxNNx[256]", 0x1286, 12, 0x80c, 0xf0, ~0, ~0); +print OUT pack("H*x[1240]", "590DBAACFE922582"); +print OUT pack("H*x[5]", "800009440022000c0000000138"); +print OUT pack("H*x[475]H*", "12860cb7809781e80006626f677573", "089C0ADA"); +close OUT or die; +EOF --error 1 --exec $MYSQLD $args let SEARCH_PATTERN=InnoDB: No valid checkpoint found .corrupted redo log; --source include/search_pattern_in_file.inc --echo # valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2, invalid block checksum ---remove_file $bugdir/ib_logfile0 ---exec unzip $MTR_SUITE_DIR/std_data/log_corruption4.zip -d $bugdir > $SEARCH_FILE +perl; +die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; +binmode OUT; +die unless seek(OUT, 0x210, 0); +print OUT pack("NNx[264]", 0, 0x80c); +print OUT pack("NNx[212]N", 0x590dbaac, 0xfe922582, 0xc72d49c4); +close OUT or die; +EOF # Anything below innodb_force_recovery=6 must find a valid redo log. # Missing tablespace files are tolerated already with innodb_force_recovery=1. --error 1 --exec $MYSQLD $args --innodb-force-recovery=5 -let SEARCH_PATTERN=InnoDB: Log block 2372 at lsn 1213952 has valid header, but checksum field contains 144444122, should be 3362026715; +let SEARCH_PATTERN=InnoDB: Invalid log block checksum. block: 2372 checkpoint no: 1 expected: 3362026715 found: 144444122; --source include/search_pattern_in_file.inc let SEARCH_PATTERN=InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 1213964 and the end 1213952\.; --source include/search_pattern_in_file.inc -let SEARCH_PATTERN=Plugin 'InnoDB' registration as a STORAGE ENGINE failed; ---source include/search_pattern_in_file.inc --echo # --innodb-force-recovery=6 (skip the entire redo log) ---error 1 ---exec $MYSQLD $args --innodb-force-recovery=6 -let SEARCH_PATTERN=InnoDB: Cannot create sys_virtual system tables. running in read-only mode; +--error 2 +--exec $MYSQLD $args --innodb-force-recovery=6 --unknown-option +--let SEARCH_PATTERN=\\[Note\\] InnoDB: .* started; log sequence number 0 +--source include/search_pattern_in_file.inc +--let SEARCH_PATTERN=\\[ERROR\\] Aborting --source include/search_pattern_in_file.inc --echo # valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2, invalid block number ---remove_file $bugdir/ib_logfile0 ---exec unzip $MTR_SUITE_DIR/std_data/log_corruption4a.zip -d $bugdir > $SEARCH_FILE +perl; +die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; +binmode OUT; +# header block +print OUT pack("Nx[5]nx[5]", 1, 0x1286); +print OUT "malicious intentions, or perhaps not"; +print OUT pack("x[456]N", 0xd42d53a2); +# checkpoint page 1 and all-zero checkpoint 2 +print OUT pack("x[13]nCNNx[264]", 0x1286, 12, 0, 0x80c); +print OUT pack("H*x[212]Nx[1024]", "590DBAACFE922582", 0xc72d49c4); +# redo log data +print OUT pack("H*x[5]", "C0DEBA5E0022000c0000000138"); +print OUT pack("H*x[475]H*", "12860cb7809781e80006626f677573", "089C0ADA"); +EOF +--copy_file $bugdir/ib_logfile0 $bugdir/ib_logfile # Anything below innodb_force_recovery=6 must find a valid redo log. # Missing tablespace files are tolerated already with innodb_force_recovery=1. --error 1 --exec $MYSQLD $args --innodb-force-recovery=5 let SEARCH_PATTERN=InnoDB: Ignoring the redo log due to missing MLOG_CHECKPOINT between the checkpoint 1213964 and the end 1213952\.; --source include/search_pattern_in_file.inc -let SEARCH_PATTERN=Plugin 'InnoDB' registration as a STORAGE ENGINE failed; ---source include/search_pattern_in_file.inc --echo # --innodb-force-recovery=6 (skip the entire redo log) ---error 1 ---exec $MYSQLD $args --innodb-force-recovery=6 -let SEARCH_PATTERN=InnoDB: Cannot create sys_virtual system tables. running in read-only mode; ---source include/search_pattern_in_file.inc +--error 2 +--exec $MYSQLD $args --innodb-force-recovery=6 --unknown-option --echo # Test a corrupted MLOG_FILE_NAME record. --echo # valid header, valid checkpoint 1, all-zero (invalid) checkpoint 2 --remove_file $bugdir/ib_logfile0 ---exec unzip $MTR_SUITE_DIR/std_data/log_corruption5.zip -d $bugdir > $SEARCH_FILE +--move_file $bugdir/ib_logfile $bugdir/ib_logfile0 +perl; +die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; +binmode OUT; +die unless seek(OUT, 0x800, 0); +print OUT pack("N", 0x80000944); +die unless seek(OUT, 0x9fc, 0); +print OUT pack("N", 0xc86474db); +close OUT or die; +EOF --error 1 --exec $MYSQLD $args let SEARCH_PATTERN=InnoDB: Log scan progressed past the checkpoint lsn 1213964; @@ -128,20 +256,50 @@ let SEARCH_PATTERN=InnoDB: Set innodb_force_recovery to ignore this error; --source include/search_pattern_in_file.inc --echo # Test a corrupted MLOG_FILE_NAME record. ---echo # valid header, invalid checkpoint 1, valid checkpoint 2 ---remove_file $bugdir/ib_logfile0 ---exec unzip $MTR_SUITE_DIR/std_data/log_corruption6.zip -d $bugdir > $SEARCH_FILE +--echo # valid header, invalid checkpoint 1, valid checkpoint 2, invalid block +perl; +die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; +binmode OUT; +# header block +print OUT pack("Nx[5]nx[5]", 1, 0x1286); +print OUT "ibbackup was here!!!1!"; +print OUT pack("x[470]N", 0x52b54540); +# invalid (all-zero) checkpoint page 1 and an empty log page +print OUT chr(0) x 1024; +# valid checkpoint block 2 +print OUT pack("x[13]nCNNx[264]", 0x1286, 12, 0, 0x80c); +print OUT pack("H*x[212]N", "590DBAACFE922582", 0xc72d49c4); +# log page +print OUT pack("H*", "800009440022000c00000001"); +# MLOG_CHECKPOINT record +print OUT pack("H*", "38000000000012860c"); +# MLOG_FILE_NAME record +print OUT pack("H*", "b7809781e80006"), "bigot"; +# padding and wrong log block checksum +print OUT pack("x[475]N", 150151); +close OUT or die; +EOF --error 1 --exec $MYSQLD $args -let SEARCH_PATTERN=InnoDB: ############### CORRUPT LOG RECORD FOUND ##################; ---source include/search_pattern_in_file.inc -let SEARCH_PATTERN=InnoDB: Log record type 55, page 151:488\. Log parsing proceeded successfully up to 1213973\. Previous log record type 56, is multi 0 Recv offset 9, prev 0; +let SEARCH_PATTERN=InnoDB: Invalid log block checksum. block: 2372 checkpoint no: 1 expected: 2454333373 found: 150151; --source include/search_pattern_in_file.inc -let SEARCH_PATTERN=InnoDB: Hex dump starting 0 bytes before and ending 13 bytes after the corrupted record; ---source include/search_pattern_in_file.inc -let SEARCH_PATTERN= len 22. hex 38000000000012860cb7809781e80006626f67757300. asc 8 bogus ; +--echo # valid header, invalid checkpoint 1, valid checkpoint 2, invalid log record +perl; +die unless open OUT, "+<", "$ENV{bugdir}/ib_logfile0"; +binmode OUT; +die unless seek(OUT, 0x9fc, 0); +print OUT pack("N", 2454333373); +close OUT or die; +EOF + +--error 1 +--exec $MYSQLD $args +--let SEARCH_PATTERN= len 22; hex 38000000000012860cb7809781e800066269676f7400; asc 8 bigot ; --source include/search_pattern_in_file.inc -let SEARCH_PATTERN=InnoDB: Set innodb_force_recovery to ignore this error; + +# Catch errors when built with one of the sanitizers +--let SEARCH_ABORT=FOUND +--let SEARCH_PATTERN=Sanitizer --source include/search_pattern_in_file.inc --list_files $bugdir diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc index 9321faed9c6..51c721bfc93 100644 --- a/storage/innobase/dict/dict0crea.cc +++ b/storage/innobase/dict/dict0crea.cc @@ -1679,6 +1679,11 @@ dict_create_or_check_foreign_constraint_tables(void) return(DB_SUCCESS); } + if (srv_read_only_mode + || srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO) { + return(DB_READ_ONLY); + } + trx = trx_allocate_for_mysql(); trx_set_dict_operation(trx, TRX_DICT_OP_TABLE); @@ -1808,11 +1813,9 @@ dict_create_or_check_sys_virtual() return(DB_SUCCESS); } - if (srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO - || srv_read_only_mode) { - ib::error() << "Cannot create sys_virtual system tables;" - " running in read-only mode."; - return(DB_ERROR); + if (srv_read_only_mode + || srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO) { + return(DB_READ_ONLY); } trx = trx_allocate_for_mysql(); @@ -2465,9 +2468,15 @@ dict_create_or_check_sys_tablespace(void) if (sys_tablespaces_err == DB_SUCCESS && sys_datafiles_err == DB_SUCCESS) { + srv_sys_tablespaces_open = true; return(DB_SUCCESS); } + if (srv_read_only_mode + || srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO) { + return(DB_READ_ONLY); + } + trx = trx_allocate_for_mysql(); trx_set_dict_operation(trx, TRX_DICT_OP_TABLE); @@ -2540,6 +2549,7 @@ dict_create_or_check_sys_tablespace(void) if (err == DB_SUCCESS) { ib::info() << "Tablespace and datafile system tables created."; + srv_sys_tablespaces_open = true; } /* Note: The master thread has not been started at this point. */ diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 78566d060cb..bc8b8ffd1dd 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -1023,25 +1023,24 @@ recv_find_max_checkpoint( /** Check the 4-byte checksum to the trailer checksum field of a log block. -@param[in] log block +@param[in] block log block +@param[in] print_err whether to report checksum mismatch @return whether the checksum matches */ bool -log_block_checksum_is_ok( - const byte* block, /*!< in: pointer to a log block */ - bool print_err) /*!< in print error ? */ +log_block_checksum_is_ok(const byte* block, bool print_err) { - if (log_block_get_checksum(block) != log_block_calc_checksum(block) && - print_err) { - ib::error() << " Log block checkpoint not correct." + bool valid + = log_block_get_checksum(block) == log_block_calc_checksum(block); + + if (!valid && print_err) { + ib::error() << "Invalid log block checksum." << " block: " << log_block_get_hdr_no(block) << " checkpoint no: " << log_block_get_checkpoint_no(block) - << " calc checkpoint: " << log_block_calc_checksum(block) - << " stored checkpoint: " << log_block_get_checksum(block); + << " expected: " << log_block_calc_checksum(block) + << " found: " << log_block_get_checksum(block); } - return(!innodb_log_checksums - || log_block_get_checksum(block) - == log_block_calc_checksum(block)); + return(valid || !innodb_log_checksums); } /** Try to parse a single log record body and also applies it if @@ -2778,12 +2777,6 @@ recv_scan_log_recs( return (TRUE); } - ib::error() << "Log block " << no << - " at lsn " << scanned_lsn << " has valid" - " header, but checksum field contains " - << log_block_get_checksum(log_block) - << ", should be " - << log_block_calc_checksum(log_block); /* Garbage or an incompletely written log block. This could be the result of killing the server diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 1d17bff4782..00acaed1555 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -2306,7 +2306,6 @@ files_checked: /* Open or Create SYS_TABLESPACES and SYS_DATAFILES so that tablespace names and other metadata can be found. */ - srv_sys_tablespaces_open = true; err = dict_create_or_check_sys_tablespace(); if (err != DB_SUCCESS) { return(srv_init_abort(err)); @@ -2435,7 +2434,8 @@ files_checked: } /* Create the doublewrite buffer to a new tablespace */ - if (buf_dblwr == NULL && !buf_dblwr_create()) { + if (!srv_read_only_mode && srv_force_recovery < SRV_FORCE_NO_TRX_UNDO + && !buf_dblwr_create()) { return(srv_init_abort(DB_ERROR)); } @@ -2503,20 +2503,22 @@ files_checked: /* Create the SYS_FOREIGN and SYS_FOREIGN_COLS system tables */ err = dict_create_or_check_foreign_constraint_tables(); - if (err != DB_SUCCESS) { - return(srv_init_abort(err)); - } - - /* Create the SYS_TABLESPACES system table */ - err = dict_create_or_check_sys_tablespace(); - if (err != DB_SUCCESS) { - return(srv_init_abort(err)); + if (err == DB_SUCCESS) { + err = dict_create_or_check_sys_tablespace(); + if (err == DB_SUCCESS) { + err = dict_create_or_check_sys_virtual(); + } } - srv_sys_tablespaces_open = true; - - /* Create the SYS_VIRTUAL system table */ - err = dict_create_or_check_sys_virtual(); - if (err != DB_SUCCESS) { + switch (err) { + case DB_SUCCESS: + break; + case DB_READ_ONLY: + if (srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO) { + break; + } + ib::error() << "Cannot create system tables in read-only mode"; + /* fall through */ + default: return(srv_init_abort(err)); } @@ -2757,7 +2759,8 @@ innodb_shutdown() ut_ad(dict_stats_event || !srv_was_started || srv_read_only_mode); ut_ad(dict_sys || !srv_was_started); ut_ad(trx_sys || !srv_was_started); - ut_ad(buf_dblwr || !srv_was_started); + ut_ad(buf_dblwr || !srv_was_started || srv_read_only_mode + || srv_force_recovery >= SRV_FORCE_NO_TRX_UNDO); ut_ad(lock_sys || !srv_was_started); ut_ad(btr_search_sys || !srv_was_started); ut_ad(ibuf || !srv_was_started); |