Skip to content

Commit edc6b41

Browse files
committed
Rename VACOPT_NOWAIT to VACOPT_SKIP_LOCKED
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
1 parent 6551f3d commit edc6b41

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

src/backend/commands/analyze.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ analyze_rel(Oid relid, RangeVar *relation, int options,
143143
* matter if we ever try to accumulate stats on dead tuples.) If the rel
144144
* has been dropped since we last saw it, we don't need to process it.
145145
*/
146-
if (!(options & VACOPT_NOWAIT))
146+
if (!(options & VACOPT_SKIP_LOCKED))
147147
onerel = try_relation_open(relid, ShareUpdateExclusiveLock);
148148
else if (ConditionalLockRelationOid(relid, ShareUpdateExclusiveLock))
149149
onerel = try_relation_open(relid, NoLock);

src/backend/commands/vacuum.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1377,7 +1377,7 @@ vacuum_rel(Oid relid, RangeVar *relation, int options, VacuumParams *params)
13771377
* If we've been asked not to wait for the relation lock, acquire it first
13781378
* in non-blocking mode, before calling try_relation_open().
13791379
*/
1380-
if (!(options & VACOPT_NOWAIT))
1380+
if (!(options & VACOPT_SKIP_LOCKED))
13811381
onerel = try_relation_open(relid, lmode);
13821382
else if (ConditionalLockRelationOid(relid, lmode))
13831383
onerel = try_relation_open(relid, NoLock);

src/backend/postmaster/autovacuum.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2904,7 +2904,7 @@ table_recheck_autovac(Oid relid, HTAB *table_toast_map,
29042904
tab->at_vacoptions = VACOPT_SKIPTOAST |
29052905
(dovacuum ? VACOPT_VACUUM : 0) |
29062906
(doanalyze ? VACOPT_ANALYZE : 0) |
2907-
(!wraparound ? VACOPT_NOWAIT : 0);
2907+
(!wraparound ? VACOPT_SKIP_LOCKED : 0);
29082908
tab->at_params.freeze_min_age = freeze_min_age;
29092909
tab->at_params.freeze_table_age = freeze_table_age;
29102910
tab->at_params.multixact_freeze_min_age = multixact_freeze_min_age;

src/include/nodes/parsenodes.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3135,7 +3135,8 @@ typedef enum VacuumOption
31353135
VACOPT_VERBOSE = 1 << 2, /* print progress info */
31363136
VACOPT_FREEZE = 1 << 3, /* FREEZE option */
31373137
VACOPT_FULL = 1 << 4, /* FULL (non-concurrent) vacuum */
3138-
VACOPT_NOWAIT = 1 << 5, /* don't wait to get lock (autovacuum only) */
3138+
VACOPT_SKIP_LOCKED = 1 << 5, /* skip if cannot get lock (autovacuum
3139+
* only) */
31393140
VACOPT_SKIPTOAST = 1 << 6, /* don't process the TOAST table, if any */
31403141
VACOPT_DISABLE_PAGE_SKIPPING = 1 << 7 /* don't skip any pages */
31413142
} VacuumOption;

0 commit comments

Comments
 (0)