diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2014-12-02 14:29:14 +0100 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2014-12-02 14:30:07 +0100 |
commit | d4e835045c66dfeed06fcc1c6c09a531ff2427ee (patch) | |
tree | 04161fceb880369125ee82e8076f43ea4303c622 | |
parent | 684c9550bc0e58e23615c2374e01b2a6127adba0 (diff) | |
download | sonarqube-d4e835045c66dfeed06fcc1c6c09a531ff2427ee.tar.gz sonarqube-d4e835045c66dfeed06fcc1c6c09a531ff2427ee.zip |
SONAR-5827 Disable batch session when inserting in file_sources to avoid OOM
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/index/DuplicationPersister.java | 3 | ||||
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/index/SourcePersister.java | 3 |
2 files changed, 3 insertions, 3 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/index/DuplicationPersister.java b/sonar-batch/src/main/java/org/sonar/batch/index/DuplicationPersister.java index 4e5ebce1ef1..ae234e553cf 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/index/DuplicationPersister.java +++ b/sonar-batch/src/main/java/org/sonar/batch/index/DuplicationPersister.java @@ -71,10 +71,9 @@ public final class DuplicationPersister implements ScanPersister { Snapshot snapshot = snapshotCache.get(effectiveKey); MeasureModel measureModel = MeasurePersister.model(measure, ruleFinder).setSnapshotId(snapshot.getId()); mapper.insert(measureModel); + session.commit(); } } - - session.commit(); } catch (Exception e) { throw new IllegalStateException("Unable to save some measures", e); } finally { 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 ae387199288..edd0c01da3f 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 @@ -121,7 +121,8 @@ public class SourcePersister implements ScanPersister { @Override public void persist() { - DbSession session = mybatis.openSession(true); + // Don't use batch insert for file_sources since keeping all data in memory can produce OOM for big files + DbSession session = mybatis.openSession(false); try { final Map<String, FileSourceDto> fileSourceDtoByFileUuid = new HashMap<String, FileSourceDto>(); |