]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9489 increase the default nb of shards of rules index
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Tue, 27 Jun 2017 19:44:18 +0000 (21:44 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Fri, 30 Jun 2017 08:58:10 +0000 (10:58 +0200)
server/sonar-server/src/main/java/org/sonar/server/rule/index/RuleIndexDefinition.java
server/sonar-server/src/test/java/org/sonar/server/rule/index/RuleIndexDefinitionTest.java

index 17fe3380b49499f0828e14f2697da9d1f3cef57a..b50ef8398b2ee1d7e551f8450f04264090a80912 100644 (file)
@@ -102,7 +102,10 @@ public class RuleIndexDefinition implements IndexDefinition {
     NewIndex index = context.create(INDEX_TYPE_RULE.getIndex());
 
     index.refreshHandledByIndexer();
-    index.configureShards(settings, 1);
+    // Default nb of shards should be greater than 1 in order to
+    // easily detect routing misconfiguration.
+    // See https://jira.sonarsource.com/browse/SONAR-9489
+    index.configureShards(settings, 2);
 
     // Active rule type
     NewIndex.NewIndexType activeRuleMapping = index.createType(INDEX_TYPE_ACTIVE_RULE.getType());
index 51b7c1cc216681b3b120a9574c188ec74d6dcf1f..10630b27d482250c470d35e429bf97fe65800234 100644 (file)
@@ -57,7 +57,7 @@ public class RuleIndexDefinitionTest {
     assertThat(ruleIndex.getTypes().keySet()).containsOnly("activeRule", "ruleExtension", "rule");
 
     // no cluster by default
-    assertThat(ruleIndex.getSettings().get("index.number_of_shards")).isEqualTo("1");
+    assertThat(ruleIndex.getSettings().get("index.number_of_shards")).isEqualTo("2");
     assertThat(ruleIndex.getSettings().get("index.number_of_replicas")).isEqualTo("0");
   }