[CONJ-529] retriesAllDown not working as expected Created: 2017-09-25  Updated: 2017-12-08  Resolved: 2017-12-08

Status: Closed
Project: MariaDB Connector/J
Component/s: Failover
Affects Version/s: 2.1.1
Fix Version/s: 2.2.1, 1.7.1

Type: Bug Priority: Major
Reporter: Hautot Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None


 Description   

We changed the connector to use the mariadb one (latest version). And so instead of "maxReconnects" we use "retriesAllDown" option in the connection string.

In the code I see:
/**

  • When using loadbalancing, the number of times the driver should cycle through available hosts, attempting to connect.
  • Between cycles, the driver will pause for 250ms if no servers are available.
    */
    RETRY_ALL_DOWN("retriesAllDown", 120, 0, "1.2.0"),

So I would think that between 2 connection tries (try the whole list of master/slaves) it would wait for ¼ seconds but looking at the code in
public static void loop(Listener listener, final List<HostAddress> addresses,
SearchFilter searchFilter) throws SQLException

{ ... }

I see no sleep and I have put some logs and I noticed that the connector tried to connect almost 1 million times in +/- 70 seconds (the time for mariadb container to start, load data and restart).
So I am obliged to put an arbitrary very high value for "retriesAllDown".

I think a quick fix would be to put a sleep 250ms at the end of the while loop to match what's in the above comment.
Or add like for mysql a parameter to wait a little more between 2 consecutive failed tries.



 Comments   
Comment by Diego Dupin [ 2017-12-08 ]

available through snapshot :

<repositories>
    <repository>
        <id>sonatype-nexus-snapshots</id>
        <name>Sonatype Nexus Snapshots</name>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
    </repository>
</repositories>
 
<dependencies>
    <dependency>
        <groupId>org.mariadb.jdbc</groupId>
        <artifactId>mariadb-java-client</artifactId>
        <version>2.2.1-SNAPSHOT</version>
    </dependency>
</dependencies>

Generated at Thu Feb 08 03:16:21 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.