use of com.hazelcast.internal.monitor.LocalRecordStoreStats in project hazelcast by hazelcast.
the class LocalMapStatsProvider method addStatsOfPrimaryReplica.
private static void addStatsOfPrimaryReplica(RecordStore recordStore, LocalMapOnDemandCalculatedStats onDemandStats) {
LocalRecordStoreStats stats = recordStore.getLocalRecordStoreStats();
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());
// we need to update the locked entry count here whether or not the map is empty
// keys that are not contained by a map can be locked
onDemandStats.incrementLockedEntryCount(recordStore.getLockedEntryCount());
}
use of com.hazelcast.internal.monitor.LocalRecordStoreStats in project hazelcast by hazelcast.
the class MapReplicationStateHolder method applyState.
@SuppressWarnings({ "checkstyle:npathcomplexity", "checkstyle:methodlength", "checkstyle:cyclomaticcomplexity", "checkstyle:nestedifdepth" })
void applyState() {
ThreadUtil.assertRunningOnPartitionThread();
applyIndexesState();
if (!isNullOrEmpty(data)) {
for (Map.Entry<String, List> dataEntry : data.entrySet()) {
String mapName = dataEntry.getKey();
List keyRecordExpiry = dataEntry.getValue();
RecordStore recordStore = operation.getRecordStore(mapName);
recordStore.beforeOperation();
try {
initializeRecordStore(mapName, recordStore);
recordStore.setPreMigrationLoadedStatus(loaded.get(mapName));
MapContainer mapContainer = recordStore.getMapContainer();
PartitionContainer partitionContainer = recordStore.getMapContainer().getMapServiceContext().getPartitionContainer(operation.getPartitionId());
for (Map.Entry<String, IndexConfig> indexDefinition : mapContainer.getIndexDefinitions().entrySet()) {
Indexes indexes = mapContainer.getIndexes(partitionContainer.getPartitionId());
indexes.addOrGetIndex(indexDefinition.getValue());
}
final Indexes indexes = mapContainer.getIndexes(partitionContainer.getPartitionId());
final boolean populateIndexes = indexesMustBePopulated(indexes, operation);
InternalIndex[] indexesSnapshot = null;
if (populateIndexes) {
// defensively clear possible stale leftovers in non-global indexes from
// the previous failed promotion attempt
indexesSnapshot = indexes.getIndexes();
Indexes.beginPartitionUpdate(indexesSnapshot);
indexes.clearAll();
}
long nowInMillis = Clock.currentTimeMillis();
forEachReplicatedRecord(keyRecordExpiry, mapContainer, recordStore, populateIndexes, nowInMillis);
if (populateIndexes) {
Indexes.markPartitionAsIndexed(partitionContainer.getPartitionId(), indexesSnapshot);
}
} finally {
recordStore.afterOperation();
}
}
}
for (Map.Entry<String, LocalRecordStoreStats> statsEntry : recordStoreStatsPerMapName.entrySet()) {
String mapName = statsEntry.getKey();
LocalRecordStoreStats stats = statsEntry.getValue();
RecordStore recordStore = operation.getRecordStore(mapName);
recordStore.setStats(stats);
}
}
Aggregations