]> granicus.if.org Git - postgresql/commit
Fix handling of all-zero pages in SP-GiST vacuum.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 27 Jul 2015 09:28:21 +0000 (12:28 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 27 Jul 2015 09:31:05 +0000 (12:31 +0300)
commit2fa8ba34804211714a6e0a7fcf5512423c77f8dd
tree6ee4e939140426a15d9fac9199f5b1410f8eda18
parent6a0a388c202098db207fff8e571f599296aa57d8
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.
src/backend/access/spgist/spgvacuum.c
src/include/access/spgist_private.h