@Override public Map<StashTimeKey, StashRunTimeInfo> getStashTimesForPlacement(String placement) { try { return _localCompactionControl.getStashTimesForPlacement(placement); } catch (Exception e) { _log.error("Failed to get all stash timestamps info for placement: {}", placement, e); throw Throwables.propagate(e); } } }
@GET @Path ("/stash-time") @RequiresPermissions ("system|comp_control") public Map<StashTimeKey, StashRunTimeInfo> getStashTimesForPlacement(@QueryParam ("placement") String placement) { return Strings.isNullOrEmpty(placement) ? _compactionControlSource.getAllStashTimes() : _compactionControlSource.getStashTimesForPlacement(placement); } }
private Expanded expand(final Record record, boolean ignoreRecent, final ReadConsistency consistency) { long fullConsistencyTimeStamp = _dataWriterDao.getFullConsistencyTimestamp(record.getKey().getTable()); long rawConsistencyTimeStamp = _dataWriterDao.getRawConsistencyTimestamp(record.getKey().getTable()); Map<StashTimeKey, StashRunTimeInfo> stashTimeInfoMap = _compactionControlSource.getStashTimesForPlacement(record.getKey().getTable().getAvailability().getPlacement()); // we will consider the earliest timestamp found as our compactionControlTimestamp. // we are also filtering out any expired timestamps. (CompactionControlMonitor should do this for us, but for now it's running every hour. So, just to fill that gap, we are filtering here.) // If no timestamps are found, then taking minimum value because we want all the deltas after the compactionControlTimestamp to be deleted as per the compaction rules as usual. long compactionControlTimestamp = stashTimeInfoMap.isEmpty() ? Long.MIN_VALUE : stashTimeInfoMap.values().stream().filter(s -> s.getExpiredTimestamp() > System.currentTimeMillis()).map(StashRunTimeInfo::getTimestamp).min(Long::compareTo).orElse(Long.MIN_VALUE); return expand(record, fullConsistencyTimeStamp, rawConsistencyTimeStamp, compactionControlTimestamp, ignoreRecent, consistency); }
private Expanded expand(final Record record, boolean ignoreRecent, final ReadConsistency consistency) { long fullConsistencyTimeStamp = _dataWriterDao.getFullConsistencyTimestamp(record.getKey().getTable()); long rawConsistencyTimeStamp = _dataWriterDao.getRawConsistencyTimestamp(record.getKey().getTable()); Map<StashTimeKey, StashRunTimeInfo> stashTimeInfoMap = _compactionControlSource.getStashTimesForPlacement(record.getKey().getTable().getAvailability().getPlacement()); // we will consider the earliest timestamp found as our compactionControlTimestamp. // we are also filtering out any expired timestamps. (CompactionControlMonitor should do this for us, but for now it's running every hour. So, just to fill that gap, we are filtering here.) // If no timestamps are found, then taking minimum value because we want all the deltas after the compactionControlTimestamp to be deleted as per the compaction rules as usual. long compactionControlTimestamp = stashTimeInfoMap.isEmpty() ? Long.MIN_VALUE : stashTimeInfoMap.values().stream().filter(s -> s.getExpiredTimestamp() > System.currentTimeMillis()).map(StashRunTimeInfo::getTimestamp).min(Long::compareTo).orElse(Long.MIN_VALUE); return expand(record, fullConsistencyTimeStamp, rawConsistencyTimeStamp, compactionControlTimestamp, ignoreRecent, consistency); }
Map<StashTimeKey, StashRunTimeInfo> stashTimeInfoMap = _compactionControlSource.getStashTimesForPlacement(placement); Instant cutoffTime = stashTimeInfoMap.values().stream() .map(StashRunTimeInfo::getTimestamp)