HBASE-17243 Reuse CompactionPartitionId and avoid creating MobFileName in PartitionedMobCompactor to avoid unnecessary new objects (addendum)

Signed-off-by: Matteo Bertozzi <matteo.bertozzi@cloudera.com>
This commit is contained in:
Huaxiang Sun 2016-12-03 07:18:36 -08:00 committed by Matteo Bertozzi
parent efcd15bf67
commit 03423fec6b
1 changed files with 4 additions and 3 deletions

View File

@ -176,10 +176,11 @@ public class PartitionedMobCompactor extends MobCompactor {
id.setDate(MobFileName.getDateFromName(fileName));
CompactionPartition compactionPartition = filesToCompact.get(id);
if (compactionPartition == null) {
compactionPartition = new CompactionPartition(
new CompactionPartitionId(id.getStartKey(), id.getDate()));
CompactionPartitionId newId = new CompactionPartitionId(id.getStartKey(), id.getDate());
compactionPartition = new CompactionPartition(newId);
compactionPartition.addFile(file);
filesToCompact.put(id, compactionPartition);
filesToCompact.put(newId, compactionPartition);
} else {
compactionPartition.addFile(file);
}