private static LocalMapOnDemandCalculatedStats getOrCreateOnDemandStats(Map<String, Object> onDemandStats, RecordStore recordStore) { String mapName = recordStore.getName(); Object stats = onDemandStats.get(mapName); if (stats == null) { stats = new LocalMapOnDemandCalculatedStats(); onDemandStats.put(mapName, stats); } return ((LocalMapOnDemandCalculatedStats) stats); }
/** * Calculates and adds replica partition stats. */ private void addReplicaStatsOf(RecordStore recordStore, LocalMapOnDemandCalculatedStats onDemandStats) { if (!hasRecords(recordStore)) { return; } long backupEntryCount = 0; long backupEntryMemoryCost = 0; int totalBackupCount = recordStore.getMapContainer().getTotalBackupCount(); for (int replicaNumber = 1; replicaNumber <= totalBackupCount; replicaNumber++) { int partitionId = recordStore.getPartitionId(); Address replicaAddress = getReplicaAddress(partitionId, replicaNumber, totalBackupCount); if (!isReplicaAvailable(replicaAddress, totalBackupCount)) { printWarning(partitionId, replicaNumber); continue; } if (isReplicaOnThisNode(replicaAddress)) { backupEntryMemoryCost += recordStore.getOwnedEntryCost(); backupEntryCount += recordStore.size(); } } if (NATIVE != recordStore.getMapContainer().getMapConfig().getInMemoryFormat()) { onDemandStats.incrementHeapCost(backupEntryMemoryCost); } onDemandStats.incrementBackupEntryMemoryCost(backupEntryMemoryCost); onDemandStats.incrementBackupEntryCount(backupEntryCount); onDemandStats.setBackupCount(recordStore.getMapContainer().getMapConfig().getTotalBackupCount()); }
/** * Calculates and adds replica partition stats. */ private void addReplicaStatsOf(RecordStore recordStore, LocalMapOnDemandCalculatedStats onDemandStats) { if (!hasRecords(recordStore)) { return; } long backupEntryCount = 0; long backupEntryMemoryCost = 0; int totalBackupCount = recordStore.getMapContainer().getTotalBackupCount(); for (int replicaNumber = 1; replicaNumber <= totalBackupCount; replicaNumber++) { int partitionId = recordStore.getPartitionId(); Address replicaAddress = getReplicaAddress(partitionId, replicaNumber, totalBackupCount); if (!isReplicaAvailable(replicaAddress, totalBackupCount)) { printWarning(partitionId, replicaNumber); continue; } if (isReplicaOnThisNode(replicaAddress)) { backupEntryMemoryCost += recordStore.getOwnedEntryCost(); backupEntryCount += recordStore.size(); } } if (NATIVE != recordStore.getMapContainer().getMapConfig().getInMemoryFormat()) { onDemandStats.incrementHeapCost(backupEntryMemoryCost); } onDemandStats.incrementBackupEntryMemoryCost(backupEntryMemoryCost); onDemandStats.incrementBackupEntryCount(backupEntryCount); onDemandStats.setBackupCount(recordStore.getMapContainer().getMapConfig().getTotalBackupCount()); }
private static void addPrimaryStatsOf(RecordStore recordStore, LocalMapOnDemandCalculatedStats onDemandStats) { if (!hasRecords(recordStore)) { return; } LocalRecordStoreStats stats = recordStore.getLocalRecordStoreStats(); onDemandStats.incrementLockedEntryCount(recordStore.getLockedEntryCount()); onDemandStats.incrementHits(stats.getHits()); onDemandStats.incrementDirtyEntryCount(recordStore.getMapDataStore().notFinishedOperationsCount()); onDemandStats.incrementOwnedEntryMemoryCost(recordStore.getOwnedEntryCost()); if (NATIVE != recordStore.getMapContainer().getMapConfig().getInMemoryFormat()) { onDemandStats.incrementHeapCost(recordStore.getOwnedEntryCost()); } onDemandStats.incrementOwnedEntryCount(recordStore.size()); onDemandStats.setLastAccessTime(stats.getLastAccessTime()); onDemandStats.setLastUpdateTime(stats.getLastUpdateTime()); onDemandStats.setBackupCount(recordStore.getMapContainer().getMapConfig().getTotalBackupCount()); }
private static void addPrimaryStatsOf(RecordStore recordStore, LocalMapOnDemandCalculatedStats onDemandStats) { if (!hasRecords(recordStore)) { return; } LocalRecordStoreStats stats = recordStore.getLocalRecordStoreStats(); onDemandStats.incrementLockedEntryCount(recordStore.getLockedEntryCount()); onDemandStats.incrementHits(stats.getHits()); onDemandStats.incrementDirtyEntryCount(recordStore.getMapDataStore().notFinishedOperationsCount()); onDemandStats.incrementOwnedEntryMemoryCost(recordStore.getOwnedEntryCost()); if (NATIVE != recordStore.getMapContainer().getMapConfig().getInMemoryFormat()) { onDemandStats.incrementHeapCost(recordStore.getOwnedEntryCost()); } onDemandStats.incrementOwnedEntryCount(recordStore.size()); onDemandStats.setLastAccessTime(stats.getLastAccessTime()); onDemandStats.setLastUpdateTime(stats.getLastUpdateTime()); onDemandStats.setBackupCount(recordStore.getMapContainer().getMapConfig().getTotalBackupCount()); }
private void addNearCacheStats(String mapName, LocalMapStatsImpl localMapStats, LocalMapOnDemandCalculatedStats onDemandStats) { NearCache nearCache = mapNearCacheManager.getNearCache(mapName); if (nearCache == null) { return; } NearCacheStats nearCacheStats = nearCache.getNearCacheStats(); localMapStats.setNearCacheStats(nearCacheStats); if (NATIVE != nearCache.getInMemoryFormat()) { onDemandStats.incrementHeapCost(nearCacheStats.getOwnedEntryMemoryCost()); } }
public LocalMapStatsImpl createLocalMapStats(String mapName) { LocalMapStatsImpl stats = getLocalMapStatsImpl(mapName); LocalMapOnDemandCalculatedStats onDemandStats = new LocalMapOnDemandCalculatedStats(); addNearCacheStats(mapName, stats, onDemandStats); addIndexStats(mapName, stats); updateMapOnDemandStats(mapName, onDemandStats); return onDemandStats.updateAndGet(stats); }
private static LocalMapOnDemandCalculatedStats getOrCreateOnDemandStats(Map<String, Object> onDemandStats, RecordStore recordStore) { String mapName = recordStore.getName(); Object stats = onDemandStats.get(mapName); if (stats == null) { stats = new LocalMapOnDemandCalculatedStats(); onDemandStats.put(mapName, stats); } return ((LocalMapOnDemandCalculatedStats) stats); }
public LocalMapStatsImpl createLocalMapStats(String mapName) { LocalMapStatsImpl stats = getLocalMapStatsImpl(mapName); LocalMapOnDemandCalculatedStats onDemandStats = new LocalMapOnDemandCalculatedStats(); addNearCacheStats(mapName, stats, onDemandStats); addIndexStats(mapName, stats); updateMapOnDemandStats(mapName, onDemandStats); return onDemandStats.updateAndGet(stats); }
private void addNearCacheStats(String mapName, LocalMapStatsImpl localMapStats, LocalMapOnDemandCalculatedStats onDemandStats) { NearCache nearCache = mapNearCacheManager.getNearCache(mapName); if (nearCache == null) { return; } NearCacheStats nearCacheStats = nearCache.getNearCacheStats(); localMapStats.setNearCacheStats(nearCacheStats); onDemandStats.incrementHeapCost(nearCacheStats.getOwnedEntryMemoryCost()); }