Juan Ramos created GEODE-7764:
---------------------------------
Summary: LastModifiedTime not updated for Destroy/Remove
Key: GEODE-7764
URL: https://issues.apache.org/jira/browse/GEODE-7764
Project: Geode
Issue Type: Bug
Components: regions, statistics
Reporter: Juan Ramos
This issue was raised through
[this|https://stackoverflow.com/questions/54764977/why-is-lastmodifiedtime-in-distributedregionmxbean-is-not-updated-if-data-is-del]
StackOverflow question, basically the `lastModifiedTime` is not updated after
a `destroy`/`remove` operation.
The following test can be used to consistently reproduce the issue:
{code}
@Category(OQLQueryTest.class)
@RunWith(JUnitParamsRunner.class)
public class StackOverflowTests {
private static final String REGION_NAME = "testRegion";
@Rule
public ServerStarterRule server = new
ServerStarterRule().withJMXManager().withAutoStart();
private Region<String, String> setUpRegion(RegionShortcut regionShortcut) {
return server.getCache().<String, String>createRegionFactory(regionShortcut)
.setStatisticsEnabled(true)
.create(REGION_NAME);
}
@Test
@Parameters({"REPLICATE", "PARTITION"})
public void lastModifiedTimeForRemove(RegionShortcut regionShortcut) {
Region<String, String> region = setUpRegion(regionShortcut);
long initialLastModifiedTime = region.getStatistics().getLastModifiedTime();
region.put("key1", "value1");
await()
.atMost(1, TimeUnit.MINUTES)
.untilAsserted(() ->
assertThat(region.getStatistics().getLastModifiedTime()).isGreaterThan(initialLastModifiedTime));
long lLastModifiedTimeAfterPut =
region.getStatistics().getLastModifiedTime();
region.remove("key1");
await()
.atMost(1, TimeUnit.MINUTES)
.untilAsserted(() ->
assertThat(region.getStatistics().getLastModifiedTime()).isGreaterThan(lLastModifiedTimeAfterPut));
}
@Test
@Parameters({"REPLICATE", "PARTITION"})
public void lastModifiedTimeForDestroy(RegionShortcut regionShortcut) {
Region<String, String> region = setUpRegion(regionShortcut);
long initialLastModifiedTime = region.getStatistics().getLastModifiedTime();
region.put("key1", "value1");
await()
.atMost(1, TimeUnit.MINUTES)
.untilAsserted(() ->
assertThat(region.getStatistics().getLastModifiedTime()).isGreaterThan(initialLastModifiedTime));
long lLastModifiedTimeAfterPut =
region.getStatistics().getLastModifiedTime();
region.destroy("key1");
await()
.atMost(1, TimeUnit.MINUTES)
.untilAsserted(() ->
assertThat(region.getStatistics().getLastModifiedTime()).isGreaterThan(lLastModifiedTimeAfterPut));
}
}
{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)