v3-0002-switch-from-passing-conn-to-passing-slot.patch

text/x-patch

Filename: v3-0002-switch-from-passing-conn-to-passing-slot.patch
Type: text/x-patch
Part: 1
Message: Re: vacuumdb: add --dry-run

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch v3-0002
Subject: switch from passing conn to passing slot
File+
src/bin/scripts/vacuuming.c 6 5
From 8ce09dd5c83191827f2faa874edd12610c6852e1 Mon Sep 17 00:00:00 2001
From: Corey Huinker <corey.huinker@gmail.com>
Date: Wed, 19 Nov 2025 19:13:45 -0500
Subject: [PATCH v3 2/5] switch from passing conn to passing slot

---
 src/bin/scripts/vacuuming.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/bin/scripts/vacuuming.c b/src/bin/scripts/vacuuming.c
index 5d9c07f8715..f1fa565679c 100644
--- a/src/bin/scripts/vacuuming.c
+++ b/src/bin/scripts/vacuuming.c
@@ -43,8 +43,8 @@ static SimpleStringList *retrieve_objects(PGconn *conn,
 static void free_retrieved_objects(SimpleStringList *list);
 static void prepare_vacuum_command(PGconn *conn, PQExpBuffer sql,
 								   vacuumingOptions *vacopts, const char *table);
-static void run_vacuum_command(PGconn *conn, const char *sql, bool echo,
-							   const char *table);
+static void run_vacuum_command(ParallelSlot *free_slot, const char *sql,
+							   bool echo, const char *table);
 
 /*
  * Executes vacuum/analyze as indicated.  Returns 0 if the plan is carried
@@ -394,7 +394,7 @@ vacuum_one_database(ConnParams *cparams,
 			 * through ParallelSlotsGetIdle.
 			 */
 			ParallelSlotSetHandler(free_slot, TableCommandResultHandler, NULL);
-			run_vacuum_command(free_slot->connection, sql.data,
+			run_vacuum_command(free_slot, sql.data,
 							   echo, tabname);
 		}
 
@@ -427,7 +427,7 @@ vacuum_one_database(ConnParams *cparams,
 		else
 		{
 			ParallelSlotSetHandler(free_slot, TableCommandResultHandler, NULL);
-			run_vacuum_command(free_slot->connection, cmd, echo, NULL);
+			run_vacuum_command(free_slot, cmd, echo, NULL);
 
 			if (!ParallelSlotsWaitCompletion(sa))
 				ret = EXIT_FAILURE; /* error already reported by handler */
@@ -1021,10 +1021,11 @@ prepare_vacuum_command(PGconn *conn, PQExpBuffer sql,
  * Any errors during command execution are reported to stderr.
  */
 static void
-run_vacuum_command(PGconn *conn, const char *sql, bool echo,
+run_vacuum_command(ParallelSlot *free_slot, const char *sql, bool echo,
 				   const char *table)
 {
 	bool		status;
+	PGconn	   *conn = free_slot->connection;
 
 	if (echo)
 		printf("%s\n", sql);
-- 
2.51.1