<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 22, 2013 at 5:57 AM, Pranith Kumar Karampuri <span dir="ltr">&lt;<a href="mailto:pkarampu@redhat.com" target="_blank">pkarampu@redhat.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
<br>
----- Original Message -----<br>
&gt; From: &quot;Anand Avati&quot; &lt;<a href="mailto:anand.avati@gmail.com">anand.avati@gmail.com</a>&gt;<br>
&gt; To: &quot;Jeff Darcy&quot; &lt;<a href="mailto:jdarcy@redhat.com">jdarcy@redhat.com</a>&gt;<br>
&gt; Cc: &quot;Pranith Kumar Karampuri&quot; &lt;<a href="mailto:pkarampu@redhat.com">pkarampu@redhat.com</a>&gt;, &quot;Anand Avati&quot; &lt;<a href="mailto:aavati@redhat.com">aavati@redhat.com</a>&gt;, &quot;Raghavan Pichai&quot;<br>

&gt; &lt;<a href="mailto:rpichai@redhat.com">rpichai@redhat.com</a>&gt;, &quot;Ravishankar Narayanankutty&quot; &lt;<a href="mailto:ranaraya@redhat.com">ranaraya@redhat.com</a>&gt;, &quot;devel&quot; &lt;<a href="mailto:gluster-devel@nongnu.org">gluster-devel@nongnu.org</a>&gt;<br>

&gt; Sent: Wednesday, May 22, 2013 1:19:19 AM<br>
&gt; Subject: Re: [Gluster-devel] Proposal to change locking in data-self-heal<br>
&gt;<br>
&gt; On Tue, May 21, 2013 at 7:05 AM, Jeff Darcy &lt;<a href="mailto:jdarcy@redhat.com">jdarcy@redhat.com</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; On 05/21/2013 09:10 AM, Pranith Kumar Karampuri wrote:<br>
&gt; &gt;<br>
&gt; &gt;&gt; scenario-1 won&#39;t happen because there exists a chance for it to acquire<br>
&gt; &gt;&gt; truncate&#39;s full file lock after any 128k range sync happens.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; Scenario-2 won&#39;t happen because extra self-heals that are launched on the<br>
&gt; &gt;&gt; same file will be blocked in self-heal-domain so the data-path&#39;s locks are<br>
&gt; &gt;&gt; not affected by this.<br>
&gt; &gt;&gt;<br>
&gt; &gt;<br>
&gt; &gt; This is two changes for two scenarios:<br>
&gt; &gt;<br>
&gt; &gt; * Change granular-lock order to avoid scenario 1.<br>
&gt; &gt;<br>
&gt; &gt; * Add a new lock to avoid scenario 2.<br>
&gt; &gt;<br>
&gt; &gt; I&#39;m totally fine with the second part, but the first part makes me a bit<br>
&gt; &gt; uneasy.  As I recall, the &quot;chained&quot; locking (lock second range before<br>
&gt; &gt; unlocking the first) was a deliberate choice to avoid windows where<br>
&gt; &gt; somebody could jump in with a truncate during self-heal.  It certainly<br>
&gt; &gt; wasn&#39;t the obvious thing to do, suggesting there was a specific reason.<br>
&gt;<br>
&gt;<br>
&gt; Chained locking really was to avoid the start of a second self-heal while<br>
&gt; one is in progress. By giving up the big lock (after holding the small<br>
&gt; lock), regional operations can progress but the second self-heal waiting to<br>
&gt; hold the big lock is still held off. Truncating isn&#39;t really an issue as<br>
&gt; long as the truncate transaction locks from new EOF till infinity (which it<br>
&gt; is) and self-heal will not race in those regions. Of course, with chained<br>
&gt; locking, full-file truncates can starve.<br>
&gt;<br>
&gt; It&#39;s not obvious what use case Pranith is facing where self-heal and<br>
&gt; ftruncate() are competing. Is it just an artificial/hand-crafted test case,<br>
&gt; or a real-life access pattern?<br>
<br>
</div></div>artificial.<br>
<div class="im"><br>
&gt;<br>
&gt;<br>
&gt; &gt; Until we recall what that reason was I don&#39;t think we can determine<br>
&gt; &gt; whether this is a bug or a feature.  If it&#39;s a feature, or if we don&#39;t<br>
&gt; &gt; know, this change is likely to break something instead of fixing it.<br>
&gt;<br>
&gt;<br>
&gt; The sole reason was to prevent the start of a second self-heal. Having<br>
&gt; self-heals serialize in a separate domain solves the problem (except if we<br>
&gt; are looking at runtime compatibility across multiple versions in this<br>
&gt; scenario.. aargh!)<br>
<br>
</div>So you guys are OK with this proposal if we solve version compatibility issues?<br><br></blockquote><div><br></div><div style>I guess you can even just ignore the backward compatibility issue in this case. Old servers will &quot;safely&quot; block themselves against the big data-lock causing starvation just the way things work today. Once all servers are upgraded, all self-heals will gracefully block themselves in the new domain. There isn&#39;t much compatibility handling actually.</div>
<div style><br></div><div style>Avati</div><div style><br></div></div></div></div>