]> granicus.if.org Git - postgresql/commit
Fix mdtruncate() to close fd.c handle of deleted segments.
authorAndres Freund <andres@anarazel.de>
Thu, 8 Sep 2016 23:51:09 +0000 (16:51 -0700)
committerAndres Freund <andres@anarazel.de>
Thu, 8 Sep 2016 23:52:13 +0000 (16:52 -0700)
commit075cfbe4a966aa9717941ac8dce48434c4706aa5
treed34a08ea0b54092a3ec2624fa6c6810d3e778d97
parentdb88112ce17f05b211cf6e2c50f1dd7107556786
Fix mdtruncate() to close fd.c handle of deleted segments.

mdtruncate() forgot to FileClose() a segment's mdfd_vfd, when deleting
it. That lead to a fd.c handle to a truncated file being kept open until
backend exit.

The issue appears to have been introduced way back in 1a5c450f3024ac5,
before that the handle was closed inside FileUnlink().

The impact of this bug is limited - only VACUUM and ON COMMIT TRUNCATE
for temporary tables, truncate files in place (i.e. TRUNCATE itself is
not affected), and the relation has to be bigger than 1GB. The
consequences of a leaked fd.c handle aren't severe either.

Discussion: <20160908220748.oqh37ukwqqncbl3n@alap3.anarazel.de>
Backpatch: all supported releases
src/backend/storage/smgr/md.c