|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/amapi.h"#include "access/heapam.h"#include "access/multixact.h"#include "access/relscan.h"#include "access/tableam.h"#include "access/toast_internals.h"#include "access/transam.h"#include "access/xact.h"#include "catalog/catalog.h"#include "catalog/dependency.h"#include "catalog/heap.h"#include "catalog/index.h"#include "catalog/namespace.h"#include "catalog/objectaccess.h"#include "catalog/pg_am.h"#include "catalog/pg_inherits.h"#include "catalog/toasting.h"#include "commands/cluster.h"#include "commands/defrem.h"#include "commands/progress.h"#include "commands/tablecmds.h"#include "commands/vacuum.h"#include "miscadmin.h"#include "optimizer/optimizer.h"#include "pgstat.h"#include "storage/bufmgr.h"#include "storage/lmgr.h"#include "storage/predicate.h"#include "utils/acl.h"#include "utils/fmgroids.h"#include "utils/guc.h"#include "utils/inval.h"#include "utils/lsyscache.h"#include "utils/memutils.h"#include "utils/pg_rusage.h"#include "utils/relmapper.h"#include "utils/snapmgr.h"#include "utils/syscache.h"
Go to the source code of this file.
Data Structures | |
| struct | RelToCluster |
Definition at line 508 of file cluster.c.
References ereport, errcode(), errmsg, ERROR, fb(), heap_attisnull(), index_close(), index_open(), NoLock, RelationGetRelationName, and RelationGetRelid.
Referenced by ATExecClusterOn(), cluster_rel(), ExecRepack(), and process_single_relation().
| void cluster_rel | ( | RepackCommand | cmd, |
| Relation | OldHeap, | ||
| Oid | indexOid, | ||
| ClusterParams * | params | ||
| ) |
Definition at line 300 of file cluster.c.
References AccessExclusiveLock, allowSystemTableMods, Assert, AtEOXact_GUC(), CHECK_FOR_INTERRUPTS, check_index_is_clusterable(), CheckRelationLockedByMe(), CheckTableNotInUse(), CLUOPT_RECHECK, CLUOPT_VERBOSE, cluster_rel_recheck(), ereport, errcode(), errdetail(), errmsg, ERROR, fb(), GetUserIdAndSecContext(), index_open(), IsCatalogRelation(), NewGUCNestLevel(), NoLock, OidIsValid, ClusterParams::options, pgstat_progress_end_command(), pgstat_progress_start_command(), pgstat_progress_update_param(), PROGRESS_COMMAND_REPACK, PROGRESS_REPACK_COMMAND, rebuild_relation(), relation_close(), RELATION_IS_OTHER_TEMP, RelationGetRelationName, RelationGetRelid, RelationIsPopulated, REPACK_COMMAND_CLUSTER, RepackCommandAsString(), RestrictSearchPath(), SECURITY_RESTRICTED_OPERATION, SetUserIdAndSecContext(), TransferPredicateLocksToHeapRelation(), and verbose.
Referenced by ExecRepack(), process_single_relation(), and vacuum_rel().
|
static |
Definition at line 447 of file cluster.c.
References AccessExclusiveLock, CLUOPT_RECHECK_ISCLUSTERED, fb(), get_index_isclustered(), ObjectIdGetDatum(), OidIsValid, relation_close(), RELATION_IS_OTHER_TEMP, RelationGetRelid, repack_is_permitted_for_relation(), and SearchSysCacheExists1.
Referenced by cluster_rel().
|
static |
Definition at line 841 of file cluster.c.
References AccessExclusiveLock, Assert, CacheInvalidateRelcacheByTuple(), CatalogTupleUpdate(), CommandCounterIncrement(), DEBUG2, elog, ereport, errdetail(), errmsg, ERROR, fb(), VacuumCutoffs::FreezeLimit, get_namespace_name(), GETSTRUCT(), heap_freetuple(), HeapTupleIsValid, INFO, InvalidOid, LockRelationOid(), VacuumCutoffs::MultiXactCutoff, MultiXactIdIsValid, MultiXactIdPrecedes(), ObjectIdGetDatum(), VacuumCutoffs::OldestXmin, pg_rusage_init(), pg_rusage_show(), PG_USED_FOR_ASSERTS_ONLY, plan_cluster_use_sort(), RelationGetDescr, RelationGetNamespace, RelationGetNumberOfBlocks, RelationGetRelationName, RelationGetRelid, VacuumCutoffs::relfrozenxid, VacuumCutoffs::relminmxid, RowExclusiveLock, SearchSysCacheCopy1, table_close(), table_open(), table_relation_copy_for_cluster(), TransactionIdIsValid, TransactionIdPrecedes(), vacuum_get_cutoffs(), and verbose.
Referenced by rebuild_relation().
|
static |
Definition at line 1972 of file cluster.c.
References ereport, errcode(), errmsg, ERROR, fb(), foreach_oid, get_index_isclustered(), get_relname_relid(), InvalidOid, OidIsValid, RelationData::rd_rel, RelationGetIndexList(), and RelationGetRelationName.
Referenced by ExecRepack(), and process_single_relation().
| void ExecRepack | ( | ParseState * | pstate, |
| RepackStmt * | stmt, | ||
| bool | isTopLevel | ||
| ) |
Definition at line 113 of file cluster.c.
References AccessExclusiveLock, ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, Assert, check_index_is_clusterable(), CLUOPT_ANALYZE, CLUOPT_RECHECK, CLUOPT_RECHECK_ISCLUSTERED, CLUOPT_VERBOSE, cluster_rel(), CommitTransactionCommand(), defGetBoolean(), determine_clustered_index(), elog, ereport, errcode(), errmsg, ERROR, fb(), foreach_node, foreach_ptr, get_tables_to_repack(), get_tables_to_repack_partitioned(), GetTransactionSnapshot(), MemoryContextDelete(), OidIsValid, ClusterParams::options, parser_errposition(), PopActiveSnapshot(), PortalContext, PreventInTransactionBlock(), process_single_relation(), PushActiveSnapshot(), RelationData::rd_rel, RelationGetRelationName, RelationGetRelid, REPACK_COMMAND_CLUSTER, RepackCommandAsString(), StartTransactionCommand(), stmt, table_close(), and try_table_open().
Referenced by standard_ProcessUtility().
| void finish_heap_swap | ( | Oid | OIDOldHeap, |
| Oid | OIDNewHeap, | ||
| bool | is_system_catalog, | ||
| bool | swap_toast_by_content, | ||
| bool | check_constraints, | ||
| bool | is_internal, | ||
| TransactionId | frozenXid, | ||
| MultiXactId | cutoffMulti, | ||
| char | newrelpersistence | ||
| ) |
Definition at line 1455 of file cluster.c.
References CacheInvalidateCatalog(), CatalogTupleUpdate(), CommandCounterIncrement(), DROP_RESTRICT, elog, ERROR, fb(), GETSTRUCT(), HeapTupleIsValid, i, NAMEDATALEN, NoLock, ObjectIdGetDatum(), OidIsValid, PERFORM_DELETION_INTERNAL, performDeletion(), pgstat_progress_update_param(), PROGRESS_REPACK_PHASE, PROGRESS_REPACK_PHASE_FINAL_CLEANUP, PROGRESS_REPACK_PHASE_REBUILD_INDEX, PROGRESS_REPACK_PHASE_SWAP_REL_FILES, REINDEX_REL_CHECK_CONSTRAINTS, REINDEX_REL_FORCE_INDEXES_PERMANENT, REINDEX_REL_FORCE_INDEXES_UNLOGGED, REINDEX_REL_SUPPRESS_INDEX_USE, reindex_relation(), relation_close(), RelationClearMissing(), RelationMapRemoveMapping(), RenameRelationInternal(), ResetRelRewrite(), RowExclusiveLock, SearchSysCacheCopy1, snprintf, swap_relation_files(), table_close(), table_open(), and toast_get_valid_index().
Referenced by ATRewriteTables(), rebuild_relation(), and refresh_by_heap_swap().
|
static |
Definition at line 1658 of file cluster.c.
References AccessShareLock, BoolGetDatum(), BTEqualStrategyNumber, ConditionalLockRelationOid(), fb(), Form_pg_index, ForwardScanDirection, GETSTRUCT(), GetUserId(), heap_getnext(), InvalidOid, lappend(), MemoryContextSwitchTo(), NIL, ObjectIdGetDatum(), palloc_object, relation_close(), repack_is_permitted_for_relation(), ScanKeyInit(), SearchSysCacheExists1, table_beginscan_catalog(), table_endscan(), table_open(), and UnlockRelationOid().
Referenced by ExecRepack().
|
static |
Definition at line 1788 of file cluster.c.
References fb(), find_all_inheritors(), foreach_oid, get_rel_relkind(), GetUserId(), IndexGetRelation(), InvalidOid, lappend(), MemoryContextSwitchTo(), NIL, NoLock, palloc_object, and repack_is_permitted_for_relation().
Referenced by ExecRepack().
| Oid make_new_heap | ( | Oid | OIDOldHeap, |
| Oid | NewTableSpace, | ||
| Oid | NewAccessMethod, | ||
| char | relpersistence, | ||
| LOCKMODE | lockmode | ||
| ) |
Definition at line 715 of file cluster.c.
References Assert, CommandCounterIncrement(), elog, ERROR, fb(), heap_create_with_catalog(), HeapTupleIsValid, InvalidOid, LookupCreationNamespace(), NAMEDATALEN, NewHeapCreateToastTable(), NIL, NoLock, ObjectIdGetDatum(), OidIsValid, ONCOMMIT_NOOP, RelationGetDescr, RelationGetNamespace, RelationIsMapped, ReleaseSysCache(), SearchSysCache1(), snprintf, SysCacheGetAttr(), table_close(), and table_open().
Referenced by ATRewriteTables(), rebuild_relation(), and RefreshMatViewByOid().
Definition at line 568 of file cluster.c.
References Assert, CatalogTupleUpdate(), elog, ERROR, fb(), Form_pg_index, get_index_isclustered(), GETSTRUCT(), heap_freetuple(), HeapTupleIsValid, InvalidOid, InvokeObjectPostAlterHookArg, lfirst_oid, ObjectIdGetDatum(), OidIsValid, RelationData::rd_rel, RelationGetIndexList(), RowExclusiveLock, SearchSysCacheCopy1, table_close(), and table_open().
Referenced by ATExecClusterOn(), ATExecDropCluster(), and rebuild_relation().
|
static |
Definition at line 1879 of file cluster.c.
References AccessExclusiveLock, analyze_rel(), Assert, check_index_is_clusterable(), CLUOPT_ANALYZE, CLUOPT_VERBOSE, cluster_rel(), CommandCounterIncrement(), CommitTransactionCommand(), determine_clustered_index(), ereport, errcode(), errmsg, ERROR, fb(), GetTransactionSnapshot(), NIL, NoLock, OidIsValid, ClusterParams::options, PopActiveSnapshot(), PushActiveSnapshot(), RangeVarCallbackMaintainsTable(), RangeVarGetRelidExtended(), RelationData::rd_rel, RELATION_IS_OTHER_TEMP, REPACK_COMMAND_CLUSTER, REPACK_COMMAND_REPACK, RepackCommandAsString(), StartTransactionCommand(), stmt, table_open(), VACOPT_ANALYZE, and VACOPT_VERBOSE.
Referenced by ExecRepack().
Definition at line 639 of file cluster.c.
References AccessExclusiveLock, Assert, CheckRelationLockedByMe(), CheckRelationOidLockedByMe(), copy_table_data(), fb(), finish_heap_swap(), index_close(), IsSystemRelation(), make_new_heap(), mark_index_clustered(), NoLock, RelationGetRelid, table_close(), table_open(), and verbose.
Referenced by cluster_rel().
|
static |
Definition at line 1851 of file cluster.c.
References ACL_MAINTAIN, ACLCHECK_OK, Assert, ereport, errmsg, get_rel_name(), pg_class_aclcheck(), REPACK_COMMAND_CLUSTER, REPACK_COMMAND_REPACK, RepackCommandAsString(), and WARNING.
Referenced by cluster_rel_recheck(), get_tables_to_repack(), and get_tables_to_repack_partitioned().
|
static |
Definition at line 2015 of file cluster.c.
References REPACK_COMMAND_CLUSTER, REPACK_COMMAND_REPACK, and REPACK_COMMAND_VACUUMFULL.
Referenced by cluster_rel(), ExecRepack(), process_single_relation(), and repack_is_permitted_for_relation().
|
static |
Definition at line 1073 of file cluster.c.
References AccessExclusiveLock, Assert, CacheInvalidateRelcacheByTuple(), CatalogCloseIndexes(), CatalogOpenIndexes(), CatalogTupleUpdateWithInfo(), changeDependencyFor(), deleteDependencyRecordsFor(), DEPENDENCY_INTERNAL, elog, ERROR, fb(), get_namespace_name(), get_rel_name(), get_rel_namespace(), GETSTRUCT(), heap_freetuple(), HeapTupleIsValid, InvalidMultiXactId, InvalidOid, InvalidTransactionId, InvokeObjectPostAlterHookArg, IsSystemClass(), NameStr, NoLock, ObjectIdGetDatum(), recordDependencyOn(), relation_close(), relation_open(), RelationAssumeNewRelfilelocator(), RelationMapOidToFilenumber(), RelationMapUpdateMap(), RelFileNumberIsValid, RowExclusiveLock, SearchSysCacheCopy1, swap_relation_files(), table_close(), table_open(), toast_get_valid_index(), TransactionIdIsNormal, and TransactionIdIsValid.
Referenced by finish_heap_swap(), and swap_relation_files().