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

Appearance settings

Commit d5ad7a0

Browse filesBrowse files
committed
Fix traversing to the deleted GIN page via downlink
Current GIN code appears to don't handle traversing to the deleted page via downlink. This commit fixes that by stepping right from the delete page like we do in nbtree. This commit also fixes setting 'deleted' flag to the GIN pages. Now other page flags are not erased once page is deleted. That helps to keep our assertions true if we arrive deleted page via downlink. Discussion: https://postgr.es/m/CAPpHfdvMvsw-NcE5bRS7R1BbvA4BxoDnVVjkXC5W0Czvy9LVrg%40mail.gmail.com Author: Alexander Korotkov Reviewed-by: Peter Geoghegan Backpatch-through: 9.4
1 parent e146411 commit d5ad7a0
Copy full SHA for d5ad7a0

File tree

Expand file treeCollapse file tree

4 files changed

+5
-9
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+5
-9
lines changed

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

Copy file name to clipboardExpand all lines: src/backend/access/gin/ginbtree.c
-7Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,6 @@ ginStepRight(Buffer buffer, Relation index, int lockmode)
187187
if (isLeaf != GinPageIsLeaf(page) || isData != GinPageIsData(page))
188188
elog(ERROR, "right sibling of GIN page is of different type");
189189

190-
/*
191-
* Given the proper lock sequence above, we should never land on a deleted
192-
* page.
193-
*/
194-
if (GinPageIsDeleted(page))
195-
elog(ERROR, "right sibling of GIN page was deleted");
196-
197190
return nextbuffer;
198191
}
199192

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

Copy file name to clipboardExpand all lines: src/backend/access/gin/gindatapage.c
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,9 @@ dataIsMoveRight(GinBtree btree, Page page)
238238
if (GinPageRightMost(page))
239239
return false;
240240

241+
if (GinPageIsDeleted(page))
242+
return true;
243+
241244
return (ginCompareItemPointers(&btree->itemptr, iptr) > 0) ? true : false;
242245
}
243246

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

Copy file name to clipboardExpand all lines: src/backend/access/gin/ginvacuum.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ ginDeletePage(GinVacuumState *gvs, BlockNumber deleteBlkno, BlockNumber leftBlkn
186186
* we shouldn't change rightlink field to save workability of running
187187
* search scan
188188
*/
189-
GinPageGetOpaque(page)->flags = GIN_DELETED;
189+
GinPageSetDeleted(page);
190190

191191
MarkBufferDirty(pBuffer);
192192
MarkBufferDirty(lBuffer);

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

Copy file name to clipboardExpand all lines: src/backend/access/gin/ginxlog.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ ginRedoDeletePage(XLogReaderState *record)
500500
{
501501
page = BufferGetPage(dbuffer);
502502
Assert(GinPageIsData(page));
503-
GinPageGetOpaque(page)->flags = GIN_DELETED;
503+
GinPageSetDeleted(page);
504504
GinPageSetDeleteXid(page, data->deleteXid);
505505
PageSetLSN(page, lsn);
506506
MarkBufferDirty(dbuffer);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.