<div dir="ltr">default_init() --> for_each_object_in_wd() --> thread_process_path() --> for_each_object_in_path() and the code for for_each_object_in_path():<br><div><br></div><div>......</div><div><div> if (is_tmp_dentry(d->d_name)) {</div><div> if (cleanup) {</div><div> snprintf(file_name, sizeof(file_name),</div><div> "%s/%s", path, d->d_name);</div><div> sd_debug("remove tmp object %s", file_name);</div><div> if (unlink(file_name) < 0)</div><div> sd_err("failed to unlink %s: %m",</div><div> file_name);</div><div> }</div><div> continue;</div><div> }</div></div><div>......</div><div><br></div><div>sheep should remove .tmp file when it start, or it will not work correctly.<br></div><div>Ruoyu, the full path bug was fixed by you :)</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-09-18 17:28 GMT+08:00 Ruoyu <span dir="ltr"><<a href="mailto:liangry@ucweb.com" target="_blank">liangry@ucweb.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#FFFFFF" text="#000000"><span class="">
<br>
<div>On 2014年09月18日 16:30, Bingpeng Zhu
wrote:<br>
</div>
<blockquote type="cite">
<div>
<div style="line-height:21px"><span style="line-height:1.5">Thank
you for the advice.</span></div>
<div style="line-height:21px"><span style="line-height:1.5">default_init()
of sheep/store.c</span><span style="line-height:1.5">
has </span><span style="line-height:1.5">already </span><span style="line-height:1.5">had the logic of unlinking </span><span style="line-height:1.5">oid.tmp files. I'm not sure the
reason why oid.tmp file still exists </span><span style="line-height:1.5">in the system.</span></div>
</div>
</blockquote></span>
No. current logic does not unlink oid.tmp files in default_init().<div><div class="h5"><br>
<blockquote type="cite">
<div><span style="line-height:1.5"><br>
</span></div>
<div>
<div><br>
</div>
<div><br>
</div>
<div style="font-size:12px;font-family:Arial Narrow;padding:2px 0 2px 0">------------------ Original ------------------</div>
<div style="font-size:12px;background:#efefef;padding:8px">
<div><b>From: </b> "Hitoshi
Mitake";<a href="mailto:mitake.hitoshi@lab.ntt.co.jp" target="_blank"><mitake.hitoshi@lab.ntt.co.jp></a>;</div>
<div><b>Date: </b> Sep 18, 2014</div>
<div><b>To: </b> "Ruoyu"<a href="mailto:liangry@ucweb.com" target="_blank"><liangry@ucweb.com></a>; <u></u></div>
<div><b>Cc: </b> "Bingpeng Zhu"<a href="mailto:nkuzbp@foxmail.com" target="_blank"><nkuzbp@foxmail.com></a>;
"sheepdog"<a href="mailto:sheepdog@lists.wpkg.org" target="_blank"><sheepdog@lists.wpkg.org></a>; <u></u></div>
<div><b>Subject: </b> Re: [sheepdog] question about replica
recovery failure caused by oid.tmp file</div>
</div>
<div><br>
</div>
At Tue, 16 Sep 2014 10:10:32 +0800,<br>
Ruoyu wrote:<br>
> <br>
> [1 <multipart/alternative (7bit)>]<br>
> [1.1 <text/plain; ISO-8859-1 (7bit)>]<br>
> Thanks Bingpeng.<br>
> I also encountered this problem.<br>
> I suggest sheep should scan oid.tmp files and remove them
when it is <br>
> being started.<br>
<br>
I agree with Ruoyu's opinion. .tmp files should be deleted at<br>
initialization time. e.g. default_init() of sheep/store.c would
be a<br>
good place for it.<br>
<br>
Thanks,<br>
Hitoshi<br>
<br>
> <br>
> On 2014?09?15? 00:14, Bingpeng Zhu wrote:<br>
> > Hi, all:<br>
> > I have a problem in using sheepdog. I create a
erasure coded VDI <br>
> > and write<br>
> > some data to it. Then, I unplug disk and
stop/restart one sheep in a <br>
> > short<br>
> > time. After recovery is completed in the latest
epoch, I find some <br>
> > replica is<br>
> > lost and only the corresponding oid.tmp file exists
in the data <br>
> > directory. I tried<br>
> > to rebuild the replica using "dog vdi check", but it
didn't work. I <br>
> > think it is<br>
> > caused by oid.tmp file. I have to delete the oid.tmp
file manually <br>
> > and then<br>
> > "dog vdi check" successfully recoverd the lost
replica.<br>
> > In function default_create_and_write() of
sheep/plain_store.c, <br>
> > it returns<br>
> > success directly if oid.tmp file exists. I have read
the comment in <br>
> > this function carefully,<br>
> > it says gateway and recovery thread may try to write
the SAME data, <br>
> > so it is okay<br>
> > to simply return success here. To solve this
problem, I want to <br>
> > change the code of<br>
> > default_create_and_write() so that replica data will
be written even <br>
> > oid.tmp file exists.<br>
> > If oid.tmp exists, the function should overwrite it.<br>
> > I am not sure if this change will work good for all
scenario. <br>
> > Especially, I doubt whether<br>
> > this change will lead to old data overwriting new
data. But I <br>
> > haven't thought out any scenario<br>
> > that will lead to old data overwriting new data. Can
someone give me <br>
> > some advice to solve this problem?<br>
> ><br>
> ><br>
> ><br>
> <br>
> [1.2 <text/html; ISO-8859-1 (7bit)>]<br>
> <br>
> [2 <text/plain; us-ascii (7bit)>]<br>
> -- <br>
> sheepdog mailing list<br>
> <a href="mailto:sheepdog@lists.wpkg.org" target="_blank">sheepdog@lists.wpkg.org</a><br>
> <a href="http://lists.wpkg.org/mailman/listinfo/sheepdog" target="_blank">http://lists.wpkg.org/mailman/listinfo/sheepdog</a><br>
</div>
</blockquote>
<br>
</div></div></div>
<br>--<br>
sheepdog mailing list<br>
<a href="mailto:sheepdog@lists.wpkg.org">sheepdog@lists.wpkg.org</a><br>
<a href="http://lists.wpkg.org/mailman/listinfo/sheepdog" target="_blank">http://lists.wpkg.org/mailman/listinfo/sheepdog</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>--<br>Best Regard<br>Robin Dong
</div>