|
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 "storage/lwlock.h"#include "storage/procarray.h"#include "storage/procnumber.h"#include "utils/builtins.h"#include "utils/memutils.h"#include "utils/snapmgr.h"#include "utils/xid8.h"#include "varatt.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 73 of file xid8funcs.c.
| #define PG_SNAPSHOT_SIZE | ( | nxip | ) | (offsetof(pg_snapshot, xip) + sizeof(FullTransactionId) * (nxip)) |
Definition at line 71 of file xid8funcs.c.
| #define USE_BSEARCH_IF_NXIP_GREATER 30 |
Definition at line 49 of file xid8funcs.c.
|
static |
Definition at line 238 of file xid8funcs.c.
References appendBinaryStringInfo(), buf, and pg_snapshot::nxip.
Referenced by parse_snapshot().
|
static |
Definition at line 249 of file xid8funcs.c.
References buf, pfree(), and SET_VARSIZE().
Referenced by parse_snapshot().
|
static |
Definition at line 223 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 154 of file xid8funcs.c.
References a, b, and FullTransactionIdPrecedes.
Referenced by is_visible_fxid(), and sort_snapshot().
|
static |
Definition at line 188 of file xid8funcs.c.
References cmp_fxid(), false, FullTransactionIdEquals, FullTransactionIdPrecedes, i, pg_snapshot::nxip, 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 266 of file xid8funcs.c.
References buf, buf_add_txid(), buf_finalize(), buf_init(), ereturn, errcode(), errmsg(), FullTransactionIdEquals, FullTransactionIdFollowsOrEquals, FullTransactionIdFromU64(), FullTransactionIdIsValid, FullTransactionIdPrecedes, InvalidFullTransactionId, str, and val.
Referenced by pg_snapshot_in().
| Datum pg_current_snapshot | ( | PG_FUNCTION_ARGS | ) |
Definition at line 371 of file xid8funcs.c.
References cur, elog, ERROR, FullTransactionIdFromAllowableAt(), GetActiveSnapshot(), i, pg_snapshot::nxip, palloc(), PG_RETURN_POINTER, PG_SNAPSHOT_SIZE, ReadNextFullTransactionId(), SET_VARSIZE(), sort_snapshot(), pg_snapshot::xip, pg_snapshot::xmax, and pg_snapshot::xmin.
| Datum pg_current_xact_id | ( | PG_FUNCTION_ARGS | ) |
Definition at line 335 of file xid8funcs.c.
References GetTopFullTransactionId(), PG_RETURN_FULLTRANSACTIONID, and PreventCommandDuringRecovery().
| Datum pg_current_xact_id_if_assigned | ( | PG_FUNCTION_ARGS | ) |
Definition at line 353 of file xid8funcs.c.
References FullTransactionIdIsValid, GetTopFullTransactionIdIfAny(), PG_RETURN_FULLTRANSACTIONID, and PG_RETURN_NULL.
| Datum pg_snapshot_in | ( | PG_FUNCTION_ARGS | ) |
Definition at line 421 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 437 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 469 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 535 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 596 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 583 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 570 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 556 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 641 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 174 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 98 of file xid8funcs.c.
References Assert(), ereport, errcode(), errmsg(), ERROR, FullTransactionIdFromAllowableAt(), FullTransactionIdPrecedes, LWLockHeldByMe(), TransamVariablesData::oldestClogXid, ReadNextFullTransactionId(), TransactionIdIsNormal, TransactionIdIsValid, TransamVariables, U64FromFullTransactionId, and XidFromFullTransactionId.
Referenced by pg_xact_status().