Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
32cd09ac
Commit
32cd09ac
authored
Nov 02, 1997
by
Vadim B. Mikheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Good Bye, Time Travel!
parent
6cc0a00d
Changes
36
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
258 additions
and
1834 deletions
+258
-1834
src/backend/access/common/heaptuple.c
src/backend/access/common/heaptuple.c
+10
-73
src/backend/access/common/indextuple.c
src/backend/access/common/indextuple.c
+2
-2
src/backend/access/heap/heapam.c
src/backend/access/heap/heapam.c
+7
-8
src/backend/access/transam/transam.c
src/backend/access/transam/transam.c
+13
-114
src/backend/access/transam/transsup.c
src/backend/access/transam/transsup.c
+1
-224
src/backend/access/transam/varsup.c
src/backend/access/transam/varsup.c
+1
-123
src/backend/access/transam/xact.c
src/backend/access/transam/xact.c
+2
-2
src/backend/access/transam/xid.c
src/backend/access/transam/xid.c
+1
-39
src/backend/catalog/Makefile
src/backend/catalog/Makefile
+2
-2
src/backend/catalog/heap.c
src/backend/catalog/heap.c
+4
-29
src/backend/catalog/index.c
src/backend/catalog/index.c
+3
-8
src/backend/commands/vacuum.c
src/backend/commands/vacuum.c
+43
-50
src/backend/nodes/copyfuncs.c
src/backend/nodes/copyfuncs.c
+3
-16
src/backend/parser/catalog_utils.c
src/backend/parser/catalog_utils.c
+1
-21
src/backend/parser/gram.y
src/backend/parser/gram.y
+3
-2
src/backend/parser/parse_query.c
src/backend/parser/parse_query.c
+1
-62
src/backend/storage/buffer/buf_init.c
src/backend/storage/buffer/buf_init.c
+2
-4
src/backend/storage/large_object/inv_api.c
src/backend/storage/large_object/inv_api.c
+11
-15
src/backend/tcop/postgres.c
src/backend/tcop/postgres.c
+2
-50
src/backend/utils/adt/char.c
src/backend/utils/adt/char.c
+2
-7
src/backend/utils/cache/relcache.c
src/backend/utils/cache/relcache.c
+1
-4
src/backend/utils/init/globals.c
src/backend/utils/init/globals.c
+1
-2
src/backend/utils/time/tqual.c
src/backend/utils/time/tqual.c
+57
-708
src/include/access/heapam.h
src/include/access/heapam.h
+2
-2
src/include/access/htup.h
src/include/access/htup.h
+22
-29
src/include/access/transam.h
src/include/access/transam.h
+12
-45
src/include/access/valid.h
src/include/access/valid.h
+4
-7
src/include/access/xact.h
src/include/access/xact.h
+7
-6
src/include/catalog/catname.h
src/include/catalog/catname.h
+1
-2
src/include/catalog/pg_attribute.h
src/include/catalog/pg_attribute.h
+29
-110
src/include/catalog/pg_class.h
src/include/catalog/pg_class.h
+1
-3
src/include/catalog/pg_time.h
src/include/catalog/pg_time.h
+0
-41
src/include/catalog/pg_type.h
src/include/catalog/pg_type.h
+2
-3
src/include/parser/parse_query.h
src/include/parser/parse_query.h
+1
-4
src/include/postgres.h
src/include/postgres.h
+2
-2
src/include/utils/tqual.h
src/include/utils/tqual.h
+2
-15
No files found.
src/backend/access/common/heaptuple.c
View file @
32cd09ac
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.2
7 1997/09/24 17:44:24 thomas
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/heaptuple.c,v 1.2
8 1997/11/02 15:24:09 vadim
Exp $
*
* NOTES
* The old interface functions have been converted to macros
...
...
@@ -115,7 +115,7 @@ DataFill(char *data,
TupleDesc
tupleDesc
,
Datum
value
[],
char
nulls
[],
char
*
infomask
,
uint16
*
infomask
,
bits8
*
bit
)
{
bits8
*
bitP
=
0
;
...
...
@@ -246,11 +246,6 @@ heap_attisnull(HeapTuple tup, int attnum)
case
MinCommandIdAttributeNumber
:
case
MaxTransactionIdAttributeNumber
:
case
MaxCommandIdAttributeNumber
:
case
ChainItemPointerAttributeNumber
:
case
AnchorItemPointerAttributeNumber
:
case
MinAbsoluteTimeAttributeNumber
:
case
MaxAbsoluteTimeAttributeNumber
:
case
VersionTypeAttributeNumber
:
break
;
case
0
:
...
...
@@ -293,18 +288,6 @@ heap_sysattrlen(AttrNumber attno)
return
sizeof
f
->
t_xmax
;
case
MaxCommandIdAttributeNumber
:
return
sizeof
f
->
t_cmax
;
case
ChainItemPointerAttributeNumber
:
return
sizeof
f
->
t_chain
;
case
MinAbsoluteTimeAttributeNumber
:
return
sizeof
f
->
t_tmin
;
case
MaxAbsoluteTimeAttributeNumber
:
return
sizeof
f
->
t_tmax
;
case
VersionTypeAttributeNumber
:
return
sizeof
f
->
t_vtype
;
case
AnchorItemPointerAttributeNumber
:
elog
(
WARN
,
"heap_sysattrlen: field t_anchor does not exist!"
);
return
0
;
default:
elog
(
WARN
,
"sysattrlen: System attribute number %d unknown."
,
attno
);
...
...
@@ -343,21 +326,6 @@ heap_sysattrbyval(AttrNumber attno)
case
MaxCommandIdAttributeNumber
:
byval
=
true
;
break
;
case
ChainItemPointerAttributeNumber
:
byval
=
false
;
break
;
case
AnchorItemPointerAttributeNumber
:
byval
=
false
;
break
;
case
MinAbsoluteTimeAttributeNumber
:
byval
=
true
;
break
;
case
MaxAbsoluteTimeAttributeNumber
:
byval
=
true
;
break
;
case
VersionTypeAttributeNumber
:
byval
=
true
;
break
;
default:
byval
=
true
;
elog
(
WARN
,
"sysattrbyval: System attribute number %d unknown."
,
...
...
@@ -377,7 +345,7 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
{
switch
(
attnum
)
{
case
SelfItemPointerAttributeNumber
:
case
SelfItemPointerAttributeNumber
:
return
((
Datum
)
&
tup
->
t_ctid
);
case
ObjectIdAttributeNumber
:
return
((
Datum
)
(
long
)
tup
->
t_oid
);
...
...
@@ -389,38 +357,6 @@ heap_getsysattr(HeapTuple tup, Buffer b, int attnum)
return
((
Datum
)
(
long
)
tup
->
t_xmax
);
case
MaxCommandIdAttributeNumber
:
return
((
Datum
)
(
long
)
tup
->
t_cmax
);
case
ChainItemPointerAttributeNumber
:
return
((
Datum
)
&
tup
->
t_chain
);
case
AnchorItemPointerAttributeNumber
:
elog
(
WARN
,
"heap_getsysattr: t_anchor does not exist!"
);
break
;
/*
* For tmin and tmax, we need to do some extra work. These
* don't get filled in until the vacuum cleaner runs (or we
* manage to flush a page after setting the value correctly
* below). If the vacuum cleaner hasn't run yet, then the
* times stored in the tuple are wrong, and we need to look up
* the commit time of the transaction. We cache this value in
* the tuple to avoid doing the work more than once.
*/
case
MinAbsoluteTimeAttributeNumber
:
if
(
!
AbsoluteTimeIsBackwardCompatiblyValid
(
tup
->
t_tmin
)
&&
TransactionIdDidCommit
(
tup
->
t_xmin
))
tup
->
t_tmin
=
TransactionIdGetCommitTime
(
tup
->
t_xmin
);
return
((
Datum
)
(
long
)
tup
->
t_tmin
);
case
MaxAbsoluteTimeAttributeNumber
:
if
(
!
AbsoluteTimeIsBackwardCompatiblyReal
(
tup
->
t_tmax
))
{
if
(
TransactionIdDidCommit
(
tup
->
t_xmax
))
tup
->
t_tmax
=
TransactionIdGetCommitTime
(
tup
->
t_xmax
);
else
tup
->
t_tmax
=
CURRENT_ABSTIME
;
}
return
((
Datum
)
(
long
)
tup
->
t_tmax
);
case
VersionTypeAttributeNumber
:
return
((
Datum
)
(
long
)
tup
->
t_vtype
);
default:
elog
(
WARN
,
"heap_getsysattr: undefined attnum %d"
,
attnum
);
}
...
...
@@ -858,8 +794,6 @@ heap_formtuple(TupleDesc tupleDescriptor,
tuple
->
t_len
=
len
;
tuple
->
t_natts
=
numberOfAttributes
;
tuple
->
t_hoff
=
hoff
;
tuple
->
t_tmin
=
INVALID_ABSTIME
;
tuple
->
t_tmax
=
CURRENT_ABSTIME
;
DataFill
((
char
*
)
tuple
+
tuple
->
t_hoff
,
tupleDescriptor
,
...
...
@@ -868,6 +802,8 @@ heap_formtuple(TupleDesc tupleDescriptor,
&
tuple
->
t_infomask
,
(
hasnull
?
tuple
->
t_bits
:
NULL
));
tuple
->
t_infomask
|=
HEAP_XMAX_INVALID
;
return
(
tuple
);
}
...
...
@@ -970,9 +906,9 @@ heap_modifytuple(HeapTuple tuple,
* ----------------
*/
infomask
=
newTuple
->
t_infomask
;
memmove
((
char
*
)
&
newTuple
->
t_
ct
id
,
/* XXX */
(
char
*
)
&
tuple
->
t_
ct
id
,
((
char
*
)
&
tuple
->
t_hoff
-
(
char
*
)
&
tuple
->
t_
ctid
));
/* XXX */
memmove
((
char
*
)
&
newTuple
->
t_
o
id
,
/* XXX */
(
char
*
)
&
tuple
->
t_
o
id
,
((
char
*
)
&
tuple
->
t_hoff
-
(
char
*
)
&
tuple
->
t_
oid
));
/* XXX */
newTuple
->
t_infomask
=
infomask
;
newTuple
->
t_natts
=
numberOfAttributes
;
/* fix t_natts just in
* case */
...
...
@@ -1013,10 +949,11 @@ heap_addheader(uint32 natts, /* max domain index */
tup
=
(
HeapTuple
)
tp
;
MemSet
((
char
*
)
tup
,
0
,
len
);
tup
->
t_len
=
(
short
)
len
;
/* XXX */
tup
->
t_len
=
len
;
tp
+=
tup
->
t_hoff
=
hoff
;
tup
->
t_natts
=
natts
;
tup
->
t_infomask
=
0
;
tup
->
t_infomask
|=
HEAP_XMAX_INVALID
;
memmove
(
tp
,
structure
,
structlen
);
...
...
src/backend/access/common/indextuple.c
View file @
32cd09ac
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.
19 1997/09/18 20:19:37 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.
20 1997/11/02 15:24:11 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -52,7 +52,7 @@ index_formtuple(TupleDesc tupleDescriptor,
int
i
;
unsigned
short
infomask
=
0
;
bool
hasnull
=
false
;
char
tupmask
=
0
;
uint16
tupmask
=
0
;
int
numberOfAttributes
=
tupleDescriptor
->
natts
;
if
(
numberOfAttributes
>
MaxIndexAttributeNumber
)
...
...
src/backend/access/heap/heapam.c
View file @
32cd09ac
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.2
0 1997/09/18 14:19:30 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.2
1 1997/11/02 15:24:26 vadim
Exp $
*
*
* INTERFACE ROUTINES
...
...
@@ -1174,8 +1174,8 @@ heap_insert(Relation relation, HeapTuple tup)
TransactionIdStore
(
GetCurrentTransactionId
(),
&
(
tup
->
t_xmin
));
tup
->
t_cmin
=
GetCurrentCommandId
();
StoreInvalidTransactionId
(
&
(
tup
->
t_xmax
));
tup
->
t_
tmin
=
INVALID_ABSTIME
;
tup
->
t_
tmax
=
CURRENT_ABSTIME
;
tup
->
t_
infomask
&=
~
(
HEAP_XACT_MASK
)
;
tup
->
t_
infomask
|=
HEAP_XMAX_INVALID
;
doinsert
(
relation
,
tup
);
...
...
@@ -1281,7 +1281,7 @@ heap_delete(Relation relation, ItemPointer tid)
*/
TransactionIdStore
(
GetCurrentTransactionId
(),
&
(
tp
->
t_xmax
));
tp
->
t_cmax
=
GetCurrentCommandId
();
ItemPointerSetInvalid
(
&
tp
->
t_chain
);
tp
->
t_infomask
&=
~
(
HEAP_XMAX_COMMITTED
|
HEAP_XMAX_INVALID
);
/* ----------------
* invalidate caches
...
...
@@ -1410,9 +1410,8 @@ heap_replace(Relation relation, ItemPointer otid, HeapTuple tup)
TransactionIdStore
(
GetCurrentTransactionId
(),
&
(
tup
->
t_xmin
));
tup
->
t_cmin
=
GetCurrentCommandId
();
StoreInvalidTransactionId
(
&
(
tup
->
t_xmax
));
tup
->
t_tmin
=
INVALID_ABSTIME
;
tup
->
t_tmax
=
CURRENT_ABSTIME
;
ItemPointerSetInvalid
(
&
tup
->
t_chain
);
tup
->
t_infomask
&=
~
(
HEAP_XACT_MASK
);
tup
->
t_infomask
|=
HEAP_XMAX_INVALID
;
/* ----------------
* insert new item
...
...
@@ -1438,7 +1437,7 @@ heap_replace(Relation relation, ItemPointer otid, HeapTuple tup)
*/
TransactionIdStore
(
GetCurrentTransactionId
(),
&
(
tp
->
t_xmax
));
tp
->
t_cmax
=
GetCurrentCommandId
();
tp
->
t_
chain
=
tup
->
t_ctid
;
tp
->
t_
infomask
&=
~
(
HEAP_XMAX_COMMITTED
|
HEAP_XMAX_INVALID
)
;
/* ----------------
* invalidate caches
...
...
src/backend/access/transam/transam.c
View file @
32cd09ac
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.1
3 1997/09/08 21:41:42 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.1
4 1997/11/02 15:24:42 vadim
Exp $
*
* NOTES
* This file contains the high level access-method interface to the
...
...
@@ -41,17 +41,14 @@ TransactionLogUpdate(TransactionId transactionId,
*/
Relation
LogRelation
=
(
Relation
)
NULL
;
Relation
TimeRelation
=
(
Relation
)
NULL
;
Relation
VariableRelation
=
(
Relation
)
NULL
;
/* ----------------
* global variables holding cached transaction id's and statuses.
* ----------------
*/
TransactionId
cachedGetCommitTimeXid
;
AbsoluteTime
cachedGetCommitTime
;
TransactionId
cachedTestXid
;
XidStatus
cachedTestXidStatus
;
TransactionId
cachedTestXid
;
XidStatus
cachedTestXidStatus
;
/* ----------------
* transaction system constants
...
...
@@ -118,7 +115,7 @@ SetRecoveryCheckingEnabled(bool state)
#endif
/* ----------------------------------------------------------------
* postgres log
/time
access method interface
* postgres log access method interface
*
* TransactionLogTest
* TransactionLogUpdate
...
...
@@ -204,7 +201,6 @@ TransactionLogUpdate(TransactionId transactionId, /* trans id to update */
{
BlockNumber
blockNumber
;
bool
fail
=
false
;
/* success/failure */
AbsoluteTime
currentTime
;
/* time of this transaction */
/* ----------------
* during initialization we don't record any updates.
...
...
@@ -213,12 +209,6 @@ TransactionLogUpdate(TransactionId transactionId, /* trans id to update */
if
(
!
RelationIsValid
(
LogRelation
))
return
;
/* ----------------
* get the transaction commit time
* ----------------
*/
currentTime
=
getSystemTime
();
/* ----------------
* update the log relation
* ----------------
...
...
@@ -234,91 +224,12 @@ TransactionLogUpdate(TransactionId transactionId, /* trans id to update */
* update (invalidate) our single item TransactionLogTest cache.
* ----------------
*/
TransactionIdStore
(
transactionId
,
&
cachedTestXid
);
cachedTestXidStatus
=
status
;
/* ----------------
* now we update the time relation, if necessary
* (we only record commit times)
* ----------------
*/
if
(
RelationIsValid
(
TimeRelation
)
&&
status
==
XID_COMMIT
)
if
(
status
!=
XID_COMMIT
)
{
TransComputeBlockNumber
(
TimeRelation
,
transactionId
,
&
blockNumber
);
TransBlockNumberSetCommitTime
(
TimeRelation
,
blockNumber
,
transactionId
,
currentTime
,
&
fail
);
/* ----------------
* update (invalidate) our single item GetCommitTime cache.
* ----------------
*/
TransactionIdStore
(
transactionId
,
&
cachedGetCommitTimeXid
);
cachedGetCommitTime
=
currentTime
;
TransactionIdStore
(
transactionId
,
&
cachedTestXid
);
cachedTestXidStatus
=
status
;
}
/* ----------------
* now we update the "last committed transaction" field
* in the variable relation if we are recording a commit.
* ----------------
*/
if
(
RelationIsValid
(
VariableRelation
)
&&
status
==
XID_COMMIT
)
UpdateLastCommittedXid
(
transactionId
);
}
/* --------------------------------
* TransactionIdGetCommitTime
* --------------------------------
*/
AbsoluteTime
/* commit time of transaction id */
TransactionIdGetCommitTime
(
TransactionId
transactionId
)
/* transaction id to
* test */
{
BlockNumber
blockNumber
;
AbsoluteTime
commitTime
;
/* commit time */
bool
fail
=
false
;
/* success/failure */
/* ----------------
* return invalid if we aren't running yet...
* ----------------
*/
if
(
!
RelationIsValid
(
TimeRelation
))
return
INVALID_ABSTIME
;
/* ----------------
* before going to the buffer manager, check our single
* item cache to see if we didn't just get the commit time
* a moment ago.
* ----------------
*/
if
(
TransactionIdEquals
(
transactionId
,
cachedGetCommitTimeXid
))
return
cachedGetCommitTime
;
/* ----------------
* compute the item pointer corresponding to the
* page containing our transaction commit time
* ----------------
*/
TransComputeBlockNumber
(
TimeRelation
,
transactionId
,
&
blockNumber
);
commitTime
=
TransBlockNumberGetCommitTime
(
TimeRelation
,
blockNumber
,
transactionId
,
&
fail
);
/* ----------------
* update our cache and return the transaction commit time
* ----------------
*/
if
(
!
fail
)
{
TransactionIdStore
(
transactionId
,
&
cachedGetCommitTimeXid
);
cachedGetCommitTime
=
commitTime
;
return
commitTime
;
}
else
return
INVALID_ABSTIME
;
}
/* ----------------------------------------------------------------
...
...
@@ -472,7 +383,6 @@ void
InitializeTransactionLog
(
void
)
{
Relation
logRelation
;
Relation
timeRelation
;
MemoryContext
oldContext
;
/* ----------------
...
...
@@ -503,20 +413,17 @@ InitializeTransactionLog(void)
* ----------------
*/
logRelation
=
heap_openr
(
LogRelationName
);
timeRelation
=
heap_openr
(
TimeRelationName
);
VariableRelation
=
heap_openr
(
VariableRelationName
);
/* ----------------
* XXX TransactionLogUpdate requires that LogRelation
* and TimeRelation are valid so we temporarily set
* them so we can initialize things properly.
* This could be done cleaner.
* is valid so we temporarily set it so we can initialize
* things properly. This could be done cleaner.
* ----------------
*/
LogRelation
=
logRelation
;
TimeRelation
=
timeRelation
;
/* ----------------
* if we have a virgin database, we initialize the log
and time
* if we have a virgin database, we initialize the log
* relation by committing the AmiTransactionId (id 512) and we
* initialize the variable relation by setting the next available
* transaction id to FirstTransactionId (id 514). OID initialization
...
...
@@ -529,10 +436,12 @@ InitializeTransactionLog(void)
/* ----------------
* SOMEDAY initialize the information stored in
* the headers of the log/
time/
variable relations.
* the headers of the log/variable relations.
* ----------------
*/
TransactionLogUpdate
(
AmiTransactionId
,
XID_COMMIT
);
TransactionIdStore
(
AmiTransactionId
,
&
cachedTestXid
);
cachedTestXidStatus
=
XID_COMMIT
;
VariableRelationPutNextXid
(
FirstTransactionId
);
}
...
...
@@ -547,7 +456,6 @@ InitializeTransactionLog(void)
TransRecover
(
logRelation
);
}
LogRelation
=
(
Relation
)
NULL
;
TimeRelation
=
(
Relation
)
NULL
;
SpinRelease
(
OidGenLockId
);
/* ----------------
...
...
@@ -561,7 +469,6 @@ InitializeTransactionLog(void)
* ----------------
*/
LogRelation
=
logRelation
;
TimeRelation
=
timeRelation
;
/* ----------------
* restore the memory context to the previous context
...
...
@@ -651,15 +558,7 @@ TransactionIdCommit(TransactionId transactionId)
if
(
AMI_OVERRIDE
)
return
;
/*
* Within TransactionLogUpdate we call UpdateLastCommited() which
* assumes we have exclusive access to pg_variable. Therefore we need
* to get exclusive access before calling TransactionLogUpdate. -mer
* 18 Aug 1992
*/
SpinAcquire
(
OidGenLockId
);
TransactionLogUpdate
(
transactionId
,
XID_COMMIT
);
SpinRelease
(
OidGenLockId
);
}
/*
...
...
src/backend/access/transam/transsup.c
View file @
32cd09ac
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/transsup.c,v 1.1
3 1997/09/08 21:41:46 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/transsup.c,v 1.1
4 1997/11/02 15:24:44 vadim
Exp $
*
* NOTES
* This file contains support functions for the high
...
...
@@ -23,16 +23,10 @@
#include <access/xact.h>
#include <storage/lmgr.h>
static
AbsoluteTime
TransBlockGetCommitTime
(
Block
tblock
,
TransactionId
transactionId
);
static
XidStatus
TransBlockGetXidStatus
(
Block
tblock
,
TransactionId
transactionId
);
static
void
TransBlockSetCommitTime
(
Block
tblock
,
TransactionId
transactionId
,
AbsoluteTime
commitTime
);
static
void
TransBlockSetXidStatus
(
Block
tblock
,
TransactionId
transactionId
,
XidStatus
xstatus
);
...
...
@@ -73,8 +67,6 @@ TransComputeBlockNumber(Relation relation, /* relation to test */
*/
if
(
relation
==
LogRelation
)
itemsPerBlock
=
TP_NumXidStatusPerBlock
;
else
if
(
relation
==
TimeRelation
)
itemsPerBlock
=
TP_NumTimePerBlock
;
else
elog
(
WARN
,
"TransComputeBlockNumber: unknown relation"
);
...
...
@@ -197,15 +189,6 @@ TransBlockGetXidStatus(Block tblock,
bits8
bit2
;
BitIndex
offset
;
/* ----------------
* sanity check
* ----------------
*/
if
(
tblock
==
NULL
)
{
return
XID_INVALID
;
}
/* ----------------
* calculate the index into the transaction data where
* our transaction status is located
...
...
@@ -248,13 +231,6 @@ TransBlockSetXidStatus(Block tblock,
Index
index
;
BitIndex
offset
;
/* ----------------
* sanity check
* ----------------
*/
if
(
tblock
==
NULL
)
return
;
/* ----------------
* calculate the index into the transaction data where
* we sould store our transaction status.
...
...
@@ -295,90 +271,6 @@ TransBlockSetXidStatus(Block tblock,
}
}
/* --------------------------------
* TransBlockGetCommitTime
*
* This returns the transaction commit time for the
* specified transaction id in the trans block.
* --------------------------------
*/
static
AbsoluteTime
TransBlockGetCommitTime
(
Block
tblock
,
TransactionId
transactionId
)
{
Index
index
;
AbsoluteTime
*
timeArray
;
/* ----------------
* sanity check
* ----------------
*/
if
(
tblock
==
NULL
)
return
INVALID_ABSTIME
;
/* ----------------
* calculate the index into the transaction data where
* our transaction commit time is located
*
* XXX this will be replaced soon when we move to the
* new transaction id scheme -cim 3/23/90
*
* The new scheme is here. -mer 5/24/92
* ----------------
*/
index
=
transactionId
%
TP_NumTimePerBlock
;
/* ----------------
* return the commit time to the caller
* ----------------
*/
timeArray
=
(
AbsoluteTime
*
)
tblock
;
return
(
AbsoluteTime
)
timeArray
[
index
];
}
/* --------------------------------
* TransBlockSetCommitTime
*
* This sets the commit time of the specified transaction
* --------------------------------
*/
static
void
TransBlockSetCommitTime
(
Block
tblock
,
TransactionId
transactionId
,
AbsoluteTime
commitTime
)
{
Index
index
;
AbsoluteTime
*
timeArray
;
/* ----------------
* sanity check
* ----------------
*/
if
(
tblock
==
NULL
)
return
;
/* ----------------
* calculate the index into the transaction data where
* we sould store our transaction status.
*
* XXX this will be replaced soon when we move to the
* new transaction id scheme -cim 3/23/90
*
* The new scheme is here. -mer 5/24/92
* ----------------
*/
index
=
transactionId
%
TP_NumTimePerBlock
;
/* ----------------
* store the transaction commit time at the specified index
* ----------------
*/
timeArray
=
(
AbsoluteTime
*
)
tblock
;
timeArray
[
index
]
=
commitTime
;
}
/* ----------------------------------------------------------------
* transam i/o support routines
* ----------------------------------------------------------------
...
...
@@ -494,121 +386,6 @@ TransBlockNumberSetXidStatus(Relation relation,
RelationUnsetLockForWrite
(
relation
);
}
/* --------------------------------
* TransBlockNumberGetCommitTime
* --------------------------------
*/
AbsoluteTime
TransBlockNumberGetCommitTime
(
Relation
relation
,
BlockNumber
blockNumber
,
TransactionId
xid
,
bool
*
failP
)
{
Buffer
buffer
;
/* buffer associated with block */
Block
block
;
/* block containing commit time */
bool
localfail
;
/* bool used if failP = NULL */
AbsoluteTime
xtime
;
/* commit time */
/* ----------------
* SOMEDAY place a read lock on the time relation
*
* That someday is today 5 Aug. 1991 -mer
* ----------------
*/
RelationSetLockForRead
(
relation
);
/* ----------------
* get the block containing the transaction information
* ----------------
*/
buffer
=
ReadBuffer
(
relation
,
blockNumber
);
block
=
BufferGetBlock
(
buffer
);
/* ----------------
* get the commit time from the block
* note, for now we always return false in failP.
* ----------------
*/
if
(
failP
==
NULL
)
failP
=
&
localfail
;
(
*
failP
)
=
false
;
xtime
=
TransBlockGetCommitTime
(
block
,
xid
);
/* ----------------
* release the buffer and return the commit time
* ----------------
*/
ReleaseBuffer
(
buffer
);
/* ----------------
* SOMEDAY release our lock on the time relation
* ----------------
*/
RelationUnsetLockForRead
(
relation
);
if
((
*
failP
)
==
false
)
return
xtime
;
else
return
INVALID_ABSTIME
;
}
/* --------------------------------
* TransBlockNumberSetCommitTime
* --------------------------------
*/
void
TransBlockNumberSetCommitTime
(
Relation
relation
,
BlockNumber
blockNumber
,
TransactionId
xid
,
AbsoluteTime
xtime
,
bool
*
failP
)
{
Buffer
buffer
;
/* buffer associated with block */
Block
block
;
/* block containing commit time */
bool
localfail
;
/* bool used if failP = NULL */
/* ----------------
* SOMEDAY gain exclusive access to the time relation
*
* That someday is today 5 Aug. 1991 -mer
* ----------------
*/
RelationSetLockForWrite
(
relation
);
/* ----------------
* get the block containing our commit time
* ----------------
*/
buffer
=
ReadBuffer
(
relation
,
blockNumber
);
block
=
BufferGetBlock
(
buffer
);
/* ----------------
* attempt to update the commit time of the transaction on the block.
* if we are successful, write the block. otherwise release the buffer.
* note, for now we always return false in failP.
* ----------------
*/
if
(
failP
==
NULL
)
failP
=
&
localfail
;
(
*
failP
)
=
false
;
TransBlockSetCommitTime
(
block
,
xid
,
xtime
);
if
((
*
failP
)
==
false
)
WriteBuffer
(
buffer
);
else
ReleaseBuffer
(
buffer
);
/* ----------------
* SOMEDAY release our lock on the time relation
* ----------------
*/
RelationUnsetLockForWrite
(
relation
);
}
/* --------------------------------
* TransGetLastRecordedTransaction
* --------------------------------
...
...
src/backend/access/transam/varsup.c
View file @
32cd09ac
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.1
2 1997/09/08 21:41:49 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/varsup.c,v 1.1
3 1997/11/02 15:24:45 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -23,9 +23,7 @@
static
void
GetNewObjectIdBlock
(
Oid
*
oid_return
,
int
oid_block_size
);
static
void
VariableRelationGetNextOid
(
Oid
*
oid_return
);
static
void
VariableRelationGetNextXid
(
TransactionId
*
xidP
);
static
void
VariableRelationPutLastXid
(
TransactionId
xid
);
static
void
VariableRelationPutNextOid
(
Oid
*
oidP
);
static
void
VariableRelationGetLastXid
(
TransactionId
*
xidP
);
/* ---------------------
* spin lock for oid generation
...
...
@@ -80,49 +78,6 @@ VariableRelationGetNextXid(TransactionId *xidP)
ReleaseBuffer
(
buf
);
}
/* --------------------------------
* VariableRelationGetLastXid
* --------------------------------
*/
static
void
VariableRelationGetLastXid
(
TransactionId
*
xidP
)
{
Buffer
buf
;
VariableRelationContents
var
;
/* ----------------
* We assume that a spinlock has been acquire to guarantee
* exclusive access to the variable relation.
* ----------------
*/
/* ----------------
* do nothing before things are initialized
* ----------------
*/
if
(
!
RelationIsValid
(
VariableRelation
))
return
;
/* ----------------
* read the variable page, get the the lastXid field and
* release the buffer
* ----------------
*/
buf
=
ReadBuffer
(
VariableRelation
,
0
);
if
(
!
BufferIsValid
(
buf
))
{
SpinRelease
(
OidGenLockId
);
elog
(
WARN
,
"VariableRelationGetNextXid: ReadBuffer failed"
);
}
var
=
(
VariableRelationContents
)
BufferGetBlock
(
buf
);
TransactionIdStore
(
var
->
lastXidData
,
xidP
);
ReleaseBuffer
(
buf
);
}
/* --------------------------------
* VariableRelationPutNextXid
* --------------------------------
...
...
@@ -169,49 +124,6 @@ VariableRelationPutNextXid(TransactionId xid)
SetBufferWriteMode
(
flushmode
);
}
/* --------------------------------
* VariableRelationPutLastXid
* --------------------------------
*/
static
void
VariableRelationPutLastXid
(
TransactionId
xid
)
{
Buffer
buf
;
VariableRelationContents
var
;
/* ----------------
* We assume that a spinlock has been acquire to guarantee
* exclusive access to the variable relation.
* ----------------
*/
/* ----------------
* do nothing before things are initialized
* ----------------
*/
if
(
!
RelationIsValid
(
VariableRelation
))
return
;
/* ----------------
* read the variable page, update the lastXid field and
* force the page back out to disk.
* ----------------
*/
buf
=
ReadBuffer
(
VariableRelation
,
0
);
if
(
!
BufferIsValid
(
buf
))
{
SpinRelease
(
OidGenLockId
);
elog
(
WARN
,
"VariableRelationPutLastXid: ReadBuffer failed"
);
}
var
=
(
VariableRelationContents
)
BufferGetBlock
(
buf
);
TransactionIdStore
(
xid
,
&
(
var
->
lastXidData
));
WriteBuffer
(
buf
);
}
/* --------------------------------
* VariableRelationGetNextOid
* --------------------------------
...
...
@@ -449,40 +361,6 @@ GetNewTransactionId(TransactionId *xid)
prefetched_xid_count
--
;
}
/* ----------------
* UpdateLastCommittedXid
* ----------------
*/
void
UpdateLastCommittedXid
(
TransactionId
xid
)
{
TransactionId
lastid
;
/*
* we assume that spinlock OidGenLockId has been acquired prior to
* entering this function
*/
/* ----------------
* get the "last committed" transaction id from
* the variable relation page.
* ----------------
*/
VariableRelationGetLastXid
(
&
lastid
);
/* ----------------
* if the transaction id is greater than the last committed
* transaction then we update the last committed transaction
* in the variable relation.
* ----------------
*/
if
(
TransactionIdIsLessThan
(
lastid
,
xid
))
VariableRelationPutLastXid
(
xid
);
}
/* ----------------------------------------------------------------
* object id generation support
* ----------------------------------------------------------------
...
...
src/backend/access/transam/xact.c
View file @
32cd09ac
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.1
6 1997/09/08 21:41:52 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.1
7 1997/11/02 15:24:46 vadim
Exp $
*
* NOTES
* Transaction aborts can now occur two ways:
...
...
@@ -497,7 +497,7 @@ CommandCounterIncrement()
if
(
CurrentTransactionStateData
.
commandId
==
FirstCommandId
)
{
CommandIdCounterOverflowFlag
=
true
;
elog
(
WARN
,
"You may only have
65535
commands per transaction"
);
elog
(
WARN
,
"You may only have
2^32-1
commands per transaction"
);
}
CurrentTransactionStateData
.
scanCommandId
=
...
...
src/backend/access/transam/xid.c
View file @
32cd09ac
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.1
0 1997/09/08 21:41:56 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/Attic/xid.c,v 1.1
1 1997/11/02 15:24:47 vadim
Exp $
*
* OLD COMMENTS
* XXX WARNING
...
...
@@ -30,18 +30,6 @@ extern TransactionId DisabledTransactionId;
extern
TransactionId
AmiTransactionId
;
extern
TransactionId
FirstTransactionId
;
/* ----------------------------------------------------------------
* TransactionIdIsValid
*
* Macro-ize me.
* ----------------------------------------------------------------
*/
bool
TransactionIdIsValid
(
TransactionId
transactionId
)
{
return
((
bool
)
(
transactionId
!=
NullTransactionId
));
}
/* XXX char16 name for catalogs */
TransactionId
xidin
(
char
*
representation
)
...
...
@@ -65,32 +53,6 @@ xidout(TransactionId transactionId)
}
/* ----------------------------------------------------------------
* StoreInvalidTransactionId
*
* Maybe do away with Pointer types in these routines.
* Macro-ize this one.
* ----------------------------------------------------------------
*/
void
StoreInvalidTransactionId
(
TransactionId
*
destination
)
{
*
destination
=
NullTransactionId
;
}
/* ----------------------------------------------------------------
* TransactionIdStore
*
* Macro-ize this one.
* ----------------------------------------------------------------
*/
void
TransactionIdStore
(
TransactionId
transactionId
,
TransactionId
*
destination
)
{
*
destination
=
transactionId
;
}
/* ----------------------------------------------------------------
* TransactionIdEquals
* ----------------------------------------------------------------
...
...
src/backend/catalog/Makefile
View file @
32cd09ac
...
...
@@ -4,7 +4,7 @@
# Makefile for catalog
#
# IDENTIFICATION
# $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.
2 1996/11/03 23:26:58 scrappy
Exp $
# $Header: /cvsroot/pgsql/src/backend/catalog/Makefile,v 1.
3 1997/11/02 15:24:52 vadim
Exp $
#
#-------------------------------------------------------------------------
...
...
@@ -30,7 +30,7 @@ GENBKI= ./genbki.sh
GLOBALBKI_SRCS
=
$(
addprefix
../../include/catalog/,
\
pg_database.h pg_demon.h pg_magic.h pg_defaults.h
\
pg_variable.h pg_server.h pg_user.h pg_hosts.h
\
pg_group.h pg_log.h
pg_time.h
\
pg_group.h pg_log.h
\
)
LOCALBKI_SRCS
=
$(
addprefix
../../include/catalog/,
\
...
...
src/backend/catalog/heap.c
View file @
32cd09ac
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.
29 1997/09/18 20:20:11 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.
30 1997/11/02 15:24:55 vadim
Exp $
*
* INTERFACE ROUTINES
* heap_creatr() - Create an uncataloged heap relation
...
...
@@ -108,7 +108,7 @@ static FormData_pg_attribute a3 = {
static
FormData_pg_attribute
a4
=
{
0xffffffff
,
{
"cmin"
},
29l
,
0l
,
sizeof
(
CommandId
),
MinCommandIdAttributeNumber
,
0
,
-
1
,
'\001'
,
'\0'
,
'
s
'
,
'\0'
,
'\0'
MinCommandIdAttributeNumber
,
0
,
-
1
,
'\001'
,
'\0'
,
'
i
'
,
'\0'
,
'\0'
};
static
FormData_pg_attribute
a5
=
{
...
...
@@ -118,36 +118,11 @@ static FormData_pg_attribute a5 = {
static
FormData_pg_attribute
a6
=
{
0xffffffff
,
{
"cmax"
},
29l
,
0l
,
sizeof
(
CommandId
),
MaxCommandIdAttributeNumber
,
0
,
-
1
,
'\001'
,
'\0'
,
's'
,
'\0'
,
'\0'
};
static
FormData_pg_attribute
a7
=
{
0xffffffff
,
{
"chain"
},
27l
,
0l
,
sizeof
(
ItemPointerData
),
ChainItemPointerAttributeNumber
,
0
,
-
1
,
'\0'
,
'\0'
,
'i'
,
'\0'
,
'\0'
};
static
FormData_pg_attribute
a8
=
{
0xffffffff
,
{
"anchor"
},
27l
,
0l
,
sizeof
(
ItemPointerData
),
AnchorItemPointerAttributeNumber
,
0
,
-
1
,
'\0'
,
'\0'
,
'i'
,
'\0'
,
'\0'
};
static
FormData_pg_attribute
a9
=
{
0xffffffff
,
{
"tmin"
},
702l
,
0l
,
sizeof
(
AbsoluteTime
),
MinAbsoluteTimeAttributeNumber
,
0
,
-
1
,
'\001'
,
'\0'
,
'i'
,
'\0'
,
'\0'
};
static
FormData_pg_attribute
a10
=
{
0xffffffff
,
{
"tmax"
},
702l
,
0l
,
sizeof
(
AbsoluteTime
),
MaxAbsoluteTimeAttributeNumber
,
0
,
-
1
,
'\001'
,
'\0'
,
'i'
,
'\0'
,
'\0'
};
static
FormData_pg_attribute
a11
=
{
0xffffffff
,
{
"vtype"
},
18l
,
0l
,
sizeof
(
char
),
VersionTypeAttributeNumber
,
0
,
-
1
,
'\001'
,
'\0'
,
'c'
,
'\0'
,
'\0'
MaxCommandIdAttributeNumber
,
0
,
-
1
,
'\001'
,
'\0'
,
'i'
,
'\0'
,
'\0'
};
static
AttributeTupleForm
HeapAtt
[]
=
{
&
a1
,
&
a2
,
&
a3
,
&
a4
,
&
a5
,
&
a6
,
&
a7
,
&
a8
,
&
a9
,
&
a10
,
&
a11
};
{
&
a1
,
&
a2
,
&
a3
,
&
a4
,
&
a5
,
&
a6
};
/* ----------------------------------------------------------------
* XXX END OF UGLY HARD CODED BADNESS XXX
...
...
src/backend/catalog/index.c
View file @
32cd09ac
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.2
4 1997/10/27 11:52:43
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.2
5 1997/11/02 15:25:01
vadim Exp $
*
*
* INTERFACE ROUTINES
...
...
@@ -119,14 +119,9 @@ static FormData_pg_attribute sysatts[] = {
{
0l
,
{
"ctid"
},
27l
,
0l
,
6
,
-
1
,
0
,
-
1
,
'\0'
,
'\0'
,
'i'
,
'\0'
,
'\0'
},
{
0l
,
{
"oid"
},
26l
,
0l
,
4
,
-
2
,
0
,
-
1
,
'\001'
,
'\0'
,
'i'
,
'\0'
,
'\0'
},
{
0l
,
{
"xmin"
},
28l
,
0l
,
4
,
-
3
,
0
,
-
1
,
'\0'
,
'\0'
,
'i'
,
'\0'
,
'\0'
},
{
0l
,
{
"cmin"
},
29l
,
0l
,
2
,
-
4
,
0
,
-
1
,
'\001'
,
'\0'
,
's
'
,
'\0'
,
'\0'
},
{
0l
,
{
"cmin"
},
29l
,
0l
,
4
,
-
4
,
0
,
-
1
,
'\001'
,
'\0'
,
'i
'
,
'\0'
,
'\0'
},
{
0l
,
{
"xmax"
},
28l
,
0l
,
4
,
-
5
,
0
,
-
1
,
'\0'
,
'\0'
,
'i'
,
'\0'
,
'\0'
},
{
0l
,
{
"cmax"
},
29l
,
0l
,
2
,
-
6
,
0
,
-
1
,
'\001'
,
'\0'
,
's'
,
'\0'
,
'\0'
},
{
0l
,
{
"chain"
},
27l
,
0l
,
6
,
-
7
,
0
,
-
1
,
'\0'
,
'\0'
,
'i'
,
'\0'
,
'\0'
},
{
0l
,
{
"anchor"
},
27l
,
0l
,
6
,
-
8
,
0
,
-
1
,
'\0'
,
'\0'
,
'i'
,
'\0'
,
'\0'
},
{
0l
,
{
"tmin"
},
702l
,
0l
,
4
,
-
9
,
0
,
-
1
,
'\001'
,
'\0'
,
'i'
,
'\0'
,
'\0'
},
{
0l
,
{
"tmax"
},
702l
,
0l
,
4
,
-
10
,
0
,
-
1
,
'\001'
,
'\0'
,
'i'
,
'\0'
,
'\0'
},
{
0l
,
{
"vtype"
},
18l
,
0l
,
1
,
-
11
,
0
,
-
1
,
'\001'
,
'\0'
,
'c'
,
'\0'
,
'\0'
},
{
0l
,
{
"cmax"
},
29l
,
0l
,
4
,
-
6
,
0
,
-
1
,
'\001'
,
'\0'
,
'i'
,
'\0'
,
'\0'
},
};
/* ----------------------------------------------------------------
...
...
src/backend/commands/vacuum.c
View file @
32cd09ac
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.4
8 1997/09/22 07:12:33
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.4
9 1997/11/02 15:25:07
vadim Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -742,54 +742,60 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
htup
=
(
HeapTuple
)
PageGetItem
(
page
,
itemid
);
tupgone
=
false
;
if
(
!
AbsoluteTimeIsBackwardCompatiblyValid
(
htup
->
t_tmin
)
&&
TransactionIdIsValid
((
TransactionId
)
htup
->
t_xmin
))
if
(
!
(
htup
->
t_infomask
&
HEAP_XMIN_COMMITTED
))
{
if
(
TransactionIdDidAbort
(
htup
->
t_xmin
))
{
if
(
htup
->
t_infomask
&
HEAP_XMIN_INVALID
)
tupgone
=
true
;
}
else
if
(
TransactionIdDidCommit
(
htup
->
t_xmin
))
{
htup
->
t_tmin
=
TransactionIdGetCommitTime
(
htup
->
t_xmin
);
pgchanged
=
true
;
}
else
if
(
!
TransactionIdIsInProgress
(
htup
->
t_xmin
))
{
/*
* Not Aborted, Not Committed, Not in Progress - so it
* from crashed process. - vadim 11/26/96
*/
ncrash
++
;
tupgone
=
true
;
}
else
{
elog
(
NOTICE
,
"Rel %s: TID %u/%u: InsertTransactionInProgress %u - can't shrink relation"
,
relname
,
blkno
,
offnum
,
htup
->
t_xmin
);
do_shrinking
=
false
;
if
(
TransactionIdDidAbort
(
htup
->
t_xmin
))
tupgone
=
true
;
else
if
(
TransactionIdDidCommit
(
htup
->
t_xmin
))
{
htup
->
t_infomask
|=
HEAP_XMIN_COMMITTED
;
pgchanged
=
true
;
}
else
if
(
!
TransactionIdIsInProgress
(
htup
->
t_xmin
))
{
/*
* Not Aborted, Not Committed, Not in Progress -
* so it's from crashed process. - vadim 11/26/96
*/
ncrash
++
;
tupgone
=
true
;
}
else
{
elog
(
NOTICE
,
"Rel %s: TID %u/%u: InsertTransactionInProgress %u - can't shrink relation"
,
relname
,
blkno
,
offnum
,
htup
->
t_xmin
);
do_shrinking
=
false
;
}
}
}
if
(
TransactionIdIsValid
((
TransactionId
)
htup
->
t_xmax
))
/*
* here we are concerned about tuples with xmin committed
* and xmax unknown or committed
*/
if
(
htup
->
t_infomask
&
HEAP_XMIN_COMMITTED
&&
!
(
htup
->
t_infomask
&
HEAP_XMAX_INVALID
))
{
if
(
TransactionIdDidAbort
(
htup
->
t_xmax
))
if
(
htup
->
t_infomask
&
HEAP_XMAX_COMMITTED
)
tupgone
=
true
;
else
if
(
TransactionIdDidAbort
(
htup
->
t_xmax
))
{
StoreInvalidTransactionId
(
&
(
htup
->
t_xmax
))
;
htup
->
t_infomask
|=
HEAP_XMAX_INVALID
;
pgchanged
=
true
;
}
else
if
(
TransactionIdDidCommit
(
htup
->
t_xmax
))
tupgone
=
true
;
else
if
(
!
TransactionIdIsInProgress
(
htup
->
t_xmax
))
{
/*
* Not Aborted, Not Committed, Not in Progress - so it
* from crashed process. - vadim 06/02/97
*/
StoreInvalidTransactionId
(
&
(
htup
->
t_xmax
))
;
htup
->
t_infomask
|=
HEAP_XMAX_INVALID
;
;
pgchanged
=
true
;
}
else
...
...
@@ -800,18 +806,6 @@ vc_scanheap(VRelStats *vacrelstats, Relation onerel,
}
}
/*
* Is it possible at all ? - vadim 11/26/96
*/
if
(
!
TransactionIdIsValid
((
TransactionId
)
htup
->
t_xmin
))
{
elog
(
NOTICE
,
"Rel %s: TID %u/%u: INSERT_TRANSACTION_ID IS INVALID. \
DELETE_TRANSACTION_ID_VALID %d, TUPGONE %d."
,
relname
,
blkno
,
offnum
,
TransactionIdIsValid
((
TransactionId
)
htup
->
t_xmax
),
tupgone
);
}
/*
* It's possibly! But from where it comes ? And should we fix
* it ? - vadim 11/28/96
...
...
@@ -973,7 +967,6 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
{
TransactionId
myXID
;
CommandId
myCID
;
AbsoluteTime
myCTM
=
0
;
Buffer
buf
,
ToBuf
;
int
nblocks
,
...
...
@@ -1187,9 +1180,9 @@ vc_rpfheap(VRelStats *vacrelstats, Relation onerel,
TransactionIdStore
(
myXID
,
&
(
newtup
->
t_xmin
));
newtup
->
t_cmin
=
myCID
;
StoreInvalidTransactionId
(
&
(
newtup
->
t_xmax
));
newtup
->
t_tmin
=
INVALID_ABSTIME
;
newtup
->
t_
tmax
=
CURRENT_ABSTIME
;
ItemPointerSetInvalid
(
&
newtup
->
t_chain
)
;
/* set xmin to unknown and xmax to invalid */
newtup
->
t_
infomask
&=
~
(
HEAP_XACT_MASK
)
;
newtup
->
t_infomask
|=
HEAP_XMAX_INVALID
;
/* add tuple to the page */
newoff
=
PageAddItem
(
ToPage
,
(
Item
)
newtup
,
tlen
,
...
...
@@ -1209,7 +1202,8 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
/* now logically delete end-tuple */
TransactionIdStore
(
myXID
,
&
(
htup
->
t_xmax
));
htup
->
t_cmax
=
myCID
;
memmove
((
char
*
)
&
(
htup
->
t_chain
),
(
char
*
)
&
(
newtup
->
t_ctid
),
sizeof
(
newtup
->
t_ctid
));
/* set xmax to unknown */
htup
->
t_infomask
&=
~
(
HEAP_XMAX_INVALID
|
HEAP_XMAX_COMMITTED
);
ToVpd
->
vpd_nusd
++
;
nmoved
++
;
...
...
@@ -1278,11 +1272,10 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
FlushBufferPool
(
!
TransactionFlushEnabled
());
TransactionIdCommit
(
myXID
);
FlushBufferPool
(
!
TransactionFlushEnabled
());
myCTM
=
TransactionIdGetCommitTime
(
myXID
);
}
/*
* Clean uncleaned reapped pages from Vvpl list and set
commit' times
* Clean uncleaned reapped pages from Vvpl list and set
xmin committed
* for inserted tuples
*/
nchkmvd
=
0
;
...
...
@@ -1316,7 +1309,7 @@ failed to add item with len = %u to page %u (free space %u, nusd %u, noff %u)",
htup
=
(
HeapTuple
)
PageGetItem
(
page
,
itemid
);
if
(
TransactionIdEquals
((
TransactionId
)
htup
->
t_xmin
,
myXID
))
{
htup
->
t_
tmin
=
myCTM
;
htup
->
t_
infomask
|=
HEAP_XMIN_COMMITTED
;
ntups
++
;
}
}
...
...
src/backend/nodes/copyfuncs.c
View file @
32cd09ac
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.1
3 1997/09/19 06:52:49
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.1
4 1997/11/02 15:25:11
vadim Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -1470,21 +1470,8 @@ _copyRangeTblEntry(RangeTblEntry *from)
newnode
->
relname
=
pstrdup
(
from
->
relname
);
if
(
from
->
refname
)
newnode
->
refname
=
pstrdup
(
from
->
refname
);
if
(
from
->
timeRange
)
{
newnode
->
timeRange
=
makeNode
(
TimeRange
);
if
(
from
->
timeRange
->
startDate
)
newnode
->
timeRange
->
startDate
=
pstrdup
(
from
->
timeRange
->
startDate
);
else
newnode
->
timeRange
->
startDate
=
NULL
;
if
(
from
->
timeRange
->
endDate
)
newnode
->
timeRange
->
endDate
=
pstrdup
(
from
->
timeRange
->
endDate
);
else
newnode
->
timeRange
->
endDate
=
NULL
;
newnode
->
timeQual
=
makeTimeRange
(
newnode
->
timeRange
->
startDate
,
newnode
->
timeRange
->
endDate
,
((
newnode
->
timeRange
->
endDate
==
NULL
)
?
0
:
1
));
}
newnode
->
timeRange
=
NULL
;
newnode
->
timeQual
=
NULL
;
return
newnode
;
}
...
...
src/backend/parser/catalog_utils.c
View file @
32cd09ac
...
...
@@ -6,7 +6,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/catalog_utils.c,v 1.2
8 1997/09/18 20:21:05 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/catalog_utils.c,v 1.2
9 1997/11/02 15:25:19 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -75,21 +75,6 @@ struct
{
"cmax"
,
MaxCommandIdAttributeNumber
},
{
"chain"
,
ChainItemPointerAttributeNumber
},
{
"anchor"
,
AnchorItemPointerAttributeNumber
},
{
"tmin"
,
MinAbsoluteTimeAttributeNumber
},
{
"tmax"
,
MaxAbsoluteTimeAttributeNumber
},
{
"vtype"
,
VersionTypeAttributeNumber
}
};
#define SPECIALS (sizeof(special_attr)/sizeof(*special_attr))
...
...
@@ -101,11 +86,6 @@ static char *attnum_type[SPECIALS] = {
"cid"
,
"xid"
,
"cid"
,
"tid"
,
"tid"
,
"abstime"
,
"abstime"
,
"char"
};
#define MAXFARGS 8
/* max # args to a c or postquel function */
...
...
src/backend/parser/gram.y
View file @
32cd09ac
...
...
@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.6
1 1997/10/31 00:50:39 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.6
2 1997/11/02 15:25:26 vadim
Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
...
...
@@ -2391,12 +2391,14 @@ time_range: '[' opt_range_start ',' opt_range_end ']'
$$ = makeNode(TimeRange);
$$->startDate = $2;
$$->endDate = $4;
elog (WARN, "parser: TimeRange is not supported");
}
| '[' date ']'
{
$$ = makeNode(TimeRange);
$$->startDate = $2;
$$->endDate = NULL;
elog (WARN, "parser: TimeRange is not supported");
}
;
...
...
@@ -3387,7 +3389,6 @@ relation_name: SpecialRuleRelation
/* disallow refs to magic system tables */
if (strcmp(LogRelationName, $1) == 0
|| strcmp(VariableRelationName, $1) == 0
|| strcmp(TimeRelationName, $1) == 0
|| strcmp(MagicRelationName, $1) == 0)
elog(WARN,"%s cannot be accessed by users",$1);
else
...
...
src/backend/parser/parse_query.c
View file @
32cd09ac
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/parse_query.c,v 1.2
1 1997/09/08 21:46:08 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/Attic/parse_query.c,v 1.2
2 1997/11/02 15:25:30 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -243,67 +243,6 @@ expandAll(ParseState *pstate, char *relname, char *refname, int *this_resno)
return
(
te_head
);
}
TimeQual
makeTimeRange
(
char
*
datestring1
,
char
*
datestring2
,
int
timecode
)
/* 0 = snapshot , 1 = timerange */
{
TimeQual
qual
=
NULL
;
AbsoluteTime
t1
,
t2
;
switch
(
timecode
)
{
case
0
:
if
(
datestring1
==
NULL
)
{
elog
(
WARN
,
"MakeTimeRange: bad snapshot arg"
);
}
t1
=
nabstimein
(
datestring1
);
if
(
!
AbsoluteTimeIsValid
(
t1
))
{
elog
(
WARN
,
"bad snapshot time:
\"
%s
\"
"
,
datestring1
);
}
qual
=
TimeFormSnapshotTimeQual
(
t1
);
break
;
case
1
:
if
(
datestring1
==
NULL
)
{
t1
=
NOSTART_ABSTIME
;
}
else
{
t1
=
nabstimein
(
datestring1
);
if
(
!
AbsoluteTimeIsValid
(
t1
))
{
elog
(
WARN
,
"bad range start time:
\"
%s
\"
"
,
datestring1
);
}
}
if
(
datestring2
==
NULL
)
{
t2
=
NOEND_ABSTIME
;
}
else
{
t2
=
nabstimein
(
datestring2
);
if
(
!
AbsoluteTimeIsValid
(
t2
))
{
elog
(
WARN
,
"bad range end time:
\"
%s
\"
"
,
datestring2
);
}
}
qual
=
TimeFormRangedTimeQual
(
t1
,
t2
);
break
;
default:
elog
(
WARN
,
"MakeTimeRange: internal parser error"
);
}
return
qual
;
}
static
void
disallow_setop
(
char
*
op
,
Type
optype
,
Node
*
operand
)
{
...
...
src/backend/storage/buffer/buf_init.c
View file @
32cd09ac
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.1
4 1997/09/18 20:21:16 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/buffer/buf_init.c,v 1.1
5 1997/11/02 15:25:36 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -70,9 +70,7 @@ extern IpcSemaphoreId WaitIOSemId;
long
*
PrivateRefCount
;
/* also used in freelist.c */
long
*
LastRefCount
;
/* refcounts of last ExecMain level */
long
*
CommitInfoNeedsSave
;
/* to write buffers where we have filled
* in */
/* t_tmin (or t_tmax) */
* in t_infomask */
/*
* Data Structures:
...
...
src/backend/storage/large_object/inv_api.c
View file @
32cd09ac
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.1
8 1997/09/12 04:08:15 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.1
9 1997/11/02 15:25:40 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -25,6 +25,7 @@
#include "access/heapam.h"
#include "access/relscan.h"
#include "access/tupdesc.h"
#include "access/transam.h"
#include "access/xact.h"
#include "access/nbtree.h"
#include "access/tupdesc.h"
...
...
@@ -791,6 +792,7 @@ inv_wrold(LargeObjectDesc *obj_desc,
TransactionIdStore
(
GetCurrentTransactionId
(),
&
(
htup
->
t_xmax
));
htup
->
t_cmax
=
GetCurrentCommandId
();
htup
->
t_infomask
&=
~
(
HEAP_XMAX_COMMITTED
|
HEAP_XMAX_INVALID
);
/*
* If we're overwriting the entire block, we're lucky. All we need to
...
...
@@ -1005,18 +1007,14 @@ inv_newtuple(LargeObjectDesc *obj_desc,
ntup
->
t_len
=
tupsize
;
ItemPointerSet
(
&
(
ntup
->
t_ctid
),
BufferGetBlockNumber
(
buffer
),
off
);
ItemPointerSetInvalid
(
&
(
ntup
->
t_chain
));
LastOidProcessed
=
ntup
->
t_oid
=
newoid
();
TransactionIdStore
(
GetCurrentTransactionId
(),
&
(
ntup
->
t_xmin
));
ntup
->
t_cmin
=
GetCurrentCommandId
();
StoreInvalidTransactionId
(
&
(
ntup
->
t_xmax
));
ntup
->
t_cmax
=
0
;
ntup
->
t_tmin
=
INVALID_ABSTIME
;
ntup
->
t_tmax
=
CURRENT_ABSTIME
;
ntup
->
t_infomask
=
HEAP_XMAX_INVALID
;
ntup
->
t_natts
=
2
;
ntup
->
t_hoff
=
hoff
;
ntup
->
t_vtype
=
0
;
ntup
->
t_infomask
=
0x0
;
/* if a NULL is passed in, avoid the calculations below */
if
(
dbuf
==
NULL
)
...
...
@@ -1132,22 +1130,20 @@ DumpPage(Page page, int blkno)
printf("\n\t:ctid=%s:oid=%d",
ItemPointerFormExternal(&tup->t_ctid),
tup->t_oid);
printf(":natts=%d:thoff=%d:
vtype=`%c' (0x%02x):
",
printf(":natts=%d:thoff=%d:",
tup->t_natts,
tup->t_hoff
, tup->t_vtype, tup->t_vtype
);
tup->t_hoff);
printf("\n\t:
tmin=%d:
cmin=%u:",
tup->t_
tmin, tup->t_
cmin);
printf("\n\t:cmin=%u:",
tup->t_cmin);
printf("xmin=%u:", tup->t_xmin);
printf("\n\t:
tmax=%d:
cmax=%u:",
tup->t_
tmax, tup->t_
cmax);
printf("\n\t:cmax=%u:",
tup->t_cmax);
printf("xmax=%u:", tup->t_xmax);
printf("xmax=%u:
\n
", tup->t_xmax);
printf("\n\t:chain=%s:\n",
ItemPointerFormExternal(&tup->t_chain));
} else
putchar('\n');
}
...
...
src/backend/tcop/postgres.c
View file @
32cd09ac
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.5
0 1997/10/25 01:10:16 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.5
1 1997/11/02 15:25:45 vadim
Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
...
...
@@ -495,54 +495,6 @@ pg_plan(char *query_string, /* string to execute */
querytree_list
=
new_list
;
/* ----------------
* Fix time range quals
* this _must_ go here, because it must take place after rewrites
* ( if they take place ) so that time quals are usable by the executor
*
* Also, need to frob the range table entries here to plan union
* queries for archived relations.
* ----------------
*/
for
(
i
=
0
;
i
<
querytree_list
->
len
;
i
++
)
{
List
*
l
;
List
*
rt
=
NULL
;
querytree
=
querytree_list
->
qtrees
[
i
];
/* ----------------
* utilities don't have time ranges
* ----------------
*/
if
(
querytree
->
commandType
==
CMD_UTILITY
)
continue
;
rt
=
querytree
->
rtable
;
foreach
(
l
,
rt
)
{
RangeTblEntry
*
rte
=
lfirst
(
l
);
TimeRange
*
timequal
=
rte
->
timeRange
;
if
(
timequal
)
{
int
timecode
=
(
rte
->
timeRange
->
endDate
==
NULL
)
?
0
:
1
;
rte
->
timeQual
=
makeTimeRange
(
rte
->
timeRange
->
startDate
,
rte
->
timeRange
->
endDate
,
timecode
);
}
else
{
rte
->
timeQual
=
NULL
;
}
}
/* check for archived relations */
plan_archive
(
rt
);
}
if
(
DebugPrintRewrittenParsetree
==
true
)
{
printf
(
"
\n
----
\t
after rewriting:
\n
"
);
...
...
@@ -1391,7 +1343,7 @@ PostgresMain(int argc, char *argv[])
if
(
IsUnderPostmaster
==
false
)
{
puts
(
"
\n
POSTGRES backend interactive interface"
);
puts
(
"$Revision: 1.5
0 $ $Date: 1997/10/25 01:10:16
$"
);
puts
(
"$Revision: 1.5
1 $ $Date: 1997/11/02 15:25:45
$"
);
}
/* ----------------
...
...
src/backend/utils/adt/char.c
View file @
32cd09ac
...
...
@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.1
3 1997/10/25 05:12:38 thomas
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/adt/char.c,v 1.1
4 1997/11/02 15:25:57 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -81,12 +81,7 @@ cidout(int32 c)
char
*
result
;
CommandId
c2
;
/*
* cid is a number between 0 .. 2^16-1, therefore we need at most 6
* chars for the string (5 digits + '\0') NOTE: print it as an
* UNSIGNED int!
*/
result
=
palloc
(
6
);
result
=
palloc
(
12
);
c2
=
(
CommandId
)
c
;
sprintf
(
result
,
"%u"
,
(
unsigned
)
(
c2
));
return
(
result
);
...
...
src/backend/utils/cache/relcache.c
View file @
32cd09ac
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.2
6 1997/10/25 05:38:52 thomas
Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.2
7 1997/11/02 15:26:06 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -80,7 +80,6 @@
#include "catalog/pg_variable.h"
#include "catalog/pg_log.h"
#include "catalog/pg_time.h"
#include "catalog/pg_attrdef.h"
#include "catalog/pg_relcheck.h"
#include "catalog/indexing.h"
...
...
@@ -118,7 +117,6 @@ FormData_pg_attribute Desc_pg_proc[Natts_pg_proc] = {Schema_pg_proc};
FormData_pg_attribute
Desc_pg_type
[
Natts_pg_type
]
=
{
Schema_pg_type
};
FormData_pg_attribute
Desc_pg_variable
[
Natts_pg_variable
]
=
{
Schema_pg_variable
};
FormData_pg_attribute
Desc_pg_log
[
Natts_pg_log
]
=
{
Schema_pg_log
};
FormData_pg_attribute
Desc_pg_time
[
Natts_pg_time
]
=
{
Schema_pg_time
};
/* ----------------
* global variables
...
...
@@ -1679,7 +1677,6 @@ RelationInitialize(void)
formrdesc
(
TypeRelationName
,
Natts_pg_type
,
Desc_pg_type
);
formrdesc
(
VariableRelationName
,
Natts_pg_variable
,
Desc_pg_variable
);
formrdesc
(
LogRelationName
,
Natts_pg_log
,
Desc_pg_log
);
formrdesc
(
TimeRelationName
,
Natts_pg_time
,
Desc_pg_time
);
/*
* If this isn't initdb time, then we want to initialize some index
...
...
src/backend/utils/init/globals.c
View file @
32cd09ac
...
...
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.1
4 1997/09/18 14:33:46
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/init/globals.c,v 1.1
5 1997/11/02 15:26:12
vadim Exp $
*
* NOTES
* Globals used all over the place should be declared here and not
...
...
@@ -114,7 +114,6 @@ char *SharedSystemRelationNames[] = {
LogRelationName
,
MagicRelationName
,
ServerRelationName
,
TimeRelationName
,
UserRelationName
,
VariableRelationName
,
0
...
...
src/backend/utils/time/tqual.c
View file @
32cd09ac
This diff is collapsed.
Click to expand it.
src/include/access/heapam.h
View file @
32cd09ac
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: heapam.h,v 1.2
0 1997/10/30 23:37:01 momjian
Exp $
* $Id: heapam.h,v 1.2
1 1997/11/02 15:26:37 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -142,7 +142,7 @@ extern void heap_restrpos(HeapScanDesc sdesc);
extern
Size
ComputeDataSize
(
TupleDesc
tupleDesc
,
Datum
value
[],
char
nulls
[]);
extern
void
DataFill
(
char
*
data
,
TupleDesc
tupleDesc
,
Datum
value
[],
char
nulls
[],
char
*
infomask
,
Datum
value
[],
char
nulls
[],
uint16
*
infomask
,
bits8
*
bit
);
extern
int
heap_attisnull
(
HeapTuple
tup
,
int
attnum
);
extern
int
heap_sysattrlen
(
AttrNumber
attno
);
...
...
src/include/access/htup.h
View file @
32cd09ac
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: htup.h,v 1.
6 1997/09/08 21:50:46 momjian
Exp $
* $Id: htup.h,v 1.
7 1997/11/02 15:26:42 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -28,33 +28,25 @@
*/
typedef
struct
HeapTupleData
{
unsigned
int
t_len
;
/* length of entire tuple */
unsigned
int
t_len
;
/* length of entire tuple
*/
Oid
t_oid
;
/* OID of this tuple -- 4 bytes
*/
ItemPointerData
t_ctid
;
/* current TID of this tuple */
CommandId
t_cmin
;
/* insert CID stamp -- 4 bytes each */
CommandId
t_cmax
;
/* delete CommandId stamp */
ItemPointerData
t_chain
;
/* replaced tuple TID */
TransactionId
t_xmin
;
/* insert XID stamp -- 4 bytes each */
TransactionId
t_xmax
;
/* delete XID stamp */
Oid
t_oid
;
/* OID of this tuple -- 4 bytes */
ItemPointerData
t_ctid
;
/* current TID of this tuple */
int16
t_natts
;
/* number of attributes */
CommandId
t_cmin
;
/* insert CID stamp -- 2 bytes each */
CommandId
t_cmax
;
/* delete CommandId stamp */
uint16
t_infomask
;
/* various infos */
TransactionId
t_xmin
;
/* insert XID stamp -- 4 bytes each */
TransactionId
t_xmax
;
/* delete XID stamp */
uint8
t_hoff
;
/* sizeof tuple header */
AbsoluteTime
t_tmin
;
/* time stamps -- 4 bytes each */
AbsoluteTime
t_tmax
;
int16
t_natts
;
/* number of attributes */
char
t_vtype
;
/* not used - padding */
char
t_infomask
;
/* whether tuple as null or variable
* length attributes */
uint8
t_hoff
;
/* sizeof tuple header */
bits8
t_bits
[
MinHeapTupleBitmapSize
/
8
];
bits8
t_bits
[
MinHeapTupleBitmapSize
/
8
];
/* bit map of domains */
/* MORE DATA FOLLOWS AT END OF STRUCT */
...
...
@@ -69,12 +61,7 @@ typedef HeapTupleData *HeapTuple;
#define MinCommandIdAttributeNumber (-4)
#define MaxTransactionIdAttributeNumber (-5)
#define MaxCommandIdAttributeNumber (-6)
#define ChainItemPointerAttributeNumber (-7)
#define AnchorItemPointerAttributeNumber (-8)
#define MinAbsoluteTimeAttributeNumber (-9)
#define MaxAbsoluteTimeAttributeNumber (-10)
#define VersionTypeAttributeNumber (-11)
#define FirstLowInvalidHeapAttributeNumber (-12)
#define FirstLowInvalidHeapAttributeNumber (-7)
/* ----------------
...
...
@@ -101,9 +88,15 @@ typedef HeapTupleData *HeapTuple;
/*
* information stored in t_infomask:
*/
#define HEAP_HASNULL 0x01
/* has null attribute(s) */
#define HEAP_HASVARLENA 0x02
/* has variable length
#define HEAP_HASNULL 0x0
00
1
/* has null attribute(s) */
#define HEAP_HASVARLENA 0x0
00
2
/* has variable length
* attribute(s) */
#define HEAP_XMIN_COMMITTED 0x0100
/* t_xmin committed */
#define HEAP_XMIN_INVALID 0x0200
/* t_xmin invalid/aborted */
#define HEAP_XMAX_COMMITTED 0x0400
/* t_xmax committed */
#define HEAP_XMAX_INVALID 0x0800
/* t_xmax invalid/aborted */
#define HEAP_XACT_MASK 0x0F00
/* */
#define HeapTupleNoNulls(tuple) \
(!(((HeapTuple) (tuple))->t_infomask & HEAP_HASNULL))
...
...
src/include/access/transam.h
View file @
32cd09ac
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: transam.h,v 1.1
1 1997/09/08 21:51:03 momjian
Exp $
* $Id: transam.h,v 1.1
2 1997/11/02 15:26:44 vadim
Exp $
*
* NOTES
* Transaction System Version 101 now support proper oid
...
...
@@ -18,7 +18,6 @@
#define TRANSAM_H
#include <storage/bufmgr.h>
#include <utils/nabstime.h>
/* ----------------
* transaction system version id
...
...
@@ -33,19 +32,19 @@
* even if their minor versions differ.
* ----------------
*/
#define TRANS_SYSTEM_VERSION
101
#define TRANS_SYSTEM_VERSION
200
/* ----------------
* transaction id status values
*
* someday we will use "11" = 3 = XID_
INVALI
D to mean the
*
starting of run-length encoded log data
.
* someday we will use "11" = 3 = XID_
COMMIT_CHIL
D to mean the
*
commiting of child xactions
.
* ----------------
*/
#define XID_COMMIT 2
/* transaction commited */
#define XID_ABORT 1
/* transaction aborted */
#define XID_INPROGRESS 0
/* transaction in progress */
#define XID_
INVALID 3
/* other
*/
#define XID_COMMIT
2
/* transaction commited */
#define XID_ABORT
1
/* transaction aborted */
#define XID_INPROGRESS
0
/* transaction in progress */
#define XID_
COMMIT_CHILD 3
/* child xact commited
*/
typedef
unsigned
char
XidStatus
;
/* (2 bits) */
...
...
@@ -69,7 +68,6 @@ typedef unsigned char XidStatus;/* (2 bits) */
*/
#define TP_DataSize BLCKSZ
#define TP_NumXidStatusPerBlock (TP_DataSize * 4)
#define TP_NumTimePerBlock (TP_DataSize / 4)
/* ----------------
* LogRelationContents structure
...
...
@@ -90,25 +88,6 @@ typedef struct LogRelationContentsData
typedef
LogRelationContentsData
*
LogRelationContents
;
/* ----------------
* TimeRelationContents structure
*
* This structure describes the storage of the data in the
* first 2048 bytes of the time relation. This storage is never
* used for transaction commit times because transaction id's begin
* their numbering at 512.
*
* The first 4 bytes of this relation store the version
* number of the transction system.
* ----------------
*/
typedef
struct
TimeRelationContentsData
{
int
TransSystemVersion
;
}
TimeRelationContentsData
;
typedef
TimeRelationContentsData
*
TimeRelationContents
;
/* ----------------
* VariableRelationContents structure
*
...
...
@@ -127,10 +106,10 @@ typedef TimeRelationContentsData *TimeRelationContents;
*/
typedef
struct
VariableRelationContentsData
{
int
TransSystemVersion
;
TransactionId
nextXidData
;
TransactionId
lastXidData
;
Oid
nextOid
;
int
TransSystemVersion
;
TransactionId
nextXidData
;
TransactionId
lastXidData
;
/* unused */
Oid
nextOid
;
}
VariableRelationContentsData
;
typedef
VariableRelationContentsData
*
VariableRelationContents
;
...
...
@@ -143,7 +122,6 @@ typedef VariableRelationContentsData *VariableRelationContents;
/*
* prototypes for functions in transam/transam.c
*/
extern
AbsoluteTime
TransactionIdGetCommitTime
(
TransactionId
transactionId
);
extern
void
InitializeTransactionLog
(
void
);
extern
bool
TransactionIdDidCommit
(
TransactionId
transactionId
);
extern
bool
TransactionIdDidAbort
(
TransactionId
transactionId
);
...
...
@@ -162,18 +140,10 @@ extern void
TransBlockNumberSetXidStatus
(
Relation
relation
,
BlockNumber
blockNumber
,
TransactionId
xid
,
XidStatus
xstatus
,
bool
*
failP
);
extern
AbsoluteTime
TransBlockNumberGetCommitTime
(
Relation
relation
,
BlockNumber
blockNumber
,
TransactionId
xid
,
bool
*
failP
);
extern
void
TransBlockNumberSetCommitTime
(
Relation
relation
,
BlockNumber
blockNumber
,
TransactionId
xid
,
AbsoluteTime
xtime
,
bool
*
failP
);
/* in transam/varsup.c */
extern
void
VariableRelationPutNextXid
(
TransactionId
xid
);
extern
void
GetNewTransactionId
(
TransactionId
*
xid
);
extern
void
UpdateLastCommittedXid
(
TransactionId
xid
);
extern
void
GetNewObjectId
(
Oid
*
oid_return
);
extern
void
CheckMaxObjectId
(
Oid
assigned_oid
);
...
...
@@ -184,11 +154,8 @@ extern void CheckMaxObjectId(Oid assigned_oid);
/* in transam.c */
extern
Relation
LogRelation
;
extern
Relation
TimeRelation
;
extern
Relation
VariableRelation
;
extern
TransactionId
cachedGetCommitTimeXid
;
extern
AbsoluteTime
cachedGetCommitTime
;
extern
TransactionId
cachedTestXid
;
extern
XidStatus
cachedTestXidStatus
;
...
...
src/include/access/valid.h
View file @
32cd09ac
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: valid.h,v 1.
8 1997/09/18 14:20:45 momjian
Exp $
* $Id: valid.h,v 1.
9 1997/11/02 15:26:46 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -122,8 +122,6 @@ do \
/* We use underscores to protect the variable passed in as parameters */
\
HeapTuple _tuple; \
bool _res; \
TransactionId _old_tmin, \
_old_tmax; \
\
if (!ItemIdIsUsed(itemId)) \
(result) = (HeapTuple) NULL; \
...
...
@@ -144,11 +142,10 @@ do \
(result) = _tuple; \
else \
{ \
_old_tmin = _tuple->t_tmin
; \
_old_tmax = _tuple->t_tmax;
\
uint16 _infomask = _tuple->t_infomask
; \
\
_res = HeapTupleSatisfiesTimeQual(_tuple, (qual)); \
if (_tuple->t_tmin != _old_tmin || \
_tuple->t_tmax != _old_tmax) \
if (_tuple->t_infomask != _infomask) \
SetBufferCommitInfoNeedsSave(buffer); \
if (_res) \
(result) = _tuple; \
...
...
src/include/access/xact.h
View file @
32cd09ac
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: xact.h,v 1.
9 1997/09/08 21:51:06 momjian
Exp $
* $Id: xact.h,v 1.
10 1997/11/02 15:26:48 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -53,6 +53,12 @@ typedef struct TransactionStateData
typedef
TransactionStateData
*
TransactionState
;
#define TransactionIdIsValid(xid) ((bool) (xid != NullTransactionId))
#define TransactionIdStore(xid, dest) \
(*((TransactionId*)dest) = (TransactionId)xid)
#define StoreInvalidTransactionId(dest) \
(*((TransactionId*)dest) = NullTransactionId)
/* ----------------
* extern definitions
* ----------------
...
...
@@ -88,11 +94,6 @@ extern TransactionId DisabledTransactionId;
extern
TransactionId
xidin
(
char
*
representation
);
extern
char
*
xidout
(
TransactionId
transactionId
);
extern
bool
xideq
(
TransactionId
xid1
,
TransactionId
xid2
);
extern
bool
TransactionIdIsValid
(
TransactionId
transactionId
);
extern
void
StoreInvalidTransactionId
(
TransactionId
*
destination
);
extern
void
TransactionIdStore
(
TransactionId
transactionId
,
TransactionId
*
destination
);
extern
bool
TransactionIdEquals
(
TransactionId
id1
,
TransactionId
id2
);
extern
bool
TransactionIdIsLessThan
(
TransactionId
id1
,
TransactionId
id2
);
extern
void
TransactionIdAdd
(
TransactionId
*
xid
,
int
value
);
...
...
src/include/catalog/catname.h
View file @
32cd09ac
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: catname.h,v 1.
6 1997/09/08 02:34:47 momjian
Exp $
* $Id: catname.h,v 1.
7 1997/11/02 15:26:50 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -40,7 +40,6 @@
#define RewriteRelationName "pg_rewrite"
#define ServerRelationName "pg_server"
#define StatisticRelationName "pg_statistic"
#define TimeRelationName "pg_time"
#define TypeRelationName "pg_type"
#define UserRelationName "pg_user"
#define VariableRelationName "pg_variable"
...
...
src/include/catalog/pg_attribute.h
View file @
32cd09ac
This diff is collapsed.
Click to expand it.
src/include/catalog/pg_class.h
View file @
32cd09ac
...
...
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_class.h,v 1.1
1 1997/09/08 02:35:03 momjian
Exp $
* $Id: pg_class.h,v 1.1
2 1997/11/02 15:26:59 vadim
Exp $
*
* NOTES
* ``pg_relation'' is being replaced by ``pg_class''. currently
...
...
@@ -141,7 +141,6 @@ DATA(insert OID = 1262 ( pg_database 88 PGUID 0 0 0 0 0 f t r n 3 0 0 0 f _nu
DATA
(
insert
OID
=
1263
(
pg_defaults
89
PGUID
0
0
0
0
0
f
t
r
n
2
0
0
0
f
_null_
));
DATA
(
insert
OID
=
1264
(
pg_variable
90
PGUID
0
0
0
0
0
f
t
s
n
2
0
0
0
f
_null_
));
DATA
(
insert
OID
=
1269
(
pg_log
99
PGUID
0
0
0
0
0
f
t
s
n
1
0
0
0
f
_null_
));
DATA
(
insert
OID
=
1271
(
pg_time
100
PGUID
0
0
0
0
0
f
t
s
n
1
0
0
0
f
_null_
));
DATA
(
insert
OID
=
1273
(
pg_hosts
101
PGUID
0
0
0
0
0
f
t
s
n
3
0
0
0
f
_null_
));
DATA
(
insert
OID
=
1215
(
pg_attrdef
109
PGUID
0
0
0
0
0
t
t
r
n
4
0
0
0
f
_null_
));
DATA
(
insert
OID
=
1216
(
pg_relcheck
110
PGUID
0
0
0
0
0
t
t
r
n
4
0
0
0
f
_null_
));
...
...
@@ -160,7 +159,6 @@ DATA(insert OID = 1219 ( pg_trigger 111 PGUID 0 0 0 0 0 t t r n 7 0 0 0 f _nu
#define RelOid_pg_defaults 1263
#define RelOid_pg_variable 1264
#define RelOid_pg_log 1269
#define RelOid_pg_time 1271
#define RelOid_pg_hosts 1273
#define RelOid_pg_attrdef 1215
#define RelOid_pg_relcheck 1216
...
...
src/include/catalog/pg_time.h
deleted
100644 → 0
View file @
6cc0a00d
/*-------------------------------------------------------------------------
*
* pg_time.h--
* the system commit-time relation "pg_time" is not a "heap" relation.
* it is automatically created by the transam/ code and the
* information here is all bogus and is just here to make the
* relcache code happy.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_time.h,v 1.4 1997/09/08 02:35:28 momjian Exp $
*
* NOTES
* The structures and macros used by the transam/ code
* to access pg_time should some day go here -cim 6/18/90
*
*-------------------------------------------------------------------------
*/
#ifndef PG_TIME_H
#define PG_TIME_H
/* ----------------
* postgres.h contains the system type definintions and the
* CATALOG(), BOOTSTRAP and DATA() sugar words so this file
* can be read by both genbki.sh and the C compiler.
* ----------------
*/
CATALOG
(
pg_time
)
BOOTSTRAP
{
Oid
timefoo
;
}
FormData_pg_time
;
typedef
FormData_pg_time
*
Form_pg_time
;
#define Natts_pg_time 1
#define Anum_pg_time_timefoo 1
#endif
/* PG_TIME_H */
src/include/catalog/pg_type.h
View file @
32cd09ac
...
...
@@ -7,7 +7,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_type.h,v 1.
19 1997/09/08 21:51:31 momjian
Exp $
* $Id: pg_type.h,v 1.
20 1997/11/02 15:27:03 vadim
Exp $
*
* NOTES
* the genbki.sh script reads this file and generates .bki
...
...
@@ -186,7 +186,7 @@ DATA(insert OID = 26 ( oid PGUID 4 10 t b t \054 0 0 int4in int4out int4
DATA
(
insert
OID
=
27
(
tid
PGUID
6
19
f
b
t
\
054
0
0
tidin
tidout
tidin
tidout
i
_null_
));
DATA
(
insert
OID
=
28
(
xid
PGUID
4
12
t
b
t
\
054
0
0
xidin
xidout
xidin
xidout
i
_null_
));
DATA
(
insert
OID
=
29
(
cid
PGUID
2
3
t
b
t
\
054
0
0
cidin
cidout
cidin
cidout
s
_null_
));
DATA
(
insert
OID
=
29
(
cid
PGUID
4
10
t
b
t
\
054
0
0
cidin
cidout
cidin
cidout
i
_null_
));
DATA
(
insert
OID
=
30
(
oid8
PGUID
32
89
f
b
t
\
054
0
26
oid8in
oid8out
oid8in
oid8out
i
_null_
));
DATA
(
insert
OID
=
32
(
SET
PGUID
-
1
-
1
f
r
t
\
054
0
-
1
textin
textout
textin
textout
i
_null_
));
...
...
@@ -206,7 +206,6 @@ DATA(insert OID = 99 ( pg_log PGUID 1 1 t b t \054 1269 0 foo bar foo bar c _n
/* OIDS 100 - 199 */
DATA
(
insert
OID
=
100
(
pg_time
PGUID
1
1
t
b
t
\
054
1271
0
foo
bar
foo
bar
c
_null_
));
DATA
(
insert
OID
=
101
(
pg_hosts
PGUID
1
1
t
b
t
\
054
1273
0
foo
bar
foo
bar
c
_null_
));
DATA
(
insert
OID
=
109
(
pg_attrdef
PGUID
1
1
t
b
t
\
054
1215
0
foo
bar
foo
bar
c
_null_
));
DATA
(
insert
OID
=
110
(
pg_relcheck
PGUID
1
1
t
b
t
\
054
1216
0
foo
bar
foo
bar
c
_null_
));
...
...
src/include/parser/parse_query.h
View file @
32cd09ac
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: parse_query.h,v 1.1
2 1997/09/08 21:53:39 momjian
Exp $
* $Id: parse_query.h,v 1.1
3 1997/11/02 15:27:08 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -34,9 +34,6 @@ addRangeTableEntry(ParseState *pstate,
extern
List
*
expandAll
(
ParseState
*
pstate
,
char
*
relname
,
char
*
refname
,
int
*
this_resno
);
extern
TimeQual
makeTimeRange
(
char
*
datestring1
,
char
*
datestring2
,
int
timecode
);
extern
Expr
*
make_op
(
char
*
opname
,
Node
*
ltree
,
Node
*
rtree
);
extern
Oid
find_atttype
(
Oid
relid
,
char
*
attrname
);
...
...
src/include/postgres.h
View file @
32cd09ac
...
...
@@ -6,7 +6,7 @@
*
* Copyright (c) 1995, Regents of the University of California
*
* $Id: postgres.h,v 1.
9 1997/09/08 21:50:28 momjian
Exp $
* $Id: postgres.h,v 1.
10 1997/11/02 15:26:28 vadim
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -163,7 +163,7 @@ typedef struct OidNameData *OidName;
typedef
uint32
TransactionId
;
#define InvalidTransactionId 0
typedef
uint
16
CommandId
;
typedef
uint
32
CommandId
;
#define FirstCommandId 0
...
...
src/include/utils/tqual.h
View file @
32cd09ac
/*-------------------------------------------------------------------------
*
* tqual.h--
* POSTGRES
time
qualification definitions.
* POSTGRES
"time"
qualification definitions.
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: tqual.h,v 1.9 1997/09/08 21:55:19 momjian Exp $
*
* NOTE
* It may be desirable to allow time qualifications to indicate
* relative times.
* $Id: tqual.h,v 1.10 1997/11/02 15:27:14 vadim Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -19,11 +15,6 @@
#include <access/htup.h>
typedef
struct
TimeQualSpace
{
char
data
[
12
];
}
TimeQualSpace
;
typedef
Pointer
TimeQual
;
/* Tuples valid as of StartTransactionCommand */
...
...
@@ -35,10 +26,6 @@ extern TimeQual SelfTimeQual;
extern
void
setheapoverride
(
bool
on
);
extern
bool
heapisoverride
(
void
);
extern
TimeQual
TimeFormSnapshotTimeQual
(
AbsoluteTime
time
);
extern
TimeQual
TimeFormRangedTimeQual
(
AbsoluteTime
startTime
,
AbsoluteTime
endTime
);
extern
bool
HeapTupleSatisfiesTimeQual
(
HeapTuple
tuple
,
TimeQual
qual
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment