From: Teryk Bellahsene Date: Thu, 4 Dec 2014 08:36:57 +0000 (+0100) Subject: SONAR-5817 remove snapshot_sources use during purge and snapshot delete X-Git-Tag: 5.0-RC1~76 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6fac387db10d3541a8ff0dd9b2fa50d8f0fa2eb9;p=sonarqube.git SONAR-5817 remove snapshot_sources use during purge and snapshot delete --- 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 a68c3fa58ce..3bdb2248a16 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 @@ -180,8 +180,6 @@ class PurgeCommands { session.commit(); profiler.stop(); - deleteSnapshotSources(snapshotIdsPartition); - deleteSnapshotGraphs(snapshotIdsPartition); deleteSnapshotData(snapshotIdsPartition); @@ -207,8 +205,6 @@ class PurgeCommands { deleteSnapshotDuplications(snapshotIdsPartition); - deleteSnapshotSources(snapshotIdsPartition); - deleteSnapshotGraphs(snapshotIdsPartition); deleteSnapshotData(snapshotIdsPartition); @@ -247,15 +243,6 @@ class PurgeCommands { profiler.stop(); } - private void deleteSnapshotSources(final List> snapshotIdsPartition) { - profiler.start("deleteSnapshotSource (snapshot_sources)"); - for (List partSnapshotIds : snapshotIdsPartition) { - purgeMapper.deleteSnapshotSource(partSnapshotIds); - } - session.commit(); - profiler.stop(); - } - private void deleteSnapshotDuplications(final List> snapshotIdsPartition) { profiler.start("deleteSnapshotDuplications (duplications_index)"); for (List partSnapshotIds : snapshotIdsPartition) { diff --git a/sonar-core/src/main/java/org/sonar/core/purge/PurgeMapper.java b/sonar-core/src/main/java/org/sonar/core/purge/PurgeMapper.java index a31a2abd2b9..4ece70e8e4a 100644 --- a/sonar-core/src/main/java/org/sonar/core/purge/PurgeMapper.java +++ b/sonar-core/src/main/java/org/sonar/core/purge/PurgeMapper.java @@ -48,8 +48,6 @@ public interface PurgeMapper { void deleteSnapshotMeasures(@Param("snapshotIds") List snapshotIds); - void deleteSnapshotSource(@Param("snapshotIds") List snapshotIds); - void deleteSnapshotGraphs(@Param("snapshotIds") List snapshotIds); void deleteSnapshotData(@Param("snapshotIds") List snapshotIds); 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 6134cde6f24..70acfa0df27 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 @@ -103,13 +103,6 @@ - - delete from snapshot_sources where snapshot_id in - - #{snapshotId} - - - delete from graphs where snapshot_id in diff --git a/sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java b/sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java index 8bf37632966..704c13903db 100644 --- a/sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java +++ b/sonar-core/src/test/java/org/sonar/core/purge/PurgeCommandsTest.java @@ -53,7 +53,7 @@ public class PurgeCommandsTest extends AbstractDaoTestCase { MyBatis.closeQuietly(session); } checkTables("shouldDeleteSnapshot", - "snapshots", "project_measures", "snapshot_sources", "duplications_index", "events", "dependencies", "snapshot_data"); + "snapshots", "project_measures", "duplications_index", "events", "dependencies", "snapshot_data"); } /** @@ -84,7 +84,7 @@ public class PurgeCommandsTest extends AbstractDaoTestCase { MyBatis.closeQuietly(session); } checkTables("shouldPurgeSnapshot", - "snapshots", "project_measures", "snapshot_sources", "duplications_index", "events", "dependencies", "snapshot_data"); + "snapshots", "project_measures", "duplications_index", "events", "dependencies", "snapshot_data"); } @Test diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml index d2aaf6dba28..d2711e08506 100644 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot-result.xml @@ -13,7 +13,6 @@ parent_snapshot_id="[null]" root_project_id="[null]" root_snapshot_id="[null]" status="P" islast="[false]" path="[null]"/> - - - + + diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml index 501a124192c..2ff3064a175 100644 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml +++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldDeleteSnapshot.xml @@ -8,10 +8,10 @@ period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00" build_date="2008-12-02 13:58:00.00" + depth="[null]" scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00" + build_date="2008-12-02 13:58:00.00" version="[null]" path="[null]"/> - - - + + - + - - - + + diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml index 3144614ec52..d48051136b5 100644 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml +++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot-result.xml @@ -16,9 +16,8 @@ Note that measures, events and reviews are not deleted. period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00" build_date="2008-12-02 13:58:00.00" version="[null]" path="[null]"/> - - + depth="[null]" scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00" + build_date="2008-12-02 13:58:00.00" version="[null]" path="[null]"/> @@ -26,10 +25,13 @@ Note that measures, events and reviews are not deleted. + text_value="[null]" tendency="[null]" measure_date="[null]" alert_status="[null]" + description="[null]" measure_data="[null]"/> @@ -40,7 +42,8 @@ Note that measures, events and reviews are not deleted. @@ -56,15 +59,18 @@ Note that measures, events and reviews are not deleted. period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00" build_date="2008-12-02 13:58:00.00" version="[null]" path="[null]"/> + depth="[null]" scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00" + build_date="2008-12-02 13:58:00.00" version="[null]" path="[null]"/> - + text_value="[null]" tendency="[null]" measure_date="[null]" alert_status="[null]" + description="[null]" measure_data="[null]"/> - + diff --git a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml index 5b651f5ea32..262efa6af05 100644 --- a/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml +++ b/sonar-core/src/test/resources/org/sonar/core/purge/PurgeCommandsTest/shouldPurgeSnapshot.xml @@ -8,15 +8,15 @@ period3_mode="[null]" period3_param="[null]" period3_date="[null]" period4_mode="[null]" period4_param="[null]" period4_date="[null]" period5_mode="[null]" period5_param="[null]" period5_date="[null]" - depth="[null]" scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00" build_date="2008-12-02 13:58:00.00" version="[null]" path="[null]"/> - - + depth="[null]" scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00" + build_date="2008-12-02 13:58:00.00" version="[null]" path="[null]"/> + 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" METRIC_ID="1" rules_category_id="[null]" person_id="[null]" text_value="[null]" + tendency="[null]" measure_date="[null]" alert_status="[null]" description="[null]" + measure_data="[null]"/> - + - - - - - - - - - - - - - - + project_id="2" parent_snapshot_id="[null]" root_project_id="2" root_snapshot_id="[null]" + status="P" islast="[false]" purge_status="1" + period1_mode="[null]" period1_param="[null]" period1_date="[null]" + period2_mode="[null]" period2_param="[null]" period2_date="[null]" + period3_mode="[null]" period3_param="[null]" period3_date="[null]" + period4_mode="[null]" period4_param="[null]" period4_date="[null]" + period5_mode="[null]" period5_param="[null]" period5_date="[null]" + depth="[null]" scope="PRJ" qualifier="TRK" created_at="2008-12-02 13:58:00.00" + build_date="2008-12-02 13:58:00.00" version="[null]" path="[null]"/> + + + + + + + + + + + +