File tree Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Expand file tree Collapse file tree 1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -418,6 +418,14 @@ ptrack_filelist_getnext(PtScanCtx * ctx)
418418 return ptrack_filelist_getnext (ctx );
419419 }
420420
421+ if (fst .st_size == 0 )
422+ {
423+ elog (WARNING , "ptrack: skip empty file %s" , fullpath );
424+
425+ /* But try the next one */
426+ return ptrack_filelist_getnext (ctx );
427+ }
428+
421429 if (pfl -> segno > 0 )
422430 {
423431 ctx -> relsize = pfl -> segno * RELSEG_SIZE + fst .st_size / BLCKSZ ;
@@ -544,7 +552,7 @@ ptrack_get_pagemapset(PG_FUNCTION_ARGS)
544552 XLogRecPtr update_lsn2 ;
545553
546554 /* Stop traversal if there are no more segments */
547- if (ctx -> bid .blocknum > ctx -> relsize )
555+ if (ctx -> bid .blocknum >= ctx -> relsize )
548556 {
549557 /* We completed a segment and there is a bitmap to return */
550558 if (pagemap .bitmap != NULL )
@@ -576,12 +584,9 @@ ptrack_get_pagemapset(PG_FUNCTION_ARGS)
576584 if (htup )
577585 SRF_RETURN_NEXT (funcctx , HeapTupleGetDatum (htup ));
578586 }
579- else
580- {
581- /* We have just processed unchanged file, let's pick next */
582- if (ptrack_filelist_getnext (ctx ) < 0 )
583- SRF_RETURN_DONE (funcctx );
584- }
587+
588+ if (ptrack_filelist_getnext (ctx ) < 0 )
589+ SRF_RETURN_DONE (funcctx );
585590 }
586591
587592 hash = BID_HASH_FUNC (ctx -> bid );
You can’t perform that action at this time.
0 commit comments