Skip to content

Commit 33d249f

Browse files
authored
Merge 528c9db into 42ea77d
2 parents 42ea77d + 528c9db commit 33d249f

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

ptrack.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,14 +322,22 @@ ptrack_gather_filelist(List **filelist, char *path, Oid spcOid, Oid dbOid)
322322

323323
if (sret < 0)
324324
{
325-
ereport(LOG,
325+
ereport(WARNING,
326326
(errcode_for_file_access(),
327327
errmsg("ptrack: could not stat file \"%s\": %m", subpath)));
328328
continue;
329329
}
330330

331331
if (S_ISREG(fst.st_mode))
332332
{
333+
if (fst.st_size == 0)
334+
{
335+
elog(DEBUG3, "ptrack: skip empty file %s", subpath);
336+
337+
/* But try the next one */
338+
continue;
339+
}
340+
333341
/* Regular file inside database directory, otherwise skip it */
334342
if (dbOid != InvalidOid || spcOid == GLOBALTABLESPACE_OID)
335343
{
@@ -406,6 +414,8 @@ ptrack_filelist_getnext(PtScanCtx * ctx)
406414
RelFileNodeBackend rnodebackend;
407415
#endif
408416

417+
get_next:
418+
409419
/* No more file in the list */
410420
if (list_length(ctx->filelist) == 0)
411421
return -1;
@@ -440,15 +450,15 @@ ptrack_filelist_getnext(PtScanCtx * ctx)
440450
elog(WARNING, "ptrack: cannot stat file %s", fullpath);
441451

442452
/* But try the next one */
443-
return ptrack_filelist_getnext(ctx);
453+
goto get_next;
444454
}
445455

446456
if (fst.st_size == 0)
447457
{
448-
elog(WARNING, "ptrack: skip empty file %s", fullpath);
458+
elog(DEBUG3, "ptrack: skip empty file %s", fullpath);
449459

450460
/* But try the next one */
451-
return ptrack_filelist_getnext(ctx);
461+
goto get_next;
452462
}
453463

454464
#if CFS_SUPPORT
@@ -460,7 +470,7 @@ ptrack_filelist_getnext(PtScanCtx * ctx)
460470

461471
// Could not open fullpath for some reason, trying the next file.
462472
if(rel_st_size == -1)
463-
return ptrack_filelist_getnext(ctx);
473+
goto get_next;
464474
} else
465475
#endif
466476
rel_st_size = fst.st_size;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy