Skip to content

Commit 5fde047

Browse files
committed
Combine two flag tests in GetSnapshotData().
Previously the code checked PROC_IN_LOGICAL_DECODING and PROC_IN_VACUUM separately. As the relevant variable is marked as volatile, the compiler cannot combine the two tests. As GetSnapshotData() is pretty hot in a number of workloads, it's worthwhile to fix that. It'd also be a good idea to get rid of the volatiles altogether. But for one that's a larger patch, and for another, the code after this change still seems at least as easy to read as before. Author: Andres Freund Discussion: https://postgr.es/m/20181005172955.wyjb4fzcdzqtaxjq@alap3.anarazel.de
1 parent 5fc1670 commit 5fde047

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/backend/storage/ipc/procarray.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,14 +1589,11 @@ GetSnapshotData(Snapshot snapshot)
15891589
TransactionId xid;
15901590

15911591
/*
1592-
* Backend is doing logical decoding which manages xmin
1593-
* separately, check below.
1592+
* Skip over backends doing logical decoding which manages xmin
1593+
* separately (check below) and ones running LAZY VACUUM.
15941594
*/
1595-
if (pgxact->vacuumFlags & PROC_IN_LOGICAL_DECODING)
1596-
continue;
1597-
1598-
/* Ignore procs running LAZY VACUUM */
1599-
if (pgxact->vacuumFlags & PROC_IN_VACUUM)
1595+
if (pgxact->vacuumFlags &
1596+
(PROC_IN_LOGICAL_DECODING | PROC_IN_VACUUM))
16001597
continue;
16011598

16021599
/* Update globalxmin to be the smallest valid xmin */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy