Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7a3c261

Browse filesBrowse 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 03f5894 commit 7a3c261
Copy full SHA for 7a3c261

File tree

Expand file treeCollapse file tree

1 file changed

+10
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+10
-3
lines changed

‎src/backend/access/brin/brin_revmap.c

Copy file name to clipboardExpand all lines: src/backend/access/brin/brin_revmap.c
+10-3Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,17 @@ brinGetTupleForHeapBlock(BrinRevmap *revmap, BlockNumber heapBlk,
272272
/* If we land on a revmap page, start over */
273273
if (BRIN_IS_REGULAR_PAGE(page))
274274
{
275+
/*
276+
* If the offset number is greater than what's in the page, it's
277+
* possible that the range was desummarized concurrently. Just
278+
* return NULL to handle that case.
279+
*/
275280
if (*off > PageGetMaxOffsetNumber(page))
276-
ereport(ERROR,
277-
(errcode(ERRCODE_INDEX_CORRUPTED),
278-
errmsg_internal("corrupted BRIN index: inconsistent range map")));
281+
{
282+
LockBuffer(*buf, BUFFER_LOCK_UNLOCK);
283+
return NULL;
284+
}
285+
279286
lp = PageGetItemId(page, *off);
280287
if (ItemIdIsUsed(lp))
281288
{

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.