amogh-jahagirdar commented on code in PR #10140:
URL: https://github.com/apache/iceberg/pull/10140#discussion_r1588420304


##########
core/src/main/java/org/apache/iceberg/jdbc/JdbcClientPool.java:
##########
@@ -21,17 +21,39 @@
 import java.sql.Connection;
 import java.sql.DriverManager;
 import java.sql.SQLException;
-import java.sql.SQLNonTransientConnectionException;
+import java.sql.SQLTransientException;
+import java.util.Arrays;
 import java.util.Map;
 import java.util.Properties;
+import java.util.Set;
+import java.util.stream.Collectors;
 import org.apache.iceberg.CatalogProperties;
 import org.apache.iceberg.ClientPoolImpl;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableSet;
+import org.apache.iceberg.relocated.com.google.common.collect.Sets;
 
 public class JdbcClientPool extends ClientPoolImpl<Connection, SQLException> {
 
+  /**
+   * The following are common retryable SQLSTATE error codes which are generic 
across vendors.
+   *
+   * <ul>
+   *   <li>08000: Generic Connection Exception
+   *   <li>08003: Connection does not exist
+   *   <li>08006: Connection failure
+   *   <li>08007: Transaction resolution unknown
+   * </ul>
+   *
+   * See https://en.wikipedia.org/wiki/SQLSTATE for more details.
+   */
+  static final Set<String> COMMON_RETRYABLE_CONNECTION_SQL_STATES =

Review Comment:
   Sure it seems like 40001 is typically a transaction rollback prompted by a 
database's deadlock detector kicking in and essentially killing one of the 
operations.
   
   I think I'll add 40001 since it can be safely retried and is a common status 
code across vendors.
   
   I'm a bit more hesitant to add database vendor specific codes (like 40P01) 
to this default set, since it sets a precedent to be a dumping ground for many 
states. I'd advocate we keep this default set to be a common set, and users 
pass in custom codes for other cases.



-- 
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-unsubscr...@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to