diff options
author | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-03-11 10:49:06 +0100 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@sonarsource.com> | 2014-03-11 10:52:07 +0100 |
commit | 5c9a4197ced4491833cf1647da57e4ce2d16fa71 (patch) | |
tree | 5bd0e7dec5e83ec7345d307541ce7d769a4e74f6 /sonar-core | |
parent | 6701b7aa2f66e4eec8449ddf7020fcea4e7f0c27 (diff) | |
download | sonarqube-5c9a4197ced4491833cf1647da57e4ce2d16fa71.tar.gz sonarqube-5c9a4197ced4491833cf1647da57e4ce2d16fa71.zip |
Update purge as there's now no more requirements in characteristics
Diffstat (limited to 'sonar-core')
4 files changed, 1 insertions, 49 deletions
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<Long> characteristicIds = purgeMapper.selectCharacteristicIdsToPurge(); - if (!characteristicIds.isEmpty()) { - for (List<Long> partSnapshotIds : snapshotIdsPartition) { - // SONAR-3641 We cannot process all characteristics at once - for (List<Long> 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} </select> - <select id="selectCharacteristicIdsToPurge" resultType="long"> - select id from characteristics where rule_id is not null - </select> - <select id="selectProjectIdsByRootId" resultType="long" parameterType="long"> select id from projects where root_id=#{id} and scope='PRJ' </select> @@ -175,16 +171,6 @@ ) </delete> - <delete id="deleteSnapshotMeasuresOnCharacteristics" parameterType="map"> - delete from project_measures where snapshot_id in - <foreach collection="snapshotIds" open="(" close=")" item="snapshotId" separator=","> - #{snapshotId} - </foreach> - and ( - <foreach item="cid" index="index" collection="cids" open="" separator=" OR " close="">characteristic_id=#{cid}</foreach> - ) - </delete> - <update id="updatePurgeStatusToOne" parameterType="long"> update snapshots set purge_status = 1 where id = #{id} </update> 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]"/> - <!-- delete measure on requirement --> - <!--<project_measures ID="5" project_id="1" SNAPSHOT_ID="1" RULE_ID="[null]" characteristic_id="2" METRIC_ID="1" - url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" - variation_value_4="[null]" - variation_value_5="[null]" rule_priority="[null]" alert_text="[null]" VALUE="10.0" - rules_category_id="[null]" - person_id="[null]" - text_value="[null]" tendency="[null]" measure_date="[null]" alert_status="[null]" - description="[null]"/>--> - <!-- delete measure on metrics that are flagged with delete_historical_data=true --> <!--<project_measures ID="6" project_id="1" SNAPSHOT_ID="1" RULE_ID="[null]" characteristic_id="[null]" METRIC_ID="2" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteWastedMeasuresWhenPurgingSnapshot.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteWastedMeasuresWhenPurgingSnapshot.xml index 3321a4d8cf8..23ec5986e5b 100644 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteWastedMeasuresWhenPurgingSnapshot.xml +++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteWastedMeasuresWhenPurgingSnapshot.xml @@ -65,16 +65,6 @@ text_value="[null]" tendency="[null]" measure_date="[null]" alert_status="[null]" description="[null]"/> - <!-- delete measure on requirement --> - <project_measures id="5" project_id="1" snapshot_id="1" rule_id="[null]" characteristic_id="3" metric_id="1" - url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" - variation_value_4="[null]" - variation_value_5="[null]" rule_priority="[null]" alert_text="[null]" value="10.0" - rules_category_id="[null]" - person_id="[null]" - text_value="[null]" tendency="[null]" measure_date="[null]" alert_status="[null]" - description="[null]"/> - <!-- delete measure on metrics that are flagged with delete_historical_data=true --> <project_measures id="6" project_id="1" snapshot_id="1" rule_id="[null]" characteristic_id="[null]" metric_id="2" url="[null]" variation_value_1="[null]" variation_value_2="[null]" variation_value_3="[null]" |