Re: Re: PANIC: invalid index offnum: 186 when processing BRIN indexes in VACUUM
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: Michael Paquier <michael.paquier@gmail.com>,
Alvaro Herrera <alvherre@alvh.no-ip.org>,
PostgreSQL mailing lists <pgsql-hackers@postgresql.org>
Date: 2017-10-30T21:43:54Z
Lists: pgsql-hackers
Tomas Vondra <tomas.vondra@2ndquadrant.com> writes: > On 10/30/2017 09:03 PM, Tom Lane wrote: >> [ scratches head ... ] Not sure how that could've introduced any >> problems? Will look. > Not sure, but I can confirm Michael's findings - I've been unable to > reproduce the issue on 1a4be103a5 even after 20 minutes, and on > 24992c6db9 it failed after only 2. Hmm. The index offnum being complained of is one past the end of the lp array. I think I see what about that commit changed the behavior: the old code for PageIndexDeleteNoCompact never changed the length of the lp array, except in the corner case where the page is becoming completely empty. The new code will shorten the lp array (decrease phdr->pd_lower) if it's told to remove the last item. So if you make two successive calls specifying the same offnum, and it's the last one on the page, the second one will fail with the symptoms we see here. However, so far as I can see, a sequence like that would have failed before too, just with a different error message, because once the first call had marked the item unused, the second call would not see it as a candidate to match. So I'm not quite sure how that's related ... but it seems like it must be. Anyway, my opinion ATM is that PageIndexTupleDeleteNoCompact is fine, and what we're looking at is some kind of bug in summarize_range or brin_doupdate, causing them to pass a offset beyond the end of the page in some corner case. regards, tom lane
Commits
-
Fix BRIN summarization concurrent with extension
- ec42a1dcb30d 11.0 landed
- cf0612aa2c8f 9.5.10 landed
- bd8e2b3cf4cf 9.6.6 landed
- 37a856567c04 10.1 landed
-
Fix corner-case errors in brin_doupdate().
- 62a16572d571 11.0 landed
- a43cd427e703 9.6.6 landed
- 43276abc6f7e 9.5.10 landed
- 97ba7b8c87e1 10.1 landed
-
Rewrite PageIndexDeleteNoCompact into a form that only deletes 1 tuple.
- 24992c6db9fd 10.0 cited
-
Invent PageIndexTupleOverwrite, and teach BRIN and GiST to use it.
- b1328d78f88c 10.0 cited
-
Close some holes in BRIN page assignment
- ccc4c074994d 9.6.0 cited