pgsql: Fix double-XLogBeginInsert call in GIN page splits. - Mailing list pgsql-committers

From Heikki Linnakangas
Subject pgsql: Fix double-XLogBeginInsert call in GIN page splits.
Date
Msg-id E1Z9I5T-00064P-L8@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix double-XLogBeginInsert call in GIN page splits.

If data checksums or wal_log_hints is on, and a GIN page is split, the code
to find a new, empty, block was called after having already called
XLogBeginInsert(). That causes an assertion failure or PANIC, if finding the
new block involves updating a FSM page that had not been modified since last
checkpoint, because that update is WAL-logged, which calls XLogBeginInsert
again. Nested XLogBeginInsert calls are not supported.

To fix, rearrange GIN code so that XLogBeginInsert is called later, after
finding the victim buffers.

Reported by Jeff Janes.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/a45c70acf35e43257d86313dcbb7bb0e5201fab1

Modified Files
--------------
src/backend/access/gin/ginbtree.c     |   15 ++++++---------
src/backend/access/gin/gindatapage.c  |    4 ++++
src/backend/access/gin/ginentrypage.c |    1 +
3 files changed, 11 insertions(+), 9 deletions(-)


pgsql-committers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: pgsql: Don't choke on files that are removed while pg_rewind runs.
Next
From: Heikki Linnakangas
Date:
Subject: pgsql: Promote the assertion that XLogBeginInsert() is not called twice