pgsql/src/interfaces/libpq fe-exec.c fe-misc.c ...

Поиск
Список
Период
Сортировка
От momjian@postgresql.org (Bruce Momjian - CVS)
Тема pgsql/src/interfaces/libpq fe-exec.c fe-misc.c ...
Дата
Msg-id 20020305052013.AEB7147598E@postgresql.org
обсуждение исходный текст
Список pgsql-committers
CVSROOT:    /cvsroot
Module name:    pgsql
Changes by:    momjian@postgresql.org    02/03/05 00:20:13

Modified files:
    src/interfaces/libpq: fe-exec.c fe-misc.c libpq-fe.h libpq-int.h

Log message:
    Here's a patch against 7.1.3 that fixes a problem with sending larger
    queries over non-blocking connections with libpq. "Larger" here
    basically means that it doesn't fit into the output buffer.

    The basic strategy is to fix pqFlush and pqPutBytes.

    The problem with pqFlush as it stands now is that it returns EOF when an
    error occurs or when not all data could be sent. The latter case is
    clearly not an error for a non-blocking connection but the caller can't
    distringuish it from an error very well.

    The first part of the fix is therefore to fix pqFlush. This is done by
    to renaming it to pqSendSome which only differs from pqFlush in its
    return values to allow the caller to make the above distinction and a
    new pqFlush which is implemented in terms of pqSendSome and behaves
    exactly like the old pqFlush.

    The second part of the fix modifies pqPutBytes to use pqSendSome instead
    of pqFlush and to either send all the data or if not all data can be
    sent on a non-blocking connection to at least put all data into the
    output buffer, enlarging it if necessary. The callers of pqPutBytes
    don't have to be changed because from their point of view pqPutBytes
    behaves like before. It either succeeds in queueing all output data or
    fails with an error.

    I've also added a new API function PQsendSome which analogously to
    PQflush just calls pqSendSome. Programs using non-blocking queries
    should use this new function. The main difference is that this function
    will have to be called repeatedly (calling select() properly in between)
    until all data has been written.

    AFAICT, the code in CVS HEAD hasn't changed with respect to non-blocking
    queries and this fix should work there, too, but I haven't tested that
    yet.

    Bernhard Herzog


В списке pgsql-committers по дате отправления:

Предыдущее
От: tgl@postgresql.org (Tom Lane)
Дата:
Сообщение: pgsql/src/backend/optimizer/prep Tag: REL7_2_S ...
Следующее
От: momjian@postgresql.org (Bruce Momjian - CVS)
Дата:
Сообщение: pgsql/src/backend/access gist/gist.c gist/gist ...