mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Extend the innodb.log_corruption test.
Remove the dependency on unzip. Instead, generate the InnoDB files with perl. log_block_checksum_is_ok(): Correct the error message. recv_scan_log_recs(): Remove the duplicated error message for log block checksum mismatch. innobase_start_or_create_for_mysql(): If the server is in read-only mode or if innodb_force_recovery>=3, do not try to modify the system tablespace. (If the doublewrite buffer or the non-core system tables do not exist, do not try to create them.) innodb_shutdown(): Relax a debug assertion. If the system tablespace did not contain a doublewrite buffer and if we started up in innodb_read_only mode or with innodb_force_recovery>=3, it will not be created. dict_create_or_check_sys_tablespace(): Set the flag srv_sys_tablespaces_open when the tables exist.
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
#
|
||||
# empty. the real check happens in 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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 ##################;
|
||||
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: 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;
|
||||
--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: 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 ;
|
||||
--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
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
if (err == DB_SUCCESS) {
|
||||
err = dict_create_or_check_sys_tablespace();
|
||||
if (err == DB_SUCCESS) {
|
||||
err = dict_create_or_check_sys_virtual();
|
||||
}
|
||||
}
|
||||
|
||||
/* Create the SYS_TABLESPACES system table */
|
||||
err = dict_create_or_check_sys_tablespace();
|
||||
if (err != DB_SUCCESS) {
|
||||
return(srv_init_abort(err));
|
||||
}
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user