abhishekagarwal87 commented on code in PR #18406:
URL: https://github.com/apache/druid/pull/18406#discussion_r2298408837
##########
extensions-core/kubernetes-overlord-extensions/src/main/java/org/apache/druid/k8s/overlord/common/KubernetesPeonClient.java:
##########
@@ -353,6 +476,32 @@ private boolean shouldRetryStartingPeonPod(Throwable e)
return true;
}
+ /**
+ * Checks if the exception is a potentially transient connection pool
exception.
+ * <p>
+ * This method checks if the exception is one of the known transient
connection pool exceptions
+ * and whether it contains a specific message substring, if applicable.
+ * <p>
+ * We have experienced connections in the pool being closed by the
server-side but remaining in the pool. These issues
+ * should be safe to retry in many cases.
+ */
+ private boolean isRetryableTransientConnectionPoolException(Throwable e)
+ {
+ for (var entry :
DruidK8sConstants.TRANSITIVE_CONNECTION_POOL_EXCEPTIONS.entrySet()) {
+ Class<? extends RuntimeException> exceptionClass = entry.getKey();
+ Optional<String> messageSubstring = entry.getValue();
+
+ if (exceptionClass.isInstance(e)) {
+ if (messageSubstring.isPresent()) {
+ return e.getMessage() != null &&
e.getMessage().contains(messageSubstring.get());
+ } else {
+ return true;
+ }
+ }
+ }
Review Comment:
nit: it would be more readable if you remove that constant map and have few
if/else conditions here for each exception type. something like
```
if(exception is httpClientException) ..
if (exception is connectionClosed)...
return false
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]