apurtell commented on code in PR #4403:
URL: https://github.com/apache/hbase/pull/4403#discussion_r878728373
##########
hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterChoreScheduled.java:
##########
@@ -63,15 +64,17 @@ public static void tearDown() throws Exception {
}
@Test
- public void testDefaultScheduledChores() {
+ public void testDefaultScheduledChores() throws Exception{
// test if logCleaner chore is scheduled by default in HMaster init
TestChoreField<LogCleaner> logCleanerTestChoreField = new
TestChoreField<>();
LogCleaner logCleaner = logCleanerTestChoreField.getChoreObj("logCleaner");
logCleanerTestChoreField.testIfChoreScheduled(logCleaner);
// test if hfileCleaner chore is scheduled by default in HMaster init
TestChoreField<HFileCleaner> hFileCleanerTestChoreField = new
TestChoreField<>();
- HFileCleaner hFileCleaner =
hFileCleanerTestChoreField.getChoreObj("hfileCleaner");
+ Field masterField = HMaster.class.getDeclaredField("hfileCleaners");
+ masterField.setAccessible(true);
+ HFileCleaner hFileCleaner = ((LinkedList<HFileCleaner>)
masterField.get(hMaster)).getFirst();
Review Comment:
If opting for ArrayList this would be `.get(0)`
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java:
##########
@@ -378,12 +381,18 @@ public class HMaster extends
HBaseServerBase<MasterRpcServices> implements Maste
private HbckChore hbckChore;
CatalogJanitor catalogJanitorChore;
- // Threadpool for scanning the archive directory, used by the HFileCleaner
- private DirScanPool hfileCleanerPool;
// Threadpool for scanning the Old logs directory, used by the LogCleaner
private DirScanPool logCleanerPool;
private LogCleaner logCleaner;
- private HFileCleaner hfileCleaner;
+ // HFile cleaners for the custom hfile archive paths and the default archive
path
+ // The archive path cleaner is the first element
+ private LinkedList<HFileCleaner> hfileCleaners = new LinkedList<>();
Review Comment:
The choice of LinkedList will trigger some static analysis tools to warn it
is almost always a poor choice. In my opinion the use of LinkedList here makes
sense but ArrayList would avoid that issue. Just a suggestion.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]