@@ -646,8 +646,9 @@ static int cfs_cmp_page_offs(void const* p1, void const* p2)
646
646
/*
647
647
* Perform garbage collection (if required) on the file
648
648
* @param map_path - path to the map file (*.cfm).
649
+ * @param noerror - surpress error message (when this function is called by cfs_gc_relation until there are available segments)
649
650
*/
650
- static bool cfs_gc_file (char * map_path )
651
+ static bool cfs_gc_file (char * map_path , bool noerror )
651
652
{
652
653
int md = open (map_path , O_RDWR |PG_BINARY , 0 );
653
654
FileMap * map ;
@@ -679,7 +680,9 @@ static bool cfs_gc_file(char* map_path)
679
680
680
681
if (md < 0 )
681
682
{
682
- elog (LOG , "CFS failed to open map file %s: %m" , map_path );
683
+ if (!noerror ) {
684
+ elog (LOG , "CFS failed to open map file %s: %m" , map_path );
685
+ }
683
686
goto FinishGC ;
684
687
}
685
688
@@ -1059,7 +1062,7 @@ static bool cfs_gc_directory(int worker_id, char const* path)
1059
1062
strcmp (file_path + len - 4 , ".cfm" ) == 0 )
1060
1063
{
1061
1064
if (entry -> d_ino % cfs_state -> n_workers == worker_id
1062
- && !cfs_gc_file (file_path ))
1065
+ && !cfs_gc_file (file_path , false ))
1063
1066
{
1064
1067
success = false;
1065
1068
break ;
@@ -1395,7 +1398,7 @@ Datum cfs_gc_relation(PG_FUNCTION_ARGS)
1395
1398
1396
1399
while (true)
1397
1400
{
1398
- if (!cfs_gc_file (map_path ))
1401
+ if (!cfs_gc_file (map_path , true ))
1399
1402
break ;
1400
1403
sprintf (map_path , "%s.%u.cfm" , path , ++ i );
1401
1404
}
0 commit comments