steveloughran 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_r306282623
##########
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:
are there more checks we could add here? e.g. what will getFileStatus do? As
even in auth mode, I'd expect success.
once HADOOP-16380 is in, we can also add a test for a tombstone blocking the
empy dir here too, that is: even with the TS, we shouldn't get an empty dir in
that parent listing, even before the tombstone has expired
----------------------------------------------------------------
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]