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

Commit74cf8ee

Browse files
committed
./src cleanup
1 parent05c4d25 commit74cf8ee

File tree

14 files changed

+63
-226
lines changed

14 files changed

+63
-226
lines changed

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

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3270,7 +3270,7 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
32703270
oldtup.t_data= (HeapTupleHeader)PageGetItem(page,lp);
32713271
oldtup.t_len=ItemIdGetLength(lp);
32723272
oldtup.t_self=*otid;
3273-
3273+
32743274
/* the new tuple is ready, except for this: */
32753275
newtup->t_tableOid=RelationGetRelid(relation);
32763276

@@ -3630,21 +3630,6 @@ heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
36303630
newtup->t_data->t_infomask2 |=infomask2_new_tuple;
36313631
HeapTupleHeaderSetXmax(newtup->t_data,xmax_new_tuple);
36323632

3633-
#if0
3634-
{
3635-
Snapshots=GetTransactionSnapshot();
3636-
fprintf(stderr,"pid=%d transaction %d update tuple: old.ctid=[%x-%x,%x], old.xmin=%d, old.xmax=%d, old.mask=%x, new.xmin=%d, new.xmax=%d, new.flags=%x, snap.xmin=%d, snap.xmax=%d\n",
3637-
getpid(),xid,
3638-
oldtup.t_data->t_ctid.ip_blkid.bi_hi,
3639-
oldtup.t_data->t_ctid.ip_blkid.bi_lo,
3640-
oldtup.t_data->t_ctid.ip_posid,
3641-
HeapTupleHeaderGetRawXmin(oldtup.t_data),HeapTupleHeaderGetRawXmax(oldtup.t_data),oldtup.t_data->t_infomask,
3642-
xid,xmax_new_tuple,infomask_new_tuple,
3643-
s->xmin,s->xmax);
3644-
}
3645-
Assert(xmax_new_tuple!=xid|| (newtup->t_data->t_infomask&HEAP_XMAX_LOCK_ONLY)!=0);
3646-
#endif
3647-
36483633
/*
36493634
* Replace cid with a combo cid if necessary. Note that we already put
36503635
* the plain cid into the new tuple.
@@ -7606,10 +7591,10 @@ heap_xlog_visible(XLogReaderState *record)
76067591
* we did for the heap page. If this results in a dropped bit, no
76077592
* real harm is done; and the next VACUUM will fix it.
76087593
*/
7609-
if (lsn>PageGetLSN(vmpage)) {
7594+
if (lsn>PageGetLSN(vmpage))
76107595
visibilitymap_set(reln,blkno,InvalidBuffer,lsn,vmbuffer,
76117596
xlrec->cutoff_xid);
7612-
}
7597+
76137598
ReleaseBuffer(vmbuffer);
76147599
FreeFakeRelcacheEntry(reln);
76157600
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ heap_page_prune_opt(Relation relation, Buffer buffer)
9898
OldestXmin=RecentGlobalXmin;
9999
else
100100
OldestXmin=RecentGlobalDataXmin;
101-
//fprintf(stderr, "pid=%d PRUNEHEAP: xmin=%d\n", getpid(), OldestXmin);
101+
102102
Assert(TransactionIdIsValid(OldestXmin));
103103

104104
/*

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,10 +254,6 @@ visibilitymap_set(Relation rel, BlockNumber heapBlk, Buffer heapBuf,
254254
Pagepage;
255255
char*map;
256256

257-
#if0
258-
fprintf(stderr,"Visibilitymap cutoff %d, RecentLocalDataXmin=%d\n",cutoff_xid,RecentGlobalDataXmin);
259-
// return;
260-
#endif
261257
#ifdefTRACE_VISIBILITYMAP
262258
elog(DEBUG1,"vm_set %s %d",RelationGetRelationName(rel),heapBlk);
263259
#endif

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

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,24 @@ static TransactionId GetGlobalTransactionId(void);
4848

4949
TransactionIdGetGlobalTransactionId(void)
5050
{
51-
returnInvalidTransactionId;
51+
returnInvalidTransactionId;
5252
}
5353

54-
TransactionManagerDefaultTM= {CLOGTransactionIdGetStatus,CLOGTransactionIdSetTreeStatus,GetLocalSnapshotData,GetNewLocalTransactionId,GetOldestLocalXmin,TransactionIdIsRunning,GetGlobalTransactionId };
54+
TransactionManagerDefaultTM= {
55+
CLOGTransactionIdGetStatus,
56+
CLOGTransactionIdSetTreeStatus,
57+
GetLocalSnapshotData,
58+
GetNewLocalTransactionId,
59+
GetOldestLocalXmin,
60+
TransactionIdIsRunning,
61+
GetGlobalTransactionId
62+
};
63+
5564
TransactionManager*TM=&DefaultTM;
5665

5766
TransactionManager*GetTransactionManager(void)
5867
{
59-
returnTM;
68+
returnTM;
6069
}
6170

6271
/*
@@ -114,7 +123,7 @@ void
114123
TransactionIdSetTreeStatus(TransactionIdxid,intnsubxids,
115124
TransactionId*subxids,XidStatusstatus,XLogRecPtrlsn)
116125
{
117-
TM->SetTransactionStatus(xid,nsubxids,subxids,status,lsn);
126+
TM->SetTransactionStatus(xid,nsubxids,subxids,status,lsn);
118127
}
119128

120129
/*
@@ -415,7 +424,7 @@ TransactionIdSetStatusBit(TransactionId xid, XidStatus status, XLogRecPtr lsn, i
415424
XidStatus
416425
TransactionIdGetStatus(TransactionIdxid,XLogRecPtr*lsn)
417426
{
418-
returnTM->GetTransactionStatus(xid,lsn);
427+
returnTM->GetTransactionStatus(xid,lsn);
419428
}
420429

421430
XidStatus

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

Lines changed: 1 addition & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -576,138 +576,6 @@ RemoveGXact(GlobalTransaction gxact)
576576
elog(ERROR,"failed to find %p in GlobalTransaction array",gxact);
577577
}
578578

579-
int
580-
AllocGXid(TransactionIdxid)
581-
{
582-
GlobalTransactiongxact;
583-
PGPROC*proc;
584-
PGXACT*pgxact;
585-
inti;
586-
chargid[GIDSIZE];
587-
588-
sprintf(gid,"%u",xid);
589-
590-
/* fail immediately if feature is disabled */
591-
if (max_prepared_xacts==0)
592-
ereport(ERROR,
593-
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
594-
errmsg("prepared transactions are disabled"),
595-
errhint("Set max_prepared_transactions to a nonzero value.")));
596-
597-
/* on first call, register the exit hook */
598-
if (!twophaseExitRegistered)
599-
{
600-
before_shmem_exit(AtProcExit_Twophase,0);
601-
twophaseExitRegistered= true;
602-
}
603-
604-
LWLockAcquire(TwoPhaseStateLock,LW_EXCLUSIVE);
605-
606-
/* Check for conflicting GID */
607-
for (i=0;i<TwoPhaseState->numPrepXacts;i++)
608-
{
609-
gxact=TwoPhaseState->prepXacts[i];
610-
if (strcmp(gxact->gid,gid)==0)
611-
{
612-
ereport(ERROR,
613-
(errcode(ERRCODE_DUPLICATE_OBJECT),
614-
errmsg("transaction identifier \"%s\" is already in use",
615-
gid)));
616-
}
617-
}
618-
619-
/* Get a free gxact from the freelist */
620-
if (TwoPhaseState->freeGXacts==NULL)
621-
ereport(ERROR,
622-
(errcode(ERRCODE_OUT_OF_MEMORY),
623-
errmsg("maximum number of prepared transactions reached"),
624-
errhint("Increase max_prepared_transactions (currently %d).",
625-
max_prepared_xacts)));
626-
gxact=TwoPhaseState->freeGXacts;
627-
TwoPhaseState->freeGXacts=gxact->next;
628-
629-
proc=&ProcGlobal->allProcs[gxact->pgprocno];
630-
pgxact=&ProcGlobal->allPgXact[gxact->pgprocno];
631-
632-
/* Initialize the PGPROC entry */
633-
MemSet(proc,0,sizeof(PGPROC));
634-
proc->pgprocno=gxact->pgprocno;
635-
SHMQueueElemInit(&(proc->links));
636-
proc->waitStatus=STATUS_OK;
637-
/* We set up the gxact's VXID as InvalidBackendId/XID */
638-
proc->lxid= (LocalTransactionId)xid;
639-
pgxact->xid=xid;
640-
pgxact->xmin=InvalidTransactionId;
641-
pgxact->delayChkpt= false;
642-
pgxact->vacuumFlags=0;
643-
proc->pid=0;
644-
proc->backendId=InvalidBackendId;
645-
proc->databaseId=0;
646-
proc->roleId=0;
647-
proc->lwWaiting= false;
648-
proc->lwWaitMode=0;
649-
proc->waitLock=NULL;
650-
proc->waitProcLock=NULL;
651-
for (i=0;i<NUM_LOCK_PARTITIONS;i++)
652-
SHMQueueInit(&(proc->myProcLocks[i]));
653-
/* subxid data must be filled later by GXactLoadSubxactData */
654-
pgxact->overflowed= false;
655-
pgxact->nxids=0;
656-
657-
gxact->prepared_at=0;
658-
/* initialize LSN to 0 (start of WAL) */
659-
gxact->prepare_lsn=0;
660-
gxact->owner=0;
661-
gxact->locking_backend=MyBackendId;
662-
gxact->valid= true;
663-
strcpy(gxact->gid,gid);
664-
665-
/* And insert it into the active array */
666-
Assert(TwoPhaseState->numPrepXacts<max_prepared_xacts);
667-
TwoPhaseState->prepXacts[TwoPhaseState->numPrepXacts++]=gxact;
668-
669-
/*
670-
* Remember that we have this GlobalTransaction entry locked for us. If we
671-
* abort after this, we must release it.
672-
*/
673-
MyLockedGxact=gxact;
674-
675-
LWLockRelease(TwoPhaseStateLock);
676-
677-
returngxact->pgprocno;
678-
}
679-
680-
bool
681-
RemoveGXid(TransactionIdxid)
682-
{
683-
inti;
684-
chargid[GIDSIZE];
685-
686-
sprintf(gid,"%u",xid);
687-
688-
LWLockAcquire(TwoPhaseStateLock,LW_EXCLUSIVE);
689-
690-
for (i=0;i<TwoPhaseState->numPrepXacts;i++)
691-
{
692-
if (strcmp(TwoPhaseState->prepXacts[i]->gid,gid)==0)
693-
{
694-
/* remove from the active array */
695-
TwoPhaseState->numPrepXacts--;
696-
TwoPhaseState->prepXacts[i]=TwoPhaseState->prepXacts[TwoPhaseState->numPrepXacts];
697-
698-
/* and put it back in the freelist */
699-
TwoPhaseState->prepXacts[i]->next=TwoPhaseState->freeGXacts;
700-
TwoPhaseState->freeGXacts=TwoPhaseState->prepXacts[i];
701-
702-
LWLockRelease(TwoPhaseStateLock);
703-
return true;
704-
}
705-
}
706-
707-
LWLockRelease(TwoPhaseStateLock);
708-
return false;
709-
}
710-
711579
/*
712580
* TransactionIdIsPrepared
713581
*True iff transaction associated with the identifier is prepared
@@ -2322,5 +2190,5 @@ RecordTransactionAbortPrepared(TransactionId xid,
23222190
*/
23232191
constchar*GetLockedGlobalTransactionId()
23242192
{
2325-
returnMyLockedGxact ?MyLockedGxact->gid :NULL;
2193+
returnMyLockedGxact ?MyLockedGxact->gid :NULL;
23262194
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ VariableCache ShmemVariableCache = NULL;
3737
TransactionId
3838
GetNewTransactionId(boolisSubXact)
3939
{
40-
returnTM->GetNewTransactionId(isSubXact);
40+
returnTM->GetNewTransactionId(isSubXact);
4141
}
4242

4343
/*

‎src/backend/executor/execMain.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,9 +2261,8 @@ EvalPlanQualFetch(EState *estate, Relation relation, int lockmode,
22612261
}
22622262

22632263
/* otherwise xmin should not be dirty... */
2264-
if (TransactionIdIsValid(SnapshotDirty.xmin)) {
2264+
if (TransactionIdIsValid(SnapshotDirty.xmin))
22652265
elog(ERROR,"t_xmin is uncommitted in tuple to be updated");
2266-
}
22672266

22682267
/*
22692268
* If tuple is being updated by other transaction then we have to

‎src/backend/executor/nodeModifyTable.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,6 @@ ExecModifyTable(ModifyTableState *node)
12671267
ItemPointerDatatuple_ctid;
12681268
HeapTupleDataoldtupdata;
12691269
HeapTupleoldtuple;
1270-
intn_tuples=0;
12711270

12721271
/*
12731272
* This should NOT get called during EvalPlanQual; we should have passed a

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ ProcArrayApplyXidAssignment(TransactionId topxid,
965965
bool
966966
TransactionIdIsInProgress(TransactionIdxid)
967967
{
968-
returnTM->IsInProgress(xid);
968+
returnTM->IsInProgress(xid);
969969
}
970970

971971
/*
@@ -1003,6 +1003,7 @@ TransactionIdIsRunning(TransactionId xid)
10031003
TransactionIdtopxid;
10041004
inti,
10051005
j;
1006+
10061007
/*
10071008
* Don't bother checking a transaction older than RecentXmin; it could not
10081009
* possibly still be running. (Note: in particular, this guarantees that
@@ -1258,7 +1259,7 @@ TransactionIdIsActive(TransactionId xid)
12581259
TransactionId
12591260
GetOldestXmin(Relationrel,boolignoreVacuum)
12601261
{
1261-
returnTM->GetOldestXmin(rel,ignoreVacuum);
1262+
returnTM->GetOldestXmin(rel,ignoreVacuum);
12621263
}
12631264

12641265
/*
@@ -1475,7 +1476,7 @@ GetMaxSnapshotSubxidCount(void)
14751476
Snapshot
14761477
GetSnapshotData(Snapshotsnapshot)
14771478
{
1478-
returnTM->GetSnapshot(snapshot);
1479+
returnTM->GetSnapshot(snapshot);
14791480
}
14801481

14811482
/*
@@ -3882,4 +3883,3 @@ KnownAssignedXidsReset(void)
38823883

38833884
LWLockRelease(ProcArrayLock);
38843885
}
3885-

‎src/backend/storage/lmgr/lmgr.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,9 +542,9 @@ XactLockTableWait(TransactionId xid, Relation rel, ItemPointer ctid,
542542
error_context_stack=&callback;
543543
}
544544

545-
for (;;)
546-
{
547-
Assert(TransactionIdIsValid(xid));
545+
for (;;)
546+
{
547+
Assert(TransactionIdIsValid(xid));
548548
Assert(!TransactionIdEquals(xid,GetTopTransactionIdIfAny()));
549549

550550
SET_LOCKTAG_TRANSACTION(tag,xid);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp