Re: BUG #16663: DROP INDEX did not free up disk space: idle connection hold file marked as deleted
Andres Freund <andres@anarazel.de>
From: Andres Freund <andres@anarazel.de>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: denis.patron@previnet.it, pgsql-bugs@lists.postgresql.org
Date: 2020-10-14T04:35:40Z
Lists: pgsql-bugs, pgsql-hackers
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 <noreply@postgresql.org> wrote in > > The following bug has been logged on the website: > > > > Bug reference: 16663 > > Logged by: Denis Patron > > Email address: denis.patron@previnet.it > > 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
Commits
-
Use truncate(2) where appropriate.
- 57faaf376e19 14.0 landed
-
Free disk space for dropped relations on commit.
- e00928de8d22 9.5.25 landed
- d0bbe2122099 9.6.21 landed
- 22701755dc64 10.16 landed
- d5706ad7b70a 11.11 landed
- 50f338574242 12.6 landed
- fd3a75d820a4 13.2 landed
- 9f35f943732e 14.0 landed
-
Rename the "point is strictly above/below point" comparison operators.
- 0cc993278888 14.0 cited