From 2b2b2846b99fc176900ec44e01f3bcc97b6a3cf8 Mon Sep 17 00:00:00 2001 From: Justin Pryzby Date: Mon, 14 Dec 2020 16:37:16 -0600 Subject: [PATCH 3/4] structure member variables: remove prefixes and lowercase --- src/backend/access/heap/vacuumlazy.c | 8 +-- src/backend/catalog/index.c | 18 +++--- src/backend/commands/analyze.c | 10 ++-- src/backend/commands/cluster.c | 10 ++-- src/backend/commands/indexcmds.c | 50 ++++++++--------- src/backend/commands/vacuum.c | 82 ++++++++++++++-------------- src/backend/postmaster/autovacuum.c | 14 ++--- src/backend/tcop/utility.c | 2 +- src/include/catalog/index.h | 8 +-- src/include/commands/cluster.h | 4 +- src/include/commands/vacuum.h | 16 +++--- 11 files changed, 111 insertions(+), 111 deletions(-) diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c index 3c8b22fd63..6bfed2b2da 100644 --- a/src/backend/access/heap/vacuumlazy.c +++ b/src/backend/access/heap/vacuumlazy.c @@ -456,7 +456,7 @@ heap_vacuum_rel(Relation onerel, VacuumParams *params, starttime = GetCurrentTimestamp(); } - if (params->options.VACOPT_VERBOSE) + if (params->options.verbose) elevel = INFO; else elevel = DEBUG2; @@ -484,7 +484,7 @@ heap_vacuum_rel(Relation onerel, VacuumParams *params, xidFullScanLimit); aggressive |= MultiXactIdPrecedesOrEquals(onerel->rd_rel->relminmxid, mxactFullScanLimit); - if (params->options.VACOPT_DISABLE_PAGE_SKIPPING) + if (params->options.disable_page_skipping) aggressive = true; vacrelstats = (LVRelStats *) palloc0(sizeof(LVRelStats)); @@ -902,7 +902,7 @@ lazy_scan_heap(Relation onerel, VacuumParams *params, LVRelStats *vacrelstats, * be replayed on any hot standby, where it can be disruptive. */ next_unskippable_block = 0; - if (!params->options.VACOPT_DISABLE_PAGE_SKIPPING) + if (!params->options.disable_page_skipping) { while (next_unskippable_block < nblocks) { @@ -960,7 +960,7 @@ lazy_scan_heap(Relation onerel, VacuumParams *params, LVRelStats *vacrelstats, { /* Time to advance next_unskippable_block */ next_unskippable_block++; - if (!params->options.VACOPT_DISABLE_PAGE_SKIPPING) + if (!params->options.disable_page_skipping) { while (next_unskippable_block < nblocks) { diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c index da2f45b796..ecd66ff3df 100644 --- a/src/backend/catalog/index.c +++ b/src/backend/catalog/index.c @@ -3610,12 +3610,12 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence, * we only need to be sure no schema or data changes are going on. */ heapId = IndexGetRelation(indexId, - options->REINDEXOPT_MISSING_OK); + options->missing_ok); /* if relation is missing, leave */ if (!OidIsValid(heapId)) return; - if (options->REINDEXOPT_MISSING_OK) + if (options->missing_ok) heapRelation = try_table_open(heapId, ShareLock); else heapRelation = table_open(heapId, ShareLock); @@ -3624,7 +3624,7 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence, if (!heapRelation) return; - if (options->REINDEXOPT_REPORT_PROGRESS) + if (options->report_progress) { pgstat_progress_start_command(PROGRESS_COMMAND_CREATE_INDEX, heapId); @@ -3640,7 +3640,7 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence, */ iRel = index_open(indexId, AccessExclusiveLock); - if (options->REINDEXOPT_REPORT_PROGRESS) + if (options->report_progress) pgstat_progress_update_param(PROGRESS_CREATEIDX_ACCESS_METHOD_OID, iRel->rd_rel->relam); @@ -3791,14 +3791,14 @@ reindex_index(Oid indexId, bool skip_constraint_checks, char persistence, } /* Log what we did */ - if (options->REINDEXOPT_VERBOSE) + if (options->verbose) ereport(INFO, (errmsg("index \"%s\" was reindexed", get_rel_name(indexId)), errdetail_internal("%s", pg_rusage_show(&ru0)))); - if (options->REINDEXOPT_REPORT_PROGRESS) + if (options->report_progress) pgstat_progress_end_command(); /* Close rels, but keep locks */ @@ -3860,7 +3860,7 @@ reindex_relation(Oid relid, int flags, ReindexOptions *options) * to prevent schema and data changes in it. The lock level used here * should match ReindexTable(). */ - if (options->REINDEXOPT_MISSING_OK) + if (options->missing_ok) rel = try_table_open(relid, ShareLock); else rel = table_open(relid, ShareLock); @@ -3962,10 +3962,10 @@ reindex_relation(Oid relid, int flags, ReindexOptions *options) { /* * Note that this should fail if the toast relation is missing, so - * reset REINDEXOPT_MISSING_OK. + * reset missing_ok. */ ReindexOptions newoptions = *options; - newoptions.REINDEXOPT_MISSING_OK = false; + newoptions.missing_ok = false; result |= reindex_relation(toast_relid, flags, &newoptions); } diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index 2e266391fb..01c034407c 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -127,7 +127,7 @@ analyze_rel(Oid relid, RangeVar *relation, VacuumOption newoptions; /* Select logging level */ - if (params->options.VACOPT_VERBOSE) + if (params->options.verbose) elevel = INFO; else elevel = DEBUG2; @@ -150,7 +150,7 @@ analyze_rel(Oid relid, RangeVar *relation, * Make sure to generate only logs for ANALYZE in this case. */ newoptions = params->options; - newoptions.VACOPT_VACUUM = false; + newoptions.vacuum = false; onerel = vacuum_open_relation(relid, relation, &newoptions, params->log_min_duration >= 0, ShareUpdateExclusiveLock); @@ -241,7 +241,7 @@ analyze_rel(Oid relid, RangeVar *relation, else { /* No need for a WARNING if we already complained during VACUUM */ - if (!params->options.VACOPT_VACUUM) + if (!params->options.vacuum) ereport(WARNING, (errmsg("skipping \"%s\" --- cannot analyze non-tables or special system tables", RelationGetRelationName(onerel)))); @@ -627,7 +627,7 @@ do_analyze_rel(Relation onerel, VacuumParams *params, * VACUUM ANALYZE, don't overwrite the accurate count already inserted by * VACUUM. */ - if (!inh && !params->options.VACOPT_VACUUM) + if (!inh && !params->options.vacuum) { for (ind = 0; ind < nindexes; ind++) { @@ -658,7 +658,7 @@ do_analyze_rel(Relation onerel, VacuumParams *params, (va_cols == NIL)); /* If this isn't part of VACUUM ANALYZE, let index AMs do cleanup */ - if (!params->options.VACOPT_VACUUM) + if (!params->options.vacuum) { for (ind = 0; ind < nindexes; ind++) { diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index 591878207d..04bf056caa 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -111,7 +111,7 @@ cluster(ParseState *pstate, ClusterStmt *stmt, bool isTopLevel) DefElem *opt = (DefElem *) lfirst(lc); if (strcmp(opt->defname, "verbose") == 0) - options.CLUOPT_VERBOSE = defGetBoolean(opt); + options.verbose = defGetBoolean(opt); else ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), @@ -232,7 +232,7 @@ cluster(ParseState *pstate, ClusterStmt *stmt, bool isTopLevel) { RelToCluster *rvtc = (RelToCluster *) lfirst(rv); ClusterOption newoptions = options; - newoptions.CLUOPT_RECHECK = true; + newoptions.recheck = true; /* Start a new transaction for each relation. */ StartTransactionCommand(); @@ -308,7 +308,7 @@ cluster_rel(Oid tableOid, Oid indexOid, ClusterOption *options) * *must* skip the one on indisclustered since it would reject an attempt * to cluster a not-previously-clustered index. */ - if (options->CLUOPT_RECHECK) + if (options->recheck) { /* Check that the user still owns the relation */ if (!pg_class_ownercheck(tableOid, GetUserId())) @@ -392,7 +392,7 @@ cluster_rel(Oid tableOid, Oid indexOid, ClusterOption *options) /* Check heap and index are valid to cluster on */ if (OidIsValid(indexOid)) - check_index_is_clusterable(OldHeap, indexOid, options->CLUOPT_RECHECK, + check_index_is_clusterable(OldHeap, indexOid, options->recheck, AccessExclusiveLock); @@ -420,7 +420,7 @@ cluster_rel(Oid tableOid, Oid indexOid, ClusterOption *options) TransferPredicateLocksToHeapRelation(OldHeap); /* rebuild_relation does all the dirty work */ - rebuild_relation(OldHeap, indexOid, options->CLUOPT_VERBOSE); + rebuild_relation(OldHeap, indexOid, options->verbose); /* NB: rebuild_relation does table_close() on OldHeap */ diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index 80fa39112a..13e463da90 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -2467,9 +2467,9 @@ ReindexParseOptions(ParseState *pstate, ReindexStmt *stmt) DefElem *opt = (DefElem *) lfirst(lc); if (strcmp(opt->defname, "verbose") == 0) - options.REINDEXOPT_VERBOSE = defGetBoolean(opt); + options.verbose = defGetBoolean(opt); else if (strcmp(opt->defname, "concurrently") == 0) - options.REINDEXOPT_CONCURRENTLY = defGetBoolean(opt); + options.concurrently = defGetBoolean(opt); else ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), @@ -2506,7 +2506,7 @@ ReindexIndex(RangeVar *indexRelation, ReindexOptions *options, bool isTopLevel) state.options = *options; state.locked_table_oid = InvalidOid; indOid = RangeVarGetRelidExtended(indexRelation, - options->REINDEXOPT_CONCURRENTLY ? + options->concurrently ? ShareUpdateExclusiveLock : AccessExclusiveLock, 0, RangeVarCallbackForReindexIndex, @@ -2521,13 +2521,13 @@ ReindexIndex(RangeVar *indexRelation, ReindexOptions *options, bool isTopLevel) if (relkind == RELKIND_PARTITIONED_INDEX) ReindexPartitions(indOid, options, isTopLevel); - else if (options->REINDEXOPT_CONCURRENTLY && + else if (options->concurrently && persistence != RELPERSISTENCE_TEMP) ReindexRelationConcurrently(indOid, options); else { ReindexOptions newoptions = *options; - newoptions.REINDEXOPT_REPORT_PROGRESS = true; + newoptions.report_progress = true; reindex_index(indOid, false, persistence, &newoptions); } } @@ -2550,7 +2550,7 @@ RangeVarCallbackForReindexIndex(const RangeVar *relation, * non-concurrent case and table locks used by index_concurrently_*() for * concurrent case. */ - table_lockmode = state->options.REINDEXOPT_CONCURRENTLY ? + table_lockmode = state->options.concurrently ? ShareUpdateExclusiveLock : ShareLock; /* @@ -2622,14 +2622,14 @@ ReindexTable(RangeVar *relation, ReindexOptions *options, bool isTopLevel) * locks on our temporary table. */ heapOid = RangeVarGetRelidExtended(relation, - options->REINDEXOPT_CONCURRENTLY ? + options->concurrently ? ShareUpdateExclusiveLock : ShareLock, 0, RangeVarCallbackOwnsTable, NULL); if (get_rel_relkind(heapOid) == RELKIND_PARTITIONED_TABLE) ReindexPartitions(heapOid, options, isTopLevel); - else if (options->REINDEXOPT_CONCURRENTLY && + else if (options->concurrently && get_rel_persistence(heapOid) != RELPERSISTENCE_TEMP) { result = ReindexRelationConcurrently(heapOid, options); @@ -2642,7 +2642,7 @@ ReindexTable(RangeVar *relation, ReindexOptions *options, bool isTopLevel) else { ReindexOptions newoptions = *options; - newoptions.REINDEXOPT_REPORT_PROGRESS = true; + newoptions.report_progress = true; result = reindex_relation(heapOid, REINDEX_REL_PROCESS_TOAST | REINDEX_REL_CHECK_CONSTRAINTS, @@ -2685,7 +2685,7 @@ ReindexMultipleTables(const char *objectName, ReindexObjectType objectKind, objectKind == REINDEX_OBJECT_DATABASE); if (objectKind == REINDEX_OBJECT_SYSTEM && - options->REINDEXOPT_CONCURRENTLY) + options->concurrently) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot reindex system catalogs concurrently"))); @@ -2793,7 +2793,7 @@ ReindexMultipleTables(const char *objectName, ReindexObjectType objectKind, * Skip system tables, since index_create() would reject indexing them * concurrently (and it would likely fail if we tried). */ - if (options->REINDEXOPT_CONCURRENTLY && + if (options->concurrently && IsCatalogRelationOid(relid)) { if (!concurrent_warning) @@ -2990,19 +2990,19 @@ ReindexMultipleInternal(List *relids, ReindexOptions *options) Assert(relkind != RELKIND_PARTITIONED_INDEX && relkind != RELKIND_PARTITIONED_TABLE); - if (options->REINDEXOPT_CONCURRENTLY && + if (options->concurrently && relpersistence != RELPERSISTENCE_TEMP) { ReindexOptions newoptions = *options; - newoptions.REINDEXOPT_MISSING_OK = true; + newoptions.missing_ok = true; (void) ReindexRelationConcurrently(relid, &newoptions); /* ReindexRelationConcurrently() does the verbose output */ } else if (relkind == RELKIND_INDEX) { ReindexOptions newoptions = *options; - newoptions.REINDEXOPT_REPORT_PROGRESS = true; - newoptions.REINDEXOPT_MISSING_OK = true; + newoptions.report_progress = true; + newoptions.missing_ok = true; reindex_index(relid, false, relpersistence, &newoptions); PopActiveSnapshot(); /* reindex_index() does the verbose output */ @@ -3011,15 +3011,15 @@ ReindexMultipleInternal(List *relids, ReindexOptions *options) { bool result; ReindexOptions newoptions = *options; - newoptions.REINDEXOPT_REPORT_PROGRESS = true; - newoptions.REINDEXOPT_MISSING_OK = true; + newoptions.report_progress = true; + newoptions.missing_ok = true; result = reindex_relation(relid, REINDEX_REL_PROCESS_TOAST | REINDEX_REL_CHECK_CONSTRAINTS, &newoptions); - if (result && options->REINDEXOPT_VERBOSE) + if (result && options->verbose) ereport(INFO, (errmsg("table \"%s.%s\" was reindexed", get_namespace_name(get_rel_namespace(relid)), @@ -3092,7 +3092,7 @@ ReindexRelationConcurrently(Oid relationOid, ReindexOptions *options) "ReindexConcurrent", ALLOCSET_SMALL_SIZES); - if (options->REINDEXOPT_VERBOSE) + if (options->verbose) { /* Save data needed by REINDEX VERBOSE in private context */ oldcontext = MemoryContextSwitchTo(private_context); @@ -3137,7 +3137,7 @@ ReindexRelationConcurrently(Oid relationOid, ReindexOptions *options) errmsg("cannot reindex system catalogs concurrently"))); /* Open relation to get its indexes */ - if (options->REINDEXOPT_MISSING_OK) + if (options->missing_ok) { heapRelation = try_table_open(relationOid, ShareUpdateExclusiveLock); @@ -3233,7 +3233,7 @@ ReindexRelationConcurrently(Oid relationOid, ReindexOptions *options) case RELKIND_INDEX: { Oid heapId = IndexGetRelation(relationOid, - options->REINDEXOPT_MISSING_OK); + options->missing_ok); Relation heapRelation; /* if relation is missing, leave */ @@ -3259,10 +3259,10 @@ ReindexRelationConcurrently(Oid relationOid, ReindexOptions *options) /* * Check if parent relation can be locked and if it exists, * this needs to be done at this stage as the list of indexes - * to rebuild is not complete yet, and REINDEXOPT_MISSING_OK + * to rebuild is not complete yet, and missing_ok * should not be used once all the session locks are taken. */ - if (options->REINDEXOPT_MISSING_OK) + if (options->missing_ok) { heapRelation = try_table_open(heapId, ShareUpdateExclusiveLock); @@ -3303,7 +3303,7 @@ ReindexRelationConcurrently(Oid relationOid, ReindexOptions *options) /* * Definitely no indexes, so leave. Any checks based on - * REINDEXOPT_MISSING_OK should be done only while the list of indexes to + * missing_ok should be done only while the list of indexes to * work on is built as the session locks taken before this transaction * commits will make sure that they cannot be dropped by a concurrent * session until this operation completes. @@ -3754,7 +3754,7 @@ ReindexRelationConcurrently(Oid relationOid, ReindexOptions *options) StartTransactionCommand(); /* Log what we did */ - if (options->REINDEXOPT_VERBOSE) + if (options->verbose) { if (relkind == RELKIND_INDEX) ereport(INFO, diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 3774a18ff8..167ca0a1de 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -114,9 +114,9 @@ ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool isTopLevel) /* Parse common options for VACUUM and ANALYZE */ if (strcmp(opt->defname, "verbose") == 0) - params.options.VACOPT_VERBOSE = defGetBoolean(opt); + params.options.verbose = defGetBoolean(opt); else if (strcmp(opt->defname, "skip_locked") == 0) - params.options.VACOPT_SKIP_LOCKED = defGetBoolean(opt); + params.options.skip_locked = defGetBoolean(opt); else if (!vacstmt->is_vacuumcmd) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), @@ -125,13 +125,13 @@ ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool isTopLevel) /* Parse options available on VACUUM */ else if (strcmp(opt->defname, "analyze") == 0) - params.options.VACOPT_ANALYZE = defGetBoolean(opt); + params.options.analyze = defGetBoolean(opt); else if (strcmp(opt->defname, "freeze") == 0) - params.options.VACOPT_FREEZE = defGetBoolean(opt); + params.options.freeze = defGetBoolean(opt); else if (strcmp(opt->defname, "full") == 0) - params.options.VACOPT_FULL = defGetBoolean(opt); + params.options.full = defGetBoolean(opt); else if (strcmp(opt->defname, "disable_page_skipping") == 0) - params.options.VACOPT_DISABLE_PAGE_SKIPPING = defGetBoolean(opt); + params.options.disable_page_skipping = defGetBoolean(opt); else if (strcmp(opt->defname, "index_cleanup") == 0) // XXX params.index_cleanup = get_vacopt_ternary_value(opt); @@ -178,25 +178,25 @@ ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool isTopLevel) } if (vacstmt->is_vacuumcmd) - params.options.VACOPT_VACUUM = true; + params.options.vacuum = true; else - params.options.VACOPT_ANALYZE = true; + params.options.analyze = true; /* sanity checks on options */ - Assert(params.options.VACOPT_VACUUM || params.options.VACOPT_ANALYZE); - Assert(params.options.VACOPT_VACUUM || - !(params.options.VACOPT_FULL || params.options.VACOPT_FREEZE)); - Assert(!params.options.VACOPT_SKIPTOAST); + Assert(params.options.vacuum || params.options.analyze); + Assert(params.options.vacuum || + !(params.options.full || params.options.freeze)); + Assert(!params.options.skiptoast); - if (params.options.VACOPT_FULL && params.nworkers > 0) + if (params.options.full && params.nworkers > 0) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("VACUUM FULL cannot be performed in parallel"))); /* - * Make sure VACOPT_ANALYZE is specified if any column lists are present. + * Make sure analyze is specified if any column lists are present. */ - if (!params.options.VACOPT_ANALYZE) + if (!params.options.analyze) { ListCell *lc; @@ -215,7 +215,7 @@ ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool isTopLevel) * All freeze ages are zero if the FREEZE option is given; otherwise pass * them as -1 which means to use the default values. */ - if (params.options.VACOPT_FREEZE) + if (params.options.freeze) { params.freeze_min_age = 0; params.freeze_table_age = 0; @@ -271,7 +271,7 @@ vacuum(List *relations, VacuumParams *params, Assert(params != NULL); - stmttype = params->options.VACOPT_VACUUM ? "VACUUM" : "ANALYZE"; + stmttype = params->options.vacuum ? "VACUUM" : "ANALYZE"; /* * We cannot run VACUUM inside a user transaction block; if we were inside @@ -281,7 +281,7 @@ vacuum(List *relations, VacuumParams *params, * * ANALYZE (without VACUUM) can run either way. */ - if (params->options.VACOPT_VACUUM) + if (params->options.vacuum) { PreventInTransactionBlock(isTopLevel, stmttype); in_outer_xact = false; @@ -303,8 +303,8 @@ vacuum(List *relations, VacuumParams *params, /* * Sanity check DISABLE_PAGE_SKIPPING option. */ - if (params->options.VACOPT_FULL && - params->options.VACOPT_DISABLE_PAGE_SKIPPING) + if (params->options.full && + params->options.disable_page_skipping) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("VACUUM option DISABLE_PAGE_SKIPPING cannot be used with FULL"))); @@ -313,7 +313,7 @@ vacuum(List *relations, VacuumParams *params, * Send info about dead objects to the statistics collector, unless we are * in autovacuum --- autovacuum.c does this for itself. */ - if (params->options.VACOPT_VACUUM && !IsAutoVacuumWorkerProcess()) + if (params->options.vacuum && !IsAutoVacuumWorkerProcess()) pgstat_vacuum_stat(); /* @@ -378,11 +378,11 @@ vacuum(List *relations, VacuumParams *params, * transaction block, and also in an autovacuum worker, use own * transactions so we can release locks sooner. */ - if (params->options.VACOPT_VACUUM) + if (params->options.vacuum) use_own_xacts = true; else { - Assert(params->options.VACOPT_ANALYZE); + Assert(params->options.analyze); if (IsAutoVacuumWorkerProcess()) use_own_xacts = true; else if (in_outer_xact) @@ -435,13 +435,13 @@ vacuum(List *relations, VacuumParams *params, { VacuumRelation *vrel = lfirst_node(VacuumRelation, cur); - if (params->options.VACOPT_VACUUM) + if (params->options.vacuum) { if (!vacuum_rel(vrel->oid, vrel->relation, params)) continue; } - if (params->options.VACOPT_ANALYZE) + if (params->options.analyze) { /* * If using separate xacts, start one for analyze. Otherwise, @@ -495,7 +495,7 @@ vacuum(List *relations, VacuumParams *params, StartTransactionCommand(); } - if (params->options.VACOPT_VACUUM && !IsAutoVacuumWorkerProcess()) + if (params->options.vacuum && !IsAutoVacuumWorkerProcess()) { /* * Update pg_database.datfrozenxid, and truncate pg_xact if possible. @@ -525,7 +525,7 @@ vacuum_is_relation_owner(Oid relid, Form_pg_class reltuple, VacuumOption *option { char *relname; - Assert(options->VACOPT_VACUUM || options->VACOPT_ANALYZE); + Assert(options->vacuum || options->analyze); /* * Check permissions. @@ -544,7 +544,7 @@ vacuum_is_relation_owner(Oid relid, Form_pg_class reltuple, VacuumOption *option relname = NameStr(reltuple->relname); - if (options->VACOPT_VACUUM) + if (options->vacuum) { if (reltuple->relisshared) ereport(WARNING, @@ -567,7 +567,7 @@ vacuum_is_relation_owner(Oid relid, Form_pg_class reltuple, VacuumOption *option return false; } - if (options->VACOPT_ANALYZE) + if (options->analyze) { if (reltuple->relisshared) ereport(WARNING, @@ -602,7 +602,7 @@ vacuum_open_relation(Oid relid, RangeVar *relation, VacuumOption *options, bool rel_lock = true; int elevel; - Assert(options->VACOPT_VACUUM || options->VACOPT_ANALYZE); + Assert(options->vacuum || options->analyze); /* * Open the relation and get the appropriate lock on it. @@ -613,7 +613,7 @@ vacuum_open_relation(Oid relid, RangeVar *relation, VacuumOption *options, * If we've been asked not to wait for the relation lock, acquire it first * in non-blocking mode, before calling try_relation_open(). */ - if (!options->VACOPT_SKIP_LOCKED) + if (!options->skip_locked) onerel = try_relation_open(relid, lmode); else if (ConditionalLockRelationOid(relid, lmode)) onerel = try_relation_open(relid, NoLock); @@ -653,7 +653,7 @@ vacuum_open_relation(Oid relid, RangeVar *relation, VacuumOption *options, else return NULL; - if (options->VACOPT_VACUUM) + if (options->vacuum) { if (!rel_lock) ereport(elevel, @@ -674,7 +674,7 @@ vacuum_open_relation(Oid relid, RangeVar *relation, VacuumOption *options, return NULL; } - if (options->VACOPT_ANALYZE) + if (options->analyze) { if (!rel_lock) ereport(elevel, @@ -739,7 +739,7 @@ expand_vacuum_rel(VacuumRelation *vrel, VacuumOption *options) * below, as well as find_all_inheritors's expectation that the caller * holds some lock on the starting relation. */ - rvr_opts = (options->VACOPT_SKIP_LOCKED) ? RVR_SKIP_LOCKED : 0; + rvr_opts = (options->skip_locked) ? RVR_SKIP_LOCKED : 0; relid = RangeVarGetRelidExtended(vrel->relation, AccessShareLock, rvr_opts, @@ -751,7 +751,7 @@ expand_vacuum_rel(VacuumRelation *vrel, VacuumOption *options) */ if (!OidIsValid(relid)) { - if (options->VACOPT_VACUUM) + if (options->vacuum) ereport(WARNING, (errcode(ERRCODE_LOCK_NOT_AVAILABLE), errmsg("skipping vacuum of \"%s\" --- lock not available", @@ -1720,7 +1720,7 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams *params) /* Begin a transaction for vacuuming this relation */ StartTransactionCommand(); - if (!params->options.VACOPT_FULL) + if (!params->options.full) { /* * In lazy vacuum, we can set the PROC_IN_VACUUM flag, which lets @@ -1770,7 +1770,7 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams *params) * vacuum, but just ShareUpdateExclusiveLock for concurrent vacuum. Either * way, we can be sure that no other backend is vacuuming the same table. */ - lmode = (params->options.VACOPT_FULL) ? + lmode = (params->options.full) ? AccessExclusiveLock : ShareUpdateExclusiveLock; /* open the relation and get the appropriate lock on it */ @@ -1794,7 +1794,7 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams *params) * case. */ newoptions = params->options; - newoptions.VACOPT_ANALYZE = false; + newoptions.analyze = false; if (!vacuum_is_relation_owner(RelationGetRelid(onerel), onerel->rd_rel, &newoptions)) @@ -1889,7 +1889,7 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams *params) * us to process it. In VACUUM FULL, though, the toast table is * automatically rebuilt by cluster_rel so we shouldn't recurse to it. */ - if (!params->options.VACOPT_SKIPTOAST && !params->options.VACOPT_FULL) + if (!params->options.skiptoast && !params->options.full) toast_relid = onerel->rd_rel->reltoastrelid; else toast_relid = InvalidOid; @@ -1908,10 +1908,10 @@ vacuum_rel(Oid relid, RangeVar *relation, VacuumParams *params) /* * Do the actual work --- either FULL or "lazy" vacuum */ - if (params->options.VACOPT_FULL) + if (params->options.full) { ClusterOption cluster_options = { - .CLUOPT_VERBOSE = params->options.VACOPT_VERBOSE, + .verbose = params->options.verbose, /* Other members initialized to false/0/NULL */ }; diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index a1599ccb77..ba742e4c6e 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -2505,7 +2505,7 @@ do_autovacuum(void) * next table in our list. */ HOLD_INTERRUPTS(); - if (tab->at_params.options.VACOPT_VACUUM) + if (tab->at_params.options.vacuum) errcontext("automatic vacuum of table \"%s.%s.%s\"", tab->at_datname, tab->at_nspname, tab->at_relname); else @@ -2919,10 +2919,10 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map, tab = palloc(sizeof(autovac_table)); tab->at_relid = relid; tab->at_sharedrel = classForm->relisshared; - tab->at_params.options.VACOPT_SKIPTOAST = true; - tab->at_params.options.VACOPT_VACUUM = dovacuum; - tab->at_params.options.VACOPT_ANALYZE = doanalyze; - tab->at_params.options.VACOPT_SKIP_LOCKED = !wraparound; + tab->at_params.options.skiptoast = true; + tab->at_params.options.vacuum = dovacuum; + tab->at_params.options.analyze = doanalyze; + tab->at_params.options.skip_locked = !wraparound; tab->at_params.index_cleanup = VACOPT_TERNARY_DEFAULT; tab->at_params.truncate = VACOPT_TERNARY_DEFAULT; /* As of now, we don't support parallel vacuum for autovacuum */ @@ -3250,10 +3250,10 @@ autovac_report_activity(autovac_table *tab) int len; /* Report the command and possible options */ - if (tab->at_params.options.VACOPT_VACUUM) + if (tab->at_params.options.vacuum) snprintf(activity, MAX_AUTOVAC_ACTIV_LEN, "autovacuum: VACUUM%s", - tab->at_params.options.VACOPT_ANALYZE ? " ANALYZE" : ""); + tab->at_params.options.analyze ? " ANALYZE" : ""); else snprintf(activity, MAX_AUTOVAC_ACTIV_LEN, "autovacuum: ANALYZE"); diff --git a/src/backend/tcop/utility.c b/src/backend/tcop/utility.c index 23612b7a90..a6c42ee599 100644 --- a/src/backend/tcop/utility.c +++ b/src/backend/tcop/utility.c @@ -922,7 +922,7 @@ standard_ProcessUtility(PlannedStmt *pstmt, ReindexOptions options; options = ReindexParseOptions(pstate, stmt); - if (options.REINDEXOPT_CONCURRENTLY) + if (options.concurrently) PreventInTransactionBlock(isTopLevel, "REINDEX CONCURRENTLY"); diff --git a/src/include/catalog/index.h b/src/include/catalog/index.h index 3a8671f558..d7e7e0dd24 100644 --- a/src/include/catalog/index.h +++ b/src/include/catalog/index.h @@ -32,10 +32,10 @@ typedef enum /* options for REINDEX */ typedef struct ReindexOptions { - bool REINDEXOPT_VERBOSE; /* print progress info */ - bool REINDEXOPT_REPORT_PROGRESS; /* report pgstat progress */ - bool REINDEXOPT_MISSING_OK; /* skip missing relations */ - bool REINDEXOPT_CONCURRENTLY; /* concurrent mode */ + bool verbose; /* print progress info */ + bool report_progress; /* report pgstat progress */ + bool missing_ok; /* skip missing relations */ + bool concurrently; /* concurrent mode */ } ReindexOptions; /* state info for validate_index bulkdelete callback */ diff --git a/src/include/commands/cluster.h b/src/include/commands/cluster.h index 5111941a41..2c20c76734 100644 --- a/src/include/commands/cluster.h +++ b/src/include/commands/cluster.h @@ -22,8 +22,8 @@ /* options for CLUSTER */ typedef struct ClusterOption { - bool CLUOPT_RECHECK; /* recheck relation state */ - bool CLUOPT_VERBOSE; /* print progress info */ + bool recheck; /* recheck relation state */ + bool verbose; /* print progress info */ } ClusterOption; extern void cluster(ParseState *pstate, ClusterStmt *stmt, bool isTopLevel); diff --git a/src/include/commands/vacuum.h b/src/include/commands/vacuum.h index 15327643ba..bfbbc932ab 100644 --- a/src/include/commands/vacuum.h +++ b/src/include/commands/vacuum.h @@ -176,14 +176,14 @@ typedef struct VacAttrStats typedef struct VacuumOption { - bool VACOPT_VACUUM; /* do VACUUM */ - bool VACOPT_ANALYZE; /* do ANALYZE */ - bool VACOPT_VERBOSE; /* print progress info */ - bool VACOPT_FREEZE; /* FREEZE option */ - bool VACOPT_FULL; /* FULL (non-concurrent) vacuum */ - bool VACOPT_SKIP_LOCKED; /* skip if cannot get lock */ - bool VACOPT_SKIPTOAST; /* don't process the TOAST table, if any */ - bool VACOPT_DISABLE_PAGE_SKIPPING; /* don't skip any pages */ + bool vacuum; /* do VACUUM */ + bool analyze; /* do ANALYZE */ + bool verbose; /* print progress info */ + bool freeze; /* FREEZE option */ + bool full; /* FULL (non-concurrent) vacuum */ + bool skip_locked; /* skip if cannot get lock */ + bool skiptoast; /* don't process the TOAST table, if any */ + bool disable_page_skipping; /* don't skip any pages */ } VacuumOption; /* -- 2.17.0