<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="ZH-CN" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D"> Similar problems happened to me a while ago, even without cache.<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:10.5pt"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D">However, I think the problem is “What’s the expected behavior of formatting a running cluster?”<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D"> Has this been discussed before ? I’m wondering if you already have an answer for this.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<div style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> sheepdog-bounces@lists.wpkg.org [mailto:sheepdog-bounces@lists.wpkg.org]
<b>On Behalf Of </b>HaiTing Yao<br>
<b>Sent:</b> Monday, March 19, 2012 10:44 AM<br>
<b>To:</b> Liu Yuan<br>
<b>Cc:</b> HaiTing Yao; sheepdog@lists.wpkg.org<br>
<b>Subject:</b> Re: [Sheepdog] [PATCH] sheep: modify cached_epoch<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US">On Fri, Mar 16, 2012 at 6:35 PM, Liu Yuan <<a href="mailto:namei.unix@gmail.com">namei.unix@gmail.com</a>> wrote:<o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US">On 03/16/2012 04:43 PM,
<a href="mailto:yaohaiting.wujue@gmail.com">yaohaiting.wujue@gmail.com</a> wrote:<br>
<br>
> From: HaiTing Yao <<a href="mailto:wujue.yht@taobao.com">wujue.yht@taobao.com</a>><br>
><br>
> cached_epoch is a __thread variable. If it greater than 1, format the<br>
> cluster again will lead to permanent I/O error.<br>
><br>
> Signed-off-by: HaiTing Yao <<a href="mailto:wujue.yht@taobao.com">wujue.yht@taobao.com</a>><br>
> ---<br>
> sheep/sdnet.c | 6 +++++-<br>
> 1 files changed, 5 insertions(+), 1 deletions(-)<br>
><br>
> diff --git a/sheep/sdnet.c b/sheep/sdnet.c<br>
> index 5db9f29..d693858 100644<br>
> --- a/sheep/sdnet.c<br>
> +++ b/sheep/sdnet.c<br>
> @@ -832,7 +832,11 @@ int get_sheep_fd(uint8_t *addr, uint16_t port, int node_idx, uint32_t epoch)<br>
> if (before(epoch, cached_epoch)) {<br>
> eprintf("requested epoch is smaller than the previous one: %d < %d\n",<br>
> epoch, cached_epoch);<br>
> - return -1;<br>
> + /* cluster format again */<br>
> + if (sys->epoch == 1)<br>
> + cached_epoch = 0;<br>
> + else<br>
> + return -1;<br>
> }<br>
> if (after(epoch, cached_epoch)) {<br>
> for (i = 0; i < SD_MAX_NODES; i++) {<br>
<br>
<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US">Any script that can reproduce this issue?<o:p></o:p></span></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<p class="MsoNormal"><span lang="EN-US"><br>
Thanks,<br>
Yuan<o:p></o:p></span></p>
</blockquote>
<div>
<p class="MsoNormal"><span lang="EN-US"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Please try this script, thanks<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">The error log like this<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> Mar 19 10:28:14 forward_write_obj_req(304) 70912800000000<br>
Mar 19 10:28:14 get_sheep_fd(834) requested epoch is smaller than the previous one: 1 < 2<br>
Mar 19 10:28:14 forward_write_obj_req(337) failed to connect to <a href="http://127.0.0.1:7002">
127.0.0.1:7002</a><br>
Mar 19 10:28:14 do_io_request(785) failed: 1, 70912800000000 , 1, 129<br>
Mar 19 10:28:14 client_handler(557) closed connection 11<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">test-cached.sh<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">set -x<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">sudo killall sheep<br>
sudo rm -rf ~/s1 ~/s2 ~/s3 ~/s4 <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">echo "test cached epoch" > ~/tmp-cached<br>
sudo sheep -d ~/s1 -z 1 <br>
sudo sheep -d ~/s2 -z 2 -p 7002 <br>
sudo sheep -d ~/s3 -z 3 -p 7003 <br>
sudo sheep -d ~/s4 -z 4 -p 7004 <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">sleep 60<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">collie cluster format<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">collie vdi create v1 64M<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">sleep 30<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">collie vdi write v1 0 1024 < ~/tmp-cached
<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">ps -ef | grep "\-z 4" | awk '{print $2}' | xargs sudo kill<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">sleep 60<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">collie vdi write v1 0 1024 < ~/tmp-cached
<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">sleep 6<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">collie cluster format<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">collie vdi create v1 64M<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">sleep 60<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">collie vdi write v1 0 1024 < ~/tmp-cached
<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Best Regards<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</body>
</html>