<html><body><div style="font-family: garamond,new york,times,serif; font-size: 12pt; color: #000000"><br><div><br></div><hr id="zwchr"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"Vijay Bellur" &lt;vbellur@redhat.com&gt;<br><b>To: </b>"Krutika Dhananjay" &lt;kdhananj@redhat.com&gt;<br><b>Cc: </b>"Gluster Devel" &lt;gluster-devel@gluster.org&gt;<br><b>Sent: </b>Tuesday, February 24, 2015 4:13:13 PM<br><b>Subject: </b>Re: [Gluster-devel] Sharding - Inode write fops - recoverability from failures - design<br><div><br></div>On 02/24/2015 01:53 PM, Krutika Dhananjay wrote:<br>&gt;<br>&gt;<br>&gt; ------------------------------------------------------------------------<br>&gt;<br>&gt; &nbsp; &nbsp; *From: *"Vijay Bellur" &lt;vbellur@redhat.com&gt;<br>&gt; &nbsp; &nbsp; *To: *"Krutika Dhananjay" &lt;kdhananj@redhat.com&gt;<br>&gt; &nbsp; &nbsp; *Cc: *"Gluster Devel" &lt;gluster-devel@gluster.org&gt;<br>&gt; &nbsp; &nbsp; *Sent: *Tuesday, February 24, 2015 12:26:58 PM<br>&gt; &nbsp; &nbsp; *Subject: *Re: [Gluster-devel] Sharding - Inode write fops -<br>&gt; &nbsp; &nbsp; recoverability from failures - design<br>&gt;<br>&gt; &nbsp; &nbsp; On 02/24/2015 12:19 PM, Krutika Dhananjay wrote:<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; ------------------------------------------------------------------------<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; *From: *"Vijay Bellur" &lt;vbellur@redhat.com&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; *To: *"Krutika Dhananjay" &lt;kdhananj@redhat.com&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; *Cc: *"Gluster Devel" &lt;gluster-devel@gluster.org&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; *Sent: *Tuesday, February 24, 2015 11:35:28 AM<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; *Subject: *Re: [Gluster-devel] Sharding - Inode write fops -<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; recoverability from failures - design<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; On 02/24/2015 10:36 AM, Krutika Dhananjay wrote:<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; ------------------------------------------------------------------------<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; *From: *"Vijay Bellur" &lt;vbellur@redhat.com&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; *To: *"Krutika Dhananjay" &lt;kdhananj@redhat.com&gt;,<br>&gt; &nbsp; &nbsp; "Gluster Devel"<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &lt;gluster-devel@gluster.org&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; *Sent: *Monday, February 23, 2015 5:25:57 PM<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; *Subject: *Re: [Gluster-devel] Sharding - Inode write<br>&gt; &nbsp; &nbsp; fops -<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; recoverability from failures - design<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; On 02/22/2015 06:08 PM, Krutika Dhananjay wrote:<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; Hi,<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; Please find the design doc for one of the problems in<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; sharding which<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; Pranith and I are trying to solve and its solution @<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; http://review.gluster.org/#/c/9723/1.<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; Reviews and feedback are much appreciated.<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; Can this feature be made optional? I think there are use<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; cases like<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; virtual machine image storage, hdfs etc. where the<br>&gt; &nbsp; &nbsp; number of<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; metadata<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; queries might not be very high. It would be an acceptable<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; tradeoff in<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; such cases to not be very efficient for answering metadata<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; queries but<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; be very efficient for data operations.<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; IOW, can we have two possible modes of operation for<br>&gt; &nbsp; &nbsp; the sharding<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; translator to answer metadata queries?<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; 1. One that behaves like a regular filesystem where we<br>&gt; &nbsp; &nbsp; expect<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; a mix of<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; data and metadata operations. Your document seems to cover<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; that part<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; well. We can look at optimizing behavior for<br>&gt; &nbsp; &nbsp; multi-threaded<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; single<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; writer use cases after an initial implementation is in<br>&gt; &nbsp; &nbsp; place.<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; Techniques<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; like eager locking can be applied here.<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; 2. Another mode where we do not expect a lot of metadata<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; queries. In<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; this mode, we can visit all nodes where we have shards to<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; answer these<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; queries.<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; But for sharding translator to be able to visit all<br>&gt; &nbsp; &nbsp; shards, it is<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; required to know the last shard number.<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; Without this, it will never know when to stop looking up the<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; different<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; shards. For this to happen, we<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt; still need to maintain the size attribute for each file.<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; Wouldn't maintaining the total number of shards in the metadata<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; shard be<br>&gt; &nbsp; &nbsp; &nbsp;&gt; &nbsp; &nbsp; sufficient?<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt; &nbsp; &nbsp; &nbsp;&gt; Maintaining the correctness of "total number of shards" would again<br>&gt; &nbsp; &nbsp; &nbsp;&gt; incur the same cost as maintaining size or any other metadata<br>&gt; &nbsp; &nbsp; attribute<br>&gt; &nbsp; &nbsp; &nbsp;&gt; if a client/brick crashes in the middle of a write fop before the<br>&gt; &nbsp; &nbsp; &nbsp;&gt; attribute is committed to disk.<br>&gt; &nbsp; &nbsp; &nbsp;&gt; In other words, we will again need to maintain a "dirty" and<br>&gt; &nbsp; &nbsp; "committed"<br>&gt; &nbsp; &nbsp; &nbsp;&gt; copy of the shard_count to ensure its correctness.<br>&gt; &nbsp; &nbsp; &nbsp;&gt;<br>&gt;<br>&gt; &nbsp; &nbsp; I think the cost of maintaining "total number of shards" is not as<br>&gt; &nbsp; &nbsp; expensive as maintaining size or any other metadata attribute. The<br>&gt; &nbsp; &nbsp; shard<br>&gt; &nbsp; &nbsp; count needs to be updated only when an extending operation results in<br>&gt; &nbsp; &nbsp; the creation of a new shard or when a truncate operation results in the<br>&gt; &nbsp; &nbsp; removal of a shard. Maintaining other metadata attributes would need<br>&gt; &nbsp; &nbsp; a 5<br>&gt; &nbsp; &nbsp; phase transaction for every write operation. Isn't that the case?<br>&gt;<br>&gt; Even size attribute changes only in case of extending writes and<br>&gt; truncates. In fact, Pranith and I had<br>&gt; initially chosen to persist shard count as opposed to size in the first<br>&gt; design for inode write fops.<br>&gt; But the reason we decided to go with size in the end is to prevent extra<br>&gt; lookup on the last shard to<br>&gt; find the total size of the file (i.e., if N is the total number of<br>&gt; shards, file size = (N-1)*shard_block_size + sizeof(last shard)).<br>&gt;<br><div><br></div>I am probably confused about the definition of size.</blockquote><div>By size, I mean the total size of the file in bytes.</div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;">For maintaining <br>accurate size, wouldn't we need to account for truncates and writes that <br>happen within the scope of one shard?</blockquote><div>Correct. This particular increase/decrease in size can be deduced from the change in ia_size between postbuf and prebuf in the respective callback.</div><div>-Krutika</div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><br><div><br></div>-Vijay<br><div><br></div><br><div><br></div></blockquote><br></div></body></html>