<?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>Life Scaling &#187; slave</title>
	<atom:link href="http://orensol.com/tag/slave/feed/" rel="self" type="application/rss+xml" />
	<link>http://orensol.com</link>
	<description>Oren Solomianik's Blog</description>
	<lastBuildDate>Mon, 21 Jun 2010 08:10:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>MySQL off-site replication and timezones</title>
		<link>http://orensol.com/2009/01/15/mysql-off-site-replication-and-timezones/</link>
		<comments>http://orensol.com/2009/01/15/mysql-off-site-replication-and-timezones/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 09:17:58 +0000</pubDate>
		<dc:creator>Oren</dc:creator>
				<category><![CDATA[LAMP]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[replication]]></category>
		<category><![CDATA[slave]]></category>
		<category><![CDATA[timezone]]></category>

		<guid isPermaLink="false">http://orensol.com/?p=21</guid>
		<description><![CDATA[<p>Recently we were doing some testing on a mysql slave server which was located at an off-site location from the master server. While the on-site slave was having no problems replicating, the off-site slave would once a day break replication on a duplicate entry error because of a unique key insert problem.</p>
<p>This was very weird, [...]]]></description>
			<content:encoded><![CDATA[<p>Recently we were doing some testing on a mysql slave server which was located at an off-site location from the master server. While the on-site slave was having no problems replicating, the off-site slave would once a day break replication on a duplicate entry error because of a unique key insert problem.</p>
<p>This was very weird, especially because the on-site slave was having no trouble at all. After some brainstorming aided by <a href="http://www.percona.com/" target="_blank">percona</a>, we realized the cause. The off-site slave was in a different timezone than the other master and slave. This fact together with the fact that we had a unique key that contained curdate(), caused the following scenario:</p>
<ul>
<li>On January 3, 23:57, there was an insert on table t, unique key was 2009-01-03.</li>
<li>On January 4, 00:01, there was an insert on table t, unique key was 2009-01-04</li>
</ul>
<p>No problem, but &#8212; times are replicated as timestamps, so on the off-site slave, which was 1 hour ahead (EST instead of CST):</p>
<ul>
<li>First insert was replicated as January 4, 00:57, insert on table t, unique key 2009-01-04</li>
<li>Second insert was replicated as January 4, 01:01, insert on table t, and error on unique key for 2009-01-04</li>
</ul>
<p>The solution is either to set the whole machine&#8217;s timezone to the timezone of the master you&#8217;re replicating, or using the same <a href="http://dev.mysql.com/doc/refman/5.1/en/time-zone-support.html" target="_blank">time-zone and default-time-zone settings</a> for the mysql server.</p>
]]></content:encoded>
			<wfw:commentRss>http://orensol.com/2009/01/15/mysql-off-site-replication-and-timezones/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->