void deleteByRootAndModulesOrSubviews(List<IdUuidPair> rootAndModulesOrSubviewsIds) { if (rootAndModulesOrSubviewsIds.isEmpty()) { return; } List<List<Long>> idPartitions = Lists.partition(IdUuidPairs.ids(rootAndModulesOrSubviewsIds), MAX_RESOURCES_PER_QUERY); List<List<String>> uuidsPartitions = Lists.partition(IdUuidPairs.uuids(rootAndModulesOrSubviewsIds), MAX_RESOURCES_PER_QUERY); profiler.start("deleteByRootAndModulesOrSubviews (properties)"); idPartitions.forEach(purgeMapper::deletePropertiesByComponentIds); session.commit(); profiler.stop(); profiler.start("deleteByRootAndModulesOrSubviews (manual_measures)"); uuidsPartitions.forEach(purgeMapper::deleteManualMeasuresByComponentUuids); session.commit(); profiler.stop(); }
void purgeAnalyses(List<IdUuidPair> analysisUuids) { List<List<String>> analysisUuidsPartitions = Lists.partition(IdUuidPairs.uuids(analysisUuids), MAX_SNAPSHOTS_PER_QUERY); deleteAnalysisDuplications(analysisUuidsPartitions); profiler.start("deleteSnapshotWastedMeasures (project_measures)"); List<Long> metricIdsWithoutHistoricalData = purgeMapper.selectMetricIdsWithoutHistoricalData(); if (!metricIdsWithoutHistoricalData.isEmpty()) { analysisUuidsPartitions .forEach(analysisUuidsPartition -> purgeMapper.deleteAnalysisWastedMeasures(analysisUuidsPartition, metricIdsWithoutHistoricalData)); session.commit(); } profiler.stop(); profiler.start("updatePurgeStatusToOne (snapshots)"); analysisUuidsPartitions.forEach(purgeMapper::updatePurgeStatusToOne); session.commit(); profiler.stop(); }
@Test public void extract_ids() { List<IdUuidPair> idUuidPairList = Lists.newArrayList(new IdUuidPair(1L, "ABCD"), new IdUuidPair(2L, "EFGH")); List<Long> ids = IdUuidPairs.ids(idUuidPairList); assertThat(ids).containsOnly(1L, 2L); }
@Test public void extract_uuids() { List<IdUuidPair> idUuidPairList = Lists.newArrayList(new IdUuidPair(1L, "ABCD"), new IdUuidPair(2L, "EFGH")); List<String> uuids = IdUuidPairs.uuids(idUuidPairList); assertThat(uuids).containsOnly("ABCD", "EFGH"); } }
void deleteComponents(List<IdUuidPair> componentIdUuids) { List<List<Long>> componentIdPartitions = Lists.partition(IdUuidPairs.ids(componentIdUuids), MAX_RESOURCES_PER_QUERY); List<List<String>> componentUuidsPartitions = Lists.partition(IdUuidPairs.uuids(componentIdUuids), MAX_RESOURCES_PER_QUERY);
@VisibleForTesting void deleteAnalyses(List<IdUuidPair> analysisIdUuids) { List<List<String>> analysisUuidsPartitions = Lists.partition(IdUuidPairs.uuids(analysisIdUuids), MAX_SNAPSHOTS_PER_QUERY); deleteAnalysisDuplications(analysisUuidsPartitions); profiler.start("deleteAnalyses (event_component_changes)"); analysisUuidsPartitions.forEach(purgeMapper::deleteAnalysisEventComponentChanges); session.commit(); profiler.stop(); profiler.start("deleteAnalyses (events)"); analysisUuidsPartitions.forEach(purgeMapper::deleteAnalysisEvents); session.commit(); profiler.stop(); 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 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(); }
@VisibleForTesting protected void deleteAnalyses(List<IdUuidPair> analysisIdUuids) { List<List<String>> analysisUuidsPartitions = Lists.partition(IdUuidPairs.uuids(analysisIdUuids), MAX_SNAPSHOTS_PER_QUERY); deleteAnalysisDuplications(analysisUuidsPartitions); profiler.start("deleteAnalyses (events)"); analysisUuidsPartitions.forEach(purgeMapper::deleteAnalysisEvents); session.commit(); profiler.stop(); 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(); }
public void purgeAnalyses(List<IdUuidPair> analysisUuids) { List<List<String>> analysisUuidsPartitions = Lists.partition(IdUuidPairs.uuids(analysisUuids), MAX_SNAPSHOTS_PER_QUERY); deleteAnalysisDuplications(analysisUuidsPartitions); profiler.start("deleteSnapshotWastedMeasures (project_measures)"); List<Long> metricIdsWithoutHistoricalData = purgeMapper.selectMetricIdsWithoutHistoricalData(); analysisUuidsPartitions.stream() .forEach(analysisUuidsPartition -> purgeMapper.deleteAnalysisWastedMeasures(analysisUuidsPartition, metricIdsWithoutHistoricalData)); session.commit(); profiler.stop(); profiler.start("updatePurgeStatusToOne (snapshots)"); analysisUuidsPartitions.forEach(purgeMapper::updatePurgeStatusToOne); session.commit(); profiler.stop(); }