From issues-return-4951-archive-asf-public=cust-asf.ponee.io@phoenix.apache.org Wed Mar 6 19:04:43 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 45B451807CC for ; Wed, 6 Mar 2019 20:04:41 +0100 (CET) Received: (qmail 76658 invoked by uid 500); 6 Mar 2019 19:04:40 -0000 Mailing-List: contact issues-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list issues@phoenix.apache.org Received: (qmail 76585 invoked by uid 99); 6 Mar 2019 19:04:40 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Mar 2019 19:04:40 +0000 From: GitBox To: issues@phoenix.apache.org Subject: [GitHub] [phoenix] vincentpoon commented on a change in pull request #453: [PHOENIX-5172] Harden the PQS canary synth test tool with retry mechanism and more logging Message-ID: <155189907972.24909.11456091557851123811.gitbox@gitbox.apache.org> Date: Wed, 06 Mar 2019 19:04:39 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit vincentpoon commented on a change in pull request #453: [PHOENIX-5172] Harden the PQS canary synth test tool with retry mechanism and more logging URL: https://github.com/apache/phoenix/pull/453#discussion_r263085970 ########## File path: phoenix-core/src/main/java/org/apache/phoenix/tool/PhoenixCanaryTool.java ########## @@ -464,11 +364,60 @@ public Void call() { return 0; } + private static Connection getConnectionWithRetry(String connectionURL, Properties connProps){ + Connection connection = null; + boolean isSuccess; + int currentAttempt = 1; + do { + try { + connection = DriverManager.getConnection(connectionURL, connProps); + LOG.info("Successfully established connection within " + +currentAttempt+ "/" + MAX_ATTEMPTS + " attempts"); + LOG.info("connectionURL :" +connectionURL); + LOG.info("connProps :" + connProps); + isSuccess = true; + } catch (Exception e) { + LOG.error("Failed to get connection." + + " Exhausted attempts : "+ currentAttempt+ "/" + MAX_ATTEMPTS); + LOG.error("connectionURL :" + connectionURL); + LOG.error("connProps :" + connProps); + LOG.error("Something went wrong while getting Connection", e); + isSuccess = false; + sleepBeforeRetry(currentAttempt); + currentAttempt++; + } + } while (isSuccess != true && currentAttempt <= MAX_ATTEMPTS); + return connection; + } + + private static void sleepBeforeRetry(int attempt) { + final int sleepTimesInSeconds= getSleepTime(attempt); Review comment: nit: formatting with space before `=` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services