bgaborg commented on a change in pull request #1134: HADOOP-16433. S3Guard:
Filter expired entries and tombstones when lis…
URL: https://github.com/apache/hadoop/pull/1134#discussion_r306683463
##########
File path:
hadoop-tools/hadoop-aws/src/test/java/org/apache/hadoop/fs/s3a/ITestS3GuardOutOfBandOperations.java
##########
@@ -538,6 +540,47 @@ public void deleteAfterTombstoneExpiryOobCreate() throws
Exception {
}
}
+ /**
+ * Test that a tombstone won't hide an entry after it's expired in the
+ * listing.
+ */
+ @Test
+ public void testRootTombstones() throws Exception {
+ long ttl = 10L;
+ ITtlTimeProvider mockTimeProvider = mock(ITtlTimeProvider.class);
+ when(mockTimeProvider.getMetadataTtl()).thenReturn(ttl);
+ when(mockTimeProvider.getNow()).thenReturn(100L);
+ ITtlTimeProvider originalTimeProvider = guardedFs.getTtlTimeProvider();
+ guardedFs.setTtlTimeProvider(mockTimeProvider);
+
+ Path base = path(getMethodName() + UUID.randomUUID());
+ Path testFile = new Path(base, "test.file");
+
+ try {
+ touch(guardedFs, testFile);
+ ContractTestUtils.assertDeleted(guardedFs, testFile, false);
+
+ touch(rawFS, testFile);
+ awaitFileStatus(rawFS, testFile);
+
+ // the rawFS will include the file=
+ LambdaTestUtils.eventually(5000, 1000, () -> {
+ checkListingContainsPath(rawFS, testFile);
+ });
+
+ // it will be hidden because of the tombstone
+ checkListingDoesNotContainPath(guardedFs, testFile);
Review comment:
I'd prefer `Preconditions.checkArgument(lastUpdated >=0`. Better fail fast
if something's wrong. We don't need to be that failproof here.
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]