Skip to content

Commit

Permalink
Merge remote-tracking branch 'elastic/master' into sync-retention-leases
Browse files Browse the repository at this point in the history
* elastic/master: (85 commits)
  Use explicit version for build-tools in example plugin integ tests (elastic#37792)
  Change `rational` to `saturation` in script_score (elastic#37766)
  Deprecate types in get field mapping API (elastic#37667)
  Add ability to listen to group of affix settings (elastic#37679)
  Ensure changes requests return the latest mapping version (elastic#37633)
  Make Minio Setup more Reliable (elastic#37747)
  Liberalize StreamOutput#writeStringList (elastic#37768)
  Add PersistentTasksClusterService::unassignPersistentTask method (elastic#37576)
  Tests: disable testRandomGeoCollectionQuery on tiny polygons (elastic#37579)
  Use ILM for Watcher history deletion (elastic#37443)
  Make sure PutMappingRequest accepts content types other than JSON. (elastic#37720)
  Retry ILM steps that fail due to SnapshotInProgressException (elastic#37624)
  Use disassociate in preference to deassociate (elastic#37704)
  Delete Redundant RoutingServiceTests (elastic#37750)
  Always return metadata version if metadata is requested (elastic#37674)
  [TEST] Mute MlMappingsUpgradeIT testMappingsUpgrade
  Streamline skip_unavailable handling (elastic#37672)
  Only bootstrap and elect node in current voting configuration (elastic#37712)
  Ensure either success or failure path for SearchOperationListener is called (elastic#37467)
  Target only specific index in update settings test
  ...
  • Loading branch information
jasontedor committed Jan 24, 2019
2 parents df5f711 + 49b8b07 commit 37380dd
Show file tree
Hide file tree
Showing 702 changed files with 12,060 additions and 8,697 deletions.
12 changes: 11 additions & 1 deletion TESTING.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ In order to start with a different distribution use the `-Drun.distribution` arg
To for example start the open source distribution:

-------------------------------------
./gradlew run -Drun.distribution=oss-zip
./gradlew run -Drun.distribution=oss
-------------------------------------

==== License type
Expand Down Expand Up @@ -631,3 +631,13 @@ inside `/etc/hosts`, e.g.:
255.255.255.255 broadcasthost
::1 localhost ElasticMBP.local`
....

== Benchmarking

For changes that might affect the performance characteristics of Elasticsearch
you should also run macrobenchmarks. We maintain a macrobenchmarking tool
called https://github.com/elastic/rally[Rally]
which you can use to measure the performance impact. It comes with a set of
default benchmarks that we also
https://elasticsearch-benchmarks.elastic.co/[run every night]. To get started,
please see https://esrally.readthedocs.io/en/stable/[Rally's documentation].
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,3 @@ public TemporalAccessor parseJodaDate() {
return jodaFormatter.parse("1234567890");
}
}

28 changes: 14 additions & 14 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -221,14 +221,14 @@ allprojects {
"org.elasticsearch.plugin:elasticsearch-scripting-painless-spi:${version}": ':modules:lang-painless:spi',
"org.elasticsearch.test:framework:${version}": ':test:framework',
"org.elasticsearch.distribution.integ-test-zip:elasticsearch:${version}": ':distribution:archives:integ-test-zip',
"org.elasticsearch.distribution.zip:elasticsearch:${version}": ':distribution:archives:zip',
"org.elasticsearch.distribution.zip:elasticsearch-oss:${version}": ':distribution:archives:oss-zip',
"org.elasticsearch.distribution.tar:elasticsearch:${version}": ':distribution:archives:tar',
"org.elasticsearch.distribution.tar:elasticsearch-oss:${version}": ':distribution:archives:oss-tar',
"org.elasticsearch.distribution.rpm:elasticsearch:${version}": ':distribution:packages:rpm',
"org.elasticsearch.distribution.rpm:elasticsearch-oss:${version}": ':distribution:packages:oss-rpm',
"org.elasticsearch.distribution.deb:elasticsearch:${version}": ':distribution:packages:deb',
"org.elasticsearch.distribution.deb:elasticsearch-oss:${version}": ':distribution:packages:oss-deb',
"downloads.zip:elasticsearch:${version}": ':distribution:archives:zip',
"downloads.zip:elasticsearch-oss:${version}": ':distribution:archives:oss-zip',
"downloads.tar:elasticsearch:${version}": ':distribution:archives:tar',
"downloads.tar:elasticsearch-oss:${version}": ':distribution:archives:oss-tar',
"downloads.rpm:elasticsearch:${version}": ':distribution:packages:rpm',
"downloads.rpm:elasticsearch-oss:${version}": ':distribution:packages:oss-rpm',
"downloads.deb:elasticsearch:${version}": ':distribution:packages:deb',
"downloads.deb:elasticsearch-oss:${version}": ':distribution:packages:oss-deb',
"org.elasticsearch.test:logger-usage:${version}": ':test:logger-usage',
"org.elasticsearch.xpack.test:feature-aware:${version}": ':x-pack:test:feature-aware',
// for transport client
Expand All @@ -244,13 +244,13 @@ allprojects {
bwcVersions.forPreviousUnreleased { VersionCollection.UnreleasedVersionInfo unreleasedVersion ->
Version unreleased = unreleasedVersion.version
String snapshotProject = ":distribution:bwc:${unreleasedVersion.gradleProjectName}"
ext.projectSubstitutions["org.elasticsearch.distribution.deb:elasticsearch:${unreleased}"] = snapshotProject
ext.projectSubstitutions["org.elasticsearch.distribution.rpm:elasticsearch:${unreleased}"] = snapshotProject
ext.projectSubstitutions["org.elasticsearch.distribution.zip:elasticsearch:${unreleased}"] = snapshotProject
ext.projectSubstitutions["downloads.deb:elasticsearch:${unreleased}"] = snapshotProject
ext.projectSubstitutions["downloads.rpm:elasticsearch:${unreleased}"] = snapshotProject
ext.projectSubstitutions["downloads.zip:elasticsearch:${unreleased}"] = snapshotProject
if (unreleased.onOrAfter('6.3.0')) {
ext.projectSubstitutions["org.elasticsearch.distribution.deb:elasticsearch-oss:${unreleased}"] = snapshotProject
ext.projectSubstitutions["org.elasticsearch.distribution.rpm:elasticsearch-oss:${unreleased}"] = snapshotProject
ext.projectSubstitutions["org.elasticsearch.distribution.zip:elasticsearch-oss:${unreleased}"] = snapshotProject
ext.projectSubstitutions["downloads.deb:elasticsearch-oss:${unreleased}"] = snapshotProject
ext.projectSubstitutions["downloads.rpm:elasticsearch-oss:${unreleased}"] = snapshotProject
ext.projectSubstitutions["downloads.zip:elasticsearch-oss:${unreleased}"] = snapshotProject
}
}

Expand Down
17 changes: 17 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,21 @@ if (project != rootProject) {
jarHell.enabled = false
thirdPartyAudit.enabled = false

configurations {
distribution
}

dependencies {
distribution project(':distribution:archives:zip')
distribution project(':distribution:archives:oss-zip')
}

String localDownloads = "${rootProject.buildDir}/local-downloads"
task setupLocalDownloads(type:Copy) {
from configurations.distribution
into localDownloads
}

unitTest {
// The test task is configured to runtimeJava version, but build-tools doesn't support all of them, so test
// with compiler instead on the ones that are too old.
Expand All @@ -192,6 +207,7 @@ if (project != rootProject) {
dependsOn project.rootProject.allprojects.collect {
it.tasks.matching { it.name == 'publishNebulaPublicationToLocalTestRepository'}
}
dependsOn setupLocalDownloads
exclude "**/*Tests.class"
testClassesDirs = sourceSets.test.output.classesDirs
classpath = sourceSets.test.runtimeClasspath
Expand All @@ -204,6 +220,7 @@ if (project != rootProject) {
).asPath,
)
systemProperty 'test.local-test-repo-path', "${rootProject.buildDir}/local-test-repo"
systemProperty 'test.local-test-downloads-path', localDownloads
systemProperty 'test.version_under_test', version
systemProperty 'test.lucene-snapshot-revision', (versions.lucene =~ /\w+-snapshot-([a-z0-9]+)/)[0][1]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ class BuildPlugin implements Plugin<Project> {
static void requireJavaHome(Task task, int version) {
Project rootProject = task.project.rootProject // use root project for global accounting
if (rootProject.hasProperty('requiredJavaVersions') == false) {
rootProject.rootProject.ext.requiredJavaVersions = [:].withDefault{key -> return []}
rootProject.rootProject.ext.requiredJavaVersions = [:]
rootProject.gradle.taskGraph.whenReady { TaskExecutionGraph taskGraph ->
List<String> messages = []
for (entry in rootProject.requiredJavaVersions) {
Expand All @@ -407,9 +407,16 @@ class BuildPlugin implements Plugin<Project> {
if (messages.isEmpty() == false) {
throw new GradleException(messages.join('\n'))
}
rootProject.rootProject.ext.requiredJavaVersions = null // reset to null to indicate the pre-execution checks have executed
}
} else if (rootProject.rootProject.requiredJavaVersions == null) {
// check directly if the version is present since we are already executing
if (rootProject.javaVersions.get(version) == null) {
throw new GradleException("JAVA${version}_HOME required to run task:\n${task}")
}
} else {
rootProject.requiredJavaVersions.getOrDefault(version, []).add(task)
}
rootProject.requiredJavaVersions.get(version).add(task)
}

/** A convenience method for getting java home for a version of java and requiring that version for the given task to execute */
Expand Down Expand Up @@ -558,6 +565,12 @@ class BuildPlugin implements Plugin<Project> {
repos.mavenLocal()
}
repos.jcenter()
repos.ivy {
url "https://artifacts.elastic.co/downloads"
patternLayout {
artifact "elasticsearch/[module]-[revision](-[classifier]).[ext]"
}
}
repos.maven {
name "elastic"
url "https://artifacts.elastic.co/maven"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class DocsTestPlugin extends RestTestPlugin {
project.pluginManager.apply('elasticsearch.standalone-rest-test')
super.apply(project)
// The distribution can be configured with -Dtests.distribution on the command line
project.integTestCluster.distribution = System.getProperty('tests.distribution', 'zip')
project.integTestCluster.distribution = System.getProperty('tests.distribution', 'default')
// Docs are published separately so no need to assemble
project.tasks.assemble.enabled = false
Map<String, String> defaultSubstitutions = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class ClusterConfiguration {
private final Project project

@Input
String distribution = 'zip'
String distribution = 'default'

@Input
int numNodes = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,17 @@
*/
package org.elasticsearch.gradle.test

import java.util.stream.Collectors
import org.apache.tools.ant.DefaultLogger
import org.apache.tools.ant.taskdefs.condition.Os
import org.elasticsearch.gradle.BuildPlugin
import org.elasticsearch.gradle.LoggedExec
import org.elasticsearch.gradle.Version
import org.elasticsearch.gradle.VersionProperties

import org.elasticsearch.gradle.plugin.PluginBuildPlugin
import org.elasticsearch.gradle.plugin.PluginPropertiesExtension
import org.gradle.api.AntBuilder
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
import org.gradle.api.InvalidUserDataException
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.artifacts.Configuration
Expand All @@ -45,7 +42,7 @@ import org.gradle.api.tasks.Exec
import java.nio.charset.StandardCharsets
import java.nio.file.Paths
import java.util.concurrent.TimeUnit

import java.util.stream.Collectors
/**
* A helper for creating tasks to build a cluster that is used by a task, and tear down the cluster when the task is finished.
*/
Expand Down Expand Up @@ -89,7 +86,7 @@ class ClusterFormationTasks {
Configuration currentDistro = project.configurations.create("${prefix}_elasticsearchDistro")
Configuration bwcDistro = project.configurations.create("${prefix}_elasticsearchBwcDistro")
Configuration bwcPlugins = project.configurations.create("${prefix}_elasticsearchBwcPlugins")
if (System.getProperty('tests.distribution', 'oss-zip') == 'integ-test-zip') {
if (System.getProperty('tests.distribution', 'oss') == 'integ-test-zip') {
throw new Exception("tests.distribution=integ-test-zip is not supported")
}
configureDistributionDependency(project, config.distribution, currentDistro, VersionProperties.elasticsearch)
Expand Down Expand Up @@ -174,24 +171,31 @@ class ClusterFormationTasks {

/** Adds a dependency on the given distribution */
static void configureDistributionDependency(Project project, String distro, Configuration configuration, String elasticsearchVersion) {
if (Version.fromString(elasticsearchVersion).before('6.3.0') &&
distro.startsWith('oss-')
) {
// TEMP HACK
// The oss docs CI build overrides the distro on the command line. This hack handles backcompat until CI is updated.
if (distro.equals('oss-zip')) {
distro = 'oss'
}
if (distro.equals('zip')) {
distro = 'default'
}
// END TEMP HACK
if (['integ-test-zip', 'oss', 'default'].contains(distro) == false) {
throw new GradleException("Unknown distribution: ${distro} in project ${project.path}")
}
Version version = Version.fromString(elasticsearchVersion)
if (version.before('6.3.0') && distro.startsWith('oss-')) {
distro = distro.substring('oss-'.length())
}
String packaging = distro
if (distro.contains('tar')) {
packaging = 'tar.gz'\
} else if (distro.contains('zip')) {
packaging = 'zip'
String group = "downloads.zip"
if (distro.equals("integ-test-zip")) {
group = "org.elasticsearch.distribution.integ-test-zip"
}
String subgroup = distro
String artifactName = 'elasticsearch'
if (distro.contains('oss')) {
if (distro.equals('oss') && Version.fromString(elasticsearchVersion).onOrAfter('6.3.0')) {
artifactName += '-oss'
subgroup = distro.substring('oss-'.length())
}
project.dependencies.add(configuration.name, "org.elasticsearch.distribution.${subgroup}:${artifactName}:${elasticsearchVersion}@${packaging}")
project.dependencies.add(configuration.name, "${group}:${artifactName}:${elasticsearchVersion}@zip")
}

/** Adds a dependency on a different version of the given plugin, which will be retrieved using gradle's dependency resolution */
Expand Down Expand Up @@ -314,31 +318,13 @@ 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

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
}
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
}
break;
default:
throw new InvalidUserDataException("Unknown distribution: ${node.config.distribution}")
Task extract = project.tasks.create(name: name, type: Copy, dependsOn: extractDependsOn) {
from {
project.zipTree(configuration.singleFile)
}
into node.baseDir
}

return extract
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ import org.gradle.api.Project
import java.nio.file.Files
import java.nio.file.Path
import java.nio.file.Paths

import static org.elasticsearch.gradle.BuildPlugin.getJavaHome

/**
* A container for the files and configuration associated with a single node in a test cluster.
*/
Expand Down Expand Up @@ -125,8 +122,8 @@ class NodeInfo {
baseDir = new File(project.buildDir, "cluster/${prefix} node${nodeNum}")
pidFile = new File(baseDir, 'es.pid')
this.nodeVersion = Version.fromString(nodeVersion)
homeDir = homeDir(baseDir, config.distribution, nodeVersion)
pathConf = pathConf(baseDir, config.distribution, nodeVersion)
homeDir = new File(baseDir, "elasticsearch-${nodeVersion}")
pathConf = new File(homeDir, 'config')
if (config.dataDir != null) {
dataDir = "${config.dataDir(nodeNum)}"
} else {
Expand Down Expand Up @@ -299,41 +296,4 @@ class NodeInfo {
}
return dataDir
}

/** Returns the directory elasticsearch home is contained in for the given distribution */
static File homeDir(File baseDir, String distro, String nodeVersion) {
String path
switch (distro) {
case 'integ-test-zip':
case 'zip':
case 'tar':
case 'oss-zip':
case 'oss-tar':
path = "elasticsearch-${nodeVersion}"
break
case 'rpm':
case 'deb':
path = "${distro}-extracted/usr/share/elasticsearch"
break
default:
throw new InvalidUserDataException("Unknown distribution: ${distro}")
}
return new File(baseDir, path)
}

static File pathConf(File baseDir, String distro, String nodeVersion) {
switch (distro) {
case 'integ-test-zip':
case 'zip':
case 'oss-zip':
case 'tar':
case 'oss-tar':
return new File(homeDir(baseDir, distro, nodeVersion), 'config')
case 'rpm':
case 'deb':
return new File(baseDir, "${distro}-extracted/etc/elasticsearch")
default:
throw new InvalidUserDataException("Unknown distribution: ${distro}")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class RunTask extends DefaultTask {
clusterConfig.httpPort = 9200
clusterConfig.transportPort = 9300
clusterConfig.daemonize = false
clusterConfig.distribution = 'zip'
clusterConfig.distribution = 'default'
project.afterEvaluate {
ClusterFormationTasks.setup(project, name, this, clusterConfig)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ class VagrantTestPlugin implements Plugin<Project> {
UPGRADE_FROM_ARCHIVES.each {
// The version of elasticsearch that we upgrade *from*
project.dependencies.add(PACKAGING_CONFIGURATION,
"org.elasticsearch.distribution.${it}:elasticsearch:${upgradeFromVersion}@${it}")
"downloads.${it}:elasticsearch:${upgradeFromVersion}@${it}")
if (upgradeFromVersion.onOrAfter('6.3.0')) {
project.dependencies.add(PACKAGING_CONFIGURATION,
"org.elasticsearch.distribution.${it}:elasticsearch-oss:${upgradeFromVersion}@${it}")
"downloads.${it}:elasticsearch-oss:${upgradeFromVersion}@${it}")
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,9 @@ private void configure() {
getConfPathSharedData().mkdirs();
getConfPathLogs().mkdirs();
LinkedHashMap<String, String> config = new LinkedHashMap<>();
config.put("cluster.name", "cluster-" + safeName(name));
config.put("node.name", "node-" + safeName(name));
String nodeName = safeName(name);
config.put("cluster.name",nodeName);
config.put("node.name", nodeName);
config.put("path.repo", getConfPathRepo().getAbsolutePath());
config.put("path.data", getConfPathData().getAbsolutePath());
config.put("path.logs", getConfPathLogs().getAbsolutePath());
Expand All @@ -342,6 +343,9 @@ private void configure() {
if (Version.fromString(version).getMajor() >= 6) {
config.put("cluster.routing.allocation.disk.watermark.flood_stage", "1b");
}
if (Version.fromString(version).getMajor() >= 7) {
config.put("cluster.initial_master_nodes", "[" + nodeName + "]");
}
try {
Files.write(
getConfigFile().toPath(),
Expand Down
Loading

0 comments on commit 37380dd

Please sign in to comment.