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

Commit 3daaa06

Browse files
author
Sokolov Yura
committed
cfs: fix cfs_control_gc_lock
it should wait always, not only first time.
1 parent 1a281e8 commit 3daaa06

File tree

1 file changed

+9
-12
lines changed
  • src/backend/storage/file

1 file changed

+9
-12
lines changed

src/backend/storage/file/cfs.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,20 +1481,17 @@ void cfs_gc_start_bgworkers()
14811481
void cfs_control_gc_lock(void)
14821482
{
14831483
uint32 was_disabled = pg_atomic_fetch_add_u32(&cfs_state->gc_disabled, 1);
1484-
if (!was_disabled)
1484+
/* Wait until there are no active GC workers */
1485+
while (pg_atomic_read_u32(&cfs_state->n_active_gc) != 0)
14851486
{
1486-
/* Wait until there are no active GC workers */
1487-
while (pg_atomic_read_u32(&cfs_state->n_active_gc) != 0)
1488-
{
1489-
int rc = WaitLatch(MyLatch,
1490-
WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH,
1491-
CFS_DISABLE_TIMEOUT /* ms */);
1492-
if (rc & WL_POSTMASTER_DEATH)
1493-
exit(1);
1487+
int rc = WaitLatch(MyLatch,
1488+
WL_LATCH_SET | WL_TIMEOUT | WL_POSTMASTER_DEATH,
1489+
CFS_DISABLE_TIMEOUT /* ms */);
1490+
if (rc & WL_POSTMASTER_DEATH)
1491+
exit(1);
14941492

1495-
ResetLatch(MyLatch);
1496-
CHECK_FOR_INTERRUPTS();
1497-
}
1493+
ResetLatch(MyLatch);
1494+
CHECK_FOR_INTERRUPTS();
14981495
}
14991496
}
15001497

0 commit comments

Comments
 (0)