]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5473 Optimization: do not change file_sources.updated_at
authorJulien HENRY <julien.henry@sonarsource.com>
Thu, 12 Mar 2015 09:24:55 +0000 (10:24 +0100)
committerJulien HENRY <julien.henry@sonarsource.com>
Thu, 12 Mar 2015 09:24:55 +0000 (10:24 +0100)
  when the change is only on src_hash

sonar-batch/src/main/java/org/sonar/batch/index/SourcePersister.java

index bbbd47cf5ca8bfce4e6a43a5de6f37a3ad641529..dd084a834c23c6b9fef142b2397ae0f33d949276 100644 (file)
@@ -112,8 +112,11 @@ public class SourcePersister implements ScanPersister {
           .setBinaryData(data)
           .setDataHash(dataHash)
           .setSrcHash(metadata.hash())
-          .setLineHashes(lineHashesAsMd5Hex(inputFile))
-          .setUpdatedAt(system2.now());
+          .setLineHashes(lineHashesAsMd5Hex(inputFile));
+        // Optimization do not change updated at when updating src_hash to avoid indexation by E/S
+        if (!dataHash.equals(previousDto.getDataHash())) {
+          previousDto.setUpdatedAt(system2.now());
+        }
         mapper.update(previousDto);
         session.commit();
       }