Branch: Tag:

2014-11-18

2014-11-18 20:19:11 by Stephen R. van den Berg <srb@cuci.nl>

pgsql: Improve debugging output.

650:    _msgsreceived++;    _bytesreceived+=1+msglen;    int errtype=NOERROR; -  PD("%d",ci->socket->query_fd()); +  PD("%d>",ci->socket->query_fd());    switch(msgtype) {    array(mapping) getcols() {    int bintext=ci->read_int8();
687:    return msgresponse;    };    case 'R': { -  PD("<Authentication "); +  PD("Authentication ");    string sendpass;    int authtype;    msglen-=4+4;
769:    msglen-=4+4;backendpid=ci->read_int32();    cancelsecret=ci->read(msglen);   #ifdef PG_DEBUG -  PD("<BackendKeyData %O\n",cancelsecret); +  PD("BackendKeyData %O\n",cancelsecret);    msglen=0;   #endif    break;    case 'S': { -  PD("<ParameterStatus "); +  PD("ParameterStatus ");    msglen-=4;    array(string) ts=reads();   #ifdef PG_DEBUG
790:    }    case '3':   #ifdef PG_DEBUG -  PD("<CloseComplete\n"); +  PD("CloseComplete\n");    msglen-=4;   #endif    break;
798: Inside #if defined(PG_DEBUG)
   backendstatus=ci->read_int8();   #ifdef PG_DEBUG    msglen-=4+1; -  PD("<ReadyForQuery %c\n",backendstatus); +  PD("ReadyForQuery %c\n",backendstatus);   #endif    for(;objectp(portal);portal=qportals->read()) {   #ifdef PG_DEBUG
822:    break;    case '1':   #ifdef PG_DEBUG -  PD("<ParseComplete\n"); +  PD("ParseComplete\n");    msglen-=4;   #endif    break;
830:    array a;    int cols=ci->read_int16();   #ifdef PG_DEBUG -  PD("<%O ParameterDescription %d values\n",portal._query,cols); +  PD("%O ParameterDescription %d values\n",portal._query,cols);    msglen-=4+2+4*cols;   #endif    foreach(a=allocate(cols);int i;)
847: Inside #if defined(PG_DEBUG)
   array a;   #ifdef PG_DEBUG    int cols=ci->read_int16(); -  PD("<RowDescription %d columns %O\n",cols,portal._query); +  PD("RowDescription %d columns %O\n",cols,portal._query);    msglen-=4+2;    foreach(a=allocate(cols);int i;)   #else
894: Inside #if defined(PG_DEBUG)
   case 'n': {   #ifdef PG_DEBUG    msglen-=4; -  PD("<NoData %O\n",portal._query); +  PD("NoData %O\n",portal._query);   #endif    portal._fetchlimit=0; // disables subsequent Executes    portal->_processrowdesc(({}));
903:    }    case 'H':    portal->_processrowdesc(getcols()); -  PD("<CopyOutResponse %O\n",portal._query); +  PD("CopyOutResponse %O\n",portal._query);    break;    case '2': {    mapping tp;   #ifdef PG_DEBUG    msglen-=4; -  PD("<%O BindComplete\n",portal._portalname); +  PD("%O BindComplete\n",portal._portalname);   #endif    if(tp=portal._tprepared) {    int tend=gethrtime();
935: Inside #if defined(PG_DEBUG)
   msglen-=4;   #ifdef PG_DEBUG   #ifdef PG_DEBUGMORE -  PD("<%O DataRow %d bytes\n",portal._portalname,msglen); +  PD("%O DataRow %d bytes\n",portal._portalname,msglen);   #endif    datarowdebugcount++;    if(!datarowdebug)    datarowdebug=sprintf( -  "<%O DataRow %d bytes",portal._portalname,msglen); +  "%O DataRow %d bytes",portal._portalname,msglen);   #endif   #ifdef PG_DEBUG    msglen=
949:    break;    case 's':   #ifdef PG_DEBUG -  PD("<%O PortalSuspended\n",portal._portalname); +  PD("%O PortalSuspended\n",portal._portalname);    msglen-=4;   #endif    portal=0;
962:   #endif    string s=ci->read(msglen-1);    portal->_storetiming(); -  PD("<%O CommandComplete %O\n",portal._portalname,s); +  PD("%O CommandComplete %O\n",portal._portalname,s);   #ifdef PG_DEBUG    if(ci->read_int8())    errtype=PROTOCOLERROR;
976:    }    case 'I':   #ifdef PG_DEBUG -  PD("<EmptyQueryResponse %O\n",portal._portalname); +  PD("EmptyQueryResponse %O\n",portal._portalname);    msglen-=4;   #endif    portal->_releasesession();    portal=0;    break;    case 'd': -  PD("<%O CopyData\n",portal._portalname); +  PD("%O CopyData\n",portal._portalname);    portal->_storetiming();    msglen-=4;   #ifdef PG_DEBUG
997:    break;    case 'G':    portal->_setrowdesc(getcols()); -  PD("<%O CopyInResponse\n",portal._portalname); +  PD("%O CopyInResponse\n",portal._portalname);    portal._state=COPYINPROGRESS;    {    Thread.MutexKey resultlock=portal._resultmux->lock();
1007:    break;    case 'c':   #ifdef PG_DEBUG -  PD("<%O CopyDone\n",portal._portalname); +  PD("%O CopyDone\n",portal._portalname);    msglen-=4;   #endif    portal=0;
1015:    case 'E': {    if(!_readyforquerycount)    sendsync(); -  PD("<%O ErrorResponse %O\n", +  PD("%O ErrorResponse %O\n",    objectp(portal)&&(portal._portalname||portal._preparedname),    objectp(portal)&&portal._query);    mapping(string:string) msgresponse;
1059:    break;    }    case 'N': { -  PD("<NoticeResponse\n"); +  PD("NoticeResponse\n");    mapping(string:string) msgresponse;    msgresponse=getresponse();    if(clearmessage) {
1073:    break;    }    case 'A': { -  PD("<NotificationResponse\n"); +  PD("NotificationResponse\n");    msglen-=4+4;    int pid=ci->read_int32();    string condition,extrainfo=UNDEFINED;