apurtell commented on code in PR #2288:
URL: https://github.com/apache/phoenix/pull/2288#discussion_r2411810135
##########
phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/FailoverPhoenixConnection.java:
##########
@@ -333,10 +339,31 @@ <T> T
wrapActionDuringFailover(SupplierWithSQLException<T> s) throws SQLExceptio
while (true) {
try {
return s.get();
- } catch (SQLException e) {
+ } catch (Exception e) {
+ if (isStaleClusterRoleRecordExceptionExistsInThrowable(e)) {
+ LOG.debug("StaleHAGroupStoreException found refreshing
HAGroup");
+ //If the exception is due to stale ClusterRoleRecord
version, try
+ //refreshing the ClusterRoleRecord and state transitions
if required
+
+ if (!context.getHAGroup().refreshClusterRoleRecord()) {
+ throw new
SQLExceptionInfo.Builder(SQLExceptionCode.STALE_CRR_RETHROW_AFTER_REFRESH_FAILED)
+ .setMessage(String.format("Error while running
operation Stale ClusterRoleRecord for HAGroup %s" +
+ " found with version %s,
refreshing HAGroup failed :- %s",
+ context.getHAGroup(),
context.getHAGroup().getRoleRecord().getVersion(), e)).build().buildException();
+ }
+
+ throw new
SQLExceptionInfo.Builder(SQLExceptionCode.STALE_CRR_RETHROW_AFTER_REFRESH)
Review Comment:
What is the difference between these two cases? The error messages and error
code names do not provide good context.
##########
phoenix-core-client/src/main/java/org/apache/phoenix/jdbc/FailoverPhoenixConnection.java:
##########
@@ -333,10 +339,31 @@ <T> T
wrapActionDuringFailover(SupplierWithSQLException<T> s) throws SQLExceptio
while (true) {
try {
return s.get();
- } catch (SQLException e) {
+ } catch (Exception e) {
+ if (isStaleClusterRoleRecordExceptionExistsInThrowable(e)) {
+ LOG.debug("StaleHAGroupStoreException found refreshing
HAGroup");
+ //If the exception is due to stale ClusterRoleRecord
version, try
+ //refreshing the ClusterRoleRecord and state transitions
if required
+
+ if (!context.getHAGroup().refreshClusterRoleRecord()) {
+ throw new
SQLExceptionInfo.Builder(SQLExceptionCode.STALE_CRR_RETHROW_AFTER_REFRESH_FAILED)
+ .setMessage(String.format("Error while running
operation Stale ClusterRoleRecord for HAGroup %s" +
+ " found with version %s,
refreshing HAGroup failed :- %s",
+ context.getHAGroup(),
context.getHAGroup().getRoleRecord().getVersion(), e)).build().buildException();
+ }
+
+ throw new
SQLExceptionInfo.Builder(SQLExceptionCode.STALE_CRR_RETHROW_AFTER_REFRESH)
Review Comment:
What is the difference between these two cases? The error messages and error
code names do not provide good context.
--
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]