use of org.apache.ignite.internal.processors.cache.persistence.checkpoint.EarliestCheckpointMapSnapshot.GroupStateSnapshot in project ignite by apache.
the class CheckpointHistory method earliestCheckpointsMapSnapshot.
/**
* Creates a snapshot of {@link #earliestCp} map.
* Guarded by checkpoint read lock.
*
* @return Snapshot of a map.
*/
public EarliestCheckpointMapSnapshot earliestCheckpointsMapSnapshot() {
Map<UUID, Map<Integer, GroupStateSnapshot>> data = new HashMap<>();
synchronized (earliestCp) {
Collection<CheckpointEntry> values = earliestCp.values();
for (CheckpointEntry cp : values) {
UUID checkpointId = cp.checkpointId();
if (data.containsKey(checkpointId))
continue;
Map<Integer, GroupState> map = cp.groupStates();
if (map != null) {
Map<Integer, GroupStateSnapshot> groupStates = new HashMap<>();
map.forEach((k, v) -> groupStates.put(k, new GroupStateSnapshot(v.partitionIds(), v.partitionCounters(), v.size())));
data.put(checkpointId, groupStates);
}
}
}
Set<UUID> ids = histMap.values().stream().map(CheckpointEntry::checkpointId).collect(Collectors.toSet());
return new EarliestCheckpointMapSnapshot(ids, data);
}
use of org.apache.ignite.internal.processors.cache.persistence.checkpoint.EarliestCheckpointMapSnapshot.GroupStateSnapshot in project gridgain by gridgain.
the class CheckpointHistory method earliestCheckpointsMapSnapshot.
/**
* Creates a snapshot of {@link #earliestCp} map.
* Guarded by checkpoint read lock.
*
* @return Snapshot of a map.
*/
public EarliestCheckpointMapSnapshot earliestCheckpointsMapSnapshot() {
Map<UUID, Map<Integer, GroupStateSnapshot>> data = new HashMap<>();
synchronized (earliestCp) {
Collection<CheckpointEntry> values = earliestCp.values();
for (CheckpointEntry cp : values) {
UUID checkpointId = cp.checkpointId();
if (data.containsKey(checkpointId))
continue;
Map<Integer, GroupState> map = cp.groupStates();
if (map != null) {
Map<Integer, GroupStateSnapshot> groupStates = new HashMap<>();
map.forEach((k, v) -> groupStates.put(k, new GroupStateSnapshot(v.partitionIds(), v.partitionCounters(), v.size())));
data.put(checkpointId, groupStates);
}
}
}
Set<UUID> ids = histMap.values().stream().map(CheckpointEntry::checkpointId).collect(Collectors.toSet());
return new EarliestCheckpointMapSnapshot(ids, data);
}
Aggregations