Re: BUG #7914: pg_dump aborts occasionally - Mailing list pgsql-bugs

From Shin-ichi MORITA
Subject Re: BUG #7914: pg_dump aborts occasionally
Date
Msg-id D21BF31C50304BEEB86E10C12ED7E1FE@25a038note
Whole thread Raw
In response to Re: BUG #7914: pg_dump aborts occasionally  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #7914: pg_dump aborts occasionally
List pgsql-bugs
>>> Hm.  Can you create a reproducible test case for this?
>> I think this issue happens when pg_dump is slower than the backend
>> for some reason.
>
> If so, perhaps injecting a sleep() delay into the right place in pg_dump
> or libpq would make it reproducible?  I wouldn't have any problem
> crediting a test with such modified code as being a valid test.

I think it's a good idea.
Although I can not confirm this by actually modifying the code right now,
somewhere in the loop calling PQgetCopyData() in pg_dump.c would be good.

pg_dump.c:
1348: for (;;)
1349: {
1350:     ret = PQgetCopyData(conn, ©buf, 0);
1351:
1352:     if (ret < 0)
1353:         break;              /* done or error */
1354:
1355:     if (copybuf)
1356:     {
1357:         WriteData(fout, copybuf, ret);
1358:         PQfreemem(copybuf);
1359:     }
          sleep(1); /* maybe */

An alternative way would be running pg_dump with a lower priority.
Actually, I can reproduce this issue by setting the priority of
pg_dump to Low using Windows Task Manager
on the "single processor" environment.

Regards,
Shin-ichi MORITA

pgsql-bugs by date:

Previous
From: kovaral@gmail.com
Date:
Subject: BUG #7921: Problem while initializing db..initdb could not create directory..
Next
From: Kevin Grittner
Date:
Subject: Re: BUG #7918: limitation of pagination with LIMIT and OFFSET