Thread: Re: pg_restore fails on Windows

Re: pg_restore fails on Windows

From
Tom Tom
Date:
Magnus Hagander wrote:
> Tom Lane wrote:
> > I wrote:
> >> Of course the larger issue is why it's failing --- 150MB doesn't seem
> >> like that much for a modern machine.  I suspect that PQerrorMessage()
> >> would tell us something useful, but pg_restore isn't letting us see it.
> >
> > I've applied a patch for the latter issue.  But the only way we can find
> > out what's happening is if someone will build a Windows version from CVS
> > tip for the OP...
>
> Attached is a pg_restore.exe off CVS tip today, which should include the
> patch. Please try this one.
>
> //Magnus
>

I tested the restore using the provided pg_restore.exe. The output is:

for --inserts mode:
-------------------------------
pg_restore: connecting to database for restore
Password:
pg_restore: creating SCHEMA public
pg_restore: creating COMMENT SCHEMA public
pg_restore: creating TABLE hibtableattachmentxmldata
pg_restore: restoring data for table "hibtableattachmentxmldata"
pg_restore: [archiver (db)] Error from TOC entry 1731; 0 16429 TABLE DATA hibtableattachmentxmldata postgres
pg_restore: [archiver (db)] could not execute query: could not send data to server: No buffer space available
(0x0000274
7/10055)
    Command was: INSERT INTO hibtableattachmentxmldata VALUES ('1111',
'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFF...
pg_restore: setting owner and privileges for SCHEMA public
pg_restore: setting owner and privileges for COMMENT SCHEMA public
pg_restore: setting owner and privileges for ACL public
pg_restore: setting owner and privileges for TABLE hibtableattachmentxmldata
WARNING: errors ignored on restore: 1

for COPY mode
------------------------
pg_restore: connecting to database for restore
Password:
pg_restore: creating SCHEMA public
pg_restore: creating COMMENT SCHEMA public
pg_restore: creating TABLE hibtableattachmentxmldata
pg_restore: restoring data for table "hibtableattachmentxmldata"
pg_restore: [archiver (db)] error returned by PQputCopyData: could not send data to server: No buffer space available
(0
x00002747/10055)
pg_restore: *** aborted because of error

The restore in the COPY mode was obviously aborted, whereas the --inserts finished with warnings.

Note: the provided pg_restore.exe is not compiled with the support for compressed dumps.

Regards,
Tomas

Re: Re: pg_restore fails on Windows

From
Tom Lane
Date:
=?us-ascii?Q?Tom=20Tom?= <cobold@seznam.cz> writes:
> Magnus Hagander wrote:
>> Attached is a pg_restore.exe off CVS tip today, which should include the
>> patch. Please try this one.

> I tested the restore using the provided pg_restore.exe. The output is:

> pg_restore: [archiver (db)] could not execute query: could not send data to server: No buffer space available
(0x00002747/10055)

According to
http://support.microsoft.com/kb/201213
this is an acknowledged bug that's been broken since Windows 95, so
I suppose we should conclude that M$ is unwilling or incompetent to
fix it.

Possibly the best workaround is something like

+ #ifndef WIN32
        sent = pqsecure_write(conn, ptr, len);
+ #else
+         /* Windows tends to fail on large sends, see KB 20213 */
+         sent = pqsecure_write(conn, ptr, Min(len, 65536));
+ #endif

in pqSendSome().  The backend seems to not be subject to a similar
problem because it's already filtering its output through a limited-size
buffer.

            regards, tom lane