palashc commented on code in PR #1666:
URL: https://github.com/apache/phoenix/pull/1666#discussion_r1327589774


##########
phoenix-core/src/main/java/org/apache/phoenix/jdbc/PhoenixStatement.java:
##########
@@ -421,7 +514,20 @@ private PhoenixResultSet executeQuery(final 
CompilableStatement stmt,
                                     }
                                 }
                                 throw e;
-                            } catch (RuntimeException e) {
+                            } catch (SQLException e) {
+                                // force update cache if 
StaleMetadataCacheException and retry
+                                if (e instanceof StaleMetadataCacheException) {
+                                    String planSchemaName = 
getLastQueryPlan().getTableRef().getTable().getSchemaName().toString();
+                                    String planTableName = 
getLastQueryPlan().getTableRef().getTable().getTableName().toString();
+                                    // update cache
+                                    new 
MetaDataClient(connection).updateCache(connection.getTenantId(), 
planSchemaName, planTableName, true);
+                                    // skip last ddl timestamp validation in 
the retry
+                                    setValidateLastDdlTimestamp(false);

Review Comment:
   Yeah I was thinking of that, do we ever re-use the statement for different 
queries? I could only find usage of `conn.createStatement` in our tests but we 
can not guarantee that usage from customers. 
   
   I can revert back to passing a boolean parameter through the execute* 
methods. 



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

Reply via email to