pgsql: Fix handling of all-zero pages in SP-GiST vacuum.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix handling of all-zero pages in SP-GiST vacuum.
Date: 2015-07-27 15:15:15
Message-ID: E1ZJk7X-0001dF-Bq@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix handling of all-zero pages in SP-GiST vacuum.

SP-GiST initialized an all-zeros page at vacuum, but that was not
WAL-logged, which is not safe. You might get a torn page write, when it gets
flushed to disk, and end-up with a half-initialized index page. To fix,
leave it in the all-zeros state, and add it to the FSM. It will be
initialized when reused. Also don't set the page-deleted flag when recycling
an empty page. That was also not WAL-logged, and a torn write of that would
cause the page to have an invalid checksum.

Backpatch to 9.2, where SP-GiST indexes were added.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/023430abf72eb7d335430e241065d5ed19ddd94b

Modified Files
--------------
src/backend/access/spgist/spgvacuum.c | 27 ++++++++-------------------
src/include/access/spgist_private.h | 4 ++--
2 files changed, 10 insertions(+), 21 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2015-07-27 15:36:51 Re: pgsql: Fix handling of all-zero pages in SP-GiST vacuum.
Previous Message Heikki Linnakangas 2015-07-27 08:53:18 pgsql: Remove false comment about speculative insertion.