@@ -322,14 +322,22 @@ ptrack_gather_filelist(List **filelist, char *path, Oid spcOid, Oid dbOid)
322
322
323
323
if (sret < 0 )
324
324
{
325
- ereport (LOG ,
325
+ ereport (WARNING ,
326
326
(errcode_for_file_access (),
327
327
errmsg ("ptrack: could not stat file \"%s\": %m" , subpath )));
328
328
continue ;
329
329
}
330
330
331
331
if (S_ISREG (fst .st_mode ))
332
332
{
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
+
333
341
/* Regular file inside database directory, otherwise skip it */
334
342
if (dbOid != InvalidOid || spcOid == GLOBALTABLESPACE_OID )
335
343
{
@@ -406,6 +414,8 @@ ptrack_filelist_getnext(PtScanCtx * ctx)
406
414
RelFileNodeBackend rnodebackend ;
407
415
#endif
408
416
417
+ get_next :
418
+
409
419
/* No more file in the list */
410
420
if (list_length (ctx -> filelist ) == 0 )
411
421
return -1 ;
@@ -440,15 +450,15 @@ ptrack_filelist_getnext(PtScanCtx * ctx)
440
450
elog (WARNING , "ptrack: cannot stat file %s" , fullpath );
441
451
442
452
/* But try the next one */
443
- return ptrack_filelist_getnext ( ctx ) ;
453
+ goto get_next ;
444
454
}
445
455
446
456
if (fst .st_size == 0 )
447
457
{
448
- elog (WARNING , "ptrack: skip empty file %s" , fullpath );
458
+ elog (DEBUG3 , "ptrack: skip empty file %s" , fullpath );
449
459
450
460
/* But try the next one */
451
- return ptrack_filelist_getnext ( ctx ) ;
461
+ goto get_next ;
452
462
}
453
463
454
464
#if CFS_SUPPORT
@@ -460,7 +470,7 @@ ptrack_filelist_getnext(PtScanCtx * ctx)
460
470
461
471
// Could not open fullpath for some reason, trying the next file.
462
472
if (rel_st_size == -1 )
463
- return ptrack_filelist_getnext ( ctx ) ;
473
+ goto get_next ;
464
474
} else
465
475
#endif
466
476
rel_st_size = fst .st_size ;
0 commit comments