Skip to content

Commit 528c9db

Browse files
committed
[PBCKP-564] Don't spam with "skip empty file" message
And don't add empty files to file list at all. Fixes #35
1 parent 42ea77d commit 528c9db

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

Diff for: ptrack.c

+15-5
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)