From: Simon Brandhof Date: Mon, 29 Jan 2018 16:56:59 +0000 (+0100) Subject: SONAR-10052 support profiles with more than 1'000 active rules X-Git-Tag: 7.5~1755 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d031c78f5294d76085cd84ddb1382be41da9434e;p=sonarqube.git SONAR-10052 support profiles with more than 1'000 active rules --- 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 selectByRulesAndRuleProfileUuids(DbSession dbSession, Collection rules, Collection 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 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) {