Skip to content

Commit 8782ea2

Browse files
committed
BRIN: Handle concurrent desummarization properly
If a page range is desummarized at just the right time concurrently with an index walk, BRIN would raise an error indicating index corruption. This is scary and unhelpful; silently returning that the page range is not summarized is sufficient reaction. This bug was introduced by commit 975ad4e as additional protection against a bug whose actual fix was elsewhere. Backpatch equally. Reported-By: Anastasia Lubennikova <a.lubennikova@postgrespro.ru> Diagnosed-By: Alexander Lakhin <exclusion@gmail.com> Discussion: https://postgr.es/m/2588667e-d07d-7e10-74e2-7e1e46194491@postgrespro.ru Backpatch: 9.5 - master
1 parent 1754a71 commit 8782ea2

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/backend/access/brin/brin_revmap.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,17 @@ brinGetTupleForHeapBlock(BrinRevmap *revmap, BlockNumber heapBlk,
282282
/* If we land on a revmap page, start over */
283283
if (BRIN_IS_REGULAR_PAGE(page))
284284
{
285+
/*
286+
* If the offset number is greater than what's in the page, it's
287+
* possible that the range was desummarized concurrently. Just
288+
* return NULL to handle that case.
289+
*/
285290
if (*off > PageGetMaxOffsetNumber(page))
286-
ereport(ERROR,
287-
(errcode(ERRCODE_INDEX_CORRUPTED),
288-
errmsg_internal("corrupted BRIN index: inconsistent range map")));
291+
{
292+
LockBuffer(*buf, BUFFER_LOCK_UNLOCK);
293+
return NULL;
294+
}
295+
289296
lp = PageGetItemId(page, *off);
290297
if (ItemIdIsUsed(lp))
291298
{

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy