wchevreuil commented on a change in pull request #348: HBASE-22643 : Delete
region without archiving only if regiondir is pr…
URL: https://github.com/apache/hbase/pull/348#discussion_r302562480
##########
File path:
hbase-server/src/test/java/org/apache/hadoop/hbase/backup/TestHFileArchiving.java
##########
@@ -526,6 +526,36 @@ public void testCleaningRace() throws Exception {
}
}
+ @Test
+ public void testUnDeletedRegionWithoutArchive() throws IOException {
+ Path regionDir = new Path(FSUtils.getTableDir(new Path("./"),
+ TableName.valueOf(name.getMethodName())), "abcdef");
+ Path familyDir = new Path(regionDir, "cf");
+ Path rootDir = UTIL.getDataTestDirOnTestFS("testCleaningRace");
+ Path file = new Path(familyDir, "0");
+ Path sourceFile = new Path(rootDir, file);
+ FileSystem fileSystem = UTIL.getTestFileSystem();
+ fileSystem.createNewFile(sourceFile);
+ // Try to archive the file but with null regionDir, can't delete sourceFile
+ assertFalse(HFileArchiver.archiveRegion(fileSystem, null, null, null));
Review comment:
We are passing _null_ to all params, apart from the _FileSystem_ instance,
so no need to create all these variables on line #531 to #536, unless you
wanted to add an extra validation that this _sourceFile_ created on line #538
is not deleted by the test. I think it's irrelevant as we clearly never pass
any information about this file to the tested method.
----------------------------------------------------------------
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