Cluster crashes if a query fails when using PostgreSQL and V2 protocol
----------------------------------------------------------------------

         Key: SEQUOIA-881
         URL: https://forge.continuent.org/jira/browse/SEQUOIA-881
     Project: Sequoia
        Type: Bug
  Components: Core  
    Versions: Sequoia 2.10.3    
 Environment: Sequoia 2.10 CVS branch - PostgreSQL 8.1 - JDBC driver uses V2 
protocol instead of V3
    Reporter: Guillaume Smet


Hi all,

The application we are using (Red Hat WAF/CCM) forces us to use the version 2 
of the protocol used by the PostgreSQL JDBC driver instead of the V3 one (due 
to types problem which are not fixable).

When a query fails inside a transaction, the entire cluster goes down because 
the backends are declared inactive by DatabaseBackend.isValidConnection().

In this method, there is a hack for PostgreSQL:
if ("25P02".equals(e.getSQLState())
          || (e.getMessage() != null && e
              .getMessage()
              .indexOf(
                  "current transaction is aborted, queries ignored until end of 
transaction block") > 0))
        {
        // see bug item #300873 on the forge for details
        // postgres throws an exception if a query is issued after a request has
        // failed within a transaction, we now have to check for this exception
        // as it is means the connection is valid
        //
        // postgres versions after 7.4 will return the SQLState, whereas
        // postgres versions prior to 7.4 will have to be checked for the
        // message text

This comment is misleading. It's not a problem with a particular version of 
PostgreSQL but with the version of the protocol (V2 does not support SQLState 
whereas V3 does). If you are using PostgreSQL 8.1 with V2 protocol 
(protocolVersion=2 parameter in your JDBC URL), you won't have the valid 
SQLState returned. Note that using the V2 protocol is the recommended 
workaround when you cannot upgrade the application. Apart from that, V3 
protocol can have performances problem on particular queries that V2 does not 
have so it's really important to support it too.

BTW it shouldn't be a problem if the error message didn't change between 7.4 
and 8.1. In 8.1 "queries" is replaced by "commands".

I attached a patch which:
- fixes the comment,
- removed the start of the sentence and only considers "ignored until end of 
transaction block" - it's not used anywhere else in PostgreSQL source code and 
is really tied to this problem.
This patch fixes the problem on our platform.

This is a really annoying problem for us as the entire cluster goes down as 
soon as a query fails.

Regards,

--
Guillaume Smet
Open Wide

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   https://forge.continuent.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


_______________________________________________
Sequoia mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/sequoia

Reply via email to