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

Commit fe395b3

Browse files
committed
Add noerror parameter to cfs_gc_file to avoid logging of message about absent file when cfs_gc_file is called by cfs_gc_relation
1 parent e6c29f0 commit fe395b3

File tree

1 file changed

+7
-4
lines changed
  • src/backend/storage/file

1 file changed

+7
-4
lines changed

src/backend/storage/file/cfs.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,9 @@ static int cfs_cmp_page_offs(void const* p1, void const* p2)
646646
/*
647647
* Perform garbage collection (if required) on the file
648648
* @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)
649650
*/
650-
static bool cfs_gc_file(char* map_path)
651+
static bool cfs_gc_file(char* map_path, bool noerror)
651652
{
652653
int md = open(map_path, O_RDWR|PG_BINARY, 0);
653654
FileMap* map;
@@ -679,7 +680,9 @@ static bool cfs_gc_file(char* map_path)
679680

680681
if (md < 0)
681682
{
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+
}
683686
goto FinishGC;
684687
}
685688

@@ -1059,7 +1062,7 @@ static bool cfs_gc_directory(int worker_id, char const* path)
10591062
strcmp(file_path + len - 4, ".cfm") == 0)
10601063
{
10611064
if (entry->d_ino % cfs_state->n_workers == worker_id
1062-
&& !cfs_gc_file(file_path))
1065+
&& !cfs_gc_file(file_path, false))
10631066
{
10641067
success = false;
10651068
break;
@@ -1395,7 +1398,7 @@ Datum cfs_gc_relation(PG_FUNCTION_ARGS)
13951398

13961399
while (true)
13971400
{
1398-
if (!cfs_gc_file(map_path))
1401+
if (!cfs_gc_file(map_path, true))
13991402
break;
14001403
sprintf(map_path, "%s.%u.cfm", path, ++i);
14011404
}

0 commit comments

Comments
 (0)