summaryrefslogtreecommitdiffstats
path: root/storage/innobase/srv/srv0start.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/srv/srv0start.cc')
-rw-r--r--storage/innobase/srv/srv0start.cc48
1 files changed, 25 insertions, 23 deletions
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index ef5bcb67..738e0a7e 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -468,7 +468,7 @@ ATTRIBUTE_COLD static dberr_t srv_undo_tablespaces_reinit()
rseg->init(nullptr, FIL_NULL);
}
- if (trx_sys.recovered_binlog_lsn
+ if (*trx_sys.recovered_binlog_filename
#ifdef WITH_WSREP
|| !trx_sys.recovered_wsrep_xid.is_null()
#endif /* WITH_WSREP */
@@ -476,7 +476,7 @@ ATTRIBUTE_COLD static dberr_t srv_undo_tablespaces_reinit()
{
/* Update binlog offset, binlog file name & wsrep xid in
system tablespace rollback segment */
- if (trx_sys.recovered_binlog_lsn)
+ if (*trx_sys.recovered_binlog_filename)
{
ut_d(const size_t len = strlen(trx_sys.recovered_binlog_filename) + 1);
ut_ad(len > 1);
@@ -1122,10 +1122,14 @@ dberr_t srv_start(bool create_new_db)
if (srv_force_recovery) {
ib::info() << "!!! innodb_force_recovery is set to "
<< srv_force_recovery << " !!!";
+ if (srv_force_recovery == SRV_FORCE_NO_LOG_REDO) {
+ srv_read_only_mode = true;
+ }
}
- if (srv_force_recovery == SRV_FORCE_NO_LOG_REDO) {
- srv_read_only_mode = true;
+ if (srv_read_only_mode) {
+ sql_print_information("InnoDB: Started in read only mode");
+ srv_use_doublewrite_buf = false;
}
high_level_read_only = srv_read_only_mode
@@ -1302,6 +1306,10 @@ dberr_t srv_start(bool create_new_db)
ut_ad(buf_page_cleaner_is_active);
}
+ if (innodb_encrypt_temporary_tables && !log_crypt_init()) {
+ return srv_init_abort(DB_ERROR);
+ }
+
/* Check if undo tablespaces and redo log files exist before creating
a new system tablespace */
if (create_new_db) {
@@ -1310,6 +1318,11 @@ dberr_t srv_start(bool create_new_db)
return(srv_init_abort(DB_ERROR));
}
recv_sys.debug_free();
+ } else {
+ err = recv_recovery_read_checkpoint();
+ if (err != DB_SUCCESS) {
+ return srv_init_abort(err);
+ }
}
/* Open or create the data files. */
@@ -1334,12 +1347,9 @@ dberr_t srv_start(bool create_new_db)
" old data files which contain your precious data!";
/* fall through */
default:
- /* Other errors might come from Datafile::validate_first_page() */
- return(srv_init_abort(err));
- }
-
- if (innodb_encrypt_temporary_tables && !log_crypt_init()) {
- return srv_init_abort(DB_ERROR);
+ /* Other errors might be flagged by
+ Datafile::validate_first_page() */
+ return srv_init_abort(err);
}
if (create_new_db) {
@@ -1355,10 +1365,10 @@ dberr_t srv_start(bool create_new_db)
return srv_init_abort(err);
}
- srv_undo_space_id_start= 1;
+ srv_undo_space_id_start = 1;
}
- /* Open log file and data files in the systemtablespace: we keep
+ /* Open data files in the system tablespace: we keep
them open until database shutdown */
ut_d(fil_system.sys_space->recv_size = srv_sys_space_size_debug);
@@ -1771,21 +1781,13 @@ dberr_t srv_start(bool create_new_db)
}
if (srv_force_recovery < SRV_FORCE_NO_UNDO_LOG_SCAN) {
- /* The following call is necessary for the insert
+ /* The following call is necessary for the change
buffer to work with multiple tablespaces. We must
know the mapping between space id's and .ibd file
names.
- In a crash recovery, we check that the info in data
- dictionary is consistent with what we already know
- about space id's from the calls to fil_ibd_load().
-
- In a normal startup, we create the space objects for
- every table in the InnoDB data dictionary that has
- an .ibd file.
-
We also determine the maximum tablespace id used. */
- dict_check_tablespaces_and_store_max_id();
+ dict_check_tablespaces_and_store_max_id(nullptr);
}
if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO
@@ -1933,7 +1935,7 @@ void innodb_preshutdown()
better prevent any further changes from being buffered. */
innodb_change_buffering= 0;
- if (trx_sys.is_initialised())
+ if (srv_force_recovery < SRV_FORCE_NO_TRX_UNDO && srv_was_started)
while (trx_sys.any_active_transactions())
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}