From: Teodor Sigaev <teodor@sigaev.ru>
To: Craig McElroy <craig.mcelroy@contegix.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: PostgreSQL Admin List <pgsql-admin@postgresql.org>
Subject: Re: Problem with PITR Past Particular WAL File
Date: Fri, 26 Oct 2007 16:53:09 +0400
Message-ID: <4721E335.8090601@sigaev.ru> (raw)
In-Reply-To: <4E5ADC27-53C9-4A63-8BE2-7563E2EC89EB@contegix.com>
References: <FF045AC2-D3E0-4DC6-BE39-4925AE9AD804@contegix.com>
<10123.1193250394@sss.pgh.pa.us>
<1FAEADD9-FE4A-444E-9B45-D6192B0265E5@contegix.com>
<16979.1193327974@sss.pgh.pa.us>
<4720DAF9.6080002@sigaev.ru>
<4E5ADC27-53C9-4A63-8BE2-7563E2EC89EB@contegix.com>
Craig McElroy wrote:
> Teodor:
> Thanks for the followup. We will be upgrading this system to 8.2.5 in
> the next day or so and will test it on that anyways just to be sure it
> isn't related. Let me know if there is anything else we can provide to
> help track down the bug. We will be keeping this base backup and WAL
> files around so that we can use them for testing.
If I'm right then 8.2.5 will not help you. Attached patch should fix your
problem, but I suppose that there is an another bug. Test specially developed
for reproduce your problem discovers another issue. The diagnostic is:
FATAL: failed to add item to index page in 1663/10819/16460
CONTEXT: xlog redo Insert item, node: 1663/10819/16460 blkno: 514 offset: 78
nitem: 1 isdata: F isleaf F isdelete F updateBlkno:1551
Now I'm working on fixing it.
--
Teodor Sigaev E-mail: teodor@sigaev.ru
WWW: http://www.sigaev.ru/Attachments:fix_ginstate_usage.patch (text/plain, 2.8K) download
*** ./src/backend/access/gin.orig/ginentrypage.c Thu Oct 25 22:11:56 2007
--- ./src/backend/access/gin/ginentrypage.c Thu Oct 25 22:43:17 2007
***************
*** 404,409 ****
--- 404,434 ----
}
/*
+ * Returns new tuple with copied value from source tuple.+ * New tuple will not store posting list+ */+ static IndexTuple+ copyIndexTuple(IndexTuple itup, Page page)+ {+ IndexTuple nitup;+ + if (GinPageIsLeaf(page) && !GinIsPostingTree(itup))+ {+ nitup = (IndexTuple) palloc(MAXALIGN(GinGetOrigSizePosting(itup)));+ memcpy(nitup, itup, GinGetOrigSizePosting(itup));+ nitup->t_info &= ~INDEX_SIZE_MASK;+ nitup->t_info |= GinGetOrigSizePosting(itup);+ }+ else+ {+ nitup = (IndexTuple) palloc(MAXALIGN(IndexTupleSize(itup)));+ memcpy(nitup, itup, IndexTupleSize(itup));+ }+ + return nitup;+ }+ + /*
* Place tuple and split page, original buffer(lbuf) leaves untouched,
* returns shadow page of lbuf filled new data.
* Tuples are distributed between pages by equal size on its, not
***************
*** 424,431 ****
IndexTuple itup,
leftrightmost = NULL;
static ginxlogSplit data;
- Datum value;- bool isnull;
Page page;
Page lpage = GinPageGetCopyPage(BufferGetPage(lbuf));
Page rpage = BufferGetPage(rbuf);
--- 449,454 ----
***************
*** 494,502 ****
ptr += MAXALIGN(IndexTupleSize(itup));
}
! value = index_getattr(leftrightmost, FirstOffsetNumber, btree->ginstate->tupdesc, &isnull);
! btree->entry = GinFormTuple(btree->ginstate, value, NULL, 0);
ItemPointerSet(&(btree->entry)->t_tid, BufferGetBlockNumber(lbuf), InvalidOffsetNumber);
btree->rightblkno = BufferGetBlockNumber(rbuf);
data.node = btree->index->rd_node;
--- 517,525 ----
ptr += MAXALIGN(IndexTupleSize(itup));
}
! btree->entry = copyIndexTuple(leftrightmost, lpage);
ItemPointerSet(&(btree->entry)->t_tid, BufferGetBlockNumber(lbuf), InvalidOffsetNumber);
+
btree->rightblkno = BufferGetBlockNumber(rbuf);
data.node = btree->index->rd_node;
***************
*** 533,552 ****
Page page = BufferGetPage(buf);
itup = getRightMostTuple(page);
! if (GinPageIsLeaf(page) && !GinIsPostingTree(itup))
! {
! nitup = (IndexTuple) palloc(MAXALIGN(GinGetOrigSizePosting(itup)));
! memcpy(nitup, itup, GinGetOrigSizePosting(itup));
! nitup->t_info &= ~INDEX_SIZE_MASK;
! nitup->t_info |= GinGetOrigSizePosting(itup);
! }
! else
! {
! nitup = (IndexTuple) palloc(MAXALIGN(IndexTupleSize(itup)));
! memcpy(nitup, itup, IndexTupleSize(itup));
! }
!
ItemPointerSet(&nitup->t_tid, BufferGetBlockNumber(buf), InvalidOffsetNumber);
return nitup;
}
--- 556,564 ----
Page page = BufferGetPage(buf);
itup = getRightMostTuple(page);
! nitup = copyIndexTuple(itup, page);
ItemPointerSet(&nitup->t_tid, BufferGetBlockNumber(buf), InvalidOffsetNumber);
+
return nitup;
}
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: teodor@sigaev.ru, craig.mcelroy@contegix.com, tgl@sss.pgh.pa.us
Subject: Re: Problem with PITR Past Particular WAL File
In-Reply-To: <4721E335.8090601@sigaev.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox