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_r263082440
 
 

 ##########
 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);
 
 Review comment:
   nit: format the string and do a single LOG.error(string, e)

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to