pgsql-server/src/interfaces/libpgtcl pgtclCmds ... - Mailing list pgsql-committers

From momjian@postgresql.org (Bruce Momjian - CVS)
Subject pgsql-server/src/interfaces/libpgtcl pgtclCmds ...
Date
Msg-id 20020817121932.11E92475833@postgresql.org
Whole thread Raw
Responses Re: pgsql-server/src/interfaces/libpgtcl pgtclCmds ...  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-committers
CVSROOT:    /cvsroot
Module name:    pgsql-server
Changes by:    momjian@postgresql.org    02/08/17 08:19:32

Modified files:
    src/interfaces/libpgtcl: pgtclCmds.c pgtclId.c pgtclId.h

Log message:
    What I have done for libpgtcl:
    Everytime if I do PQconsumeInput (when the backend channel gets
    readable) I check for the return value. (0 == error) and generate a
    notification manually, e.g. fixed string connection_closed) and pass it to the
    TCL event queue. The only other thing I had to do is to comment out removing
    all pending events in PgStopNotifyEventSource whenever the connection was
    unexpectedly closed (so the manually generated event will not be deleted).

    A broken backend connection triggers a notify event to the client (fixed
    notification string "connection_closed") so proper action can be taken to switch
    to another database server etc. Remember that this is event driven. If you have
    applications, that have idle database connections most of the time, you'll get
    immediate feedback of a dying server. Upon connection to the server issue a
    pg_notify for notify event "connection_closed" and whenever the backend crashes
    (which it does do in very very rare cases) you get an event driven recovery. (of
    course the Tcl-Event loop has to be processed). Issuing a notification
    "connection_closed" on a still working database could be used for switching to
    another db-server (which I've actually impelemented right now).

    Gerhard Hintermayer


pgsql-committers by date:

Previous
From: momjian@postgresql.org (Bruce Momjian - CVS)
Date:
Subject: pgsql-server/ oc/src/sgml/ref/set_constraints. ...
Next
From: momjian@postgresql.org (Bruce Momjian - CVS)
Date:
Subject: pgsql-server/ oc/src/sgml/libpq.sgml rc/interf ...