]> granicus.if.org Git - postgresql/commitdiff
Rename VACOPT_NOWAIT to VACOPT_SKIP_LOCKED
authorMichael Paquier <michael@paquier.xyz>
Thu, 12 Jul 2018 05:28:28 +0000 (14:28 +0900)
committerMichael Paquier <michael@paquier.xyz>
Thu, 12 Jul 2018 05:28:28 +0000 (14:28 +0900)
When it comes to SELECT ... FOR or LOCK, NOWAIT means to not wait for
something to happen, and issue an error.  SKIP LOCKED means to not wait
for something to happen but to move on without issuing an error.  The
internal option of autovacuum and autoanalyze mentioned above, used only
when wraparound is not involved was named NOWAIT, but behaves like SKIP
LOCKED which is confusing.

Author: Nathan Bossart
Discussion: https://postgr.es/m/20180307050345.GA3095@paquier.xyz

src/backend/commands/analyze.c
src/backend/commands/vacuum.c
src/backend/postmaster/autovacuum.c
src/include/nodes/parsenodes.h

index 25194e871c00710b55508583d02e0fbc3165bb67..3e148f03d0e5a334f94b8d9e1afd3abae5b2a416 100644 (file)
@@ -143,7 +143,7 @@ analyze_rel(Oid relid, RangeVar *relation, int options,
         * matter if we ever try to accumulate stats on dead tuples.) If the rel
         * has been dropped since we last saw it, we don't need to process it.
         */
-       if (!(options & VACOPT_NOWAIT))
+       if (!(options & VACOPT_SKIP_LOCKED))
                onerel = try_relation_open(relid, ShareUpdateExclusiveLock);
        else if (ConditionalLockRelationOid(relid, ShareUpdateExclusiveLock))
                onerel = try_relation_open(relid, NoLock);
index e16d8ef212ae57432b5de502aadc0eda51ae52ff..bd0f04c7e24e14779928a8bad0a1377b75768902 100644 (file)
@@ -1377,7 +1377,7 @@ vacuum_rel(Oid relid, RangeVar *relation, int options, VacuumParams *params)
         * 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_NOWAIT))
+       if (!(options & VACOPT_SKIP_LOCKED))
                onerel = try_relation_open(relid, lmode);
        else if (ConditionalLockRelationOid(relid, lmode))
                onerel = try_relation_open(relid, NoLock);
index 02e6d8131e09882b3916ca067bb890afa2f4a900..78e4c85f5d78f4e5200ad41bde81b025d9cc1aff 100644 (file)
@@ -2904,7 +2904,7 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
                tab->at_vacoptions = VACOPT_SKIPTOAST |
                        (dovacuum ? VACOPT_VACUUM : 0) |
                        (doanalyze ? VACOPT_ANALYZE : 0) |
-                       (!wraparound ? VACOPT_NOWAIT : 0);
+                       (!wraparound ? VACOPT_SKIP_LOCKED : 0);
                tab->at_params.freeze_min_age = freeze_min_age;
                tab->at_params.freeze_table_age = freeze_table_age;
                tab->at_params.multixact_freeze_min_age = multixact_freeze_min_age;
index 6390f7e8c129e84607e1bb3c56ddd8578115f298..2a2b17d5704bc5c4a2128e1aaa47cb8dba8d7eb1 100644 (file)
@@ -3135,7 +3135,8 @@ typedef enum VacuumOption
        VACOPT_VERBOSE = 1 << 2,        /* print progress info */
        VACOPT_FREEZE = 1 << 3,         /* FREEZE option */
        VACOPT_FULL = 1 << 4,           /* FULL (non-concurrent) vacuum */
-       VACOPT_NOWAIT = 1 << 5,         /* don't wait to get lock (autovacuum only) */
+       VACOPT_SKIP_LOCKED = 1 << 5,    /* skip if cannot get lock (autovacuum
+                                                                        * only) */
        VACOPT_SKIPTOAST = 1 << 6,      /* don't process the TOAST table, if any */
        VACOPT_DISABLE_PAGE_SKIPPING = 1 << 7   /* don't skip any pages */
 } VacuumOption;