Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 1f42d35

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 3546cf8 commit 1f42d35

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/backend/access/brin/brin_revmap.c

+10-3
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)