diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index cbc70f4504b..79b95a0b05a 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -713,8 +713,7 @@ class BuildPlugin implements Plugin { // after the doFirst added by the info plugin, and we can override attributes JavaVersion compilerJavaVersion = ext.get('compilerJavaVersion') as JavaVersion jarTask.manifest.attributes( - // TODO: remove using the short hash - 'Change': ((String)ext.get('gitRevision')).substring(0, 7), + 'Change': ext.get('gitRevision'), 'X-Compile-Elasticsearch-Version': VersionProperties.elasticsearch, 'X-Compile-Lucene-Version': VersionProperties.lucene, 'X-Compile-Elasticsearch-Snapshot': VersionProperties.isElasticsearchSnapshot(), diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/core/MainResponseTests.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/core/MainResponseTests.java index 24925e819a4..e4168ad2e80 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/core/MainResponseTests.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/core/MainResponseTests.java @@ -58,7 +58,7 @@ public class MainResponseTests extends AbstractResponseTestCase, ToXContentFragment { Build.CURRENT.getQualifiedVersion(), Build.CURRENT.flavor().displayName(), Build.CURRENT.type().displayName(), - Build.CURRENT.shortHash(), + Build.CURRENT.hash(), Build.CURRENT.date(), JvmInfo.jvmInfo().version()); System.out.println(versionOutput); diff --git a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java index 30cb93f0f68..181fe4155b2 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java +++ b/server/src/main/java/org/elasticsearch/action/admin/cluster/node/info/NodesInfoResponse.java @@ -69,7 +69,7 @@ public class NodesInfoResponse extends BaseNodesResponse implements To builder.field("version", nodeInfo.getVersion()); builder.field("build_flavor", nodeInfo.getBuild().flavor().displayName()); builder.field("build_type", nodeInfo.getBuild().type().displayName()); - builder.field("build_hash", nodeInfo.getBuild().shortHash()); + builder.field("build_hash", nodeInfo.getBuild().hash()); if (nodeInfo.getTotalIndexingBuffer() != null) { builder.humanReadableField("total_indexing_buffer", "total_indexing_buffer_in_bytes", nodeInfo.getTotalIndexingBuffer()); } diff --git a/server/src/main/java/org/elasticsearch/action/main/MainResponse.java b/server/src/main/java/org/elasticsearch/action/main/MainResponse.java index 38c532525a5..16c2f5528cc 100644 --- a/server/src/main/java/org/elasticsearch/action/main/MainResponse.java +++ b/server/src/main/java/org/elasticsearch/action/main/MainResponse.java @@ -107,7 +107,7 @@ public class MainResponse extends ActionResponse implements ToXContentObject { .field("number", build.getQualifiedVersion()) .field("build_flavor", build.flavor().displayName()) .field("build_type", build.type().displayName()) - .field("build_hash", build.shortHash()) + .field("build_hash", build.hash()) .field("build_date", build.date()) .field("build_snapshot", build.isSnapshot()) .field("lucene_version", version.luceneVersion.toString()) diff --git a/server/src/main/java/org/elasticsearch/bootstrap/Elasticsearch.java b/server/src/main/java/org/elasticsearch/bootstrap/Elasticsearch.java index 48cf0016455..26a1aa30ada 100644 --- a/server/src/main/java/org/elasticsearch/bootstrap/Elasticsearch.java +++ b/server/src/main/java/org/elasticsearch/bootstrap/Elasticsearch.java @@ -127,7 +127,7 @@ class Elasticsearch extends EnvironmentAwareCommand { Build.CURRENT.getQualifiedVersion(), Build.CURRENT.flavor().displayName(), Build.CURRENT.type().displayName(), - Build.CURRENT.shortHash(), + Build.CURRENT.hash(), Build.CURRENT.date(), JvmInfo.jvmInfo().version() ); diff --git a/server/src/main/java/org/elasticsearch/common/logging/DeprecationLogger.java b/server/src/main/java/org/elasticsearch/common/logging/DeprecationLogger.java index f0deaa5b730..31d454e70e3 100644 --- a/server/src/main/java/org/elasticsearch/common/logging/DeprecationLogger.java +++ b/server/src/main/java/org/elasticsearch/common/logging/DeprecationLogger.java @@ -152,7 +152,7 @@ public class DeprecationLogger { "299 Elasticsearch-%s%s-%s", Version.CURRENT.toString(), Build.CURRENT.isSnapshot() ? "-SNAPSHOT" : "", - Build.CURRENT.shortHash()); + Build.CURRENT.hash()); /** * Regular expression to test if a string matches the RFC7234 specification for warning headers. This pattern assumes that the warn code @@ -160,7 +160,9 @@ public class DeprecationLogger { */ public static final Pattern WARNING_HEADER_PATTERN = Pattern.compile( "299 " + // warn code - "Elasticsearch-\\d+\\.\\d+\\.\\d+(?:-(?:alpha|beta|rc)\\d+)?(?:-SNAPSHOT)?-(?:[a-f0-9]{7}|Unknown) " + // warn agent + "Elasticsearch-" + // warn agent + "\\d+\\.\\d+\\.\\d+(?:-(?:alpha|beta|rc)\\d+)?(?:-SNAPSHOT)?-" + // warn agent + "(?:[a-f0-9]{7}(?:[a-f0-9]{33})?|unknown) " + // warn agent "\"((?:\t| |!|[\\x23-\\x5B]|[\\x5D-\\x7E]|[\\x80-\\xFF]|\\\\|\\\\\")*)\"( " + // quoted warning value, captured // quoted RFC 1123 date format "\"" + // opening quote diff --git a/server/src/main/java/org/elasticsearch/node/Node.java b/server/src/main/java/org/elasticsearch/node/Node.java index 9467af274e3..db9b8d4a00f 100644 --- a/server/src/main/java/org/elasticsearch/node/Node.java +++ b/server/src/main/java/org/elasticsearch/node/Node.java @@ -285,7 +285,7 @@ public class Node implements Closeable { jvmInfo.pid(), Build.CURRENT.flavor().displayName(), Build.CURRENT.type().displayName(), - Build.CURRENT.shortHash(), + Build.CURRENT.hash(), Build.CURRENT.date(), Constants.OS_NAME, Constants.OS_VERSION, diff --git a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java index f6234085973..c28057cbebc 100644 --- a/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java +++ b/server/src/main/java/org/elasticsearch/rest/action/cat/RestNodesAction.java @@ -279,7 +279,7 @@ public class RestNodesAction extends AbstractCatAction { table.addCell(node.getVersion().toString()); table.addCell(info == null ? null : info.getBuild().flavor().displayName()); table.addCell(info == null ? null : info.getBuild().type().displayName()); - table.addCell(info == null ? null : info.getBuild().shortHash()); + table.addCell(info == null ? null : info.getBuild().hash()); table.addCell(jvmInfo == null ? null : jvmInfo.version()); @@ -299,7 +299,7 @@ public class RestNodesAction extends AbstractCatAction { table.addCell(diskUsed); table.addCell(diskAvailable); table.addCell(diskUsedPercent); - + table.addCell(jvmStats == null ? null : jvmStats.getMem().getHeapUsed()); table.addCell(jvmStats == null ? null : jvmStats.getMem().getHeapUsedPercent()); table.addCell(jvmInfo == null ? null : jvmInfo.getMem().getHeapMax()); diff --git a/server/src/test/java/org/elasticsearch/BuildTests.java b/server/src/test/java/org/elasticsearch/BuildTests.java index e0d8140c708..ce9e7230d54 100644 --- a/server/src/test/java/org/elasticsearch/BuildTests.java +++ b/server/src/test/java/org/elasticsearch/BuildTests.java @@ -49,33 +49,33 @@ public class BuildTests extends ESTestCase { try (InputStream ignored = FileSystemUtils.openFileURLStream(url)) {} // these should never be null assertNotNull(Build.CURRENT.date()); - assertNotNull(Build.CURRENT.shortHash()); + assertNotNull(Build.CURRENT.hash()); } public void testIsProduction() { Build build = new Build( - Build.CURRENT.flavor(), Build.CURRENT.type(), Build.CURRENT.shortHash(), Build.CURRENT.date(), + Build.CURRENT.flavor(), Build.CURRENT.type(), Build.CURRENT.hash(), Build.CURRENT.date(), Build.CURRENT.isSnapshot(), Math.abs(randomInt()) + "." + Math.abs(randomInt()) + "." + Math.abs(randomInt()) ); assertTrue(build.getQualifiedVersion(), build.isProductionRelease()); assertFalse(new Build( - Build.CURRENT.flavor(), Build.CURRENT.type(), Build.CURRENT.shortHash(), Build.CURRENT.date(), + Build.CURRENT.flavor(), Build.CURRENT.type(), Build.CURRENT.hash(), Build.CURRENT.date(), Build.CURRENT.isSnapshot(), "7.0.0-alpha1" ).isProductionRelease()); assertFalse(new Build( - Build.CURRENT.flavor(), Build.CURRENT.type(), Build.CURRENT.shortHash(), Build.CURRENT.date(), + Build.CURRENT.flavor(), Build.CURRENT.type(), Build.CURRENT.hash(), Build.CURRENT.date(), Build.CURRENT.isSnapshot(), "7.0.0-alpha1-SNAPSHOT" ).isProductionRelease()); assertFalse(new Build( - Build.CURRENT.flavor(), Build.CURRENT.type(), Build.CURRENT.shortHash(), Build.CURRENT.date(), + Build.CURRENT.flavor(), Build.CURRENT.type(), Build.CURRENT.hash(), Build.CURRENT.date(), Build.CURRENT.isSnapshot(), "7.0.0-SNAPSHOT" ).isProductionRelease()); assertFalse(new Build( - Build.CURRENT.flavor(), Build.CURRENT.type(), Build.CURRENT.shortHash(), Build.CURRENT.date(), + Build.CURRENT.flavor(), Build.CURRENT.type(), Build.CURRENT.hash(), Build.CURRENT.date(), Build.CURRENT.isSnapshot(), "Unknown" ).isProductionRelease()); } @@ -84,7 +84,7 @@ public class BuildTests extends ESTestCase { Build build = Build.CURRENT; Build another = new Build( - build.flavor(), build.type(), build.shortHash(), build.date(), build.isSnapshot(), build.getQualifiedVersion() + build.flavor(), build.type(), build.hash(), build.date(), build.isSnapshot(), build.getQualifiedVersion() ); assertEquals(build, another); assertEquals(build.hashCode(), another.hashCode()); @@ -93,7 +93,7 @@ public class BuildTests extends ESTestCase { Arrays.stream(Build.Flavor.values()).filter(f -> !f.equals(build.flavor())).collect(Collectors.toSet()); final Build.Flavor otherFlavor = randomFrom(otherFlavors); Build differentFlavor = new Build( - otherFlavor, build.type(), build.shortHash(), build.date(), build.isSnapshot(), build.getQualifiedVersion() + otherFlavor, build.type(), build.hash(), build.date(), build.isSnapshot(), build.getQualifiedVersion() ); assertNotEquals(build, differentFlavor); @@ -101,7 +101,7 @@ public class BuildTests extends ESTestCase { Arrays.stream(Build.Type.values()).filter(f -> !f.equals(build.type())).collect(Collectors.toSet()); final Build.Type otherType = randomFrom(otherTypes); Build differentType = new Build( - build.flavor(), otherType, build.shortHash(), build.date(), build.isSnapshot(), build.getQualifiedVersion() + build.flavor(), otherType, build.hash(), build.date(), build.isSnapshot(), build.getQualifiedVersion() ); assertNotEquals(build, differentType); @@ -112,17 +112,17 @@ public class BuildTests extends ESTestCase { assertNotEquals(build, differentHash); Build differentDate = new Build( - build.flavor(), build.type(), build.shortHash(), "1970-01-01", build.isSnapshot(), build.getQualifiedVersion() + build.flavor(), build.type(), build.hash(), "1970-01-01", build.isSnapshot(), build.getQualifiedVersion() ); assertNotEquals(build, differentDate); Build differentSnapshot = new Build( - build.flavor(), build.type(), build.shortHash(), build.date(), !build.isSnapshot(), build.getQualifiedVersion() + build.flavor(), build.type(), build.hash(), build.date(), !build.isSnapshot(), build.getQualifiedVersion() ); assertNotEquals(build, differentSnapshot); Build differentVersion = new Build( - build.flavor(), build.type(), build.shortHash(), build.date(), build.isSnapshot(), "1.2.3" + build.flavor(), build.type(), build.hash(), build.date(), build.isSnapshot(), "1.2.3" ); assertNotEquals(build, differentVersion); } @@ -172,23 +172,23 @@ public class BuildTests extends ESTestCase { case 1: return new WriteableBuild(new Build( randomValueOtherThan(b.build.flavor(), () -> randomFrom(Build.Flavor.values())), b.build.type(), - b.build.shortHash(), b.build.date(), b.build.isSnapshot(), b.build.getQualifiedVersion())); + b.build.hash(), b.build.date(), b.build.isSnapshot(), b.build.getQualifiedVersion())); case 2: return new WriteableBuild(new Build(b.build.flavor(), randomValueOtherThan(b.build.type(), () -> randomFrom(Build.Type.values())), - b.build.shortHash(), b.build.date(), b.build.isSnapshot(), b.build.getQualifiedVersion())); + b.build.hash(), b.build.date(), b.build.isSnapshot(), b.build.getQualifiedVersion())); case 3: return new WriteableBuild(new Build(b.build.flavor(), b.build.type(), - randomStringExcept(b.build.shortHash()), b.build.date(), b.build.isSnapshot(), b.build.getQualifiedVersion())); + randomStringExcept(b.build.hash()), b.build.date(), b.build.isSnapshot(), b.build.getQualifiedVersion())); case 4: return new WriteableBuild(new Build(b.build.flavor(), b.build.type(), - b.build.shortHash(), randomStringExcept(b.build.date()), b.build.isSnapshot(), b.build.getQualifiedVersion())); + b.build.hash(), randomStringExcept(b.build.date()), b.build.isSnapshot(), b.build.getQualifiedVersion())); case 5: return new WriteableBuild(new Build(b.build.flavor(), b.build.type(), - b.build.shortHash(), b.build.date(), b.build.isSnapshot() == false, b.build.getQualifiedVersion())); + b.build.hash(), b.build.date(), b.build.isSnapshot() == false, b.build.getQualifiedVersion())); case 6: return new WriteableBuild(new Build(b.build.flavor(), b.build.type(), - b.build.shortHash(), b.build.date(), b.build.isSnapshot(), randomStringExcept(b.build.getQualifiedVersion()))); + b.build.hash(), b.build.date(), b.build.isSnapshot(), randomStringExcept(b.build.getQualifiedVersion()))); } throw new AssertionError(); }); diff --git a/server/src/test/java/org/elasticsearch/action/main/MainResponseTests.java b/server/src/test/java/org/elasticsearch/action/main/MainResponseTests.java index 9c04b1c10fc..5ca6fc76601 100644 --- a/server/src/test/java/org/elasticsearch/action/main/MainResponseTests.java +++ b/server/src/test/java/org/elasticsearch/action/main/MainResponseTests.java @@ -64,7 +64,7 @@ public class MainResponseTests extends AbstractSerializingTestCase String clusterUUID = randomAlphaOfLengthBetween(10, 20); final Build current = Build.CURRENT; Build build = new Build( - current.flavor(), current.type(), current.shortHash(), current.date(), current.isSnapshot(), + current.flavor(), current.type(), current.hash(), current.date(), current.isSnapshot(), current.getQualifiedVersion() ); Version version = Version.CURRENT; @@ -79,7 +79,7 @@ public class MainResponseTests extends AbstractSerializingTestCase + "\"number\":\"" + build.getQualifiedVersion() + "\"," + "\"build_flavor\":\"" + current.flavor().displayName() + "\"," + "\"build_type\":\"" + current.type().displayName() + "\"," - + "\"build_hash\":\"" + current.shortHash() + "\"," + + "\"build_hash\":\"" + current.hash() + "\"," + "\"build_date\":\"" + current.date() + "\"," + "\"build_snapshot\":" + current.isSnapshot() + "," + "\"lucene_version\":\"" + version.luceneVersion.toString() + "\"," @@ -106,7 +106,7 @@ public class MainResponseTests extends AbstractSerializingTestCase case 2: // toggle the snapshot flag of the original Build parameter build = new Build( - Build.Flavor.UNKNOWN, Build.Type.UNKNOWN, build.shortHash(), build.date(), !build.isSnapshot(), + Build.Flavor.UNKNOWN, Build.Type.UNKNOWN, build.hash(), build.date(), !build.isSnapshot(), build.getQualifiedVersion() ); break; diff --git a/server/src/test/java/org/elasticsearch/bootstrap/ElasticsearchCliTests.java b/server/src/test/java/org/elasticsearch/bootstrap/ElasticsearchCliTests.java index f59584bb90c..1f0a953a707 100644 --- a/server/src/test/java/org/elasticsearch/bootstrap/ElasticsearchCliTests.java +++ b/server/src/test/java/org/elasticsearch/bootstrap/ElasticsearchCliTests.java @@ -68,7 +68,7 @@ public class ElasticsearchCliTests extends ESElasticsearchCliTestCase { "Build: %s/%s/%s/%s", Build.CURRENT.flavor().displayName(), Build.CURRENT.type().displayName(), - Build.CURRENT.shortHash(), + Build.CURRENT.hash(), Build.CURRENT.date()); assertThat(output, containsString(expectedBuildOutput)); assertThat(output, containsString("JVM: " + JvmInfo.jvmInfo().version()));