<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: How to coordinate distributed work with MySQL&#8217;s GET_LOCK</title>
	<link>http://www.xaprb.com/blog/2006/07/26/how-to-coordinate-distributed-work-with-mysqls-get_lock/</link>
	<description>Stay curious!</description>
	<pubDate>Wed, 09 Jul 2008 04:07:26 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>

	<item>
		<title>By: Shehan</title>
		<link>http://www.xaprb.com/blog/2006/07/26/how-to-coordinate-distributed-work-with-mysqls-get_lock/#comment-14431</link>
		<author>Shehan</author>
		<pubDate>Mon, 14 Apr 2008 03:16:38 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/07/26/how-to-coordinate-distributed-work-with-mysqls-get_lock/#comment-14431</guid>
		<description>I'm having a hard time to use "GET_LOCK()" function. 
Can comeone explain how this work and put some sample code. 

I'm using InnoDb storage even. But when I apply the function it gives nothing. 

please help.
Thanks!</description>
		<content:encoded><![CDATA[<p>I&#8217;m having a hard time to use &#8220;GET_LOCK()&#8221; function.<br />
Can comeone explain how this work and put some sample code. </p>
<p>I&#8217;m using InnoDb storage even. But when I apply the function it gives nothing. </p>
<p>please help.<br />
Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Partha Dutta</title>
		<link>http://www.xaprb.com/blog/2006/07/26/how-to-coordinate-distributed-work-with-mysqls-get_lock/#comment-1266</link>
		<author>Partha Dutta</author>
		<pubDate>Fri, 28 Jul 2006 15:52:18 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/07/26/how-to-coordinate-distributed-work-with-mysqls-get_lock/#comment-1266</guid>
		<description>&lt;p&gt;Also, If the session is interactive, you also have to worry about any interactive_timeout or wait_timeout sessions. Otherwiseif the session disconnects, the &lt;code&gt;GET_LOCK&lt;/code&gt; will release the lock immediately.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Also, If the session is interactive, you also have to worry about any interactive_timeout or wait_timeout sessions. Otherwiseif the session disconnects, the <code>GET_LOCK</code> will release the lock immediately.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2006/07/26/how-to-coordinate-distributed-work-with-mysqls-get_lock/#comment-1255</link>
		<author>Xaprb</author>
		<pubDate>Thu, 27 Jul 2006 20:09:05 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/07/26/how-to-coordinate-distributed-work-with-mysqls-get_lock/#comment-1255</guid>
		<description>&lt;p&gt;Sure, for work that's done in the database locks are a bad thing.  In my case, the applications are working outside the database, and we just use MySQL as a central point of control.  Remember GET_LOCK() doesn't actually get a lock on anything, per se.&lt;/p&gt;

&lt;p&gt;The types of applications we're trying to make mutually exclusive are such things as a script to upload a set of ads to a search engine.  Allowing more than one to proceed, and then trying to resolve conflicts later, will most certainly not work :-)  The work must be done by one and only one program.  Another example is rolling up the tables I referred to a couple articles ago.  We don't want that happening twice at once, as it's nothing but double work to produce the same answer.&lt;/p&gt;

&lt;p&gt;So we actually use these "locks" to just make sure only one thing can run (hence the "highlander" name -- "there can be only one!!!!" -- and no, I've not seen the movie)&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Sure, for work that&#8217;s done in the database locks are a bad thing.  In my case, the applications are working outside the database, and we just use MySQL as a central point of control.  Remember GET_LOCK() doesn&#8217;t actually get a lock on anything, per se.</p>
<p>The types of applications we&#8217;re trying to make mutually exclusive are such things as a script to upload a set of ads to a search engine.  Allowing more than one to proceed, and then trying to resolve conflicts later, will most certainly not work :-)  The work must be done by one and only one program.  Another example is rolling up the tables I referred to a couple articles ago.  We don&#8217;t want that happening twice at once, as it&#8217;s nothing but double work to produce the same answer.</p>
<p>So we actually use these &#8220;locks&#8221; to just make sure only one thing can run (hence the &#8220;highlander&#8221; name &#8212; &#8220;there can be only one!!!!&#8221; &#8212; and no, I&#8217;ve not seen the movie)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay Pipes</title>
		<link>http://www.xaprb.com/blog/2006/07/26/how-to-coordinate-distributed-work-with-mysqls-get_lock/#comment-1254</link>
		<author>Jay Pipes</author>
		<pubDate>Thu, 27 Jul 2006 19:53:26 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/07/26/how-to-coordinate-distributed-work-with-mysqls-get_lock/#comment-1254</guid>
		<description>&lt;p&gt;Hi!&lt;/p&gt;

&lt;p&gt;Locking of any sort, IMHO, causes scalability and concurrency issues, even if it is a non-blocking read.  Wouldn't a more scalable solution be to simply not set locks at all and resolve conficts at runtime based on a modified date?  This is the standard model of distributed version control.&lt;/p&gt;

&lt;p&gt;Thoughts?&lt;/p&gt;

&lt;p&gt;-Jay&lt;/p&gt;

&lt;p&gt;@Toby:  I believe that LOCK TABLE would cause a blocking read in PostgreSQL, no?  Just like in MySQL, if you issue a LOCK TABLES ... WRITE or SELECT ... FOR UPDATE, it will be a blocking read AFAIK...&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Hi!</p>
<p>Locking of any sort, IMHO, causes scalability and concurrency issues, even if it is a non-blocking read.  Wouldn&#8217;t a more scalable solution be to simply not set locks at all and resolve conficts at runtime based on a modified date?  This is the standard model of distributed version control.</p>
<p>Thoughts?</p>
<p>-Jay</p>
<p>@Toby:  I believe that LOCK TABLE would cause a blocking read in PostgreSQL, no?  Just like in MySQL, if you issue a LOCK TABLES &#8230; WRITE or SELECT &#8230; FOR UPDATE, it will be a blocking read AFAIK&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Toby</title>
		<link>http://www.xaprb.com/blog/2006/07/26/how-to-coordinate-distributed-work-with-mysqls-get_lock/#comment-1247</link>
		<author>Toby</author>
		<pubDate>Thu, 27 Jul 2006 16:43:53 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/07/26/how-to-coordinate-distributed-work-with-mysqls-get_lock/#comment-1247</guid>
		<description>&lt;p&gt;Yes, this lock is perfect for a project I'm working on too. I use it to protect a critical section - an algorithm that operates on one table. A stored procedure would use the lock in the same way.&lt;/p&gt;

&lt;p&gt;PostgreSQL could achieve the same effect (for my purposes) using &lt;code&gt;LOCK TABLE&lt;/code&gt;.&lt;/p&gt;</description>
		<content:encoded><![CDATA[<p>Yes, this lock is perfect for a project I&#8217;m working on too. I use it to protect a critical section - an algorithm that operates on one table. A stored procedure would use the lock in the same way.</p>
<p>PostgreSQL could achieve the same effect (for my purposes) using <code>LOCK TABLE</code>.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
