From a45c70acf35e43257d86313dcbb7bb0e5201fab1 Mon Sep 17 00:00:00 2001 From: Heikki Linnakangas Date: Sun, 28 Jun 2015 21:59:29 +0300 Subject: 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. --- src/backend/access/gin/ginentrypage.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/backend/access/gin/ginentrypage.c') diff --git a/src/backend/access/gin/ginentrypage.c b/src/backend/access/gin/ginentrypage.c index 9997eae1bcd..c912e60a112 100644 --- a/src/backend/access/gin/ginentrypage.c +++ b/src/backend/access/gin/ginentrypage.c @@ -557,6 +557,7 @@ entryPlaceToPage(GinBtree btree, Buffer buf, GinBtreeStack *stack, data.isDelete = insertData->isDelete; data.offset = off; + XLogBeginInsert(); XLogRegisterBuffer(0, buf, REGBUF_STANDARD); XLogRegisterBufData(0, (char *) &data, offsetof(ginxlogInsertEntry, tuple)); -- cgit v1.2.3