Bill commented on a change in pull request #6561:
URL: https://github.com/apache/geode/pull/6561#discussion_r665745133



##########
File path: 
geode-core/src/main/java/org/apache/geode/cache/client/internal/QueryOp.java
##########
@@ -120,7 +124,29 @@ protected Object processResponse(Message msg) throws 
Exception {
           queryResult = resultPart.getObject();
         } catch (Exception e) {
           String s = "While deserializing " + getOpName() + " result";
-          exceptionRef[0] = new SerializationException(s, e);
+
+          // Enable the workaround to convert PdxSerializationException into 
IOException to retry.
+          // It only worked when the client is configured to connect to more 
than one cache server
+          // AND the pool's "retry-attempts" is -1 (the default which means 
try each server) or > 0.
+          // It is possible that if application closed the current connection 
and got a new
+          // connection to the same server and retried the query to it, that 
it would also
+          // workaround this issue and it would not have the limitations of 
needing multiple servers
+          // and would not depend on the retry-attempts configuration.
+          boolean enableQueryRetryOnPdxSerializationException = 
Boolean.getBoolean(
+              GeodeGlossary.GEMFIRE_PREFIX + 
"enableQueryRetryOnPdxSerializationException");
+          if (e instanceof PdxSerializationException
+              && enableQueryRetryOnPdxSerializationException) {
+            // IOException will allow the client to retry next server in the 
connection pool until
+            // exhausted all the servers (so it will not retry forever). Why 
retry:
+            // The byte array of the pdxInstance is always the same at the 
server. Other clients can
+            // get a correct one from query response message. Even this client 
can get it correctly
+            // before and after the PdxSerializationException.
+            exceptionRef[0] = new IOException(s, e);
+            LogService.getLogger().warn(
+                "Encountered unexpected PdxSerializationException, retrying on 
another server");

Review comment:
       good to see the warning issued here

##########
File path: 
geode-core/src/main/java/org/apache/geode/cache/client/internal/QueryOp.java
##########
@@ -120,7 +124,29 @@ protected Object processResponse(Message msg) throws 
Exception {
           queryResult = resultPart.getObject();
         } catch (Exception e) {
           String s = "While deserializing " + getOpName() + " result";
-          exceptionRef[0] = new SerializationException(s, e);
+
+          // Enable the workaround to convert PdxSerializationException into 
IOException to retry.
+          // It only worked when the client is configured to connect to more 
than one cache server
+          // AND the pool's "retry-attempts" is -1 (the default which means 
try each server) or > 0.
+          // It is possible that if application closed the current connection 
and got a new
+          // connection to the same server and retried the query to it, that 
it would also
+          // workaround this issue and it would not have the limitations of 
needing multiple servers
+          // and would not depend on the retry-attempts configuration.
+          boolean enableQueryRetryOnPdxSerializationException = 
Boolean.getBoolean(
+              GeodeGlossary.GEMFIRE_PREFIX + 
"enableQueryRetryOnPdxSerializationException");

Review comment:
       good to see this functionality made conditional on the system property




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