nabarunnag commented on a change in pull request #6042:
URL: https://github.com/apache/geode/pull/6042#discussion_r580450722
##########
File path:
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/versions/TombstoneDUnitTest.java
##########
@@ -144,6 +145,75 @@ public void testGetOldestTombstoneTimeReplicate() {
});
}
+ @Test
+ public void testRewriteBadOldestTombstoneTimeReplicateForTimestamp() {
+ VM server1 = VM.getVM(-1);
+ VM server2 = VM.getVM(1);
+
+ final int count = 10;
+
+ server1.invoke(() -> {
+ createCacheAndRegion(RegionShortcut.REPLICATE_PERSISTENT);
+ for (int i = 0; i < count; i++) {
+ region.put("K" + i, "V" + i);
+ }
+ });
+
+ server2.invoke(() -> createCacheAndRegion(RegionShortcut.REPLICATE));
+
+ server1.invoke(() -> {
+ TombstoneService.TombstoneSweeper tombstoneSweeper =
+ ((InternalCache)
cache).getTombstoneService().getSweeper((LocalRegion) region);
+
+ RegionEntry regionEntry = ((LocalRegion) region).getRegionEntry("K0");
+ VersionTag<?> versionTag = regionEntry.getVersionStamp()
+ .asVersionTag();
+ versionTag.setVersionTimeStamp(System.currentTimeMillis() + 100000);
+ TombstoneService.Tombstone modifiedTombstone =
+ new TombstoneService.Tombstone(regionEntry, (LocalRegion) region,
+ versionTag);
+ tombstoneSweeper.tombstones.add(modifiedTombstone);
+ if (tombstoneSweeper.getOldestTombstoneTime() > 0) {
+ System.out.println("We have a problem");
Review comment:
assert checks instead of System outs
##########
File path:
geode-core/src/main/java/org/apache/geode/internal/cache/TombstoneService.java
##########
@@ -749,7 +751,8 @@ protected boolean hasExpired(long
msTillHeadTombstoneExpires) {
testHook_forceExpirationCount--;
return true;
}
- return msTillHeadTombstoneExpires <= 0;
+ // In case
+ return msTillHeadTombstoneExpires <= 0 || msTillHeadTombstoneExpires >
EXPIRY_TIME;
Review comment:
I maybe missing the math but long msTillHeadTombstoneExpires =
oldest.getVersionTimeStamp() + EXPIRY_TIME - now;
the only time msTillHeadTombstoneExpires is greater than EXPIRY_TIME will be
when oldest.timeStamp - now is a postive number. Can this occur?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]