diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 8da91c0ec12..f1aecbd68b8 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -2565,7 +2565,6 @@ static int init_binlog_sender(binlog_send_info *info, String slave_until_gtid_str(str_buf2, sizeof(str_buf2), system_charset_info); connect_gtid_state.length(0); - /* ToDo: Need more complex logic here. I want to be able to at least switch from legacy to innodb binlog without having to RESET MASTER. So we need to be able to start reading from legacy and then switch over to the binlog in innodb. Also, we might want to pass the init GTID position in so that the binlog reader can find the place to start by itself? But probably still want to allocate the reader here like this. */ if (opt_binlog_engine_hton && !(info->engine_binlog_reader= (*opt_binlog_engine_hton->get_binlog_reader)(true))) diff --git a/storage/innobase/fsp/fsp_binlog.cc b/storage/innobase/fsp/fsp_binlog.cc index ff82faae796..c302f75563d 100644 --- a/storage/innobase/fsp/fsp_binlog.cc +++ b/storage/innobase/fsp/fsp_binlog.cc @@ -1088,7 +1088,6 @@ binlog_write_up_to_now() noexcept do { active2= active; - /* ToDo: What kind of locking or std::memory_order is needed for page_no? */ page_no= binlog_cur_page_no; active= active_binlog_file_no.load(std::memory_order_relaxed); } while (UNIV_UNLIKELY(active != active2)); @@ -1307,7 +1306,6 @@ dberr_t fsp_binlog_tablespace_create(uint64_t file_no, uint32_t size_in_pages, os_file_create_subdirs_if_needed(name); - /* ToDo: Do we need here an mtr.log_file_op(FILE_CREATE) like in fil_ibd_create(()? */ fh = os_file_create( innodb_data_file_key, name, OS_FILE_CREATE, OS_DATA_FILE, srv_read_only_mode, &ret); @@ -1317,8 +1315,6 @@ dberr_t fsp_binlog_tablespace_create(uint64_t file_no, uint32_t size_in_pages, return DB_ERROR; } - /* ToDo: Enryption? */ - /* We created the binlog file and now write it full of zeros */ if (!os_file_set_size(name, fh, os_offset_t{size_in_pages} << ibb_page_size_shift) @@ -1361,7 +1357,6 @@ fsp_binlog_write_rec(chunk_data_base *chunk_data, mtr_t *mtr, byte chunk_type, const uint32_t page_end= page_size - BINLOG_PAGE_DATA_END; uint32_t page_no= binlog_cur_page_no; uint32_t page_offset= binlog_cur_page_offset; - /* ToDo: What is the lifetime of what's pointed to by binlog_cur_block, is there some locking needed around it or something? */ fsp_binlog_page_entry *block= nullptr; uint64_t file_no= active_binlog_file_no.load(std::memory_order_relaxed); uint64_t pending_prev_end_offset= 0; @@ -1392,13 +1387,10 @@ fsp_binlog_write_rec(chunk_data_base *chunk_data, mtr_t *mtr, byte chunk_type, ut_ad(!pending_prev_end_offset); pending_prev_end_offset= page_no << page_size_shift; mysql_mutex_lock(&active_binlog_mutex); - /* ToDo: Make this wait killable?. */ - /* ToDo2: Handle not stalling infinitely if the new tablespace cannot be created due to eg. I/O error. Or should we in this case loop and repeatedly retry the create? */ while (last_created_binlog_file_no <= file_no) { my_cond_wait(&active_binlog_cond, &active_binlog_mutex.m_mutex); } - // ToDo: assert that a single write doesn't span more than two binlog files. ++file_no; file_size_in_pages= binlog_page_fifo->size_in_pages(file_no); binlog_cur_durable_offset[file_no & 3].store(0, std::memory_order_relaxed); diff --git a/storage/innobase/handler/innodb_binlog.cc b/storage/innobase/handler/innodb_binlog.cc index e53cf2b1ca8..bb04816062e 100644 --- a/storage/innobase/handler/innodb_binlog.cc +++ b/storage/innobase/handler/innodb_binlog.cc @@ -673,8 +673,20 @@ bool binlog_recovery::init_recovery(bool space_id, uint32_t page_no, return false; } if (num_binlogs == 1) - return init_recovery_from(file_no2 + (space_id != (file_no2 & 1)), lsn2, - page_no, offset, start_lsn, buf, size); + { + uint64_t start_file_no= file_no2; + /* + Only one binlog file found. + + This first recovery record may apply to the previous file (which has + then presumably been purged since the last checkpoint). Or it may + apply to this file, or only to the following file. + */ + if (space_id != (file_no2 & 1) && start_lsn >= lsn2) + ++start_file_no; + return init_recovery_from(start_file_no, lsn2, page_no, offset, + start_lsn, buf, size); + } int res1= get_header(file_no1, lsn1, is_empty1); @@ -1406,7 +1418,6 @@ scan_for_binlogs(const char *binlog_dir, found_binlogs *binlog_files, static bool binlog_page_empty(const byte *page) { - /* ToDo: Here we also need to see if there is a full state record at the start of the file. If not, we have to delete the file and ignore it, it is an incomplete file. Or can we rely on the innodb crash recovery to make file creation atomic and we will never see a partially pre-allocated file? Also if the gtid state is larger than mtr max size (if there is such max?), or if we crash in the middle of pre-allocation? */ return page[BINLOG_PAGE_DATA] == 0; } @@ -2084,7 +2095,6 @@ read_gtid_state(rpl_binlog_state_base *state, File file, uint32_t page_no) if (UNIV_UNLIKELY(!page_buf)) return -1; - /* ToDo: Handle encryption. */ int res= crc32_pread_page(file, page_buf.get(), page_no, MYF(MY_WME)); if (UNIV_UNLIKELY(res <= 0)) return -1; @@ -3635,7 +3645,6 @@ innobase_binlog_write_direct_ordered(IO_CACHE *cache, mtr.commit(); innodb_binlog_post_commit(&mtr, (binlog_oob_context *)binlog_info->engine_ptr); - /* ToDo: Presumably innodb_binlog_write_cache() should be able to fail in some cases? Then return any such error to the caller. */ return false; } @@ -3883,7 +3892,6 @@ purge_adjust_limit_file_no(handler_binlog_purge_info *purge_info, LF_PINS *pins) 1c. Any file_no in use by an active dump thread 1d. Any file_no containing oob data referenced by file_no from (1c) 1e. User specified file_no (from PURGE BINARY LOGS TO, if any). - 1f. (ToDo): Any file_no that was still active at the last checkpoint. 2. Unix timestamp specifying the minimal value that should not be purged, optional (used by PURGE BINARY LOGS BEFORE and --binlog-expire-log-seconds).