diff options
author | Michael Paquier <michael@paquier.xyz> | 2019-07-19 09:31:58 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2019-07-19 09:31:58 +0900 |
commit | 5f3840370b63fdf17f704a285623ccc233fa8d4f (patch) | |
tree | 194f7e1322dc8fb871b853e516a13e12e96a81de /src/bin/scripts/common.h | |
parent | b538c90b1bded5464787e2b8e4431302d24eb601 (diff) | |
download | postgresql-5f3840370b63fdf17f704a285623ccc233fa8d4f.tar.gz postgresql-5f3840370b63fdf17f704a285623ccc233fa8d4f.zip |
Refactor parallelization processing code in src/bin/scripts/
The existing facility of vacuumdb to handle parallel connections into a
given database with an authentication set is moved to a common file in
src/bin/scripts/, named scripts_parallel.c. This introduces a set of
routines to initialize, wait and terminate a set of connections,
simplifying a bit the code of vacuumdb on the way. More routines
related to result handling and database connection are moved to
common.c.
The initial plan is to use that for reindexdb, but it could be applied
to other tools like clusterdb.
While on it, clean up a set of variables "progname" which were defined
as routine arguments for error messages. Since most of the callers have
switched to pg_log_error() and such there is no need for this variable.
Author: Julien Rouhaud
Reviewed-by: Michael Paquier, Álvaro Herrera
Discussion: https://postgr.es/m/CAOBaU_YrnH_Jqo46NhaJ7uRBiWWEcS40VNRQxgFbqYo9kApUsg@mail.gmail.com
Diffstat (limited to 'src/bin/scripts/common.h')
-rw-r--r-- | src/bin/scripts/common.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/bin/scripts/common.h b/src/bin/scripts/common.h index 35d1a3e0d51..f36b26a5765 100644 --- a/src/bin/scripts/common.h +++ b/src/bin/scripts/common.h @@ -39,20 +39,24 @@ extern PGconn *connectMaintenanceDatabase(const char *maintenance_db, const char *pguser, enum trivalue prompt_password, const char *progname, bool echo); -extern PGresult *executeQuery(PGconn *conn, const char *query, - const char *progname, bool echo); +extern void disconnectDatabase(PGconn *conn); -extern void executeCommand(PGconn *conn, const char *query, - const char *progname, bool echo); +extern PGresult *executeQuery(PGconn *conn, const char *query, bool echo); + +extern void executeCommand(PGconn *conn, const char *query, bool echo); extern bool executeMaintenanceCommand(PGconn *conn, const char *query, bool echo); +extern bool consumeQueryResult(PGconn *conn); + +extern bool processQueryResult(PGconn *conn, PGresult *result); + extern void splitTableColumnsSpec(const char *spec, int encoding, char **table, const char **columns); extern void appendQualifiedRelation(PQExpBuffer buf, const char *name, - PGconn *conn, const char *progname, bool echo); + PGconn *conn, bool echo); extern bool yesno_prompt(const char *question); |