diff options
Diffstat (limited to 'storage/innobase/log/log0recv.cc')
-rw-r--r-- | storage/innobase/log/log0recv.cc | 72 |
1 files changed, 38 insertions, 34 deletions
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 5a42f9db206..9f6b9243070 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -25,7 +25,7 @@ Recovery Created 9/20/1997 Heikki Tuuri *******************************************************/ -#include "ha_prototypes.h" +#include "univ.i" #include <vector> #include <map> @@ -52,8 +52,6 @@ Created 9/20/1997 Heikki Tuuri #include "trx0undo.h" #include "trx0rec.h" #include "fil0fil.h" -#include "fsp0sysspace.h" -#include "ut0new.h" #include "buf0rea.h" #include "srv0srv.h" #include "srv0start.h" @@ -153,9 +151,13 @@ struct file_name_t { /** Status of the tablespace */ fil_status status; + /** FSP_SIZE of tablespace */ + ulint size; + /** Constructor */ file_name_t(std::string name_, bool deleted) : - name(name_), space(NULL), status(deleted ? DELETED: NORMAL) {} + name(name_), space(NULL), status(deleted ? DELETED: NORMAL), + size(0) {} }; /** Map of dirty tablespaces during recovery */ @@ -229,9 +231,8 @@ static void recv_addr_trim(ulint space_id, unsigned pages, lsn_t lsn) hash_cell_t* const cell = hash_get_nth_cell( recv_sys->addr_hash, i); for (recv_addr_t* addr = static_cast<recv_addr_t*>(cell->node), - *prev = NULL, *next; - addr; - prev = addr, addr = next) { + *next; + addr; addr = next) { next = static_cast<recv_addr_t*>(addr->addr_hash); if (addr->space != space_id || addr->page_no < pages) { @@ -253,22 +254,6 @@ static void recv_addr_trim(ulint space_id, unsigned pages, lsn_t lsn) } recv = n; } - - if (UT_LIST_GET_LEN(addr->rec_list)) { - DBUG_PRINT("ib_log", - ("preserving " ULINTPF - " records for page %u:%u", - UT_LIST_GET_LEN(addr->rec_list), - addr->space, addr->page_no)); - } else { - ut_ad(recv_sys->n_addrs); - --recv_sys->n_addrs; - if (addr == cell->node) { - cell->node = next; - } else { - prev->addr_hash = next; - } - } } } if (fil_space_t* space = fil_space_get(space_id)) { @@ -340,6 +325,11 @@ fil_name_process( ut_ad(space != NULL); if (f.space == NULL || f.space == space) { + + if (f.size && f.space == NULL) { + fil_space_set_recv_size(space->id, f.size); + } + f.name = fname.name; f.space = space; f.status = file_name_t::NORMAL; @@ -1944,7 +1934,7 @@ recv_recover_page(bool just_read_in, buf_block_t* block) if (start_lsn) { log_flush_order_mutex_enter(); - buf_flush_recv_note_modification(block, start_lsn, end_lsn); + buf_flush_note_modification(block, start_lsn, end_lsn, NULL); log_flush_order_mutex_exit(); } @@ -1981,10 +1971,7 @@ recv_recover_page(bool just_read_in, buf_block_t* block) page number. @param[in] page_id page id @return number of pages found */ -static -ulint -recv_read_in_area( - const page_id_t& page_id) +static ulint recv_read_in_area(const page_id_t page_id) { recv_addr_t* recv_addr; ulint page_nos[RECV_READ_AHEAD_AREA]; @@ -2027,8 +2014,7 @@ recv_read_in_area( /** Apply the hash table of stored log records to persistent data pages. @param[in] last_batch whether the change buffer merge will be performed as part of the operation */ -void -recv_apply_hashed_log_recs(bool last_batch) +void recv_apply_hashed_log_recs(bool last_batch) { ut_ad(srv_operation == SRV_OPERATION_NORMAL || srv_operation == SRV_OPERATION_RESTORE @@ -2093,7 +2079,8 @@ recv_apply_hashed_log_recs(bool last_batch) recv_addr = static_cast<recv_addr_t*>( HASH_GET_NEXT(addr_hash, recv_addr))) { - if (recv_addr->state == RECV_DISCARDED) { + if (recv_addr->state == RECV_DISCARDED + || !UT_LIST_GET_LEN(recv_addr->rec_list)) { ut_a(recv_sys->n_addrs); recv_sys->n_addrs--; continue; @@ -2271,11 +2258,24 @@ recv_parse_log_rec( } if (*page_no == 0 && *type == MLOG_4BYTES + && apply && mach_read_from_2(old_ptr) == FSP_HEADER_OFFSET + FSP_SIZE) { old_ptr += 2; - fil_space_set_recv_size(*space, - mach_parse_compressed(&old_ptr, - end_ptr)); + + ulint size = mach_parse_compressed(&old_ptr, end_ptr); + + recv_spaces_t::iterator it = recv_spaces.find(*space); + + ut_ad(!recv_sys->mlog_checkpoint_lsn + || *space == TRX_SYS_SPACE + || srv_is_undo_tablespace(*space) + || it != recv_spaces.end()); + + if (it != recv_spaces.end() && !it->second.space) { + it->second.size = size; + } + + fil_space_set_recv_size(*space, size); } return ulint(new_ptr - ptr); @@ -3400,6 +3400,8 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn) then there is a possiblity that hash table will not contain all space ids redo logs. Rescan the remaining unstored redo logs for the validation of missing tablespace. */ + ut_ad(rescan || !missing_tablespace); + while (missing_tablespace) { DBUG_PRINT("ib_log", ("Rescan of redo log to validate " "the missing tablespace. Scan " @@ -3423,6 +3425,8 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn) log_mutex_exit(); return err; } + + rescan = true; } if (srv_operation == SRV_OPERATION_NORMAL) { |