]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5007 - Minor Updates for ES cluster
authorStephane Gamard <stephane.gamard@searchbox.com>
Thu, 12 Jun 2014 17:17:23 +0000 (19:17 +0200)
committerStephane Gamard <stephane.gamard@searchbox.com>
Thu, 12 Jun 2014 17:19:44 +0000 (19:19 +0200)
sonar-server/src/main/java/org/sonar/server/log/index/LogNormalizer.java
sonar-server/src/main/java/org/sonar/server/qualityprofile/index/ActiveRuleNormalizer.java
sonar-server/src/main/java/org/sonar/server/rule/index/RuleNormalizer.java
sonar-server/src/main/java/org/sonar/server/search/IndexQueueWorker.java

index 35be0d4db6b9cbfb07609e2a848f913533a8473a..933e9b832b5718cd35a7e4769e7a31990fc568da 100644 (file)
@@ -20,6 +20,7 @@
 package org.sonar.server.log.index;
 
 import com.google.common.collect.ImmutableList;
+import org.elasticsearch.action.support.replication.ReplicationType;
 import org.elasticsearch.action.update.UpdateRequest;
 import org.sonar.api.utils.KeyValueFormat;
 import org.sonar.core.log.db.LogDto;
@@ -105,6 +106,7 @@ public class LogNormalizer extends BaseNormalizer<LogDto, LogKey> {
    /* Creating updateRequest */
     return ImmutableList.of(new UpdateRequest()
       //Need to make a UUID because Key does not insure unicity
+      .replicationType(ReplicationType.ASYNC)
       .doc(logDoc)
       .upsert(logDoc));
   }
index 7e7af5a378bd068f80a14d721e03b2d11f500220..58320729db2d9761a6b6a0441ba73d4a8a3c39c1 100644 (file)
@@ -21,6 +21,7 @@ package org.sonar.server.qualityprofile.index;
 
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
+import org.elasticsearch.action.support.replication.ReplicationType;
 import org.elasticsearch.action.update.UpdateRequest;
 import org.sonar.core.persistence.DbSession;
 import org.sonar.core.qualityprofile.db.ActiveRuleDto;
@@ -150,6 +151,7 @@ public class ActiveRuleNormalizer extends BaseNormalizer<ActiveRuleDto, ActiveRu
 
     /* Creating updateRequest */
     return ImmutableList.of(new UpdateRequest()
+      .replicationType(ReplicationType.ASYNC)
       .routing(key.ruleKey().toString())
       .id(activeRuleDto.getKey().toString())
       .parent(activeRuleDto.getKey().ruleKey().toString())
@@ -186,6 +188,7 @@ public class ActiveRuleNormalizer extends BaseNormalizer<ActiveRuleDto, ActiveRu
     newParam.put(ActiveRuleParamField.VALUE.field(), param.getValue());
 
     return ImmutableList.of(new UpdateRequest()
+        .replicationType(ReplicationType.ASYNC)
         .routing(key.ruleKey().toString())
         .id(key.toString())
         .script(ListUpdate.NAME)
@@ -198,6 +201,7 @@ public class ActiveRuleNormalizer extends BaseNormalizer<ActiveRuleDto, ActiveRu
 
   private List<UpdateRequest> nestedDelete(ActiveRuleParamDto param, ActiveRuleKey key) {
     return ImmutableList.of(new UpdateRequest()
+        .replicationType(ReplicationType.ASYNC)
         .routing(key.ruleKey().toString())
         .id(key.toString())
         .script(ListUpdate.NAME)
index 69dc9b4cbf79ff0949e005871de70f8bfea6a1d4..3cbf9f76df9959e1f7b9187eebd1cabf1fe8b529 100644 (file)
@@ -22,6 +22,8 @@ package org.sonar.server.rule.index;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Sets;
+import org.elasticsearch.action.WriteConsistencyLevel;
+import org.elasticsearch.action.support.replication.ReplicationType;
 import org.elasticsearch.action.update.UpdateRequest;
 import org.sonar.api.rule.RuleKey;
 import org.sonar.core.persistence.DbSession;
@@ -231,6 +233,8 @@ public class RuleNormalizer extends BaseNormalizer<RuleDto, RuleKey> {
 
       /** Creating updateRequest */
       return ImmutableList.of(new UpdateRequest()
+        .replicationType(ReplicationType.ASYNC)
+        .consistencyLevel(WriteConsistencyLevel.QUORUM)
         .id(rule.getKey().toString())
         .doc(update)
         .upsert(upsert));
index cd404b33957800ead7c4cf74aad2fa5e74779be4..d0c5ade780f44764e50931184ae69f9682d2f640 100644 (file)
@@ -36,7 +36,7 @@ public class IndexQueueWorker extends ThreadPoolExecutor
   private final IndexClient indexes;
 
   public IndexQueueWorker(IndexQueue queue, IndexClient indexes) {
-    super(1, 1, 500l, TimeUnit.MILLISECONDS, queue);
+    super(1,1, 0L, TimeUnit.MILLISECONDS, queue);
     this.indexes = indexes;
   }