]> granicus.if.org Git - pgbouncer/commitdiff
console: rename backend_pid to remote_pid
authorMarko Kreen <markokr@gmail.com>
Wed, 17 Apr 2013 16:07:28 +0000 (19:07 +0300)
committerMarko Kreen <markokr@gmail.com>
Wed, 17 Apr 2013 16:07:28 +0000 (19:07 +0300)
This corresponds better to current implementation,
as now client pid is also shown correctly.

doc/usage.txt
src/admin.c

index 3c53f75b989e7a3fa6c528344fa092191ee2b673..fd0942ea6fcde1e859be959312e5788a3daeeaf3 100644 (file)
@@ -231,9 +231,12 @@ ptr::
 link::
   Address of client connection the server is paired with.
 
-backend_pid::
-  Pid of backend server process.  In case the server is another PgBouncer,
-  it will be a random number associated with this connection.
+remote_pid::
+  Pid of backend server process.  In case connection is made over
+  unix socket and OS supports getting process ID info, it's
+  OS pid.  Otherwise it's extracted from cancel packet server sent,
+  which should be PID in case server is Postgres, but it's a random
+  number in case server it another PgBouncer.
 
 ==== SHOW CLIENTS; ====
 
@@ -275,9 +278,9 @@ ptr::
 link::
   Address of server connection the client is paired with.
 
-backend_pid::
-  Random number sent to client as "backend process pid".
-  Usually unique, but not quaranteed.
+remote_pid::
+  Process ID, in case client connects over UNIX socket
+  and OS supports getting it.
 
 ==== SHOW POOLS; ====
 
index ee6a999b7997de097d0fd3f226c2288a80f8a0ca..dafcfa40b6cc77c544701de2cbfa0808f6fe6c35 100644 (file)
@@ -523,7 +523,7 @@ static void socket_header(PktBuf *buf, bool debug)
                                    "type", "user", "database", "state",
                                    "addr", "port", "local_addr", "local_port",
                                    "connect_time", "request_time",
-                                   "ptr", "link", "backend_pid",
+                                   "ptr", "link", "remote_pid",
                                    "recv_pos", "pkt_pos", "pkt_remain",
                                    "send_pos", "send_remain",
                                    "pkt_avail", "send_avail");
@@ -537,7 +537,7 @@ static void adr2txt(const PgAddr *adr, char *dst, unsigned dstlen)
 static void socket_row(PktBuf *buf, PgSocket *sk, const char *state, bool debug)
 {
        int pkt_avail = 0, send_avail = 0;
-       int backend_pid;
+       int remote_pid;
        char ptrbuf[128], linkbuf[128];
        char l_addr[PGADDR_BUF], r_addr[PGADDR_BUF];
        IOBuf *io = sk->sbuf.io;
@@ -558,12 +558,12 @@ static void socket_row(PktBuf *buf, PgSocket *sk, const char *state, bool debug)
 
        /* get pid over unix socket */
        if (pga_is_unix(&sk->remote_addr))
-               backend_pid = sk->remote_addr.scred.pid;
+               remote_pid = sk->remote_addr.scred.pid;
        else
-               backend_pid = 0;
+               remote_pid = 0;
        /* if that failed, get it from cancel key */
-       if (is_server_socket(sk) && backend_pid == 0)
-               backend_pid = be32dec(sk->cancel_key);
+       if (is_server_socket(sk) && remote_pid == 0)
+               remote_pid = be32dec(sk->cancel_key);
 
        pktbuf_write_DataRow(buf, debug ? SKF_DBG : SKF_STD,
                             is_server_socket(sk) ? "S" :"C",
@@ -573,7 +573,7 @@ static void socket_row(PktBuf *buf, PgSocket *sk, const char *state, bool debug)
                             l_addr, pga_port(&sk->local_addr),
                             sk->connect_time,
                             sk->request_time,
-                            ptrbuf, linkbuf, backend_pid,
+                            ptrbuf, linkbuf, remote_pid,
                             io ? io->recv_pos : 0,
                             io ? io->parse_pos : 0,
                             sk->sbuf.pkt_remain,