diff --git a/build.gradle b/build.gradle index a0c00db10dca2..546cbb04104e7 100644 --- a/build.gradle +++ b/build.gradle @@ -36,16 +36,18 @@ if (properties.get("org.elasticsearch.acceptScanTOS", "false") == "true") { } } +boolean isSnapshot = Boolean.parseBoolean(System.getProperty("build.snapshot", "true")) + // common maven publishing configuration subprojects { group = 'org.elasticsearch' - version = VersionProperties.elasticsearch.toString() + version = VersionProperties.elasticsearch description = "Elasticsearch subproject ${project.path}" } apply plugin: 'nebula.info-scm' String licenseCommit -if (VersionProperties.elasticsearch.toString().endsWith('-SNAPSHOT')) { +if (isSnapshot) { licenseCommit = scminfo.change ?: "master" // leniency for non git builds } else { licenseCommit = "v${version}" @@ -103,7 +105,7 @@ subprojects { * in a branch if there are only betas and rcs in the branch so we have * *something* to test against. */ VersionCollection versions = new VersionCollection(file('server/src/main/java/org/elasticsearch/Version.java').readLines('UTF-8')) -if (versions.currentVersion != VersionProperties.elasticsearch) { +if (versions.currentVersion.isSameVersionNumber(VersionProperties.elasticsearchVersion) == false) { throw new GradleException("The last version in Versions.java [${versions.currentVersion}] does not match " + "VersionProperties.elasticsearch [${VersionProperties.elasticsearch}]") } @@ -299,7 +301,7 @@ subprojects { // other packages (e.g org.elasticsearch.client) will point to server rather than // their own artifacts. if (project.plugins.hasPlugin(BuildPlugin) || project.plugins.hasPlugin(PluginBuildPlugin)) { - String artifactsHost = VersionProperties.elasticsearch.isSnapshot() ? "https://snapshots.elastic.co" : "https://artifacts.elastic.co" + String artifactsHost = isSnapshot ? "https://snapshots.elastic.co" : "https://artifacts.elastic.co" Closure sortClosure = { a, b -> b.group <=> a.group } Closure depJavadocClosure = { shadowed, dep -> if (dep.group == null || false == dep.group.startsWith('org.elasticsearch')) { diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index da8ad788164d2..2fbfeb1c67674 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -16,7 +16,6 @@ * specific language governing permissions and limitations * under the License. */ -import java.nio.file.Files import org.gradle.util.GradleVersion plugins { @@ -53,35 +52,26 @@ sourceCompatibility = minimumRuntimeVersion Properties props = new Properties() props.load(project.file('version.properties').newDataInputStream()) -version = props.getProperty('elasticsearch') -boolean snapshot = "true".equals(System.getProperty("build.snapshot", "true")); -if (snapshot) { - // we update the version property to reflect if we are building a snapshot or a release build - // we write this back out below to load it in the Build.java which will be shown in rest main action - // to indicate this being a snapshot build or a release build. - version += "-SNAPSHOT" - props.put("elasticsearch", version); -} - -File tempPropertiesFile = new File(project.buildDir, "version.properties") -task writeVersionProperties { - inputs.properties(props) - outputs.file(tempPropertiesFile) +processResources { doLast { - OutputStream stream = Files.newOutputStream(tempPropertiesFile.toPath()); - try { - props.store(stream, "UTF-8"); - } finally { - stream.close(); - } + // TODO change default to "" once we have a non qualified ML snapshot + String qualifier = System.getProperty("build.version_qualifier", "alpha1"); + boolean isSnapshot = Boolean.parseBoolean(System.getProperty("build.snapshot", "true")); + props.put( + "elasticsearchBuild", + props.get("elasticsearch") + + (qualifier.isEmpty() ? "" : "-") + qualifier + + (isSnapshot ? "-SNAPSHOT" : "") + ) + Writer versionFileWriter = file("$destinationDir/version.properties").newWriter() + try { + props.store(versionFileWriter, "Generated version properties") + } finally { + versionFileWriter.close() + } } } -processResources { - dependsOn writeVersionProperties - from tempPropertiesFile -} - /***************************************************************************** * Dependencies used by the entire build * *****************************************************************************/ diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index 6ed98217d34fe..17a5a73d97cd7 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -694,18 +694,15 @@ class BuildPlugin implements Plugin { jarTask.destinationDir = new File(project.buildDir, 'distributions') // fixup the jar manifest jarTask.doFirst { - final Version versionWithoutSnapshot = new Version( - VersionProperties.elasticsearch.major, - VersionProperties.elasticsearch.minor, - VersionProperties.elasticsearch.revision, - VersionProperties.elasticsearch.suffix, - false) // this doFirst is added before the info plugin, therefore it will run // after the doFirst added by the info plugin, and we can override attributes jarTask.manifest.attributes( - 'X-Compile-Elasticsearch-Version': versionWithoutSnapshot, + 'X-Compile-Elasticsearch-Version': VersionProperties.elasticsearchVersion, + 'X-Compile-Elasticsearch-Qualifier': System.getProperty("build.version_qualifier", ""), + 'X-Compile-Elasticsearch-Snapshot': Boolean.parseBoolean( + System.getProperty("build.snapshot", "true") + ), 'X-Compile-Lucene-Version': VersionProperties.lucene, - 'X-Compile-Elasticsearch-Snapshot': VersionProperties.elasticsearch.isSnapshot(), 'Build-Date': ZonedDateTime.now(ZoneOffset.UTC), 'Build-Java-Version': project.compilerJavaVersion) if (jarTask.manifest.attributes.containsKey('Change') == false) { diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/VersionCollection.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/VersionCollection.groovy index daab0efc8c69a..0da2afef5f61f 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/VersionCollection.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/VersionCollection.groovy @@ -47,8 +47,6 @@ import java.util.regex.Matcher * Notes on terminology: * - The case for major+1 being released is accomplished through the isReleasableBranch value. If this is false, then the branch is no longer * releasable, meaning not to test against any snapshots. - * - Released is defined as having > 1 suffix-free version in a major.minor series. For instance, only 6.2.0 means unreleased, but a - * 6.2.0 and 6.2.1 mean that 6.2.0 was released already. */ class VersionCollection { @@ -73,48 +71,27 @@ class VersionCollection { * @param versionLines The lines of the Version.java file. */ VersionCollection(List versionLines) { - final boolean buildSnapshot = System.getProperty("build.snapshot", "true") == "true" - - List versions = [] - // This class should be converted wholesale to use the treeset - for (final String line : versionLines) { final Matcher match = line =~ /\W+public static final Version V_(\d+)_(\d+)_(\d+)(_alpha\d+|_beta\d+|_rc\d+)? .*/ if (match.matches()) { final Version foundVersion = new Version( - Integer.parseInt(match.group(1)), Integer.parseInt(match.group(2)), - Integer.parseInt(match.group(3)), (match.group(4) ?: '').replace('_', '-'), false) - safeAddToSet(foundVersion) + Integer.parseInt(match.group(1)), + Integer.parseInt(match.group(2)), + Integer.parseInt(match.group(3)) + ) + versionSet.add(foundVersion) } } - if (versionSet.empty) { throw new GradleException("Unexpectedly found no version constants in Versions.java") } - - // If the major version has been released, then remove all of the alpha/beta/rc versions that exist in the set - versionSet.removeAll { it.suffix.isEmpty() == false && isMajorReleased(it, versionSet) } - - // set currentVersion - Version lastVersion = versionSet.last() - currentVersion = new Version(lastVersion.major, lastVersion.minor, lastVersion.revision, lastVersion.suffix, buildSnapshot) - - // remove all of the potential alpha/beta/rc from the currentVersion - versionSet.removeAll { - it.suffix.isEmpty() == false && - it.major == currentVersion.major && - it.minor == currentVersion.minor && - it.revision == currentVersion.revision } - - // re-add the currentVersion to the set - versionSet.add(currentVersion) + currentVersion = versionSet.last() if (isReleasableBranch) { if (isReleased(currentVersion)) { // caveat 0 - if the minor has been released then it only has a maintenance version // go back 1 version to get the last supported snapshot version of the line, which is a maint bugfix - Version highestMinor = getHighestPreviousMinor(currentVersion.major) - maintenanceBugfixSnapshot = replaceAsSnapshot(highestMinor) + maintenanceBugfixSnapshot = getHighestPreviousMinor(currentVersion.major) } else { // caveat 3 - if our currentVersion is a X.0.0, we need to check X-1 minors to see if they are released if (currentVersion.minor == 0) { @@ -125,15 +102,15 @@ class VersionCollection { // it will bail. The order is that the minor snapshot is fufilled first, and then the staged minor snapshot if (nextMinorSnapshot == null) { // it has not been set yet - nextMinorSnapshot = replaceAsSnapshot(version) + nextMinorSnapshot = version } else if (stagedMinorSnapshot == null) { - stagedMinorSnapshot = replaceAsSnapshot(version) + stagedMinorSnapshot = version } else { throw new GradleException("More than 2 snapshot version existed for the next minor and staged (frozen) minors.") } } else { // caveat 2 - this is the last minor snap for this major, so replace the highest (last) one of these and break - nextBugfixSnapshot = replaceAsSnapshot(version) + nextBugfixSnapshot = version // we only care about the largest minor here, so in the case of 6.1 and 6.0, it will only get 6.1 break } @@ -148,24 +125,23 @@ class VersionCollection { // caveat 1 - This should only ever contain 0 or 1 branch in flight. An example is 6.x is frozen, and 6.2 is cut // but not yet released there is some simple logic to make sure that in the case of more than 1, it will bail if (stagedMinorSnapshot == null) { - stagedMinorSnapshot = replaceAsSnapshot(version) + stagedMinorSnapshot = version } else { throw new GradleException("More than 1 snapshot version existed for the staged (frozen) minors.") } } else { // caveat 2 - this is the last minor snap for this major, so replace the highest (last) one of these and break - nextBugfixSnapshot = replaceAsSnapshot(version) + nextBugfixSnapshot = version // we only care about the largest minor here, so in the case of 6.1 and 6.0, it will only get 6.1 break } } // caveat 0 - now dip back 1 version to get the last supported snapshot version of the line Version highestMinor = getHighestPreviousMinor(currentVersion.major) - maintenanceBugfixSnapshot = replaceAsSnapshot(highestMinor) + maintenanceBugfixSnapshot = highestMinor } } } - this.versions = Collections.unmodifiableList(versionSet.toList()) } @@ -275,18 +251,6 @@ class VersionCollection { return version.revision > 0 } - /** - * Validates that the count of non suffixed (alpha/beta/rc) versions in a given major to major+1 is greater than 1. - * This means that there is more than just a major.0.0 or major.0.0-alpha in a branch to signify it has been prevously released. - */ - private boolean isMajorReleased(Version version, TreeSet items) { - return items - .tailSet(Version.fromString("${version.major}.0.0")) - .headSet(Version.fromString("${version.major + 1}.0.0")) - .count { it.suffix.isEmpty() } // count only non suffix'd versions as actual versions that may be released - .intValue() > 1 - } - /** * Gets the largest version previous major version based on the nextMajorVersion passed in. * If you have a list [5.0.2, 5.1.2, 6.0.1, 6.1.1] and pass in 6 for the nextMajorVersion, it will return you 5.1.2 @@ -299,22 +263,11 @@ class VersionCollection { /** * Helper function for turning a version into a snapshot version, removing and readding it to the tree */ - private Version replaceAsSnapshot(Version version) { - versionSet.remove(version) - Version snapshotVersion = new Version(version.major, version.minor, version.revision, version.suffix, true) - safeAddToSet(snapshotVersion) - return snapshotVersion - } /** * Safely adds a value to the treeset, or bails if the value already exists. * @param version */ - private void safeAddToSet(Version version) { - if (versionSet.add(version) == false) { - throw new GradleException("Versions.java contains duplicate entries for ${version}") - } - } /** * Gets the entire set of major.minor.* given those parameters. diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/DocsTestPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/DocsTestPlugin.groovy index 9b2b1ca215673..f912328368123 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/DocsTestPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/doc/DocsTestPlugin.groovy @@ -37,12 +37,12 @@ public class DocsTestPlugin extends RestTestPlugin { // Docs are published separately so no need to assemble project.tasks.assemble.enabled = false Map defaultSubstitutions = [ - /* These match up with the asciidoc syntax for substitutions but - * the values may differ. In particular {version} needs to resolve - * to the version being built for testing but needs to resolve to - * the last released version for docs. */ - '\\{version\\}': - VersionProperties.elasticsearch.toString().replace('-SNAPSHOT', ''), + /* These match up with the asciidoc syntax for substitutions but + * the values may differ. In particular {version} needs to resolve + * to the version being built for testing but needs to resolve to + * the last released version for docs. */ + '\\{version\\}': VersionProperties.elasticsearchVersion.toString(), + '\\{plugin_version\\}': VersionProperties.elasticsearchVersion.toString(), '\\{lucene_version\\}' : VersionProperties.lucene.replaceAll('-snapshot-\\w+$', ''), '\\{build_flavor\\}' : project.integTestCluster.distribution.startsWith('oss-') ? 'oss' : 'default', diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy index a14a3a680da1c..fde473faee134 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy @@ -22,6 +22,7 @@ import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin import nebula.plugin.publishing.maven.MavenScmPlugin import org.elasticsearch.gradle.BuildPlugin import org.elasticsearch.gradle.NoticeTask +import org.elasticsearch.gradle.VersionProperties import org.elasticsearch.gradle.test.RestIntegTestTask import org.elasticsearch.gradle.test.RunTask import org.gradle.api.Project @@ -112,8 +113,8 @@ public class PluginBuildPlugin extends BuildPlugin { private static void configureDependencies(Project project) { project.dependencies { - compileOnly "org.elasticsearch:elasticsearch:${project.versions.elasticsearch}" - testCompile "org.elasticsearch.test:framework:${project.versions.elasticsearch}" + compileOnly "org.elasticsearch:elasticsearch:${VersionProperties.elasticsearch}" + testCompile "org.elasticsearch.test:framework:${VersionProperties.elasticsearch}" // we "upgrade" these optional deps to provided for plugins, since they will run // with a full elasticsearch server that includes optional deps compileOnly "org.locationtech.spatial4j:spatial4j:${project.versions.spatial4j}" diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginPropertiesTask.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginPropertiesTask.groovy index 9588f77a71db7..f7de7e97f20b5 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginPropertiesTask.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginPropertiesTask.groovy @@ -66,17 +66,11 @@ class PluginPropertiesTask extends Copy { } Map generateSubstitutions() { - def stringSnap = { version -> - if (version.endsWith("-SNAPSHOT")) { - return version.substring(0, version.length() - 9) - } - return version - } return [ 'name': extension.name, 'description': extension.description, - 'version': stringSnap(extension.version), - 'elasticsearchVersion': stringSnap(VersionProperties.elasticsearch.toString()), + 'version': extension.version as String, + 'elasticsearchVersion': VersionProperties.elasticsearchVersion as String, 'javaVersion': project.targetCompatibility as String, 'classname': extension.classname, 'extendedPlugins': extension.extendedPlugins.join(','), diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy index 06557d4ccfdb7..c7a13cdcaa73e 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/precommit/PrecommitTasks.groovy @@ -21,7 +21,6 @@ package org.elasticsearch.gradle.precommit import org.elasticsearch.gradle.ExportElasticsearchBuildResourcesTask import org.gradle.api.Project import org.gradle.api.Task -import org.gradle.api.artifacts.Configuration import org.gradle.api.plugins.JavaBasePlugin import org.gradle.api.plugins.quality.Checkstyle /** diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy index 4ede349b206d6..c7a6cbc861eb5 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/ClusterFormationTasks.groovy @@ -91,7 +91,7 @@ class ClusterFormationTasks { if (System.getProperty('tests.distribution', 'oss-zip') == 'integ-test-zip') { throw new Exception("tests.distribution=integ-test-zip is not supported") } - configureDistributionDependency(project, config.distribution, currentDistro, VersionProperties.elasticsearch) + configureDistributionDependency(project, config.distribution, currentDistro, VersionProperties.elasticsearchVersion) if (config.numBwcNodes > 0) { if (config.bwcVersion == null) { throw new IllegalArgumentException("Must specify bwcVersion when numBwcNodes > 0") @@ -117,7 +117,7 @@ class ClusterFormationTasks { elasticsearchVersion = config.bwcVersion distro = bwcDistro } else { - elasticsearchVersion = VersionProperties.elasticsearch + elasticsearchVersion = VersionProperties.elasticsearchVersion distro = currentDistro } NodeInfo node = new NodeInfo(config, i, project, prefix, elasticsearchVersion, sharedDir) @@ -149,7 +149,11 @@ class ClusterFormationTasks { artifactName += '-oss' subgroup = distro.substring('oss-'.length()) } - project.dependencies.add(configuration.name, "org.elasticsearch.distribution.${subgroup}:${artifactName}:${elasticsearchVersion}@${packaging}") + String esDepVersion = elasticsearchVersion == VersionProperties.elasticsearchVersion ? VersionProperties.elasticsearch : elasticsearchVersion + project.dependencies.add( + configuration.name, + "org.elasticsearch.distribution.${subgroup}:${artifactName}:${esDepVersion}@${packaging}" + ) } /** Adds a dependency on a different version of the given plugin, which will be retrieved using gradle's dependency resolution */ @@ -204,7 +208,7 @@ class ClusterFormationTasks { setup = configureAddKeystoreFileTasks(prefix, project, setup, node) if (node.config.plugins.isEmpty() == false) { - if (node.nodeVersion == VersionProperties.elasticsearch) { + if (node.nodeVersion == VersionProperties.elasticsearchVersion) { setup = configureCopyPluginsTask(taskName(prefix, node, 'copyPlugins'), project, setup, node, prefix) } else { setup = configureCopyBwcPluginsTask(taskName(prefix, node, 'copyBwcPlugins'), project, setup, node, prefix) @@ -272,27 +276,30 @@ class ClusterFormationTasks { elasticsearch source tree. If this is a plugin built in the elasticsearch source tree or this is a distro in the elasticsearch source tree then this should be the version of elasticsearch built by the source tree. If it isn't then Bad Things(TM) will happen. */ - Task extract + Task extract = project.tasks.create(name: name, type: Copy, dependsOn: extractDependsOn) { + into node.baseDir + eachFile { fcp -> + fcp.path = fcp.path + .replaceFirst("${VersionProperties.elasticsearch}/", "${VersionProperties.elasticsearchVersion}/") + .replaceFirst("-SNAPSHOT/", '/') + .replaceFirst("-SNAPSHOT\$", '') + } + includeEmptyDirs false + doLast { + // Make sure to create the empty dirs we need + new File(node.homeDir, "logs").mkdirs() + } + } switch (node.config.distribution) { case 'integ-test-zip': case 'zip': case 'oss-zip': - extract = project.tasks.create(name: name, type: Copy, dependsOn: extractDependsOn) { - from { - project.zipTree(configuration.singleFile) - } - into node.baseDir - } + extract.from { project.zipTree(configuration.singleFile) } break; case 'tar': case 'oss-tar': - extract = project.tasks.create(name: name, type: Copy, dependsOn: extractDependsOn) { - from { - project.tarTree(project.resources.gzip(configuration.singleFile)) - } - into node.baseDir - } + extract.from { project.tarTree(project.resources.gzip(configuration.singleFile)) } break; default: throw new InvalidUserDataException("Unknown distribution: ${node.config.distribution}") @@ -558,7 +565,7 @@ class ClusterFormationTasks { static Task configureInstallPluginTask(String name, Project project, Task setup, NodeInfo node, String pluginName, String prefix) { final FileCollection pluginZip; - if (node.nodeVersion != VersionProperties.elasticsearch) { + if (node.nodeVersion != VersionProperties.elasticsearchVersion) { pluginZip = project.configurations.getByName(pluginBwcConfigurationName(prefix, pluginName)) } else { pluginZip = project.configurations.getByName(pluginConfigurationName(prefix, pluginName)) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/NodeInfo.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/NodeInfo.groovy index aaf4e468182a9..9d33f675e04bc 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/NodeInfo.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/test/NodeInfo.groovy @@ -23,6 +23,7 @@ import com.sun.jna.Native import com.sun.jna.WString import org.apache.tools.ant.taskdefs.condition.Os import org.elasticsearch.gradle.Version +import org.elasticsearch.gradle.VersionProperties import org.gradle.api.InvalidUserDataException import org.gradle.api.Project @@ -306,7 +307,8 @@ class NodeInfo { /** Returns the directory elasticsearch home is contained in for the given distribution */ static File homeDir(File baseDir, String distro, Version nodeVersion) { - String path + final String path + switch (distro) { case 'integ-test-zip': case 'zip': diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/Version.java b/buildSrc/src/main/java/org/elasticsearch/gradle/Version.java index 53855716840dd..ca5cdcef2a6b4 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/Version.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/Version.java @@ -12,49 +12,23 @@ public final class Version implements Comparable { private final int minor; private final int revision; private final int id; - private final boolean snapshot; - /** - * Suffix on the version name. - */ - private final String suffix; private static final Pattern pattern = - Pattern.compile("(\\d)+\\.(\\d+)\\.(\\d+)(-alpha\\d+|-beta\\d+|-rc\\d+)?(-SNAPSHOT)?"); + Pattern.compile("(\\d)+\\.(\\d+)\\.(\\d+)-?(alpha\\d+|beta\\d+|rc\\d+)?"); - public Version(int major, int minor, int revision, String suffix, boolean snapshot) { + Version(int major, int minor, int revision) { Objects.requireNonNull(major, "major version can't be null"); Objects.requireNonNull(minor, "minor version can't be null"); Objects.requireNonNull(revision, "revision version can't be null"); this.major = major; this.minor = minor; this.revision = revision; - this.snapshot = snapshot; - this.suffix = suffix == null ? "" : suffix; - - int suffixOffset = 0; - if (this.suffix.isEmpty()) { - // no suffix will be considered smaller, uncomment to change that - // suffixOffset = 100; - } else { - if (this.suffix.contains("alpha")) { - suffixOffset += parseSuffixNumber(this.suffix.substring(6)); - } else if (this.suffix.contains("beta")) { - suffixOffset += 25 + parseSuffixNumber(this.suffix.substring(5)); - } else if (this.suffix.contains("rc")) { - suffixOffset += 50 + parseSuffixNumber(this.suffix.substring(3)); - } - else { - throw new IllegalArgumentException("Suffix must contain one of: alpha, beta or rc"); - } - } - - // currently snapshot is not taken into account - this.id = major * 10000000 + minor * 100000 + revision * 1000 + suffixOffset * 10 /*+ (snapshot ? 1 : 0)*/; + this.id = major * 10000000 + minor * 100000 + revision * 1000; } private static int parseSuffixNumber(String substring) { if (substring.isEmpty()) { - throw new IllegalArgumentException("Invalid suffix, must contain a number e.x. alpha2"); + throw new IllegalArgumentException("Invalid qualifier, must contain a number e.x. alpha2"); } return Integer.parseInt(substring); } @@ -64,24 +38,19 @@ public static Version fromString(final String s) { Matcher matcher = pattern.matcher(s); if (matcher.matches() == false) { throw new IllegalArgumentException( - "Invalid version format: '" + s + "'. Should be major.minor.revision[-(alpha|beta|rc)Number][-SNAPSHOT]" + "Invalid version format: '" + s + "'. Should be major.minor.revision" ); } - return new Version( - Integer.parseInt(matcher.group(1)), - parseSuffixNumber(matcher.group(2)), - parseSuffixNumber(matcher.group(3)), - matcher.group(4), - matcher.group(5) != null + Integer.parseInt(matcher.group(1)), + parseSuffixNumber(matcher.group(2)), + parseSuffixNumber(matcher.group(3)) ); } @Override public String toString() { - final String snapshotStr = snapshot ? "-SNAPSHOT" : ""; - return String.valueOf(getMajor()) + "." + String.valueOf(getMinor()) + "." + String.valueOf(getRevision()) + - (suffix == null ? "" : suffix) + snapshotStr; + return String.valueOf(getMajor()) + "." + getMinor() + "." + getRevision(); } public boolean before(Version compareTo) { @@ -116,19 +85,6 @@ public boolean after(String compareTo) { return after(fromString(compareTo)); } - public boolean onOrBeforeIncludingSuffix(Version otherVersion) { - if (id != otherVersion.getId()) { - return id < otherVersion.getId(); - } - - if (suffix.equals("")) { - return otherVersion.getSuffix().equals(""); - } - - - return otherVersion.getSuffix().equals("") || suffix.compareTo(otherVersion.getSuffix()) < 0; - } - @Override public boolean equals(Object o) { if (this == o) return true; @@ -137,17 +93,22 @@ public boolean equals(Object o) { return major == version.major && minor == version.minor && revision == version.revision && - id == version.id && - snapshot == version.snapshot && - Objects.equals(suffix, version.suffix); + id == version.id; } @Override public int hashCode() { - return Objects.hash(major, minor, revision, id, snapshot, suffix); + return Objects.hash(major, minor, revision, id); + } + + public boolean isSameVersionNumber(Version other) { + return major == other.major && + minor == other.minor && + revision == other.revision; } + public int getMajor() { return major; } @@ -164,14 +125,6 @@ protected int getId() { return id; } - public boolean isSnapshot() { - return snapshot; - } - - public String getSuffix() { - return suffix; - } - @Override public int compareTo(Version other) { return Integer.compare(getId(), other.getId()); diff --git a/buildSrc/src/main/java/org/elasticsearch/gradle/VersionProperties.java b/buildSrc/src/main/java/org/elasticsearch/gradle/VersionProperties.java index 9ee597eb25ad8..01648cdf73a6d 100644 --- a/buildSrc/src/main/java/org/elasticsearch/gradle/VersionProperties.java +++ b/buildSrc/src/main/java/org/elasticsearch/gradle/VersionProperties.java @@ -10,8 +10,12 @@ * Accessor for shared dependency versions used by elasticsearch, namely the elasticsearch and lucene versions. */ public class VersionProperties { - public static Version getElasticsearch() { - return elasticsearch; + public static Version getElasticsearchVersion() { + return elasticsearchVersion; + } + + public static String getElasticsearch() { + return elaticsearchBuild; } public static String getLucene() { @@ -22,13 +26,15 @@ public static Map getVersions() { return versions; } - private static final Version elasticsearch; + private static final Version elasticsearchVersion; private static final String lucene; + private static final String elaticsearchBuild; private static final Map versions = new HashMap(); static { Properties props = getVersionProperties(); - elasticsearch = Version.fromString(props.getProperty("elasticsearch")); lucene = props.getProperty("lucene"); + elasticsearchVersion = Version.fromString(props.getProperty("elasticsearch")); + elaticsearchBuild = props.getProperty("elasticsearchBuild"); for (String property : props.stringPropertyNames()) { versions.put(property, props.getProperty(property)); } diff --git a/buildSrc/src/test/groovy/org/elasticsearch/gradle/VersionCollectionTests.groovy b/buildSrc/src/test/groovy/org/elasticsearch/gradle/VersionCollectionTests.groovy index f6b9cb5fc95bf..074184862cba8 100644 --- a/buildSrc/src/test/groovy/org/elasticsearch/gradle/VersionCollectionTests.groovy +++ b/buildSrc/src/test/groovy/org/elasticsearch/gradle/VersionCollectionTests.groovy @@ -12,7 +12,7 @@ class VersionCollectionTests extends GradleUnitTestCase { formatVersion('5.0.0_rc1'),formatVersion('5.0.0_rc2'),formatVersion('5.0.1'), formatVersion('5.0.2'), formatVersion('5.1.1'), formatVersion('5.1.2'), formatVersion('5.2.0'), formatVersion('5.2.1'), formatVersion('6.0.0'), formatVersion('6.0.1'), formatVersion('6.1.0'), formatVersion('6.1.1'), formatVersion('6.2.0'), formatVersion('6.3.0'), - formatVersion('7.0.0_alpha1'), formatVersion('7.0.0_alpha2')] + formatVersion('7.0.0')] /** * This validates the logic of being on a unreleased major branch with a staged major-1.minor sibling. This case happens when a version is @@ -23,31 +23,31 @@ class VersionCollectionTests extends GradleUnitTestCase { void testAgainstMajorUnreleasedWithExistingStagedMinorRelease() { VersionCollection vc = new VersionCollection(allVersions) assertNotNull(vc) - assertEquals(vc.nextMinorSnapshot, Version.fromString("6.3.0-SNAPSHOT")) - assertEquals(vc.stagedMinorSnapshot, Version.fromString("6.2.0-SNAPSHOT")) - assertEquals(vc.nextBugfixSnapshot, Version.fromString("6.1.1-SNAPSHOT")) + assertEquals(vc.nextMinorSnapshot, Version.fromString("6.3.0")) + assertEquals(vc.stagedMinorSnapshot, Version.fromString("6.2.0")) + assertEquals(vc.nextBugfixSnapshot, Version.fromString("6.1.1")) assertNull(vc.maintenanceBugfixSnapshot) vc.indexCompatible.containsAll(vc.versions) // This should contain the same list sans the current version List indexCompatList = [Version.fromString("6.0.0"), Version.fromString("6.0.1"), - Version.fromString("6.1.0"), Version.fromString("6.1.1-SNAPSHOT"), - Version.fromString("6.2.0-SNAPSHOT"), Version.fromString("6.3.0-SNAPSHOT")] + Version.fromString("6.1.0"), Version.fromString("6.1.1"), + Version.fromString("6.2.0"), Version.fromString("6.3.0")] assertTrue(indexCompatList.containsAll(vc.indexCompatible)) assertTrue(vc.indexCompatible.containsAll(indexCompatList)) - List wireCompatList = [Version.fromString("6.3.0-SNAPSHOT")] + List wireCompatList = [Version.fromString("6.3.0")] assertTrue(wireCompatList.containsAll(vc.wireCompatible)) assertTrue(vc.wireCompatible.containsAll(wireCompatList)) assertEquals(vc.snapshotsIndexCompatible.size(), 3) - assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("6.3.0-SNAPSHOT"))) - assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("6.2.0-SNAPSHOT"))) - assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("6.1.1-SNAPSHOT"))) + assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("6.3.0"))) + assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("6.2.0"))) + assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("6.1.1"))) assertEquals(vc.snapshotsWireCompatible.size(), 1) - assertEquals(vc.snapshotsWireCompatible.first(), Version.fromString("6.3.0-SNAPSHOT")) + assertEquals(vc.snapshotsWireCompatible.first(), Version.fromString("6.3.0")) } /** @@ -62,9 +62,9 @@ class VersionCollectionTests extends GradleUnitTestCase { VersionCollection vc = new VersionCollection(localVersion) assertNotNull(vc) - assertEquals(vc.nextMinorSnapshot, Version.fromString("6.3.0-SNAPSHOT")) + assertEquals(vc.nextMinorSnapshot, Version.fromString("6.3.0")) assertEquals(vc.stagedMinorSnapshot, null) - assertEquals(vc.nextBugfixSnapshot, Version.fromString("6.2.1-SNAPSHOT")) + assertEquals(vc.nextBugfixSnapshot, Version.fromString("6.2.1")) assertNull(vc.maintenanceBugfixSnapshot) vc.indexCompatible.containsAll(vc.versions) @@ -72,21 +72,21 @@ class VersionCollectionTests extends GradleUnitTestCase { // This should contain the same list sans the current version List indexCompatList = [Version.fromString("6.0.0"), Version.fromString("6.0.1"), Version.fromString("6.1.0"), Version.fromString("6.1.1"), - Version.fromString("6.2.0"), Version.fromString("6.2.1-SNAPSHOT"), - Version.fromString("6.3.0-SNAPSHOT")] + Version.fromString("6.2.0"), Version.fromString("6.2.1"), + Version.fromString("6.3.0")] assertTrue(indexCompatList.containsAll(vc.indexCompatible)) assertTrue(vc.indexCompatible.containsAll(indexCompatList)) - List wireCompatList = [Version.fromString("6.3.0-SNAPSHOT")] + List wireCompatList = [Version.fromString("6.3.0")] assertTrue(wireCompatList.containsAll(vc.wireCompatible)) assertTrue(vc.wireCompatible.containsAll(wireCompatList)) assertEquals(vc.snapshotsIndexCompatible.size(), 2) - assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("6.3.0-SNAPSHOT"))) - assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("6.2.1-SNAPSHOT"))) + assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("6.3.0"))) + assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("6.2.1"))) assertEquals(vc.snapshotsWireCompatible.size(), 1) - assertEquals(vc.snapshotsWireCompatible.first(), Version.fromString("6.3.0-SNAPSHOT")) + assertEquals(vc.snapshotsWireCompatible.first(), Version.fromString("6.3.0")) } /** @@ -101,30 +101,30 @@ class VersionCollectionTests extends GradleUnitTestCase { VersionCollection vc = new VersionCollection(localVersion) assertNotNull(vc) assertEquals(vc.nextMinorSnapshot, null) - assertEquals(vc.stagedMinorSnapshot, Version.fromString("6.2.0-SNAPSHOT")) - assertEquals(vc.nextBugfixSnapshot, Version.fromString("6.1.1-SNAPSHOT")) - assertEquals(vc.maintenanceBugfixSnapshot, Version.fromString("5.2.1-SNAPSHOT")) + assertEquals(vc.stagedMinorSnapshot, Version.fromString("6.2.0")) + assertEquals(vc.nextBugfixSnapshot, Version.fromString("6.1.1")) + assertEquals(vc.maintenanceBugfixSnapshot, Version.fromString("5.2.1")) // This should contain the same list sans the current version List indexCompatList = vc.versions.subList(0, vc.versions.size() - 1) assertTrue(indexCompatList.containsAll(vc.indexCompatible)) assertTrue(vc.indexCompatible.containsAll(indexCompatList)) - List wireCompatList = [Version.fromString("5.2.0"), Version.fromString("5.2.1-SNAPSHOT"), Version.fromString("6.0.0"), - Version.fromString("6.0.1"), Version.fromString("6.1.0"), Version.fromString("6.1.1-SNAPSHOT"), - Version.fromString("6.2.0-SNAPSHOT")] + List wireCompatList = [Version.fromString("5.2.0"), Version.fromString("5.2.1"), Version.fromString("6.0.0"), + Version.fromString("6.0.1"), Version.fromString("6.1.0"), Version.fromString("6.1.1"), + Version.fromString("6.2.0")] assertTrue(wireCompatList.containsAll(vc.wireCompatible)) assertTrue(vc.wireCompatible.containsAll(wireCompatList)) assertEquals(vc.snapshotsIndexCompatible.size(), 3) - assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("6.2.0-SNAPSHOT"))) - assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("6.1.1-SNAPSHOT"))) - assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("5.2.1-SNAPSHOT"))) + assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("6.2.0"))) + assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("6.1.1"))) + assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("5.2.1"))) assertEquals(vc.snapshotsWireCompatible.size(), 3) - assertTrue(vc.snapshotsWireCompatible.contains(Version.fromString("6.2.0-SNAPSHOT"))) - assertTrue(vc.snapshotsWireCompatible.contains(Version.fromString("6.1.1-SNAPSHOT"))) - assertTrue(vc.snapshotsWireCompatible.contains(Version.fromString("5.2.1-SNAPSHOT"))) + assertTrue(vc.snapshotsWireCompatible.contains(Version.fromString("6.2.0"))) + assertTrue(vc.snapshotsWireCompatible.contains(Version.fromString("6.1.1"))) + assertTrue(vc.snapshotsWireCompatible.contains(Version.fromString("5.2.1"))) } /** @@ -142,27 +142,27 @@ class VersionCollectionTests extends GradleUnitTestCase { assertNotNull(vc) assertEquals(vc.nextMinorSnapshot, null) assertEquals(vc.stagedMinorSnapshot, null) - assertEquals(vc.nextBugfixSnapshot, Version.fromString("6.2.1-SNAPSHOT")) - assertEquals(vc.maintenanceBugfixSnapshot, Version.fromString("5.2.1-SNAPSHOT")) + assertEquals(vc.nextBugfixSnapshot, Version.fromString("6.2.1")) + assertEquals(vc.maintenanceBugfixSnapshot, Version.fromString("5.2.1")) // This should contain the same list sans the current version List indexCompatList = vc.versions.subList(0, vc.versions.size() - 1) assertTrue(indexCompatList.containsAll(vc.indexCompatible)) assertTrue(vc.indexCompatible.containsAll(indexCompatList)) - List wireCompatList = [Version.fromString("5.2.0"), Version.fromString("5.2.1-SNAPSHOT"), Version.fromString("6.0.0"), + List wireCompatList = [Version.fromString("5.2.0"), Version.fromString("5.2.1"), Version.fromString("6.0.0"), Version.fromString("6.0.1"), Version.fromString("6.1.0"), Version.fromString("6.1.1"), - Version.fromString("6.2.0"), Version.fromString("6.2.1-SNAPSHOT")] + Version.fromString("6.2.0"), Version.fromString("6.2.1")] assertTrue(wireCompatList.containsAll(vc.wireCompatible)) assertTrue(vc.wireCompatible.containsAll(wireCompatList)) assertEquals(vc.snapshotsIndexCompatible.size(), 2) - assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("6.2.1-SNAPSHOT"))) - assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("5.2.1-SNAPSHOT"))) + assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("6.2.1"))) + assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("5.2.1"))) assertEquals(vc.snapshotsWireCompatible.size(), 2) - assertTrue(vc.snapshotsWireCompatible.contains(Version.fromString("6.2.1-SNAPSHOT"))) - assertTrue(vc.snapshotsWireCompatible.contains(Version.fromString("5.2.1-SNAPSHOT"))) + assertTrue(vc.snapshotsWireCompatible.contains(Version.fromString("6.2.1"))) + assertTrue(vc.snapshotsWireCompatible.contains(Version.fromString("5.2.1"))) } /** @@ -180,23 +180,23 @@ class VersionCollectionTests extends GradleUnitTestCase { assertEquals(vc.nextMinorSnapshot, null) assertEquals(vc.stagedMinorSnapshot, null) assertEquals(vc.nextBugfixSnapshot, null) - assertEquals(vc.maintenanceBugfixSnapshot, Version.fromString("5.2.1-SNAPSHOT")) + assertEquals(vc.maintenanceBugfixSnapshot, Version.fromString("5.2.1")) // This should contain the same list sans the current version List indexCompatList = vc.versions.subList(0, vc.versions.size() - 1) assertTrue(indexCompatList.containsAll(vc.indexCompatible)) assertTrue(vc.indexCompatible.containsAll(indexCompatList)) - List wireCompatList = [Version.fromString("5.2.0"), Version.fromString("5.2.1-SNAPSHOT"), Version.fromString("6.0.0"), + List wireCompatList = [Version.fromString("5.2.0"), Version.fromString("5.2.1"), Version.fromString("6.0.0"), Version.fromString("6.0.1"), Version.fromString("6.1.0")] assertTrue(wireCompatList.containsAll(vc.wireCompatible)) assertTrue(vc.wireCompatible.containsAll(wireCompatList)) assertEquals(vc.snapshotsIndexCompatible.size(), 1) - assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("5.2.1-SNAPSHOT"))) + assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("5.2.1"))) assertEquals(vc.snapshotsWireCompatible.size(), 1) - assertTrue(vc.snapshotsWireCompatible.contains(Version.fromString("5.2.1-SNAPSHOT"))) + assertTrue(vc.snapshotsWireCompatible.contains(Version.fromString("5.2.1"))) } /** @@ -211,14 +211,14 @@ class VersionCollectionTests extends GradleUnitTestCase { formatVersion('5.3.2')] VersionCollection vc = new VersionCollection(localVersion) assertNotNull(vc) - assertEquals(vc.maintenanceBugfixSnapshot, Version.fromString("2.1.1-SNAPSHOT")) + assertEquals(vc.maintenanceBugfixSnapshot, Version.fromString("2.1.1")) // This should contain the same list sans the current version List indexCompatList = vc.versions.subList(0, vc.versions.size() - 1) assertTrue(indexCompatList.containsAll(vc.indexCompatible)) assertTrue(vc.indexCompatible.containsAll(indexCompatList)) - List wireCompatList = [Version.fromString("2.1.0"), Version.fromString("2.1.1-SNAPSHOT"), Version.fromString("5.0.0"), + List wireCompatList = [Version.fromString("2.1.0"), Version.fromString("2.1.1"), Version.fromString("5.0.0"), Version.fromString("5.0.1"), Version.fromString("5.1.0"), Version.fromString("5.1.1"), Version.fromString("5.2.0"), Version.fromString("5.2.1"), Version.fromString("5.3.0"), Version.fromString("5.3.1")] @@ -228,7 +228,7 @@ class VersionCollectionTests extends GradleUnitTestCase { assertTrue(vc.wireCompatible.containsAll(wireCompatList)) assertEquals(vc.snapshotsIndexCompatible.size(), 1) - assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("2.1.1-SNAPSHOT"))) + assertTrue(vc.snapshotsIndexCompatible.contains(Version.fromString("2.1.1"))) // ensure none of the 2.x snapshots appear here, as this is the floor of bwc for wire compat assertEquals(vc.snapshotsWireCompatible.size(), 0) diff --git a/buildSrc/src/test/java/org/elasticsearch/gradle/VersionTests.java b/buildSrc/src/test/java/org/elasticsearch/gradle/VersionTests.java index d3c3b4a43cb41..97f3c6eaf0213 100644 --- a/buildSrc/src/test/java/org/elasticsearch/gradle/VersionTests.java +++ b/buildSrc/src/test/java/org/elasticsearch/gradle/VersionTests.java @@ -33,107 +33,57 @@ public class VersionTests extends GradleUnitTestCase { public ExpectedException expectedEx = ExpectedException.none(); public void testVersionParsing() { - assertVersionEquals("7.0.1", 7, 0, 1, "", false); - assertVersionEquals("7.0.1-alpha2", 7, 0, 1, "-alpha2", false); - assertVersionEquals("5.1.2-rc3", 5, 1, 2, "-rc3", false); - assertVersionEquals("6.1.2-SNAPSHOT", 6, 1, 2, "", true); - assertVersionEquals("6.1.2-beta1-SNAPSHOT", 6, 1, 2, "-beta1", true); + assertVersionEquals("7.0.1", 7, 0, 1, ""); } public void testCompareWithStringVersions() { assertTrue("1.10.20 is not interpreted as before 2.0.0", Version.fromString("1.10.20").before("2.0.0") ); - assertTrue("7.0.0-alpha1 is not interpreted as before 7.0.0-alpha2", - Version.fromString("7.0.0-alpha1").before("7.0.0-alpha2") - ); - assertTrue("7.0.0-alpha1 should be equal to 7.0.0-alpha1", - Version.fromString("7.0.0-alpha1").equals(Version.fromString("7.0.0-alpha1")) - ); - assertTrue("7.0.0-SNAPSHOT should be equal to 7.0.0-SNAPSHOT", - Version.fromString("7.0.0-SNAPSHOT").equals(Version.fromString("7.0.0-SNAPSHOT")) - ); - assertEquals(Version.fromString("5.2.1-SNAPSHOT"), Version.fromString("5.2.1-SNAPSHOT")); } public void testCollections() { assertTrue( Arrays.asList( - Version.fromString("5.2.0"), Version.fromString("5.2.1-SNAPSHOT"), Version.fromString("6.0.0"), - Version.fromString("6.0.1"), Version.fromString("6.1.0") + Version.fromString("6.0.0"), + Version.fromString("6.0.1"), + Version.fromString("6.1.0") ).containsAll(Arrays.asList( - Version.fromString("6.0.1"), Version.fromString("5.2.1-SNAPSHOT") + Version.fromString("6.0.1") )) ); Set versions = new HashSet<>(); versions.addAll(Arrays.asList( - Version.fromString("5.2.0"), Version.fromString("5.2.1-SNAPSHOT"), Version.fromString("6.0.0"), + Version.fromString("5.2.0"), Version.fromString("6.0.0"), Version.fromString("6.0.1"), Version.fromString("6.1.0") )); Set subset = new HashSet<>(); subset.addAll(Arrays.asList( - Version.fromString("6.0.1"), Version.fromString("5.2.1-SNAPSHOT") + Version.fromString("6.0.1"), Version.fromString("5.2.0") )); assertTrue(versions.containsAll(subset)); } public void testToString() { - assertEquals("7.0.1", new Version(7, 0, 1, null, false).toString()); + assertEquals("7.0.1", new Version(7, 0, 1).toString()); } public void testCompareVersions() { - assertEquals(0, new Version(7, 0, 0, null, true).compareTo( - new Version(7, 0, 0, null, true) - )); - assertEquals(0, new Version(7, 0, 0, null, true).compareTo( - new Version(7, 0, 0, "", true) + assertEquals(0, new Version(7, 0, 0).compareTo( + new Version(7, 0, 0) )); - // snapshot is not taken into account TODO inconsistent with equals - assertEquals( - 0, - new Version(7, 0, 0, "", false).compareTo( - new Version(7, 0, 0, null, true)) - ); - // without sufix is smaller than with TODO - assertOrder( - new Version(7, 0, 0, null, false), - new Version(7, 0, 0, "-alpha1", false) - ); - // numbered sufix - assertOrder( - new Version(7, 0, 0, "-alpha1", false), - new Version(7, 0, 0, "-alpha2", false) - ); - // ranked sufix - assertOrder( - new Version(7, 0, 0, "-alpha8", false), - new Version(7, 0, 0, "-rc1", false) - ); - // ranked sufix - assertOrder( - new Version(7, 0, 0, "-alpha8", false), - new Version(7, 0, 0, "-beta1", false) - ); - // ranked sufix - assertOrder( - new Version(7, 0, 0, "-beta8", false), - new Version(7, 0, 0, "-rc1", false) - ); - // major takes precedence assertOrder( - new Version(6, 10, 10, "-alpha8", true), - new Version(7, 0, 0, "-alpha2", false) + new Version(7, 1, 0), + new Version(7, 1, 1) ); - // then minor assertOrder( - new Version(7, 0, 10, "-alpha8", true), - new Version(7, 1, 0, "-alpha2", false) + new Version(7, 1, 10), + new Version(7, 2, 0) ); - // then revision assertOrder( - new Version(7, 1, 0, "-alpha8", true), - new Version(7, 1, 10, "-alpha2", false) + new Version(7, 10, 10), + new Version(8, 0, 0) ); } @@ -149,33 +99,16 @@ public void testExceptionSyntax() { Version.fromString("foo.bar.baz"); } - public void testExceptionSuffixNumber() { - expectedEx.expect(IllegalArgumentException.class); - expectedEx.expectMessage("Invalid suffix"); - new Version(7, 1, 1, "-alpha", true); - } - - public void testExceptionSuffix() { - expectedEx.expect(IllegalArgumentException.class); - expectedEx.expectMessage("Suffix must contain one of:"); - new Version(7, 1, 1, "foo1", true); - } private void assertOrder(Version smaller, Version bigger) { assertEquals(smaller + " should be smaller than " + bigger, -1, smaller.compareTo(bigger)); } - private void assertVersionEquals(String stringVersion, int major, int minor, int revision, String sufix, boolean snapshot) { + private void assertVersionEquals(String stringVersion, int major, int minor, int revision, String sufix) { Version version = Version.fromString(stringVersion); assertEquals(major, version.getMajor()); assertEquals(minor, version.getMinor()); assertEquals(revision, version.getRevision()); - if (snapshot) { - assertTrue("Expected version to be a snapshot but it was not", version.isSnapshot()); - } else { - assertFalse("Expected version not to be a snapshot but it was", version.isSnapshot()); - } - assertEquals(sufix, version.getSuffix()); } } diff --git a/buildSrc/src/testKit/jarHell/build.gradle b/buildSrc/src/testKit/jarHell/build.gradle index 17ff43fc7403b..7d7d077fe77f4 100644 --- a/buildSrc/src/testKit/jarHell/build.gradle +++ b/buildSrc/src/testKit/jarHell/build.gradle @@ -23,7 +23,7 @@ repositories { dependencies { // Needed for the JarHell task - testCompile ("org.elasticsearch.test:framework:${versions.elasticsearch}") + testCompile ("org.elasticsearch.test:framework:${versions.elasticsearchBuild}") // causes jar hell with local sources compile "org.apache.logging.log4j:log4j-api:${versions.log4j}" } diff --git a/buildSrc/version.properties b/buildSrc/version.properties index 34c266913d0a2..afef0d04231bc 100644 --- a/buildSrc/version.properties +++ b/buildSrc/version.properties @@ -1,4 +1,4 @@ -elasticsearch = 7.0.0-alpha1 +elasticsearch = 7.0.0 lucene = 7.5.0-snapshot-13b9e28f9d # optional dependencies diff --git a/client/rest-high-level/src/test/java/org/elasticsearch/client/PingAndInfoIT.java b/client/rest-high-level/src/test/java/org/elasticsearch/client/PingAndInfoIT.java index 5f38316fd752d..525dc5def7a5c 100644 --- a/client/rest-high-level/src/test/java/org/elasticsearch/client/PingAndInfoIT.java +++ b/client/rest-high-level/src/test/java/org/elasticsearch/client/PingAndInfoIT.java @@ -85,7 +85,10 @@ public void testXPackInfo() throws IOException { assertTrue(ml.available()); assertTrue(ml.enabled()); assertEquals(mainResponse.getVersion().toString(), - ml.nativeCodeInfo().get("version").toString().replace("-SNAPSHOT", "")); + ml.nativeCodeInfo().get("version").toString() + .replace("-SNAPSHOT", "") + .replaceFirst("-(alpha|beta|rc)[0-9]+", "") + ); } public void testXPackInfoEmptyRequest() throws IOException { diff --git a/distribution/bwc/build.gradle b/distribution/bwc/build.gradle index 52334b72a7680..b52d76ea204e7 100644 --- a/distribution/bwc/build.gradle +++ b/distribution/bwc/build.gradle @@ -141,10 +141,10 @@ subprojects { baseDir += project == 'zip' ? '/archives' : '/packages' // add oss variant first projectDirs.add("${baseDir}/oss-${project}") - artifactFiles.add(file("${checkoutDir}/${baseDir}/oss-${project}/build/distributions/elasticsearch-oss-${bwcVersion}.${project}")) + artifactFiles.add(file("${checkoutDir}/${baseDir}/oss-${project}/build/distributions/elasticsearch-oss-${bwcVersion}-SNAPSHOT.${project}")) } projectDirs.add("${baseDir}/${project}") - artifactFiles.add(file("${checkoutDir}/${baseDir}/${project}/build/distributions/elasticsearch-${bwcVersion}.${project}")) + artifactFiles.add(file("${checkoutDir}/${baseDir}/${project}/build/distributions/elasticsearch-${bwcVersion}-SNAPSHOT.${project}")) } task buildBwcVersion(type: Exec) { @@ -171,7 +171,6 @@ subprojects { for (String dir : projectDirs) { args ":${dir.replace('/', ':')}:assemble" } - args "-Dbuild.snapshot=true" final LogLevel logLevel = gradle.startParameter.logLevel if ([LogLevel.QUIET, LogLevel.WARN, LogLevel.INFO, LogLevel.DEBUG].contains(logLevel)) { args "--${logLevel.name().toLowerCase(Locale.ENGLISH)}" @@ -183,6 +182,7 @@ subprojects { } else if (showStacktraceName.equals("ALWAYS_FULL")) { args "--full-stacktrace" } + args "-Dbuild.snapshot=true" standardOutput = new IndentingOutputStream(System.out) errorOutput = new IndentingOutputStream(System.err) doLast { diff --git a/docs/reference/cat/plugins.asciidoc b/docs/reference/cat/plugins.asciidoc index a9915d7aaa236..6285a0051db64 100644 --- a/docs/reference/cat/plugins.asciidoc +++ b/docs/reference/cat/plugins.asciidoc @@ -14,24 +14,24 @@ Might look like: ["source","txt",subs="attributes,callouts"] ------------------------------------------------------------------------------ name component version description -U7321H6 analysis-icu {version} The ICU Analysis plugin integrates Lucene ICU module into elasticsearch, adding ICU relates analysis components. -U7321H6 analysis-kuromoji {version} The Japanese (kuromoji) Analysis plugin integrates Lucene kuromoji analysis module into elasticsearch. -U7321H6 analysis-nori {version} The Korean (nori) Analysis plugin integrates Lucene nori analysis module into elasticsearch. -U7321H6 analysis-phonetic {version} The Phonetic Analysis plugin integrates phonetic token filter analysis with elasticsearch. -U7321H6 analysis-smartcn {version} Smart Chinese Analysis plugin integrates Lucene Smart Chinese analysis module into elasticsearch. -U7321H6 analysis-stempel {version} The Stempel (Polish) Analysis plugin integrates Lucene stempel (polish) analysis module into elasticsearch. -U7321H6 analysis-ukrainian {version} The Ukrainian Analysis plugin integrates the Lucene UkrainianMorfologikAnalyzer into elasticsearch. -U7321H6 discovery-azure-classic {version} The Azure Classic Discovery plugin allows to use Azure Classic API for the unicast discovery mechanism -U7321H6 discovery-ec2 {version} The EC2 discovery plugin allows to use AWS API for the unicast discovery mechanism. -U7321H6 discovery-file {version} Discovery file plugin enables unicast discovery from hosts stored in a file. -U7321H6 discovery-gce {version} The Google Compute Engine (GCE) Discovery plugin allows to use GCE API for the unicast discovery mechanism. -U7321H6 ingest-attachment {version} Ingest processor that uses Apache Tika to extract contents -U7321H6 ingest-geoip {version} Ingest processor that uses looksup geo data based on ip adresses using the Maxmind geo database -U7321H6 ingest-user-agent {version} Ingest processor that extracts information from a user agent -U7321H6 mapper-murmur3 {version} The Mapper Murmur3 plugin allows to compute hashes of a field's values at index-time and to store them in the index. -U7321H6 mapper-size {version} The Mapper Size plugin allows document to record their uncompressed size at index time. -U7321H6 store-smb {version} The Store SMB plugin adds support for SMB stores. -U7321H6 transport-nio {version} The nio transport. +U7321H6 analysis-icu {plugin_version} The ICU Analysis plugin integrates Lucene ICU module into elasticsearch, adding ICU relates analysis components. +U7321H6 analysis-kuromoji {plugin_version} The Japanese (kuromoji) Analysis plugin integrates Lucene kuromoji analysis module into elasticsearch. +U7321H6 analysis-nori {plugin_version} The Korean (nori) Analysis plugin integrates Lucene nori analysis module into elasticsearch. +U7321H6 analysis-phonetic {plugin_version} The Phonetic Analysis plugin integrates phonetic token filter analysis with elasticsearch. +U7321H6 analysis-smartcn {plugin_version} Smart Chinese Analysis plugin integrates Lucene Smart Chinese analysis module into elasticsearch. +U7321H6 analysis-stempel {plugin_version} The Stempel (Polish) Analysis plugin integrates Lucene stempel (polish) analysis module into elasticsearch. +U7321H6 analysis-ukrainian {plugin_version} The Ukrainian Analysis plugin integrates the Lucene UkrainianMorfologikAnalyzer into elasticsearch. +U7321H6 discovery-azure-classic {plugin_version} The Azure Classic Discovery plugin allows to use Azure Classic API for the unicast discovery mechanism +U7321H6 discovery-ec2 {plugin_version} The EC2 discovery plugin allows to use AWS API for the unicast discovery mechanism. +U7321H6 discovery-file {plugin_version} Discovery file plugin enables unicast discovery from hosts stored in a file. +U7321H6 discovery-gce {plugin_version} The Google Compute Engine (GCE) Discovery plugin allows to use GCE API for the unicast discovery mechanism. +U7321H6 ingest-attachment {plugin_version} Ingest processor that uses Apache Tika to extract contents +U7321H6 ingest-geoip {plugin_version} Ingest processor that uses looksup geo data based on ip adresses using the Maxmind geo database +U7321H6 ingest-user-agent {plugin_version} Ingest processor that extracts information from a user agent +U7321H6 mapper-murmur3 {plugin_version} The Mapper Murmur3 plugin allows to compute hashes of a field's values at index-time and to store them in the index. +U7321H6 mapper-size {plugin_version} The Mapper Size plugin allows document to record their uncompressed size at index time. +U7321H6 store-smb {plugin_version} The Store SMB plugin adds support for SMB stores. +U7321H6 transport-nio {plugin_version} The nio transport. ------------------------------------------------------------------------------ // TESTRESPONSE[s/([.()])/\\$1/ s/U7321H6/.+/ _cat] diff --git a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/LegacyDelimitedPayloadTokenFilterFactory.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/LegacyDelimitedPayloadTokenFilterFactory.java index 06c179d95f7af..c00cda0a0f218 100644 --- a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/LegacyDelimitedPayloadTokenFilterFactory.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/LegacyDelimitedPayloadTokenFilterFactory.java @@ -32,7 +32,7 @@ public class LegacyDelimitedPayloadTokenFilterFactory extends DelimitedPayloadTo LegacyDelimitedPayloadTokenFilterFactory(IndexSettings indexSettings, Environment env, String name, Settings settings) { super(indexSettings, env, name, settings); - if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0_alpha1)) { + if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0)) { throw new IllegalArgumentException( "[delimited_payload_filter] is not supported for new indices, use [delimited_payload] instead"); } diff --git a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/NGramTokenFilterFactory.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/NGramTokenFilterFactory.java index 22b060613163c..e6e573ce4af7f 100644 --- a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/NGramTokenFilterFactory.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/NGramTokenFilterFactory.java @@ -43,7 +43,7 @@ public class NGramTokenFilterFactory extends AbstractTokenFilterFactory { this.maxGram = settings.getAsInt("max_gram", NGramTokenFilter.DEFAULT_MAX_NGRAM_SIZE); int ngramDiff = maxGram - minGram; if (ngramDiff > maxAllowedNgramDiff) { - if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0_alpha1)) { + if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0)) { throw new IllegalArgumentException( "The difference between max_gram and min_gram in NGram Tokenizer must be less than or equal to: [" + maxAllowedNgramDiff + "] but was [" + ngramDiff + "]. This limit can be set by changing the [" diff --git a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/NGramTokenizerFactory.java b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/NGramTokenizerFactory.java index b00797428b79a..e811d0fbc4bda 100644 --- a/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/NGramTokenizerFactory.java +++ b/modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/NGramTokenizerFactory.java @@ -91,7 +91,7 @@ static CharMatcher parseTokenChars(List characterClasses) { this.maxGram = settings.getAsInt("max_gram", NGramTokenizer.DEFAULT_MAX_NGRAM_SIZE); int ngramDiff = maxGram - minGram; if (ngramDiff > maxAllowedNgramDiff) { - if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0_alpha1)) { + if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0)) { throw new IllegalArgumentException( "The difference between max_gram and min_gram in NGram Tokenizer must be less than or equal to: [" + maxAllowedNgramDiff + "] but was [" + ngramDiff + "]. This limit can be set by changing the [" diff --git a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/MultiSearchTemplateResponse.java b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/MultiSearchTemplateResponse.java index 74f3bc743aeb2..fcb824b6d273c 100644 --- a/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/MultiSearchTemplateResponse.java +++ b/modules/lang-mustache/src/main/java/org/elasticsearch/script/mustache/MultiSearchTemplateResponse.java @@ -113,20 +113,20 @@ public Exception getFailure() { public String toString() { return "Item [response=" + response + ", exception=" + exception + "]"; } - - + + } private Item[] items; - private long tookInMillis; - + private long tookInMillis; + MultiSearchTemplateResponse() { } public MultiSearchTemplateResponse(Item[] items, long tookInMillis) { this.items = items; this.tookInMillis = tookInMillis; - } + } @Override public Iterator iterator() { @@ -139,7 +139,7 @@ public Iterator iterator() { public Item[] getResponses() { return this.items; } - + /** * How long the msearch_template took. */ @@ -154,7 +154,7 @@ public void readFrom(StreamInput in) throws IOException { for (int i = 0; i < items.length; i++) { items[i] = Item.readItem(in); } - if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) { + if (in.getVersion().onOrAfter(Version.V_7_0_0)) { tookInMillis = in.readVLong(); } } @@ -166,7 +166,7 @@ public void writeTo(StreamOutput out) throws IOException { for (Item item : items) { item.writeTo(out); } - if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) { + if (out.getVersion().onOrAfter(Version.V_7_0_0)) { out.writeVLong(tookInMillis); } } @@ -174,7 +174,7 @@ public void writeTo(StreamOutput out) throws IOException { @Override public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params params) throws IOException { builder.startObject(); - builder.field("took", tookInMillis); + builder.field("took", tookInMillis); builder.startArray(Fields.RESPONSES); for (Item item : items) { if (item.isFailure()) { @@ -193,7 +193,7 @@ public XContentBuilder toXContent(XContentBuilder builder, ToXContent.Params par static final class Fields { static final String RESPONSES = "responses"; } - + public static MultiSearchTemplateResponse fromXContext(XContentParser parser) { //The MultiSearchTemplateResponse is identical to the multi search response so we reuse the parsing logic in multi search response MultiSearchResponse mSearchResponse = MultiSearchResponse.fromXContext(parser); @@ -208,7 +208,7 @@ public static MultiSearchTemplateResponse fromXContext(XContentParser parser) { } templateResponses[i++] = new Item(stResponse, item.getFailure()); } - return new MultiSearchTemplateResponse(templateResponses, mSearchResponse.getTook().millis()); + return new MultiSearchTemplateResponse(templateResponses, mSearchResponse.getTook().millis()); } @Override diff --git a/plugins/examples/painless-whitelist/build.gradle b/plugins/examples/painless-whitelist/build.gradle index cb2aeb82e9d01..61220d6b0e97d 100644 --- a/plugins/examples/painless-whitelist/build.gradle +++ b/plugins/examples/painless-whitelist/build.gradle @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ +import org.elasticsearch.gradle.VersionProperties apply plugin: 'elasticsearch.esplugin' esplugin { @@ -28,7 +29,7 @@ esplugin { } dependencies { - compileOnly "org.elasticsearch.plugin:elasticsearch-scripting-painless-spi:${versions.elasticsearch}" + compileOnly "org.elasticsearch.plugin:elasticsearch-scripting-painless-spi:${VersionProperties.elasticsearch}" } if (System.getProperty('tests.distribution') == null) { diff --git a/qa/vagrant/src/test/resources/packaging/utils/utils.bash b/qa/vagrant/src/test/resources/packaging/utils/utils.bash index cb71e9e6ec1a0..7464359f23243 100644 --- a/qa/vagrant/src/test/resources/packaging/utils/utils.bash +++ b/qa/vagrant/src/test/resources/packaging/utils/utils.bash @@ -516,7 +516,7 @@ wait_for_elasticsearch_status() { # $1 - expected version check_elasticsearch_version() { local version=$1 - local versionToCheck=$(echo $version | sed -e 's/-SNAPSHOT//') + local versionToCheck=$(echo $version | sed -e 's/-SNAPSHOT//' | sed -e 's/-\(alpha\|beta\|rc\)[0-9]//') run curl -s localhost:9200 [ "$status" -eq 0 ] diff --git a/qa/wildfly/build.gradle b/qa/wildfly/build.gradle index 6c6bf5d9b31b9..98111f6393dc2 100644 --- a/qa/wildfly/build.gradle +++ b/qa/wildfly/build.gradle @@ -129,7 +129,7 @@ task startWildfly { assert index >= 0 httpPort = Integer.parseInt(line.substring(index + 1)) // set this system property so the test runner knows the port Wildfly is listening for HTTP requests on - integTestRunner.systemProperty("tests.jboss.http.port", httpPort) + integTestRunner.systemProperty("tests.jboss.home", "http://localhost:$httpPort/wildfly-$version/transport") } else if (line.matches('.*Http management interface listening on http://.*:\\d+/management$')) { assert managementPort == 0 final int colonIndex = line.lastIndexOf(":") diff --git a/qa/wildfly/src/test/java/org/elasticsearch/wildfly/WildflyIT.java b/qa/wildfly/src/test/java/org/elasticsearch/wildfly/WildflyIT.java index 1da713ea9bcd9..8ec7b109f5b8b 100644 --- a/qa/wildfly/src/test/java/org/elasticsearch/wildfly/WildflyIT.java +++ b/qa/wildfly/src/test/java/org/elasticsearch/wildfly/WildflyIT.java @@ -27,10 +27,9 @@ import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.util.EntityUtils; +import org.apache.log4j.Logger; import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.TestRuleLimitSysouts; -import org.elasticsearch.Build; -import org.elasticsearch.Version; import org.elasticsearch.cluster.ClusterModule; import org.elasticsearch.common.Strings; import org.elasticsearch.common.xcontent.DeprecationHandler; @@ -54,14 +53,16 @@ @TestRuleLimitSysouts.Limit(bytes = 14000) public class WildflyIT extends LuceneTestCase { + Logger logger = Logger.getLogger(WildflyIT.class); + public void testTransportClient() throws URISyntaxException, IOException { try (CloseableHttpClient client = HttpClientBuilder.create().build()) { final String str = String.format( Locale.ROOT, - "http://localhost:%d/wildfly-%s%s/transport/employees/1", - Integer.parseInt(System.getProperty("tests.jboss.http.port")), - Version.CURRENT, - Build.CURRENT.isSnapshot() ? "-SNAPSHOT" : ""); + "%s/employees/1", + System.getProperty("tests.jboss.home") + ); + logger.info("Connecting to uri: " + str); final HttpPut put = new HttpPut(new URI(str)); final String body; try (XContentBuilder builder = jsonBuilder()) { diff --git a/server/src/main/java/org/elasticsearch/Build.java b/server/src/main/java/org/elasticsearch/Build.java index 9021e2d4c1f66..007f70213eebc 100644 --- a/server/src/main/java/org/elasticsearch/Build.java +++ b/server/src/main/java/org/elasticsearch/Build.java @@ -118,10 +118,12 @@ public static Type fromDisplayName(final String displayName) { flavor = Flavor.fromDisplayName(System.getProperty("es.distribution.flavor", "unknown")); type = Type.fromDisplayName(System.getProperty("es.distribution.type", "unknown")); - final String esPrefix = "elasticsearch-" + Version.CURRENT; final URL url = getElasticsearchCodeSourceLocation(); final String urlStr = url == null ? "" : url.toString(); - if (urlStr.startsWith("file:/") && (urlStr.endsWith(esPrefix + ".jar") || urlStr.endsWith(esPrefix + "-SNAPSHOT.jar"))) { + if (urlStr.startsWith("file:/") && + urlStr.matches( + "(.*)elasticsearch-" + Version.CURRENT + "(-)?((alpha|beta|rc)[0-9]+)?(-SNAPSHOT)?.jar" + )) { try (JarInputStream jar = new JarInputStream(FileSystemUtils.openFileURLStream(url))) { Manifest manifest = jar.getManifest(); shortHash = manifest.getMainAttributes().getValue("Change"); diff --git a/server/src/main/java/org/elasticsearch/ElasticsearchException.java b/server/src/main/java/org/elasticsearch/ElasticsearchException.java index c009bb3818cc8..80c0ceedfd87f 100644 --- a/server/src/main/java/org/elasticsearch/ElasticsearchException.java +++ b/server/src/main/java/org/elasticsearch/ElasticsearchException.java @@ -1007,7 +1007,7 @@ private enum ElasticsearchExceptionHandle { org.elasticsearch.common.xcontent.UnknownNamedObjectException::new, 148, UNKNOWN_VERSION_ADDED), TOO_MANY_BUCKETS_EXCEPTION(MultiBucketConsumerService.TooManyBucketsException.class, MultiBucketConsumerService.TooManyBucketsException::new, 149, - Version.V_7_0_0_alpha1); + Version.V_7_0_0); final Class exceptionClass; final CheckedFunction constructor; diff --git a/server/src/main/java/org/elasticsearch/Version.java b/server/src/main/java/org/elasticsearch/Version.java index 65dc1e2d23131..1da2d9a34f582 100644 --- a/server/src/main/java/org/elasticsearch/Version.java +++ b/server/src/main/java/org/elasticsearch/Version.java @@ -41,7 +41,8 @@ public class Version implements Comparable, ToXContentFragment { /* * The logic for ID is: XXYYZZAA, where XX is major version, YY is minor version, ZZ is revision, and AA is alpha/beta/rc indicator AA * values below 25 are for alpha builder (since 5.0), and above 25 and below 50 are beta builds, and below 99 are RC builds, with 99 - * indicating a release the (internal) format of the id is there so we can easily do after/before checks on the id + * indicating a release the (internal) format of the id is there so we can easily do after/before checks on the id. + * Starting with 7.0.0, we no longer store AA */ public static final int V_EMPTY_ID = 0; public static final Version V_EMPTY = new Version(V_EMPTY_ID, org.apache.lucene.util.Version.LATEST); @@ -103,10 +104,9 @@ public class Version implements Comparable, ToXContentFragment { public static final Version V_6_4_1 = new Version(V_6_4_1_ID, org.apache.lucene.util.Version.LUCENE_7_4_0); public static final int V_6_5_0_ID = 6050099; public static final Version V_6_5_0 = new Version(V_6_5_0_ID, org.apache.lucene.util.Version.LUCENE_7_5_0); - public static final int V_7_0_0_alpha1_ID = 7000001; - public static final Version V_7_0_0_alpha1 = - new Version(V_7_0_0_alpha1_ID, org.apache.lucene.util.Version.LUCENE_7_5_0); - public static final Version CURRENT = V_7_0_0_alpha1; + public static final int V_7_0_0_ID = 7000099; + public static final Version V_7_0_0 = new Version(V_7_0_0_ID, org.apache.lucene.util.Version.LUCENE_7_5_0); + public static final Version CURRENT = V_7_0_0; static { assert CURRENT.luceneVersion.equals(org.apache.lucene.util.Version.LATEST) : "Version must be upgraded to [" @@ -119,8 +119,8 @@ public static Version readVersion(StreamInput in) throws IOException { public static Version fromId(int id) { switch (id) { - case V_7_0_0_alpha1_ID: - return V_7_0_0_alpha1; + case V_7_0_0_ID: + return V_7_0_0; case V_6_5_0_ID: return V_6_5_0; case V_6_4_1_ID: @@ -243,6 +243,9 @@ public static Version fromString(String version) { int build = 99; if (parts.length == 4) { String buildStr = parts[3]; + if (rawMajor >= 7) { + throw new IllegalArgumentException("illegal version format - qualifiers are supported until version 7.x"); + } if (buildStr.startsWith("alpha")) { assert rawMajor >= 5 : "major must be >= 5 but was " + major; build = Integer.parseInt(buildStr.substring(5)); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequest.java b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequest.java index 22e8554ed6aa6..38847362ec89b 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/alias/IndicesAliasesRequest.java @@ -239,7 +239,7 @@ public AliasActions(StreamInput in) throws IOException { if (in.getVersion().onOrAfter(Version.V_6_4_0)) { writeIndex = in.readOptionalBoolean(); } - if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) { + if (in.getVersion().onOrAfter(Version.V_7_0_0)) { originalAliases = in.readStringArray(); } } @@ -256,7 +256,7 @@ public void writeTo(StreamOutput out) throws IOException { if (out.getVersion().onOrAfter(Version.V_6_4_0)) { out.writeOptionalBoolean(writeIndex); } - if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) { + if (out.getVersion().onOrAfter(Version.V_7_0_0)) { out.writeStringArray(originalAliases); } } diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java b/server/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java index fa2a395f2c9e4..1bbce19ee8dec 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/create/CreateIndexRequest.java @@ -460,7 +460,7 @@ public void readFrom(StreamInput in) throws IOException { for (int i = 0; i < aliasesSize; i++) { aliases.add(Alias.read(in)); } - if (in.getVersion().before(Version.V_7_0_0_alpha1)) { + if (in.getVersion().before(Version.V_7_0_0)) { in.readBoolean(); // updateAllTypes } waitForActiveShards = ActiveShardCount.readFrom(in); @@ -485,7 +485,7 @@ public void writeTo(StreamOutput out) throws IOException { for (Alias alias : aliases) { alias.writeTo(out); } - if (out.getVersion().before(Version.V_7_0_0_alpha1)) { + if (out.getVersion().before(Version.V_7_0_0)) { out.writeBoolean(true); // updateAllTypes } waitForActiveShards.writeTo(out); diff --git a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java index a827444acb8c5..926ae175d65ad 100644 --- a/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java +++ b/server/src/main/java/org/elasticsearch/action/admin/indices/mapping/put/PutMappingRequest.java @@ -297,7 +297,7 @@ public void readFrom(StreamInput in) throws IOException { indicesOptions = IndicesOptions.readIndicesOptions(in); type = in.readOptionalString(); source = in.readString(); - if (in.getVersion().before(Version.V_7_0_0_alpha1)) { + if (in.getVersion().before(Version.V_7_0_0)) { in.readBoolean(); // updateAllTypes } concreteIndex = in.readOptionalWriteable(Index::new); @@ -310,7 +310,7 @@ public void writeTo(StreamOutput out) throws IOException { indicesOptions.writeIndicesOptions(out); out.writeOptionalString(type); out.writeString(source); - if (out.getVersion().before(Version.V_7_0_0_alpha1)) { + if (out.getVersion().before(Version.V_7_0_0)) { out.writeBoolean(true); // updateAllTypes } out.writeOptionalWriteable(concreteIndex); diff --git a/server/src/main/java/org/elasticsearch/action/delete/DeleteRequest.java b/server/src/main/java/org/elasticsearch/action/delete/DeleteRequest.java index 879e8e665cd44..02280a5822734 100644 --- a/server/src/main/java/org/elasticsearch/action/delete/DeleteRequest.java +++ b/server/src/main/java/org/elasticsearch/action/delete/DeleteRequest.java @@ -185,7 +185,7 @@ public void readFrom(StreamInput in) throws IOException { type = in.readString(); id = in.readString(); routing = in.readOptionalString(); - if (in.getVersion().before(Version.V_7_0_0_alpha1)) { + if (in.getVersion().before(Version.V_7_0_0)) { in.readOptionalString(); // _parent } version = in.readLong(); @@ -198,7 +198,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeString(type); out.writeString(id); out.writeOptionalString(routing()); - if (out.getVersion().before(Version.V_7_0_0_alpha1)) { + if (out.getVersion().before(Version.V_7_0_0)) { out.writeOptionalString(null); // _parent } out.writeLong(version); diff --git a/server/src/main/java/org/elasticsearch/action/get/GetRequest.java b/server/src/main/java/org/elasticsearch/action/get/GetRequest.java index f4f7f8ba7940a..4fa3e99c9905a 100644 --- a/server/src/main/java/org/elasticsearch/action/get/GetRequest.java +++ b/server/src/main/java/org/elasticsearch/action/get/GetRequest.java @@ -245,7 +245,7 @@ public void readFrom(StreamInput in) throws IOException { type = in.readString(); id = in.readString(); routing = in.readOptionalString(); - if (in.getVersion().before(Version.V_7_0_0_alpha1)) { + if (in.getVersion().before(Version.V_7_0_0)) { in.readOptionalString(); } preference = in.readOptionalString(); @@ -264,7 +264,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeString(type); out.writeString(id); out.writeOptionalString(routing); - if (out.getVersion().before(Version.V_7_0_0_alpha1)) { + if (out.getVersion().before(Version.V_7_0_0)) { out.writeOptionalString(null); } out.writeOptionalString(preference); diff --git a/server/src/main/java/org/elasticsearch/action/get/MultiGetRequest.java b/server/src/main/java/org/elasticsearch/action/get/MultiGetRequest.java index 0ea564154ab0b..9e9c2df971af8 100644 --- a/server/src/main/java/org/elasticsearch/action/get/MultiGetRequest.java +++ b/server/src/main/java/org/elasticsearch/action/get/MultiGetRequest.java @@ -191,7 +191,7 @@ public void readFrom(StreamInput in) throws IOException { type = in.readOptionalString(); id = in.readString(); routing = in.readOptionalString(); - if (in.getVersion().before(Version.V_7_0_0_alpha1)) { + if (in.getVersion().before(Version.V_7_0_0)) { in.readOptionalString(); // _parent } storedFields = in.readOptionalStringArray(); @@ -207,7 +207,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeOptionalString(type); out.writeString(id); out.writeOptionalString(routing); - if (out.getVersion().before(Version.V_7_0_0_alpha1)) { + if (out.getVersion().before(Version.V_7_0_0)) { out.writeOptionalString(null); // _parent } out.writeOptionalStringArray(storedFields); diff --git a/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java b/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java index 339880dad44bf..d287fdb4baaca 100644 --- a/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java +++ b/server/src/main/java/org/elasticsearch/action/index/IndexRequest.java @@ -509,7 +509,7 @@ public void readFrom(StreamInput in) throws IOException { type = in.readOptionalString(); id = in.readOptionalString(); routing = in.readOptionalString(); - if (in.getVersion().before(Version.V_7_0_0_alpha1)) { + if (in.getVersion().before(Version.V_7_0_0)) { in.readOptionalString(); // _parent } if (in.getVersion().before(Version.V_6_0_0_alpha1)) { @@ -536,7 +536,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeOptionalString(type); out.writeOptionalString(id); out.writeOptionalString(routing); - if (out.getVersion().before(Version.V_7_0_0_alpha1)) { + if (out.getVersion().before(Version.V_7_0_0)) { out.writeOptionalString(null); // _parent } if (out.getVersion().before(Version.V_6_0_0_alpha1)) { 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 6cae1056a4b7b..d5367cd1bc21b 100644 --- a/server/src/main/java/org/elasticsearch/action/main/MainResponse.java +++ b/server/src/main/java/org/elasticsearch/action/main/MainResponse.java @@ -81,7 +81,7 @@ public void writeTo(StreamOutput out) throws IOException { clusterName.writeTo(out); out.writeString(clusterUuid); Build.writeBuild(build, out); - if (out.getVersion().before(Version.V_7_0_0_alpha1)) { + if (out.getVersion().before(Version.V_7_0_0)) { out.writeBoolean(true); } } @@ -94,7 +94,7 @@ public void readFrom(StreamInput in) throws IOException { clusterName = new ClusterName(in); clusterUuid = in.readString(); build = Build.readBuild(in); - if (in.getVersion().before(Version.V_7_0_0_alpha1)) { + if (in.getVersion().before(Version.V_7_0_0)) { in.readBoolean(); } } diff --git a/server/src/main/java/org/elasticsearch/action/search/MultiSearchResponse.java b/server/src/main/java/org/elasticsearch/action/search/MultiSearchResponse.java index cb30385ecc868..53ea9e87a765a 100644 --- a/server/src/main/java/org/elasticsearch/action/search/MultiSearchResponse.java +++ b/server/src/main/java/org/elasticsearch/action/search/MultiSearchResponse.java @@ -166,7 +166,7 @@ public void readFrom(StreamInput in) throws IOException { for (int i = 0; i < items.length; i++) { items[i] = Item.readItem(in); } - if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) { + if (in.getVersion().onOrAfter(Version.V_7_0_0)) { tookInMillis = in.readVLong(); } } @@ -178,7 +178,7 @@ public void writeTo(StreamOutput out) throws IOException { for (Item item : items) { item.writeTo(out); } - if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) { + if (out.getVersion().onOrAfter(Version.V_7_0_0)) { out.writeVLong(tookInMillis); } } diff --git a/server/src/main/java/org/elasticsearch/action/termvectors/TermVectorsRequest.java b/server/src/main/java/org/elasticsearch/action/termvectors/TermVectorsRequest.java index d6bf911e572c3..4cd02caf91c32 100644 --- a/server/src/main/java/org/elasticsearch/action/termvectors/TermVectorsRequest.java +++ b/server/src/main/java/org/elasticsearch/action/termvectors/TermVectorsRequest.java @@ -502,7 +502,7 @@ public void readFrom(StreamInput in) throws IOException { } routing = in.readOptionalString(); - if (in.getVersion().before(Version.V_7_0_0_alpha1)) { + if (in.getVersion().before(Version.V_7_0_0)) { in.readOptionalString(); // _parent } preference = in.readOptionalString(); @@ -545,7 +545,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeEnum(xContentType); } out.writeOptionalString(routing); - if (out.getVersion().before(Version.V_7_0_0_alpha1)) { + if (out.getVersion().before(Version.V_7_0_0)) { out.writeOptionalString(null); // _parent } out.writeOptionalString(preference); diff --git a/server/src/main/java/org/elasticsearch/action/update/UpdateRequest.java b/server/src/main/java/org/elasticsearch/action/update/UpdateRequest.java index 96816efe5322e..5840ab9411e90 100644 --- a/server/src/main/java/org/elasticsearch/action/update/UpdateRequest.java +++ b/server/src/main/java/org/elasticsearch/action/update/UpdateRequest.java @@ -748,7 +748,7 @@ public void readFrom(StreamInput in) throws IOException { type = in.readString(); id = in.readString(); routing = in.readOptionalString(); - if (in.getVersion().before(Version.V_7_0_0_alpha1)) { + if (in.getVersion().before(Version.V_7_0_0)) { in.readOptionalString(); // _parent } if (in.readBoolean()) { @@ -760,7 +760,7 @@ public void readFrom(StreamInput in) throws IOException { doc = new IndexRequest(); doc.readFrom(in); } - if (in.getVersion().before(Version.V_7_0_0_alpha1)) { + if (in.getVersion().before(Version.V_7_0_0)) { String[] fields = in.readOptionalStringArray(); if (fields != null) { throw new IllegalArgumentException("[fields] is no longer supported"); @@ -785,7 +785,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeString(type); out.writeString(id); out.writeOptionalString(routing); - if (out.getVersion().before(Version.V_7_0_0_alpha1)) { + if (out.getVersion().before(Version.V_7_0_0)) { out.writeOptionalString(null); // _parent } @@ -806,7 +806,7 @@ public void writeTo(StreamOutput out) throws IOException { doc.id(id); doc.writeTo(out); } - if (out.getVersion().before(Version.V_7_0_0_alpha1)) { + if (out.getVersion().before(Version.V_7_0_0)) { out.writeOptionalStringArray(null); } out.writeOptionalWriteable(fetchSourceContext); diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/MappingMetaData.java b/server/src/main/java/org/elasticsearch/cluster/metadata/MappingMetaData.java index 2f4461066ec98..1aa53fca1b31c 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/MappingMetaData.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/MappingMetaData.java @@ -178,7 +178,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeOptionalString("now"); // 5.x default out.writeOptionalBoolean(null); } - if (out.getVersion().before(Version.V_7_0_0_alpha1)) { + if (out.getVersion().before(Version.V_7_0_0)) { out.writeBoolean(false); // hasParentField } } @@ -220,7 +220,7 @@ public MappingMetaData(StreamInput in) throws IOException { in.readOptionalString(); // defaultTimestamp in.readOptionalBoolean(); // ignoreMissing } - if (in.getVersion().before(Version.V_7_0_0_alpha1)) { + if (in.getVersion().before(Version.V_7_0_0)) { in.readBoolean(); // hasParentField } } diff --git a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java b/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java index e41911d123e5c..32f601ea862a6 100644 --- a/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java +++ b/server/src/main/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexService.java @@ -566,7 +566,7 @@ static int getNumberOfShards(final Settings.Builder indexSettingsBuilder) { final int numberOfShards; final Version indexVersionCreated = Version.fromId(Integer.parseInt(indexSettingsBuilder.get(IndexMetaData.SETTING_INDEX_VERSION_CREATED.getKey()))); - if (indexVersionCreated.before(Version.V_7_0_0_alpha1)) { + if (indexVersionCreated.before(Version.V_7_0_0)) { numberOfShards = 5; } else { numberOfShards = 1; @@ -769,7 +769,7 @@ static void prepareResizeIndexSettings( * the less default split operations are supported */ public static int calculateNumRoutingShards(int numShards, Version indexVersionCreated) { - if (indexVersionCreated.onOrAfter(Version.V_7_0_0_alpha1)) { + if (indexVersionCreated.onOrAfter(Version.V_7_0_0)) { // only select this automatically for indices that are created on or after 7.0 this will prevent this new behaviour // until we have a fully upgraded cluster. Additionally it will make integratin testing easier since mixed clusters // will always have the behavior of the min node in the cluster. diff --git a/server/src/main/java/org/elasticsearch/index/analysis/ShingleTokenFilterFactory.java b/server/src/main/java/org/elasticsearch/index/analysis/ShingleTokenFilterFactory.java index 422941acc73e5..50e1844609df5 100644 --- a/server/src/main/java/org/elasticsearch/index/analysis/ShingleTokenFilterFactory.java +++ b/server/src/main/java/org/elasticsearch/index/analysis/ShingleTokenFilterFactory.java @@ -40,7 +40,7 @@ public ShingleTokenFilterFactory(IndexSettings indexSettings, Environment enviro int shingleDiff = maxShingleSize - minShingleSize + (outputUnigrams ? 1 : 0); if (shingleDiff > maxAllowedShingleDiff) { - if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0_alpha1)) { + if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0)) { throw new IllegalArgumentException( "In Shingle TokenFilter the difference between max_shingle_size and min_shingle_size (and +1 if outputting unigrams)" + " must be less than or equal to: [" + maxAllowedShingleDiff + "] but was [" + shingleDiff + "]. This limit" diff --git a/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java b/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java index d06374d5d8915..5d764047ab71a 100644 --- a/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java +++ b/server/src/main/java/org/elasticsearch/index/mapper/MapperService.java @@ -153,7 +153,7 @@ public MapperService(IndexSettings indexSettings, IndexAnalyzers indexAnalyzers, this.mapperRegistry = mapperRegistry; if (INDEX_MAPPER_DYNAMIC_SETTING.exists(indexSettings.getSettings()) && - indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0_alpha1)) { + indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0)) { throw new IllegalArgumentException("Setting " + INDEX_MAPPER_DYNAMIC_SETTING.getKey() + " was removed after version 6.0.0"); } @@ -403,7 +403,7 @@ private synchronized Map internalMerge(@Nullable Documen Map results = new LinkedHashMap<>(2); if (defaultMapper != null) { - if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0_alpha1)) { + if (indexSettings.getIndexVersionCreated().onOrAfter(Version.V_7_0_0)) { throw new IllegalArgumentException("The [default] mapping cannot be updated on index [" + index().getName() + "]: defaults mappings are not useful anymore now that indices can have at most one type."); } else if (reason == MergeReason.MAPPING_UPDATE) { // only log in case of explicit mapping updates diff --git a/server/src/main/java/org/elasticsearch/index/similarity/SimilarityProviders.java b/server/src/main/java/org/elasticsearch/index/similarity/SimilarityProviders.java index 18c6d6a3fc063..714a7492c5c5e 100644 --- a/server/src/main/java/org/elasticsearch/index/similarity/SimilarityProviders.java +++ b/server/src/main/java/org/elasticsearch/index/similarity/SimilarityProviders.java @@ -221,7 +221,7 @@ static void assertSettingsIsSubsetOf(String type, Version version, Settings sett unknownSettings.removeAll(Arrays.asList(supportedSettings)); unknownSettings.remove("type"); // used to figure out which sim this is if (unknownSettings.isEmpty() == false) { - if (version.onOrAfter(Version.V_7_0_0_alpha1)) { + if (version.onOrAfter(Version.V_7_0_0)) { throw new IllegalArgumentException("Unknown settings for similarity of type [" + type + "]: " + unknownSettings); } else { DEPRECATION_LOGGER.deprecated("Unknown settings for similarity of type [" + type + "]: " + unknownSettings); diff --git a/server/src/main/java/org/elasticsearch/index/similarity/SimilarityService.java b/server/src/main/java/org/elasticsearch/index/similarity/SimilarityService.java index eaed2169f11c0..05651fbc076cc 100644 --- a/server/src/main/java/org/elasticsearch/index/similarity/SimilarityService.java +++ b/server/src/main/java/org/elasticsearch/index/similarity/SimilarityService.java @@ -52,7 +52,7 @@ public final class SimilarityService extends AbstractIndexComponent { static { Map>> defaults = new HashMap<>(); defaults.put(CLASSIC_SIMILARITY, version -> { - if (version.onOrAfter(Version.V_7_0_0_alpha1)) { + if (version.onOrAfter(Version.V_7_0_0)) { return () -> { throw new IllegalArgumentException("The [classic] similarity may not be used anymore. Please use the [BM25] " + "similarity or build a custom [scripted] similarity instead."); @@ -79,7 +79,7 @@ public final class SimilarityService extends AbstractIndexComponent { Map> builtIn = new HashMap<>(); builtIn.put(CLASSIC_SIMILARITY, (settings, version, script) -> { - if (version.onOrAfter(Version.V_7_0_0_alpha1)) { + if (version.onOrAfter(Version.V_7_0_0)) { throw new IllegalArgumentException("The [classic] similarity may not be used anymore. Please use the [BM25] " + "similarity or build a custom [scripted] similarity instead."); } else { @@ -151,7 +151,7 @@ public Similarity similarity(MapperService mapperService) { defaultSimilarity; } - + public SimilarityProvider getSimilarity(String name) { Supplier sim = similarities.get(name); if (sim == null) { diff --git a/server/src/main/java/org/elasticsearch/index/translog/Translog.java b/server/src/main/java/org/elasticsearch/index/translog/Translog.java index f17acac37896d..9b480bdb3ddc2 100644 --- a/server/src/main/java/org/elasticsearch/index/translog/Translog.java +++ b/server/src/main/java/org/elasticsearch/index/translog/Translog.java @@ -1199,7 +1199,7 @@ public Source getSource() { } private void write(final StreamOutput out) throws IOException { - final int format = out.getVersion().onOrAfter(Version.V_7_0_0_alpha1) ? SERIALIZATION_FORMAT : FORMAT_6_0; + final int format = out.getVersion().onOrAfter(Version.V_7_0_0) ? SERIALIZATION_FORMAT : FORMAT_6_0; out.writeVInt(format); out.writeString(id); out.writeString(type); @@ -1359,7 +1359,7 @@ public Source getSource() { } private void write(final StreamOutput out) throws IOException { - final int format = out.getVersion().onOrAfter(Version.V_7_0_0_alpha1) ? SERIALIZATION_FORMAT : FORMAT_6_0; + final int format = out.getVersion().onOrAfter(Version.V_7_0_0) ? SERIALIZATION_FORMAT : FORMAT_6_0; out.writeVInt(format); out.writeString(type); out.writeString(id); diff --git a/server/src/main/java/org/elasticsearch/script/ScriptStats.java b/server/src/main/java/org/elasticsearch/script/ScriptStats.java index abf54e7e3d0a2..06eec72c0e0da 100644 --- a/server/src/main/java/org/elasticsearch/script/ScriptStats.java +++ b/server/src/main/java/org/elasticsearch/script/ScriptStats.java @@ -42,14 +42,14 @@ public ScriptStats(long compilations, long cacheEvictions, long compilationLimit public ScriptStats(StreamInput in) throws IOException { compilations = in.readVLong(); cacheEvictions = in.readVLong(); - compilationLimitTriggered = in.getVersion().onOrAfter(Version.V_7_0_0_alpha1) ? in.readVLong() : 0; + compilationLimitTriggered = in.getVersion().onOrAfter(Version.V_7_0_0) ? in.readVLong() : 0; } @Override public void writeTo(StreamOutput out) throws IOException { out.writeVLong(compilations); out.writeVLong(cacheEvictions); - if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) { + if (out.getVersion().onOrAfter(Version.V_7_0_0)) { out.writeVLong(compilationLimitTriggered); } } diff --git a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/CompositeValuesSourceBuilder.java b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/CompositeValuesSourceBuilder.java index 32a94f59be5c2..01c592a5e01a7 100644 --- a/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/CompositeValuesSourceBuilder.java +++ b/server/src/main/java/org/elasticsearch/search/aggregations/bucket/composite/CompositeValuesSourceBuilder.java @@ -72,7 +72,7 @@ public abstract class CompositeValuesSourceBuilder>> suggestions) public Suggest(StreamInput in) throws IOException { // in older versions, Suggestion types were serialized as Streamable - if (in.getVersion().before(Version.V_7_0_0_alpha1)) { + if (in.getVersion().before(Version.V_7_0_0)) { final int size = in.readVInt(); suggestions = new ArrayList<>(size); for (int i = 0; i < size; i++) { @@ -161,7 +161,7 @@ public boolean hasScoreDocs() { @Override public void writeTo(StreamOutput out) throws IOException { // in older versions, Suggestion types were serialized as Streamable - if (out.getVersion().before(Version.V_7_0_0_alpha1)) { + if (out.getVersion().before(Version.V_7_0_0)) { out.writeVInt(suggestions.size()); for (Suggestion command : suggestions) { out.writeVInt(command.getWriteableType()); @@ -279,7 +279,7 @@ public Suggestion(StreamInput in) throws IOException { size = in.readVInt(); // this is a hack to work around slightly different serialization order of earlier versions of TermSuggestion - if (in.getVersion().before(Version.V_7_0_0_alpha1) && this instanceof TermSuggestion) { + if (in.getVersion().before(Version.V_7_0_0) && this instanceof TermSuggestion) { TermSuggestion t = (TermSuggestion) this; t.setSort(SortBy.readFromStream(in)); } @@ -389,7 +389,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeVInt(size); // this is a hack to work around slightly different serialization order in older versions of TermSuggestion - if (out.getVersion().before(Version.V_7_0_0_alpha1) && this instanceof TermSuggestion) { + if (out.getVersion().before(Version.V_7_0_0) && this instanceof TermSuggestion) { TermSuggestion termSuggestion = (TermSuggestion) this; termSuggestion.getSort().writeTo(out); } diff --git a/server/src/main/java/org/elasticsearch/search/suggest/completion/context/GeoContextMapping.java b/server/src/main/java/org/elasticsearch/search/suggest/completion/context/GeoContextMapping.java index 938c4963620ed..b6b0aa8a1f58f 100644 --- a/server/src/main/java/org/elasticsearch/search/suggest/completion/context/GeoContextMapping.java +++ b/server/src/main/java/org/elasticsearch/search/suggest/completion/context/GeoContextMapping.java @@ -292,7 +292,7 @@ protected void validateReferences(Version indexVersionCreated, Function sortComparator() { public void writeTo(StreamOutput out) throws IOException { super.writeTo(out); - if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) { + if (out.getVersion().onOrAfter(Version.V_7_0_0)) { sort.writeTo(out); } } diff --git a/server/src/main/java/org/elasticsearch/transport/RemoteConnectionInfo.java b/server/src/main/java/org/elasticsearch/transport/RemoteConnectionInfo.java index 60067e18573ad..c2024e39228aa 100644 --- a/server/src/main/java/org/elasticsearch/transport/RemoteConnectionInfo.java +++ b/server/src/main/java/org/elasticsearch/transport/RemoteConnectionInfo.java @@ -58,7 +58,7 @@ public final class RemoteConnectionInfo implements ToXContentFragment, Writeable public RemoteConnectionInfo(StreamInput input) throws IOException { seedNodes = input.readList(TransportAddress::new); - if (input.getVersion().before(Version.V_7_0_0_alpha1)) { + if (input.getVersion().before(Version.V_7_0_0)) { /* * Versions before 7.0 sent the HTTP addresses of all nodes in the * remote cluster here but it was expensive to fetch and we @@ -79,7 +79,7 @@ public RemoteConnectionInfo(StreamInput input) throws IOException { @Override public void writeTo(StreamOutput out) throws IOException { out.writeList(seedNodes); - if (out.getVersion().before(Version.V_7_0_0_alpha1)) { + if (out.getVersion().before(Version.V_7_0_0)) { /* * Versions before 7.0 sent the HTTP addresses of all nodes in the * remote cluster here but it was expensive to fetch and we diff --git a/server/src/test/java/org/elasticsearch/ExceptionSerializationTests.java b/server/src/test/java/org/elasticsearch/ExceptionSerializationTests.java index 5c8c25cbfddfe..cc4e038226bae 100644 --- a/server/src/test/java/org/elasticsearch/ExceptionSerializationTests.java +++ b/server/src/test/java/org/elasticsearch/ExceptionSerializationTests.java @@ -362,7 +362,7 @@ public void testCircuitBreakingException() throws IOException { public void testTooManyBucketsException() throws IOException { MultiBucketConsumerService.TooManyBucketsException ex = serialize(new MultiBucketConsumerService.TooManyBucketsException("Too many buckets", 100), - randomFrom(Version.V_7_0_0_alpha1)); + randomFrom(Version.V_7_0_0)); assertEquals("Too many buckets", ex.getMessage()); assertEquals(100, ex.getMaxBuckets()); } diff --git a/server/src/test/java/org/elasticsearch/VersionTests.java b/server/src/test/java/org/elasticsearch/VersionTests.java index 4c7dc9eb094b7..46c67b846fd74 100644 --- a/server/src/test/java/org/elasticsearch/VersionTests.java +++ b/server/src/test/java/org/elasticsearch/VersionTests.java @@ -37,7 +37,7 @@ import java.util.Set; import static org.elasticsearch.Version.V_6_3_0; -import static org.elasticsearch.Version.V_7_0_0_alpha1; +import static org.elasticsearch.Version.V_7_0_0; import static org.elasticsearch.test.VersionUtils.allVersions; import static org.elasticsearch.test.VersionUtils.randomVersion; import static org.hamcrest.CoreMatchers.equalTo; @@ -50,30 +50,30 @@ public class VersionTests extends ESTestCase { public void testVersionComparison() throws Exception { - assertThat(V_6_3_0.before(V_7_0_0_alpha1), is(true)); + assertThat(V_6_3_0.before(V_7_0_0), is(true)); assertThat(V_6_3_0.before(V_6_3_0), is(false)); - assertThat(V_7_0_0_alpha1.before(V_6_3_0), is(false)); + assertThat(V_7_0_0.before(V_6_3_0), is(false)); - assertThat(V_6_3_0.onOrBefore(V_7_0_0_alpha1), is(true)); + assertThat(V_6_3_0.onOrBefore(V_7_0_0), is(true)); assertThat(V_6_3_0.onOrBefore(V_6_3_0), is(true)); - assertThat(V_7_0_0_alpha1.onOrBefore(V_6_3_0), is(false)); + assertThat(V_7_0_0.onOrBefore(V_6_3_0), is(false)); - assertThat(V_6_3_0.after(V_7_0_0_alpha1), is(false)); + assertThat(V_6_3_0.after(V_7_0_0), is(false)); assertThat(V_6_3_0.after(V_6_3_0), is(false)); - assertThat(V_7_0_0_alpha1.after(V_6_3_0), is(true)); + assertThat(V_7_0_0.after(V_6_3_0), is(true)); - assertThat(V_6_3_0.onOrAfter(V_7_0_0_alpha1), is(false)); + assertThat(V_6_3_0.onOrAfter(V_7_0_0), is(false)); assertThat(V_6_3_0.onOrAfter(V_6_3_0), is(true)); - assertThat(V_7_0_0_alpha1.onOrAfter(V_6_3_0), is(true)); + assertThat(V_7_0_0.onOrAfter(V_6_3_0), is(true)); assertTrue(Version.fromString("5.0.0-alpha2").onOrAfter(Version.fromString("5.0.0-alpha1"))); assertTrue(Version.fromString("5.0.0").onOrAfter(Version.fromString("5.0.0-beta2"))); assertTrue(Version.fromString("5.0.0-rc1").onOrAfter(Version.fromString("5.0.0-beta24"))); assertTrue(Version.fromString("5.0.0-alpha24").before(Version.fromString("5.0.0-beta0"))); - assertThat(V_6_3_0, is(lessThan(V_7_0_0_alpha1))); + assertThat(V_6_3_0, is(lessThan(V_7_0_0))); assertThat(V_6_3_0.compareTo(V_6_3_0), is(0)); - assertThat(V_7_0_0_alpha1, is(greaterThan(V_6_3_0))); + assertThat(V_7_0_0, is(greaterThan(V_6_3_0))); } public void testMin() { @@ -182,10 +182,10 @@ public void testMinCompatVersion() { // from 7.0 on we are supporting the latest minor of the previous major... this might fail once we add a new version ie. 5.x is // released since we need to bump the supported minor in Version#minimumCompatibilityVersion() Version lastVersion = Version.V_6_5_0; // TODO: remove this once min compat version is a constant instead of method - assertEquals(lastVersion.major, Version.V_7_0_0_alpha1.minimumCompatibilityVersion().major); + assertEquals(lastVersion.major, Version.V_7_0_0.minimumCompatibilityVersion().major); assertEquals("did you miss to bump the minor in Version#minimumCompatibilityVersion()", - lastVersion.minor, Version.V_7_0_0_alpha1.minimumCompatibilityVersion().minor); - assertEquals(0, Version.V_7_0_0_alpha1.minimumCompatibilityVersion().revision); + lastVersion.minor, Version.V_7_0_0.minimumCompatibilityVersion().minor); + assertEquals(0, Version.V_7_0_0.minimumCompatibilityVersion().revision); } public void testToString() { @@ -341,11 +341,10 @@ public static void assertUnknownVersion(Version version) { public void testIsCompatible() { assertTrue(isCompatible(Version.CURRENT, Version.CURRENT.minimumCompatibilityVersion())); - assertTrue(isCompatible(Version.V_6_5_0, Version.V_7_0_0_alpha1)); - assertFalse(isCompatible(Version.fromId(2000099), Version.V_7_0_0_alpha1)); + assertTrue(isCompatible(Version.V_6_5_0, Version.V_7_0_0)); + assertTrue(isCompatible(Version.fromString("7.0.0"), Version.fromString("8.0.0"))); + assertFalse(isCompatible(Version.fromId(2000099), Version.V_7_0_0)); assertFalse(isCompatible(Version.fromId(2000099), Version.V_6_5_0)); - assertFalse(isCompatible(Version.fromString("7.0.0"), Version.fromString("8.0.0"))); - assertFalse(isCompatible(Version.fromString("7.0.0-alpha1"), Version.fromString("8.0.0"))); final Version currentMajorVersion = Version.fromId(Version.CURRENT.major * 1000000 + 99); final Version currentOrNextMajorVersion; diff --git a/server/src/test/java/org/elasticsearch/action/support/IndicesOptionsTests.java b/server/src/test/java/org/elasticsearch/action/support/IndicesOptionsTests.java index f564066b4e3df..e27d98a43c4cb 100644 --- a/server/src/test/java/org/elasticsearch/action/support/IndicesOptionsTests.java +++ b/server/src/test/java/org/elasticsearch/action/support/IndicesOptionsTests.java @@ -51,7 +51,7 @@ public class IndicesOptionsTests extends ESTestCase { public void testSerialization() throws Exception { int iterations = randomIntBetween(5, 20); for (int i = 0; i < iterations; i++) { - Version version = randomVersionBetween(random(), Version.V_7_0_0_alpha1, null); + Version version = randomVersionBetween(random(), Version.V_7_0_0, null); IndicesOptions indicesOptions = IndicesOptions.fromOptions( randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean(), randomBoolean()); diff --git a/server/src/test/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexServiceTests.java b/server/src/test/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexServiceTests.java index 24f5a69656114..42b6e26fa2592 100644 --- a/server/src/test/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexServiceTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/metadata/MetaDataCreateIndexServiceTests.java @@ -97,12 +97,12 @@ public void testNumberOfShards() { { final Version versionCreated = VersionUtils.randomVersionBetween( random(), - Version.V_6_0_0_alpha1, VersionUtils.getPreviousVersion(Version.V_7_0_0_alpha1)); + Version.V_6_0_0_alpha1, VersionUtils.getPreviousVersion(Version.V_7_0_0)); final Settings.Builder indexSettingsBuilder = Settings.builder().put(SETTING_VERSION_CREATED, versionCreated); assertThat(MetaDataCreateIndexService.IndexCreationTask.getNumberOfShards(indexSettingsBuilder), equalTo(5)); } { - final Version versionCreated = VersionUtils.randomVersionBetween(random(), Version.V_7_0_0_alpha1, Version.CURRENT); + final Version versionCreated = VersionUtils.randomVersionBetween(random(), Version.V_7_0_0, Version.CURRENT); final Settings.Builder indexSettingsBuilder = Settings.builder().put(SETTING_VERSION_CREATED, versionCreated); assertThat(MetaDataCreateIndexService.IndexCreationTask.getNumberOfShards(indexSettingsBuilder), equalTo(1)); } @@ -430,7 +430,7 @@ public void testCalculateNumRoutingShards() { assertEquals(2048, MetaDataCreateIndexService.calculateNumRoutingShards(1024, Version.CURRENT)); assertEquals(4096, MetaDataCreateIndexService.calculateNumRoutingShards(2048, Version.CURRENT)); - Version latestV6 = VersionUtils.getPreviousVersion(Version.V_7_0_0_alpha1); + Version latestV6 = VersionUtils.getPreviousVersion(Version.V_7_0_0); int numShards = randomIntBetween(1, 1000); assertEquals(numShards, MetaDataCreateIndexService.calculateNumRoutingShards(numShards, latestV6)); assertEquals(numShards, MetaDataCreateIndexService.calculateNumRoutingShards(numShards, diff --git a/server/src/test/java/org/elasticsearch/discovery/zen/MembershipActionTests.java b/server/src/test/java/org/elasticsearch/discovery/zen/MembershipActionTests.java index 8ebb543da6e4f..11307dd4663c3 100644 --- a/server/src/test/java/org/elasticsearch/discovery/zen/MembershipActionTests.java +++ b/server/src/test/java/org/elasticsearch/discovery/zen/MembershipActionTests.java @@ -77,7 +77,7 @@ public void testPreventJoinClusterWithUnsupportedNodeVersions() { final Version maxNodeVersion = nodes.getMaxNodeVersion(); final Version minNodeVersion = nodes.getMinNodeVersion(); - if (maxNodeVersion.onOrAfter(Version.V_7_0_0_alpha1)) { + if (maxNodeVersion.onOrAfter(Version.V_7_0_0)) { final Version tooLow = getPreviousVersion(maxNodeVersion.minimumCompatibilityVersion()); expectThrows(IllegalStateException.class, () -> { if (randomBoolean()) { @@ -99,7 +99,7 @@ public void testPreventJoinClusterWithUnsupportedNodeVersions() { }); } - if (minNodeVersion.onOrAfter(Version.V_7_0_0_alpha1)) { + if (minNodeVersion.onOrAfter(Version.V_7_0_0)) { Version oldMajor = Version.V_6_4_0.minimumCompatibilityVersion(); expectThrows(IllegalStateException.class, () -> MembershipAction.ensureMajorVersionBarrier(oldMajor, minNodeVersion)); } diff --git a/server/src/test/java/org/elasticsearch/transport/RemoteClusterConnectionTests.java b/server/src/test/java/org/elasticsearch/transport/RemoteClusterConnectionTests.java index 88b01c66898a0..1e175751a095d 100644 --- a/server/src/test/java/org/elasticsearch/transport/RemoteClusterConnectionTests.java +++ b/server/src/test/java/org/elasticsearch/transport/RemoteClusterConnectionTests.java @@ -1005,7 +1005,7 @@ private static RemoteConnectionInfo assertSerialization(RemoteConnectionInfo inf public void testRemoteConnectionInfoBwComp() throws IOException { final Version version = VersionUtils.randomVersionBetween(random(), - Version.V_6_1_0, VersionUtils.getPreviousVersion(Version.V_7_0_0_alpha1)); + Version.V_6_1_0, VersionUtils.getPreviousVersion(Version.V_7_0_0)); RemoteConnectionInfo expected = new RemoteConnectionInfo("test_cluster", Collections.singletonList(new TransportAddress(TransportAddress.META_ADDRESS, 1)), 4, 4, new TimeValue(30, TimeUnit.MINUTES), false); diff --git a/test/framework/src/main/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java b/test/framework/src/main/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java index cddcca59e6cf5..3a68240db785d 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java +++ b/test/framework/src/main/java/org/elasticsearch/test/junit/listeners/ReproduceInfoPrinter.java @@ -148,8 +148,11 @@ public ReproduceErrorMessageBuilder appendESProperties() { // these properties only make sense for integration tests appendProperties(ESIntegTestCase.TESTS_ENABLE_MOCK_MODULES); } - appendProperties("tests.assertion.disabled", "tests.security.manager", "tests.nightly", "tests.jvms", - "tests.client.ratio", "tests.heap.size", "tests.bwc", "tests.bwc.version", "build.snapshot"); + appendProperties( + "tests.assertion.disabled", "tests.security.manager", "tests.nightly", "tests.jvms", + "tests.client.ratio", "tests.heap.size", "tests.bwc", "tests.bwc.version", "build.snapshot", + "build.version_qualifier" + ); if (System.getProperty("tests.jvm.argline") != null && !System.getProperty("tests.jvm.argline").isEmpty()) { appendOpt("tests.jvm.argline", "\"" + System.getProperty("tests.jvm.argline") + "\""); } diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/DoSection.java b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/DoSection.java index e1346d3f6967d..4aed9b925a6d9 100644 --- a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/DoSection.java +++ b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/DoSection.java @@ -292,7 +292,7 @@ void checkWarningHeaders(final List warningHeaders, final Version master if (matches) { final String message = matcher.group(1); // noinspection StatementWithEmptyBody - if (masterVersion.before(Version.V_7_0_0_alpha1) + if (masterVersion.before(Version.V_7_0_0) && message.equals("the default number of shards will change from [5] to [1] in 7.0.0; " + "if you wish to continue using the default of [5] shards, " + "you must manage this on the create index request or with an index template")) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/Job.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/Job.java index a978612fd02e5..3177724d15e04 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/Job.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/Job.java @@ -240,7 +240,7 @@ public Job(StreamInput in) throws IOException { Map readCustomSettings = in.readMap(); customSettings = readCustomSettings == null ? null : Collections.unmodifiableMap(readCustomSettings); modelSnapshotId = in.readOptionalString(); - if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1) && in.readBoolean()) { + if (in.getVersion().onOrAfter(Version.V_7_0_0) && in.readBoolean()) { modelSnapshotMinVersion = Version.readVersion(in); } else { modelSnapshotMinVersion = null; @@ -514,7 +514,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeOptionalLong(resultsRetentionDays); out.writeMap(customSettings); out.writeOptionalString(modelSnapshotId); - if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) { + if (out.getVersion().onOrAfter(Version.V_7_0_0)) { if (modelSnapshotMinVersion != null) { out.writeBoolean(true); Version.writeVersion(modelSnapshotMinVersion, out); @@ -747,7 +747,7 @@ public Builder(StreamInput in) throws IOException { resultsRetentionDays = in.readOptionalLong(); customSettings = in.readMap(); modelSnapshotId = in.readOptionalString(); - if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1) && in.readBoolean()) { + if (in.getVersion().onOrAfter(Version.V_7_0_0) && in.readBoolean()) { modelSnapshotMinVersion = Version.readVersion(in); } else { modelSnapshotMinVersion = null; @@ -952,7 +952,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeOptionalLong(resultsRetentionDays); out.writeMap(customSettings); out.writeOptionalString(modelSnapshotId); - if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) { + if (out.getVersion().onOrAfter(Version.V_7_0_0)) { if (modelSnapshotMinVersion != null) { out.writeBoolean(true); Version.writeVersion(modelSnapshotMinVersion, out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/JobUpdate.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/JobUpdate.java index cdfd9bad7f1de..067a73e47787d 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/JobUpdate.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/config/JobUpdate.java @@ -141,7 +141,7 @@ public JobUpdate(StreamInput in) throws IOException { } else { jobVersion = null; } - if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1) && in.readBoolean()) { + if (in.getVersion().onOrAfter(Version.V_7_0_0) && in.readBoolean()) { modelSnapshotMinVersion = Version.readVersion(in); } else { modelSnapshotMinVersion = null; @@ -183,7 +183,7 @@ public void writeTo(StreamOutput out) throws IOException { out.writeBoolean(false); } } - if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) { + if (out.getVersion().onOrAfter(Version.V_7_0_0)) { if (modelSnapshotMinVersion != null) { out.writeBoolean(true); Version.writeVersion(modelSnapshotMinVersion, out); diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/process/autodetect/state/ModelSnapshot.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/process/autodetect/state/ModelSnapshot.java index 068b998dc251a..fed5545c25345 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/process/autodetect/state/ModelSnapshot.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ml/job/process/autodetect/state/ModelSnapshot.java @@ -140,7 +140,7 @@ private ModelSnapshot(String jobId, Version minVersion, Date timestamp, String d public ModelSnapshot(StreamInput in) throws IOException { jobId = in.readString(); - if (in.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) { + if (in.getVersion().onOrAfter(Version.V_7_0_0)) { minVersion = Version.readVersion(in); } else { minVersion = Version.CURRENT.minimumCompatibilityVersion(); @@ -159,7 +159,7 @@ public ModelSnapshot(StreamInput in) throws IOException { @Override public void writeTo(StreamOutput out) throws IOException { out.writeString(jobId); - if (out.getVersion().onOrAfter(Version.V_7_0_0_alpha1)) { + if (out.getVersion().onOrAfter(Version.V_7_0_0)) { Version.writeVersion(minVersion, out); } if (timestamp != null) { diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/exporter/MonitoringTemplateUtils.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/exporter/MonitoringTemplateUtils.java index 96bc59af1ca63..ad67ba723ca51 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/exporter/MonitoringTemplateUtils.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/monitoring/exporter/MonitoringTemplateUtils.java @@ -28,7 +28,7 @@ public final class MonitoringTemplateUtils { *

* It may be possible for this to diverge between templates and pipelines, but for now they're the same. */ - public static final int LAST_UPDATED_VERSION = Version.V_7_0_0_alpha1.id; + public static final int LAST_UPDATED_VERSION = Version.V_7_0_0.id; /** * Current version of templates used in their name to differentiate from breaking changes (separate from product version). diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/role/PutRoleRequest.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/role/PutRoleRequest.java index 82863a6e8d155..4d75ae296a87e 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/role/PutRoleRequest.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/security/action/role/PutRoleRequest.java @@ -185,6 +185,7 @@ public void writeTo(StreamOutput out) throws IOException { for (RoleDescriptor.IndicesPrivileges index : indicesPrivileges) { index.writeTo(out); } + if (out.getVersion().onOrAfter(Version.V_6_4_0)) { out.writeStreamableList(applicationPrivileges); ConditionalClusterPrivileges.writeArray(out, this.conditionalClusterPrivileges); diff --git a/x-pack/plugin/core/src/main/resources/monitoring-alerts.json b/x-pack/plugin/core/src/main/resources/monitoring-alerts.json index 01186bca77db5..5ab085b453075 100644 --- a/x-pack/plugin/core/src/main/resources/monitoring-alerts.json +++ b/x-pack/plugin/core/src/main/resources/monitoring-alerts.json @@ -1,6 +1,6 @@ { "index_patterns": [ ".monitoring-alerts-${monitoring.template.version}" ], - "version": 7000001, + "version": 7000099, "settings": { "index": { "number_of_shards": 1, diff --git a/x-pack/plugin/core/src/main/resources/monitoring-beats.json b/x-pack/plugin/core/src/main/resources/monitoring-beats.json index 07756ba2602f0..44c251f74e7f2 100644 --- a/x-pack/plugin/core/src/main/resources/monitoring-beats.json +++ b/x-pack/plugin/core/src/main/resources/monitoring-beats.json @@ -9,7 +9,7 @@ "index.number_of_replicas": 0, "index.number_of_shards": 1 }, - "version": 7000001, + "version": 7000099, "mappings": { "doc": { "dynamic": false, diff --git a/x-pack/plugin/core/src/main/resources/monitoring-es.json b/x-pack/plugin/core/src/main/resources/monitoring-es.json index a1726a7a74ae4..9ec0f39a17d26 100644 --- a/x-pack/plugin/core/src/main/resources/monitoring-es.json +++ b/x-pack/plugin/core/src/main/resources/monitoring-es.json @@ -1,6 +1,6 @@ { "index_patterns": [ ".monitoring-es-${monitoring.template.version}-*" ], - "version": 7000001, + "version": 7000099, "settings": { "index.number_of_shards": 1, "index.number_of_replicas": 0, diff --git a/x-pack/plugin/core/src/main/resources/monitoring-kibana.json b/x-pack/plugin/core/src/main/resources/monitoring-kibana.json index 51e9f7cdd1906..c220e95e182e3 100644 --- a/x-pack/plugin/core/src/main/resources/monitoring-kibana.json +++ b/x-pack/plugin/core/src/main/resources/monitoring-kibana.json @@ -1,6 +1,6 @@ { "index_patterns": [ ".monitoring-kibana-${monitoring.template.version}-*" ], - "version": 7000001, + "version": 7000099, "settings": { "index.number_of_shards": 1, "index.number_of_replicas": 0, diff --git a/x-pack/plugin/core/src/main/resources/monitoring-logstash.json b/x-pack/plugin/core/src/main/resources/monitoring-logstash.json index cadefd6864dc5..5ae3e9a9eb85a 100644 --- a/x-pack/plugin/core/src/main/resources/monitoring-logstash.json +++ b/x-pack/plugin/core/src/main/resources/monitoring-logstash.json @@ -1,6 +1,6 @@ { "index_patterns": [ ".monitoring-logstash-${monitoring.template.version}-*" ], - "version": 7000001, + "version": 7000099, "settings": { "index.number_of_shards": 1, "index.number_of_replicas": 0, diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecks.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecks.java index 177574d89b65c..273fe1dec9d20 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecks.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecks.java @@ -145,7 +145,7 @@ static DeprecationIssue baseSimilarityDefinedCheck(IndexMetaData indexMetaData) } static DeprecationIssue delimitedPayloadFilterCheck(IndexMetaData indexMetaData) { - if (indexMetaData.getCreationVersion().before(Version.V_7_0_0_alpha1)) { + if (indexMetaData.getCreationVersion().before(Version.V_7_0_0)) { List issues = new ArrayList<>(); Map filters = indexMetaData.getSettings().getGroups(AnalysisRegistry.INDEX_ANALYSIS_FILTER); for (Map.Entry entry : filters.entrySet()) { @@ -211,4 +211,4 @@ static DeprecationIssue indexSharedFileSystemCheck(IndexMetaData indexMetaData) } return null; } -} \ No newline at end of file +} diff --git a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecksTests.java b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecksTests.java index d496eea2f0d13..7203a853846d1 100644 --- a/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecksTests.java +++ b/x-pack/plugin/deprecation/src/test/java/org/elasticsearch/xpack/deprecation/IndexDeprecationChecksTests.java @@ -22,7 +22,7 @@ public class IndexDeprecationChecksTests extends ESTestCase { public void testDelimitedPayloadFilterCheck() throws IOException { Settings settings = settings( - VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_7_0_0_alpha1))) + VersionUtils.randomVersionBetween(random(), Version.V_6_0_0, VersionUtils.getPreviousVersion(Version.V_7_0_0))) .put("index.analysis.filter.my_delimited_payload_filter.type", "delimited_payload_filter") .put("index.analysis.filter.my_delimited_payload_filter.delimiter", "^") .put("index.analysis.filter.my_delimited_payload_filter.encoding", "identity").build(); diff --git a/x-pack/plugin/ml/cpp-snapshot/build.gradle b/x-pack/plugin/ml/cpp-snapshot/build.gradle index 1c35d9db6f321..df2905c453b76 100644 --- a/x-pack/plugin/ml/cpp-snapshot/build.gradle +++ b/x-pack/plugin/ml/cpp-snapshot/build.gradle @@ -16,7 +16,7 @@ void getZip(File snapshotZip) { // do a HEAD first to check the zip hash against the local file conn.setRequestMethod('HEAD'); if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) { - throw new GradleException('ML cpp snapshot does not exist') + throw new GradleException("ML cpp snapshot ${version} does not exist") } String remoteMd5 = conn.getHeaderField('ETag') diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/ClusterAlertsUtil.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/ClusterAlertsUtil.java index 259c3af8839b2..b42da6f7283ee 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/ClusterAlertsUtil.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/ClusterAlertsUtil.java @@ -56,7 +56,7 @@ public class ClusterAlertsUtil { * The last time that all watches were updated. For now, all watches have been updated in the same version and should all be replaced * together. */ - public static final int LAST_UPDATED_VERSION = Version.V_7_0_0_alpha1.id; + public static final int LAST_UPDATED_VERSION = Version.V_7_0_0.id; /** * An unsorted list of Watch IDs representing resource files for Monitoring Cluster Alerts. @@ -151,7 +151,7 @@ public static List getClusterAlertsBlacklist(final Exporter.Config confi if (unknownIds.isEmpty() == false) { throw new SettingsException( - "[" + CLUSTER_ALERTS_BLACKLIST_SETTING.getConcreteSettingForNamespace(config.name()).getKey() + + "[" + CLUSTER_ALERTS_BLACKLIST_SETTING.getConcreteSettingForNamespace(config.name()).getKey() + "] contains unrecognized Cluster Alert IDs [" + String.join(", ", unknownIds) + "]"); } } diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporter.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporter.java index 54447c1646370..2ac4fd01850e7 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporter.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporter.java @@ -164,7 +164,7 @@ public class HttpExporter extends Exporter { /** * Minimum supported version of the remote monitoring cluster (same major). */ - public static final Version MIN_SUPPORTED_CLUSTER_VERSION = Version.V_7_0_0_alpha1; + public static final Version MIN_SUPPORTED_CLUSTER_VERSION = Version.V_7_0_0; /** * The {@link RestClient} automatically pools connections and keeps them alive as necessary. diff --git a/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/elasticsearch_cluster_status.json b/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/elasticsearch_cluster_status.json index e1f418d5a8d71..1a177a26e7cf2 100644 --- a/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/elasticsearch_cluster_status.json +++ b/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/elasticsearch_cluster_status.json @@ -7,7 +7,7 @@ "link": "elasticsearch/indices", "severity": 2100, "type": "monitoring", - "version_created": 7000001, + "version_created": 7000099, "watch": "${monitoring.watch.id}" } }, diff --git a/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/elasticsearch_nodes.json b/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/elasticsearch_nodes.json index 5c0cb7f55b4e5..4b45cb38f07d4 100644 --- a/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/elasticsearch_nodes.json +++ b/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/elasticsearch_nodes.json @@ -7,7 +7,7 @@ "link": "elasticsearch/nodes", "severity": 1999, "type": "monitoring", - "version_created": 7000001, + "version_created": 7000099, "watch": "${monitoring.watch.id}" } }, diff --git a/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/elasticsearch_version_mismatch.json b/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/elasticsearch_version_mismatch.json index 051a3a9d40921..7cb494ce8e712 100644 --- a/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/elasticsearch_version_mismatch.json +++ b/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/elasticsearch_version_mismatch.json @@ -7,7 +7,7 @@ "link": "elasticsearch/nodes", "severity": 1000, "type": "monitoring", - "version_created": 7000001, + "version_created": 7000099, "watch": "${monitoring.watch.id}" } }, diff --git a/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/kibana_version_mismatch.json b/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/kibana_version_mismatch.json index b2acba610e141..7ec176c57897a 100644 --- a/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/kibana_version_mismatch.json +++ b/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/kibana_version_mismatch.json @@ -7,7 +7,7 @@ "link": "kibana/instances", "severity": 1000, "type": "monitoring", - "version_created": 7000001, + "version_created": 7000099, "watch": "${monitoring.watch.id}" } }, diff --git a/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/logstash_version_mismatch.json b/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/logstash_version_mismatch.json index cf1fdde606c7a..69fc05f7ccee8 100644 --- a/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/logstash_version_mismatch.json +++ b/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/logstash_version_mismatch.json @@ -7,7 +7,7 @@ "link": "logstash/instances", "severity": 1000, "type": "monitoring", - "version_created": 7000001, + "version_created": 7000099, "watch": "${monitoring.watch.id}" } }, diff --git a/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/xpack_license_expiration.json b/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/xpack_license_expiration.json index 7eb0d59167dbd..e7c05fbcde11b 100644 --- a/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/xpack_license_expiration.json +++ b/x-pack/plugin/monitoring/src/main/resources/monitoring/watches/xpack_license_expiration.json @@ -8,7 +8,7 @@ "alert_index": ".monitoring-alerts-6", "cluster_uuid": "${monitoring.watch.cluster_uuid}", "type": "monitoring", - "version_created": 7000001, + "version_created": 7000099, "watch": "${monitoring.watch.id}" } }, diff --git a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java index e8bcf42233a7b..f3371f6589449 100644 --- a/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java +++ b/x-pack/plugin/security/src/main/java/org/elasticsearch/xpack/security/Security.java @@ -1025,7 +1025,7 @@ public void accept(DiscoveryNode node, ClusterState state) { static final class ValidateUpgradedSecurityIndex implements BiConsumer { @Override public void accept(DiscoveryNode node, ClusterState state) { - if (state.getNodes().getMinNodeVersion().before(Version.V_7_0_0_alpha1)) { + if (state.getNodes().getMinNodeVersion().before(Version.V_7_0_0)) { IndexMetaData indexMetaData = state.getMetaData().getIndices().get(SECURITY_INDEX_NAME); if (indexMetaData != null && INDEX_FORMAT_SETTING.get(indexMetaData.getSettings()) < INTERNAL_INDEX_FORMAT) { throw new IllegalStateException("Security index is not on the current version [" + INTERNAL_INDEX_FORMAT + "] - " + diff --git a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/esnative/ReservedRealmTests.java b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/esnative/ReservedRealmTests.java index 36d1690b8b202..82eb9484bd599 100644 --- a/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/esnative/ReservedRealmTests.java +++ b/x-pack/plugin/security/src/test/java/org/elasticsearch/xpack/security/authc/esnative/ReservedRealmTests.java @@ -463,6 +463,6 @@ private void verifyVersionPredicate(String principal, Predicate version assertThat(versionPredicate.test(Version.V_6_3_0), is(true)); break; } - assertThat(versionPredicate.test(Version.V_7_0_0_alpha1), is(true)); + assertThat(versionPredicate.test(Version.V_7_0_0), is(true)); } }