BUG #7914: pg_dump aborts occasionally

Поиск
Список
Период
Сортировка
От s-morita@beingcorp.co.jp
Тема BUG #7914: pg_dump aborts occasionally
Дата
Msg-id E1UCTUD-0000L3-C1@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #7914: pg_dump aborts occasionally  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
The following bug has been logged on the website:

Bug reference:      7914
Logged by:          Shin-ichi MORITA
Email address:      s-morita@beingcorp.co.jp
PostgreSQL version: 8.4.16
Operating system:   Windows Server 2012
Description:        =


Hi great team,

I encountered a strange error during pg_dump as below:
----
pg_dump: Dumping the contents of table "t_file_data" failed: PQgetCopyData()
failed.
pg_dump: Error message from server: lost synchronization with server: got
message type "d", length 21861
pg_dump: The command was: COPY public.t_file_data (c_file_info_id,
c_page_no, c_data) TO stdout;
pg_dump: *** aborted because of error
----

It seems that large tables tend to cause this to happen.

In order to figure out what happens, I looked into
src/interfaces/libpq/fe-protocol3.c.
Then I have found that it is possible that PGconn::inBuffer is
unintentionally enlarging during execution of getCopyDataMessage().

Please look at fe-protocol3.c:1432:
1425: avail =3D conn->inEnd - conn->inCursor;
1426: if (avail < msgLength - 4)
1427: {
    :
1432:      if (pqCheckInBufferSpace(conn->inCursor + (size_t) msgLength -
4,

When several messages have been already proccessed and avail < msgLength -
4,
inBuffer will be enlarged without left-justification.

I think that pqCheckInBufferSpace() should be called only when inBuffer is
left-justified like this:
1432:      if (conn->inStart =3D=3D 0 && pqCheckInBufferSpace(conn->inCurso=
r +
(size_t) msgLength - 4,

When inBuffer was not left-justified at that moment, the line 1432 will be
executed again after inBuffer is left-justified in pqReadData() called by
pqGetCopyData3().

Please check this out.
Sorry if I have mistaken.

Note that I did not consider the async case.

Thanks and best regards,

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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: BUG #7913: TO_CHAR Function & Turkish collate
Следующее
От:
Дата:
Сообщение: Re: Excessive space allocations in Postgresql 9.1.6 system files causing the file system to run out of space.