use of org.apache.ignite.internal.processors.cache.persistence.checkpoint.ReservationReason in project ignite by apache.
the class GridCacheDatabaseSharedManager method printReservationToLog.
/**
* Prints detail information about caches which were not reserved
* and reservation depth for the caches which have WAL history enough.
*
* @param earliestValidCheckpoints Map contains information about caches' reservation.
*/
private void printReservationToLog(Map<Integer, T2<ReservationReason, Map<Integer, CheckpointEntry>>> earliestValidCheckpoints) {
try {
Map<ReservationReason, List<Integer>> notReservedCachesToPrint = new HashMap<>();
Map<ReservationReason, List<T2<Integer, CheckpointEntry>>> reservedCachesToPrint = new HashMap<>();
for (Map.Entry<Integer, T2<ReservationReason, Map<Integer, CheckpointEntry>>> entry : earliestValidCheckpoints.entrySet()) {
if (entry.getValue().get2() == null) {
notReservedCachesToPrint.computeIfAbsent(entry.getValue().get1(), reason -> new ArrayList<>()).add(entry.getKey());
} else {
reservedCachesToPrint.computeIfAbsent(entry.getValue().get1(), reason -> new ArrayList<>()).add(new T2(entry.getKey(), entry.getValue().get2().values().stream().min(Comparator.comparingLong(CheckpointEntry::timestamp)).get()));
}
}
if (!F.isEmpty(notReservedCachesToPrint)) {
log.info("Cache groups were not reserved [" + notReservedCachesToPrint.entrySet().stream().map(entry -> '[' + entry.getValue().stream().map(grpId -> "[grpId=" + grpId + ", grpName=" + cctx.cache().cacheGroup(grpId).cacheOrGroupName() + ']').collect(Collectors.joining(", ")) + ", reason=" + entry.getKey() + ']').collect(Collectors.joining(", ")) + ']');
}
if (!F.isEmpty(reservedCachesToPrint)) {
log.info("Cache groups with earliest reserved checkpoint and a reason why a previous checkpoint was inapplicable: [" + reservedCachesToPrint.entrySet().stream().map(entry -> '[' + entry.getValue().stream().map(grpCp -> "[grpId=" + grpCp.get1() + ", grpName=" + cctx.cache().cacheGroup(grpCp.get1()).cacheOrGroupName() + ", cp=(" + grpCp.get2().checkpointId() + ", " + U.format(grpCp.get2().timestamp()) + ")]").collect(Collectors.joining(", ")) + ", reason=" + entry.getKey() + ']').collect(Collectors.joining(", ")) + ']');
}
} catch (Exception e) {
log.error("An error happened during printing partitions that were reserved for potential historical rebalance.", e);
}
}
Aggregations