PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <time.h>
#include <unistd.h>
#include "access/commit_ts.h"
#include "access/multixact.h"
#include "access/parallel.h"
#include "access/subtrans.h"
#include "access/transam.h"
#include "access/twophase.h"
#include "access/xact.h"
#include "access/xlog.h"
#include "access/xloginsert.h"
#include "access/xlogutils.h"
#include "catalog/index.h"
#include "catalog/namespace.h"
#include "catalog/pg_enum.h"
#include "catalog/storage.h"
#include "commands/async.h"
#include "commands/tablecmds.h"
#include "commands/trigger.h"
#include "executor/spi.h"
#include "libpq/be-fsstubs.h"
#include "libpq/pqsignal.h"
#include "miscadmin.h"
#include "pg_trace.h"
#include "pgstat.h"
#include "replication/logical.h"
#include "replication/logicallauncher.h"
#include "replication/origin.h"
#include "replication/syncrep.h"
#include "replication/walsender.h"
#include "storage/condition_variable.h"
#include "storage/fd.h"
#include "storage/lmgr.h"
#include "storage/md.h"
#include "storage/predicate.h"
#include "storage/proc.h"
#include "storage/procarray.h"
#include "storage/sinvaladt.h"
#include "storage/smgr.h"
#include "utils/builtins.h"
#include "utils/catcache.h"
#include "utils/combocid.h"
#include "utils/guc.h"
#include "utils/inval.h"
#include "utils/memutils.h"
#include "utils/relmapper.h"
#include "utils/snapmgr.h"
#include "utils/timeout.h"
#include "utils/timestamp.h"
Go to the source code of this file.
Data Structures | |
struct | TransactionStateData |
struct | SerializedTransactionState |
struct | XactCallbackItem |
struct | SubXactCallbackItem |
Macros | |
#define | SerializedTransactionStateHeaderSize offsetof(SerializedTransactionState, parallelCurrentXids) |
Typedefs | |
typedef enum TransState | TransState |
typedef enum TBlockState | TBlockState |
typedef struct TransactionStateData | TransactionStateData |
typedef TransactionStateData * | TransactionState |
typedef struct SerializedTransactionState | SerializedTransactionState |
typedef struct XactCallbackItem | XactCallbackItem |
typedef struct SubXactCallbackItem | SubXactCallbackItem |
#define SerializedTransactionStateHeaderSize offsetof(SerializedTransactionState, parallelCurrentXids) |
Definition at line 229 of file xact.c.
Referenced by EstimateTransactionStateSpace(), and SerializeTransactionState().
typedef struct SerializedTransactionState SerializedTransactionState |
typedef struct SubXactCallbackItem SubXactCallbackItem |
typedef enum TBlockState TBlockState |
typedef TransactionStateData* TransactionState |
typedef struct TransactionStateData TransactionStateData |
typedef enum TransState TransState |
typedef struct XactCallbackItem XactCallbackItem |
enum TBlockState |
Definition at line 153 of file xact.c.
enum TransState |
Enumerator | |
---|---|
TRANS_DEFAULT | |
TRANS_START | |
TRANS_INPROGRESS | |
TRANS_COMMIT | |
TRANS_ABORT | |
TRANS_PREPARE |
Definition at line 137 of file xact.c.
void AbortCurrentTransaction | ( | void | ) |
Definition at line 3210 of file xact.c.
References AbortCurrentTransaction(), AbortSubTransaction(), AbortTransaction(), TransactionStateData::blockState, CleanupSubTransaction(), CleanupTransaction(), CurrentTransactionState, TransactionStateData::state, TBLOCK_ABORT, TBLOCK_ABORT_END, TBLOCK_ABORT_PENDING, TBLOCK_BEGIN, TBLOCK_DEFAULT, TBLOCK_END, TBLOCK_IMPLICIT_INPROGRESS, TBLOCK_INPROGRESS, TBLOCK_PARALLEL_INPROGRESS, TBLOCK_PREPARE, TBLOCK_STARTED, TBLOCK_SUBABORT, TBLOCK_SUBABORT_END, TBLOCK_SUBABORT_PENDING, TBLOCK_SUBABORT_RESTART, TBLOCK_SUBBEGIN, TBLOCK_SUBCOMMIT, TBLOCK_SUBINPROGRESS, TBLOCK_SUBRELEASE, TBLOCK_SUBRESTART, TRANS_DEFAULT, TRANS_INPROGRESS, and TRANS_START.
Referenced by _SPI_rollback(), AbortCurrentTransaction(), AutoVacLauncherMain(), PostgresMain(), ReorderBufferImmediateInvalidation(), ReorderBufferProcessTXN(), and SnapBuildClearExportedSnapshot().
void AbortOutOfAnyTransaction | ( | void | ) |
Definition at line 4579 of file xact.c.
References AbortSubTransaction(), AbortTransaction(), Assert, AtAbort_Memory(), AtAbort_Portals(), AtCleanup_Memory(), AtSubAbort_Portals(), TransactionStateData::blockState, CleanupSubTransaction(), CleanupTransaction(), CurrentTransactionState, TransactionStateData::curTransactionOwner, TransactionStateData::parent, TransactionStateData::state, TransactionStateData::subTransactionId, TBLOCK_ABORT, TBLOCK_ABORT_END, TBLOCK_ABORT_PENDING, TBLOCK_BEGIN, TBLOCK_DEFAULT, TBLOCK_END, TBLOCK_IMPLICIT_INPROGRESS, TBLOCK_INPROGRESS, TBLOCK_PARALLEL_INPROGRESS, TBLOCK_PREPARE, TBLOCK_STARTED, TBLOCK_SUBABORT, TBLOCK_SUBABORT_END, TBLOCK_SUBABORT_PENDING, TBLOCK_SUBABORT_RESTART, TBLOCK_SUBBEGIN, TBLOCK_SUBCOMMIT, TBLOCK_SUBINPROGRESS, TBLOCK_SUBRELEASE, TBLOCK_SUBRESTART, TRANS_DEFAULT, TRANS_INPROGRESS, and TRANS_START.
Referenced by do_autovacuum(), perform_work_item(), RemoveTempRelationsCallback(), and ShutdownPostgres().
|
static |
Definition at line 4924 of file xact.c.
References AbortBufferIO(), AfterTriggerEndSubXact(), AtEOSubXact_Files(), AtEOSubXact_HashTables(), AtEOSubXact_Inval(), AtEOSubXact_LargeObject(), AtEOSubXact_Namespace(), AtEOSubXact_on_commit_actions(), AtEOSubXact_Parallel(), AtEOSubXact_PgStat(), AtEOSubXact_RelationCache(), AtEOSubXact_SPI(), AtEOXact_GUC(), AtSubAbort_childXids(), AtSubAbort_Memory(), AtSubAbort_Notify(), AtSubAbort_Portals(), AtSubAbort_ResourceOwner(), AtSubAbort_smgr(), AtSubAbort_Snapshot(), CallSubXactCallbacks(), ConditionVariableCancelSleep(), CurrentTransactionState, TransactionStateData::curTransactionOwner, elog, TransactionStateData::fullTransactionId, FullTransactionIdIsValid, TransactionStateData::gucNestLevel, HOLD_INTERRUPTS, IsInParallelMode(), LockErrorCleanup(), LWLockReleaseAll(), TransactionStateData::nestingLevel, TransactionStateData::parallelModeLevel, TransactionStateData::parent, PG_SETMASK, pgstat_progress_end_command(), pgstat_report_wait_end(), TransactionStateData::prevSecContext, TransactionStateData::prevUser, TransactionStateData::prevXactReadOnly, RecordTransactionAbort(), reschedule_timeouts(), ResetLogicalStreamingState(), ResetReindexState(), RESOURCE_RELEASE_AFTER_LOCKS, RESOURCE_RELEASE_BEFORE_LOCKS, RESOURCE_RELEASE_LOCKS, ResourceOwnerRelease(), RESUME_INTERRUPTS, SetUserIdAndSecContext(), ShowTransactionState(), TransactionStateData::state, TransactionStateData::subTransactionId, SUBXACT_EVENT_ABORT_SUB, TRANS_ABORT, TRANS_INPROGRESS, TransStateAsString(), UnBlockSig, UnlockBuffers(), WARNING, XactReadOnly, and XLogResetInsertion().
Referenced by AbortCurrentTransaction(), AbortOutOfAnyTransaction(), CommitTransactionCommand(), and RollbackAndReleaseCurrentSubTransaction().
|
static |
Definition at line 2601 of file xact.c.
References AbortBufferIO(), AfterTriggerEndXact(), Assert, AtAbort_Memory(), AtAbort_Notify(), AtAbort_Portals(), AtAbort_ResourceOwner(), AtAbort_Twophase(), AtEOXact_ApplyLauncher(), AtEOXact_Buffers(), AtEOXact_ComboCid(), AtEOXact_Enum(), AtEOXact_Files(), AtEOXact_GUC(), AtEOXact_HashTables(), AtEOXact_Inval(), AtEOXact_LargeObject(), AtEOXact_MultiXact(), AtEOXact_Namespace(), AtEOXact_on_commit_actions(), AtEOXact_Parallel(), AtEOXact_PgStat(), AtEOXact_RelationCache(), AtEOXact_RelationMap(), AtEOXact_SMgr(), AtEOXact_SPI(), TransactionStateData::blockState, CallXactCallbacks(), ConditionVariableCancelSleep(), CurrentTransactionState, elog, HOLD_INTERRUPTS, InvalidTransactionId, IsInParallelMode(), LockErrorCleanup(), LWLockReleaseAll(), PGPROC::lxid, MyProc, TransactionStateData::nestingLevel, TransactionStateData::parallelModeLevel, TransactionStateData::parent, PG_SETMASK, pgstat_progress_end_command(), pgstat_report_wait_end(), pgstat_report_xact_timestamp(), TransactionStateData::prevSecContext, TransactionStateData::prevUser, ProcArrayEndTransaction(), RecordTransactionAbort(), reschedule_timeouts(), ResetLogicalStreamingState(), ResetReindexState(), RESOURCE_RELEASE_AFTER_LOCKS, RESOURCE_RELEASE_BEFORE_LOCKS, RESOURCE_RELEASE_LOCKS, ResourceOwnerRelease(), RESUME_INTERRUPTS, SetUserIdAndSecContext(), smgrDoPendingDeletes(), smgrDoPendingSyncs(), TransactionStateData::state, TBLOCK_PARALLEL_INPROGRESS, TopTransactionResourceOwner, TRANS_ABORT, TRANS_INPROGRESS, TRANS_PREPARE, TransStateAsString(), UnBlockSig, UnlockBuffers(), WARNING, XACT_EVENT_ABORT, XACT_EVENT_PARALLEL_ABORT, XactLastRecEnd, XLogResetInsertion(), and XLogSetAsyncXactLSN().
Referenced by AbortCurrentTransaction(), AbortOutOfAnyTransaction(), and CommitTransactionCommand().
|
static |
Definition at line 569 of file xact.c.
References Assert, CurrentResourceOwner, TransactionStateData::curTransactionOwner, TransactionStateData::didLogXid, elog, ERROR, TransactionStateData::fullTransactionId, FullTransactionIdIsValid, GetNewTransactionId(), GetTopTransactionId(), IsInParallelMode(), IsParallelWorker, MinSizeOfXactAssignment, TransactionStateData::nestingLevel, xl_xact_assignment::nsubxacts, nUnreportedXids, palloc(), TransactionStateData::parent, pfree(), PGPROC_MAX_CACHED_SUBXIDS, RegisterPredicateLockingXid(), TransactionStateData::state, SubTransSetParent(), TRANS_INPROGRESS, TransactionIdIsValid, unreportedXids, XactLockTableInsert(), XidFromFullTransactionId, XLOG_XACT_ASSIGNMENT, XLogBeginInsert(), XLogInsert(), XLogLogicalInfoActive, XLogRegisterData(), XLogStandbyInfoActive, and xl_xact_assignment::xtop.
Referenced by GetCurrentFullTransactionId(), GetCurrentTransactionId(), GetTopFullTransactionId(), and GetTopTransactionId().
|
static |
Definition at line 1753 of file xact.c.
References MemoryContextSwitchTo(), and TopMemoryContext.
Referenced by AbortOutOfAnyTransaction(), and AbortTransaction().
|
static |
Definition at line 1785 of file xact.c.
References CurrentResourceOwner, and TopTransactionResourceOwner.
Referenced by AbortTransaction().
|
static |
Definition at line 1476 of file xact.c.
References AtCCI_RelationMap(), and CommandEndInvalidationMessages().
Referenced by CommandCounterIncrement().
|
static |
Definition at line 1843 of file xact.c.
References Assert, CurTransactionContext, TransactionStateData::curTransactionContext, MemoryContextDelete(), MemoryContextResetAndDeleteChildren, MemoryContextSwitchTo(), TransactionStateData::parent, TopMemoryContext, and TopTransactionContext.
Referenced by AbortOutOfAnyTransaction(), and CleanupTransaction().
|
static |
Definition at line 1495 of file xact.c.
References Assert, CurTransactionContext, TransactionStateData::curTransactionContext, MemoryContextDelete(), MemoryContextSwitchTo(), TopMemoryContext, and TopTransactionContext.
Referenced by CommitTransaction(), and PrepareTransaction().
|
static |
Definition at line 1086 of file xact.c.
References AcceptInvalidationMessages().
Referenced by StartTransaction().
|
static |
Definition at line 1095 of file xact.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, Assert, CurrentTransactionState, CurTransactionContext, TransactionStateData::curTransactionContext, MemoryContextSwitchTo(), TopMemoryContext, and TopTransactionContext.
Referenced by StartTransaction().
|
static |
Definition at line 1142 of file xact.c.
References Assert, CurrentResourceOwner, CurrentTransactionState, TransactionStateData::curTransactionOwner, CurTransactionResourceOwner, ResourceOwnerCreate(), and TopTransactionResourceOwner.
Referenced by StartTransaction().
|
static |
Definition at line 1811 of file xact.c.
References TransactionStateData::childXids, CurrentTransactionState, TransactionStateData::maxChildXids, TransactionStateData::nChildXids, and pfree().
Referenced by AbortSubTransaction().
|
static |
Definition at line 1773 of file xact.c.
References Assert, and MemoryContextSwitchTo().
Referenced by AbortSubTransaction().
|
static |
Definition at line 1798 of file xact.c.
References CurrentResourceOwner, CurrentTransactionState, and TransactionStateData::curTransactionOwner.
Referenced by AbortSubTransaction().
|
static |
Definition at line 1879 of file xact.c.
References Assert, CurrentTransactionState, CurTransactionContext, TransactionStateData::curTransactionContext, MemoryContextDelete(), MemoryContextResetAndDeleteChildren, MemoryContextSwitchTo(), and TransactionStateData::parent.
Referenced by CleanupSubTransaction().
|
static |
Definition at line 1551 of file xact.c.
References Assert, TransactionStateData::childXids, CurrentTransactionState, ereport, errcode(), errmsg(), ERROR, TransactionStateData::fullTransactionId, MaxAllocSize, TransactionStateData::maxChildXids, MemoryContextAlloc(), Min, TransactionStateData::nChildXids, TransactionStateData::parent, pfree(), repalloc(), TopTransactionContext, and XidFromFullTransactionId.
Referenced by CommitSubTransaction().
|
static |
Definition at line 1522 of file xact.c.
References Assert, CurrentTransactionState, CurTransactionContext, TransactionStateData::curTransactionContext, MemoryContextDelete(), MemoryContextIsEmpty(), MemoryContextSwitchTo(), and TransactionStateData::parent.
Referenced by CommitSubTransaction().
|
static |
Definition at line 1170 of file xact.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, Assert, CurrentTransactionState, CurTransactionContext, TransactionStateData::curTransactionContext, and MemoryContextSwitchTo().
Referenced by StartSubTransaction().
|
static |
Definition at line 1194 of file xact.c.
References Assert, CurrentResourceOwner, CurrentTransactionState, TransactionStateData::curTransactionOwner, CurTransactionResourceOwner, TransactionStateData::parent, and ResourceOwnerCreate().
Referenced by StartSubTransaction().
void BeginImplicitTransactionBlock | ( | void | ) |
Definition at line 4039 of file xact.c.
References TransactionStateData::blockState, CurrentTransactionState, TBLOCK_IMPLICIT_INPROGRESS, and TBLOCK_STARTED.
Referenced by exec_simple_query().
void BeginInternalSubTransaction | ( | const char * | name | ) |
Definition at line 4407 of file xact.c.
References TransactionStateData::blockState, BlockStateAsString(), CommitTransactionCommand(), CurrentTransactionState, elog, ereport, errcode(), errmsg(), ERROR, FATAL, IsInParallelMode(), MemoryContextStrdup(), TransactionStateData::name, PushTransaction(), StartTransactionCommand(), TBLOCK_ABORT, TBLOCK_ABORT_END, TBLOCK_ABORT_PENDING, TBLOCK_BEGIN, TBLOCK_DEFAULT, TBLOCK_END, TBLOCK_IMPLICIT_INPROGRESS, TBLOCK_INPROGRESS, TBLOCK_PARALLEL_INPROGRESS, TBLOCK_PREPARE, TBLOCK_STARTED, TBLOCK_SUBABORT, TBLOCK_SUBABORT_END, TBLOCK_SUBABORT_PENDING, TBLOCK_SUBABORT_RESTART, TBLOCK_SUBBEGIN, TBLOCK_SUBCOMMIT, TBLOCK_SUBINPROGRESS, TBLOCK_SUBRELEASE, TBLOCK_SUBRESTART, and TopTransactionContext.
Referenced by exec_stmt_block(), plperl_spi_exec(), plperl_spi_exec_prepared(), plperl_spi_fetchrow(), plperl_spi_prepare(), plperl_spi_query(), plperl_spi_query_prepared(), pltcl_returnnext(), pltcl_subtrans_begin(), pltcl_subtransaction(), PLy_spi_subtransaction_begin(), PLy_subtransaction_enter(), ReorderBufferImmediateInvalidation(), and ReorderBufferProcessTXN().
void BeginTransactionBlock | ( | void | ) |
Definition at line 3637 of file xact.c.
References TransactionStateData::blockState, BlockStateAsString(), CurrentTransactionState, elog, ereport, errcode(), errmsg(), FATAL, TBLOCK_ABORT, TBLOCK_ABORT_END, TBLOCK_ABORT_PENDING, TBLOCK_BEGIN, TBLOCK_DEFAULT, TBLOCK_END, TBLOCK_IMPLICIT_INPROGRESS, TBLOCK_INPROGRESS, TBLOCK_PARALLEL_INPROGRESS, TBLOCK_PREPARE, TBLOCK_STARTED, TBLOCK_SUBABORT, TBLOCK_SUBABORT_END, TBLOCK_SUBABORT_PENDING, TBLOCK_SUBABORT_RESTART, TBLOCK_SUBBEGIN, TBLOCK_SUBCOMMIT, TBLOCK_SUBINPROGRESS, TBLOCK_SUBRELEASE, TBLOCK_SUBRESTART, and WARNING.
Referenced by standard_ProcessUtility().
|
static |
Definition at line 5390 of file xact.c.
References TBLOCK_ABORT, TBLOCK_ABORT_END, TBLOCK_ABORT_PENDING, TBLOCK_BEGIN, TBLOCK_DEFAULT, TBLOCK_END, TBLOCK_IMPLICIT_INPROGRESS, TBLOCK_INPROGRESS, TBLOCK_PARALLEL_INPROGRESS, TBLOCK_PREPARE, TBLOCK_STARTED, TBLOCK_SUBABORT, TBLOCK_SUBABORT_END, TBLOCK_SUBABORT_PENDING, TBLOCK_SUBABORT_RESTART, TBLOCK_SUBBEGIN, TBLOCK_SUBCOMMIT, TBLOCK_SUBINPROGRESS, TBLOCK_SUBRELEASE, and TBLOCK_SUBRESTART.
Referenced by BeginInternalSubTransaction(), BeginTransactionBlock(), CommitTransactionCommand(), DefineSavepoint(), EndTransactionBlock(), ReleaseCurrentSubTransaction(), ReleaseSavepoint(), RollbackAndReleaseCurrentSubTransaction(), RollbackToSavepoint(), ShowTransactionStateRec(), StartTransactionCommand(), TransactionBlockStatusCode(), and UserAbortTransactionBlock().
|
static |
Definition at line 3616 of file xact.c.
References SubXactCallbackItem::arg, SubXactCallbackItem::callback, and SubXactCallbackItem::next.
Referenced by AbortSubTransaction(), CommitSubTransaction(), and StartSubTransaction().
|
static |
Definition at line 3561 of file xact.c.
References XactCallbackItem::arg, XactCallbackItem::callback, and XactCallbackItem::next.
Referenced by AbortTransaction(), CommitTransaction(), and PrepareTransaction().
|
static |
Definition at line 3454 of file xact.c.
References ereport, errcode(), errmsg(), ERROR, IsSubTransaction(), IsTransactionBlock(), and WARNING.
Referenced by RequireTransactionBlock(), and WarnNoTransactionBlock().
|
static |
Definition at line 5078 of file xact.c.
References AtSubCleanup_Memory(), AtSubCleanup_Portals(), CurrentResourceOwner, CurrentTransactionState, TransactionStateData::curTransactionOwner, CurTransactionResourceOwner, elog, TransactionStateData::parent, PopTransaction(), ResourceOwnerDelete(), ShowTransactionState(), TransactionStateData::state, TransactionStateData::subTransactionId, TRANS_ABORT, TRANS_DEFAULT, TransStateAsString(), and WARNING.
Referenced by AbortCurrentTransaction(), AbortOutOfAnyTransaction(), CommitTransactionCommand(), and RollbackAndReleaseCurrentSubTransaction().
|
static |
Definition at line 2789 of file xact.c.
References AtCleanup_Memory(), AtCleanup_Portals(), AtEOXact_Snapshot(), TransactionStateData::childXids, CurrentResourceOwner, CurrentTransactionState, TransactionStateData::curTransactionOwner, CurTransactionResourceOwner, elog, FATAL, TransactionStateData::fullTransactionId, TransactionStateData::gucNestLevel, InvalidFullTransactionId, InvalidSubTransactionId, TransactionStateData::maxChildXids, TransactionStateData::nChildXids, TransactionStateData::nestingLevel, nParallelCurrentXids, TransactionStateData::parallelModeLevel, ResourceOwnerDelete(), TransactionStateData::state, TransactionStateData::subTransactionId, TopTransactionResourceOwner, TRANS_ABORT, TRANS_DEFAULT, and TransStateAsString().
Referenced by AbortCurrentTransaction(), AbortOutOfAnyTransaction(), and CommitTransactionCommand().
void CommandCounterIncrement | ( | void | ) |
Definition at line 1021 of file xact.c.
References AtCCI_LocalCache(), currentCommandId, currentCommandIdUsed, elog, ereport, errcode(), errmsg(), ERROR, InvalidCommandId, IsInParallelMode(), IsParallelWorker, and SnapshotSetCommandId().
Referenced by _SPI_execute_plan(), acquire_inherited_sample_rows(), addFkRecurseReferenced(), addFkRecurseReferencing(), AddRoleMems(), AlterPublicationOptions(), AlterRole(), apply_handle_delete(), apply_handle_insert(), apply_handle_truncate(), apply_handle_update(), ATAddCheckConstraint(), ATExecAddColumn(), ATExecAlterColumnType(), ATExecCmd(), ATExecDropColumn(), ATExecDropConstraint(), ATExecDropExpression(), ATExecDropIdentity(), ATExecSetCompression(), ATExecSetTableSpace(), ATExecSetTableSpaceNoStorage(), ATParseTransformCmd(), ATRewriteTables(), AttachPartitionEnsureIndexes(), btadjustmembers(), CloneFkReferencing(), CommitSubTransaction(), CommitTransactionCommand(), copy_table_data(), create_ctas_internal(), create_toast_table(), CreateFKCheckTrigger(), createForeignKeyActionTriggers(), CreateForeignTable(), CreatePublication(), CreateRole(), CreateSchemaCommand(), CreateTrigger(), DefineCollation(), DefineDomain(), DefineQueryRewrite(), DefineRelation(), DefineVirtualRelation(), deleteOneObject(), DelRoleMems(), DetachPartitionFinalize(), DropClonedTriggersFromPartition(), DropRole(), EventTriggerDDLCommandEnd(), EventTriggerDDLCommandStart(), EventTriggerInvoke(), EventTriggerSQLDrop(), EventTriggerTableRewrite(), exec_eval_simple_expr(), exec_execute_message(), exec_parse_message(), exec_simple_query(), ExecGrant_Database(), ExecGrant_Fdw(), ExecGrant_ForeignServer(), ExecGrant_Function(), ExecGrant_Language(), ExecGrant_Largeobject(), ExecGrant_Namespace(), ExecGrant_Relation(), ExecGrant_Tablespace(), ExecGrant_Type(), execute_sql_string(), ExplainOnePlan(), fmgr_sql(), hashadjustmembers(), ImportForeignSchema(), index_build(), index_concurrently_swap(), index_create(), IndexSetParentIndex(), InitTempTableNamespace(), inv_create(), inv_drop(), inv_truncate(), inv_write(), LogicalRepSyncTableStart(), make_new_heap(), makeConfigurationDependencies(), moveArrayTypeName(), OperatorShellMake(), OperatorUpd(), pg_import_system_collations(), PortalRunMulti(), ProcedureCreate(), ProcessUtilitySlow(), recordExtensionInitPrivWorker(), reindex_index(), reindex_relation(), ReindexRelationConcurrently(), RelationSetNewRelfilenode(), RenumberEnumType(), replorigin_create(), replorigin_drop_guts(), ri_PerformCheck(), SetDefaultACL(), SetMatViewPopulatedState(), shdepReassignOwned(), SPI_cursor_open_internal(), standard_ProcessUtility(), StoreConstraints(), StorePartitionBound(), tryAttachPartitionForeignKey(), vacuum(), and validatePartitionedIndex().
|
static |
Definition at line 4816 of file xact.c.
References AfterTriggerEndSubXact(), AtEOSubXact_Files(), AtEOSubXact_HashTables(), AtEOSubXact_Inval(), AtEOSubXact_LargeObject(), AtEOSubXact_Namespace(), AtEOSubXact_on_commit_actions(), AtEOSubXact_Parallel(), AtEOSubXact_PgStat(), AtEOSubXact_RelationCache(), AtEOSubXact_SPI(), AtEOXact_GUC(), AtSubCommit_childXids(), AtSubCommit_Memory(), AtSubCommit_Notify(), AtSubCommit_Portals(), AtSubCommit_smgr(), AtSubCommit_Snapshot(), CallSubXactCallbacks(), CommandCounterIncrement(), CurrentResourceOwner, CurrentTransactionState, TransactionStateData::curTransactionOwner, CurTransactionResourceOwner, elog, TransactionStateData::fullTransactionId, FullTransactionIdIsValid, TransactionStateData::gucNestLevel, IsInParallelMode(), TransactionStateData::nestingLevel, TransactionStateData::parallelModeLevel, TransactionStateData::parent, PopTransaction(), TransactionStateData::prevXactReadOnly, RESOURCE_RELEASE_AFTER_LOCKS, RESOURCE_RELEASE_BEFORE_LOCKS, RESOURCE_RELEASE_LOCKS, ResourceOwnerDelete(), ResourceOwnerRelease(), ShowTransactionState(), TransactionStateData::state, TransactionStateData::subTransactionId, SUBXACT_EVENT_COMMIT_SUB, SUBXACT_EVENT_PRE_COMMIT_SUB, TRANS_COMMIT, TRANS_DEFAULT, TRANS_INPROGRESS, TransStateAsString(), WARNING, XactLockTableDelete(), XactReadOnly, and XidFromFullTransactionId.
Referenced by CommitTransactionCommand(), and ReleaseCurrentSubTransaction().
|
static |
Definition at line 2073 of file xact.c.
References AfterTriggerEndXact(), AfterTriggerFireDeferred(), Assert, AtCommit_Memory(), AtCommit_Notify(), AtEOXact_ApplyLauncher(), AtEOXact_Buffers(), AtEOXact_ComboCid(), AtEOXact_Enum(), AtEOXact_Files(), AtEOXact_GUC(), AtEOXact_HashTables(), AtEOXact_Inval(), AtEOXact_LargeObject(), AtEOXact_MultiXact(), AtEOXact_Namespace(), AtEOXact_on_commit_actions(), AtEOXact_Parallel(), AtEOXact_PgStat(), AtEOXact_RelationCache(), AtEOXact_RelationMap(), AtEOXact_SMgr(), AtEOXact_Snapshot(), AtEOXact_SPI(), TransactionStateData::blockState, CallXactCallbacks(), TransactionStateData::childXids, CurrentResourceOwner, CurrentTransactionState, TransactionStateData::curTransactionOwner, CurTransactionResourceOwner, elog, EnterParallelMode(), TransactionStateData::fullTransactionId, TransactionStateData::gucNestLevel, HOLD_INTERRUPTS, InvalidFullTransactionId, InvalidSubTransactionId, InvalidTransactionId, IsInParallelMode(), PGPROC::lxid, TransactionStateData::maxChildXids, MyProc, TransactionStateData::nChildXids, TransactionStateData::nestingLevel, nParallelCurrentXids, TransactionStateData::parallelModeLevel, ParallelWorkerReportLastRecEnd(), TransactionStateData::parent, pgstat_report_xact_timestamp(), PreCommit_CheckForSerializationFailure(), PreCommit_Notify(), PreCommit_on_commit_actions(), PreCommit_Portals(), ProcArrayEndTransaction(), RecordTransactionCommit(), RESOURCE_RELEASE_AFTER_LOCKS, RESOURCE_RELEASE_BEFORE_LOCKS, RESOURCE_RELEASE_LOCKS, ResourceOwnerDelete(), ResourceOwnerRelease(), RESUME_INTERRUPTS, ShowTransactionState(), smgrDoPendingDeletes(), smgrDoPendingSyncs(), TransactionStateData::state, TransactionStateData::subTransactionId, TBLOCK_PARALLEL_INPROGRESS, TopTransactionResourceOwner, TRANS_COMMIT, TRANS_DEFAULT, TRANS_INPROGRESS, TransStateAsString(), WARNING, XACT_EVENT_COMMIT, XACT_EVENT_PARALLEL_COMMIT, XACT_EVENT_PARALLEL_PRE_COMMIT, XACT_EVENT_PRE_COMMIT, and XactLastRecEnd.
Referenced by CommitTransactionCommand(), EndParallelWorkerTransaction(), EndRestoreBlobs(), restore_toc_entry(), and RestoreArchive().
void CommitTransactionCommand | ( | void | ) |
Definition at line 2939 of file xact.c.
References AbortSubTransaction(), AbortTransaction(), Assert, AssertState, TransactionStateData::blockState, BlockStateAsString(), TransactionStateData::chain, CleanupSubTransaction(), CleanupTransaction(), CommandCounterIncrement(), CommitSubTransaction(), CommitTransaction(), CommitTransactionCommand(), CurrentTransactionState, DefineSavepoint(), elog, ERROR, FATAL, TransactionStateData::name, TransactionStateData::parent, PrepareTransaction(), RestoreTransactionCharacteristics(), TransactionStateData::savepointLevel, SaveTransactionCharacteristics(), StartSubTransaction(), StartTransaction(), TBLOCK_ABORT, TBLOCK_ABORT_END, TBLOCK_ABORT_PENDING, TBLOCK_BEGIN, TBLOCK_DEFAULT, TBLOCK_END, TBLOCK_IMPLICIT_INPROGRESS, TBLOCK_INPROGRESS, TBLOCK_PARALLEL_INPROGRESS, TBLOCK_PREPARE, TBLOCK_STARTED, TBLOCK_SUBABORT, TBLOCK_SUBABORT_END, TBLOCK_SUBABORT_PENDING, TBLOCK_SUBABORT_RESTART, TBLOCK_SUBBEGIN, TBLOCK_SUBCOMMIT, TBLOCK_SUBINPROGRESS, TBLOCK_SUBRELEASE, and TBLOCK_SUBRESTART.
Referenced by _SPI_commit(), apply_handle_commit_internal(), apply_handle_stream_abort(), apply_handle_stream_stop(), ApplyWorkerMain(), ATExecDetachPartition(), autoprewarm_database_main(), BeginInternalSubTransaction(), BootstrapModeMain(), cluster(), CommitTransactionCommand(), DefineIndex(), do_autovacuum(), exec_replication_command(), finish_xact_command(), get_database_list(), get_subscription_list(), IdentifySystem(), index_drop(), initialize_worker_spi(), InitPostgres(), LogicalRepSyncTableStart(), maybe_reread_subscription(), movedb(), ParallelWorkerMain(), pg_attribute_noreturn(), process_syncing_tables_for_apply(), ProcessCatchupInterrupt(), ProcessCompletedNotifies(), ProcessIncomingNotify(), ReindexMultipleInternal(), ReindexRelationConcurrently(), RemoveTempRelationsCallback(), vacuum(), and vacuum_rel().
void DefineSavepoint | ( | const char * | name | ) |
Definition at line 4086 of file xact.c.
References TransactionStateData::blockState, BlockStateAsString(), CurrentTransactionState, elog, ereport, errcode(), errmsg(), ERROR, FATAL, IsInParallelMode(), MemoryContextStrdup(), TransactionStateData::name, PushTransaction(), TBLOCK_ABORT, TBLOCK_ABORT_END, TBLOCK_ABORT_PENDING, TBLOCK_BEGIN, TBLOCK_DEFAULT, TBLOCK_END, TBLOCK_IMPLICIT_INPROGRESS, TBLOCK_INPROGRESS, TBLOCK_PARALLEL_INPROGRESS, TBLOCK_PREPARE, TBLOCK_STARTED, TBLOCK_SUBABORT, TBLOCK_SUBABORT_END, TBLOCK_SUBABORT_PENDING, TBLOCK_SUBABORT_RESTART, TBLOCK_SUBBEGIN, TBLOCK_SUBCOMMIT, TBLOCK_SUBINPROGRESS, TBLOCK_SUBRELEASE, TBLOCK_SUBRESTART, and TopTransactionContext.
Referenced by CommitTransactionCommand(), and standard_ProcessUtility().
void EndImplicitTransactionBlock | ( | void | ) |
Definition at line 4064 of file xact.c.
References TransactionStateData::blockState, CurrentTransactionState, TBLOCK_IMPLICIT_INPROGRESS, and TBLOCK_STARTED.
Referenced by exec_simple_query().
void EndParallelWorkerTransaction | ( | void | ) |
Definition at line 5328 of file xact.c.
References Assert, TransactionStateData::blockState, CommitTransaction(), TBLOCK_DEFAULT, and TBLOCK_PARALLEL_INPROGRESS.
Referenced by ParallelWorkerMain().
Definition at line 3757 of file xact.c.
References Assert, TransactionStateData::blockState, BlockStateAsString(), TransactionStateData::chain, CurrentTransactionState, elog, ereport, errcode(), errmsg(), ERROR, FATAL, TransactionStateData::parent, TBLOCK_ABORT, TBLOCK_ABORT_END, TBLOCK_ABORT_PENDING, TBLOCK_BEGIN, TBLOCK_DEFAULT, TBLOCK_END, TBLOCK_IMPLICIT_INPROGRESS, TBLOCK_INPROGRESS, TBLOCK_PARALLEL_INPROGRESS, TBLOCK_PREPARE, TBLOCK_STARTED, TBLOCK_SUBABORT, TBLOCK_SUBABORT_END, TBLOCK_SUBABORT_PENDING, TBLOCK_SUBABORT_RESTART, TBLOCK_SUBBEGIN, TBLOCK_SUBCOMMIT, TBLOCK_SUBINPROGRESS, TBLOCK_SUBRELEASE, TBLOCK_SUBRESTART, and WARNING.
Referenced by PrepareTransactionBlock(), and standard_ProcessUtility().
void EnterParallelMode | ( | void | ) |
Definition at line 979 of file xact.c.
References Assert, CurrentTransactionState, and TransactionStateData::parallelModeLevel.
Referenced by _bt_begin_parallel(), begin_parallel_vacuum(), CommitTransaction(), ExecutePlan(), and ParallelWorkerMain().
Size EstimateTransactionStateSpace | ( | void | ) |
Definition at line 5205 of file xact.c.
References add_size(), TransactionStateData::fullTransactionId, FullTransactionIdIsValid, mul_size(), TransactionStateData::nChildXids, TransactionStateData::parent, and SerializedTransactionStateHeaderSize.
Referenced by InitializeParallelDSM().
void ExitParallelMode | ( | void | ) |
Definition at line 992 of file xact.c.
References Assert, CurrentTransactionState, ParallelContextActive(), and TransactionStateData::parallelModeLevel.
Referenced by _bt_begin_parallel(), _bt_end_parallel(), end_parallel_vacuum(), ExecutePlan(), and ParallelWorkerMain().
void ForceSyncCommit | ( | void | ) |
Definition at line 1071 of file xact.c.
References forceSyncCommit.
Referenced by createdb(), CreateTableSpace(), dropdb(), DropTableSpace(), and movedb().
Definition at line 761 of file xact.c.
References Assert, currentCommandId, currentCommandIdUsed, and IsParallelWorker.
Referenced by ATRewriteTable(), CatalogTuplesMultiInsertWithInfo(), CopyFrom(), create_estate_for_relation(), GetSnapshotData(), GetSnapshotDataReuse(), intorel_startup(), pgrowlocks(), RegisterRelcacheInvalidation(), RelationFindReplTupleByIndex(), RelationFindReplTupleSeq(), simple_heap_delete(), simple_heap_insert(), simple_heap_update(), simple_table_tuple_delete(), simple_table_tuple_insert(), simple_table_tuple_update(), standard_ExecutorStart(), toast_save_datum(), transientrel_startup(), and UpdateActiveSnapshotCommandId().
FullTransactionId GetCurrentFullTransactionId | ( | void | ) |
Definition at line 496 of file xact.c.
References AssignTransactionId(), CurrentTransactionState, TransactionStateData::fullTransactionId, and FullTransactionIdIsValid.
FullTransactionId GetCurrentFullTransactionIdIfAny | ( | void | ) |
TimestampTz GetCurrentStatementStartTimestamp | ( | void | ) |
Definition at line 807 of file xact.c.
References stmtStartTimestamp.
Referenced by check_log_duration(), CreatePortal(), InitializeParallelDSM(), pgstat_report_activity(), statement_timestamp(), and StorePreparedStatement().
SubTransactionId GetCurrentSubTransactionId | ( | void | ) |
Definition at line 723 of file xact.c.
References CurrentTransactionState, and TransactionStateData::subTransactionId.
Referenced by _SPI_begin_call(), AllocateDir(), AllocateFile(), CopyFrom(), CreateParallelContext(), CreatePortal(), ExecuteTruncateGuts(), init_sql_fcache(), InitTempTableNamespace(), inv_open(), MarkPortalActive(), OpenPipeStream(), OpenTransientFilePerm(), plpgsql_create_econtext(), plpgsql_inline_handler(), register_on_commit_action(), RelationAssumeNewRelfilenode(), RelationBuildLocalRelation(), RelationForgetRelation(), remove_on_commit_action(), sepgsql_set_client_label(), SPI_connect_ext(), and spi_dest_startup().
TransactionId GetCurrentTransactionId | ( | void | ) |
Definition at line 438 of file xact.c.
References AssignTransactionId(), CurrentTransactionState, TransactionStateData::fullTransactionId, FullTransactionIdIsValid, and XidFromFullTransactionId.
Referenced by asyncQueueNotificationToEntry(), check_exclusion_or_unique_constraint(), ExecInsert(), heap_abort_speculative(), heap_delete(), heap_insert(), heap_lock_tuple(), heap_multi_insert(), heap_update(), LogAccessExclusiveLock(), LogAccessExclusiveLockPrepare(), logical_rewrite_log_mapping(), LogLogicalMessage(), PreCommit_Notify(), PrepareTransaction(), RelationSetNewRelfilenode(), and ReorderBufferProcessTXN().
TransactionId GetCurrentTransactionIdIfAny | ( | void | ) |
Definition at line 455 of file xact.c.
References TransactionStateData::fullTransactionId, and XidFromFullTransactionId.
Referenced by IsSubTransactionAssignmentPending(), RecordTransactionAbort(), ReorderBufferProcessTXN(), and XLogRecordAssemble().
int GetCurrentTransactionNestLevel | ( | void | ) |
Definition at line 857 of file xact.c.
References CurrentTransactionState, and TransactionStateData::nestingLevel.
Referenced by AfterTriggerBeginSubXact(), AfterTriggerEndSubXact(), AfterTriggerSetState(), Async_Notify(), AtEOSubXact_Inval(), AtEOSubXact_Namespace(), AtSubAbort_Notify(), AtSubCommit_Notify(), AtSubCommit_smgr(), begin_remote_xact(), pgfdw_subxact_callback(), pgstat_count_heap_delete(), pgstat_count_heap_insert(), pgstat_count_heap_update(), pgstat_count_truncate(), PopOverrideSearchPath(), PrepareInvalidationState(), PushActiveSnapshot(), PushOverrideSearchPath(), queue_listen(), register_seq_scan(), RelationCreateStorage(), RelationDropStorage(), RelationMapUpdateMap(), RestoreReindexState(), SetReindexPending(), SetReindexProcessing(), smgrDoPendingDeletes(), smgrDoPendingSyncs(), and smgrGetPendingDeletes().
TimestampTz GetCurrentTransactionStartTimestamp | ( | void | ) |
Definition at line 798 of file xact.c.
References xactStartTimestamp.
Referenced by GetCurrentTimeUsec(), GetSQLCurrentTimestamp(), GetSQLLocalTimestamp(), InitializeParallelDSM(), now(), pg_timezone_abbrevs(), and pg_timezone_names().
TimestampTz GetCurrentTransactionStopTimestamp | ( | void | ) |
Definition at line 819 of file xact.c.
References GetCurrentTimestamp(), and xactStopTimestamp.
Referenced by pgstat_report_stat().
TransactionId GetStableLatestTransactionId | ( | void | ) |
Definition at line 541 of file xact.c.
References Assert, GetTopTransactionIdIfAny(), InvalidLocalTransactionId, InvalidTransactionId, PGPROC::lxid, MyProc, ReadNextTransactionId(), and TransactionIdIsValid.
Referenced by xid_age().
FullTransactionId GetTopFullTransactionId | ( | void | ) |
Definition at line 467 of file xact.c.
References AssignTransactionId(), FullTransactionIdIsValid, and XactTopFullTransactionId.
Referenced by pg_current_xact_id().
FullTransactionId GetTopFullTransactionIdIfAny | ( | void | ) |
Definition at line 483 of file xact.c.
References XactTopFullTransactionId.
Referenced by pg_current_xact_id_if_assigned().
TransactionId GetTopTransactionId | ( | void | ) |
Definition at line 410 of file xact.c.
References AssignTransactionId(), FullTransactionIdIsValid, and XidFromFullTransactionId.
Referenced by AlterSequence(), AssignTransactionId(), do_setval(), fill_seq_with_data(), log_heap_new_cid(), and nextval_internal().
TransactionId GetTopTransactionIdIfAny | ( | void | ) |
Definition at line 425 of file xact.c.
References XidFromFullTransactionId.
Referenced by CheckForSerializableConflictOut(), ConditionalXactLockTableWait(), CreateInitDecodingContext(), ExportSnapshot(), GetSerializableTransactionSnapshotInt(), GetStableLatestTransactionId(), HeapCheckForSerializableConflictOut(), ImportSnapshot(), index_drop(), initSpGistState(), log_line_prefix(), RecordTransactionCommit(), TransactionIdIsCurrentTransactionId(), write_csvlog(), XactLockTableWait(), XidIsConcurrent(), and XLogRecordAssemble().
bool IsAbortedTransactionBlockState | ( | void | ) |
Definition at line 391 of file xact.c.
References TransactionStateData::blockState, CurrentTransactionState, TBLOCK_ABORT, and TBLOCK_SUBABORT.
Referenced by BuildParamLogString(), exec_bind_message(), exec_describe_portal_message(), exec_describe_statement_message(), exec_execute_message(), exec_parse_message(), exec_replication_command(), exec_simple_query(), HandleFunctionRequest(), PostgresMain(), and RecoveryConflictInterrupt().
bool IsInParallelMode | ( | void | ) |
Definition at line 1012 of file xact.c.
References TransactionStateData::parallelModeLevel.
Referenced by AbortSubTransaction(), AbortTransaction(), AssignTransactionId(), BeginInternalSubTransaction(), CheckTargetForConflictsIn(), CommandCounterIncrement(), CommitSubTransaction(), CommitTransaction(), CreateParallelContext(), CreatePredicateLock(), DefineSavepoint(), DeleteChildTargetLocks(), ExecSetVariableStmt(), GetLatestSnapshot(), GetNewTransactionId(), GetSerializableTransactionSnapshotInt(), GetTransactionSnapshot(), heap_delete(), heap_inplace_update(), heap_update(), PrepareTransaction(), PreventCommandIfParallelMode(), RelationCreateStorage(), RelationMapUpdateMap(), ReleaseCurrentSubTransaction(), ReleaseOneSerializableXact(), ReleasePredicateLocks(), ReleaseSavepoint(), RemoveReindexPending(), RollbackToSavepoint(), set_config_option(), SetReindexPending(), standard_ExecutorStart(), standard_ProcessUtility(), update_index_statistics(), and UpdateActiveSnapshotCommandId().
Definition at line 3492 of file xact.c.
References TransactionStateData::blockState, IsSubTransaction(), IsTransactionBlock(), TBLOCK_DEFAULT, and TBLOCK_STARTED.
Referenced by vacuum().
bool IsSubTransaction | ( | void | ) |
Definition at line 4756 of file xact.c.
References CurrentTransactionState, and TransactionStateData::nestingLevel.
Referenced by _SPI_commit(), _SPI_rollback(), AfterTriggerSetState(), check_transaction_deferrable(), check_transaction_read_only(), check_XactIsoLevel(), CheckTargetForConflictsIn(), CheckTransactionBlock(), CreateReplicationSlot(), ExportSnapshot(), ImportSnapshot(), IsInTransactionBlock(), IsSubTransactionAssignmentPending(), PreventInTransactionBlock(), and RecoveryConflictInterrupt().
bool IsSubTransactionAssignmentPending | ( | void | ) |
Definition at line 6087 of file xact.c.
References TransactionStateData::assigned, GetCurrentTransactionIdIfAny(), IsSubTransaction(), IsTransactionState(), TransactionIdIsValid, and XLogLogicalInfoActive.
Referenced by MarkSubTransactionAssigned(), and XLogRecordAssemble().
bool IsTransactionBlock | ( | void | ) |
Definition at line 4683 of file xact.c.
References TransactionStateData::blockState, CurrentTransactionState, TBLOCK_DEFAULT, and TBLOCK_STARTED.
Referenced by CheckTransactionBlock(), CreateReplicationSlot(), IsInTransactionBlock(), PreventInTransactionBlock(), and standard_ProcessUtility().