Re: pgbasebackup is failing after truncate

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: "Yelai, Ramkumar" <ramkumar(dot)yelai(at)siemens(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: pgbasebackup is failing after truncate
Date: 2016-08-12 14:06:53
Message-ID: 5e59e238-e0b9-8687-4e33-2fa9e85d169a@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 08/10/2016 11:06 PM, Yelai, Ramkumar wrote:
> HI
>
> At present, I have some requirement to truncate the data base to
> reclaim disk space and at the same time I need to take basebackup.

To be clear you ran TRUNCATE on tables within the database, correct?

If not what was the actual command you used?

>
> Seems, truncate is successfully reclaimed the space but pgbasebackup
> failed and reported the below error.
>
> “could not stat file or directory ./base/16384/25600: Permission denied.

So what user did you run pg_basebackup as and does that user have
rights on that file/directory?

>
> Further observation shows that truncate command reclaiming the space by
> making empty (not deleted) these files in ./base/16384 folders.
>
> Seems these filename are relfilenode in pg_class table to map filename
> to table name. Since truncate making empty these files and create new
> files to map the old table name, pgbasebackup is unable to synch with
> truncate and pointing to old files.
>
> Also, the old files are not deleted from “base” folder.
>
> Please let me know how to resolve this issue
>
> With best regards,
> Ramkumar Yelai
>
> _mailto:ramkumar(dot)yelai(at)siemens(dot)com_
> _http://www.siemens.co.in/STS_
>
> Registered Office: 130, Pandurang Budhkar Marg, Worli, Mumbai 400 018.
> Telephone +91 22 39677000. Fax +91 22 39677075. Other Offices:
> Bangalore, Chennai, Gurgaon, Noida, Kolkata, Pune. Corporate Identity
> number:U99999MH1986PLC093854
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Edmundo Robles 2016-08-12 14:11:26 Error at dynamic generated copy...
Previous Message Adrian Klaver 2016-08-12 14:01:06 Re: Standby crash