From d18308ab161d71489498c056a9124e2c87f7f20d Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Thu, 12 Mar 2015 10:24:55 +0100 Subject: [PATCH] SONAR-5473 Optimization: do not change file_sources.updated_at when the change is only on src_hash --- .../main/java/org/sonar/batch/index/SourcePersister.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/SourcePersister.java b/sonar-batch/src/main/java/org/sonar/batch/index/SourcePersister.java index bbbd47cf5ca..dd084a834c2 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/SourcePersister.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/SourcePersister.java @@ -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(); } -- 2.39.5