Jeff Janes wrote: > On replica: > > set enable_seqscan TO off; > explain (analyze) select count(*) from foobar ; > ERROR: corrupted BRIN index: inconsistent range map
Nice. As I understand it, the problem is that the replay is using the block number of the revmap page as target blkno of the revmap entry, when it should be using the block number of the data page. This should fix it. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
commit 622a903cf88931878cbaba9bdd25c9835af0d055 Author: Alvaro Herrera <alvhe...@alvh.no-ip.org> Date: Fri Jun 26 15:33:19 2015 -0300 Fix BRIN xlog replay diff --git a/src/backend/access/brin/brin_xlog.c b/src/backend/access/brin/brin_xlog.c index 49261aa..e68f623 100644 --- a/src/backend/access/brin/brin_xlog.c +++ b/src/backend/access/brin/brin_xlog.c @@ -47,6 +47,7 @@ brin_xlog_insert_update(XLogReaderState *record, { XLogRecPtr lsn = record->EndRecPtr; Buffer buffer; + BlockNumber blkno; Page page; XLogRedoAction action; @@ -66,6 +67,8 @@ brin_xlog_insert_update(XLogReaderState *record, action = XLogReadBufferForRedo(record, 0, &buffer); } + blkno = BufferGetBlockNumber(buffer); + /* insert the index item into the page */ if (action == BLK_NEEDS_REDO) { @@ -97,7 +100,6 @@ brin_xlog_insert_update(XLogReaderState *record, if (action == BLK_NEEDS_REDO) { ItemPointerData tid; - BlockNumber blkno = BufferGetBlockNumber(buffer); ItemPointerSet(&tid, blkno, xlrec->offnum); page = (Page) BufferGetPage(buffer);
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers