summaryrefslogtreecommitdiff
path: root/storage/innobase/fsp/fsp0file.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/fsp/fsp0file.cc')
-rw-r--r--storage/innobase/fsp/fsp0file.cc38
1 files changed, 31 insertions, 7 deletions
diff --git a/storage/innobase/fsp/fsp0file.cc b/storage/innobase/fsp/fsp0file.cc
index 77faf58edcf..5d49d14f65c 100644
--- a/storage/innobase/fsp/fsp0file.cc
+++ b/storage/innobase/fsp/fsp0file.cc
@@ -280,11 +280,8 @@ Datafile::read_first_page(bool read_only_mode)
} else if (srv_operation == SRV_OPERATION_BACKUP) {
break;
} else {
-
- ib::error()
- << "Cannot read first page of '"
- << m_filepath << "' "
- << err;
+ ib::error() << "Cannot read first page of '"
+ << m_filepath << "': " << err;
break;
}
}
@@ -424,6 +421,9 @@ Datafile::validate_for_recovery()
" the first 64 pages.";
return(err);
}
+ if (m_space_id == ULINT_UNDEFINED) {
+ return DB_SUCCESS; /* empty file */
+ }
if (restore_from_doublewrite()) {
return(DB_CORRUPTION);
@@ -467,11 +467,18 @@ dberr_t Datafile::validate_first_page(lsn_t *flush_lsn)
if (error_txt != NULL) {
err_exit:
+ free_first_page();
+
+ if (recv_recovery_is_on()
+ || srv_operation == SRV_OPERATION_BACKUP) {
+ m_defer= true;
+ return DB_SUCCESS;
+ }
+
ib::info() << error_txt << " in datafile: " << m_filepath
<< ", Space ID:" << m_space_id << ", Flags: "
<< m_flags;
m_is_valid = false;
- free_first_page();
return(DB_CORRUPTION);
}
@@ -500,13 +507,18 @@ err_exit:
ulint logical_size = fil_space_t::logical_size(m_flags);
if (srv_page_size != logical_size) {
+ free_first_page();
+ if (recv_recovery_is_on()
+ || srv_operation == SRV_OPERATION_BACKUP) {
+ m_defer= true;
+ return DB_SUCCESS;
+ }
/* Logical size must be innodb_page_size. */
ib::error()
<< "Data file '" << m_filepath << "' uses page size "
<< logical_size << ", but the innodb_page_size"
" start-up parameter is "
<< srv_page_size;
- free_first_page();
return(DB_ERROR);
}
@@ -535,10 +547,18 @@ err_exit:
fil_node_t* node = UT_LIST_GET_FIRST(space->chain);
if (node && !strcmp(m_filepath, node->name)) {
+ok_exit:
mysql_mutex_unlock(&fil_system.mutex);
return DB_SUCCESS;
}
+ if (!m_space_id
+ && (recv_recovery_is_on()
+ || srv_operation == SRV_OPERATION_BACKUP)) {
+ m_defer= true;
+ goto ok_exit;
+ }
+
/* Make sure the space_id has not already been opened. */
ib::error() << "Attempted to open a previously opened"
" tablespace. Previous tablespace: "
@@ -575,6 +595,10 @@ Datafile::find_space_id()
file_size = os_file_get_size(m_handle);
+ if (!file_size) {
+ return DB_SUCCESS;
+ }
+
if (file_size == (os_offset_t) -1) {
ib::error() << "Could not get file size of datafile '"
<< m_filepath << "'";