From 5c9a4197ced4491833cf1647da57e4ce2d16fa71 Mon Sep 17 00:00:00 2001 From: Julien Lancelot Date: Tue, 11 Mar 2014 10:49:06 +0100 Subject: Update purge as there's now no more requirements in characteristics --- .../main/java/org/sonar/core/purge/PurgeCommands.java | 16 +--------------- .../main/resources/org/sonar/core/purge/PurgeMapper.xml | 14 -------------- ...uldDeleteWastedMeasuresWhenPurgingSnapshot-result.xml | 10 ---------- .../shouldDeleteWastedMeasuresWhenPurgingSnapshot.xml | 10 ---------- 4 files changed, 1 insertion(+), 49 deletions(-) (limited to 'sonar-core') diff --git a/sonar-core/src/main/java/org/sonar/core/purge/PurgeCommands.java b/sonar-core/src/main/java/org/sonar/core/purge/PurgeCommands.java index 38a07064e49..f2be30838c3 100644 --- a/sonar-core/src/main/java/org/sonar/core/purge/PurgeCommands.java +++ b/sonar-core/src/main/java/org/sonar/core/purge/PurgeCommands.java @@ -20,14 +20,13 @@ package org.sonar.core.purge; import com.google.common.annotations.VisibleForTesting; -import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import org.apache.ibatis.session.SqlSession; import java.util.List; class PurgeCommands { - private static final int MAX_CHARACTERISTICS_PER_QUERY = 1000; + private static final int MAX_SNAPSHOTS_PER_QUERY = 1000; private static final int MAX_RESOURCES_PER_QUERY = 1000; @@ -231,19 +230,6 @@ class PurgeCommands { } profiler.stop(); - profiler.start("deleteSnapshotMeasuresOnCharacteristics (project_measures)"); - List characteristicIds = purgeMapper.selectCharacteristicIdsToPurge(); - if (!characteristicIds.isEmpty()) { - for (List partSnapshotIds : snapshotIdsPartition) { - // SONAR-3641 We cannot process all characteristics at once - for (List ids : Iterables.partition(characteristicIds, MAX_CHARACTERISTICS_PER_QUERY)) { - purgeMapper.deleteSnapshotMeasuresOnCharacteristics(partSnapshotIds, ids); - } - } - session.commit(); - } - profiler.stop(); - profiler.start("updatePurgeStatusToOne (snapshots)"); for (Long snapshotId : snapshotIds) { purgeMapper.updatePurgeStatusToOne(snapshotId); diff --git a/sonar-core/src/main/resources/org/sonar/core/purge/PurgeMapper.xml b/sonar-core/src/main/resources/org/sonar/core/purge/PurgeMapper.xml index 2501ff8bd0d..a6f3ab5a38b 100644 --- a/sonar-core/src/main/resources/org/sonar/core/purge/PurgeMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/purge/PurgeMapper.xml @@ -82,10 +82,6 @@ select id from metrics where delete_historical_data=${_true} - - @@ -175,16 +171,6 @@ ) - - delete from project_measures where snapshot_id in - - #{snapshotId} - - and ( - characteristic_id=#{cid} - ) - - update snapshots set purge_status = 1 where id = #{id} diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteWastedMeasuresWhenPurgingSnapshot-result.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteWastedMeasuresWhenPurgingSnapshot-result.xml index ef9c9433014..d5ad7fc62d4 100644 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteWastedMeasuresWhenPurgingSnapshot-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteWastedMeasuresWhenPurgingSnapshot-result.xml @@ -65,16 +65,6 @@ text_value="[null]" tendency="[null]" measure_date="[null]" alert_status="[null]" description="[null]"/> - - - - -