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 @@ -368,6 +368,14 @@ ptrack_filelist_getnext(PtScanCtx * ctx)
368
368
return ptrack_filelist_getnext (ctx );
369
369
}
370
370
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
+
371
379
if (pfl -> segno > 0 )
372
380
{
373
381
ctx -> relsize = pfl -> segno * RELSEG_SIZE + fst .st_size / BLCKSZ ;
@@ -494,7 +502,7 @@ ptrack_get_pagemapset(PG_FUNCTION_ARGS)
494
502
XLogRecPtr update_lsn2 ;
495
503
496
504
/* Stop traversal if there are no more segments */
497
- if (ctx -> bid .blocknum > ctx -> relsize )
505
+ if (ctx -> bid .blocknum + 1 > ctx -> relsize )
498
506
{
499
507
/* We completed a segment and there is a bitmap to return */
500
508
if (pagemap .bitmap != NULL )
@@ -526,12 +534,9 @@ ptrack_get_pagemapset(PG_FUNCTION_ARGS)
526
534
if (htup )
527
535
SRF_RETURN_NEXT (funcctx , HeapTupleGetDatum (htup ));
528
536
}
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 );
535
540
}
536
541
537
542
hash = BID_HASH_FUNC (ctx -> bid );
You can’t perform that action at this time.
0 commit comments