mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Use FullTransactionId for the transaction stack.
Provide GetTopFullTransactionId() and GetCurrentFullTransactionId(). The intended users of these interfaces are access methods that use xids for visibility checks but don't want to have to go back and "freeze" existing references some time later before the 32 bit xid counter wraps around. Use a new struct to serialize the transaction state for parallel query, because FullTransactionId doesn't fit into the previous serialization scheme very well. Author: Thomas Munro Reviewed-by: Heikki Linnakangas Discussion: https://postgr.es/m/CAA4eK1%2BMv%2Bmb0HFfWM9Srtc6MVe160WFurXV68iAFMcagRZ0dQ%40mail.gmail.com
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
#define U64FromFullTransactionId(x) ((x).value)
|
||||
#define FullTransactionIdPrecedes(a, b) ((a).value < (b).value)
|
||||
#define FullTransactionIdIsValid(x) TransactionIdIsValid(XidFromFullTransactionId(x))
|
||||
#define InvalidFullTransactionId FullTransactionIdFromEpochAndXid(0, InvalidTransactionId)
|
||||
|
||||
/*
|
||||
* A 64 bit value that contains an epoch and a TransactionId. This is
|
||||
@@ -221,7 +222,7 @@ extern TransactionId TransactionIdLatest(TransactionId mainxid,
|
||||
extern XLogRecPtr TransactionIdGetCommitLSN(TransactionId xid);
|
||||
|
||||
/* in transam/varsup.c */
|
||||
extern TransactionId GetNewTransactionId(bool isSubXact);
|
||||
extern FullTransactionId GetNewTransactionId(bool isSubXact);
|
||||
extern void AdvanceNextFullTransactionIdPastXid(TransactionId xid);
|
||||
extern FullTransactionId ReadNextFullTransactionId(void);
|
||||
extern void SetTransactionIdLimit(TransactionId oldest_datfrozenxid,
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#ifndef XACT_H
|
||||
#define XACT_H
|
||||
|
||||
#include "access/transam.h"
|
||||
#include "access/xlogreader.h"
|
||||
#include "lib/stringinfo.h"
|
||||
#include "nodes/pg_list.h"
|
||||
@@ -355,6 +356,10 @@ extern TransactionId GetCurrentTransactionId(void);
|
||||
extern TransactionId GetCurrentTransactionIdIfAny(void);
|
||||
extern TransactionId GetStableLatestTransactionId(void);
|
||||
extern SubTransactionId GetCurrentSubTransactionId(void);
|
||||
extern FullTransactionId GetTopFullTransactionId(void);
|
||||
extern FullTransactionId GetTopFullTransactionIdIfAny(void);
|
||||
extern FullTransactionId GetCurrentFullTransactionId(void);
|
||||
extern FullTransactionId GetCurrentFullTransactionIdIfAny(void);
|
||||
extern void MarkCurrentTransactionIdLoggedIfAny(void);
|
||||
extern bool SubTransactionIsActive(SubTransactionId subxid);
|
||||
extern CommandId GetCurrentCommandId(bool used);
|
||||
|
Reference in New Issue
Block a user