You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@phoenix.apache.org by "Divneet18 (via GitHub)" <gi...@apache.org> on 2024/04/02 22:06:36 UTC

[PR] PHOENIX 7233 : CQSI openConnection should timeout to unblock other connection threads [phoenix]

Divneet18 opened a new pull request, #1871:
URL: https://github.com/apache/phoenix/pull/1871

   (no comment)


-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] PHOENIX 7233 : CQSI openConnection should timeout to unblock other connection threads [phoenix]

Posted by "gjacoby126 (via GitHub)" <gi...@apache.org>.
gjacoby126 commented on code in PR #1871:
URL: https://github.com/apache/phoenix/pull/1871#discussion_r1558311385


##########
phoenix-core-client/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java:
##########
@@ -3501,7 +3503,18 @@ public Void call() throws Exception {
                         try {
                             GLOBAL_QUERY_SERVICES_COUNTER.increment();
                             LOGGER.info("An instance of ConnectionQueryServices was created.");
-                            openConnection();
+                            CompletableFuture<Void> supplyFuture = CompletableFuture.runAsync(() -> {
+                                try {
+                                    openConnection();
+                                } catch (SQLException e) {
+                                    throw new RuntimeException(e);
+                                }
+                            });
+                            try {
+                                supplyFuture.get(120000, MILLISECONDS);
+                            } catch (TimeoutException e) {
+                                LOGGER.error("openConnection did not return any value");

Review Comment:
   Why are we swallowing the exception rather than rethrowing it? Shouldn't the timeout be a failure condition rather than proceeding?



##########
phoenix-core-client/src/main/java/org/apache/phoenix/query/ConnectionQueryServicesImpl.java:
##########
@@ -3501,7 +3503,18 @@ public Void call() throws Exception {
                         try {
                             GLOBAL_QUERY_SERVICES_COUNTER.increment();
                             LOGGER.info("An instance of ConnectionQueryServices was created.");
-                            openConnection();
+                            CompletableFuture<Void> supplyFuture = CompletableFuture.runAsync(() -> {
+                                try {
+                                    openConnection();
+                                } catch (SQLException e) {
+                                    throw new RuntimeException(e);
+                                }
+                            });
+                            try {
+                                supplyFuture.get(120000, MILLISECONDS);

Review Comment:
   The timeout should be a configurable value



-- 
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.

To unsubscribe, e-mail: issues-unsubscribe@phoenix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org