Skip to content

Commit 3925181

Browse files
committed
Merge remote-tracking branch 'upstream/master' into issue_4047
2 parents 00e5d08 + 3f02392 commit 3925181

File tree

544 files changed

+25576
-4862
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

544 files changed

+25576
-4862
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ Contributing to the Elasticsearch codebase
7474

7575
Make sure you have [Maven](http://maven.apache.org) installed, as Elasticsearch uses it as its build system. Integration with IntelliJ and Eclipse should work out of the box. Eclipse users can automatically configure their IDE by running `mvn eclipse:eclipse` and then importing the project into their workspace: `File > Import > Existing project into workspace`.
7676

77+
Elasticsearch also works perfectly with Eclipse's [http://www.eclipse.org/m2e/](m2e). Once you've installed m2e you can import Elasticsearch as an `Existing Maven Project`.
78+
7779
Please follow these formatting guidelines:
7880

7981
* Java indent is 4 spaces

bin/service.bat

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,9 @@ if NOT "%ES_HEAP_SIZE%" == "" set ES_MAX_MEM=%ES_HEAP_SIZE%
125125
call:convertxm %ES_MIN_MEM% JVM_XMS
126126
call:convertxm %ES_MAX_MEM% JVM_XMX
127127

128-
set JAVA_OPTS=%JAVA_OPTS% -XX:+UseParNewGC
129-
130-
rem JAVA_OPTS might be empty so remove the spaces that might trip commons daemon
131-
set JAVA_OPTS=%JAVA_OPTS: =%
128+
rem java_opts might be empty - init to avoid tripping commons daemon (if the command starts with ;)
129+
if not "%JAVA_OPTS%" == "" set JAVA_OPTS=%JAVA_OPTS% -XX:+UseParNewGC
130+
if "%JAVA_OPTS%" == "" set JAVA_OPTS=-XX:+UseParNewGC
132131

133132
if NOT "%ES_HEAP_NEWSIZE%" == "" set JAVA_OPTS=%JAVA_OPTS% -Xmn%ES_HEAP_NEWSIZE%
134133

@@ -174,10 +173,8 @@ set ES_PARAMS=-Delasticsearch;-Des.path.home="%ES_HOME%";-Des.default.config="%C
174173

175174
set JVM_OPTS=%JAVA_OPTS: =;%
176175

177-
if not "%ES_JAVA_OPTS%" == "" (
178-
set JVM_ES_JAVA_OPTS=%ES_JAVA_OPTS: =#%
179-
set JVM_OPTS=%JVM_OPTS%;%JVM_ES_JAVA_OPTS%
180-
)
176+
if not "%ES_JAVA_OPTS%" == "" set JVM_ES_JAVA_OPTS=%ES_JAVA_OPTS: =#%
177+
if not "%ES_JAVA_OPTS%" == "" set JVM_OPTS=%JVM_OPTS%;%JVM_ES_JAVA_OPTS%
181178

182179
if "%ES_START_TYPE%" == "" set ES_START_TYPE=manual
183180
if "%ES_STOP_TIMEOUT%" == "" set ES_STOP_TIMEOUT=0

dev-tools/ElasticSearch.launch

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
3+
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
4+
<listEntry value="/elasticsearch/src/main/java/org/elasticsearch/bootstrap/ElasticSearch.java"/>
5+
</listAttribute>
6+
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
7+
<listEntry value="1"/>
8+
</listAttribute>
9+
<mapAttribute key="org.eclipse.debug.core.environmentVariables">
10+
<mapEntry key="ES_HOME" value="${target_home}"/>
11+
</mapAttribute>
12+
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
13+
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.elasticsearch.bootstrap.ElasticSearch"/>
14+
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="elasticsearch"/>
15+
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
16+
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms256m -Xmx1g -Xss256k -Djava.awt.headless=true -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=logs/heapdump.hprof -Delasticsearch -Des.foreground=yes -Djava.library.path=lib/sigar -ea"/>
17+
</launchConfiguration>

dev-tools/build_randomization.rb

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/usr/bin/env ruby
2+
# Licensed to ElasticSearch and Shay Banon under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the 'License'); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an 'AS IS' BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License
16+
#
17+
# generate property file for the jdk randomization test
18+
#
19+
#
20+
require 'yaml'
21+
22+
class JDKSelector
23+
attr_reader :directory, :jdk_list
24+
25+
def initialize(directory)
26+
@directory = directory
27+
end
28+
29+
# get selection of available jdks from jenkins automatic install directory
30+
def get_jdk
31+
@jdk_list = Dir.entries(directory).select do |x|
32+
x.chars.first == 'J'
33+
end.map do |y|
34+
File.join(directory, y)
35+
end
36+
self
37+
end
38+
39+
# do ranomize selection from a given array
40+
def select_one(selection_array = nil)
41+
selection_array ||= @jdk_list
42+
selection_array[rand(selection_array.size)]
43+
end
44+
end
45+
46+
# given a jdk directory selection, generate revelant environment variables
47+
def get_env_matrix(data_array)
48+
[*data_array].map do |x|
49+
{
50+
'PATH' => File.join(x,'bin') + ':' + ENV['PATH'],
51+
'JAVA_HOME' => x,
52+
'BUILD_DESC' => File.basename(x)
53+
}
54+
end
55+
end
56+
57+
# pick first element out of array of hashes, generate write java property file
58+
def generate_property_file(directory, data)
59+
#array transformation
60+
content = data.first.map do |key, value|
61+
"%s=%s"%[key, value]
62+
end
63+
file_name = (ENV['BUILD_ID'] + ENV['BUILD_NUMBER']) || 'prop'
64+
file_name = file_name.split(File::SEPARATOR).first + '.txt'
65+
File.open(File.join(directory, file_name), 'w') do |file|
66+
file.write(content.join("\n"))
67+
end
68+
end
69+
70+
# jenkins sets pwd prior to execution
71+
jdk_selector = JDKSelector.new(File.join(ENV['PWD'],'tools','hudson.model.JDK'))
72+
environment_matrix = get_env_matrix(jdk_selector.get_jdk.select_one)
73+
74+
working_directory = ENV['WORKSPACE'] || '/var/tmp'
75+
generate_property_file(working_directory, environment_matrix)

0 commit comments

Comments
 (0)