From: Simon Brandhof Date: Wed, 20 Dec 2017 10:58:08 +0000 (+0100) Subject: Merge remote-tracking branch 'origin/branch-6.7' X-Git-Tag: 7.0-RC1~97 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ecf2412b6b9994f836a21a713240cba278e993c3;p=sonarqube.git Merge remote-tracking branch 'origin/branch-6.7' --- ecf2412b6b9994f836a21a713240cba278e993c3 diff --cc server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeConfiguration.java index 245c23c7c6a,15fc642e842..219d1afcfa7 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeConfiguration.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/purge/PurgeConfiguration.java @@@ -20,6 -20,6 +20,7 @@@ package org.sonar.db.purge; import com.google.common.annotations.VisibleForTesting; ++import java.util.Arrays; import java.util.Collection; import java.util.Date; import java.util.Optional; @@@ -30,6 -30,9 +31,8 @@@ import org.sonar.api.resources.Scopes import org.sonar.api.utils.System2; import org.sonar.core.config.PurgeConstants; -import static java.util.Arrays.asList; + import static java.util.Collections.singletonList; + public class PurgeConfiguration { private final IdUuidPair rootProjectIdUuid; @@@ -49,12 -52,12 +52,12 @@@ this.maxAgeInDaysOfInactiveShortLivingBranches = maxAgeInDaysOfInactiveShortLivingBranches; } - public static PurgeConfiguration newDefaultPurgeConfiguration(Configuration config, IdUuidPair idUuidPair, Collection disabledComponentUuids) { - Collection scopesWithoutHistoricalData = singletonList(Scopes.FILE); + public static PurgeConfiguration newDefaultPurgeConfiguration(Configuration config, IdUuidPair rootId, Collection disabledComponentUuids) { - String[] scopes = new String[] {Scopes.FILE}; ++ Collection scopes = singletonList(Scopes.FILE); if (config.getBoolean(PurgeConstants.PROPERTY_CLEAN_DIRECTORY).orElse(false)) { - scopes = new String[] {Scopes.DIRECTORY, Scopes.FILE}; - scopesWithoutHistoricalData = asList(Scopes.FILE, Scopes.DIRECTORY); ++ scopes = Arrays.asList(Scopes.DIRECTORY, Scopes.FILE); } - return new PurgeConfiguration(idUuidPair, scopesWithoutHistoricalData, config.getInt(PurgeConstants.DAYS_BEFORE_DELETING_CLOSED_ISSUES).get(), + return new PurgeConfiguration(rootId, scopes, config.getInt(PurgeConstants.DAYS_BEFORE_DELETING_CLOSED_ISSUES).get(), config.getInt(PurgeConstants.DAYS_BEFORE_DELETING_INACTIVE_SHORT_LIVING_BRANCHES), System2.INSTANCE, disabledComponentUuids); } diff --cc server/sonar-db-dao/src/main/resources/org/sonar/db/measure/LiveMeasureMapper.xml index 57eb8f87008,00000000000..0c9db60b475 mode 100644,000000..100644 --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/measure/LiveMeasureMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/measure/LiveMeasureMapper.xml @@@ -1,110 -1,0 +1,136 @@@ + + + + + + + lm.component_uuid as componentUuid, + lm.project_uuid as projectUuid, + lm.metric_id as metricId, + lm.value as value, + lm.text_value as textValue, + lm.measure_data as data, + lm.variation as variation + + + + + + + + insert into live_measures ( + uuid, + component_uuid, + project_uuid, + metric_id, + value, + text_value, + variation, + measure_data, + update_marker, + created_at, + updated_at + ) values ( + #{uuid, jdbcType=VARCHAR}, + #{dto.componentUuid, jdbcType=VARCHAR}, + #{dto.projectUuid, jdbcType=VARCHAR}, + #{dto.metricId, jdbcType=INTEGER}, + #{dto.value, jdbcType=DOUBLE}, + #{dto.textValue, jdbcType=VARCHAR}, + #{dto.variation, jdbcType=DOUBLE}, + #{dto.data, jdbcType=BINARY}, + #{marker, jdbcType=VARCHAR}, + #{now, jdbcType=BIGINT}, + #{now, jdbcType=BIGINT} + ) + + + + update live_measures set + value = #{dto.value, jdbcType=DOUBLE}, + variation = #{dto.variation, jdbcType=DOUBLE}, + text_value = #{dto.textValue, jdbcType=VARCHAR}, + measure_data = #{dto.data, jdbcType=BINARY}, + update_marker = #{marker, jdbcType=VARCHAR}, + updated_at = #{now, jdbcType=BIGINT} + where + component_uuid = #{dto.componentUuid, jdbcType=VARCHAR} + and metric_id = #{dto.metricId, jdbcType=INTEGER} + + + + delete from live_measures + where + project_uuid = #{projectUuid, jdbcType=VARCHAR} and + (update_marker != #{marker, jdbcType=VARCHAR} or update_marker is null) + + + + diff --cc server/sonar-db-dao/src/main/resources/org/sonar/db/measure/MeasureMapper.xml index 4dd4ecd7504,d29bcf17665..a5d4d313c7b --- a/server/sonar-db-dao/src/main/resources/org/sonar/db/measure/MeasureMapper.xml +++ b/server/sonar-db-dao/src/main/resources/org/sonar/db/measure/MeasureMapper.xml @@@ -15,27 -16,10 +15,27 @@@ pm.variation_value_1 as variation - - , - metric.name as metricKey - + + +