<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MySQL支持 &#187; 同步中的Bug</title>
	<atom:link href="http://www.mysqlsupport.cn/category/mysql%e5%90%8c%e6%ad%a5/%e5%90%8c%e6%ad%a5%e4%b8%ad%e7%9a%84bug/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlsupport.cn</link>
	<description>MySQL支持，提供专业技术支持性能调优，架构设计</description>
	<lastBuildDate>Wed, 26 Oct 2011 12:23:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>truncate table 不能复制到从库</title>
		<link>http://www.mysqlsupport.cn/truncate-not-replication/</link>
		<comments>http://www.mysqlsupport.cn/truncate-not-replication/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 11:37:28 +0000</pubDate>
		<dc:creator>wubx</dc:creator>
				<category><![CDATA[MySQL同步]]></category>
		<category><![CDATA[同步中的Bug]]></category>

		<guid isPermaLink="false">http://www.mysqlsupport.cn/?p=84</guid>
		<description><![CDATA[<strong> 作者：吴炳锡　来源：http://www.mysqlsupport.cn/ 联系方式： wubingxi#gmail.com 转载请注明作/译者和出处，并且不能用于商业用途，违者必究。</strong>

          bug说明： 该BUG在是MySQL5.1.X中存在的一个问题。
重现方法：
        利用 5.1.31-enterprise-gpl-pro-log (Or 5.1.31-sp1-enterprise) 搭建master/slave结构同步正常进行（确认同步进行）
<strong> 注意参数：
事务隔级为： READ-COMMITTED
日值格式为： mixed</strong>]]></description>
			<content:encoded><![CDATA[<p><strong> 作者：吴炳锡　来源：http://www.mysqlsupport.cn/ 联系方式： wubingxi#gmail.com 转载请注明作/译者和出处，并且不能用于商业用途，违者必究。</strong></p>
<p>          bug说明： 该BUG在是MySQL5.1.X中存在的一个问题。<br />
重现方法：<br />
        利用 5.1.31-enterprise-gpl-pro-log (Or 5.1.31-sp1-enterprise) 搭建master/slave结构同步正常进行（确认同步进行）<br />
<strong> 注意参数：<br />
事务隔级为： READ-COMMITTED<br />
日值格式为： mixed</strong></p>
<p>然后在主库建表：</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">create</span> <span style="color: #990099; font-weight: bold;">database</span> wubx<span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">create</span> <span style="color: #990099; font-weight: bold;">table</span> t1 <span style="color: #FF00FF;">&#40;</span>id <span style="color: #999900; font-weight: bold;">int</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">engine</span><span style="color: #CC0099;">=</span><span style="color: #990099; font-weight: bold;">innodb</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">insert</span> <span style="color: #990099; font-weight: bold;">into</span> t1 <span style="color: #990099; font-weight: bold;">values</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">1</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">2</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">3</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">4</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span><span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">5</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">select</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">from</span> t1<span style="color: #000033;">;</span>
<span style="color: #CC0099;">+------+</span>
<span style="color: #CC0099;">|</span> id <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">+------+</span>
<span style="color: #CC0099;">|</span> <span style="color: #008080;">1</span> <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> <span style="color: #008080;">2</span> <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> <span style="color: #008080;">3</span> <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> <span style="color: #008080;">4</span> <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> <span style="color: #008080;">5</span> <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">+------+</span></pre></div></div>

<p>从库：</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">use</span> wubx<span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">select</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">from</span> t1 <span style="color: #000033;">;</span>
<span style="color: #CC0099;">+------+</span>
<span style="color: #CC0099;">|</span> id <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">+------+</span>
<span style="color: #CC0099;">|</span> <span style="color: #008080;">1</span> <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> <span style="color: #008080;">2</span> <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> <span style="color: #008080;">3</span> <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> <span style="color: #008080;">4</span> <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> <span style="color: #008080;">5</span> <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">+------+</span></pre></div></div>

<p>主库上：</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">use</span> wubx<span style="color: #000033;">;</span>
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">truncate</span> <span style="color: #990099; font-weight: bold;">table</span> t1<span style="color: #000033;">;</span>
Query OK<span style="color: #000033;">,</span> <span style="color: #008080;">0</span> rows affected <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">0.00</span> sec<span style="color: #FF00FF;">&#41;</span>
mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">select</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">from</span> t1<span style="color: #000033;">;</span>
Empty <span style="color: #990099; font-weight: bold;">set</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">0.01</span> sec<span style="color: #FF00FF;">&#41;</span></pre></div></div>

<p>从库：</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">use</span> wubx<span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">select</span> <span style="color: #CC0099;">*</span> <span style="color: #990099; font-weight: bold;">from</span> t1 <span style="color: #000033;">;</span>
<span style="color: #CC0099;">+------+</span>
<span style="color: #CC0099;">|</span> id <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">+------+</span>
<span style="color: #CC0099;">|</span> <span style="color: #008080;">1</span> <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> <span style="color: #008080;">2</span> <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> <span style="color: #008080;">3</span> <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> <span style="color: #008080;">4</span> <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">|</span> <span style="color: #008080;">5</span> <span style="color: #CC0099;">|</span>
<span style="color: #CC0099;">+------+</span></pre></div></div>

<p>解决办法：<br />
先删除该表，然后创建该表。<br />
如: <strong>truncate table wubx;</strong>改变为：</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;"><span style="color: #990099; font-weight: bold;">drop</span> <span style="color: #990099; font-weight: bold;">table</span> wubx<span style="color: #000033;">;</span>
<span style="color: #990099; font-weight: bold;">create</span> <span style="color: #990099; font-weight: bold;">table</span> wubx<span style="color: #FF00FF;">&#40;</span> id <span style="color: #999900; font-weight: bold;">int</span><span style="color: #FF00FF;">&#41;</span> <span style="color: #990099; font-weight: bold;">engine</span><span style="color: #CC0099;">=</span><span style="color: #990099; font-weight: bold;">innodb</span><span style="color: #000033;">;</span></pre></div></div>

<p>另一种方式：<br />
  修改事务隔离级别为默认的。可以MySQL的版本升级到MySQL-5.1.37后的版本。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysqlsupport.cn/truncate-not-replication/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Relay log read failure的处理</title>
		<link>http://www.mysqlsupport.cn/relay-log-read-failure/</link>
		<comments>http://www.mysqlsupport.cn/relay-log-read-failure/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 08:35:47 +0000</pubDate>
		<dc:creator>wubx</dc:creator>
				<category><![CDATA[MySQL TIPS/FAQ]]></category>
		<category><![CDATA[MySQL同步]]></category>
		<category><![CDATA[MySQL基础]]></category>
		<category><![CDATA[同步中的Bug]]></category>

		<guid isPermaLink="false">http://www.mysqlsupport.cn/?p=59</guid>
		<description><![CDATA[作者：吴炳锡　来源：http://www.mysqlsupport.cn/ 联系方式：select unhex(’777562696E67786940676D61696C2E636F6D’); 载请注明作/译者和出处，并且不能用于商业用途，违者必究。        众所周知MySQL5.1的Replication是比较烂的。MySQL的每一个版本更新关于同步方面每次都是可以看到一大堆。但MySQL 5.1性能是比较突出的。所以经不住诱惑使用MySQL 5.1。所以也要经常遇到一些Bug。如：  mysql&#62; show slave status\G *************************** 1. row ***************************                Slave_IO_State: Waiting for master to send event                   Master_Host: 192.168.10.118                   Master_User: repl_wu                   Master_Port: 3306                 Connect_Retry: 30               Master_Log_File: mysql-bin.005121           Read_Master_Log_Pos: 64337286                Relay_Log_File: relay-bin.003995                 Relay_Log_Pos: 18446697137031827760         Relay_Master_Log_File: mysql-bin.005121              Slave_IO_Running: Yes             [...]]]></description>
			<content:encoded><![CDATA[<p><strong>作者：吴炳锡　来源：</strong><a href="http://www.mysqlsupport.cn/"><strong>http://www.mysqlsupport.cn/</strong></a><strong> </strong><strong>联系方式：</strong><strong>select unhex(’777562696E67786940676D61696C2E636F6D’); </strong><strong>载请注明作</strong><strong>/</strong><strong>译者和出处，并且不能用于商业用途，违者必究。</strong><br />
       众所周知MySQL5.1的Replication是比较烂的。MySQL的每一个版本更新关于同步方面每次都是可以看到一大堆。但MySQL 5.1性能是比较突出的。所以经不住诱惑使用MySQL 5.1。所以也要经常遇到一些Bug。如： </p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;">mysql<span style="color: #CC0099;">&gt;</span> <span style="color: #990099; font-weight: bold;">show</span> slave <span style="color: #990099; font-weight: bold;">status</span>\G
<span style="color: #CC0099;">***************************</span> <span style="color: #008080;">1</span>. row <span style="color: #CC0099;">***************************</span>
               Slave_IO_State: Waiting for master <span style="color: #990099; font-weight: bold;">to</span> send event
                  Master_Host: 192.168.10.118
                  Master_User: repl_wu
                  Master_Port: <span style="color: #008080;">3306</span>
                Connect_Retry: <span style="color: #008080;">30</span>
              Master_Log_File: mysql<span style="color: #CC0099;">-</span><span style="color: #000099;">bin</span><span style="color: #008080;">.005121</span>
          Read_Master_Log_Pos: <span style="color: #008080;">64337286</span>
               Relay_Log_File: relay<span style="color: #CC0099;">-</span><span style="color: #000099;">bin</span><span style="color: #008080;">.003995</span>
                Relay_Log_Pos: <span style="color: #008080;">18446697137031827760</span>
        Relay_Master_Log_File: mysql<span style="color: #CC0099;">-</span><span style="color: #000099;">bin</span><span style="color: #008080;">.005121</span>
             Slave_IO_Running: Yes
            Slave_SQL_Running: <span style="color: #990099; font-weight: bold;">No</span>
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: <span style="color: #008080;">1594</span>
                   Last_Error: Relay <span style="color: #000099;">log</span> <span style="color: #990099; font-weight: bold;">read</span> failure: Could <span style="color: #CC0099; font-weight: bold;">not</span> parse relay <span style="color: #000099;">log</span> event entry. The possible reasons are: the master<span style="color: #008000;">'s binary log is corrupted (you can check this by running '</span>mysqlbinlog<span style="color: #008000;">' on the binary log), the slave'</span>s relay <span style="color: #000099;">log</span> <span style="color: #CC0099; font-weight: bold;">is</span> corrupted <span style="color: #FF00FF;">&#40;</span>you can <span style="color: #990099; font-weight: bold;">check</span> this by running <span style="color: #008000;">'mysqlbinlog'</span> <span style="color: #990099; font-weight: bold;">on</span> the relay <span style="color: #000099;">log</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span> a network problem<span style="color: #000033;">,</span> <span style="color: #CC0099; font-weight: bold;">or</span> a bug <span style="color: #990099; font-weight: bold;">in</span> the master<span style="color: #008000;">'s or slave'</span>s MySQL code. <span style="color: #009900;">If</span> you want <span style="color: #990099; font-weight: bold;">to</span> <span style="color: #990099; font-weight: bold;">check</span> the master<span style="color: #008000;">'s binary log or slave'</span>s relay <span style="color: #000099;">log</span><span style="color: #000033;">,</span> you will be able <span style="color: #990099; font-weight: bold;">to</span> know their names by issuing <span style="color: #008000;">'SHOW SLAVE STATUS'</span> <span style="color: #990099; font-weight: bold;">on</span> this slave.
                 Skip_Counter: <span style="color: #008080;">0</span>
          Exec_Master_Log_Pos: <span style="color: #008080;">4</span>
              Relay_Log_Space: <span style="color: #008080;">64337901</span>
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: <span style="color: #008080;">0</span>
           Master_SSL_Allowed: <span style="color: #990099; font-weight: bold;">No</span>
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: <span style="color: #9900FF; font-weight: bold;">NULL</span>
Master_SSL_Verify_Server_Cert: <span style="color: #990099; font-weight: bold;">No</span>
                Last_IO_Errno: <span style="color: #008080;">0</span>
                Last_IO_Error:
               Last_SQL_Errno: <span style="color: #008080;">1594</span>
               Last_SQL_Error: Relay <span style="color: #000099;">log</span> <span style="color: #990099; font-weight: bold;">read</span> failure: Could <span style="color: #CC0099; font-weight: bold;">not</span> parse relay <span style="color: #000099;">log</span> event entry. The possible reasons are: the master<span style="color: #008000;">'s binary log is corrupted (you can check this by running '</span>mysqlbinlog<span style="color: #008000;">' on the binary log), the slave'</span>s relay <span style="color: #000099;">log</span> <span style="color: #CC0099; font-weight: bold;">is</span> corrupted <span style="color: #FF00FF;">&#40;</span>you can <span style="color: #990099; font-weight: bold;">check</span> this by running <span style="color: #008000;">'mysqlbinlog'</span> <span style="color: #990099; font-weight: bold;">on</span> the relay <span style="color: #000099;">log</span><span style="color: #FF00FF;">&#41;</span><span style="color: #000033;">,</span> a network problem<span style="color: #000033;">,</span> <span style="color: #CC0099; font-weight: bold;">or</span> a bug <span style="color: #990099; font-weight: bold;">in</span> the master<span style="color: #008000;">'s or slave'</span>s MySQL code. <span style="color: #009900;">If</span> you want <span style="color: #990099; font-weight: bold;">to</span> <span style="color: #990099; font-weight: bold;">check</span> the master<span style="color: #008000;">'s binary log or slave'</span>s relay <span style="color: #000099;">log</span><span style="color: #000033;">,</span> you will be able <span style="color: #990099; font-weight: bold;">to</span> know their names by issuing <span style="color: #008000;">'SHOW SLAVE STATUS'</span> <span style="color: #990099; font-weight: bold;">on</span> this slave.
<span style="color: #008080;">1</span> row <span style="color: #990099; font-weight: bold;">in</span> <span style="color: #990099; font-weight: bold;">set</span> <span style="color: #FF00FF;">&#40;</span><span style="color: #008080;">0.00</span> sec<span style="color: #FF00FF;">&#41;</span>
 </pre></div></div>

<p>        从上面可以看到是中继日值或是Master上的日值出问题了。<br />
        首先如果是中继日值坏掉，那只需要找到同步的时间点，然后重新同步，这样就可以有新的中继日值了。如果Master上的日值坏了就麻烦了。<br />
从经验来看，这是中继日值出问题了。处理方法：</p>
<p>    需要找到同步的点。</p>
<p>日值为：Master_Log_File: mysql-bin.005121，Relay_Master_Log_File: mysql-bin.005121以Relay_Master_Log_File为准，Master_Log_File为参考。</p>
<p>日值执行时间点：</p>
<p>Exec_Master_Log_Pos: 4</p>
<p>那么现在就可以：</p>

<div class="wp_syntax"><div class="code"><pre class="mysql" style="font-family:monospace;">  
      mysql<span style="color: #CC0099;">&gt;</span>stop slave<span style="color: #000033;">;</span>
&nbsp;
    mysql<span style="color: #CC0099;">&gt;</span>change master <span style="color: #990099; font-weight: bold;">to</span> Master_Log_File<span style="color: #CC0099;">=</span>’mysql<span style="color: #CC0099;">-</span><span style="color: #000099;">bin</span><span style="color: #008080;">.005121</span>’<span style="color: #000033;">,</span> Master_Log_Pos<span style="color: #CC0099;">=</span><span style="color: #008080;">4</span><span style="color: #000033;">;</span>
   
    mysql<span style="color: #CC0099;">&gt;</span>start slave<span style="color: #000033;">;</span>
&nbsp;
    mysql<span style="color: #CC0099;">&gt;</span>show slave <span style="color: #990099; font-weight: bold;">status</span>\G<span style="color: #000033;">;</span></pre></div></div>

<p>    进行确认。</p>
<p> </p>
<p><strong>   </strong><strong>建议：</strong></p>
<p>    在使用MySQL-5.1.36以下的版本的同学，请尽快升级到MySQL-5.1.40 &amp; MySQL-5.1.37sp1</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mysqlsupport.cn/relay-log-read-failure/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

