]> source.dussan.org Git - sonarqube.git/commitdiff
Remove optimization on updated at
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 30 Sep 2015 15:00:33 +0000 (17:00 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Wed, 30 Sep 2015 15:00:41 +0000 (17:00 +0200)
As there's no more ES index of file sources, there's no need to modify the updated at date only when binary data are updated

server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistFileSourcesStep.java
server/sonar-server/src/test/java/org/sonar/server/computation/step/PersistFileSourcesStepTest.java

index 56757271ef8a30a32b72a206bd623a645de1a086..824364110a613a3040492dfb78b2953946140931 100644 (file)
 package org.sonar.server.computation.step;
 
 import com.google.common.collect.ImmutableMap;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 import org.apache.commons.codec.digest.DigestUtils;
 import org.apache.ibatis.session.ResultContext;
 import org.apache.ibatis.session.ResultHandler;
@@ -52,6 +48,11 @@ import org.sonar.server.computation.source.ScmLineReader;
 import org.sonar.server.computation.source.SourceLinesRepository;
 import org.sonar.server.computation.source.SymbolsLineReader;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 import static org.sonar.server.computation.component.ComponentVisitor.Order.PRE_ORDER;
 
 public class PersistFileSourcesStep implements ComputationStep {
@@ -156,11 +157,8 @@ public class PersistFileSourcesStep implements ComputationStep {
             .setBinaryData(data)
             .setDataHash(dataHash)
             .setSrcHash(srcHash)
-            .setLineHashes(lineHashes);
-          // Optimization only change updated at when updating binary data to avoid unnecessary indexation by E/S
-          if (binaryDataUpdated) {
-            previousDto.setUpdatedAt(system2.now());
-          }
+            .setLineHashes(lineHashes)
+            .setUpdatedAt(system2.now());
           dbClient.fileSourceDao().update(previousDto);
           session.commit();
         }
index cd1bd5ee8847729bd569d1448e51be13b3e025ce..86195aa39be2d6f8e7fe6c05a2ee1b6bac7423e4 100644 (file)
@@ -389,8 +389,7 @@ public class PersistFileSourcesStepTest extends BaseStepTest {
     assertThat(dbTester.countRowsOfTable("file_sources")).isEqualTo(1);
     FileSourceDto fileSourceDto = dbClient.fileSourceDao().selectSourceByFileUuid(session, FILE_UUID);
     assertThat(fileSourceDto.getCreatedAt()).isEqualTo(past);
-    // Updated at is not updated to not reindex the file source in E/S as the src hash is not indexed
-    assertThat(fileSourceDto.getUpdatedAt()).isEqualTo(past);
+    assertThat(fileSourceDto.getUpdatedAt()).isEqualTo(now);
     assertThat(fileSourceDto.getSrcHash()).isEqualTo("137f72c3708c6bd0de00a0e5a69c699b");
   }