PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/transam.h"
#include "access/xact.h"
#include "funcapi.h"
#include "lib/qunique.h"
#include "libpq/pqformat.h"
#include "miscadmin.h"
#include "postmaster/postmaster.h"
#include "storage/lwlock.h"
#include "storage/procarray.h"
#include "utils/builtins.h"
#include "utils/memutils.h"
#include "utils/snapmgr.h"
#include "utils/xid8.h"
Go to the source code of this file.
Data Structures | |
struct | pg_snapshot |
Macros | |
#define | USE_BSEARCH_IF_NXIP_GREATER 30 |
#define | PG_SNAPSHOT_SIZE(nxip) (offsetof(pg_snapshot, xip) + sizeof(FullTransactionId) * (nxip)) |
#define | PG_SNAPSHOT_MAX_NXIP ((MaxAllocSize - offsetof(pg_snapshot, xip)) / sizeof(FullTransactionId)) |
#define PG_SNAPSHOT_MAX_NXIP ((MaxAllocSize - offsetof(pg_snapshot, xip)) / sizeof(FullTransactionId)) |
Definition at line 72 of file xid8funcs.c.
#define PG_SNAPSHOT_SIZE | ( | nxip | ) | (offsetof(pg_snapshot, xip) + sizeof(FullTransactionId) * (nxip)) |
Definition at line 70 of file xid8funcs.c.
#define USE_BSEARCH_IF_NXIP_GREATER 30 |
Definition at line 48 of file xid8funcs.c.
|
static |
Definition at line 274 of file xid8funcs.c.
References appendBinaryStringInfo(), buf, and pg_snapshot::nxip.
Referenced by parse_snapshot().
|
static |
Definition at line 285 of file xid8funcs.c.
References buf, pfree(), and SET_VARSIZE.
Referenced by parse_snapshot().
|
static |
Definition at line 259 of file xid8funcs.c.
References appendBinaryStringInfo(), buf, makeStringInfo(), pg_snapshot::nxip, PG_SNAPSHOT_SIZE, pg_snapshot::xmax, and pg_snapshot::xmin.
Referenced by parse_snapshot().
|
static |
Definition at line 190 of file xid8funcs.c.
References a, b, and FullTransactionIdPrecedes.
Referenced by is_visible_fxid(), and sort_snapshot().
|
static |
Definition at line 224 of file xid8funcs.c.
References cmp_fxid(), false, FullTransactionIdEquals, FullTransactionIdPrecedes, i, pg_snapshot::nxip, res, USE_BSEARCH_IF_NXIP_GREATER, value, pg_snapshot::xip, pg_snapshot::xmax, and pg_snapshot::xmin.
Referenced by pg_visible_in_snapshot().
|
static |
Definition at line 302 of file xid8funcs.c.
References buf, buf_add_txid(), buf_finalize(), buf_init(), ereturn, errcode(), errmsg(), FullTransactionIdEquals, FullTransactionIdFollowsOrEquals, FullTransactionIdFromU64(), FullTransactionIdIsValid, FullTransactionIdPrecedes, InvalidFullTransactionId, str, strtou64, and val.
Referenced by pg_snapshot_in().
Datum pg_current_snapshot | ( | PG_FUNCTION_ARGS | ) |
Definition at line 407 of file xid8funcs.c.
References cur, elog, ERROR, GetActiveSnapshot(), i, pg_snapshot::nxip, palloc(), PG_RETURN_POINTER, PG_SNAPSHOT_SIZE, ReadNextFullTransactionId(), SET_VARSIZE, sort_snapshot(), widen_snapshot_xid(), pg_snapshot::xip, pg_snapshot::xmax, and pg_snapshot::xmin.
Datum pg_current_xact_id | ( | PG_FUNCTION_ARGS | ) |
Definition at line 371 of file xid8funcs.c.
References GetTopFullTransactionId(), PG_RETURN_FULLTRANSACTIONID, and PreventCommandDuringRecovery().
Datum pg_current_xact_id_if_assigned | ( | PG_FUNCTION_ARGS | ) |
Definition at line 389 of file xid8funcs.c.
References FullTransactionIdIsValid, GetTopFullTransactionIdIfAny(), PG_RETURN_FULLTRANSACTIONID, and PG_RETURN_NULL.
Datum pg_snapshot_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 451 of file xid8funcs.c.
References parse_snapshot(), PG_GETARG_CSTRING, PG_RETURN_POINTER, and str.
Datum pg_snapshot_out | ( | PG_FUNCTION_ARGS | ) |
Definition at line 467 of file xid8funcs.c.
References appendStringInfo(), appendStringInfoChar(), i, initStringInfo(), pg_snapshot::nxip, PG_GETARG_VARLENA_P, PG_RETURN_CSTRING, str, U64FromFullTransactionId, UINT64_FORMAT, pg_snapshot::xip, pg_snapshot::xmax, and pg_snapshot::xmin.
Datum pg_snapshot_recv | ( | PG_FUNCTION_ARGS | ) |
Definition at line 499 of file xid8funcs.c.
References buf, cur, ereport, errcode(), errmsg(), ERROR, FullTransactionIdEquals, FullTransactionIdFromU64(), FullTransactionIdIsValid, FullTransactionIdPrecedes, i, InvalidFullTransactionId, pg_snapshot::nxip, palloc(), PG_GETARG_POINTER, PG_RETURN_POINTER, PG_SNAPSHOT_MAX_NXIP, PG_SNAPSHOT_SIZE, pq_getmsgint(), pq_getmsgint64(), SET_VARSIZE, pg_snapshot::xip, pg_snapshot::xmax, and pg_snapshot::xmin.
Datum pg_snapshot_send | ( | PG_FUNCTION_ARGS | ) |
Definition at line 565 of file xid8funcs.c.
References buf, i, pg_snapshot::nxip, PG_GETARG_VARLENA_P, PG_RETURN_BYTEA_P, pq_begintypsend(), pq_endtypsend(), pq_sendint32(), pq_sendint64(), U64FromFullTransactionId, pg_snapshot::xip, pg_snapshot::xmax, and pg_snapshot::xmin.
Datum pg_snapshot_xip | ( | PG_FUNCTION_ARGS | ) |
Definition at line 626 of file xid8funcs.c.
References arg, FuncCallContext::call_cntr, FullTransactionIdGetDatum(), MemoryContextAlloc(), FuncCallContext::multi_call_memory_ctx, pg_snapshot::nxip, PG_GETARG_VARLENA_P, SRF_FIRSTCALL_INIT, SRF_IS_FIRSTCALL, SRF_PERCALL_SETUP, SRF_RETURN_DONE, SRF_RETURN_NEXT, FuncCallContext::user_fctx, value, VARSIZE, and pg_snapshot::xip.
Datum pg_snapshot_xmax | ( | PG_FUNCTION_ARGS | ) |
Definition at line 613 of file xid8funcs.c.
References PG_GETARG_VARLENA_P, PG_RETURN_FULLTRANSACTIONID, and pg_snapshot::xmax.
Datum pg_snapshot_xmin | ( | PG_FUNCTION_ARGS | ) |
Definition at line 600 of file xid8funcs.c.
References PG_GETARG_VARLENA_P, PG_RETURN_FULLTRANSACTIONID, and pg_snapshot::xmin.
Datum pg_visible_in_snapshot | ( | PG_FUNCTION_ARGS | ) |
Definition at line 586 of file xid8funcs.c.
References is_visible_fxid(), PG_GETARG_FULLTRANSACTIONID, PG_GETARG_VARLENA_P, PG_RETURN_BOOL, and value.
Datum pg_xact_status | ( | PG_FUNCTION_ARGS | ) |
Definition at line 671 of file xid8funcs.c.
References Assert, cstring_to_text(), LW_SHARED, LWLockAcquire(), LWLockRelease(), PG_GETARG_FULLTRANSACTIONID, PG_RETURN_NULL, PG_RETURN_TEXT_P, TransactionIdDidCommit(), TransactionIdInRecentPast(), TransactionIdIsInProgress(), and TransactionIdIsValid.
|
static |
Definition at line 210 of file xid8funcs.c.
References cmp_fxid(), pg_snapshot::nxip, qsort, qunique(), and pg_snapshot::xip.
Referenced by pg_current_snapshot().
StaticAssertDecl | ( | MAX_BACKENDS *2<= | PG_SNAPSHOT_MAX_NXIP, |
"possible overflow in pg_current_snapshot()" | |||
) |
|
static |
Definition at line 97 of file xid8funcs.c.
References Assert, EpochFromFullTransactionId, ereport, errcode(), errmsg(), ERROR, FullTransactionIdFromEpochAndXid(), FullTransactionIdPrecedes, LWLockHeldByMe(), TransamVariablesData::oldestClogXid, ReadNextFullTransactionId(), TransactionIdIsNormal, TransactionIdIsValid, TransactionIdPrecedesOrEquals(), TransamVariables, U64FromFullTransactionId, and XidFromFullTransactionId.
Referenced by pg_xact_status().
|
static |
Definition at line 164 of file xid8funcs.c.
References epoch, EpochFromFullTransactionId, FullTransactionIdFromEpochAndXid(), TransactionIdIsNormal, and XidFromFullTransactionId.
Referenced by pg_current_snapshot().