aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-search
diff options
context:
space:
mode:
authorStephane Gamard <stephane.gamard@searchbox.com>2014-08-11 10:10:11 +0200
committerStephane Gamard <stephane.gamard@searchbox.com>2014-08-11 10:38:39 +0200
commit7c3daba67adfda896f528d35b2f6120d685c3983 (patch)
tree12b6760e5c088669468a9becb2c7ab4bf1ad0a69 /server/sonar-search
parente1937fdb8b0f5e7a695a39ed5a97241601da18fe (diff)
downloadsonarqube-7c3daba67adfda896f528d35b2f6120d685c3983.tar.gz
sonarqube-7c3daba67adfda896f528d35b2f6120d685c3983.zip
Extracted ES from sonar-server & updated ServerTester for mediumTests
Diffstat (limited to 'server/sonar-search')
-rw-r--r--server/sonar-search/src/main/java/org/sonar/search/SearchServer.java48
1 files changed, 28 insertions, 20 deletions
diff --git a/server/sonar-search/src/main/java/org/sonar/search/SearchServer.java b/server/sonar-search/src/main/java/org/sonar/search/SearchServer.java
index f1de561955c..486e8e612ef 100644
--- a/server/sonar-search/src/main/java/org/sonar/search/SearchServer.java
+++ b/server/sonar-search/src/main/java/org/sonar/search/SearchServer.java
@@ -49,11 +49,13 @@ public class SearchServer extends MonitoredProcess {
private static final Integer MINIMUM_INDEX_REPLICATION = 1;
private final Set<String> nodes = new HashSet<String>();
+ private final boolean isBlocking;
private Node node;
- SearchServer(Props props) throws Exception {
- super(props);
+ public SearchServer(Props props, boolean monitored, boolean blocking) throws Exception {
+ super(props, monitored);
+ this.isBlocking = blocking;
new MinimumViableSystem().check();
if (StringUtils.isNotEmpty(props.of(ES_CLUSTER_INET, null))) {
@@ -61,6 +63,10 @@ public class SearchServer extends MonitoredProcess {
}
}
+ public SearchServer(Props props) throws Exception {
+ this(props, true, true);
+ }
+
@Override
protected boolean doIsReady() {
return (node.client().admin().cluster().prepareHealth()
@@ -85,7 +91,7 @@ public class SearchServer extends MonitoredProcess {
// Disable MCast
.put("discovery.zen.ping.multicast.enabled", "false")
- // Index storage policies
+ // 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")
@@ -94,15 +100,15 @@ public class SearchServer extends MonitoredProcess {
.put("indices.store.throttle.type", "merge")
.put("indices.store.throttle.max_bytes_per_sec", "200mb")
- // Install our own listUpdate scripts
+ // Install our own listUpdate scripts
.put("script.default_lang", "native")
.put("script.native." + ListUpdate.NAME + ".type", ListUpdate.UpdateListScriptFactory.class.getName())
- // Node is pure transport
+ // Node is pure transport
.put("transport.tcp.port", port)
.put("http.enabled", false)
- // Setting up ES paths
+ // Setting up ES paths
.put("path.data", new File(dataDir, "es").getAbsolutePath())
.put("path.work", new File(tempDir).getAbsolutePath())
.put("path.logs", new File(logDir).getAbsolutePath());
@@ -119,7 +125,7 @@ public class SearchServer extends MonitoredProcess {
// Set cluster coordinates
esSettings.put("cluster.name", clusterName);
esSettings.put("node.rack_id", StringUtils.defaultIfEmpty(props.of(SONAR_NODE_NAME), "unknown"));
- esSettings.put("cluster.routing.allocation.awareness.attributes","rack_id");
+ esSettings.put("cluster.routing.allocation.awareness.attributes", "rack_id");
if (props.contains(SONAR_NODE_NAME)) {
esSettings.put("node.name", props.of(SONAR_NODE_NAME));
} else {
@@ -138,11 +144,13 @@ public class SearchServer extends MonitoredProcess {
.settings(esSettings)
.build().start();
- while (node != null && !node.isClosed()) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- // Ignore
+ if (this.isBlocking) {
+ while (node != null && !node.isClosed()) {
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ // Ignore
+ }
}
}
}
@@ -153,40 +161,40 @@ public class SearchServer extends MonitoredProcess {
// Disallow dynamic mapping (too expensive)
.put("index.mapper.dynamic", false)
- // Sortable text analyzer
+ // Sortable text analyzer
.put("index.analysis.analyzer.sortable.type", "custom")
.put("index.analysis.analyzer.sortable.tokenizer", "keyword")
.putArray("index.analysis.analyzer.sortable.filter", "trim", "lowercase", "truncate")
- // Edge NGram index-analyzer
+ // Edge NGram index-analyzer
.put("index.analysis.analyzer.index_grams.type", "custom")
.put("index.analysis.analyzer.index_grams.tokenizer", "whitespace")
.putArray("index.analysis.analyzer.index_grams.filter", "trim", "lowercase", "gram_filter")
- // Edge NGram search-analyzer
+ // Edge NGram search-analyzer
.put("index.analysis.analyzer.search_grams.type", "custom")
.put("index.analysis.analyzer.search_grams.tokenizer", "whitespace")
.putArray("index.analysis.analyzer.search_grams.filter", "trim", "lowercase")
- // Word index-analyzer
+ // Word index-analyzer
.put("index.analysis.analyzer.index_words.type", "custom")
.put("index.analysis.analyzer.index_words.tokenizer", "standard")
.putArray("index.analysis.analyzer.index_words.filter",
"standard", "word_filter", "lowercase", "stop", "asciifolding", "porter_stem")
- // Word search-analyzer
+ // Word search-analyzer
.put("index.analysis.analyzer.search_words.type", "custom")
.put("index.analysis.analyzer.search_words.tokenizer", "standard")
.putArray("index.analysis.analyzer.search_words.filter",
"standard", "lowercase", "stop", "asciifolding", "porter_stem")
- // Edge NGram filter
+ // Edge NGram filter
.put("index.analysis.filter.gram_filter.type", "edgeNGram")
.put("index.analysis.filter.gram_filter.min_gram", 2)
.put("index.analysis.filter.gram_filter.max_gram", 15)
.putArray("index.analysis.filter.gram_filter.token_chars", "letter", "digit", "punctuation", "symbol")
- // Word filter
+ // Word filter
.put("index.analysis.filter.word_filter.type", "word_delimiter")
.put("index.analysis.filter.word_filter.generate_word_parts", true)
.put("index.analysis.filter.word_filter.catenate_words", true)
@@ -197,7 +205,7 @@ public class SearchServer extends MonitoredProcess {
.put("index.analysis.filter.word_filter.split_on_numerics", true)
.put("index.analysis.filter.word_filter.stem_english_possessive", true)
- // Path Analyzer
+ // Path Analyzer
.put("index.analysis.analyzer.path_analyzer.type", "custom")
.put("index.analysis.analyzer.path_analyzer.tokenizer", "path_hierarchy");