You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2019/08/05 08:36:29 UTC

[GitHub] [incubator-shardingsphere] wwanix commented on issue #2807: sharding-proxy seemed not work well when C language based on API of libpq.so

wwanix commented on issue #2807: sharding-proxy seemed not work well when C language based on API of libpq.so
URL: https://github.com/apache/incubator-shardingsphere/issues/2807#issuecomment-518140891
 
 
   @tuohai666 My applogize. I use strace to track the data packages not tcpdump. Here are the command and output.
   1. When connect to postgresql directly.
   strace -x -e read=3 -e write=3 -e trace=network dbtest ecifpub ecifpub ecifpub@127.0.0.1:12341 
   URL=[host=127.0.0.1 port=12341 dbname=ecifpub user=ecifpub password=ecifpub]
   socket(AF_INET, SOCK_STREAM, IPPROTO_IP) = 3
   setsockopt(3, SOL_TCP, TCP_NODELAY, [1], 4) = 0
   setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
   connect(3, {sa_family=AF_INET, sin_port=htons(12341), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress)
   getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
   getsockname(3, {sa_family=AF_INET, sin_port=htons(2714), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
   sendto(3, "\x00\x00\x00\x08\x04\xd2\x16\x2f", 8, MSG_NOSIGNAL, NULL, 0) = 8
    | 00000  00 00 00 08 04 d2 16 2f                           ......./         |
   recvfrom(3, "N", 16384, 0, NULL, NULL)  = 1
    | 00000  4e                                                N                |
   sendto(3, "\x00\x00\x00\x27\x00\x03\x00\x00\x75\x73\x65\x72\x00\x65\x63\x69\x66\x70\x75\x62\x00\x64\x61\x74\x61\x62\x61\x73\x65\x00\x65\x63"..., 39, MSG_NOSIGNAL, NULL, 0) = 39
    | 00000  00 00 00 27 00 03 00 00  75 73 65 72 00 65 63 69  ...'....user.eci |
    | 00010  66 70 75 62 00 64 61 74  61 62 61 73 65 00 65 63  fpub.database.ec |
    | 00020  69 66 70 75 62 00 00                              ifpub..          |
   recvfrom(3, "\x52\x00\x00\x00\x08\x00\x00\x00\x00\x53\x00\x00\x00\x16\x61\x70\x70\x6c\x69\x63\x61\x74\x69\x6f\x6e\x5f\x6e\x61\x6d\x65\x00\x00"..., 16384, 0, NULL, NULL) = 331
    | 00000  52 00 00 00 08 00 00 00  00 53 00 00 00 16 61 70  R........S....ap |
    | 00010  70 6c 69 63 61 74 69 6f  6e 5f 6e 61 6d 65 00 00  plication_name.. |
    | 00020  53 00 00 00 1b 63 6c 69  65 6e 74 5f 65 6e 63 6f  S....client_enco |
    | 00030  64 69 6e 67 00 45 55 43  5f 43 4e 00 53 00 00 00  ding.EUC_CN.S... |
    | 00040  17 44 61 74 65 53 74 79  6c 65 00 49 53 4f 2c 20  .DateStyle.ISO,  |
    | 00050  4d 44 59 00 53 00 00 00  19 69 6e 74 65 67 65 72  MDY.S....integer |
    | 00060  5f 64 61 74 65 74 69 6d  65 73 00 6f 6e 00 53 00  _datetimes.on.S. |
    | 00070  00 00 1b 49 6e 74 65 72  76 61 6c 53 74 79 6c 65  ...IntervalStyle |
    | 00080  00 70 6f 73 74 67 72 65  73 00 53 00 00 00 15 69  .postgres.S....i |
    | 00090  73 5f 73 75 70 65 72 75  73 65 72 00 6f 66 66 00  s_superuser.off. |
    | 000a0  53 00 00 00 1b 73 65 72  76 65 72 5f 65 6e 63 6f  S....server_enco |
    | 000b0  64 69 6e 67 00 45 55 43  5f 43 4e 00 53 00 00 00  ding.EUC_CN.S... |
    | 000c0  18 73 65 72 76 65 72 5f  76 65 72 73 69 6f 6e 00  .server_version. |
    | 000d0  31 30 2e 39 00 53 00 00  00 22 73 65 73 73 69 6f  10.9.S..."sessio |
    | 000e0  6e 5f 61 75 74 68 6f 72  69 7a 61 74 69 6f 6e 00  n_authorization. |
    | 000f0  65 63 69 66 70 75 62 00  53 00 00 00 23 73 74 61  ecifpub.S...#sta |
    | 00100  6e 64 61 72 64 5f 63 6f  6e 66 6f 72 6d 69 6e 67  ndard_conforming |
    | 00110  5f 73 74 72 69 6e 67 73  00 6f 6e 00 53 00 00 00  _strings.on.S... |
    | 00120  1b 54 69 6d 65 5a 6f 6e  65 00 41 73 69 61 2f 53  .TimeZone.Asia/S |
    | 00130  68 61 6e 67 68 61 69 00  4b 00 00 00 0c 00 00 46  hanghai.K......F |
    | 00140  c7 ee 98 60 12 5a 00 00  00 05 49                 ...`.Z....I      |
   sendto(3, "\x50\x00\x00\x00\x43\x00\x73\x65\x6c\x65\x63\x74\x20\x74\x72\x61\x6e\x73\x5f\x69\x64\x20\x66\x72\x6f\x6d\x20\x63\x66\x67\x5f\x74"..., 73, MSG_NOSIGNAL, NULL, 0) = 73
    | 00000  50 00 00 00 43 00 73 65  6c 65 63 74 20 74 72 61  P...C.select tra |
    | 00010  6e 73 5f 69 64 20 66 72  6f 6d 20 63 66 67 5f 74  ns_id from cfg_t |
    | 00020  72 61 6e 73 5f 61 63 63  65 73 73 20 77 68 65 72  rans_access wher |
    | 00030  65 20 74 72 61 6e 73 5f  69 64 3d 27 50 30 30 39  e trans_id='P009 |
    | 00040  27 00 00 00 53 00 00 00  04                       '...S....        |
   recvfrom(3, "\x31\x00\x00\x00\x04\x5a\x00\x00\x00\x05\x49", 16384, 0, NULL, NULL) = 11
    | 00000  31 00 00 00 04 5a 00 00  00 05 49                 1....Z....I      |
   sendto(3, "\x42\x00\x00\x00\x0e\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x44\x00\x00\x00\x06\x50\x00\x45\x00\x00\x00\x09\x00\x00\x00\x00\x00"..., 37, MSG_NOSIGNAL, NULL, 0) = 37
    | 00000  42 00 00 00 0e 00 00 00  00 00 00 00 01 00 00 44  B..............D |
    | 00010  00 00 00 06 50 00 45 00  00 00 09 00 00 00 00 00  ....P.E......... |
    | 00020  53 00 00 00 04                                    S....            |
   recvfrom(3, "\x32\x00\x00\x00\x04\x54\x00\x00\x00\x21\x00\x01\x74\x72\x61\x6e\x73\x5f\x69\x64\x00\x00\x00\x40\x08\x00\x02\x00\x00\x04\x13\xff"..., 16384, 0, NULL, NULL) = 360
    | 00000  32 00 00 00 04 54 00 00  00 21 00 01 74 72 61 6e  2....T...!..tran |
    | 00010  73 5f 69 64 00 00 00 40  08 00 02 00 00 04 13 ff  s_id...@........ |
    | 00020  ff 00 00 00 12 00 00 44  00 00 00 0e 00 01 00 00  .......D........ |
    | 00030  00 04 50 30 30 39 44 00  00 00 0e 00 01 00 00 00  ..P009D......... |
    | 00040  04 50 30 30 39 44 00 00  00 0e 00 01 00 00 00 04  .P009D.......... |
    | 00050  50 30 30 39 44 00 00 00  0e 00 01 00 00 00 04 50  P009D..........P |
    | 00060  30 30 39 44 00 00 00 0e  00 01 00 00 00 04 50 30  009D..........P0 |
    | 00070  30 39 44 00 00 00 0e 00  01 00 00 00 04 50 30 30  09D..........P00 |
    | 00080  39 44 00 00 00 0e 00 01  00 00 00 04 50 30 30 39  9D..........P009 |
    | 00090  44 00 00 00 0e 00 01 00  00 00 04 50 30 30 39 44  D..........P009D |
    | 000a0  00 00 00 0e 00 01 00 00  00 04 50 30 30 39 44 00  ..........P009D. |
    | 000b0  00 00 0e 00 01 00 00 00  04 50 30 30 39 44 00 00  .........P009D.. |
    | 000c0  00 0e 00 01 00 00 00 04  50 30 30 39 44 00 00 00  ........P009D... |
    | 000d0  0e 00 01 00 00 00 04 50  30 30 39 44 00 00 00 0e  .......P009D.... |
    | 000e0  00 01 00 00 00 04 50 30  30 39 44 00 00 00 0e 00  ......P009D..... |
    | 000f0  01 00 00 00 04 50 30 30  39 44 00 00 00 0e 00 01  .....P009D...... |
    | 00100  00 00 00 04 50 30 30 39  44 00 00 00 0e 00 01 00  ....P009D....... |
    | 00110  00 00 04 50 30 30 39 44  00 00 00 0e 00 01 00 00  ...P009D........ |
    | 00120  00 04 50 30 30 39 44 00  00 00 0e 00 01 00 00 00  ..P009D......... |
    | 00130  04 50 30 30 39 44 00 00  00 0e 00 01 00 00 00 04  .P009D.......... |
    | 00140  50 30 30 39 44 00 00 00  0e 00 01 00 00 00 04 50  P009D..........P |
    | 00150  30 30 39 43 00 00 00 0e  53 45 4c 45 43 54 20 32  009C....SELECT 2 |
    | 00160  30 00 5a 00 00 00 05 49                           0.Z....I         |
   20 rows affected.
   sendto(3, "\x58\x00\x00\x00\x04", 5, MSG_NOSIGNAL, NULL, 0) = 5
    | 00000  58 00 00 00 04                                    X....            |
   +++ exited with 0 +++
   
   2. When connect to sharding-proxy.
   strace -x -e read=3 -e write=3 -e trace=network dbtest ecifpub ecifpub sharding_db@127.0.0.1:3307 
   URL=[host=127.0.0.1 port=3307 dbname=sharding_db user=ecifpub password=ecifpub]
   socket(AF_INET, SOCK_STREAM, IPPROTO_IP) = 3
   setsockopt(3, SOL_TCP, TCP_NODELAY, [1], 4) = 0
   setsockopt(3, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
   connect(3, {sa_family=AF_INET, sin_port=htons(3307), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress)
   getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
   getsockname(3, {sa_family=AF_INET, sin_port=htons(43109), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0
   sendto(3, "\x00\x00\x00\x08\x04\xd2\x16\x2f", 8, MSG_NOSIGNAL, NULL, 0) = 8
    | 00000  00 00 00 08 04 d2 16 2f                           ......./         |
   recvfrom(3, "N", 16384, 0, NULL, NULL)  = 1
    | 00000  4e                                                N                |
   sendto(3, "\x00\x00\x00\x2b\x00\x03\x00\x00\x75\x73\x65\x72\x00\x65\x63\x69\x66\x70\x75\x62\x00\x64\x61\x74\x61\x62\x61\x73\x65\x00\x73\x68"..., 43, MSG_NOSIGNAL, NULL, 0) = 43
    | 00000  00 00 00 2b 00 03 00 00  75 73 65 72 00 65 63 69  ...+....user.eci |
    | 00010  66 70 75 62 00 64 61 74  61 62 61 73 65 00 73 68  fpub.database.sh |
    | 00020  61 72 64 69 6e 67 5f 64  62 00 00                 arding_db..      |
   recvfrom(3, "\x52\x00\x00\x00\x08\x00\x00\x00\x00\x53\x00\x00\x00\x17\x73\x65\x72\x76\x65\x72\x5f\x76\x65\x72\x73\x69\x6f\x6e\x00\x38\x2e\x34"..., 16384, 0, NULL, NULL) = 91
    | 00000  52 00 00 00 08 00 00 00  00 53 00 00 00 17 73 65  R........S....se |
    | 00010  72 76 65 72 5f 76 65 72  73 69 6f 6e 00 38 2e 34  rver_version.8.4 |
    | 00020  00 53 00 00 00 19 63 6c  69 65 6e 74 5f 65 6e 63  .S....client_enc |
    | 00030  6f 64 69 6e 67 00 55 54  46 38 00 53 00 00 00 19  oding.UTF8.S.... |
    | 00040  73 65 72 76 65 72 5f 65  6e 63 6f 64 69 6e 67 00  server_encoding. |
    | 00050  55 54 46 38 00 5a 00 00  00 05 49                 UTF8.Z....I      |
   sendto(3, "\x50\x00\x00\x00\x43\x00\x73\x65\x6c\x65\x63\x74\x20\x74\x72\x61\x6e\x73\x5f\x69\x64\x20\x66\x72\x6f\x6d\x20\x63\x66\x67\x5f\x74"..., 73, MSG_NOSIGNAL, NULL, 0) = 73
    | 00000  50 00 00 00 43 00 73 65  6c 65 63 74 20 74 72 61  P...C.select tra |
    | 00010  6e 73 5f 69 64 20 66 72  6f 6d 20 63 66 67 5f 74  ns_id from cfg_t |
    | 00020  72 61 6e 73 5f 61 63 63  65 73 73 20 77 68 65 72  rans_access wher |
    | 00030  65 20 74 72 61 6e 73 5f  69 64 3d 27 50 30 30 39  e trans_id='P009 |
    | 00040  27 00 00 00 53 00 00 00  04                       '...S....        |
   
   Then it hangs here.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services