private static void purgeAnalyses(PurgeCommands commands, String rootUuid) { List<IdUuidPair> analysisUuids = commands.selectSnapshotIdUuids( new PurgeSnapshotQuery() .setComponentUuid(rootUuid) .setIslast(false) .setNotPurged(true)); commands.purgeAnalyses(analysisUuids); }
private static void deleteAbortedAnalyses(String rootUuid, PurgeCommands commands) { LOG.debug("<- Delete aborted builds"); PurgeSnapshotQuery query = new PurgeSnapshotQuery() .setIslast(false) .setStatus(UNPROCESSED_STATUS) .setComponentUuid(rootUuid); commands.deleteAnalyses(query); }
private void deleteDataOfComponentsWithoutHistoricalData(DbSession dbSession, String rootUuid, Collection<String> scopesWithoutHistoricalData, PurgeCommands purgeCommands) { if (scopesWithoutHistoricalData.isEmpty()) { return; } List<String> analysisUuids = purgeCommands.selectSnapshotUuids( new PurgeSnapshotQuery() .setComponentUuid(rootUuid) .setIslast(false) .setNotPurged(true)); List<String> componentWithoutHistoricalDataUuids = componentDao .selectDescendants( dbSession, ComponentTreeQuery.builder() .setBaseUuid(rootUuid) .setScopes(scopesWithoutHistoricalData) .setStrategy(Strategy.LEAVES) .build()) .stream().map(ComponentDto::uuid) .collect(MoreCollectors.toList()); purgeCommands.deleteComponentMeasures(analysisUuids, componentWithoutHistoricalDataUuids); }
void deleteAnalyses(String rootComponentUuid) { profiler.start("deleteAnalyses (event_component_changes)"); purgeMapper.deleteEventComponentChangesByComponentUuid(rootComponentUuid); session.commit(); profiler.stop(); profiler.start("deleteAnalyses (events)"); purgeMapper.deleteEventsByComponentUuid(rootComponentUuid); session.commit(); profiler.stop(); List<List<String>> analysisUuidsPartitions = Lists.partition(IdUuidPairs.uuids( purgeMapper.selectAnalysisIdsAndUuids(new PurgeSnapshotQuery().setComponentUuid(rootComponentUuid))), MAX_SNAPSHOTS_PER_QUERY); deleteAnalysisDuplications(analysisUuidsPartitions); profiler.start("deleteAnalyses (project_measures)"); analysisUuidsPartitions.forEach(purgeMapper::deleteAnalysisMeasures); session.commit(); profiler.stop(); profiler.start("deleteAnalyses (snapshots)"); analysisUuidsPartitions.forEach(purgeMapper::deleteAnalyses); session.commit(); profiler.stop(); profiler.start("deleteAnalyses (analysis_properties)"); analysisUuidsPartitions.forEach(purgeMapper::deleteAnalysisProperties); session.commit(); profiler.stop(); }
void deleteAnalyses(String rootUuid) { deleteAnalyses(purgeMapper.selectAnalysisIdsAndUuids(new PurgeSnapshotQuery().setComponentUuid(rootUuid))); }
private static void purgeAnalyses(PurgeCommands commands, String rootUuid) { List<IdUuidPair> analysisUuids = commands.selectSnapshotIdUuids( new PurgeSnapshotQuery() .setComponentUuid(rootUuid) .setIslast(false) .setNotPurged(true)); commands.purgeAnalyses(analysisUuids); }
private static void deleteAbortedAnalyses(String rootUuid, PurgeCommands commands) { LOG.debug("<- Delete aborted builds"); PurgeSnapshotQuery query = new PurgeSnapshotQuery() .setIslast(false) .setStatus(UNPROCESSED_STATUS) .setComponentUuid(rootUuid); commands.deleteAnalyses(query); }
private void deleteDataOfComponentsWithoutHistoricalData(DbSession dbSession, String rootUuid, String[] scopesWithoutHistoricalData, PurgeCommands purgeCommands) { if (scopesWithoutHistoricalData.length == 0) { return; } List<String> analysisUuids = purgeCommands.selectSnapshotUuids( new PurgeSnapshotQuery() .setComponentUuid(rootUuid) .setIslast(false) .setNotPurged(true)); List<String> componentWithoutHistoricalDataUuids = componentDao .selectDescendants( dbSession, ComponentTreeQuery.builder() .setBaseUuid(rootUuid) .setQualifiers(Arrays.asList(scopesWithoutHistoricalData)) .setStrategy(Strategy.LEAVES) .build()) .stream().map(ComponentDto::uuid) .collect(Collectors.toList()); purgeCommands.deleteComponentMeasures(analysisUuids, componentWithoutHistoricalDataUuids); }