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

Neil Chen <carpenter.nail.cz@gmail.com>

From: Neil Chen <carpenter.nail.cz@gmail.com>
To: pgsql-hackers@lists.postgresql.org
Cc: Thomas Munro <thomas.munro@gmail.com>
Date: 2020-11-19T08:20:18Z
Lists: pgsql-bugs, pgsql-hackers
The following review has been posted through the commitfest application:
make installcheck-world:  tested, passed
Implements feature:       tested, passed
Spec compliant:           not tested
Documentation:            not tested

Hi, I have tested the feature and it worked well. 
One thing that doesn't matter is that the modify here seems unnecessary, right?

> mdunlinkfork(RelFileNodeBackend rnode, ForkNumber forkNum, bool isRedo)
> {
> char	   *path;
> -	int			ret;
> +	int			ret = 0;
> path = relpath(rnode, forkNum

Commits

  1. Use truncate(2) where appropriate.

  2. Free disk space for dropped relations on commit.

  3. Rename the "point is strictly above/below point" comparison operators.