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

Commitc39f567

Browse files
committed
Fix brin index summarizing while vacuuming.
If the number of heap blocks is not multiples of pages per range, thesummarizing produces wrong summary information for the last brin indextuple while vacuuming.Problem reported by Tatsuo Ishii and fixed by Amit Langote.Discussion at "[HACKERS] BRIN INDEX value (message id :20150903.174935.1946402199422994347.t-ishii@sraoss.co.jp)Backpatched to 9.5 in which brin index was added.
1 parentc5454f9 commitc39f567

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

‎src/backend/access/brin/brin.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -934,12 +934,13 @@ terminate_brin_buildstate(BrinBuildState *state)
934934
*/
935935
staticvoid
936936
summarize_range(IndexInfo*indexInfo,BrinBuildState*state,RelationheapRel,
937-
BlockNumberheapBlk)
937+
BlockNumberheapBlk,BlockNumberheapNumBlks)
938938
{
939939
Bufferphbuf;
940940
BrinTuple*phtup;
941941
Sizephsz;
942942
OffsetNumberoffset;
943+
BlockNumberscanNumBlks;
943944

944945
/*
945946
* Insert the placeholder tuple
@@ -960,8 +961,10 @@ summarize_range(IndexInfo *indexInfo, BrinBuildState *state, Relation heapRel,
960961
* by transactions that are still in progress, among other corner cases.
961962
*/
962963
state->bs_currRangeStart=heapBlk;
964+
scanNumBlks=heapBlk+state->bs_pagesPerRange <=heapNumBlks ?
965+
state->bs_pagesPerRange :heapNumBlks-heapBlk;
963966
IndexBuildHeapRangeScan(heapRel,state->bs_irel,indexInfo, false, true,
964-
heapBlk,state->bs_pagesPerRange,
967+
heapBlk,scanNumBlks,
965968
brinbuildCallback, (void*)state);
966969

967970
/*
@@ -1066,7 +1069,7 @@ brinsummarize(Relation index, Relation heapRel, double *numSummarized,
10661069
pagesPerRange);
10671070
indexInfo=BuildIndexInfo(index);
10681071
}
1069-
summarize_range(indexInfo,state,heapRel,heapBlk);
1072+
summarize_range(indexInfo,state,heapRel,heapBlk,heapNumBlocks);
10701073

10711074
/* and re-initialize state for the next range */
10721075
brin_memtuple_initialize(state->bs_dtuple,state->bs_bdesc);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp