<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Jeremy Cole on MySQL Replication</title>
	<atom:link href="http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/</link>
	<description>Everything about MySQL Performance</description>
	<lastBuildDate>Sat, 07 Nov 2009 18:35:44 -0800</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: DeShong.net &#187; MySQL replication and the sync_binlog option</title>
		<link>http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/comment-page-1/#comment-568146</link>
		<dc:creator>DeShong.net &#187; MySQL replication and the sync_binlog option</dc:creator>
		<pubDate>Thu, 28 May 2009 01:21:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/#comment-568146</guid>
		<description>[...] around this are related to battery-backed disk cache, which you can read a bit more about in Jeremy Cole&#8217;s post on MySQL replication. You can also see some handy benchmarks that compare MySQL with and without [...]</description>
		<content:encoded><![CDATA[<p>[...] around this are related to battery-backed disk cache, which you can read a bit more about in Jeremy Cole&#8217;s post on MySQL replication. You can also see some handy benchmarks that compare MySQL with and without [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alan</title>
		<link>http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/comment-page-1/#comment-96581</link>
		<dc:creator>Alan</dc:creator>
		<pubDate>Wed, 28 Mar 2007 03:55:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/#comment-96581</guid>
		<description>I&#039;m planning to run with log-bin and sync_binlog=1.  I&#039;m also planning to do a full database backup (FLUSH TABLES WITH READ LOCK followed by a cp) once per day, along with a FLUSH LOGS.  In the event of a crash, shouldn&#039;t I be able to restore all data (both MyISAM and all committed InnoDB transactions) by just restoring the last full database backup and then applying the binary logs with mysqlbinlog?  If so, why do I need the InnoDB logs, ib_logfile0 and ib_logfile1?  Is there a way to disable them so they are not even written?</description>
		<content:encoded><![CDATA[<p>I&#8217;m planning to run with log-bin and sync_binlog=1.  I&#8217;m also planning to do a full database backup (FLUSH TABLES WITH READ LOCK followed by a cp) once per day, along with a FLUSH LOGS.  In the event of a crash, shouldn&#8217;t I be able to restore all data (both MyISAM and all committed InnoDB transactions) by just restoring the last full database backup and then applying the binary logs with mysqlbinlog?  If so, why do I need the InnoDB logs, ib_logfile0 and ib_logfile1?  Is there a way to disable them so they are not even written?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/comment-page-1/#comment-27257</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Thu, 11 Jan 2007 11:24:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/#comment-27257</guid>
		<description>Sean,

With MyISAM  there is no such thing as &quot;won&#039;t loose any data&quot; if server crashes some MyISAM updates can be only in OS cache which will be lost furthermore tables can become corrupted. 

This is all probability thing of course.</description>
		<content:encoded><![CDATA[<p>Sean,</p>
<p>With MyISAM  there is no such thing as &#8220;won&#8217;t loose any data&#8221; if server crashes some MyISAM updates can be only in OS cache which will be lost furthermore tables can become corrupted. </p>
<p>This is all probability thing of course.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sean</title>
		<link>http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/comment-page-1/#comment-27046</link>
		<dc:creator>Sean</dc:creator>
		<pubDate>Thu, 11 Jan 2007 04:05:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/#comment-27046</guid>
		<description>Peter,
I will be inheriting 25+ db servers (M-&gt;S replication) with over 800GB of data, 1000+ of writes per minute, all in MyISAM tables using version 4.1.  Side note: A project will be underway to move to InnoDB. However in the mean time, I need to ensure we won&#039;t loss data or at least keep it to minimum in the event of a crash.  And if I understand you correctly, the best I can do is:
1. use battery backed up cache
2. set sync_binlog = 1</description>
		<content:encoded><![CDATA[<p>Peter,<br />
I will be inheriting 25+ db servers (M-&gt;S replication) with over 800GB of data, 1000+ of writes per minute, all in MyISAM tables using version 4.1.  Side note: A project will be underway to move to InnoDB. However in the mean time, I need to ensure we won&#8217;t loss data or at least keep it to minimum in the event of a crash.  And if I understand you correctly, the best I can do is:<br />
1. use battery backed up cache<br />
2. set sync_binlog = 1</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/comment-page-1/#comment-199</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Sat, 17 Jun 2006 14:14:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/#comment-199</guid>
		<description>Tnagy, 

Let me answer your questions one by one 

1) Your understanding about flushing is aproximately correct.  The data is modified directly in the buffer pool pages, which becomes &quot;dirty&quot; if there are some unflushed changes and later these pages will need to be flushed in full.  This actually happens via one more &quot;physical&quot; log file which is called &quot;double write buffer&quot; to handle problem of partial page writes.  The log file is structured differently it stores records which apply to individual page modification operation perfomed rather than full pages.

Unless database is staying idle database on the disk is pretty much always out of sync.  Only in case of shutdown they are synchronozed (this is why it can take a while).  They are also synchronized by crash recovery.

2)  Right in MySQL  binary log file has to be XA source as well... otherwise it can run out of sync.  &quot;Traditional&quot; databases would not normally have many storage engines each with their own logs.  In MySQL 5.0 you can disable innodb_xa_support and you can get binary log possibly out of sync with innodb transactional log.  However it will not make group commit to work.  Group commit only works in MySQL 5.0 if binary log is disabled at all. 

Take a look at these benchmarks:  http://www.mysqlperformanceblog.com/2006/05/19/group-commit-and-xa/  - disabling XA saves you from extra fsync which allows to double results but results still do not improve with many concurrent threads. This would be sight of good working group commit.</description>
		<content:encoded><![CDATA[<p>Tnagy, </p>
<p>Let me answer your questions one by one </p>
<p>1) Your understanding about flushing is aproximately correct.  The data is modified directly in the buffer pool pages, which becomes &#8220;dirty&#8221; if there are some unflushed changes and later these pages will need to be flushed in full.  This actually happens via one more &#8220;physical&#8221; log file which is called &#8220;double write buffer&#8221; to handle problem of partial page writes.  The log file is structured differently it stores records which apply to individual page modification operation perfomed rather than full pages.</p>
<p>Unless database is staying idle database on the disk is pretty much always out of sync.  Only in case of shutdown they are synchronozed (this is why it can take a while).  They are also synchronized by crash recovery.</p>
<p>2)  Right in MySQL  binary log file has to be XA source as well&#8230; otherwise it can run out of sync.  &#8220;Traditional&#8221; databases would not normally have many storage engines each with their own logs.  In MySQL 5.0 you can disable innodb_xa_support and you can get binary log possibly out of sync with innodb transactional log.  However it will not make group commit to work.  Group commit only works in MySQL 5.0 if binary log is disabled at all. </p>
<p>Take a look at these benchmarks:  <a href="http://www.mysqlperformanceblog.com/2006/05/19/group-commit-and-xa/" rel="nofollow">http://www.mysqlperformanceblog.com/2006/05/19/group-commit-and-xa/</a>  &#8211; disabling XA saves you from extra fsync which allows to double results but results still do not improve with many concurrent threads. This would be sight of good working group commit.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tnagy</title>
		<link>http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/comment-page-1/#comment-164</link>
		<dc:creator>tnagy</dc:creator>
		<pubDate>Wed, 14 Jun 2006 17:11:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/#comment-164</guid>
		<description>I guess the problem was with you can&#039;t embed html tags in the comment, sorry--i&#039;ll try again

Also, as you mentioned the issue of group commit being broken (see http://www.mysqlperformanceblog.com/2006/05/19/group-commit-and-xa), I read that entry with interest, and what I took from it was that you should disable xa-support in my.cnf if you
1.  don&#039;t need it and
2.  have binary logging (replication) enabled
your benchmarks suggested that by doing that (even if group commit is &quot;broken&quot;) you can double your write throughput

However, i stumbled upon this in the official mySQL 5.0 documentation:
&quot;Even with sync_binlog set to 1, there is still the chance of an inconsistency between the table content and binary log content in case of a crash. For example, if you are using InnoDB tables and the MySQL server processes a COMMIT statement, it writes the whole transaction to the binary log and then commits this transaction into InnoDB. If the server crashes between those two operations, the transaction is rolled back by InnoDB at restart but still exists in the binary log. This problem can be solved with the --innodb-safe-binlog option, which adds consistency between the content of InnoDB  tables and the binary log. (Note: --innodb-safe-binlog is unneeded as of MySQL 5.0; it was made obsolete by the introduction of XA transaction support.)&quot;

I&#039;m not sure what to make of that.  XA support is traditionally for 2-phase commits between two different databases (or other transactional resources), i wouldn&#039;t think that the binary log ITSELF is XA-compliant:)

I guess what I&#039;m really asking is, if you have enabled binary logging (replication), sync_binlog = 1, and you&#039;re using MySQL 5, and it&#039;s the only transactional resource you&#039;re using, is it safe to DISABLE innodb_xa_support?  i.e. will the potential extra &quot;dirty&quot; statement remain in the replication log?  I guess I don&#039;t understand how enabling xa-support would resolve this, and as your benchmarks indicate, it potentially makes a HUGE difference (group commit or not).
Sorry for the length of this post, but I think you can see it&#039;s a liitle bit confusing:)

Thanks</description>
		<content:encoded><![CDATA[<p>I guess the problem was with you can&#8217;t embed html tags in the comment, sorry&#8211;i&#8217;ll try again</p>
<p>Also, as you mentioned the issue of group commit being broken (see <a href="http://www.mysqlperformanceblog.com/2006/05/19/group-commit-and-xa)" rel="nofollow">http://www.mysqlperformanceblog.com/2006/05/19/group-commit-and-xa)</a>, I read that entry with interest, and what I took from it was that you should disable xa-support in my.cnf if you<br />
1.  don&#8217;t need it and<br />
2.  have binary logging (replication) enabled<br />
your benchmarks suggested that by doing that (even if group commit is &#8220;broken&#8221;) you can double your write throughput</p>
<p>However, i stumbled upon this in the official mySQL 5.0 documentation:<br />
&#8220;Even with sync_binlog set to 1, there is still the chance of an inconsistency between the table content and binary log content in case of a crash. For example, if you are using InnoDB tables and the MySQL server processes a COMMIT statement, it writes the whole transaction to the binary log and then commits this transaction into InnoDB. If the server crashes between those two operations, the transaction is rolled back by InnoDB at restart but still exists in the binary log. This problem can be solved with the &#8211;innodb-safe-binlog option, which adds consistency between the content of InnoDB  tables and the binary log. (Note: &#8211;innodb-safe-binlog is unneeded as of MySQL 5.0; it was made obsolete by the introduction of XA transaction support.)&#8221;</p>
<p>I&#8217;m not sure what to make of that.  XA support is traditionally for 2-phase commits between two different databases (or other transactional resources), i wouldn&#8217;t think that the binary log ITSELF is XA-compliant:)</p>
<p>I guess what I&#8217;m really asking is, if you have enabled binary logging (replication), sync_binlog = 1, and you&#8217;re using MySQL 5, and it&#8217;s the only transactional resource you&#8217;re using, is it safe to DISABLE innodb_xa_support?  i.e. will the potential extra &#8220;dirty&#8221; statement remain in the replication log?  I guess I don&#8217;t understand how enabling xa-support would resolve this, and as your benchmarks indicate, it potentially makes a HUGE difference (group commit or not).<br />
Sorry for the length of this post, but I think you can see it&#8217;s a liitle bit confusing:)</p>
<p>Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tnagy</title>
		<link>http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/comment-page-1/#comment-163</link>
		<dc:creator>tnagy</dc:creator>
		<pubDate>Wed, 14 Jun 2006 17:09:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/#comment-163</guid>
		<description>My post in fact was too long, here&#039;s the rest:

Also, as you mentioned the issue of group commit being broken (see &lt;a&gt;&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>My post in fact was too long, here&#8217;s the rest:</p>
<p>Also, as you mentioned the issue of group commit being broken (see <a></a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tnagy</title>
		<link>http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/comment-page-1/#comment-162</link>
		<dc:creator>tnagy</dc:creator>
		<pubDate>Wed, 14 Jun 2006 17:07:30 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/#comment-162</guid>
		<description>Hello Peter,
Thanks so much for the prompt response.
If I understand your response correctly regarding the &quot;flushing&quot; of the InnoDB buffer pool, do you mean that data in the buffer pool (memory) is written directly to the tablespace files (.ibds)?  So the sequence is something like the following:
START TRANSACTION (implicit or not)
UPDATE . . .. (modify some rows in the buffer pool (in memory)
COMMIT--&gt;write (a delta?) to innodb-log-file AND
write statements to binary (replication) log AND THEN
. . . . do whatever is necessary because of multi-versioning in buffer pool (and mark these rows as dirty)

Then at some later time, as part of a background process, write the &quot;dirty&quot; pages in the buffer pool to the .ibd files
I&#039;m sure I&#039;m leaving some things out, but is that essentially the sequence?  I had assumed that the innodb-log-files were &quot;flushed&quot; at some point to the tablespace files, just because in case of a crash before all buffered dirty pages were flushed, then InnoDB has to use its log files to synchronize the tablespace files because obviously anything in memory would have been lost, but it seems like you&#039;re suggesting that the log files are not used to synchronize the tablespace files EXCEPT in the case of a crash?

Also, as you mentioned the issue of group commit being broken (see &lt;a&gt;&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Hello Peter,<br />
Thanks so much for the prompt response.<br />
If I understand your response correctly regarding the &#8220;flushing&#8221; of the InnoDB buffer pool, do you mean that data in the buffer pool (memory) is written directly to the tablespace files (.ibds)?  So the sequence is something like the following:<br />
START TRANSACTION (implicit or not)<br />
UPDATE . . .. (modify some rows in the buffer pool (in memory)<br />
COMMIT&#8211;&gt;write (a delta?) to innodb-log-file AND<br />
write statements to binary (replication) log AND THEN<br />
. . . . do whatever is necessary because of multi-versioning in buffer pool (and mark these rows as dirty)</p>
<p>Then at some later time, as part of a background process, write the &#8220;dirty&#8221; pages in the buffer pool to the .ibd files<br />
I&#8217;m sure I&#8217;m leaving some things out, but is that essentially the sequence?  I had assumed that the innodb-log-files were &#8220;flushed&#8221; at some point to the tablespace files, just because in case of a crash before all buffered dirty pages were flushed, then InnoDB has to use its log files to synchronize the tablespace files because obviously anything in memory would have been lost, but it seems like you&#8217;re suggesting that the log files are not used to synchronize the tablespace files EXCEPT in the case of a crash?</p>
<p>Also, as you mentioned the issue of group commit being broken (see <a></a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: peter</title>
		<link>http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/comment-page-1/#comment-160</link>
		<dc:creator>peter</dc:creator>
		<pubDate>Wed, 14 Jun 2006 14:54:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/#comment-160</guid>
		<description>Tnagy,

Yes you&#039;re right.  Binary log is protected by mutex which makes it very expensive to do sync_binlog=1 unless you have battery backed up cache and if your OS does not lie you about fsyncs.  It is simple code which does not even have &quot;group commit&quot; allowing to flush several events with single write to disk.   Yes this means log writes are going to be serialized. It is not exactly single threaded as flushing the log is probably only portion of what thread does but it can be significant. 

Innodb also has log mutex which protects log  writes.  In MySQL 4.1 and MySQL 5.0 without binary logging  it however can do group commit, meaning it can commit several transactions which are waiting to be commited at the same time with single log write.  This is currently broken in 5.0 if you enable binary log. 

In general data migration in Innodb happens as following (which is traditional way for most of database management systems) -  once transaction is commited the data is recorded in Innodb log files before COMMIT returns.  The data pages are however modified only in the buffer pool.  Dirty pages are flushed from the buffer pool in background.  For Innodb flushes happen when log files are almost full and Innodb needs to overwrite some old log records (remember log files in Innodb are circular) or if there are too many dirty buffers in the buffer pool (see innodb_max_dirty_pages_pct variable).</description>
		<content:encoded><![CDATA[<p>Tnagy,</p>
<p>Yes you&#8217;re right.  Binary log is protected by mutex which makes it very expensive to do sync_binlog=1 unless you have battery backed up cache and if your OS does not lie you about fsyncs.  It is simple code which does not even have &#8220;group commit&#8221; allowing to flush several events with single write to disk.   Yes this means log writes are going to be serialized. It is not exactly single threaded as flushing the log is probably only portion of what thread does but it can be significant. </p>
<p>Innodb also has log mutex which protects log  writes.  In MySQL 4.1 and MySQL 5.0 without binary logging  it however can do group commit, meaning it can commit several transactions which are waiting to be commited at the same time with single log write.  This is currently broken in 5.0 if you enable binary log. </p>
<p>In general data migration in Innodb happens as following (which is traditional way for most of database management systems) &#8211;  once transaction is commited the data is recorded in Innodb log files before COMMIT returns.  The data pages are however modified only in the buffer pool.  Dirty pages are flushed from the buffer pool in background.  For Innodb flushes happen when log files are almost full and Innodb needs to overwrite some old log records (remember log files in Innodb are circular) or if there are too many dirty buffers in the buffer pool (see innodb_max_dirty_pages_pct variable).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tnagy</title>
		<link>http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/comment-page-1/#comment-157</link>
		<dc:creator>tnagy</dc:creator>
		<pubDate>Tue, 13 Jun 2006 21:58:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.mysqlperformanceblog.com/2006/05/27/jeremy-cole-on-mysql-replication/#comment-157</guid>
		<description>Hello,
I was at the MySQL conference in May and attended Jeremy&#039;s presentation on replication.  My understanding was that all &quot;writes&quot; to the binary log were protected by a mutex--so you may have 100s of threads updating different tables/rows, but if sync_binlog = 1 (which is a requirement for true ACID integrity)--doesn&#039;t this mean that in the end all writes (to the binary log) are &quot;effectively&quot; single-threaded?
Another question along this line is with regards to innodb_flush_log_at_trx_commit = 1?  Is it also protected by a mutex and is it somehow &quot;coordinated&quot; with the write to the binary log?
Peter, it would be great if you could provide some high-level explanation of how InnoDB updates are propagated between the in-memory-buffer--&gt;innodb-log-files--&gt;innodb &quot;tablespace&quot; (.ibd) file--&gt;and finally the binary-log.</description>
		<content:encoded><![CDATA[<p>Hello,<br />
I was at the MySQL conference in May and attended Jeremy&#8217;s presentation on replication.  My understanding was that all &#8220;writes&#8221; to the binary log were protected by a mutex&#8211;so you may have 100s of threads updating different tables/rows, but if sync_binlog = 1 (which is a requirement for true ACID integrity)&#8211;doesn&#8217;t this mean that in the end all writes (to the binary log) are &#8220;effectively&#8221; single-threaded?<br />
Another question along this line is with regards to innodb_flush_log_at_trx_commit = 1?  Is it also protected by a mutex and is it somehow &#8220;coordinated&#8221; with the write to the binary log?<br />
Peter, it would be great if you could provide some high-level explanation of how InnoDB updates are propagated between the in-memory-buffer&#8211;&gt;innodb-log-files&#8211;&gt;innodb &#8220;tablespace&#8221; (.ibd) file&#8211;&gt;and finally the binary-log.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
