Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitad30805

Browse files
committed
Use FullTransactionId for the transaction stack.
Provide GetTopFullTransactionId() and GetCurrentFullTransactionId().The intended users of these interfaces are access methods that usexids for visibility checks but don't want to have to go back and"freeze" existing references some time later before the 32 bit xidcounter wraps around.Use a new struct to serialize the transaction state for parallelquery, because FullTransactionId doesn't fit into the previousserialization scheme very well.Author: Thomas MunroReviewed-by: Heikki LinnakangasDiscussion:https://postgr.es/m/CAA4eK1%2BMv%2Bmb0HFfWM9Srtc6MVe160WFurXV68iAFMcagRZ0dQ%40mail.gmail.com
1 parent2fc7af5 commitad30805

File tree

5 files changed

+170
-81
lines changed

5 files changed

+170
-81
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ VariableCache ShmemVariableCache = NULL;
3535

3636

3737
/*
38-
* Allocate the next XID for a new transaction or subtransaction.
38+
* Allocate the next FullTransactionId for a new transaction or
39+
* subtransaction.
3940
*
4041
* The new XID is also stored into MyPgXact before returning.
4142
*
@@ -44,9 +45,10 @@ VariableCache ShmemVariableCache = NULL;
4445
* does something. So it is safe to do a database lookup if we want to
4546
* issue a warning about XID wrap.
4647
*/
47-
TransactionId
48+
FullTransactionId
4849
GetNewTransactionId(boolisSubXact)
4950
{
51+
FullTransactionIdfull_xid;
5052
TransactionIdxid;
5153

5254
/*
@@ -64,7 +66,7 @@ GetNewTransactionId(bool isSubXact)
6466
{
6567
Assert(!isSubXact);
6668
MyPgXact->xid=BootstrapTransactionId;
67-
returnBootstrapTransactionId;
69+
returnFullTransactionIdFromEpochAndXid(0,BootstrapTransactionId);
6870
}
6971

7072
/* safety check, we should never get this far in a HS standby */
@@ -73,7 +75,8 @@ GetNewTransactionId(bool isSubXact)
7375

7476
LWLockAcquire(XidGenLock,LW_EXCLUSIVE);
7577

76-
xid=XidFromFullTransactionId(ShmemVariableCache->nextFullXid);
78+
full_xid=ShmemVariableCache->nextFullXid;
79+
xid=XidFromFullTransactionId(full_xid);
7780

7881
/*----------
7982
* Check to see if it's safe to assign another XID. This protects against
@@ -232,7 +235,7 @@ GetNewTransactionId(bool isSubXact)
232235

233236
LWLockRelease(XidGenLock);
234237

235-
returnxid;
238+
returnfull_xid;
236239
}
237240

238241
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp