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
c13a64d7
Commit
c13a64d7
authored
Dec 16, 1998
by
Vadim B. Mikheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Serialized mode works!
parent
54c3e652
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
209 additions
and
47 deletions
+209
-47
src/backend/access/transam/transam.c
src/backend/access/transam/transam.c
+9
-19
src/backend/access/transam/xact.c
src/backend/access/transam/xact.c
+7
-1
src/backend/executor/execMain.c
src/backend/executor/execMain.c
+2
-2
src/backend/storage/ipc/shmem.c
src/backend/storage/ipc/shmem.c
+7
-14
src/backend/storage/lmgr/lmgr.c
src/backend/storage/lmgr/lmgr.c
+2
-1
src/backend/tcop/postgres.c
src/backend/tcop/postgres.c
+5
-4
src/backend/utils/time/tqual.c
src/backend/utils/time/tqual.c
+160
-1
src/include/access/transam.h
src/include/access/transam.h
+2
-1
src/include/utils/tqual.h
src/include/utils/tqual.h
+15
-4
No files found.
src/backend/access/transam/transam.c
View file @
c13a64d7
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.2
0 1998/12/15 12:45:30
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/transam.c,v 1.2
1 1998/12/16 11:53:44
vadim Exp $
*
*
* NOTES
* NOTES
* This file contains the high level access-method interface to the
* This file contains the high level access-method interface to the
...
@@ -171,13 +171,9 @@ TransactionLogTest(TransactionId transactionId, /* transaction id to test */
...
@@ -171,13 +171,9 @@ TransactionLogTest(TransactionId transactionId, /* transaction id to test */
&
fail
);
&
fail
);
if
(
!
fail
)
if
(
!
fail
)
{
/* must not cache status of running xaction !!! */
if
(
xidstatus
!=
XID_INPROGRESS
)
{
{
TransactionIdStore
(
transactionId
,
&
cachedTestXid
);
TransactionIdStore
(
transactionId
,
&
cachedTestXid
);
cachedTestXidStatus
=
xidstatus
;
cachedTestXidStatus
=
xidstatus
;
}
return
(
bool
)
return
(
bool
)
(
status
==
xidstatus
);
(
status
==
xidstatus
);
}
}
...
@@ -230,11 +226,8 @@ TransactionLogUpdate(TransactionId transactionId, /* trans id to update */
...
@@ -230,11 +226,8 @@ TransactionLogUpdate(TransactionId transactionId, /* trans id to update */
*
*
* What's the hell ?! Why != XID_COMMIT ?!
* What's the hell ?! Why != XID_COMMIT ?!
*/
*/
if
(
status
!=
XID_INPROGRESS
)
{
TransactionIdStore
(
transactionId
,
&
cachedTestXid
);
TransactionIdStore
(
transactionId
,
&
cachedTestXid
);
cachedTestXidStatus
=
status
;
cachedTestXidStatus
=
status
;
}
}
}
...
@@ -588,14 +581,11 @@ TransactionIdAbort(TransactionId transactionId)
...
@@ -588,14 +581,11 @@ TransactionIdAbort(TransactionId transactionId)
TransactionLogUpdate
(
transactionId
,
XID_ABORT
);
TransactionLogUpdate
(
transactionId
,
XID_ABORT
);
}
}
#ifdef NOT_USED
void
void
TransactionId
SetInProgress
(
TransactionId
transactionId
)
TransactionId
FlushCache
(
)
{
{
if
(
AMI_OVERRIDE
)
return
;
Transaction
LogUpdate
(
transactionId
,
XID_INPROGRESS
);
Transaction
IdStore
(
AmiTransactionId
,
&
cachedTestXid
);
}
cachedTestXidStatus
=
XID_COMMIT
;
#endif
}
src/backend/access/transam/xact.c
View file @
c13a64d7
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.2
6 1998/12/15 12:45:35
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.2
7 1998/12/16 11:53:44
vadim Exp $
*
*
* NOTES
* NOTES
* Transaction aborts can now occur two ways:
* Transaction aborts can now occur two ways:
...
@@ -516,6 +516,9 @@ CommandCounterIncrement()
...
@@ -516,6 +516,9 @@ CommandCounterIncrement()
/* make cache changes visible to me */
/* make cache changes visible to me */
AtCommit_Cache
();
AtCommit_Cache
();
AtStart_Cache
();
AtStart_Cache
();
TransactionIdFlushCache
();
}
}
void
void
...
@@ -793,6 +796,9 @@ StartTransaction()
...
@@ -793,6 +796,9 @@ StartTransaction()
{
{
TransactionState
s
=
CurrentTransactionState
;
TransactionState
s
=
CurrentTransactionState
;
TransactionIdFlushCache
();
FreeXactSnapshot
();
/* ----------------
/* ----------------
* Check the current transaction state. If the transaction system
* Check the current transaction state. If the transaction system
* is switched off, or if we're already in a transaction, do nothing.
* is switched off, or if we're already in a transaction, do nothing.
...
...
src/backend/executor/execMain.c
View file @
c13a64d7
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.6
0 1998/12/15 12:46:04
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.6
1 1998/12/16 11:53:45
vadim Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -124,7 +124,7 @@ ExecutorStart(QueryDesc *queryDesc, EState *estate)
...
@@ -124,7 +124,7 @@ ExecutorStart(QueryDesc *queryDesc, EState *estate)
memset
(
estate
->
es_param_exec_vals
,
0
,
queryDesc
->
plantree
->
nParamExec
*
sizeof
(
ParamExecData
));
memset
(
estate
->
es_param_exec_vals
,
0
,
queryDesc
->
plantree
->
nParamExec
*
sizeof
(
ParamExecData
));
}
}
estate
->
es_snapshot
=
SnapshotNow
;
estate
->
es_snapshot
=
QuerySnapshot
;
result
=
InitPlan
(
queryDesc
->
operation
,
result
=
InitPlan
(
queryDesc
->
operation
,
queryDesc
->
parsetree
,
queryDesc
->
parsetree
,
...
...
src/backend/storage/ipc/shmem.c
View file @
c13a64d7
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.3
2 1998/12/15 12:46:24
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/shmem.c,v 1.3
3 1998/12/16 11:53:46
vadim Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -633,27 +633,21 @@ TransactionIdIsInProgress(TransactionId xid)
...
@@ -633,27 +633,21 @@ TransactionIdIsInProgress(TransactionId xid)
/*
/*
* GetSnapshotData -- returns information about running transactions.
* GetSnapshotData -- returns information about running transactions.
*
*
* InvalidTransactionId is used as terminator in snapshot->xip array.
* If serialized is true then XID >= current xact ID will not be
* placed in array. Current xact ID are never placed there (just
* to reduce its length, xmin/xmax may be equal to cid).
* MyProc->xmin will be setted if equal to InvalidTransactionId.
*
* Yet another strange func for this place... - vadim 07/21/98
* Yet another strange func for this place... - vadim 07/21/98
*/
*/
Snapshot
Snapshot
GetSnapshotData
(
bool
serialize
d
)
GetSnapshotData
(
voi
d
)
{
{
Snapshot
snapshot
=
(
Snapshot
)
malloc
(
sizeof
(
SnapshotData
));
Snapshot
snapshot
=
(
Snapshot
)
malloc
(
sizeof
(
SnapshotData
));
ShmemIndexEnt
*
result
;
ShmemIndexEnt
*
result
;
PROC
*
proc
;
PROC
*
proc
;
TransactionId
cid
=
GetCurrentTransactionId
();
TransactionId
cid
=
GetCurrentTransactionId
();
uint32
count
=
0
;
uint32
count
=
0
;
uint32
have
=
3
1
;
uint32
have
=
3
2
;
Assert
(
ShmemIndex
);
Assert
(
ShmemIndex
);
snapshot
->
xip
=
(
TransactionId
*
)
malloc
(
32
*
sizeof
(
TransactionId
));
snapshot
->
xip
=
(
TransactionId
*
)
malloc
(
have
*
sizeof
(
TransactionId
));
snapshot
->
xmax
=
cid
;
snapshot
->
xmax
=
cid
;
snapshot
->
xmin
=
cid
;
snapshot
->
xmin
=
cid
;
...
@@ -667,15 +661,14 @@ GetSnapshotData(bool serialized)
...
@@ -667,15 +661,14 @@ GetSnapshotData(bool serialized)
if
(
MyProc
->
xmin
==
InvalidTransactionId
)
if
(
MyProc
->
xmin
==
InvalidTransactionId
)
MyProc
->
xmin
=
snapshot
->
xmin
;
MyProc
->
xmin
=
snapshot
->
xmin
;
SpinRelease
(
ShmemIndexLock
);
SpinRelease
(
ShmemIndexLock
);
snapshot
->
x
ip
[
count
]
=
InvalidTransactionId
;
snapshot
->
x
cnt
=
count
;
return
snapshot
;
return
snapshot
;
}
}
if
(
result
->
location
==
INVALID_OFFSET
||
if
(
result
->
location
==
INVALID_OFFSET
||
strncmp
(
result
->
key
,
"PID "
,
4
)
!=
0
)
strncmp
(
result
->
key
,
"PID "
,
4
)
!=
0
)
continue
;
continue
;
proc
=
(
PROC
*
)
MAKE_PTR
(
result
->
location
);
proc
=
(
PROC
*
)
MAKE_PTR
(
result
->
location
);
if
(
proc
==
MyProc
||
proc
->
xid
<
FirstTransactionId
||
if
(
proc
==
MyProc
||
proc
->
xid
<
FirstTransactionId
)
(
serialized
&&
proc
->
xid
>=
cid
))
continue
;
continue
;
if
(
proc
->
xid
<
snapshot
->
xmin
)
if
(
proc
->
xid
<
snapshot
->
xmin
)
snapshot
->
xmin
=
proc
->
xid
;
snapshot
->
xmin
=
proc
->
xid
;
...
@@ -684,7 +677,7 @@ GetSnapshotData(bool serialized)
...
@@ -684,7 +677,7 @@ GetSnapshotData(bool serialized)
if
(
have
==
0
)
if
(
have
==
0
)
{
{
snapshot
->
xip
=
(
TransactionId
*
)
realloc
(
snapshot
->
xip
,
snapshot
->
xip
=
(
TransactionId
*
)
realloc
(
snapshot
->
xip
,
(
count
+
3
3
)
*
sizeof
(
TransactionId
));
(
count
+
3
2
)
*
sizeof
(
TransactionId
));
have
=
32
;
have
=
32
;
}
}
snapshot
->
xip
[
count
]
=
proc
->
xid
;
snapshot
->
xip
[
count
]
=
proc
->
xid
;
...
...
src/backend/storage/lmgr/lmgr.c
View file @
c13a64d7
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.2
0 1998/12/15 12:46:30
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/storage/lmgr/lmgr.c,v 1.2
1 1998/12/16 11:53:48
vadim Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -325,6 +325,7 @@ XactLockTableWait(TransactionId xid)
...
@@ -325,6 +325,7 @@ XactLockTableWait(TransactionId xid)
LockAcquire
(
LockTableId
,
&
tag
,
ShareLock
);
LockAcquire
(
LockTableId
,
&
tag
,
ShareLock
);
TransactionIdFlushCache
();
/*
/*
* Transaction was committed/aborted/crashed -
* Transaction was committed/aborted/crashed -
* we have to update pg_log if transaction is still
* we have to update pg_log if transaction is still
...
...
src/backend/tcop/postgres.c
View file @
c13a64d7
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.9
4 1998/10/16 06:05:13 momjian
Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.9
5 1998/12/16 11:53:52 vadim
Exp $
*
*
* NOTES
* NOTES
* this is the "main" module of the postgres backend and
* this is the "main" module of the postgres backend and
...
@@ -786,9 +786,10 @@ pg_exec_query_dest(char *query_string, /* string to execute */
...
@@ -786,9 +786,10 @@ pg_exec_query_dest(char *query_string, /* string to execute */
}
}
#endif
#endif
/* ----------------
SetQuerySnapshot
();
/*
* execute the plan
* execute the plan
*
*/
*/
if
(
ShowExecutorStats
)
if
(
ShowExecutorStats
)
ResetUsage
();
ResetUsage
();
...
@@ -1519,7 +1520,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
...
@@ -1519,7 +1520,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
if
(
!
IsUnderPostmaster
)
if
(
!
IsUnderPostmaster
)
{
{
puts
(
"
\n
POSTGRES backend interactive interface "
);
puts
(
"
\n
POSTGRES backend interactive interface "
);
puts
(
"$Revision: 1.9
4 $ $Date: 1998/10/16 06:05:13
$
\n
"
);
puts
(
"$Revision: 1.9
5 $ $Date: 1998/12/16 11:53:52
$
\n
"
);
}
}
/* ----------------
/* ----------------
...
...
src/backend/utils/time/tqual.c
View file @
c13a64d7
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.2
1 1998/12/15 12:46:40
vadim Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.2
2 1998/12/16 11:53:55
vadim Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -29,6 +29,9 @@ extern bool PostgresIsInitialized;
...
@@ -29,6 +29,9 @@ extern bool PostgresIsInitialized;
SnapshotData
SnapshotDirtyData
;
SnapshotData
SnapshotDirtyData
;
Snapshot
SnapshotDirty
=
&
SnapshotDirtyData
;
Snapshot
SnapshotDirty
=
&
SnapshotDirtyData
;
Snapshot
QuerySnapshot
=
NULL
;
static
Snapshot
SerializedSnapshot
=
NULL
;
/*
/*
* XXX Transaction system override hacks start here
* XXX Transaction system override hacks start here
*/
*/
...
@@ -436,3 +439,159 @@ HeapTupleSatisfiesDirty(HeapTupleHeader tuple)
...
@@ -436,3 +439,159 @@ HeapTupleSatisfiesDirty(HeapTupleHeader tuple)
return
false
;
/* updated by other */
return
false
;
/* updated by other */
}
}
bool
HeapTupleSatisfiesSnapshot
(
HeapTupleHeader
tuple
,
Snapshot
snapshot
)
{
if
(
AMI_OVERRIDE
)
return
true
;
if
(
!
(
tuple
->
t_infomask
&
HEAP_XMIN_COMMITTED
))
{
if
(
tuple
->
t_infomask
&
HEAP_XMIN_INVALID
)
/* xid invalid or
* aborted */
return
false
;
if
(
TransactionIdIsCurrentTransactionId
(
tuple
->
t_xmin
))
{
if
(
CommandIdGEScanCommandId
(
tuple
->
t_cmin
))
return
false
;
/* inserted after scan started */
if
(
tuple
->
t_infomask
&
HEAP_XMAX_INVALID
)
/* xid invalid */
return
true
;
Assert
(
TransactionIdIsCurrentTransactionId
(
tuple
->
t_xmax
));
if
(
tuple
->
t_infomask
&
HEAP_MARKED_FOR_UPDATE
)
return
true
;
if
(
CommandIdGEScanCommandId
(
tuple
->
t_cmax
))
return
true
;
/* deleted after scan started */
else
return
false
;
/* deleted before scan started */
}
/*
* this call is VERY expensive - requires a log table lookup.
*/
if
(
!
TransactionIdDidCommit
(
tuple
->
t_xmin
))
{
if
(
TransactionIdDidAbort
(
tuple
->
t_xmin
))
tuple
->
t_infomask
|=
HEAP_XMIN_INVALID
;
/* aborted */
return
false
;
}
tuple
->
t_infomask
|=
HEAP_XMIN_COMMITTED
;
}
/*
* By here, the inserting transaction has committed -
* have to check when...
*/
if
(
tuple
->
t_xmin
>=
snapshot
->
xmax
)
return
false
;
if
(
tuple
->
t_xmin
>=
snapshot
->
xmin
)
{
uint32
i
;
for
(
i
=
0
;
i
<
snapshot
->
xcnt
;
i
++
)
{
if
(
tuple
->
t_xmin
==
snapshot
->
xip
[
i
])
return
false
;
}
}
if
(
tuple
->
t_infomask
&
HEAP_XMAX_INVALID
)
/* xid invalid or aborted */
return
true
;
if
(
tuple
->
t_infomask
&
HEAP_MARKED_FOR_UPDATE
)
return
true
;
if
(
!
(
tuple
->
t_infomask
&
HEAP_XMAX_COMMITTED
))
{
if
(
TransactionIdIsCurrentTransactionId
(
tuple
->
t_xmax
))
{
if
(
CommandIdGEScanCommandId
(
tuple
->
t_cmax
))
return
true
;
/* deleted after scan started */
else
return
false
;
/* deleted before scan started */
}
if
(
!
TransactionIdDidCommit
(
tuple
->
t_xmax
))
{
if
(
TransactionIdDidAbort
(
tuple
->
t_xmax
))
tuple
->
t_infomask
|=
HEAP_XMAX_INVALID
;
/* aborted */
return
true
;
}
/* xmax transaction committed */
tuple
->
t_infomask
|=
HEAP_XMAX_COMMITTED
;
}
if
(
tuple
->
t_xmax
>=
snapshot
->
xmax
)
return
true
;
if
(
tuple
->
t_xmax
>=
snapshot
->
xmin
)
{
uint32
i
;
for
(
i
=
0
;
i
<
snapshot
->
xcnt
;
i
++
)
{
if
(
tuple
->
t_xmax
==
snapshot
->
xip
[
i
])
return
true
;
}
}
return
false
;
}
void
SetQuerySnapshot
(
void
)
{
/* 1st call in xaction */
if
(
SerializedSnapshot
==
NULL
)
{
SerializedSnapshot
=
GetSnapshotData
();
QuerySnapshot
=
SerializedSnapshot
;
Assert
(
QuerySnapshot
!=
NULL
);
return
;
}
if
(
QuerySnapshot
!=
SerializedSnapshot
)
{
free
(
QuerySnapshot
->
xip
);
free
(
QuerySnapshot
);
}
if
(
XactIsoLevel
==
XACT_SERIALIZED
)
QuerySnapshot
=
SerializedSnapshot
;
else
QuerySnapshot
=
GetSnapshotData
();
Assert
(
QuerySnapshot
!=
NULL
);
}
void
FreeXactSnapshot
(
void
)
{
if
(
QuerySnapshot
!=
NULL
&&
QuerySnapshot
!=
SerializedSnapshot
)
{
free
(
QuerySnapshot
->
xip
);
free
(
QuerySnapshot
);
}
QuerySnapshot
=
NULL
;
if
(
SerializedSnapshot
!=
NULL
)
{
free
(
SerializedSnapshot
->
xip
);
free
(
SerializedSnapshot
);
}
SerializedSnapshot
=
NULL
;
}
src/include/access/transam.h
View file @
c13a64d7
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: transam.h,v 1.1
6 1998/09/01 04:34:31 momjian
Exp $
* $Id: transam.h,v 1.1
7 1998/12/16 11:52:10 vadim
Exp $
*
*
* NOTES
* NOTES
* Transaction System Version 101 now support proper oid
* Transaction System Version 101 now support proper oid
...
@@ -145,6 +145,7 @@ extern bool TransactionIdDidCommit(TransactionId transactionId);
...
@@ -145,6 +145,7 @@ extern bool TransactionIdDidCommit(TransactionId transactionId);
extern
bool
TransactionIdDidAbort
(
TransactionId
transactionId
);
extern
bool
TransactionIdDidAbort
(
TransactionId
transactionId
);
extern
void
TransactionIdCommit
(
TransactionId
transactionId
);
extern
void
TransactionIdCommit
(
TransactionId
transactionId
);
extern
void
TransactionIdAbort
(
TransactionId
transactionId
);
extern
void
TransactionIdAbort
(
TransactionId
transactionId
);
extern
void
TransactionIdFlushCache
(
void
);
/* in transam/transsup.c */
/* in transam/transsup.c */
extern
void
AmiTransactionOverride
(
bool
flag
);
extern
void
AmiTransactionOverride
(
bool
flag
);
...
...
src/include/utils/tqual.h
View file @
c13a64d7
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
* Copyright (c) 1994, Regents of the University of California
* Copyright (c) 1994, Regents of the University of California
*
*
* $Id: tqual.h,v 1.1
6 1998/12/15 12:47:0
1 vadim Exp $
* $Id: tqual.h,v 1.1
7 1998/12/16 11:52:1
1 vadim Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -19,7 +19,8 @@
...
@@ -19,7 +19,8 @@
typedef
struct
SnapshotData
typedef
struct
SnapshotData
{
{
TransactionId
xmin
;
/* XID < xmin are visible to me */
TransactionId
xmin
;
/* XID < xmin are visible to me */
TransactionId
xmax
;
/* XID > xmax are invisible to me */
TransactionId
xmax
;
/* XID >= xmax are invisible to me */
uint32
xcnt
;
/* # of xact below */
TransactionId
*
xip
;
/* array of xacts in progress */
TransactionId
*
xip
;
/* array of xacts in progress */
}
SnapshotData
;
}
SnapshotData
;
...
@@ -27,7 +28,9 @@ typedef SnapshotData *Snapshot;
...
@@ -27,7 +28,9 @@ typedef SnapshotData *Snapshot;
#define SnapshotNow ((Snapshot) 0x0)
#define SnapshotNow ((Snapshot) 0x0)
#define SnapshotSelf ((Snapshot) 0x1)
#define SnapshotSelf ((Snapshot) 0x1)
extern
Snapshot
SnapshotDirty
;
extern
Snapshot
SnapshotDirty
;
extern
Snapshot
QuerySnapshot
;
#define IsSnapshotNow(snapshot) ((Snapshot) snapshot == SnapshotNow)
#define IsSnapshotNow(snapshot) ((Snapshot) snapshot == SnapshotNow)
#define IsSnapshotSelf(snapshot) ((Snapshot) snapshot == SnapshotSelf)
#define IsSnapshotSelf(snapshot) ((Snapshot) snapshot == SnapshotSelf)
...
@@ -55,7 +58,11 @@ extern CommandId HeapSpecialCommandId;
...
@@ -55,7 +58,11 @@ extern CommandId HeapSpecialCommandId;
((IsSnapshotDirty(snapshot)) ? \
((IsSnapshotDirty(snapshot)) ? \
HeapTupleSatisfiesDirty((tuple)->t_data) \
HeapTupleSatisfiesDirty((tuple)->t_data) \
: \
: \
((IsSnapshotNow(snapshot)) ? \
HeapTupleSatisfiesNow((tuple)->t_data) \
HeapTupleSatisfiesNow((tuple)->t_data) \
: \
HeapTupleSatisfiesSnapshot((tuple)->t_data, snapshot) \
) \
) \
) \
) \
) \
)
)
...
@@ -87,9 +94,13 @@ extern CommandId HeapSpecialCommandId;
...
@@ -87,9 +94,13 @@ extern CommandId HeapSpecialCommandId;
extern
bool
HeapTupleSatisfiesItself
(
HeapTupleHeader
tuple
);
extern
bool
HeapTupleSatisfiesItself
(
HeapTupleHeader
tuple
);
extern
bool
HeapTupleSatisfiesNow
(
HeapTupleHeader
tuple
);
extern
bool
HeapTupleSatisfiesNow
(
HeapTupleHeader
tuple
);
extern
bool
HeapTupleSatisfiesDirty
(
HeapTupleHeader
tuple
);
extern
bool
HeapTupleSatisfiesDirty
(
HeapTupleHeader
tuple
);
extern
bool
HeapTupleSatisfiesSnapshot
(
HeapTupleHeader
tuple
,
Snapshot
snapshot
);
extern
int
HeapTupleSatisfiesUpdate
(
HeapTuple
tuple
);
extern
int
HeapTupleSatisfiesUpdate
(
HeapTuple
tuple
);
extern
void
setheapoverride
(
bool
on
);
extern
void
setheapoverride
(
bool
on
);
extern
Snapshot
GetSnapshotData
(
bool
serialized
);
extern
Snapshot
GetSnapshotData
(
void
);
extern
void
SetQuerySnapshot
(
void
);
extern
void
FreeXactSnapshot
(
void
);
#endif
/* TQUAL_H */
#endif
/* TQUAL_H */
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