<pre class="bz_comment_text" id="comment_text_7">with write behind being removed from configuration, success is not returned for<br>writes which are failed. The above situation is caused because of replicate in<br>the setup. If replicate is removed from the test setup, this issue is not<br>
observed. As an example consider replicate over 2 nodes and following sequence<br>of operations.<br><br>1. start writing on gluster mount, data is replicated to both the nodes.<br>2. stop node1. Application still receives success on writes, but data is<br>
written only to node2.<br>3. restart node1. Application still receives success on writes, but data is<br>still not written to node1, since the file is no longer open on node1. Also<br>note that self-heal will not be done from node2 to node1 since replicate does<br>
not support self-heal on open fds yet.<br>4. stop node2. Application receives either ENOTCONN or EBADFD, based on the<br>child from which replicate received the last reply for write. subvolume<br>corresponding to node1 returns EBADFD and that of node2 returns ENOTCONN.<br>
5. Application sensing writes are failing, issues an open on the file. Note<br>that node2 is still down. If it were to be up, data on node1 would be synced<br>from node2.<br>6. Now writes happen only on node1. Note that file on node1 was missing some<br>
writes happened on node2. Now, node2 will miss the future writes, leading to a<br>split-brain situation.<br>7. Bring up the node1. If open were to happen now, when both nodes are up,<br>replicate identifies this as a split brain situation and a manual intervention<br>
is needed to identify the &quot;more&quot; correct version of file and remove the other.<br>Then replicate copies the more correct version of file to other node. <br><br>Hence the issue here is not writes being failed. Writes are happening but there<br>
is a split-brain situation because of the way servers have been restarted.</pre><br><div class="gmail_quote">On Wed, Sep 2, 2009 at 8:06 PM, Brian Hirt <span dir="ltr">&lt;<a href="mailto:bhirt@mobygames.com">bhirt@mobygames.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="im"><br>
On Sep 2, 2009, at 7:12 AM, Vijay Bellur wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Brian Hirt wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
The first part of this problem (open files not surviving gluster restarts) seems like a pretty major design flaw that needs to be fixed.<br>
</blockquote>
Yes, we do know that this is a problem and we have our sights set on solving this.<br>
</blockquote>
<br></div>
That is good to know.  Do you know if is this planned on being back ported into 2.0 or is it going to be part of 2.1?  Is there a bug report id so we can follow the progress?<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
The second part (gluster not reporting the error to the writer when gluster chokes) is a critical problem that needs to be fixed.<br>
</blockquote>
<br>
This is a bug in the write-behind translator and bug 242 has been tracked to address this.<br>
<br>
A discussion from the mailing list archives which could be of interest to you for the tail -f problem:<br>
<br>
<a href="http://gluster.org/pipermail/gluster-users/20090113/001362.html" target="_blank">http://gluster.org/pipermail/gluster-users/20090113/001362.html</a><br>
<br>
</blockquote>
<br></div>
Is there any additional information I can provide in this bug report?   I have disabled the following section from my test clients and can confirm that some errors that were not being reported are now being sent back to the writer program.  It&#39;s certainly an improvement over no errors being reported.<br>

<br>
volume writebehind<br>
  type performance/write-behind<br>
  option window-size 1MB<br>
  subvolumes distribute<br>
end-volume<br>
<br>
I&#39;ve also discovered, that this problem is not isolated to the writebehind module.  While some errors are being sent back to the writer, there is still data corruption in the gluster created file.  Gluster is still reporting success to the writer when writes have failed.   I have a simple program that writes 1, 2, 3, 4 ... N to a file at the rate of 100 lines per second.  Whenever the writer gets an error returned from write() it waits a second, reopens the file and continues writing.   While this writer is writing, I restart the gluster nodes one by one.  Once this is done, I stop the writter and check it for corruption.<br>

<br>
One interesting observation I have made is that when restarting the gluster servers, sometimes errorno EBADFD is returned and sometimes it&#39;s ENOTCONN.  When errno is ENOTCONN (107 in ubuntu 9.04) the file is not corrupted. When errno is EBADFD (77 in ubuntu 9.04) there is file corruption.  These statements are based on a limited number of test runs, but were always true for me.<br>

<br>
Some sample output of some tests:<br>
<br>
bhirt@ubuntu:~/gluster-tests$ rm -f /unify/m/test1.2009-09-02 &amp;&amp; ./write-numbers /unify/m/test1.2009-09-02<br>
problems writting to fd, reopening logfile (errno = 77) in one second<br>
^C<br>
bhirt@ubuntu:~/gluster-tests$ ./check-numbers /unify/m/test1.2009-09-02<br>
169 &lt;&gt; 480<br>
bhirt@ubuntu:~/gluster-tests$ rm -f /unify/m/test1.2009-09-02 &amp;&amp; ./write-numbers /unify/m/test1.2009-09-02<br>
problems writting to fd, reopening logfile (errno = 107) in one second<br>
^C<br>
<br>
bhirt@ubuntu:~/gluster-tests$ ./check-numbers /unify/m/test1.2009-09-02<br>
OK<br>
<br>
The programs I use to test this are:<br>
<br>
bhirt@ubuntu:~/gluster-tests$ cat write-numbers.c check-numbers<br>
#include &lt;stdio.h&gt;<br>
#include &lt;stdlib.h&gt;<br>
#include &lt;errno.h&gt;<br>
#include &lt;fcntl.h&gt;<br>
#include &lt;unistd.h&gt;<br>
#include &lt;string.h&gt;<br>
<br>
#define BUFSIZE        65536<br>
<br>
/* write 100 entries per second */<br>
#define WRITE_DELAY    1000000 / 100<br>
<br>
int open_testfile(char *testfile)<br>
{<br>
    int fd;<br>
<br>
    fd = open(testfile, O_WRONLY | O_CREAT | O_APPEND, 0666);<br>
<br>
    if (fd &lt; 0) {<br>
        perror(&quot;open&quot;);<br>
        exit(2);<br>
    }<br>
<br>
    return(fd);<br>
}<br>
<br>
void usage(char *s)<br>
{<br>
    fprintf(stderr, &quot;\nusage: %s testfile\n\n&quot;,s);<br>
}<br>
<br>
int main (int argc, char **argv)<br>
{<br>
    char buf[BUFSIZE];<br>
    int  logfd;<br>
    int  nread;<br>
    int counter = 0;<br>
<br>
<br>
    if (argc != 2) {<br>
        usage(argv[0]);<br>
        exit(1);<br>
    }<br>
<br>
    logfd = open_testfile(argv[1]);<br>
<br>
    /* loop endlessly */<br>
    for (;;) {<br>
<br>
        snprintf(buf, sizeof(buf), &quot;%d\n&quot;,counter);<br>
        nread = strnlen(buf,sizeof(buf));<br>
<br>
        /* write data */<br>
        int nwrite = write(logfd, buf, nread);<br>
<br>
        if (nwrite == nread) {<br>
            counter++;<br>
            usleep(WRITE_DELAY);<br>
        } else {<br>
            /* restarted gluster nodes give this error in 2.0.6 */<br>
            if (errno == EBADFD || errno == ENOTCONN)<br>
            {<br>
              /* wait a second before re-opening the file */<br>
              fprintf(stderr,&quot;problems writting to fd, reopening logfile (errno = %d) in one second\n&quot;,errno);<br>
              sleep(1);<br>
<br>
              /* reopen log file, and set write again flag so the data tries to get written back */<br>
              logfd = open_testfile(argv[1]);<br>
            }<br>
            else<br>
            {<br>
              perror(&quot;write&quot;);<br>
              exit(2);<br>
            }<br>
        }<br>
    }<br>
}<br>
<br>
#!/usr/bin/perl<br>
<br>
use strict;<br>
use warnings;<br>
<br>
my $i=0;<br>
<br>
while (&lt;&gt;) { die &quot;$i &lt;&gt; $_&quot; if $i++ != $_; }<br>
print STDERR &quot;OK\n&quot;;<br>
<br>
The client log file during one of the tests I ran.<br>
<br>
[2009-09-02 09:59:23] E [saved-frames.c:165:saved_frames_unwind] remote1: forced unwinding frame type(1) op(FINODELK)<br>
[2009-09-02 09:59:23] N [client-protocol.c:6246:notify] remote1: disconnected<br>
[2009-09-02 09:59:23] E [socket.c:745:socket_connect_finish] remote1: connection to <a href="http://10.0.1.31:6996" target="_blank">10.0.1.31:6996</a> failed (Connection refused)<br>
[2009-09-02 09:59:26] N [client-protocol.c:5559:client_setvolume_cbk] remote1: Connected to <a href="http://10.0.1.31:6996" target="_blank">10.0.1.31:6996</a>, attached to remote volume &#39;brick&#39;.<br>
[2009-09-02 09:59:30] E [saved-frames.c:165:saved_frames_unwind] remote2: forced unwinding frame type(1) op(WRITE)<br>
[2009-09-02 09:59:30] W [fuse-bridge.c:1534:fuse_writev_cbk] glusterfs-fuse: 153358: WRITE =&gt; -1 (Transport endpoint is not connected)<br>
[2009-09-02 09:59:30] N [client-protocol.c:6246:notify] remote2: disconnected<br>
[2009-09-02 09:59:30] E [socket.c:745:socket_connect_finish] remote2: connection to <a href="http://10.0.1.32:6996" target="_blank">10.0.1.32:6996</a> failed (Connection refused)<br>
[2009-09-02 09:59:33] N [client-protocol.c:5559:client_setvolume_cbk] remote2: Connected to <a href="http://10.0.1.32:6996" target="_blank">10.0.1.32:6996</a>, attached to remote volume &#39;brick&#39;.<br>
[2009-09-02 09:59:34] N [client-protocol.c:5559:client_setvolume_cbk] remote1: Connected to <a href="http://10.0.1.31:6996" target="_blank">10.0.1.31:6996</a>, attached to remote volume &#39;brick&#39;.<br>
[2009-09-02 09:59:37] E [saved-frames.c:165:saved_frames_unwind] remote1: forced unwinding frame type(1) op(FINODELK)<br>
[2009-09-02 09:59:37] W [fuse-bridge.c:1534:fuse_writev_cbk] glusterfs-fuse: 153923: WRITE =&gt; -1 (File descriptor in bad state)<br>
[2009-09-02 09:59:37] N [client-protocol.c:6246:notify] remote1: disconnected<br>
[2009-09-02 09:59:40] N [client-protocol.c:5559:client_setvolume_cbk] remote1: Connected to <a href="http://10.0.1.31:6996" target="_blank">10.0.1.31:6996</a>, attached to remote volume &#39;brick&#39;.<br>
[2009-09-02 09:59:41] N [client-protocol.c:5559:client_setvolume_cbk] remote2: Connected to <a href="http://10.0.1.32:6996" target="_blank">10.0.1.32:6996</a>, attached to remote volume &#39;brick&#39;.<br>
[2009-09-02 09:59:44] N [client-protocol.c:5559:client_setvolume_cbk] remote1: Connected to <a href="http://10.0.1.31:6996" target="_blank">10.0.1.31:6996</a>, attached to remote volume &#39;brick&#39;.<br>
[2009-09-02 09:59:51] W [fuse-bridge.c:882:fuse_err_cbk] glusterfs-fuse: 155106: FLUSH() ERR =&gt; -1 (File descriptor in bad state)<br>
[2009-09-02 09:59:51] W [fuse-bridge.c:882:fuse_err_cbk] glusterfs-fuse: 155108: FLUSH() ERR =&gt; -1 (File descriptor in bad state)<div><div></div><div class="h5"><br>
<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Regards,<br>
Vijay<br>
<br>
<br>
</blockquote>
<br>
<br>
<br>
_______________________________________________<br>
Gluster-devel mailing list<br>
<a href="mailto:Gluster-devel@nongnu.org" target="_blank">Gluster-devel@nongnu.org</a><br>
<a href="http://lists.nongnu.org/mailman/listinfo/gluster-devel" target="_blank">http://lists.nongnu.org/mailman/listinfo/gluster-devel</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Raghavendra G<br><br>