Source:
private Map<String, Map<String, Long>> collectValidDataSizeByContainer(long referenceTimeInMs) throws StoreException { logger.trace("On demand index scanning to collect container valid data sizes wrt ref time " + referenceTimeInMs); long startTimeMs = time.milliseconds(); Map<StoreKey, Long> deletedKeys = new HashMap<>(); Map<String, Map<String, Long>> validDataSizePerContainer = new HashMap<>(); int indexSegmentCount = 0; for (IndexSegment indexSegment : index.getIndexSegments().descendingMap().values()) { if (!enabled.get()) { throw new StoreException(String.format("BlobStoreStats is not enabled or closing for store %s", storeId), StoreErrorCodes.Store_Shutting_Down); } long indexSegmentStartProcessTimeMs = time.milliseconds(); List<IndexEntry> validIndexEntries = getValidIndexEntries(indexSegment, getIndexEntries(indexSegment), referenceTimeInMs, deletedKeys); for (IndexEntry indexEntry : validIndexEntries) { IndexValue indexValue = indexEntry.getValue(); if (!indexValue.isFlagSet(IndexValue.Flags.Delete_Index)) { updateNestedMapHelper(validDataSizePerContainer, String.valueOf(indexValue.getServiceId()), String.valueOf(indexValue.getContainerId()), indexValue.getSize()); } } metrics.statsOnDemandScanTimePerIndexSegmentMs.update(time.milliseconds() - indexSegmentStartProcessTimeMs, TimeUnit.MILLISECONDS); indexSegmentCount++; if (indexSegmentCount == 1) { logger.info("Completed scanning of 1st index segment by on-demand scanning " + indexSegment); } if (indexSegmentCount % 10 == 0) { logger.info("Completed scanning batch of 10 index segments by on-demand scanning " + indexSegment); } } metrics.statsOnDemandScanTotalTimeMs.update(time.milliseconds() - startTimeMs, TimeUnit.MILLISECONDS); return validDataSizePerContainer; }

Target:
private Map<String, Map<String, Long>> collectValidDataSizeByContainer(long referenceTimeInMs) throws StoreException { logger.trace("On demand index scanning to collect container valid data sizes wrt ref time {}", referenceTimeInMs); long startTimeMs = time.milliseconds(); Map<StoreKey, Long> deletedKeys = new HashMap<>(); Map<String, Map<String, Long>> validDataSizePerContainer = new HashMap<>(); int indexSegmentCount = 0; for (IndexSegment indexSegment : index.getIndexSegments().descendingMap().values()) { if (!enabled.get()) { throw new StoreException(String.format("BlobStoreStats is not enabled or closing for store %s", storeId), StoreErrorCodes.Store_Shutting_Down); } long indexSegmentStartProcessTimeMs = time.milliseconds(); List<IndexEntry> validIndexEntries = getValidIndexEntries(indexSegment, getIndexEntries(indexSegment), referenceTimeInMs, deletedKeys); for (IndexEntry indexEntry : validIndexEntries) { IndexValue indexValue = indexEntry.getValue(); if (!indexValue.isFlagSet(IndexValue.Flags.Delete_Index)) { updateNestedMapHelper(validDataSizePerContainer, String.valueOf(indexValue.getServiceId()), String.valueOf(indexValue.getContainerId()), indexValue.getSize()); } } metrics.statsOnDemandScanTimePerIndexSegmentMs.update(time.milliseconds() - indexSegmentStartProcessTimeMs, TimeUnit.MILLISECONDS); indexSegmentCount++; if (indexSegmentCount == 1 || indexSegmentCount % 10 == 0) { logger.info("Index segment processing (on-demand scanning) for container stats complete for {}", indexSegment); } } metrics.statsOnDemandScanTotalTimeMs.update(time.milliseconds() - startTimeMs, TimeUnit.MILLISECONDS); return validDataSizePerContainer; }