[ https://issues.apache.org/jira/browse/DRILL-5098?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15736360#comment-15736360 ]
ASF GitHub Bot commented on DRILL-5098: --------------------------------------- Github user sudheeshkatkam commented on a diff in the pull request: https://github.com/apache/drill/pull/679#discussion_r91796042 --- Diff: exec/jdbc/src/test/java/org/apache/drill/jdbc/test/JdbcConnectTriesTestEmbeddedBits.java --- @@ -0,0 +1,162 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.drill.jdbc.test; + +import org.apache.drill.exec.rpc.InvalidConnectionInfoException; +import org.apache.drill.exec.rpc.RpcException; +import org.apache.drill.jdbc.Driver; +import org.apache.drill.jdbc.JdbcTestBase; + +import org.junit.Test; + +import java.sql.SQLException; +import java.sql.Connection; + +import java.util.concurrent.ExecutionException; + +import static junit.framework.Assert.assertNotNull; +import static junit.framework.TestCase.fail; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +public class JdbcConnectTriesTestEmbeddedBits extends JdbcTestBase { + + @Test + public void testDirectConnectionConnectTriesEqualsDrillbitCount() throws SQLException { + Connection connection = null; + try { + connection = new Driver().connect("jdbc:drill:drillbit=127.0.0.1:5000,127.0.0.1:5001;" + "tries=2", --- End diff -- Create one driver and use across tests. > Improving fault tolerance for connection between client and foreman node. > ------------------------------------------------------------------------- > > Key: DRILL-5098 > URL: https://issues.apache.org/jira/browse/DRILL-5098 > Project: Apache Drill > Issue Type: Improvement > Components: Client - JDBC > Reporter: Sorabh Hamirwasia > Assignee: Sorabh Hamirwasia > Labels: doc-impacting, ready-to-commit > Fix For: 1.10 > > > With DRILL-5015 we allowed support for specifying multiple Drillbits in > connection string and randomly choosing one out of it. Over time some of the > Drillbits specified in the connection string may die and the client can fail > to connect to Foreman node if random selection happens to be of dead Drillbit. > Even if ZooKeeper is used for selecting a random Drillbit from the registered > one there is a small window when client selects one Drillbit and then that > Drillbit went down. The client will fail to connect to this Drillbit and > error out. > Instead if we try multiple Drillbits (configurable tries count through > connection string) then the probability of hitting this error window will > reduce in both the cases improving fault tolerance. During further > investigation it was also found that if there is Authentication failure then > we throw that error as generic RpcException. We need to improve that as well > to capture this case explicitly since in case of Auth failure we don't want > to try multiple Drillbits. -- This message was sent by Atlassian JIRA (v6.3.4#6332)