Re: Multiple hosts in connection string failed to failover in non-hot standby mode - Mailing list pgsql-hackers
From | Tom Lane |
---|---|
Subject | Re: Multiple hosts in connection string failed to failover in non-hot standby mode |
Date | |
Msg-id | 744012.1623014869@sss.pgh.pa.us Whole thread Raw |
In response to | Re: Multiple hosts in connection string failed to failover in non-hot standby mode (Michael Paquier <michael@paquier.xyz>) |
Responses |
Re: Multiple hosts in connection string failed to failover in non-hot standby mode
|
List | pgsql-hackers |
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 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
pgsql-hackers by date: