[Pgpool-general] serever messages (DEBUG send/recv) when executing pcp_node_info differs on Linux and HP-UX

Sandeep Thakkar sandeeptt at yahoo.com
Thu Sep 8 11:49:03 UTC 2011


Thanks for the explanation Tatsuo!

 
Sandeep.


________________________________
From: Tatsuo Ishii <ishii at sraoss.co.jp>
To: sandeeptt at yahoo.com
Cc: pgpool-general at pgfoundry.org
Sent: Thursday, September 8, 2011 10:44 AM
Subject: Re: [Pgpool-general] serever messages (DEBUG send/recv) when executing pcp_node_info differs on Linux and HP-UX

> I'm using pgpool-II 3.0.3 and found that there is a small variation in the server response on Linux and HP-UX. Here it is:
> 
> $pcp_node_info  -d 20 localhost 9898 edb edb 2
> 
> Linux:
> DEBUG: send: tos="R", len=41
>   DEBUG: recv: tos="r", len=21, data=AuthenticationOK
>   DEBUG: send: tos="I", len=6
> ! DEBUG: recv: tos="i", len=54, data=CommandComplete DEBUG: send: tos="X", len=4 localhost 5446 3 0.333333
> 
> HPUX:
> DEBUG: send: tos="R", len=41
>   DEBUG: recv: tos="r", len=21, data=AuthenticationOK
>   DEBUG: send: tos="I", len=6
> ! DEBUG: recv: tos="i", len=50, data=CommandComplete DEBUG: send: tos="X", len=4 localhost 5446 3 0.333333
> 
> What is "tos" here means? and why the length on line 4 differs in both the cases?Not sure if this is something basic and I should be aware of it :)
> 
> Thanks.

"tos" is a 1 byte character indicating what the pcp command is. For
example, "I" indicates pcp client(in this case pcp_node_info command)
requests info to pcp server(which is running on 9898 port by
default). "i" indicates pcp server sends back the requested info to
pcp client.

The difference between 54 vs. 50 is interesting. In pcp_child.c around line 375:

                    snprintf(port_str, sizeof(port_str), "%d", bi->backend_port);
                    snprintf(status, sizeof(status), "%d", bi->backend_status);
                    snprintf(weight_str, sizeof(weight_str), "%f", bi->backend_weight);

                    pcp_write(frontend, "i", 1);
                    wsize = htonl(sizeof(code) +
                                  strlen(bi->backend_hostname)+1 +
                                  strlen(port_str)+1 +
                                  strlen(status)+1 +
                                  strlen(weight_str)+1 +
                                  sizeof(int));
                    pcp_write(frontend, &wsize, sizeof(int));
                    pcp_write(frontend, code, sizeof(code));
                    pcp_write(frontend, bi->backend_hostname, strlen(bi->backend_hostname)+1);
                    pcp_write(frontend, port_str, strlen(port_str)+1);
                    pcp_write(frontend, status, strlen(status)+1);
                    pcp_write(frontend, weight_str, strlen(weight_str)+1);

I think this one could create different length of string among platforms:

                    snprintf(weight_str, sizeof(weight_str), "%f", bi->backend_weight);

Just a guess though.
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://pgfoundry.org/pipermail/pgpool-general/attachments/20110908/0976456f/attachment.html>


More information about the Pgpool-general mailing list