Source:
private void collectData(File[] replicas, ArrayList<String> replicasList, Map<String, BlobStatus> blobIdToStatusMap, AtomicLong totalKeysProcessed) throws Exception { DumpIndexTool dumpIndexTool = new DumpIndexTool(verifiableProperties); IndexStats indexStats = new IndexStats(); for (File replica : replicas) { try { File[] indexFiles = replica.listFiles(PersistentIndex.INDEX_SEGMENT_FILE_FILTER); long keysProcessedforReplica = 0; Arrays.sort(indexFiles, PersistentIndex.INDEX_SEGMENT_FILE_COMPARATOR); int totalIndexCount = indexFiles.length; int currentIndexCount = 0; logger.info("Processing index files for replica " + replica.getName()); for (File indexFile : indexFiles) { keysProcessedforReplica += dumpIndexTool.dumpIndex(indexFile, replica.getName(), replicasList, new ArrayList<String>(), blobIdToStatusMap, indexStats, false, currentIndexCount++ >= (totalIndexCount - 2)); } logger.debug("Total keys processed for is {}", replica.getName(), keysProcessedforReplica); totalKeysProcessed.addAndGet(keysProcessedforReplica); } catch (Exception e) { logger.error("Could not complete processing for {}", replica, e); } } logger.debug("Total Keys Processed {}", totalKeysProcessed.get()); logger.debug("Total Put Records {}", indexStats.getTotalPutRecords().get()); logger.debug("Total Delete Records {}", indexStats.getTotalDeleteRecords().get()); logger.debug("Total Duplicate Put Records {}", indexStats.getTotalDuplicatePutRecords().get()); logger.debug("Total Delete before Put Records {}", indexStats.getTotalDeleteBeforePutRecords().get()); logger.debug("Total Put after Delete Records {}", indexStats.getTotalPutAfterDeleteRecords().get()); logger.debug("Total Duplicate Delete Records {}", indexStats.getTotalDuplicateDeleteRecords().get()); }

Target:
private void collectData(File[] replicas, ArrayList<String> replicasList, Map<String, BlobStatus> blobIdToStatusMap, AtomicLong totalKeysProcessed) throws Exception { DumpIndexTool dumpIndexTool = new DumpIndexTool(verifiableProperties, metrics); Time time = SystemTime.getInstance(); long currentTimeInMs = time.milliseconds(); IndexStats indexStats = new IndexStats(); for (File replica : replicas) { try { File[] indexFiles = replica.listFiles(PersistentIndex.INDEX_SEGMENT_FILE_FILTER); long keysProcessedforReplica = 0; Arrays.sort(indexFiles, PersistentIndex.INDEX_SEGMENT_FILE_COMPARATOR); logger.info("Processing index files for replica ", replica.getName()); for (int i = 0; i < indexFiles.length; i++) { keysProcessedforReplica += dumpIndexTool.dumpIndex(indexFiles[i], replica.getName(), replicasList, new ArrayList<String>(), blobIdToStatusMap, indexStats, i >= (indexFiles.length - 2), time, currentTimeInMs); } logger.debug("Total keys processed for is {}", replica.getName(), keysProcessedforReplica); totalKeysProcessed.addAndGet(keysProcessedforReplica); } catch (Exception e) { logger.error("Could not complete processing for {}", replica, e); } } logger.debug("Total Keys Processed {}", totalKeysProcessed.get()); logger.debug("Total Put Records {}", indexStats.getTotalPutRecords().get()); logger.debug("Total Delete Records {}", indexStats.getTotalDeleteRecords().get()); logger.debug("Total Duplicate Put Records {}", indexStats.getTotalDuplicatePutRecords().get()); logger.debug("Total Delete before Put Records {}", indexStats.getTotalDeleteBeforePutRecords().get()); logger.debug("Total Put after Delete Records {}", indexStats.getTotalPutAfterDeleteRecords().get()); logger.debug("Total Duplicate Delete Records {}", indexStats.getTotalDuplicateDeleteRecords().get()); }