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 @@ -368,6 +368,14 @@ ptrack_filelist_getnext(PtScanCtx * ctx)
368368 return ptrack_filelist_getnext (ctx );
369369 }
370370
371+ if (fst .st_size == 0 )
372+ {
373+ elog (WARNING , "ptrack: skip empty file %s" , fullpath );
374+
375+ /* But try the next one */
376+ return ptrack_filelist_getnext (ctx );
377+ }
378+
371379 if (pfl -> segno > 0 )
372380 {
373381 ctx -> relsize = pfl -> segno * RELSEG_SIZE + fst .st_size / BLCKSZ ;
@@ -494,7 +502,7 @@ ptrack_get_pagemapset(PG_FUNCTION_ARGS)
494502 XLogRecPtr update_lsn2 ;
495503
496504 /* Stop traversal if there are no more segments */
497- if (ctx -> bid .blocknum > ctx -> relsize )
505+ if (ctx -> bid .blocknum + 1 > ctx -> relsize )
498506 {
499507 /* We completed a segment and there is a bitmap to return */
500508 if (pagemap .bitmap != NULL )
@@ -526,12 +534,9 @@ ptrack_get_pagemapset(PG_FUNCTION_ARGS)
526534 if (htup )
527535 SRF_RETURN_NEXT (funcctx , HeapTupleGetDatum (htup ));
528536 }
529- else
530- {
531- /* We have just processed unchanged file, let's pick next */
532- if (ptrack_filelist_getnext (ctx ) < 0 )
533- SRF_RETURN_DONE (funcctx );
534- }
537+
538+ if (ptrack_filelist_getnext (ctx ) < 0 )
539+ SRF_RETURN_DONE (funcctx );
535540 }
536541
537542 hash = BID_HASH_FUNC (ctx -> bid );
You can’t perform that action at this time.
0 commit comments