diff options
Diffstat (limited to 'src/backend/access/nbtree')
-rw-r--r-- | src/backend/access/nbtree/nbtpage.c | 10 | ||||
-rw-r--r-- | src/backend/access/nbtree/nbtxlog.c | 67 |
2 files changed, 41 insertions, 36 deletions
diff --git a/src/backend/access/nbtree/nbtpage.c b/src/backend/access/nbtree/nbtpage.c index cb94c76bcc..5e9e7b9270 100644 --- a/src/backend/access/nbtree/nbtpage.c +++ b/src/backend/access/nbtree/nbtpage.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtpage.c,v 1.122 2010/03/28 09:27:01 sriggs Exp $ + * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtpage.c,v 1.123 2010/07/06 19:18:55 momjian Exp $ * * NOTES * Postgres btree pages look like ordinary relation pages. The opaque @@ -720,7 +720,7 @@ _bt_page_recyclable(Page page) */ void _bt_delitems_vacuum(Relation rel, Buffer buf, - OffsetNumber *itemnos, int nitems, BlockNumber lastBlockVacuumed) + OffsetNumber *itemnos, int nitems, BlockNumber lastBlockVacuumed) { Page page = BufferGetPage(buf); BTPageOpaque opaque; @@ -797,7 +797,7 @@ _bt_delitems_vacuum(Relation rel, Buffer buf, void _bt_delitems_delete(Relation rel, Buffer buf, - OffsetNumber *itemnos, int nitems, Relation heapRel) + OffsetNumber *itemnos, int nitems, Relation heapRel) { Page page = BufferGetPage(buf); BTPageOpaque opaque; @@ -847,8 +847,8 @@ _bt_delitems_delete(Relation rel, Buffer buf, rdata[0].next = &(rdata[1]); /* - * We need the target-offsets array whether or not we store the - * to allow us to find the latestRemovedXid on a standby server. + * We need the target-offsets array whether or not we store the to + * allow us to find the latestRemovedXid on a standby server. */ rdata[1].data = (char *) itemnos; rdata[1].len = nitems * sizeof(OffsetNumber); diff --git a/src/backend/access/nbtree/nbtxlog.c b/src/backend/access/nbtree/nbtxlog.c index 97b920feea..3261483475 100644 --- a/src/backend/access/nbtree/nbtxlog.c +++ b/src/backend/access/nbtree/nbtxlog.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtxlog.c,v 1.68 2010/04/30 06:34:29 heikki Exp $ + * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtxlog.c,v 1.69 2010/07/06 19:18:55 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -568,23 +568,26 @@ static TransactionId btree_xlog_delete_get_latestRemovedXid(XLogRecord *record) { xl_btree_delete *xlrec = (xl_btree_delete *) XLogRecGetData(record); - OffsetNumber *unused; - Buffer ibuffer, hbuffer; - Page ipage, hpage; - ItemId iitemid, hitemid; - IndexTuple itup; + OffsetNumber *unused; + Buffer ibuffer, + hbuffer; + Page ipage, + hpage; + ItemId iitemid, + hitemid; + IndexTuple itup; HeapTupleHeader htuphdr; - BlockNumber hblkno; - OffsetNumber hoffnum; - TransactionId latestRemovedXid = InvalidTransactionId; - TransactionId htupxid = InvalidTransactionId; - int i; + BlockNumber hblkno; + OffsetNumber hoffnum; + TransactionId latestRemovedXid = InvalidTransactionId; + TransactionId htupxid = InvalidTransactionId; + int i; /* - * If there's nothing running on the standby we don't need to derive - * a full latestRemovedXid value, so use a fast path out of here. - * That returns InvalidTransactionId, and so will conflict with - * users, but since we just worked out that's zero people, its OK. + * If there's nothing running on the standby we don't need to derive a + * full latestRemovedXid value, so use a fast path out of here. That + * returns InvalidTransactionId, and so will conflict with users, but + * since we just worked out that's zero people, its OK. */ if (CountDBBackends(InvalidOid) == 0) return latestRemovedXid; @@ -598,8 +601,8 @@ btree_xlog_delete_get_latestRemovedXid(XLogRecord *record) ipage = (Page) BufferGetPage(ibuffer); /* - * Loop through the deleted index items to obtain the TransactionId - * from the heap items they point to. + * Loop through the deleted index items to obtain the TransactionId from + * the heap items they point to. */ unused = (OffsetNumber *) ((char *) xlrec + SizeOfBtreeDelete); @@ -624,8 +627,8 @@ btree_xlog_delete_get_latestRemovedXid(XLogRecord *record) hpage = (Page) BufferGetPage(hbuffer); /* - * Look up the heap tuple header that the index tuple points at - * by using the heap node supplied with the xlrec. We can't use + * Look up the heap tuple header that the index tuple points at by + * using the heap node supplied with the xlrec. We can't use * heap_fetch, since it uses ReadBuffer rather than XLogReadBuffer. * Note that we are not looking at tuple data here, just headers. */ @@ -651,8 +654,8 @@ btree_xlog_delete_get_latestRemovedXid(XLogRecord *record) htuphdr = (HeapTupleHeader) PageGetItem(hpage, hitemid); /* - * Get the heap tuple's xmin/xmax and ratchet up the latestRemovedXid. - * No need to consider xvac values here. + * Get the heap tuple's xmin/xmax and ratchet up the + * latestRemovedXid. No need to consider xvac values here. */ htupxid = HeapTupleHeaderGetXmin(htuphdr); if (TransactionIdFollows(htupxid, latestRemovedXid)) @@ -667,7 +670,8 @@ btree_xlog_delete_get_latestRemovedXid(XLogRecord *record) /* * Conjecture: if hitemid is dead then it had xids before the xids * marked on LP_NORMAL items. So we just ignore this item and move - * onto the next, for the purposes of calculating latestRemovedxids. + * onto the next, for the purposes of calculating + * latestRemovedxids. */ } else @@ -679,13 +683,12 @@ btree_xlog_delete_get_latestRemovedXid(XLogRecord *record) UnlockReleaseBuffer(ibuffer); /* - * Note that if all heap tuples were LP_DEAD then we will be - * returning InvalidTransactionId here. That can happen if we are - * re-replaying this record type, though that will be before the - * consistency point and will not cause problems. It should - * happen very rarely after the consistency point, though note - * that we can't tell the difference between this and the fast - * path exit above. May need to change that in future. + * Note that if all heap tuples were LP_DEAD then we will be returning + * InvalidTransactionId here. That can happen if we are re-replaying this + * record type, though that will be before the consistency point and will + * not cause problems. It should happen very rarely after the consistency + * point, though note that we can't tell the difference between this and + * the fast path exit above. May need to change that in future. */ return latestRemovedXid; } @@ -954,6 +957,7 @@ btree_redo(XLogRecPtr lsn, XLogRecord *record) switch (info) { case XLOG_BTREE_DELETE: + /* * Btree delete records can conflict with standby queries. You * might think that vacuum records would conflict as well, but @@ -972,6 +976,7 @@ btree_redo(XLogRecPtr lsn, XLogRecord *record) break; case XLOG_BTREE_REUSE_PAGE: + /* * Btree reuse page records exist to provide a conflict point * when we reuse pages in the index via the FSM. That's all it @@ -1143,7 +1148,7 @@ btree_desc(StringInfo buf, uint8 xl_info, char *rec) xl_btree_delete *xlrec = (xl_btree_delete *) rec; appendStringInfo(buf, "delete: index %u/%u/%u; iblk %u, heap %u/%u/%u;", - xlrec->node.spcNode, xlrec->node.dbNode, xlrec->node.relNode, + xlrec->node.spcNode, xlrec->node.dbNode, xlrec->node.relNode, xlrec->block, xlrec->hnode.spcNode, xlrec->hnode.dbNode, xlrec->hnode.relNode); break; @@ -1176,7 +1181,7 @@ btree_desc(StringInfo buf, uint8 xl_info, char *rec) appendStringInfo(buf, "reuse_page: rel %u/%u/%u; latestRemovedXid %u", xlrec->node.spcNode, xlrec->node.dbNode, - xlrec->node.relNode, xlrec->latestRemovedXid); + xlrec->node.relNode, xlrec->latestRemovedXid); break; } default: |