You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by zh...@apache.org on 2021/08/10 21:18:23 UTC

[geode] branch feature/GEODE-9496 created (now c24e13a)

This is an automated email from the ASF dual-hosted git repository.

zhouxj pushed a change to branch feature/GEODE-9496
in repository https://gitbox.apache.org/repos/asf/geode.git.


      at c24e13a  GEODE-9496: Enhance the usage of newly introduced system property

This branch includes the following new commits:

     new c24e13a  GEODE-9496: Enhance the usage of newly introduced system property

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[geode] 01/01: GEODE-9496: Enhance the usage of newly introduced system property

Posted by zh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

zhouxj pushed a commit to branch feature/GEODE-9496
in repository https://gitbox.apache.org/repos/asf/geode.git

commit c24e13aef836bd0fbf399774e5b9ca372dfff5ae
Author: zhouxh <gz...@pivotal.io>
AuthorDate: Tue Aug 10 14:16:41 2021 -0700

    GEODE-9496: Enhance the usage of newly introduced system property
---
 .../java/org/apache/geode/cache/client/internal/QueryOp.java  |  8 +++++---
 .../org/apache/geode/internal/lang/SystemPropertyHelper.java  |  3 +++
 .../apache/geode/internal/lang/SystemPropertyHelperTest.java  | 11 +++++++++++
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/cache/client/internal/QueryOp.java b/geode-core/src/main/java/org/apache/geode/cache/client/internal/QueryOp.java
index 1675cae..719adcb 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/client/internal/QueryOp.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/client/internal/QueryOp.java
@@ -31,10 +31,10 @@ import org.apache.geode.internal.cache.tier.sockets.ChunkedMessage;
 import org.apache.geode.internal.cache.tier.sockets.Message;
 import org.apache.geode.internal.cache.tier.sockets.ObjectPartList;
 import org.apache.geode.internal.cache.tier.sockets.Part;
+import org.apache.geode.internal.lang.SystemPropertyHelper;
 import org.apache.geode.internal.serialization.KnownVersion;
 import org.apache.geode.logging.internal.log4j.api.LogService;
 import org.apache.geode.pdx.PdxSerializationException;
-import org.apache.geode.util.internal.GeodeGlossary;
 
 /**
  * Does a region query on a server
@@ -132,8 +132,10 @@ public class QueryOp {
           // 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");
+          boolean enableQueryRetryOnPdxSerializationException = SystemPropertyHelper
+              .getProductBooleanProperty(
+                  SystemPropertyHelper.ENABLE_QUERY_RETRY_ON_PDX_SERIALIZATION_EXCEPTION)
+              .orElse(false);
           if (e instanceof PdxSerializationException
               && enableQueryRetryOnPdxSerializationException) {
             // IOException will allow the client to retry next server in the connection pool until
diff --git a/geode-core/src/main/java/org/apache/geode/internal/lang/SystemPropertyHelper.java b/geode-core/src/main/java/org/apache/geode/internal/lang/SystemPropertyHelper.java
index f66f82a..1383a62 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/lang/SystemPropertyHelper.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/lang/SystemPropertyHelper.java
@@ -71,6 +71,9 @@ public class SystemPropertyHelper {
 
   public static final String USE_HTTP_SYSTEM_PROPERTY = "useHTTP";
 
+  public static final String ENABLE_QUERY_RETRY_ON_PDX_SERIALIZATION_EXCEPTION =
+      "enableQueryRetryOnPdxSerializationException";
+
   /**
    * a comma separated string to list out the packages to scan. If not specified, the entire
    * classpath is scanned.
diff --git a/geode-core/src/test/java/org/apache/geode/internal/lang/SystemPropertyHelperTest.java b/geode-core/src/test/java/org/apache/geode/internal/lang/SystemPropertyHelperTest.java
index f44af8a..353a7c9 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/lang/SystemPropertyHelperTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/lang/SystemPropertyHelperTest.java
@@ -108,6 +108,17 @@ public class SystemPropertyHelperTest {
   }
 
   @Test
+  public void getBooleanPropertyReturnsEnableRetryOnPdxSerializationException() {
+    String testProperty = "enableQueryRetryOnPdxSerializationException";
+    String gemfirePrefixProperty = "gemfire." + testProperty;
+    System.setProperty(gemfirePrefixProperty, "true");
+    assertThat(SystemPropertyHelper.getProductBooleanProperty(testProperty).get()).isTrue();
+    System.clearProperty(gemfirePrefixProperty);
+    assertThat(SystemPropertyHelper.getProductBooleanProperty(testProperty).orElse(false))
+        .isFalse();
+  }
+
+  @Test
   public void getBooleanPropertyParallelDiskStoreRecovery() {
     // default
     assertThat(SystemPropertyHelper