473,404 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

pg_restore and large files

Hello,

I am currently using PostgreSQL v7.3.4 on a RedHat 8.0 system (2.4.23 kernel)
using the ext3 filesystem. I am experiencing problems when performing a
pg_restore using a file which is 2.3G in size. The dump, which seemed to run
smoothly, was created using the -Fc option. When I perform the restore, the
following error occurs before the pg_restore fails:

pg_restore: [custom archiver] error during file seek: Invalid argument
pg_restore: *** aborted because of error

Why is this happening? The error comes from pg_backup_custom.c, it seems that
an fseeko() is failing (even though this is the way to support large files). It
is my understanding that ext3 supports file sizes up to 1T. The restore worked
fine when the database was smaller. Any ideas?

Thanks,

Mike Charnoky
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 22 '05 #1
6 4931
Mike Charnoky <no**@nextbus.com> writes:
I am currently using PostgreSQL v7.3.4 on a RedHat 8.0 system (2.4.23 kernel)
using the ext3 filesystem. I am experiencing problems when performing a
pg_restore using a file which is 2.3G in size. The dump, which seemed to run
smoothly, was created using the -Fc option. When I perform the restore, the
following error occurs before the pg_restore fails: pg_restore: [custom archiver] error during file seek: Invalid argument
pg_restore: *** aborted because of error Why is this happening? The error comes from pg_backup_custom.c, it seems that
an fseeko() is failing (even though this is the way to support large
files).


Hm, can you insert some debugging printout to show the offset value
being passed to fseeko? That would let us eliminate one of pg_restore
and the kernel as being at fault. Another thing that'd be useful is to
run pg_restore under gdb with a breakpoint set at die_horribly, so that
you could get a stack trace from the point of the failure.

I am suspicious that it's a pg_restore bug and the problem has to do
with manipulating file offsets as plain integers someplace. Not enough
info yet to go searching, though.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 22 '05 #2
OK, I ran with gdb and here's what I got:

Breakpoint 1, _PrintTocData (AH=0x8058fc0, te=0x8086548, ropt=0x8058ee8)
at pg_backup_custom.c:471
471 if (fseeko(AH->FH, tctx->dataPos, SEEK_SET) != 0)
(gdb) backtrace
#0 _PrintTocData (AH=0x8058fc0, te=0x8086548, ropt=0x8058ee8)
at pg_backup_custom.c:471
#1 0x0804a98b in RestoreArchive (AHX=0x8058fc0, ropt=0x8058ee8)
at pg_backup_archiver.c:336
#2 0x0804a03e in main (argc=10, argv=0xbffff924) at pg_restore.c:366
#3 0x42015967 in __libc_start_main () from /lib/i686/libc.so.6
(gdb) display tctx->dataPos
2: tctx->dataPos = 1785996817

BTW, the file size is: 2361910772 bytes
Mike Charnoky

Tom Lane wrote:
Mike Charnoky <no**@nextbus.com> writes:
I am currently using PostgreSQL v7.3.4 on a RedHat 8.0 system (2.4.23 kernel)
using the ext3 filesystem. I am experiencing problems when performing a
pg_restore using a file which is 2.3G in size. The dump, which seemed to run
smoothly, was created using the -Fc option. When I perform the restore, the
following error occurs before the pg_restore fails:


pg_restore: [custom archiver] error during file seek: Invalid argument
pg_restore: *** aborted because of error


Why is this happening? The error comes from pg_backup_custom.c, it seems that
an fseeko() is failing (even though this is the way to support large
files).

Hm, can you insert some debugging printout to show the offset value
being passed to fseeko? That would let us eliminate one of pg_restore
and the kernel as being at fault. Another thing that'd be useful is to
run pg_restore under gdb with a breakpoint set at die_horribly, so that
you could get a stack trace from the point of the failure.

I am suspicious that it's a pg_restore bug and the problem has to do
with manipulating file offsets as plain integers someplace. Not enough
info yet to go searching, though.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 22 '05 #3
Whoops, forget that last post. Here's the real data from gdb at the point prior
to failure of pg_restore:

Breakpoint 1, _PrintTocData (AH=0x8058fc0, te=0x80867e0, ropt=0x8058ee8)
at pg_backup_custom.c:471
471 if (fseeko(AH->FH, tctx->dataPos, SEEK_SET) != 0)
1: tctx->dataPos = -1927033749
(gdb) backtrace
#0 _PrintTocData (AH=0x8058fc0, te=0x80867e0, ropt=0x8058ee8)
at pg_backup_custom.c:471
#1 0x0804a98b in RestoreArchive (AHX=0x8058fc0, ropt=0x8058ee8)
at pg_backup_archiver.c:336
#2 0x0804a03e in main (argc=10, argv=0xbffff924) at pg_restore.c:366
#3 0x42015967 in __libc_start_main () from /lib/i686/libc.so.6

Hope this is helpful. BTW, the dump file size is 2361910772 bytes. The last
valid dataPos before the crash was at 1785996918 (and the table being restored
was pretty big). So, it does look like a pg_restore bug and that dataPos is
being treated as an integer somewhere.
Mike Charnoky

Tom Lane wrote:
Mike Charnoky <no**@nextbus.com> writes:
I am currently using PostgreSQL v7.3.4 on a RedHat 8.0 system (2.4.23 kernel)
using the ext3 filesystem. I am experiencing problems when performing a
pg_restore using a file which is 2.3G in size. The dump, which seemed to run
smoothly, was created using the -Fc option. When I perform the restore, the
following error occurs before the pg_restore fails:


pg_restore: [custom archiver] error during file seek: Invalid argument
pg_restore: *** aborted because of error


Why is this happening? The error comes from pg_backup_custom.c, it seems that
an fseeko() is failing (even though this is the way to support large
files).

Hm, can you insert some debugging printout to show the offset value
being passed to fseeko? That would let us eliminate one of pg_restore
and the kernel as being at fault. Another thing that'd be useful is to
run pg_restore under gdb with a breakpoint set at die_horribly, so that
you could get a stack trace from the point of the failure.

I am suspicious that it's a pg_restore bug and the problem has to do
with manipulating file offsets as plain integers someplace. Not enough
info yet to go searching, though.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 22 '05 #4
Mike Charnoky <no**@nextbus.com> writes:
So, it does look like a pg_restore bug and that dataPos is
being treated as an integer somewhere.


After digging in the CVS log I bet this is the same bug just noted a
month ago:

2004-01-03 23:02 tgl

* src/bin/pg_dump/: pg_backup_archiver.c (REL7_4_STABLE),
pg_backup_archiver.c: Fix ReadOffset() to work correctly when off_t
is wider than int.

It looks like the same patch applies to 7.3, modulo slightly different
line number. Please try it and let us know if it fixes the problem.

regards, tom lane

================================================== =================
RCS file: /cvsroot//pgsql-server/src/bin/pg_dump/pg_backup_archiver.c,v
retrieving revision 1.79
retrieving revision 1.79.2.1
diff -c -r1.79 -r1.79.2.1
*** pgsql-server/src/bin/pg_dump/pg_backup_archiver.c 2003/10/20 21:05:11 1.79
--- pgsql-server/src/bin/pg_dump/pg_backup_archiver.c 2004/01/04 04:02:22 1.79.2.1
***************
*** 1425,1431 ****
for (off = 0; off < AH->offSize; off++)
{
if (off < sizeof(off_t))
! *o |= ((*AH->ReadBytePtr) (AH)) << (off * 8);
else
{
if ((*AH->ReadBytePtr) (AH) != 0)
--- 1425,1431 ----
for (off = 0; off < AH->offSize; off++)
{
if (off < sizeof(off_t))
! *o |= ((off_t) ((*AH->ReadBytePtr) (AH))) << (off * 8);
else
{
if ((*AH->ReadBytePtr) (AH) != 0)

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 22 '05 #5
Excellent! This indeed solves the problem. I'll recompile pg_dump as well,
just to be on the safe side.

Thank you so much Tom for your quick response.
Mike Charnoky

Tom Lane wrote:
Mike Charnoky <no**@nextbus.com> writes:
So, it does look like a pg_restore bug and that dataPos is
being treated as an integer somewhere.

After digging in the CVS log I bet this is the same bug just noted a
month ago:

2004-01-03 23:02 tgl

* src/bin/pg_dump/: pg_backup_archiver.c (REL7_4_STABLE),
pg_backup_archiver.c: Fix ReadOffset() to work correctly when off_t
is wider than int.

It looks like the same patch applies to 7.3, modulo slightly different
line number. Please try it and let us know if it fixes the problem.

regards, tom lane

================================================== =================
RCS file: /cvsroot//pgsql-server/src/bin/pg_dump/pg_backup_archiver.c,v
retrieving revision 1.79
retrieving revision 1.79.2.1
diff -c -r1.79 -r1.79.2.1
*** pgsql-server/src/bin/pg_dump/pg_backup_archiver.c 2003/10/20 21:05:11 1.79
--- pgsql-server/src/bin/pg_dump/pg_backup_archiver.c 2004/01/04 04:02:22 1.79.2.1
***************
*** 1425,1431 ****
for (off = 0; off < AH->offSize; off++)
{
if (off < sizeof(off_t))
! *o |= ((*AH->ReadBytePtr) (AH)) << (off * 8);
else
{
if ((*AH->ReadBytePtr) (AH) != 0)
--- 1425,1431 ----
for (off = 0; off < AH->offSize; off++)
{
if (off < sizeof(off_t))
! *o |= ((off_t) ((*AH->ReadBytePtr) (AH))) << (off * 8);
else
{
if ((*AH->ReadBytePtr) (AH) != 0)

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 22 '05 #6
Mike Charnoky <no**@nextbus.com> writes:
Excellent! This indeed solves the problem. I'll recompile pg_dump as well,
just to be on the safe side.


Okay. I've installed the patch into the REL7_3_STABLE branch as well,
just in case we end up making a 7.3.6 release ...

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 22 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sam | last post by:
I'm having trouble restoring databases that have to lo type installed in /contrib/lo. The dump seems to work just fine, I get no errors when I execute the following command #pg_dump -Fc -o -b...
0
by: andy morrow | last post by:
hi, fairly new to postgres admin stuff...... i have a production machine that is running postgresql 7.1.3 also, there's a test machine which already had 7.0.3, and which i newly installed...
0
by: Joshua D. Drake | last post by:
Alright, we are testing pg_restore while restoring a 7GB database. This database has about 6GB of large objects and about 1Gb of textual data. The problem has been verified on PostgreSQL 7.3.2,...
14
by: Ron Johnson | last post by:
Hi, While on the topic of "need for in-place upgrades", I got to think- ing how the pg_restore could be speeded up. Am I wrong in saying that in the current pg_restore, all of the indexes are...
7
by: Howard Lowndes | last post by:
My situation is that I am interacting PHP 4.1.2 to PostgreSQL 7.2.2 I have no difficulty inserting and managing BLOBs into the Large Object system table, and I have a user table called images...
1
by: nednieuws | charles | last post by:
What does this error mean: pg_restore: creating TABLE author pg_restore: creating SEQUENCE author_id pg_restore: could not execute query: ERROR: parser: parse error at or near "BY" at...
3
by: Sven Willenberger | last post by:
Created a pg_dump with Fc (custom format compression) that resulted in a 300+MB file. Now trying to pg_restore this thing fails with either an out of memory error (as in the subject line) on...
7
by: Tim Penhey | last post by:
Maybe it's just me, but I can't seem to get pg_restore to restore a database... I am running 8.0 beta 2 (using the dev3 installer) on Windows XP. I created a very simple database with one...
1
by: ruben | last post by:
Hi: I'm trying to dump tableA and restore it to tableB: $ ./pg_dump -Fc -t tableA databaseA -f tableA.dump -v $ ./pg_restore -t tableB -d databaseA tableA.dump -v pg_dump creates...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.