I wrote:
> maybe
> we just have some run-of-the-mill bugs to find, like the off-the-end
> bug I spotted in brin_doupdate. There's apparently at least one
> more, but given the error message it must be something like not
> checking for a page to have turned into a revmap page. Shouldn't
> be too hard to find...
Actually, I think it might be as simple as the attached.
brin_getinsertbuffer checks for the old page having turned into revmap,
but the "samepage" path in brin_doupdate does not :-(
With this applied, Alvaro's version of the test case has survived
without error for quite a bit longer than its former MTBF. There
might still be some issues though in other code paths.
regards, tom lane
diff --git a/src/backend/access/brin/brin_pageops.c b/src/backend/access/brin/brin_pageops.c
index 80f803e..b0f86f3 100644
*** a/src/backend/access/brin/brin_pageops.c
--- b/src/backend/access/brin/brin_pageops.c
*************** brin_doupdate(Relation idxrel, BlockNumb
*** 113,121 ****
/*
* Check that the old tuple wasn't updated concurrently: it might have
! * moved someplace else entirely ...
*/
! if (!ItemIdIsNormal(oldlp))
{
LockBuffer(oldbuf, BUFFER_LOCK_UNLOCK);
--- 113,127 ----
/*
* Check that the old tuple wasn't updated concurrently: it might have
! * moved someplace else entirely, and for that matter the whole page
! * might've become a revmap page. Note that in the first two cases
! * checked here, the "oldlp" we just calculated is garbage; but
! * PageGetItemId() is simple enough that it was safe to do that
! * calculation anyway.
*/
! if (!BRIN_IS_REGULAR_PAGE(oldpage) ||
! oldoff > PageGetMaxOffsetNumber(oldpage) ||
! !ItemIdIsNormal(oldlp))
{
LockBuffer(oldbuf, BUFFER_LOCK_UNLOCK);
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers