parent
646ab22e3a
commit
70bbcb4c48
24
pom.xml
24
pom.xml
|
@ -285,6 +285,7 @@
|
|||
<includes>
|
||||
<include>**/*.*</include>
|
||||
</includes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
|
||||
|
@ -331,7 +332,8 @@
|
|||
<jvmOutputAction>pipe,warn</jvmOutputAction>
|
||||
<leaveTemporary>true</leaveTemporary>
|
||||
<listeners>
|
||||
<report-ant-xml mavenExtensions="true" dir="${project.build.directory}/surefire-reports" />
|
||||
<report-ant-xml mavenExtensions="true"
|
||||
dir="${project.build.directory}/surefire-reports"/>
|
||||
<report-text
|
||||
showThrowable="true"
|
||||
showStackTraces="true"
|
||||
|
@ -380,7 +382,8 @@
|
|||
<tests.slow>${tests.slow}</tests.slow>
|
||||
<es.node.local>${env.ES_TEST_LOCAL}</es.node.local>
|
||||
<es.transport.tcp.compress>${env.ES_TEST_COMPRESS}</es.transport.tcp.compress>
|
||||
<es.action.wait_on_mapping_change>${env.ES_WAIT_ON_MAPPING_CHANGE}</es.action.wait_on_mapping_change>
|
||||
<es.action.wait_on_mapping_change>${env.ES_WAIT_ON_MAPPING_CHANGE}
|
||||
</es.action.wait_on_mapping_change>
|
||||
<java.awt.headless>true</java.awt.headless>
|
||||
</systemProperties>
|
||||
</configuration>
|
||||
|
@ -532,6 +535,23 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>buildnumber-maven-plugin</artifactId>
|
||||
<version>1.2</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>validate</phase>
|
||||
<goals>
|
||||
<goal>create</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<doCheck>false</doCheck>
|
||||
<doUpdate>false</doUpdate>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* Licensed to ElasticSearch and Shay Banon under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. ElasticSearch licenses this
|
||||
* file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch;
|
||||
|
||||
import org.elasticsearch.common.io.FastStringReader;
|
||||
import org.elasticsearch.common.io.Streams;
|
||||
import org.joda.time.DateTimeZone;
|
||||
import org.joda.time.format.ISODateTimeFormat;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class Build {
|
||||
|
||||
public static final Build CURRENT;
|
||||
|
||||
static {
|
||||
String hash = "NA";
|
||||
String hashShort = "NA";
|
||||
String timestamp = "NA";
|
||||
|
||||
try {
|
||||
String properties = Streams.copyToStringFromClasspath("/es-build.properties");
|
||||
Properties props = new Properties();
|
||||
props.load(new FastStringReader(properties));
|
||||
hash = props.getProperty("hash", hash);
|
||||
if (!hash.equals("NA")) {
|
||||
hashShort = hash.substring(0, 7);
|
||||
}
|
||||
String gitTimestampRaw = props.getProperty("timestamp");
|
||||
if (gitTimestampRaw != null) {
|
||||
timestamp = ISODateTimeFormat.dateTimeNoMillis().withZone(DateTimeZone.UTC).print(Long.parseLong(gitTimestampRaw));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// just ignore...
|
||||
}
|
||||
|
||||
CURRENT = new Build(hash, hashShort, timestamp);
|
||||
}
|
||||
|
||||
private String hash;
|
||||
private String hashShort;
|
||||
private String timestamp;
|
||||
|
||||
Build(String hash, String hashShort, String timestamp) {
|
||||
this.hash = hash;
|
||||
this.hashShort = hashShort;
|
||||
this.timestamp = timestamp;
|
||||
}
|
||||
|
||||
public String hash() {
|
||||
return hash;
|
||||
}
|
||||
|
||||
public String hashShort() {
|
||||
return hashShort;
|
||||
}
|
||||
|
||||
public String timestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
}
|
|
@ -295,7 +295,7 @@ public class Version implements Serializable {
|
|||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("ElasticSearch Version: " + Version.CURRENT + ", JVM: " + JvmInfo.jvmInfo().version() + "(" + JvmInfo.jvmInfo().vmVersion() + ")");
|
||||
System.out.println("Version: " + Version.CURRENT + ", Build: " + Build.CURRENT.hashShort() + "/" + Build.CURRENT.timestamp() + ", JVM: " + JvmInfo.jvmInfo().version());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
package org.elasticsearch.node.internal;
|
||||
|
||||
import org.elasticsearch.Build;
|
||||
import org.elasticsearch.ElasticSearchException;
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.action.ActionModule;
|
||||
|
@ -119,7 +120,9 @@ public final class InternalNode implements Node {
|
|||
Tuple<Settings, Environment> tuple = InternalSettingsPerparer.prepareSettings(pSettings, loadConfigSettings);
|
||||
|
||||
ESLogger logger = Loggers.getLogger(Node.class, tuple.v1().get("name"));
|
||||
logger.info("{{}}[{}]: initializing ...", Version.CURRENT, JvmInfo.jvmInfo().pid());
|
||||
logger.info("version[{}], pid[{}], build[{}/{}]", Version.CURRENT, JvmInfo.jvmInfo().pid(), Build.CURRENT.hashShort(), Build.CURRENT.timestamp());
|
||||
|
||||
logger.info("initializing ...");
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
Environment env = tuple.v2();
|
||||
|
@ -170,7 +173,7 @@ public final class InternalNode implements Node {
|
|||
|
||||
client = injector.getInstance(Client.class);
|
||||
|
||||
logger.info("{{}}[{}]: initialized", Version.CURRENT, JvmInfo.jvmInfo().pid());
|
||||
logger.info("initialized");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -189,7 +192,7 @@ public final class InternalNode implements Node {
|
|||
}
|
||||
|
||||
ESLogger logger = Loggers.getLogger(Node.class, settings.get("name"));
|
||||
logger.info("{{}}[{}]: starting ...", Version.CURRENT, JvmInfo.jvmInfo().pid());
|
||||
logger.info("starting ...");
|
||||
|
||||
// hack around dependency injection problem (for now...)
|
||||
injector.getInstance(Discovery.class).setAllocationService(injector.getInstance(AllocationService.class));
|
||||
|
@ -219,7 +222,7 @@ public final class InternalNode implements Node {
|
|||
}
|
||||
injector.getInstance(BulkUdpService.class).start();
|
||||
|
||||
logger.info("{{}}[{}]: started", Version.CURRENT, JvmInfo.jvmInfo().pid());
|
||||
logger.info("started");
|
||||
|
||||
return this;
|
||||
}
|
||||
|
@ -230,7 +233,7 @@ public final class InternalNode implements Node {
|
|||
return this;
|
||||
}
|
||||
ESLogger logger = Loggers.getLogger(Node.class, settings.get("name"));
|
||||
logger.info("{{}}[{}]: stopping ...", Version.CURRENT, JvmInfo.jvmInfo().pid());
|
||||
logger.info("stopping ...");
|
||||
|
||||
injector.getInstance(BulkUdpService.class).stop();
|
||||
if (settings.getAsBoolean("http.enabled", true)) {
|
||||
|
@ -264,7 +267,7 @@ public final class InternalNode implements Node {
|
|||
injector.getInstance(plugin).stop();
|
||||
}
|
||||
|
||||
logger.info("{{}}[{}]: stopped", Version.CURRENT, JvmInfo.jvmInfo().pid());
|
||||
logger.info("stopped");
|
||||
|
||||
return this;
|
||||
}
|
||||
|
@ -278,7 +281,7 @@ public final class InternalNode implements Node {
|
|||
}
|
||||
|
||||
ESLogger logger = Loggers.getLogger(Node.class, settings.get("name"));
|
||||
logger.info("{{}}[{}]: closing ...", Version.CURRENT, JvmInfo.jvmInfo().pid());
|
||||
logger.info("closing ...");
|
||||
|
||||
StopWatch stopWatch = new StopWatch("node_close");
|
||||
stopWatch.start("bulk.udp");
|
||||
|
@ -357,7 +360,7 @@ public final class InternalNode implements Node {
|
|||
CachedStreams.clear();
|
||||
ThreadLocals.clearReferencesThreadLocals();
|
||||
|
||||
logger.info("{{}}[{}]: closed", Version.CURRENT, JvmInfo.jvmInfo().pid());
|
||||
logger.info("closed");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
package org.elasticsearch.rest.action.main;
|
||||
|
||||
import org.apache.lucene.util.Constants;
|
||||
import org.elasticsearch.Build;
|
||||
import org.elasticsearch.ExceptionsHelper;
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.action.ActionListener;
|
||||
|
@ -78,7 +79,9 @@ public class RestMainAction extends BaseRestHandler {
|
|||
}
|
||||
builder.startObject("version")
|
||||
.field("number", Version.CURRENT.number())
|
||||
.field("snapshot_build", Version.CURRENT.snapshot)
|
||||
.field("build_hash", Build.CURRENT.hash())
|
||||
.field("build_timestamp", Build.CURRENT.timestamp())
|
||||
.field("build_snapshot", Version.CURRENT.snapshot)
|
||||
// We use the lucene version from lucene constants since
|
||||
// this includes bugfix release version as well and is already in
|
||||
// the right format. We can also be sure that the format is maitained
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
version=${project.version}
|
||||
hash=${buildNumber}
|
||||
timestamp=${timestamp}
|
Loading…
Reference in New Issue