[Pgpool-hackers] retry of health check

Tatsuo Ishii ishii at sraoss.co.jp
Fri Mar 12 23:39:37 UTC 2010


> On Thu, Mar 11, 2010 at 9:44 AM, Tatsuo Ishii <ishii at sraoss.co.jp> wrote:
> >> > Hmm.. in HEAD, 'E' is returned first in that case. Which version of
> >> > postgres returns 'R' first? Its behavior might depend on the version.
> >>
> >> 8.4. Will check CVS HEAD.
> >
> > You are right. CVS HEAD sends 'E' first(see below). Looks like someone
> > changed this part between 8.4 and CVS HEAD. This is good because
> > previous behavior was wrong IMO. Problem is, how to dealth with those
> > different behaviors. Probably the safest way is, after sending start
> > up packet to backend, read reply packet as many as possible, Then scan
> > the packet looking for 'E' message. Thoughts?
> 
> Umm.. the problem is that the returned 'R' might indicate the message
> other than AuthenticationOk. In this case, since the backend waits for
> the authentication information (e.g., password) before checking the
> existence of the specified database, pgpool would never see the 'E'.
> Then the backend doesn't accept the 'X' correctly (since it waits for
> the authentication information itself), so pgpool should just close
> the connection without sending the 'X'.
> 
> On the other hand, if the returned 'R' indicates AuthenticationOk,
> pgpool should try to read the message from the backend until the
> ReadyForQuery arrives. Only if pgpool doesn't see the 'E' on the way,
> it should try to send the 'X'.
> 
> Of course, the above suggestion is complicated, so I'm leaning towards
> not changing the existing behavior and revisiting this topic later.

For record, in CVS HEAD PostgreSQL returns 'R'(authentication OK) then
'E' if wrong user name was given. So it seems PostgreSQL's behavior is
truely random(i.e. implementation dependent) and pgpool cannot predict
what it acts.
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp


More information about the Pgpool-hackers mailing list