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

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix double-XLogBeginInsert call in GIN page splits.
Date: 2015-06-28 19:17:55
Message-ID: E1Z9I5T-00064P-L8@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Heikki Linnakangas 2015-06-28 19:31:07 pgsql: Promote the assertion that XLogBeginInsert() is not called twice
Previous Message Heikki Linnakangas 2015-06-28 18:39:21 pgsql: Don't choke on files that are removed while pg_rewind runs.