[PATCH] Move user options to the end of the command in pg_upgrade
Hi,
when the environment variable POSTGRESQL_UPGRADE_PGUPGRADE_OPTIONS is
used to specify options for pg_upgrade, options related to
unix_socket_directory/ies are being overridden by hardcoded options,
making it difficult to upgrade in some usecases.
The attached patch changes the order of those options so that the
hardcoded ones are eventually overridden by the user specified
options.
As I can see that in PostgreSQL 12 this issue has been solved by
implementing the -socketdir argument, my questions would be as
follows:
1) Could such change break something that I might have missed?
2) Would you be willing to accept this patch for versions prior to 12?
Thanks in advance.
--
Patrik Novotný
Associate Software Engineer
Red Hat
panovotn@redhat.com
Patrik Novotny <panovotn@redhat.com> writes:
when the environment variable POSTGRESQL_UPGRADE_PGUPGRADE_OPTIONS is
used to specify options for pg_upgrade, options related to
unix_socket_directory/ies are being overridden by hardcoded options,
making it difficult to upgrade in some usecases.
The attached patch changes the order of those options so that the
hardcoded ones are eventually overridden by the user specified
options.
Hi Patrik,
It looks like you forgot to attach the patch? But in any case,
I see no references to POSTGRESQL_UPGRADE_PGUPGRADE_OPTIONS in
any community Postgres code, so I'm wondering if this is just
changing some script that Red Hat supplies as part of packaging.
That would make it not our concern, really.
regards, tom lane
Hi Tom,
thanks for you reply. You're right, and I apologise for the confusion.
Options I was talking about are specified via the `--old-options`
parameter of the pg_upgrade (ex.: --old-options '-c
unix_socket_directories=/run')
Mentioning of the environment variable came only from my own
confusion. I also attached the mentioned patch.
Regards,
On Tue, Sep 10, 2019 at 4:13 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Patrik Novotny <panovotn@redhat.com> writes:
when the environment variable POSTGRESQL_UPGRADE_PGUPGRADE_OPTIONS is
used to specify options for pg_upgrade, options related to
unix_socket_directory/ies are being overridden by hardcoded options,
making it difficult to upgrade in some usecases.The attached patch changes the order of those options so that the
hardcoded ones are eventually overridden by the user specified
options.Hi Patrik,
It looks like you forgot to attach the patch? But in any case,
I see no references to POSTGRESQL_UPGRADE_PGUPGRADE_OPTIONS in
any community Postgres code, so I'm wondering if this is just
changing some script that Red Hat supplies as part of packaging.
That would make it not our concern, really.regards, tom lane
--
Patrik Novotný
Associate Software Engineer
Red Hat
panovotn@redhat.com
Attachments:
postgresql-user-options-order.patchtext/x-patch; charset=US-ASCII; name=postgresql-user-options-order.patchDownload
From b34018a51f811b680d602ae65014dadfe8992f4c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Patrik=20Novotn=C3=BD?= <panovotn@redhat.com>
Date: Tue, 27 Aug 2019 14:13:00 +0200
Subject: [PATCH] Move user options to the end of the command
---
src/bin/pg_upgrade/server.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bin/pg_upgrade/server.c b/src/bin/pg_upgrade/server.c
index 5563a5020b..6cb80d5fc7 100644
--- a/src/bin/pg_upgrade/server.c
+++ b/src/bin/pg_upgrade/server.c
@@ -249,7 +249,7 @@ start_postmaster(ClusterInfo *cluster, bool report_and_exit_on_error)
" -c autovacuum=off -c autovacuum_freeze_max_age=2000000000",
(cluster == &new_cluster) ?
" -c synchronous_commit=off -c fsync=off -c full_page_writes=off" : "",
- cluster->pgopts ? cluster->pgopts : "", socket_string);
+ socket_string, cluster->pgopts ? cluster->pgopts : "");
/*
* Don't throw an error right away, let connecting throw the error because
--
2.21.0
Patrik Novotny <panovotn@redhat.com> writes:
thanks for you reply. You're right, and I apologise for the confusion.
Options I was talking about are specified via the `--old-options`
parameter of the pg_upgrade (ex.: --old-options '-c
unix_socket_directories=/run')
Mentioning of the environment variable came only from my own
confusion. I also attached the mentioned patch.
Ah, now I see what you're on about. I agree that this is a good
change ... and we probably should add a comment reminding people
to keep the user options at the end, because somebody[1]... me, in fact broke this
through add-at-the-end syndrome.
regards, tom lane
[1]: ... me, in fact
I wrote:
Patrik Novotny <panovotn@redhat.com> writes:
thanks for you reply. You're right, and I apologise for the confusion.
Options I was talking about are specified via the `--old-options`
parameter of the pg_upgrade (ex.: --old-options '-c
unix_socket_directories=/run')
Mentioning of the environment variable came only from my own
confusion. I also attached the mentioned patch.
Ah, now I see what you're on about. I agree that this is a good
change ... and we probably should add a comment reminding people
to keep the user options at the end, because somebody[1] broke this
through add-at-the-end syndrome.
Actually ... now that I look more carefully, I'm not sure this change
would improve matters. You can't just reach in and select a different
socket directory behind pg_upgrade's back; if you try, the connection
attempts later are going to fail, because pg_upgrade will be telling
pg_dump to use what it thinks the socket directory is.
You might be better off back-patching the addition of the --socketdir
option (commit 2d34ad84303181111c6f0747186857ff50106267).
regards, tom lane