Re: WIP: Fix parallel workers connection bug in pg_dump (Bug #13727) - Mailing list pgsql-hackers

From Marko Tiikkaja
Subject Re: WIP: Fix parallel workers connection bug in pg_dump (Bug #13727)
Date
Msg-id 56368C68.9040204@joh.to
Whole thread Raw
In response to WIP: Fix parallel workers connection bug in pg_dump (Bug #13727)  (Zeus Kronion <zkronion@gmail.com>)
Responses Re: WIP: Fix parallel workers connection bug in pg_dump (Bug #13727)  (Zeus Kronion <zkronion@gmail.com>)
List pgsql-hackers
On 10/25/15 10:55 PM, Zeus Kronion wrote:
> Parallel workers were failing to connect to the database when running
> pg_dump with a connection string. The first of the following two commands
> runs without errors, while the second one fails:
> pg_dump "postgres://my-user:my-password@my.hostname.com:5432/my-db" -Fd -f
> my-dump
> pg_dump "postgres://my-user:my-password@my.hostname.com:5432/my-db" -Fd
> --jobs=9 -f my-dump
>
> The error message:
> pg_dump: [parallel archiver] connection to database "my-db" failed:
> fe_sendauth: no password supplied
>
> The password is not being stored correctly in the PGconn object when
> connecting with a connection string.

Yeah, the current code is definitely broken for this case.  However, I 
don't feel like this patch is quite there yet, either.  _connectDB has 
similar logic in it which might be hit in case e.g. a a user's HBA is 
changed from a non-password-requiring method to a password-requiring one 
after the one or more connections has been initiated.  That one needs 
changing as well.

However, I don't quite like the way the password cache is kept up to 
date in the old *or* the new code.  It seems to me that it should 
instead look like:
   if (PQconnectionUsedPassword(AH->connection))       AH->savedPassword = PQpass(AH->connection);

What do you think?


.m



pgsql-hackers by date:

Previous
From: David Fetter
Date:
Subject: Re: fortnight interval support
Next
From: Michael Paquier
Date:
Subject: Re: COPY (INSERT/UPDATE/DELETE .. RETURNING ..)