File tree 1 file changed +12
-7
lines changed
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)
418
418
return ptrack_filelist_getnext (ctx );
419
419
}
420
420
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
+
421
429
if (pfl -> segno > 0 )
422
430
{
423
431
ctx -> relsize = pfl -> segno * RELSEG_SIZE + fst .st_size / BLCKSZ ;
@@ -544,7 +552,7 @@ ptrack_get_pagemapset(PG_FUNCTION_ARGS)
544
552
XLogRecPtr update_lsn2 ;
545
553
546
554
/* Stop traversal if there are no more segments */
547
- if (ctx -> bid .blocknum > ctx -> relsize )
555
+ if (ctx -> bid .blocknum >= ctx -> relsize )
548
556
{
549
557
/* We completed a segment and there is a bitmap to return */
550
558
if (pagemap .bitmap != NULL )
@@ -576,12 +584,9 @@ ptrack_get_pagemapset(PG_FUNCTION_ARGS)
576
584
if (htup )
577
585
SRF_RETURN_NEXT (funcctx , HeapTupleGetDatum (htup ));
578
586
}
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 );
585
590
}
586
591
587
592
hash = BID_HASH_FUNC (ctx -> bid );
You can’t perform that action at this time.
0 commit comments