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 4093ff5

Browse filesBrowse files
committed
Store the deletion horizon XID for a deleted GIN page on the right page.
Commit b107140 moved the GinPageSetDeleteXid() call to a spot where the "page" variable was pointing to the wrong page, causing the XID to be inserted on a page that's not being deleted, thus allowing later GinPageIsRecyclable tests to recycle the deleted page too soon. It might be a good idea to stop using the single "page" variable for multiple purposes in this function. But for the moment I just moved the GinPageSetDeleteXid() call down beside the GinPageSetDeleted() call, which seems like a more logical place for it anyway. Back-patch to v11, as the faulty patch was. (Fortunately, the bug hasn't made it into any release yet.) Discussion: https://postgr.es/m/21620.1581098806@sss.pgh.pa.us
1 parent 55173d2 commit 4093ff5
Copy full SHA for 4093ff5

File tree

Expand file treeCollapse file tree

1 file changed

+6
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-3
lines changed

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

Copy file name to clipboardExpand all lines: src/backend/access/gin/ginvacuum.c
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,6 @@ ginDeletePage(GinVacuumState *gvs, BlockNumber deleteBlkno, BlockNumber leftBlkn
165165
page = BufferGetPage(lBuffer);
166166
GinPageGetOpaque(page)->rightlink = rightlink;
167167

168-
/* For deleted page remember last xid which could knew its address */
169-
GinPageSetDeleteXid(page, ReadNewTransactionId());
170-
171168
/* Delete downlink from parent */
172169
parentPage = BufferGetPage(pBuffer);
173170
#ifdef USE_ASSERT_CHECKING
@@ -186,7 +183,13 @@ ginDeletePage(GinVacuumState *gvs, BlockNumber deleteBlkno, BlockNumber leftBlkn
186183
* we shouldn't change rightlink field to save workability of running
187184
* search scan
188185
*/
186+
187+
/*
188+
* Mark page as deleted, and remember last xid which could know its
189+
* address.
190+
*/
189191
GinPageSetDeleted(page);
192+
GinPageSetDeleteXid(page, ReadNewTransactionId());
190193

191194
MarkBufferDirty(pBuffer);
192195
MarkBufferDirty(lBuffer);

0 commit comments

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