pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: Justin Pryzby <pryzby@telsasoft.com>
Cc: Hubert Zhang <zhubert@vmware.com>
Cc: tsunakawa.takay@fujitsu.com, pgsql-hackers@postgresql.org, Andreas Seltenreich <seltenreich@gmx.de>
Cc: Bruce Momjian <bruce@momjian.us>
Subject: Re: Multiple hosts in connection string failed to failover in non-hot standby mode
Date: Sun, 06 Jun 2021 17:27:49 -0400
Message-ID: <744012.1623014869@sss.pgh.pa.us> (raw )
In-Reply-To: <YLXjFOV3teAPirmS@paquier.xyz >
References: <20210506162651.GJ27406@telsasoft.com >
<4170264.1620321747@sss.pgh.pa.us >
<20210531012500.GP2082@telsasoft.com >
<YLRDV0MqQnGRIo4c@paquier.xyz >
<YLRZH6CWs9N6Pusy@paquier.xyz >
<2522602.1622433912@sss.pgh.pa.us >
<YLSCrAPVfxX3X8ap@paquier.xyz >
<2566986.1622468180@sss.pgh.pa.us >
<YLWFzzrUIy9Q8h1d@paquier.xyz >
<2732890.1622509658@sss.pgh.pa.us >
<YLXjFOV3teAPirmS@paquier.xyz >
It seems like nobody's terribly interested in figuring out why
pg_GSS_have_cred_cache() is misbehaving on Windows. So I took
a look at disabling GSSENC in these test cases to try to silence
hamerkop 's test failure that way. Here's a proposed patch.
It relies on setenv() being available, but I think that's fine
because we link the ECPG test programs with libpgport.
regards, tom lane
Attachments:
disable-GSS-in-ECPG-test.patch (text/x-diff, 9.7K) download
diff --git a/src/interfaces/ecpg/test/connect/test5.pgc b/src/interfaces/ecpg/test/connect/test5.pgc
index e712fa8778..f7263935ce 100644
--- a/src/interfaces/ecpg/test/connect/test5.pgc
+++ b/src/interfaces/ecpg/test/connect/test5.pgc
@@ -18,6 +18,9 @@ exec sql begin declare section;
char *user="regress_ecpg_user1";
exec sql end declare section;
+ /* disable GSSENC to ensure stability of connection failure reports */
+ setenv("PGGSSENCMODE", "disable", 1);
+
ECPGdebug(1, stderr);
exec sql connect to ecpg2_regression as main;
diff --git a/src/interfaces/ecpg/test/expected/connect-test5.c b/src/interfaces/ecpg/test/expected/connect-test5.c
index 6ae5b589de..a86a5e4331 100644
--- a/src/interfaces/ecpg/test/expected/connect-test5.c
+++ b/src/interfaces/ecpg/test/expected/connect-test5.c
@@ -38,37 +38,33 @@ main(void)
#line 19 "test5.pgc"
+ /* disable GSSENC to ensure stability of connection failure reports */
+ setenv("PGGSSENCMODE", "disable", 1);
+
ECPGdebug(1, stderr);
{ ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , "main", 0); }
-#line 23 "test5.pgc"
+#line 26 "test5.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "alter user regress_ecpg_user2 encrypted password 'insecure'", ECPGt_EOIT, ECPGt_EORT);}
-#line 24 "test5.pgc"
+#line 27 "test5.pgc"
{ ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "alter user regress_ecpg_user1 encrypted password 'connectpw'", ECPGt_EOIT, ECPGt_EORT);}
-#line 25 "test5.pgc"
+#line 28 "test5.pgc"
{ ECPGtrans(__LINE__, NULL, "commit");}
-#line 26 "test5.pgc"
+#line 29 "test5.pgc"
{ ECPGdisconnect(__LINE__, "CURRENT");}
-#line 27 "test5.pgc"
+#line 30 "test5.pgc"
/* <-- "main" not specified */
strcpy(db, "ecpg2_regression");
strcpy(id, "main");
{ ECPGconnect(__LINE__, 0, db , NULL, NULL , id, 0); }
-#line 31 "test5.pgc"
-
- { ECPGdisconnect(__LINE__, id);}
-#line 32 "test5.pgc"
-
-
- { ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , "main", 0); }
#line 34 "test5.pgc"
- { ECPGdisconnect(__LINE__, "main");}
+ { ECPGdisconnect(__LINE__, id);}
#line 35 "test5.pgc"
@@ -86,21 +82,21 @@ main(void)
#line 41 "test5.pgc"
- { ECPGconnect(__LINE__, 0, "" , "regress_ecpg_user2" , "insecure" , "main", 0); }
+ { ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , "main", 0); }
#line 43 "test5.pgc"
{ ECPGdisconnect(__LINE__, "main");}
#line 44 "test5.pgc"
- { ECPGconnect(__LINE__, 0, "ecpg2_regression" , "regress_ecpg_user1" , "connectpw" , "main", 0); }
+ { ECPGconnect(__LINE__, 0, "" , "regress_ecpg_user2" , "insecure" , "main", 0); }
#line 46 "test5.pgc"
{ ECPGdisconnect(__LINE__, "main");}
#line 47 "test5.pgc"
- { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/ecpg2_regression" , "regress_ecpg_user1" , "connectpw" , "main", 0); }
+ { ECPGconnect(__LINE__, 0, "ecpg2_regression" , "regress_ecpg_user1" , "connectpw" , "main", 0); }
#line 49 "test5.pgc"
{ ECPGdisconnect(__LINE__, "main");}
@@ -114,48 +110,55 @@ main(void)
#line 53 "test5.pgc"
- { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/ecpg2_regression" , user , "connectpw" , "main", 0); }
+ { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/ecpg2_regression" , "regress_ecpg_user1" , "connectpw" , "main", 0); }
#line 55 "test5.pgc"
{ ECPGdisconnect(__LINE__, "main");}
#line 56 "test5.pgc"
- { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/ecpg2_regression?connect_timeout=180 & client_encoding=latin1" , "regress_ecpg_user1" , "connectpw" , "main", 0); }
+ { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/ecpg2_regression" , user , "connectpw" , "main", 0); }
#line 58 "test5.pgc"
{ ECPGdisconnect(__LINE__, "main");}
#line 59 "test5.pgc"
- { ECPGconnect(__LINE__, 0, "unix:postgresql://200.46.204.71/ecpg2_regression" , "regress_ecpg_user1" , "connectpw" , "main", 0); }
+ { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/ecpg2_regression?connect_timeout=180 & client_encoding=latin1" , "regress_ecpg_user1" , "connectpw" , "main", 0); }
#line 61 "test5.pgc"
{ ECPGdisconnect(__LINE__, "main");}
#line 62 "test5.pgc"
- { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/" , "regress_ecpg_user2" , "insecure" , "main", 0); }
+ { ECPGconnect(__LINE__, 0, "unix:postgresql://200.46.204.71/ecpg2_regression" , "regress_ecpg_user1" , "connectpw" , "main", 0); }
#line 64 "test5.pgc"
{ ECPGdisconnect(__LINE__, "main");}
#line 65 "test5.pgc"
+ { ECPGconnect(__LINE__, 0, "unix:postgresql://localhost/" , "regress_ecpg_user2" , "insecure" , "main", 0); }
+#line 67 "test5.pgc"
+
+ { ECPGdisconnect(__LINE__, "main");}
+#line 68 "test5.pgc"
+
+
/* connect twice */
{ ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , "main", 0); }
-#line 68 "test5.pgc"
+#line 71 "test5.pgc"
{ ECPGconnect(__LINE__, 0, "ecpg2_regression" , NULL, NULL , "main", 0); }
-#line 69 "test5.pgc"
+#line 72 "test5.pgc"
{ ECPGdisconnect(__LINE__, "main");}
-#line 70 "test5.pgc"
+#line 73 "test5.pgc"
/* not connected */
{ ECPGdisconnect(__LINE__, "nonexistent");}
-#line 73 "test5.pgc"
+#line 76 "test5.pgc"
return 0;
diff --git a/src/interfaces/ecpg/test/expected/connect-test5.stderr b/src/interfaces/ecpg/test/expected/connect-test5.stderr
index a15f344320..abab1ba5a2 100644
--- a/src/interfaces/ecpg/test/expected/connect-test5.stderr
+++ b/src/interfaces/ecpg/test/expected/connect-test5.stderr
@@ -2,19 +2,19 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 24: query: alter user regress_ecpg_user2 encrypted password 'insecure'; with 0 parameter(s) on connection main
+[NO_PID]: ecpg_execute on line 27: query: alter user regress_ecpg_user2 encrypted password 'insecure'; with 0 parameter(s) on connection main
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 24: using PQexec
+[NO_PID]: ecpg_execute on line 27: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 24: OK: ALTER ROLE
+[NO_PID]: ecpg_process_output on line 27: OK: ALTER ROLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 25: query: alter user regress_ecpg_user1 encrypted password 'connectpw'; with 0 parameter(s) on connection main
+[NO_PID]: ecpg_execute on line 28: query: alter user regress_ecpg_user1 encrypted password 'connectpw'; with 0 parameter(s) on connection main
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_execute on line 25: using PQexec
+[NO_PID]: ecpg_execute on line 28: using PQexec
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ecpg_process_output on line 25: OK: ALTER ROLE
+[NO_PID]: ecpg_process_output on line 28: OK: ALTER ROLE
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGtrans on line 26: action "commit"; connection "main"
+[NO_PID]: ECPGtrans on line 29: action "commit"; connection "main"
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: connection main closed
[NO_PID]: sqlca: code: 0, state: 00000
@@ -40,9 +40,9 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: connection main closed
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode -402 on line 43: could not connect to database "<DEFAULT>" on line 43
+[NO_PID]: raising sqlcode -402 on line 46: could not connect to database "<DEFAULT>" on line 46
[NO_PID]: sqlca: code: -402, state: 08001
-[NO_PID]: raising sqlcode -220 on line 44: connection "main" does not exist on line 44
+[NO_PID]: raising sqlcode -220 on line 47: connection "main" does not exist on line 47
[NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT> for user regress_ecpg_user1
[NO_PID]: sqlca: code: 0, state: 00000
@@ -64,11 +64,11 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: connection main closed
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: ECPGconnect: non-localhost access via sockets on line 61
+[NO_PID]: ECPGconnect: non-localhost access via sockets on line 64
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode -402 on line 61: could not connect to database "ecpg2_regression" on line 61
+[NO_PID]: raising sqlcode -402 on line 64: could not connect to database "ecpg2_regression" on line 64
[NO_PID]: sqlca: code: -402, state: 08001
-[NO_PID]: raising sqlcode -220 on line 62: connection "main" does not exist on line 62
+[NO_PID]: raising sqlcode -220 on line 65: connection "main" does not exist on line 65
[NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: ECPGconnect: opening database <DEFAULT> on <DEFAULT> port <DEFAULT> for user regress_ecpg_user2
[NO_PID]: sqlca: code: 0, state: 00000
@@ -76,9 +76,9 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: connection main closed
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode -402 on line 64: could not connect to database "<DEFAULT>" on line 64
+[NO_PID]: raising sqlcode -402 on line 67: could not connect to database "<DEFAULT>" on line 67
[NO_PID]: sqlca: code: -402, state: 08001
-[NO_PID]: raising sqlcode -220 on line 65: connection "main" does not exist on line 65
+[NO_PID]: raising sqlcode -220 on line 68: connection "main" does not exist on line 68
[NO_PID]: sqlca: code: -220, state: 08003
[NO_PID]: ECPGconnect: opening database ecpg2_regression on <DEFAULT> port <DEFAULT>
[NO_PID]: sqlca: code: 0, state: 00000
@@ -86,5 +86,5 @@
[NO_PID]: sqlca: code: 0, state: 00000
[NO_PID]: ecpg_finish: connection main closed
[NO_PID]: sqlca: code: 0, state: 00000
-[NO_PID]: raising sqlcode -220 on line 73: connection "nonexistent" does not exist on line 73
+[NO_PID]: raising sqlcode -220 on line 76: connection "nonexistent" does not exist on line 76
[NO_PID]: sqlca: code: -220, state: 08003
view thread (38+ messages) latest in thread
Message-ID: <744012.1623014869@sss.pgh.pa.us>
Permalink: ../744012.1623014869@sss.pgh.pa.us/
Also on: postgresql.org/message-id/744012.1623014869@sss.pgh.pa.us
copy link · copy postgr.es · copy git am
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: tgl@sss.pgh.pa.us, michael@paquier.xyz, pryzby@telsasoft.com, zhubert@vmware.com, seltenreich@gmx.de, bruce@momjian.us
Subject: Re: Multiple hosts in connection string failed to failover in non-hot standby mode
In-Reply-To: <744012.1623014869@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox