From: | Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi> |
---|---|
To: | pgsql-committers(at)postgresql(dot)org |
Subject: | pgsql: Fix race condition in GIN posting tree page deletion. |
Date: | 2013-11-08 20:29:17 |
Message-ID: | E1Vesg9-0008LO-EG@gemulon.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers |
Fix race condition in GIN posting tree page deletion.
If a page is deleted, and reused for something else, just as a search is
following a rightlink to it from its left sibling, the search would continue
scanning whatever the new contents of the page are. That could lead to
incorrect query results, or even something more curious if the page is
reused for a different kind of a page.
To fix, modify the search algorithm to lock the next page before releasing
the previous one, and refrain from deleting pages from the leftmost branch
of the tree.
Add a new Concurrency section to the README, explaining why this works.
There is a lot more one could say about concurrency in GIN, but that's for
another patch.
Backpatch to all supported versions.
Branch
------
REL9_0_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/4b099e1bff528a149129732e4d5a1bf020f842ea
Modified Files
--------------
src/backend/access/gin/README | 50 ++++++++++++++++++++++++++++++++++
src/backend/access/gin/ginbtree.c | 53 ++++++++++++++++++++++++++++--------
src/backend/access/gin/ginget.c | 25 ++++-------------
src/backend/access/gin/ginvacuum.c | 51 +++++++++++++++-------------------
src/include/access/gin.h | 1 +
5 files changed, 121 insertions(+), 59 deletions(-)
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2013-11-08 21:19:58 | Re: pgsql: Fix blatantly broken record_image_cmp() logic for pass-by-value |
Previous Message | Heikki Linnakangas | 2013-11-08 20:29:16 | pgsql: Fix race condition in GIN posting tree page deletion. |