[ 
https://issues.apache.org/jira/browse/GEODE-8680?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jianxia Chen updated GEODE-8680:
--------------------------------
    Description: 
>From the stress test of a dunit test, 
>[https://concourse.apachegeode-ci.info/builds/203332]

```

org.apache.geode.internal.cache.PartitionedRegionClearWithAlterRegionDUnitTest 
> testClearRegionWhileChangingEntryIdleExpiration FAILED
 java.lang.AssertionError: An exception occurred during asynchronous invocation.
 at 
org.apache.geode.test.dunit.AsyncInvocation.checkException(AsyncInvocation.java:297)
 at org.apache.geode.test.dunit.AsyncInvocation.await(AsyncInvocation.java:448)
 at org.apache.geode.test.dunit.AsyncInvocation.await(AsyncInvocation.java:178)
 at 
org.apache.geode.internal.cache.PartitionedRegionClearWithAlterRegionDUnitTest.testClearRegionWhileChangingEntryIdleExpiration(PartitionedRegionClearWithAlterRegionDUnitTest.java:285)

Caused by:
 org.junit.ComparisonFailure: expected:<[0]> but was:<[1]>
 at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method)
 at 
jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
 at 
jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at 
org.apache.geode.internal.cache.PartitionedRegionClearWithAlterRegionDUnitTest.lambda$testClearRegionWhileChangingEntryIdleExpiration$f50cfc65$1(PartitionedRegionClearWithAlterRegionDUnitTest.java:281)

```

The code of dunit test can be find at 
[https://github.com/apache/geode/pull/5516]

  private void initialize() {
    server1 = VM.getVM(0);
    server2 = VM.getVM(1);

    server1.invoke(() -> {
      cacheRule.createCache();
      
cacheRule.getCache().createRegionFactory(RegionShortcut.PARTITION).setStatisticsEnabled(true)
          .create(REGION_NAME);
    });

    server2.invoke(() -> {
      cacheRule.createCache();
      
cacheRule.getCache().createRegionFactory(RegionShortcut.PARTITION).setStatisticsEnabled(true)
          .create(REGION_NAME);
    });

    server1.invoke(() -> {
      populateRegion();
      Region region = cacheRule.getCache().getRegion(REGION_NAME);
      assertThat(region.size()).isEqualTo(NUM_ENTRIES);
    });

    server2.invoke(() -> {
      Region region = cacheRule.getCache().getRegion(REGION_NAME);
      assertThat(region.size()).isEqualTo(NUM_ENTRIES);
    });
  }

  @Test 
  public void testClearRegionWhileChangingEntryIdleExpiration() throws 
InterruptedException {
    initialize();

    server1.invoke(() -> 
DistributionMessageObserver.setInstance(getDistributionMessageObserver()));

    AsyncInvocation asyncInvocation1 = server1.invokeAsync(() -> {
      Region region = cacheRule.getCache().getRegion(REGION_NAME);
      AttributesMutator attributesMutator = region.getAttributesMutator();
      ExpirationAttributes expirationAttributes =
          new ExpirationAttributes(1, ExpirationAction.DESTROY);
      getBlackboard().waitForGate(GATE_NAME);
      attributesMutator.setEntryIdleTimeout(expirationAttributes);
      
assertThat(region.getAttributes().getEntryIdleTimeout()).isEqualTo(expirationAttributes);
    });

    AsyncInvocation asyncInvocation2 = server2.invokeAsync(() -> {
      cacheRule.getCache().getRegion(REGION_NAME).clear();
      
assertThat(cacheRule.getCache().getRegion(REGION_NAME).size()).isEqualTo(0);
    });

    asyncInvocation1.await();
    asyncInvocation2.await();
  }


  was:
>From the stress test of a dunit test, 
>[https://concourse.apachegeode-ci.info/builds/203332]

```

org.apache.geode.internal.cache.PartitionedRegionClearWithAlterRegionDUnitTest 
> testClearRegionWhileChangingEntryIdleExpiration FAILED
 java.lang.AssertionError: An exception occurred during asynchronous invocation.
 at 
org.apache.geode.test.dunit.AsyncInvocation.checkException(AsyncInvocation.java:297)
 at org.apache.geode.test.dunit.AsyncInvocation.await(AsyncInvocation.java:448)
 at org.apache.geode.test.dunit.AsyncInvocation.await(AsyncInvocation.java:178)
 at 
org.apache.geode.internal.cache.PartitionedRegionClearWithAlterRegionDUnitTest.testClearRegionWhileChangingEntryIdleExpiration(PartitionedRegionClearWithAlterRegionDUnitTest.java:285)

Caused by:
 org.junit.ComparisonFailure: expected:<[0]> but was:<[1]>
 at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
Method)
 at 
jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
 at 
jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
 at 
org.apache.geode.internal.cache.PartitionedRegionClearWithAlterRegionDUnitTest.lambda$testClearRegionWhileChangingEntryIdleExpiration$f50cfc65$1(PartitionedRegionClearWithAlterRegionDUnitTest.java:281)

```

The code of dunit test can be find at https://github.com/apache/geode/pull/5516


> Partitioned region clear does not completely clear the region with concurrent 
> alteration of entry expiration time
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: GEODE-8680
>                 URL: https://issues.apache.org/jira/browse/GEODE-8680
>             Project: Geode
>          Issue Type: Bug
>            Reporter: Jianxia Chen
>            Priority: Major
>              Labels: GeodeOperationAPI
>
> From the stress test of a dunit test, 
> [https://concourse.apachegeode-ci.info/builds/203332]
> ```
> org.apache.geode.internal.cache.PartitionedRegionClearWithAlterRegionDUnitTest
>  > testClearRegionWhileChangingEntryIdleExpiration FAILED
>  java.lang.AssertionError: An exception occurred during asynchronous 
> invocation.
>  at 
> org.apache.geode.test.dunit.AsyncInvocation.checkException(AsyncInvocation.java:297)
>  at 
> org.apache.geode.test.dunit.AsyncInvocation.await(AsyncInvocation.java:448)
>  at 
> org.apache.geode.test.dunit.AsyncInvocation.await(AsyncInvocation.java:178)
>  at 
> org.apache.geode.internal.cache.PartitionedRegionClearWithAlterRegionDUnitTest.testClearRegionWhileChangingEntryIdleExpiration(PartitionedRegionClearWithAlterRegionDUnitTest.java:285)
> Caused by:
>  org.junit.ComparisonFailure: expected:<[0]> but was:<[1]>
>  at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native 
> Method)
>  at 
> jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
>  at 
> jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>  at 
> org.apache.geode.internal.cache.PartitionedRegionClearWithAlterRegionDUnitTest.lambda$testClearRegionWhileChangingEntryIdleExpiration$f50cfc65$1(PartitionedRegionClearWithAlterRegionDUnitTest.java:281)
> ```
> The code of dunit test can be find at 
> [https://github.com/apache/geode/pull/5516]
>   private void initialize() {
>     server1 = VM.getVM(0);
>     server2 = VM.getVM(1);
>     server1.invoke(() -> {
>       cacheRule.createCache();
>       
> cacheRule.getCache().createRegionFactory(RegionShortcut.PARTITION).setStatisticsEnabled(true)
>           .create(REGION_NAME);
>     });
>     server2.invoke(() -> {
>       cacheRule.createCache();
>       
> cacheRule.getCache().createRegionFactory(RegionShortcut.PARTITION).setStatisticsEnabled(true)
>           .create(REGION_NAME);
>     });
>     server1.invoke(() -> {
>       populateRegion();
>       Region region = cacheRule.getCache().getRegion(REGION_NAME);
>       assertThat(region.size()).isEqualTo(NUM_ENTRIES);
>     });
>     server2.invoke(() -> {
>       Region region = cacheRule.getCache().getRegion(REGION_NAME);
>       assertThat(region.size()).isEqualTo(NUM_ENTRIES);
>     });
>   }
>   @Test 
>   public void testClearRegionWhileChangingEntryIdleExpiration() throws 
> InterruptedException {
>     initialize();
>     server1.invoke(() -> 
> DistributionMessageObserver.setInstance(getDistributionMessageObserver()));
>     AsyncInvocation asyncInvocation1 = server1.invokeAsync(() -> {
>       Region region = cacheRule.getCache().getRegion(REGION_NAME);
>       AttributesMutator attributesMutator = region.getAttributesMutator();
>       ExpirationAttributes expirationAttributes =
>           new ExpirationAttributes(1, ExpirationAction.DESTROY);
>       getBlackboard().waitForGate(GATE_NAME);
>       attributesMutator.setEntryIdleTimeout(expirationAttributes);
>       
> assertThat(region.getAttributes().getEntryIdleTimeout()).isEqualTo(expirationAttributes);
>     });
>     AsyncInvocation asyncInvocation2 = server2.invokeAsync(() -> {
>       cacheRule.getCache().getRegion(REGION_NAME).clear();
>       
> assertThat(cacheRule.getCache().getRegion(REGION_NAME).size()).isEqualTo(0);
>     });
>     asyncInvocation1.await();
>     asyncInvocation2.await();
>   }



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to