You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bo...@apache.org on 2018/08/07 17:33:35 UTC

[geode] branch feature/GEODE-5534 created (now 9c73847)

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

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


      at 9c73847  GEODE-5534: Forced index key to be a string when a compressed region contains PDX values

This branch includes the following new commits:

     new 9c73847  GEODE-5534: Forced index key to be a string when a compressed region contains PDX values

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-5534: Forced index key to be a string when a compressed region contains PDX values

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

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

commit 9c73847e73e5a0fe007c248c10629c648c70ffa6
Author: Barry Oglesby <bo...@pivotal.io>
AuthorDate: Tue Aug 7 10:09:03 2018 -0700

    GEODE-5534: Forced index key to be a string when a compressed region contains PDX values
---
 .../index/AbstractIndexMaintenanceIntegrationTest.java   | 16 ++++++++++++++++
 .../geode/cache/query/internal/index/AbstractIndex.java  |  3 ++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/index/AbstractIndexMaintenanceIntegrationTest.java b/geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/index/AbstractIndexMaintenanceIntegrationTest.java
index ec1dd7d..9917dd1 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/index/AbstractIndexMaintenanceIntegrationTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/cache/query/internal/index/AbstractIndexMaintenanceIntegrationTest.java
@@ -29,6 +29,7 @@ import org.apache.geode.cache.query.IndexNameConflictException;
 import org.apache.geode.cache.query.QueryService;
 import org.apache.geode.cache.query.RegionNotFoundException;
 import org.apache.geode.cache.query.data.PortfolioPdx;
+import org.apache.geode.compression.SnappyCompressor;
 import org.apache.geode.internal.cache.LocalRegion;
 import org.apache.geode.internal.cache.RegionEntry;
 import org.apache.geode.pdx.internal.PdxString;
@@ -82,6 +83,21 @@ public abstract class AbstractIndexMaintenanceIntegrationTest {
   }
 
   @Test
+  public void setPdxStringFlagWithAPdxStringOnACompressedRegionShouldBeFalse() throws Exception {
+    CacheUtils.startCache();
+    Cache cache = CacheUtils.getCache();
+    cache.createRegionFactory(RegionShortcut.REPLICATE).setCompressor(new SnappyCompressor())
+        .create("portfolios");
+    QueryService qs = cache.getQueryService();
+    AbstractIndex statusIndex =
+        createIndex(qs, "statusIndex", "value.status", "/portfolios.entrySet()");
+
+    statusIndex.setPdxStringFlag(new PdxString("PdxString Key"));
+    assertTrue(statusIndex.isIndexedPdxKeysFlagSet);
+    assertFalse(statusIndex.isIndexOnPdxKeys());
+  }
+
+  @Test
   public void whenRemovingRegionEntryFromIndexIfEntryDestroyedIsThrownCorrectlyRemoveFromIndexAndNotThrowException()
       throws Exception {
     CacheUtils.startCache();
diff --git a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/AbstractIndex.java b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/AbstractIndex.java
index 94ac8a8..82e5d80 100644
--- a/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/AbstractIndex.java
+++ b/geode-core/src/main/java/org/apache/geode/cache/query/internal/index/AbstractIndex.java
@@ -66,6 +66,7 @@ import org.apache.geode.internal.Assert;
 import org.apache.geode.internal.cache.BucketRegion;
 import org.apache.geode.internal.cache.CachedDeserializable;
 import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.cache.InternalRegion;
 import org.apache.geode.internal.cache.LocalRegion;
 import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.internal.cache.RegionEntry;
@@ -2013,7 +2014,7 @@ public abstract class AbstractIndex implements IndexProtocol {
       return;
     }
     if (!this.isIndexedPdxKeys) {
-      if (key instanceof PdxString) {
+      if (key instanceof PdxString && ((InternalRegion) this.region).getCompressor() == null) {
         this.isIndexedPdxKeys = true;
       }
     }