diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2018-01-29 17:56:59 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2018-01-29 21:11:00 +0100 |
commit | d031c78f5294d76085cd84ddb1382be41da9434e (patch) | |
tree | 49d98b229a4d7052cf7f745f3d6b0bd5148df863 /server | |
parent | a42e0a794703ef9b8c9c0ab7d849df3b720fdc43 (diff) | |
download | sonarqube-d031c78f5294d76085cd84ddb1382be41da9434e.tar.gz sonarqube-d031c78f5294d76085cd84ddb1382be41da9434e.zip |
SONAR-10052 support profiles with more than 1'000 active rules
Diffstat (limited to 'server')
-rw-r--r-- | server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDao.java | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDao.java b/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDao.java index 1fe5c2c5a39..70d22882fba 100644 --- a/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDao.java +++ b/server/sonar-db-dao/src/main/java/org/sonar/db/qualityprofile/ActiveRuleDao.java @@ -35,7 +35,6 @@ import org.sonar.db.rule.RuleParamDto; import static com.google.common.base.Preconditions.checkArgument; import static java.util.Collections.emptyList; -import static org.sonar.db.DatabaseUtils.PARTITION_SIZE_FOR_ORACLE; import static org.sonar.db.DatabaseUtils.executeLargeInputs; import static org.sonar.db.DatabaseUtils.executeLargeInputsWithoutOutput; import static org.sonar.db.KeyLongValue.toMap; @@ -82,13 +81,12 @@ public class ActiveRuleDao implements Dao { } public Collection<ActiveRuleDto> selectByRulesAndRuleProfileUuids(DbSession dbSession, Collection<RuleDefinitionDto> rules, Collection<String> ruleProfileUuids) { - if (rules.isEmpty()) { + if (rules.isEmpty() || ruleProfileUuids.isEmpty()) { return emptyList(); } - checkArgument(rules.size() < PARTITION_SIZE_FOR_ORACLE, - "too many rules (got %s, max is %s)", rules.size(), PARTITION_SIZE_FOR_ORACLE); List<Integer> ruleIds = rules.stream().map(RuleDefinitionDto::getId).collect(MoreCollectors.toArrayList(rules.size())); - return executeLargeInputs(ruleProfileUuids, chunk -> mapper(dbSession).selectByRuleIdsAndRuleProfileUuids(ruleIds, chunk)); + ActiveRuleMapper mapper = mapper(dbSession); + return executeLargeInputs(ruleIds, ruleIdsChunk -> executeLargeInputs(ruleProfileUuids, chunk -> mapper.selectByRuleIdsAndRuleProfileUuids(ruleIdsChunk, chunk))); } public ActiveRuleDto insert(DbSession dbSession, ActiveRuleDto item) { |