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

Commit1a9405d

Browse files
committed
Cosmetic cleanup of ginInsertValue().
Make it clearer that the passed stack mustn't be empty, and that weare not supposed to fall off the end of the stack in the main loop.Tighten the loop that extracts the root block number, too.Markus Wanner and Tom Lane
1 parenta84bf49 commit1a9405d

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

‎src/backend/access/gin/ginbtree.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -275,20 +275,22 @@ ginFindParents(GinBtree btree, GinBtreeStack *stack,
275275
void
276276
ginInsertValue(GinBtreebtree,GinBtreeStack*stack,GinStatsData*buildStats)
277277
{
278-
GinBtreeStack*parent=stack;
279-
BlockNumberrootBlkno=InvalidBuffer;
278+
GinBtreeStack*parent;
279+
BlockNumberrootBlkno;
280280
Pagepage,
281281
rpage,
282282
lpage;
283283

284-
/*remember root BlockNumber */
285-
while (parent)
286-
{
287-
rootBlkno=parent->blkno;
284+
/*extract root BlockNumber from stack */
285+
Assert(stack!=NULL);
286+
parent=stack;
287+
while (parent->parent)
288288
parent=parent->parent;
289-
}
289+
rootBlkno=parent->blkno;
290+
Assert(BlockNumberIsValid(rootBlkno));
290291

291-
while (stack)
292+
/* this loop crawls up the stack until the insertion is complete */
293+
for (;;)
292294
{
293295
XLogRecData*rdata;
294296
BlockNumbersavedRightLink;
@@ -457,7 +459,7 @@ ginInsertValue(GinBtree btree, GinBtreeStack *stack, GinStatsData *buildStats)
457459
*/
458460
ginFindParents(btree,stack,rootBlkno);
459461
parent=stack->parent;
460-
page=BufferGetPage(parent->buffer);
462+
Assert(parent!=NULL);
461463
break;
462464
}
463465

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp