Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2bc2af9

Browse files
author
Sokolov Yura
committed
cfs: fix interaction of 'vacuum full', 'drop table' and cfs_gc.
1 parent 05449c2 commit 2bc2af9

File tree

1 file changed

+25
-5
lines changed
  • src/backend/storage/smgr

1 file changed

+25
-5
lines changed

src/backend/storage/smgr/md.c

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ mdcreate(SMgrRelation reln, ForkNumber forkNum, bool isRedo)
451451
void
452452
mdunlink(RelFileNodeBackend rnode, ForkNumber forkNum, bool isRedo)
453453
{
454+
bool cfs_gc_locked = false;
454455
/*
455456
* We have to clean out any pending fsync requests for the doomed
456457
* relation, else the next mdsync() will fail. There can't be any such
@@ -461,14 +462,33 @@ mdunlink(RelFileNodeBackend rnode, ForkNumber forkNum, bool isRedo)
461462
if (!RelFileNodeBackendIsTemp(rnode))
462463
ForgetRelationFsyncRequests(rnode.node, forkNum);
463464

464-
/* Now do the per-fork work */
465-
if (forkNum == InvalidForkNumber)
465+
if (md_use_compression(rnode, forkNum == InvalidForkNumber ? MAIN_FORKNUM : forkNum))
466466
{
467-
for (forkNum = 0; forkNum <= MAX_FORKNUM; forkNum++)
467+
cfs_gc_locked = true;
468+
cfs_control_gc_lock();
469+
}
470+
471+
PG_TRY();
472+
{
473+
/* Now do the per-fork work */
474+
if (forkNum == InvalidForkNumber)
475+
{
476+
for (forkNum = 0; forkNum <= MAX_FORKNUM; forkNum++)
477+
mdunlinkfork(rnode, forkNum, isRedo);
478+
}
479+
else
468480
mdunlinkfork(rnode, forkNum, isRedo);
481+
}
469482
}
470-
else
471-
mdunlinkfork(rnode, forkNum, isRedo);
483+
PG_CATCH();
484+
{
485+
if (cfs_gc_locked)
486+
cfs_control_gc_unlock();
487+
PG_RE_THROW();
488+
}
489+
PG_END_TRY();
490+
if (cfs_gc_locked)
491+
cfs_control_gc_unlock();
472492
}
473493

474494
static void

0 commit comments

Comments
 (0)