Re: BRIN indexes - TRAP: BadArgument
Alvaro Herrera <alvherre@2ndquadrant.com>
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Fujii Masao <masao.fujii@gmail.com>
Cc: Jeff Janes <jeff.janes@gmail.com>, Robert Haas <robertmhaas@gmail.com>,
Heikki Linnakangas <hlinnakangas@vmware.com>,
Erik Rijkers <er@xs4all.nl>, Emanuel Calvo <3manuek@esdebian.org>,
Simon Riggs <simon@2ndquadrant.com>,
Nicolas Barbier <nicolas.barbier@gmail.com>,
Claudio Freire <klaussfreire@gmail.com>, Josh Berkus <josh@agliodbs.com>,
Andres Freund <andres@2ndquadrant.com>,
Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2014-11-10T20:39:11Z
Lists: pgsql-hackers
Attachments
- brinxlog.patch (text/x-diff) patch
Fujii Masao wrote: > I got the following PANIC error in the standby server when I set up > the replication servers and ran "make installcheck". Note that I was > repeating the manual CHECKPOINT every second while "installcheck" > was running. Without the checkpoints, I could not reproduce the > problem. I'm not sure if CHECKPOINT really triggers this problem, though. > Anyway BRIN seems to have a problem around its WAL replay. Hm, I think I see what's happening. The xl_brin_update record references two buffers, one which is target for the updated tuple and another which is the revmap buffer. When the update target buffer is being first used we set the INIT bit which removes the buffer reference from the xlog record; in that case, if the revmap buffer is first being modified after the prior checkpoint, that revmap buffer receives backup block number 0; but the code hardcodes it as 1 on the expectation that the buffer that's target for the update will receive 0. The attached patch should fix this. I cannot reproduce the issue after applying this patch, can you please confirm that it fixes the issue for you as well? -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services
Commits
-
Refactor per-page logic common to all redo routines to a new function.
- f8f4227976a2 9.5.0 cited
-
Reduce use of heavyweight locking inside hash AM.
- 76837c1507cb 9.3.0 cited
-
Scan the buffer pool just once, not once per fork, during relation drop.
- ece01aae4792 9.2.0 cited
-
Major patch from Thomas Lockhart <Thomas.G.Lockhart@jpl.nasa.gov>
- 9e2a87b62db8 7.1.1 cited