You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@geode.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/10/23 18:38:01 UTC

[jira] [Commented] (GEODE-3520) IndexMaintenanceExceptions should not affect a put

    [ https://issues.apache.org/jira/browse/GEODE-3520?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16215627#comment-16215627 ] 

ASF GitHub Bot commented on GEODE-3520:
---------------------------------------

nabarunnag closed pull request #893: GEODE-3520: Additional asserts.
URL: https://github.com/apache/geode/pull/893
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/dunit/CorruptedIndexIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/dunit/CorruptedIndexIntegrationTest.java
index 64ff11efda..baa2555db5 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/dunit/CorruptedIndexIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/dunit/CorruptedIndexIntegrationTest.java
@@ -168,6 +168,61 @@ public void putMustSucceedWhenTheRangeIndexIsCorrupted() throws Exception {
   }
 
   @Test
+  public void putMustSucceedButShouldNotbeAddedtoIndexWhenTheRangeIndexIsCorrupted()
+      throws Exception {
+    String regionName = "portfolio";
+    String INDEX_NAME = "key_index1";
+
+    PartitionAttributesFactory partitionAttributes = new PartitionAttributesFactory();
+    partitionAttributes.setTotalNumBuckets(1);
+
+    Cache cache = getCache();
+    Region region = cache.createRegionFactory().setDataPolicy(DataPolicy.PARTITION)
+        .setPartitionAttributes(partitionAttributes.create()).create(regionName);
+
+    Portfolio p = new Portfolio(1, 2);
+    HashMap map1 = new HashMap();
+    map1.put("SUN", 1);
+    map1.put("IBM", 2);
+    map1.put("AOL", 4);
+    p.positions = map1;
+    region.put(1, p);
+
+    QueryService queryService = cache.getQueryService();
+    Index keyIndex1 = queryService.createIndex(INDEX_NAME, "positions[*]", "/portfolio");
+
+    Portfolio p2 = new Portfolio(3, 4);
+    HashMap map2 = new HashMap();
+    map2.put("APPL", 3);
+    map2.put("AOL", "hello");
+    p2.positions = map2;
+    region.put(2, p2);
+
+    Portfolio p3 = new Portfolio(5, 6);
+    HashMap map3 = new HashMap();
+    map3.put("APPL", 4);
+    map3.put("AOL", "world");
+    p3.positions = map3;
+    region.put(3, p3);
+
+    assertEquals("Put must be successful", 3, region.size());
+    assertEquals("Index must be invalid at this point ", false, keyIndex1.isValid());
+    assertEquals("No new entries must be added to the corrupted index", 4,
+        keyIndex1.getStatistics().getNumberOfValues());
+
+    QueryObserverImpl observer = new QueryObserverImpl();
+    QueryObserverHolder.setInstance(observer);
+
+    SelectResults results = (SelectResults) queryService
+        .newQuery(
+            "select * from /portfolio p where p.positions['AOL'] = 'hello' OR p.positions['IBM'] = 2")
+        .execute();
+    assertEquals("Correct results expected from the query execution ", 2, results.size());
+    assertEquals("No index must be used while executing the query ", 0,
+        observer.indexesUsed.size());
+  }
+
+  @Test
   public void rangeIndexCreationMustFailIfRegionEntriesAreNotCompatible() throws Exception {
     String regionName = "portfolio";
     String INDEX_NAME = "key_index1";


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> IndexMaintenanceExceptions should not affect a put
> --------------------------------------------------
>
>                 Key: GEODE-3520
>                 URL: https://issues.apache.org/jira/browse/GEODE-3520
>             Project: Geode
>          Issue Type: Bug
>          Components: querying
>            Reporter: Jason Huynh
>            Assignee: Jason Huynh
>             Fix For: 1.3.0
>
>
> If during index maintenance i.e. index update during a put operation , if there is an exception, the index is marked invalid, however the put will be successful as it is present in the data regions.
> This will require us to provide a user a way to determine which indexes are valid/invalid (maybe a new column in GFSH to describe index).  The query engine would need to avoid using indexes marked as invalid.
> Also provide a Java API isValid on the indexes to know if they are valid.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)