← Back to team overview

maria-discuss team mailing list archive

Re: jdbc failure after restart

 

Only SHOW and SET query are allowed on non primary nodes.
If this is those kind of query you want to run, you always can correct
directly to this specific node.
Not sure it works with MySQL connector, (maybe with old version like
5.1.30, but since then, evolution of connector use different "select"
during connection, causing exception on connection).
Better to change to MariaDB java connector if you want to do that.

diego

On Wed, Nov 23, 2016 at 2:57 PM, l vic <lvic4594@xxxxxxxxx> wrote:

> That makes sense, thanks... My question, howerver: what do i need to do so
> that my jdbc client could periodically run query on remaining node even if
> wsrep_ready=OFF?
>
> On Tue, Nov 22, 2016 at 7:21 PM, Diego Dupin <diego.dupin@xxxxxxxxxxx>
> wrote:
>
>> Hi,
>>
>> As documented here (https://mariadb.com/kb/en/mar
>> iadb/mariadb-galera-cluster-known-limitations/) :
>>
>>>
>>>    - A command may fail with ER_UNKNOWN_COM_ERROR producing 'WSREP has
>>>    not yet prepared node for application use' (or 'Unknown command' in older
>>>    versions) error message. It happens when a cluster is suspected to be split
>>>    and the node is in a smaller part — for example, during a network
>>>    glitch, when nodes temporarily lose each other. It can also occur during
>>>    state transfer. The node takes this measure to prevent data inconsistency.
>>>    Its usually a temporary state which can be detected by checking
>>>    wsrep_ready
>>>    <https://mariadb.com/kb/en/galera-cluster-status-variables/#wsrep_ready> value.
>>>    The node, however, allows SHOW and SET command during this period.
>>>
>>>
>> if you have only 2 nodes : Quorum requires a majority, meaning that you
>> cannot have automatic failover in a two node cluster. This is because the
>> failure of one causes the remaining node automatically go into a
>> non-primary state.
>>
>>
>> Diego.
>>
>> On Wed, Nov 23, 2016 at 12:00 AM, l vic <lvic4594@xxxxxxxxx> wrote:
>>
>>> i have the following jdbc exception in my jdbc client for the node 1
>>> after another node (node2) is removed:
>>> om.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException:
>>> WSREP has not yet prepared node for application use
>>>    at sun.reflect.GeneratedConstructorAccessor9.newInstance(Unknown
>>> Source)
>>>    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(De
>>> legatingConstructorAccessorImpl.java:45)
>>>    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
>>>    at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
>>>    at com.mysql.jdbc.Util.getInstance(Util.java:387)
>>>    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:917)
>>>    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3966)
>>>    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3902)
>>>    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2526)
>>>    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2673)
>>>    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2545)
>>>    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2503)
>>>    at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1369)
>>>    at com.mysql.jdbc.ConnectionImpl.loadServerVariables(Connection
>>> Impl.java:3833)
>>>    at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(Conn
>>> ectionImpl.java:3283)
>>>    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionIm
>>> pl.java:2297)
>>>    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.jav
>>> a:2083)
>>>    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:806)
>>>    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
>>>    at sun.reflect.GeneratedConstructorAccessor5.newInstance(Unknown
>>> Source)
>>>    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(De
>>> legatingConstructorAccessorImpl.java:45)
>>>    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
>>>    at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
>>>    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:410)
>>>    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDr
>>> iver.java:328)
>>>    at java.sql.DriverManager.getConnection(DriverManager.java:664)
>>>
>>> I wonder why i have this failure when i just trying to read db from the
>>> unaffected node? The failure seems to be permanent, once it happened - all
>>> subsequent reads fail
>>>
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~maria-discuss
>>> Post to     : maria-discuss@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~maria-discuss
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>

References