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

Commit 4eb9c64

Browse files
committed
Fix test GC flag bug in CFS
1 parent 87cde70 commit 4eb9c64

File tree

1 file changed

+5
-1
lines changed
  • src/backend/storage/file

1 file changed

+5
-1
lines changed

src/backend/storage/file/cfs.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ void cfs_lock_file(FileMap* map, char const* file_path)
556556
}
557557
else
558558
{
559-
if (!pg_atomic_unlocked_test_flag(&cfs_state->gc_started))
559+
if (pg_atomic_unlocked_test_flag(&cfs_state->gc_started))
560560
{
561561
if (++n_attempts > MAX_LOCK_ATTEMPTS)
562562
{
@@ -566,6 +566,7 @@ void cfs_lock_file(FileMap* map, char const* file_path)
566566
* We should revoke the the lock to allow access to this segment.
567567
*/
568568
revokeLock = true;
569+
elog(WARNING, "CFS revokes lock on file %s\n", file_path);
569570
}
570571
}
571572
else
@@ -583,6 +584,8 @@ void cfs_lock_file(FileMap* map, char const* file_path)
583584
char* map_bck_path = psprintf("%s.cfm.bck", file_path);
584585
char* file_bck_path = psprintf("%s.bck", file_path);
585586

587+
elog(WARNING, "CFS indicates that GC of %s was interrupted: try to perform recovery", file_path);
588+
586589
if (access(file_bck_path, R_OK) != 0)
587590
{
588591
/* There is no backup file: new map should be constructed */
@@ -742,6 +745,7 @@ static bool cfs_gc_file(char* map_path, bool noerror)
742745
/* Uhhh... looks like last GC was interrupted.
743746
* Try to recover file
744747
*/
748+
elog(WARNING, "CFS indicates that last GC of %s was interrupted: perform recovery", file_bck_path);
745749
if (access(file_bck_path, R_OK) != 0)
746750
{
747751
/* There is no backup file: new map should be constructed */

0 commit comments

Comments
 (0)