Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit1191916

Browse files
committed
Remove dead push/pop rollback code. Vadim once planned to implement
transaction rollback via UNDO but I think that's highly unlikely tohappen, so we may as well remove the stubs. (Someday we ought torip out the stub xxx_undo routines, too.) Per Alvaro.
1 parent5db2e83 commit1191916

File tree

4 files changed

+7
-96
lines changed

4 files changed

+7
-96
lines changed

‎src/backend/access/heap/heapam.c

Lines changed: 3 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.185 2005/03/27 23:52:58 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.186 2005/03/28 01:50:32 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -53,9 +53,6 @@
5353
#include"pgstat.h"
5454

5555

56-
/* comments are in heap_update */
57-
staticxl_heaptid_locked_tuple_;
58-
staticvoid_heap_unlock_tuple(void*data);
5956
staticXLogRecPtrlog_heap_update(Relationreln,Bufferoldbuf,
6057
ItemPointerDatafrom,Buffernewbuf,HeapTuplenewtup,boolmove);
6158

@@ -1620,15 +1617,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
16201617
* context lock (but not the pin!) on the old tuple's buffer while we
16211618
* are off doing TOAST and/or table-file-extension work. We must mark
16221619
* the old tuple to show that it's already being updated, else other
1623-
* processes may try to update it themselves. To avoid second XLOG log
1624-
* record, we use xact mgr hook to unlock old tuple without reading
1625-
* log if xact will abort before update is logged. In the event of
1626-
* crash prio logging, TQUAL routines will see HEAP_XMAX_UNLOGGED
1627-
* flag...
1628-
*
1629-
* NOTE: this trick is useless currently but saved for future when we'll
1630-
* implement UNDO and will re-use transaction IDs after postmaster
1631-
* startup.
1620+
* processes may try to update it themselves.
16321621
*
16331622
* We need to invoke the toaster if there are already any out-of-line
16341623
* toasted values present, or if the new tuple is over-threshold.
@@ -1642,15 +1631,10 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
16421631

16431632
if (need_toast||newtupsize>pagefree)
16441633
{
1645-
_locked_tuple_.node=relation->rd_node;
1646-
_locked_tuple_.tid=oldtup.t_self;
1647-
XactPushRollback(_heap_unlock_tuple, (void*)&_locked_tuple_);
1648-
16491634
oldtup.t_data->t_infomask &= ~(HEAP_XMAX_COMMITTED |
16501635
HEAP_XMAX_INVALID |
16511636
HEAP_MARKED_FOR_UPDATE |
16521637
HEAP_MOVED);
1653-
oldtup.t_data->t_infomask |=HEAP_XMAX_UNLOGGED;
16541638
HeapTupleHeaderSetXmax(oldtup.t_data,xid);
16551639
HeapTupleHeaderSetCmax(oldtup.t_data,cid);
16561640
already_marked= true;
@@ -1731,12 +1715,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
17311715

17321716
RelationPutHeapTuple(relation,newbuf,newtup);/* insert new tuple */
17331717

1734-
if (already_marked)
1735-
{
1736-
oldtup.t_data->t_infomask &= ~HEAP_XMAX_UNLOGGED;
1737-
XactPopRollback();
1738-
}
1739-
else
1718+
if (!already_marked)
17401719
{
17411720
oldtup.t_data->t_infomask &= ~(HEAP_XMAX_COMMITTED |
17421721
HEAP_XMAX_INVALID |
@@ -2585,48 +2564,6 @@ newsame:;
25852564

25862565
}
25872566

2588-
staticvoid
2589-
_heap_unlock_tuple(void*data)
2590-
{
2591-
TransactionIdxid=GetCurrentTransactionId();
2592-
xl_heaptid*xltid= (xl_heaptid*)data;
2593-
Relationreln=XLogOpenRelation(false,RM_HEAP_ID,xltid->node);
2594-
Bufferbuffer;
2595-
Pagepage;
2596-
OffsetNumberoffnum;
2597-
ItemIdlp;
2598-
HeapTupleHeaderhtup;
2599-
2600-
if (!RelationIsValid(reln))
2601-
elog(PANIC,"_heap_unlock_tuple: can't open relation");
2602-
2603-
buffer=XLogReadBuffer(false,reln,
2604-
ItemPointerGetBlockNumber(&(xltid->tid)));
2605-
if (!BufferIsValid(buffer))
2606-
elog(PANIC,"_heap_unlock_tuple: can't read buffer");
2607-
2608-
page= (Page)BufferGetPage(buffer);
2609-
if (PageIsNew((PageHeader)page))
2610-
elog(PANIC,"_heap_unlock_tuple: uninitialized page");
2611-
2612-
offnum=ItemPointerGetOffsetNumber(&(xltid->tid));
2613-
if (offnum>PageGetMaxOffsetNumber(page))
2614-
elog(PANIC,"_heap_unlock_tuple: invalid itemid");
2615-
lp=PageGetItemId(page,offnum);
2616-
2617-
if (!ItemIdIsUsed(lp)||ItemIdDeleted(lp))
2618-
elog(PANIC,"_heap_unlock_tuple: unused/deleted tuple in rollback");
2619-
2620-
htup= (HeapTupleHeader)PageGetItem(page,lp);
2621-
2622-
if (!TransactionIdEquals(HeapTupleHeaderGetXmax(htup),xid))
2623-
elog(PANIC,"_heap_unlock_tuple: invalid xmax in rollback");
2624-
htup->t_infomask &= ~HEAP_XMAX_UNLOGGED;
2625-
htup->t_infomask |=HEAP_XMAX_INVALID;
2626-
LockBuffer(buffer,BUFFER_LOCK_UNLOCK);
2627-
WriteBuffer(buffer);
2628-
}
2629-
26302567
void
26312568
heap_redo(XLogRecPtrlsn,XLogRecord*record)
26322569
{

‎src/backend/access/transam/xact.c

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.197 2005/02/20 21:46:48 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.198 2005/03/28 01:50:33 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -196,9 +196,6 @@ typedef struct SubXactCallbackItem
196196

197197
staticSubXactCallbackItem*SubXact_callbacks=NULL;
198198

199-
staticvoid (*_RollbackFunc) (void*)=NULL;
200-
staticvoid*_RollbackData=NULL;
201-
202199

203200
/* local function prototypes */
204201
staticvoidAssignSubTransactionId(TransactionStates);
@@ -3902,21 +3899,3 @@ xact_desc(char *buf, uint8 xl_info, char *rec)
39023899
else
39033900
strcat(buf,"UNKNOWN");
39043901
}
3905-
3906-
void
3907-
XactPushRollback(void (*func) (void*),void*data)
3908-
{
3909-
#ifdefXLOG_II
3910-
if (_RollbackFunc!=NULL)
3911-
elog(PANIC,"XactPushRollback: already installed");
3912-
#endif
3913-
3914-
_RollbackFunc=func;
3915-
_RollbackData=data;
3916-
}
3917-
3918-
void
3919-
XactPopRollback(void)
3920-
{
3921-
_RollbackFunc=NULL;
3922-
}

‎src/include/access/htup.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/access/htup.h,v 1.72 2004/12/31 22:03:21 pgsql Exp $
10+
* $PostgreSQL: pgsql/src/include/access/htup.h,v 1.73 2005/03/28 01:50:34 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -152,9 +152,7 @@ typedef HeapTupleHeaderData *HeapTupleHeader;
152152
* attribute(s) */
153153
#defineHEAP_HASEXTENDED0x000C/* the two above combined */
154154
#defineHEAP_HASOID0x0010/* has an object-id field */
155-
/* 0x0020 and 0x0040 are unused */
156-
#defineHEAP_XMAX_UNLOGGED0x0080/* to lock tuple for update
157-
* without logging */
155+
/* 0x0020, 0x0040 and 0x0080 are unused */
158156
#defineHEAP_XMIN_COMMITTED0x0100/* t_xmin committed */
159157
#defineHEAP_XMIN_INVALID0x0200/* t_xmin invalid/aborted */
160158
#defineHEAP_XMAX_COMMITTED0x0400/* t_xmax committed */

‎src/include/access/xact.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/access/xact.h,v 1.74 2004/12/31 22:03:21 pgsql Exp $
10+
* $PostgreSQL: pgsql/src/include/access/xact.h,v 1.75 2005/03/28 01:50:34 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -145,9 +145,6 @@ extern void RecordTransactionCommit(void);
145145

146146
externintxactGetCommittedChildren(TransactionId**ptr);
147147

148-
externvoidXactPushRollback(void (*func) (void*),void*data);
149-
externvoidXactPopRollback(void);
150-
151148
externvoidxact_redo(XLogRecPtrlsn,XLogRecord*record);
152149
externvoidxact_undo(XLogRecPtrlsn,XLogRecord*record);
153150
externvoidxact_desc(char*buf,uint8xl_info,char*rec);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp