]> source.dussan.org Git - sonarqube.git/commitdiff
Merge remote-tracking branch 'origin/branch-4.5'
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 22 Sep 2014 07:15:12 +0000 (09:15 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Mon, 22 Sep 2014 07:15:12 +0000 (09:15 +0200)
Conflicts:
server/sonar-search/src/main/java/org/sonar/search/SearchServer.java

1  2 
server/sonar-search/src/main/java/org/sonar/search/SearchServer.java
sonar-application/src/main/assembly/conf/sonar.properties

index b5620b86c5f7cfd6cc705b71a3012dd1d40cb3c9,cb039b55162c7c4136026fd7ce30e97ba2cdd9e3..1433bd71b6e709f86f50656c6eaa466bc2f9c407
@@@ -55,9 -54,7 +55,8 @@@ public class SearchServer implements Mo
    private static final Integer MINIMUM_INDEX_REPLICATION = 1;
  
    private final Set<String> nodes = new HashSet<String>();
 +  private final Set<String> marvels = new HashSet<String>();
    private final Props props;
-   private final Object lock = new Object();
  
    private Node node;
  
    }
  
    @Override
--  public void start() {
-     synchronized (lock) {
-       Integer port = props.valueAsInt(ES_PORT_PROPERTY);
-       String clusterName = props.value(ES_CLUSTER_PROPERTY);
++  public synchronized void start() {
+     Integer port = props.valueAsInt(ES_PORT_PROPERTY);
+     String clusterName = props.value(ES_CLUSTER_PROPERTY);
  
-       LoggerFactory.getLogger(SearchServer.class).info("Starting ES[{}] on port: {}", clusterName, port);
+     LoggerFactory.getLogger(SearchServer.class).info("Starting ES[{}] on port: {}", clusterName, port);
  
-       ImmutableSettings.Builder esSettings = ImmutableSettings.settingsBuilder()
+     ImmutableSettings.Builder esSettings = ImmutableSettings.settingsBuilder()
  
-         // Disable MCast
-         .put("discovery.zen.ping.multicast.enabled", "false")
+       // Disable MCast
+       .put("discovery.zen.ping.multicast.enabled", "false")
  
-           // Index storage policies
-         .put("index.number_of_shards", "1")
-         .put("index.number_of_replicas", MINIMUM_INDEX_REPLICATION)
-         .put("index.store.type", "mmapfs")
+       // Index storage policies
 -      .put("index.merge.policy.max_merge_at_once", "200")
 -      .put("index.merge.policy.segments_per_tier", "200")
+       .put("index.number_of_shards", "1")
+       .put("index.number_of_replicas", MINIMUM_INDEX_REPLICATION)
+       .put("index.store.type", "mmapfs")
 -      .put("indices.store.throttle.type", "merge")
 -      .put("indices.store.throttle.max_bytes_per_sec", "200mb")
  
-           // Install our own listUpdate scripts
-         .put("script.default_lang", "native")
-         .put("script.native." + ListUpdate.NAME + ".type", ListUpdate.UpdateListScriptFactory.class.getName())
+       // Install our own listUpdate scripts
+       .put("script.default_lang", "native")
+       .put("script.native." + ListUpdate.NAME + ".type", ListUpdate.UpdateListScriptFactory.class.getName())
  
-           // Node is pure transport
-         .put("transport.tcp.port", port)
-         .put("http.enabled", false)
+       // Node is pure transport
+       .put("transport.tcp.port", port)
+       .put("http.enabled", false)
  
-           // Setting up ES paths
-         .put("path.data", esDataDir().getAbsolutePath())
-         .put("path.work", esWorkDir().getAbsolutePath())
-         .put("path.logs", esLogDir().getAbsolutePath());
+       // Setting up ES paths
+       .put("path.data", esDataDir().getAbsolutePath())
+       .put("path.work", esWorkDir().getAbsolutePath())
+       .put("path.logs", esLogDir().getAbsolutePath());
  
-       if (!nodes.isEmpty()) {
+     if (!nodes.isEmpty()) {
  
-         LoggerFactory.getLogger(SearchServer.class).info("Joining ES cluster with master: {}", nodes);
-         esSettings.put("discovery.zen.ping.unicast.hosts", StringUtils.join(nodes, ","));
-         esSettings.put("node.master", false);
-         // Enforce a N/2+1 number of masters in cluster
-         esSettings.put("discovery.zen.minimum_master_nodes", 1);
-         // Change master pool requirement when in distributed mode
-         // esSettings.put("discovery.zen.minimum_master_nodes", (int) Math.floor(nodes.size() / 2.0) + 1);
-       }
+       LoggerFactory.getLogger(SearchServer.class).info("Joining ES cluster with master: {}", nodes);
+       esSettings.put("discovery.zen.ping.unicast.hosts", StringUtils.join(nodes, ","));
+       esSettings.put("node.master", false);
+       // Enforce a N/2+1 number of masters in cluster
+       esSettings.put("discovery.zen.minimum_master_nodes", 1);
+       // Change master pool requirement when in distributed mode
+       // esSettings.put("discovery.zen.minimum_master_nodes", (int) Math.floor(nodes.size() / 2.0) + 1);
+     }
  
-       // Enable marvel's index creation:
-       esSettings.put("action.auto_create_index", ".marvel-*");
-       // If we're collecting indexing data send them to the Marvel host(s)
-       if (!marvels.isEmpty()) {
-         esSettings.put("marvel.agent.exporter.es.hosts", StringUtils.join(marvels, ","));
-       }
++    // Enable marvel's index creation:
++    esSettings.put("action.auto_create_index", ".marvel-*");
++    // If we're collecting indexing data send them to the Marvel host(s)
++    if (!marvels.isEmpty()) {
++      esSettings.put("marvel.agent.exporter.es.hosts", StringUtils.join(marvels, ","));
++    }
 +
-       // Set cluster coordinates
-       esSettings.put("cluster.name", clusterName);
-       esSettings.put("node.rack_id", props.value(SONAR_NODE_NAME, "unknown"));
-       esSettings.put("cluster.routing.allocation.awareness.attributes", "rack_id");
-       if (props.contains(SONAR_NODE_NAME)) {
-         esSettings.put("node.name", props.value(SONAR_NODE_NAME));
-       } else {
-         try {
-           esSettings.put("node.name", InetAddress.getLocalHost().getHostName());
-         } catch (Exception e) {
-           LoggerFactory.getLogger(SearchServer.class).warn("Could not determine hostname", e);
-           esSettings.put("node.name", "sq-" + System.currentTimeMillis());
-         }
+     // Set cluster coordinates
+     esSettings.put("cluster.name", clusterName);
+     esSettings.put("node.rack_id", props.value(SONAR_NODE_NAME, "unknown"));
+     esSettings.put("cluster.routing.allocation.awareness.attributes", "rack_id");
+     if (props.contains(SONAR_NODE_NAME)) {
+       esSettings.put("node.name", props.value(SONAR_NODE_NAME));
+     } else {
+       try {
+         esSettings.put("node.name", InetAddress.getLocalHost().getHostName());
+       } catch (Exception e) {
+         LoggerFactory.getLogger(SearchServer.class).warn("Could not determine hostname", e);
+         esSettings.put("node.name", "sq-" + System.currentTimeMillis());
        }
+     }
  
-       // Make sure the index settings are up to date.
-       initAnalysis(esSettings);
+     // Make sure the index settings are up to date.
+     initAnalysis(esSettings);
  
-       // And building our ES Node
-       node = NodeBuilder.nodeBuilder()
-         .settings(esSettings)
-         .build().start();
+     // And building our ES Node
+     node = NodeBuilder.nodeBuilder()
+       .settings(esSettings)
+       .build().start();
  
-       node.client().admin().indices()
-         .preparePutTemplate("default")
-         .setTemplate("*")
-         .addMapping("_default_", "{\"dynamic\": \"strict\"}")
-         .get();
-     }
+     node.client().admin().indices()
+       .preparePutTemplate("default")
+       .setTemplate("*")
+       .addMapping("_default_", "{\"dynamic\": \"strict\"}")
+       .get();
    }
  
    @Override