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

Commit1b812d9

Browse files
committed
1. xact.c: update comments about changing MyProc->xid and MyProc->xmin.
2. varsup.c:ReadNewTransactionId(): don't read nextXid from disk - this func doesn't allocate next xid, so ShmemVariableCache->nextXid may be used (but GetNewTransactionId() must be called first).3. vacuum.c: change elog(ERROR, "Child item....") to elog(NOTICE) - this is not ERROR, proper handling is just not implemented, yet.4. s_lock.c: increase S_MAX_BUSY by 2 times.5. shmem.c:GetSnapshotData(): have to call ReadNewTransactionId() _after_ SpinAcquire(ShmemIndexLock).
1 parent48c1887 commit1b812d9

File tree

5 files changed

+44
-26
lines changed

5 files changed

+44
-26
lines changed

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.21 1999/06/03 04:41:40 vadim Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.22 1999/06/06 20:19:33 vadim Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -335,16 +335,13 @@ ReadNewTransactionId(TransactionId *xid)
335335

336336
SpinAcquire(OidGenLockId);/* not good for concurrency... */
337337

338-
if (ShmemVariableCache->xid_count==0)
339-
{
340-
TransactionIdnextid;
341-
342-
VariableRelationGetNextXid(&nextid);
343-
TransactionIdStore(nextid,&(ShmemVariableCache->nextXid));
344-
ShmemVariableCache->xid_count=VAR_XID_PREFETCH;
345-
TransactionIdAdd(&nextid,VAR_XID_PREFETCH);
346-
VariableRelationPutNextXid(nextid);
347-
}
338+
/*
339+
* Note that we don't check is ShmemVariableCache->xid_count equal
340+
* to 0 or not. This will work as long as we don't call
341+
* ReadNewTransactionId() before GetNewTransactionId().
342+
*/
343+
if (ShmemVariableCache->nextXid==0)
344+
elog(ERROR,"ReadNewTransactionId: ShmemVariableCache->nextXid is not initialized");
348345

349346
TransactionIdStore(ShmemVariableCache->nextXid,xid);
350347

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.39 1999/06/03 13:33:12 vadim Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.40 1999/06/06 20:19:34 vadim Exp $
1111
*
1212
* NOTES
1313
*Transaction aborts can now occur two ways:
@@ -942,15 +942,11 @@ CommitTransaction()
942942
/*
943943
* Let others know about no transaction in progress by me.
944944
* Note that this must be done _before_ releasing locks we hold
945-
* and SpinAcquire(ShmemIndexLock) is required - or bad (too high)
946-
* XmaxRecent value might be used by vacuum: UPDATE with xid 0 is
945+
* and SpinAcquire(ShmemIndexLock) is required: UPDATE with xid 0 is
947946
* blocked by xid 1' UPDATE, xid 1 is doing commit while xid 2
948947
* gets snapshot - if xid 2' GetSnapshotData sees xid 1 as running
949-
* then it must see xid 0 as running as well or XmaxRecent = 1
950-
* might be used by concurrent vacuum causing
951-
* ERROR: Child itemid marked as unused
952-
* This bug was reported by Hiroshi Inoue and I was able to reproduce
953-
* it with 3 sessions and gdb.- vadim 06/03/99
948+
* then it must see xid 0 as running as well or it will see two
949+
* tuple versions - one deleted by xid 1 and one inserted by xid 0.
954950
*/
955951
if (MyProc!= (PROC*)NULL)
956952
{

‎src/backend/commands/vacuum.c

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.106 1999/06/03 13:25:54 vadim Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.107 1999/06/06 20:19:34 vadim Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -1238,11 +1238,28 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
12381238
Citemid=PageGetItemId(Cpage,
12391239
ItemPointerGetOffsetNumber(&Ctid));
12401240
if (!ItemIdIsUsed(Citemid))
1241-
elog(ERROR,"Child itemid marked as unused");
1241+
{
1242+
/*
1243+
* This means that in the middle of chain there was
1244+
* tuple updated by older (than XmaxRecent) xaction
1245+
* and this tuple is already deleted by me. Actually,
1246+
* upper part of chain should be removed and seems
1247+
* that this should be handled in vc_scanheap(), but
1248+
* it's not implemented at the moment and so we
1249+
* just stop shrinking here.
1250+
*/
1251+
ReleaseBuffer(Cbuf);
1252+
pfree(vtmove);
1253+
vtmove=NULL;
1254+
elog(NOTICE,"Child itemid in update-chain marked as unused - can't continue vc_rpfheap");
1255+
break;
1256+
}
12421257
tp.t_data= (HeapTupleHeader)PageGetItem(Cpage,Citemid);
12431258
tp.t_self=Ctid;
12441259
tlen=tp.t_len=ItemIdGetLength(Citemid);
12451260
}
1261+
if (vtmove==NULL)
1262+
break;
12461263
/* first, can chain be moved ? */
12471264
for (;;)
12481265
{
@@ -1336,6 +1353,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
13361353
Ptp.t_data= (HeapTupleHeader)PageGetItem(Ppage,Pitemid);
13371354
Assert(Ptp.t_data->t_xmax==tp.t_data->t_xmin);
13381355

1356+
#ifdefNOT_USED/* I'm not sure that this will wotk properly... */
13391357
/*
13401358
* If this tuple is updated version of row and it
13411359
* was created by the same transaction then no one
@@ -1353,6 +1371,7 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
13531371
WriteBuffer(Pbuf);
13541372
continue;
13551373
}
1374+
#endif
13561375
tp.t_data=Ptp.t_data;
13571376
tlen=tp.t_len=ItemIdGetLength(Pitemid);
13581377
if (freeCbuf)
@@ -1763,7 +1782,7 @@ Elapsed %u/%u sec.",
17631782
page=BufferGetPage(buf);
17641783
num_tuples=0;
17651784
for (offnum=FirstOffsetNumber;
1766-
offnum<maxoff;
1785+
offnum <=maxoff;
17671786
offnum=OffsetNumberNext(offnum))
17681787
{
17691788
itemid=PageGetItemId(page,offnum);

‎src/backend/storage/buffer/s_lock.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/Attic/s_lock.c,v 1.20 1999/05/25 22:04:32 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/Attic/s_lock.c,v 1.21 1999/06/06 20:19:35 vadim Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -28,7 +28,7 @@
2828
* note: total time to cycle through all 16 entries might be about .07 sec.
2929
*/
3030
#defineS_NSPINCYCLE20
31-
#defineS_MAX_BUSY500 * S_NSPINCYCLE
31+
#defineS_MAX_BUSY1000 * S_NSPINCYCLE
3232

3333
ints_spincycle[S_NSPINCYCLE]=
3434
{0,0,0,0,10000,0,0,0,10000,0,

‎src/backend/storage/ipc/shmem.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.41 1999/06/03 13:33:13 vadim Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.42 1999/06/06 20:19:35 vadim Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -652,9 +652,15 @@ GetSnapshotData(bool serializable)
652652

653653
snapshot->xip= (TransactionId*)malloc(have*sizeof(TransactionId));
654654
snapshot->xmin=cid;
655-
ReadNewTransactionId(&(snapshot->xmax));
656655

657656
SpinAcquire(ShmemIndexLock);
657+
/*
658+
* Unfortunately, we have to call ReadNewTransactionId()
659+
* after acquiring ShmemIndexLock above. It's not good because of
660+
* ReadNewTransactionId() does SpinAcquire(OidGenLockId) but
661+
* _necessary_.
662+
*/
663+
ReadNewTransactionId(&(snapshot->xmax));
658664

659665
hash_seq((HTAB*)NULL);
660666
while ((result= (ShmemIndexEnt*)hash_seq(ShmemIndex))!=NULL)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp