Commit 2b710090 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.4 into 10.5

parents b62a8466 d4e1fa39
...@@ -33,7 +33,7 @@ static int roundtrip(struct param *param, const unsigned char *buf, ...@@ -33,7 +33,7 @@ static int roundtrip(struct param *param, const unsigned char *buf,
if (write(1, &b, 1) < 1 || write_string(1, buf, buf_len)) if (write(1, &b, 1) < 1 || write_string(1, buf, buf_len))
return -1; return -1;
*pkt= (unsigned char *) param->buf; *pkt= (unsigned char *) param->buf;
return read_string(0, (char *) param->buf, (int) sizeof(param->buf)) - 1; return read_string(0, (char *) param->buf, (int) sizeof(param->buf));
} }
typedef struct st_mysql_server_auth_info typedef struct st_mysql_server_auth_info
......
...@@ -254,7 +254,7 @@ class mlog_init_t ...@@ -254,7 +254,7 @@ class mlog_init_t
{ {
ut_ad(mutex_own(&recv_sys.mutex)); ut_ad(mutex_own(&recv_sys.mutex));
ut_ad(recv_no_ibuf_operations); ut_ad(recv_no_ibuf_operations);
for (auto &i : inits) { for (map::value_type& i : inits) {
i.second.created = false; i.second.created = false;
} }
} }
...@@ -274,7 +274,7 @@ class mlog_init_t ...@@ -274,7 +274,7 @@ class mlog_init_t
ut_ad(!recv_no_ibuf_operations); ut_ad(!recv_no_ibuf_operations);
mtr.start(); mtr.start();
for (const auto& i : inits) { for (const map::value_type& i : inits) {
if (!i.second.created) { if (!i.second.created) {
continue; continue;
} }
...@@ -3258,21 +3258,19 @@ recv_validate_tablespace(bool rescan, bool& missing_tablespace) ...@@ -3258,21 +3258,19 @@ recv_validate_tablespace(bool rescan, bool& missing_tablespace)
return(err); return(err);
} }
/* When rescan is not needed then recv_sys.addr_hash will have /* When rescan is not needed, recv_sys.pages will contain the
all space id belongs to redo log. If rescan is needed and entire redo log. If rescan is needed or innodb_force_recovery
innodb_force_recovery > 0 then InnoDB can ignore missing tablespace. */ is set, we can ignore missing tablespaces. */
for (recv_spaces_t::iterator i = recv_spaces.begin(); for (const recv_spaces_t::value_type& rs : recv_spaces) {
i != recv_spaces.end(); i++) { if (rs.second.status != file_name_t::MISSING) {
if (i->second.status != file_name_t::MISSING) {
continue; continue;
} }
missing_tablespace = true; missing_tablespace = true;
if (srv_force_recovery > 0) { if (srv_force_recovery > 0) {
ib::warn() << "Tablespace " << i->first ib::warn() << "Tablespace " << rs.first
<<" was not found at " << i->second.name <<" was not found at " << rs.second.name
<<", and innodb_force_recovery was set." <<", and innodb_force_recovery was set."
<<" All redo log for this tablespace" <<" All redo log for this tablespace"
<<" will be ignored!"; <<" will be ignored!";
...@@ -3280,9 +3278,9 @@ recv_validate_tablespace(bool rescan, bool& missing_tablespace) ...@@ -3280,9 +3278,9 @@ recv_validate_tablespace(bool rescan, bool& missing_tablespace)
} }
if (!rescan) { if (!rescan) {
ib::info() << "Tablespace " << i->first ib::info() << "Tablespace " << rs.first
<< " was not found at '" << " was not found at '"
<< i->second.name << "', but there" << rs.second.name << "', but there"
<<" were no modifications either."; <<" were no modifications either.";
} }
} }
...@@ -3307,33 +3305,34 @@ recv_init_crash_recovery_spaces(bool rescan, bool& missing_tablespace) ...@@ -3307,33 +3305,34 @@ recv_init_crash_recovery_spaces(bool rescan, bool& missing_tablespace)
ut_ad(!srv_read_only_mode); ut_ad(!srv_read_only_mode);
ut_ad(recv_needed_recovery); ut_ad(recv_needed_recovery);
for (recv_spaces_t::iterator i = recv_spaces.begin(); for (recv_spaces_t::value_type& rs : recv_spaces) {
i != recv_spaces.end(); i++) { ut_ad(!is_predefined_tablespace(rs.first));
ut_ad(!is_predefined_tablespace(i->first)); ut_ad(rs.second.status != file_name_t::DELETED
ut_ad(i->second.status != file_name_t::DELETED || !i->second.space); || !rs.second.space);
if (i->second.status == file_name_t::DELETED) { if (rs.second.status == file_name_t::DELETED) {
/* The tablespace was deleted, /* The tablespace was deleted,
so we can ignore any redo log for it. */ so we can ignore any redo log for it. */
flag_deleted = true; flag_deleted = true;
} else if (i->second.space != NULL) { } else if (rs.second.space != NULL) {
/* The tablespace was found, and there /* The tablespace was found, and there
are some redo log records for it. */ are some redo log records for it. */
fil_names_dirty(i->second.space); fil_names_dirty(rs.second.space);
i->second.space->enable_lsn = i->second.enable_lsn; rs.second.space->enable_lsn = rs.second.enable_lsn;
} else if (i->second.name == "") { } else if (rs.second.name == "") {
ib::error() << "Missing MLOG_FILE_NAME" ib::error() << "Missing MLOG_FILE_NAME"
" or MLOG_FILE_DELETE" " or MLOG_FILE_DELETE"
" before MLOG_CHECKPOINT for tablespace " " before MLOG_CHECKPOINT for tablespace "
<< i->first; << rs.first;
recv_sys.found_corrupt_log = true; recv_sys.found_corrupt_log = true;
return(DB_CORRUPTION); return(DB_CORRUPTION);
} else { } else {
i->second.status = file_name_t::MISSING; rs.second.status = file_name_t::MISSING;
flag_deleted = true; flag_deleted = true;
} }
ut_ad(i->second.status == file_name_t::DELETED || i->second.name != ""); ut_ad(rs.second.status == file_name_t::DELETED
|| rs.second.name != "");
} }
if (flag_deleted) { if (flag_deleted) {
...@@ -3695,36 +3694,24 @@ recv_recovery_from_checkpoint_finish(void) ...@@ -3695,36 +3694,24 @@ recv_recovery_from_checkpoint_finish(void)
const byte* const byte*
recv_dblwr_t::find_page(ulint space_id, ulint page_no) recv_dblwr_t::find_page(ulint space_id, ulint page_no)
{ {
typedef std::vector<const byte*, ut_allocator<const byte*> > std::vector<const byte*, ut_allocator<const byte*> > matches;
matches_t;
matches_t matches;
const byte* result = 0; const byte* result = 0;
for (list::iterator i = pages.begin(); i != pages.end(); ++i) { for (const byte* page : pages) {
if (page_get_space_id(*i) == space_id if (page_get_space_id(page) == space_id
&& page_get_page_no(*i) == page_no) { && page_get_page_no(page) == page_no) {
matches.push_back(*i); matches.push_back(page);
} }
} }
if (matches.size() == 1) { lsn_t max_lsn = 0;
result = matches[0];
} else if (matches.size() > 1) {
lsn_t max_lsn = 0;
lsn_t page_lsn = 0;
for (matches_t::iterator i = matches.begin(); for (const byte* page : matches) {
i != matches.end(); lsn_t page_lsn = mach_read_from_8(page + FIL_PAGE_LSN);
++i) {
page_lsn = mach_read_from_8(*i + FIL_PAGE_LSN); if (page_lsn > max_lsn) {
max_lsn = page_lsn;
if (page_lsn > max_lsn) { result = page;
max_lsn = page_lsn;
result = *i;
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment