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

Commit4aefe75

Browse files
committed
Remove some no-longer-needed kluges for bootstrapping, in particular
the AMI_OVERRIDE flag. The fact that TransactionLogFetch treatsBootstrapTransactionId as always committed is sufficient to makebootstrap work, and getting rid of extra tests in heavily used codepaths seems like a win. The files produced by initdb are demonstrablythe same after this change.
1 parent57e3b0c commit4aefe75

File tree

6 files changed

+17
-65
lines changed

6 files changed

+17
-65
lines changed

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

Lines changed: 1 addition & 5 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.182 2004/12/31 21:59:16 pgsql Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.183 2005/02/20 21:46:47 tgl Exp $
1212
*
1313
*
1414
* INTERFACE ROUTINES
@@ -715,10 +715,6 @@ heap_beginscan(Relation relation, Snapshot snapshot,
715715
*/
716716
RelationIncrementReferenceCount(relation);
717717

718-
/* XXX someday assert SelfTimeQual if relkind == RELKIND_UNCATALOGED */
719-
if (relation->rd_rel->relkind==RELKIND_UNCATALOGED)
720-
snapshot=SnapshotSelf;
721-
722718
/*
723719
* allocate and initialize scan descriptor
724720
*/

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

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/transam/transam.c,v 1.63 2004/12/31 21:59:29 pgsql Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/transam/transam.c,v 1.64 2005/02/20 21:46:48 tgl Exp $
1212
*
1313
* NOTES
1414
* This file contains the high level access-method interface to the
@@ -25,18 +25,6 @@
2525
#include"utils/tqual.h"
2626

2727

28-
/* ----------------
29-
*Flag indicating that we are bootstrapping.
30-
*
31-
* Transaction ID generation is disabled during bootstrap; we just use
32-
* BootstrapTransactionId.Also, the transaction ID status-check routines
33-
* are short-circuited; they claim that BootstrapTransactionId has already
34-
* committed, allowing tuples already inserted to be seen immediately.
35-
* ----------------
36-
*/
37-
boolAMI_OVERRIDE= false;
38-
39-
4028
staticXidStatusTransactionLogFetch(TransactionIdtransactionId);
4129
staticvoidTransactionLogUpdate(TransactionIdtransactionId,
4230
XidStatusstatus);
@@ -134,18 +122,6 @@ TransactionLogMultiUpdate(int nxids, TransactionId *xids, XidStatus status)
134122
TransactionIdSetStatus(xids[i],status);
135123
}
136124

137-
/* --------------------------------
138-
*AmiTransactionOverride
139-
*
140-
*This function is used to manipulate the bootstrap flag.
141-
* --------------------------------
142-
*/
143-
void
144-
AmiTransactionOverride(boolflag)
145-
{
146-
AMI_OVERRIDE=flag;
147-
}
148-
149125
/* ----------------------------------------------------------------
150126
*Interface functions
151127
*
@@ -184,12 +160,6 @@ TransactionIdDidCommit(TransactionId transactionId)
184160
{
185161
XidStatusxidstatus;
186162

187-
if (AMI_OVERRIDE)
188-
{
189-
Assert(transactionId==BootstrapTransactionId);
190-
return true;
191-
}
192-
193163
xidstatus=TransactionLogFetch(transactionId);
194164

195165
/*
@@ -233,12 +203,6 @@ TransactionIdDidAbort(TransactionId transactionId)
233203
{
234204
XidStatusxidstatus;
235205

236-
if (AMI_OVERRIDE)
237-
{
238-
Assert(transactionId==BootstrapTransactionId);
239-
return false;
240-
}
241-
242206
xidstatus=TransactionLogFetch(transactionId);
243207

244208
/*

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $PostgreSQL: pgsql/src/backend/access/transam/varsup.c,v 1.61 2005/02/2002:21:28 tgl Exp $
9+
* $PostgreSQL: pgsql/src/backend/access/transam/varsup.c,v 1.62 2005/02/20 21:46:48 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -41,7 +41,7 @@ GetNewTransactionId(bool isSubXact)
4141
* During bootstrap initialization, we return the special bootstrap
4242
* transaction id.
4343
*/
44-
if (AMI_OVERRIDE)
44+
if (IsBootstrapProcessingMode())
4545
returnBootstrapTransactionId;
4646

4747
LWLockAcquire(XidGenLock,LW_EXCLUSIVE);

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

Lines changed: 11 additions & 10 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.196 2005/02/2002:21:28 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.197 2005/02/20 21:46:48 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -450,22 +450,23 @@ GetCurrentTransactionNestLevel(void)
450450

451451
/*
452452
*TransactionIdIsCurrentTransactionId
453-
*
454-
*During bootstrap, we cheat and say "it's not my transaction ID" even though
455-
*it is.Along with transam.c's cheat to say that the bootstrap XID is
456-
*already committed, this causes the tqual.c routines to see previously
457-
*inserted tuples as committed, which is what we need during bootstrap.
458453
*/
459454
bool
460455
TransactionIdIsCurrentTransactionId(TransactionIdxid)
461456
{
462457
TransactionStates;
463458

464-
if (AMI_OVERRIDE)
465-
{
466-
Assert(xid==BootstrapTransactionId);
459+
/*
460+
* We always say that BootstrapTransactionId is "not my transaction ID"
461+
* even when it is (ie, during bootstrap). Along with the fact that
462+
* transam.c always treats BootstrapTransactionId as already committed,
463+
* this causes the tqual.c routines to see all tuples as committed,
464+
* which is what we need during bootstrap. (Bootstrap mode only inserts
465+
* tuples, it never updates or deletes them, so all tuples can be presumed
466+
* good immediately.)
467+
*/
468+
if (xid==BootstrapTransactionId)
467469
return false;
468-
}
469470

470471
/*
471472
* We will return true for the Xid of the current subtransaction, any

‎src/backend/utils/init/postinit.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.139 2004/12/31 22:01:40 pgsql Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.140 2005/02/20 21:46:49 tgl Exp $
1212
*
1313
*
1414
*-------------------------------------------------------------------------
@@ -328,11 +328,6 @@ InitPostgres(const char *dbname, const char *username)
328328
if (MyBackendId>MaxBackends||MyBackendId <=0)
329329
elog(FATAL,"bad backend id: %d",MyBackendId);
330330

331-
/*
332-
* Initialize the transaction system override state.
333-
*/
334-
AmiTransactionOverride(bootstrap);
335-
336331
/*
337332
* Initialize local process's access to XLOG. In bootstrap case we
338333
* may skip this since StartupXLOG() was run instead.

‎src/include/access/transam.h

Lines changed: 1 addition & 5 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/transam.h,v 1.52 2005/02/2002:22:03 tgl Exp $
10+
* $PostgreSQL: pgsql/src/include/access/transam.h,v 1.53 2005/02/2021:46:50 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -100,17 +100,13 @@ typedef VariableCacheData *VariableCache;
100100
* ----------------
101101
*/
102102

103-
/* in transam/transam.c */
104-
externboolAMI_OVERRIDE;
105-
106103
/* in transam/varsup.c */
107104
externVariableCacheShmemVariableCache;
108105

109106

110107
/*
111108
* prototypes for functions in transam/transam.c
112109
*/
113-
externvoidAmiTransactionOverride(boolflag);
114110
externboolTransactionIdDidCommit(TransactionIdtransactionId);
115111
externboolTransactionIdDidAbort(TransactionIdtransactionId);
116112
externvoidTransactionIdCommit(TransactionIdtransactionId);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp