<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jul 25, 2015 at 5:12 AM, chris holcombe <span dir="ltr">&lt;<a href="mailto:chris.holcombe@canonical.com" target="_blank">chris.holcombe@canonical.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hey Everyone!<br>
<br>
I&#39;m having trouble figuring out how the RPC mechanism works in Gluster.  Any help would be hugely appreciated!<br>
When a client makes a request from the glusterd service an xdr encoded rpc is sent to it.  From what I&#39;m gathering by looking at the source and GDB the main struct to be concerned with is:<br>
<br>
struct rpc_transport_req {<br>
        rpc_transport_msg_t  msg;<br>
        rpc_transport_rsp_t  rsp;<br>
        struct rpc_req      *rpc_req;<br>
};<br>
<br>
>From tracing it down to writev I see that the data looks as follows before being written out:<br>
<br>
(gdb) p req<br>
$4 = {msg = {rpchdr = 0x7ffff36c7c00, rpchdrcount = 1, proghdr = 0x7ffff36c7d20,<br>
    proghdrcount = 1, progpayload = 0x0, progpayloadcount = 0, iobref = 0x7fffe4000920}, rsp = {<br>
    rsphdr = 0x0, rsphdr_count = 0, rsp_payload = 0x0, rsp_payload_count = 0, rsp_iobref = 0x0},<br>
  rpc_req = 0x555555802dac}<br>
<br>
I&#39;m having trouble figuring out if this req variable is actually what is being written out to the wire.<br>
<br>
Now on the reply side the first header is the length of the reply. That makes sense.  What I&#39;m not getting is if the rpc_transport_req is actually being serialized with xdr or are parts of it being serialized?  It&#39;s hard to tell.  I need to read the __socket_proto_state_machine over again and understand it better.  I searched around for notes or anything online and there&#39;s really almost zero written about this.<br>
<br>
So my questions are:<br>
1. Is the rpc_transport_req being xdr encoded onto the wire?<br></blockquote><div><br></div><div>No, its the contents of rpc_transport_msg_t (req-&gt;msg, defined in rpc-transport.h) which is written onto the wire. For more details look into functions __socket_ioq_new and __socket_ioq_churn_entry (both defined in ./rpc/rpc-transport/socket/src/socket.c).<br><br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
2. Are there any good materials out there that explain the protocol?  Figuring it out by reading the source and break pointing the code is slow going.  Esp with the epoll threads making tracking things down hard.<br></blockquote><div><br></div><div>Our rpc implementation is based on RFC 5531 [1]. To get an high level flow, you can look at socket_submit_request and socket_submit_reply and keep following the control flow.<br><br>[1] <a href="https://tools.ietf.org/html/rfc5531">https://tools.ietf.org/html/rfc5531</a><br><br></div><div>regards,<br></div><div>Raghavendra.<br><br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
Thanks for the help!<br>
-Chris<br>
_______________________________________________<br>
Gluster-devel mailing list<br>
<a href="mailto:Gluster-devel@gluster.org" target="_blank">Gluster-devel@gluster.org</a><br>
<a href="http://www.gluster.org/mailman/listinfo/gluster-devel" rel="noreferrer" target="_blank">http://www.gluster.org/mailman/listinfo/gluster-devel</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Raghavendra G<br></div>
</div></div>