Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite1d30bb

Browse files
authored
Merge pull request#17 from vegebird/mapset-fixes
remove additional and useless loop for each relation file when do ptrack_get_pagemapset query
2 parents2f040bb +820380a commite1d30bb

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

‎ptrack.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,14 @@ ptrack_filelist_getnext(PtScanCtx * ctx)
418418
returnptrack_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+
returnptrack_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
XLogRecPtrupdate_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);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp