0001-ignore-CIC-in-VACUUM.patch

application/x-patch

Filename: 0001-ignore-CIC-in-VACUUM.patch
Type: application/x-patch
Part: 0
Message: Patch: VACUUM should ignore (CREATE |RE)INDEX CONCURRENTLY for xmin horizon calculations
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index 200f72c6e25..2e321219e8d 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -1775,8 +1775,12 @@ ComputeXidHorizons(ComputeXidHorizonsResult *h)
 		 * Skip over backends either vacuuming (which is ok with rows being
 		 * removed, as long as pg_subtrans is not truncated) or doing logical
 		 * decoding (which manages xmin separately, check below).
+		 * Also skip over backends doing (RE)INDEX CONCURRENTLY on plain 
+		 * indexes as these also can not affect vacuum on other tables and 
+		 * we don't want long indexing operations to hold back vacuum cleanup
 		 */
-		if (statusFlags & (PROC_IN_VACUUM | PROC_IN_LOGICAL_DECODING))
+		if (statusFlags & (PROC_IN_VACUUM | PROC_IN_LOGICAL_DECODING
+										  | PROC_IN_SAFE_IC))
 			continue;
 
 		/* shared tables need to take backends in all databases into account */