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

Commite1a118e

Browse files
committed
unlock buffer before releasing in heap_insert
+unlock buffer in heap_fetch under !ItemIdIsUsed().
1 parent13647ad commite1a118e

File tree

1 file changed

+50
-9
lines changed

1 file changed

+50
-9
lines changed

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

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.77 2000/07/03 23:58:32 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.78 2000/07/04 01:39:24 vadim Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -1125,6 +1125,7 @@ heap_fetch(Relation relation,
11251125

11261126
if (!ItemIdIsUsed(lp))
11271127
{
1128+
LockBuffer(buffer,BUFFER_LOCK_UNLOCK);
11281129
ReleaseBuffer(buffer);
11291130
*userbuf=InvalidBuffer;
11301131
tuple->t_datamcxt=NULL;
@@ -1331,17 +1332,17 @@ heap_insert(Relation relation, HeapTuple tup)
13311332
xlrec.mask=tup->t_data->t_infomask;
13321333

13331334
XLogRecPtrrecptr=XLogInsert(RM_HEAP_ID,XLOG_HEAP_INSERT,
1334-
(char*)xlrec,sizeof(xlrec),
1335-
(char*)tup->t_data+ offsetof(HeapTupleHeaderData,tbits),
1336-
tup->t_len- offsetof(HeapTupleHeaderData,tbits));
1335+
(char*)xlrec,SizeOfHeapInsert,
1336+
(char*)tup->t_data+ offsetof(HeapTupleHeaderData,t_bits),
1337+
tup->t_len- offsetof(HeapTupleHeaderData,t_bits));
13371338

13381339
((PageHeader)BufferGetPage(buffer))->pd_lsn=recptr;
13391340
((PageHeader)BufferGetPage(buffer))->pd_sui=ThisStartUpID;
13401341
}
13411342
#endif
13421343

1343-
WriteBuffer(buffer);
13441344
LockBuffer(buffer,BUFFER_LOCK_UNLOCK);
1345+
WriteBuffer(buffer);
13451346

13461347
if (IsSystemRelationName(RelationGetRelationName(relation)))
13471348
RelationMark4RollbackHeapTuple(relation,tup);
@@ -1440,7 +1441,7 @@ heap_delete(Relation relation, ItemPointer tid, ItemPointer ctid)
14401441
xlrec.dtid.cid=GetCurrentCommandId();
14411442
xlrec.dtid.tid=tp.t_self;
14421443
XLogRecPtrrecptr=XLogInsert(RM_HEAP_ID,XLOG_HEAP_DELETE,
1443-
(char*)xlrec,sizeof(xlrec),NULL,0);
1444+
(char*)xlrec,SizeOfHeapDelete,NULL,0);
14441445

14451446
dp->pd_lsn=recptr;
14461447
dp->pd_sui=ThisStartUpID;
@@ -1610,9 +1611,9 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
16101611
xlrec.mask=newtup->t_data->t_infomask;
16111612

16121613
XLogRecPtrrecptr=XLogInsert(RM_HEAP_ID,XLOG_HEAP_UPDATE,
1613-
(char*)xlrec,sizeof(xlrec),
1614-
(char*)newtup->t_data+ offsetof(HeapTupleHeaderData,tbits),
1615-
newtup->t_len- offsetof(HeapTupleHeaderData,tbits));
1614+
(char*)xlrec,SizeOfHeapUpdate,
1615+
(char*)newtup->t_data+ offsetof(HeapTupleHeaderData,t_bits),
1616+
newtup->t_len- offsetof(HeapTupleHeaderData,t_bits));
16161617

16171618
if (newbuf!=buffer)
16181619
{
@@ -1907,3 +1908,43 @@ heap_restrpos(HeapScanDesc scan)
19071908
(ScanKey)NULL);
19081909
}
19091910
}
1911+
1912+
#ifdefXLOG
1913+
voidheap_redo(XLogRecPtrlsn,XLogRecord*record)
1914+
{
1915+
uint8info=record->xl_info& ~XLR_INFO_MASK;
1916+
1917+
if (info==XLOG_HEAP_INSERT)
1918+
heap_xlog_insert(true,lsn,record);
1919+
elseif (info==XLOG_HEAP_DELETE)
1920+
heap_xlog_delete(true,lsn,record);
1921+
elseif (info==XLOG_HEAP_UPDATE)
1922+
heap_xlog_update(true,lsn,record);
1923+
elseif (info==XLOG_HEAP_MOVE)
1924+
heap_xlog_move(true,lsn,record);
1925+
else
1926+
elog(STOP,"heap_redo: unknown op code %u",info);
1927+
}
1928+
1929+
voidheap_undo(XLogRecPtrlsn,XLogRecord*record)
1930+
{
1931+
uint8info=record->xl_info& ~XLR_INFO_MASK;
1932+
1933+
if (info==XLOG_HEAP_INSERT)
1934+
heap_xlog_insert(false,lsn,record);
1935+
elseif (info==XLOG_HEAP_DELETE)
1936+
heap_xlog_delete(false,lsn,record);
1937+
elseif (info==XLOG_HEAP_UPDATE)
1938+
heap_xlog_update(false,lsn,record);
1939+
elseif (info==XLOG_HEAP_MOVE)
1940+
heap_xlog_move(false,lsn,record);
1941+
else
1942+
elog(STOP,"heap_undo: unknown op code %u",info);
1943+
}
1944+
1945+
voidheap_xlog_insert(boolredo,XLogRecPtrlsn,XLogRecord*record)
1946+
{
1947+
xl_heap_insertxlrec=XLogRecGetData(record);
1948+
}
1949+
1950+
#endif/* XLOG */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp