Skip to content

Commit cea3d55

Browse files
committed
Remove PROC_IN_ANALYZE and derived flags
These flags are unused and always have been. Discussion: https://postgr.es/m/20200805235549.GA8118@alvherre.pgsql
1 parent 6f0b632 commit cea3d55

File tree

3 files changed

+2
-21
lines changed

3 files changed

+2
-21
lines changed

src/backend/commands/analyze.c

+1-12
Original file line numberDiff line numberDiff line change
@@ -247,11 +247,8 @@ analyze_rel(Oid relid, RangeVar *relation,
247247
}
248248

249249
/*
250-
* OK, let's do it. First let other backends know I'm in ANALYZE.
250+
* OK, let's do it. First, initialize progress reporting.
251251
*/
252-
LWLockAcquire(ProcArrayLock, LW_EXCLUSIVE);
253-
MyPgXact->vacuumFlags |= PROC_IN_ANALYZE;
254-
LWLockRelease(ProcArrayLock);
255252
pgstat_progress_start_command(PROGRESS_COMMAND_ANALYZE,
256253
RelationGetRelid(onerel));
257254

@@ -279,14 +276,6 @@ analyze_rel(Oid relid, RangeVar *relation,
279276
relation_close(onerel, NoLock);
280277

281278
pgstat_progress_end_command();
282-
283-
/*
284-
* Reset my PGXACT flag. Note: we need this here, and not in vacuum_rel,
285-
* because the vacuum flag is cleared by the end-of-xact code.
286-
*/
287-
LWLockAcquire(ProcArrayLock, LW_EXCLUSIVE);
288-
MyPgXact->vacuumFlags &= ~PROC_IN_ANALYZE;
289-
LWLockRelease(ProcArrayLock);
290279
}
291280

292281
/*

src/include/storage/proc.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,14 @@ struct XidCache
5252
*/
5353
#define PROC_IS_AUTOVACUUM 0x01 /* is it an autovac worker? */
5454
#define PROC_IN_VACUUM 0x02 /* currently running lazy vacuum */
55-
#define PROC_IN_ANALYZE 0x04 /* currently running analyze */
5655
#define PROC_VACUUM_FOR_WRAPAROUND 0x08 /* set by autovac only */
5756
#define PROC_IN_LOGICAL_DECODING 0x10 /* currently doing logical
5857
* decoding outside xact */
5958
#define PROC_RESERVED 0x20 /* reserved for procarray */
6059

6160
/* flags reset at EOXact */
6261
#define PROC_VACUUM_STATE_MASK \
63-
(PROC_IN_VACUUM | PROC_IN_ANALYZE | PROC_VACUUM_FOR_WRAPAROUND)
62+
(PROC_IN_VACUUM | PROC_VACUUM_FOR_WRAPAROUND)
6463

6564
/*
6665
* We allow a small number of "weak" relation locks (AccessShareLock,

src/include/storage/procarray.h

-7
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
*/
3030
#define PROCARRAY_VACUUM_FLAG 0x02 /* currently running lazy
3131
* vacuum */
32-
#define PROCARRAY_ANALYZE_FLAG 0x04 /* currently running
33-
* analyze */
3432
#define PROCARRAY_LOGICAL_DECODING_FLAG 0x10 /* currently doing logical
3533
* decoding outside xact */
3634

@@ -42,18 +40,13 @@
4240
* have no corresponding PROC flag equivalent.
4341
*/
4442
#define PROCARRAY_PROC_FLAGS_MASK (PROCARRAY_VACUUM_FLAG | \
45-
PROCARRAY_ANALYZE_FLAG | \
4643
PROCARRAY_LOGICAL_DECODING_FLAG)
4744

4845
/* Use the following flags as an input "flags" to GetOldestXmin function */
4946
/* Consider all backends except for logical decoding ones which manage xmin separately */
5047
#define PROCARRAY_FLAGS_DEFAULT PROCARRAY_LOGICAL_DECODING_FLAG
5148
/* Ignore vacuum backends */
5249
#define PROCARRAY_FLAGS_VACUUM PROCARRAY_FLAGS_DEFAULT | PROCARRAY_VACUUM_FLAG
53-
/* Ignore analyze backends */
54-
#define PROCARRAY_FLAGS_ANALYZE PROCARRAY_FLAGS_DEFAULT | PROCARRAY_ANALYZE_FLAG
55-
/* Ignore both vacuum and analyze backends */
56-
#define PROCARRAY_FLAGS_VACUUM_ANALYZE PROCARRAY_FLAGS_DEFAULT | PROCARRAY_VACUUM_FLAG | PROCARRAY_ANALYZE_FLAG
5750

5851
extern Size ProcArrayShmemSize(void);
5952
extern void CreateSharedProcArray(void);

0 commit comments

Comments
 (0)