Re: BUG #16663: DROP INDEX did not free up disk space: idle connection hold file marked as deleted

From: "denis(dot)patron" <denis(dot)patron(at)previnet(dot)it>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #16663: DROP INDEX did not free up disk space: idle connection hold file marked as deleted
Date: 2020-10-14 06:47:34
Message-ID: 1602658054887-0.post@n3.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Andres Freund wrote
> Hi,
>
> On 2020-10-14 12:05:10 +0900, Kyotaro Horiguchi wrote:
>> This is not a bug.
>>
>> At Fri, 09 Oct 2020 13:24:15 +0000, PG Bug reporting form &lt;

> noreply@

> &gt; wrote in
>> > The following bug has been logged on the website:
>> >
>> > Bug reference: 16663
>> > Logged by: Denis Patron
>> > Email address:

> denis.patron@

>> > PostgreSQL version: 11.9
>> > Operating system: CentOS 7
>> > Description:
>> >
>> > I have an index, which at the file system level, is made up of multiple
>> > segments (file:
> <id>
> .1,
> <id>
> .2 ecc). When I DROP INDEX, the index is dropped
>> > in Postgresql but at the file system level, the segments are marked as
>> > "deleted". if I check with the lsof command, I see that the segments
>> are in
>> > use from an idle connection. This does not happen if the index is
>> formed by
>> > only one segment (in my case <1Gb). How can I prevent this?
>> > thanks
>>
>> That references to deleted files will dissapear at the beginning of
>> the next transaction.
>>
>> At the time a relation including an index is dropped, the first
>> segment file (named as "
> <id>
> " without a suffix number) is left behind
>> so the file is not shown as "(deleted)" in lsof output.
>
> I think we should consider either occasionally sending a sinval catchup
> interrupt to backends that have been idle for a while, or to use a timer
> that we use to limit the maximum time until we process sinvals. Just
> having to wait till all backends become busy and process sinval events
> doesn't really seem like good approach to me.
>
> Regards,
>
> Andres

thanks for replying.
the problem is that I have a very large database, with indexes of up to 70
Gb. while I redo the indexes in concurrently mode, if an idle transaction is
using the index in question, the segment file (<id> _1 <id> _2 etc) of the
index remains in the filesystem (marked as deleted) as long as the idle
connection that it is blocking it does not make another transaction. this
means that I can have hundreds of GB of space occupied by files marked
"deleted", and this for hours. the risk is to run out of free space

--
Sent from: https://www.postgresql-archive.org/PostgreSQL-bugs-f2117394.html

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2020-10-14 07:14:06 BUG #16669: cant install postgresql13-server to rhel 6
Previous Message Petr Jelinek 2020-10-14 05:04:24 Re: BUG #16643: PG13 - Logical replication - initial startup never finishes and gets stuck in startup loop

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2020-10-14 06:52:43 Re: Wrong statistics for size of XLOG_SWITCH during pg_waldump.
Previous Message Amit Langote 2020-10-14 06:44:37 Re: partition routing layering in nodeModifyTable.c