From: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> |
---|---|
To: | hjp-pgsql(at)hjp(dot)at |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: pg_restore: could not close data file: Success |
Date: | 2020-04-16 03:08:09 |
Message-ID: | 20200416.120809.1953913138810711236.horikyota.ntt@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
Hello.
Added -hackers.
At Wed, 15 Apr 2020 12:14:25 +0200, "Peter J. Holzer" <hjp-pgsql(at)hjp(dot)at> wrote in
> On 2020-04-15 12:01:46 +0200, Peter J. Holzer wrote:
> > I'm trying to restore a backup on a different machine and it terminates
> > with the not really helpful messages:
> >
> > pg_restore: [directory archiver] could not close data file: Success
> > pg_restore: [parallel archiver] a worker process died unexpectedly
> [...]
> > My guess is that maybe one of the data files is damaged
>
> As is often the case the matter became obvious a few minutes after
> writing the mail.
>
> There were indeed two file with length 0 in the dump. That happened
> because the backup failed because it couldn't obtain a lock on a table.
>
> I nicer error message (something like "cannot decompress '13503.dat.gz':
> Empty file") would have helped.
Unfortunately, just emptying .dat.gz file doesn't worked for me.
Anyway the message is emitted the following way.
pg_backup_directoy.c:
> if (cfclose(cfp) !=0)
> fatal("could not close data file: %m");
%m doesn't work for some kinds of errors about compressed files but
cfclose conseals the true cause.
I'm surprised to find an old thread about the same issue.
https://www.postgresql.org/message-id/20160307.174354.251049100.horiguchi.kyotaro%40lab.ntt.co.jp
But I don't think it's not acceptable that use fake errno for gzclose,
but cfclose properly passes-through the error code from gzclose, so it
is enought that the caller should recognize the difference.
Please find the attached.
regards.
--
Kyotaro Horiguchi
NTT Open Source Software Center
Attachment | Content-Type | Size |
---|---|---|
handle_cfclose_error_properly-1.patch | text/x-patch | 3.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Niels Jespersen | 2020-04-16 04:12:46 | SV: timestamp and timestamptz |
Previous Message | David G. Johnston | 2020-04-16 00:15:07 | Re: timestamp and timestamptz |
From | Date | Subject | |
---|---|---|---|
Next Message | Kyotaro Horiguchi | 2020-04-16 05:05:04 | Re: Allow pg_read_all_stats to read pg_stat_progress_* |
Previous Message | Noah Misch | 2020-04-16 03:01:01 | Re: cleaning perl code |