1. Problem symptomsVersion: MySQL 5.6, using the master-slave replication structure configured using the traditional binlog file & pos method. After the instance is restarted, the master-slave replication error is shown in the figure above. 2. Error meaningThe error is divided into 2 parts. Part I
Part I This part comes from the DUMP thread function of the main library mysql_binlog_send ->sender.run() ->Binlog_sender::init ->Binlog_sender::check_start_file if ((file = open_binlog_file(&cache, m_linfo.log_file_name, &errmsg)) < 0) { set_fatal_error(errmsg); return 1; } size = my_b_filelength(&cache); end_io_cache(&cache); mysql_file_close(file, MYF(MY_WME)); if (m_start_pos > size) { set_fatal_error("Client requested master to start replication from " "position > file size"); return 1; } The key is the two values m_start_pos and size, where m_start_pos comes from the position that needs to be read from the library. And size is the size of this binlog file, so it is easy to understand that if the POS point required by the IO thread is larger than the size of this binlog file, then it is naturally wrong. Part 2 This part also comes from the DUMP thread mysql_binlog_send ->sender.run() ->Binlog_sender::init ->while (!has_error() && !m_thd->killed) #If normal, start looping and reading binlog events here. If there is an error, continue with the following logic. #If there is a reading error, report an error my_snprintf(error_text, sizeof(error_text), "%s; the first event '%s' at %lld, " "the last event read from '%s' at %lld, " "the last byte read from '%s' at %lld.", m_errmsg, m_start_file, m_start_pos, m_last_file, m_last_pos, log_file, my_b_tell(&log_cache)); Here we mainly look at m_start_pos and m_last_pos. In fact, m_start_pos is the position information that needs to be read from the slave library, which is consistent with the previous error report, and m_last_pos comes from the dump thread, which is the last read position. Obviously, it is not read once here, so the position is the initial pos 4. 3. Possible causesAfter analysis, I think the most likely reason is related to sync_binlog. If we do not set it to 1, the OS cache may not be flushed to disk. If the main library server crashes and restarts directly, this problem may easily occur. After a quick Google search, I found that most of these errors are caused by server crashes and sync_binlog not being set to 1. This also proves our statement. Finally, I checked that the main database of the problem database was indeed not set to double 1. Through this small case, we have more deeply realized the importance of setting up double 1s. SummarizeThis is the end of this article about MySQL 5.6 master-slave error reporting. For more relevant MySQL 5.6 master-slave error reporting content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: jQuery canvas draws picture verification code example
>>: In-depth understanding of CSS @font-face performance optimization
1. Overview The so-called life cycle function is ...
When configuring the interface domain name, each ...
Preface In MySQL, multi-table join query is a ver...
Today, when learning PHP, of course, you have to ...
If an index contains (or covers) the values of ...
Table of contents 1. Commonjs exports and require...
Since I have changed to a new computer, all the e...
This article shares the specific code for JavaScr...
Table of contents 1. Install Node Exporter 2. Ins...
Table of contents Overview 1. RangeError 2. Refer...
I finished learning SQL by myself not long ago, a...
This article example shares the specific code of ...
Nginx logs can be used to analyze user address lo...
In the horizontal direction, you can set the alig...
I have recently studied the hollowing effect. bac...