Skip to content

Commit 7480faf

Browse files
committed
Merge branch 'master' into translog-generation
* master: [API] change wait_for_completion defaults according to docs (elastic#23672) Share XContent rendering code in terms aggs (elastic#23680) Update ingest-node.asciidoc [DOCS] Update the docs about the fact that global ordinals for _parent field are loaded eagerly instead of lazily by default. Build: remove progress logger hack for gradle 2.13 (elastic#23679) Test: Add dump of integ test cluster logs on failure (elastic#23688) Plugins: Add plugin cli specific exit codes (elastic#23599) Plugins: Output better error message when existing plugin is incompatible (elastic#23562) Reindex: wait for cleanup before responding (elastic#23677) Packaging: Remove classpath ordering hack (elastic#23596) Docs: Add note about updating plugins requiring removal and reinstallation (elastic#23597) Build: Make plugin list for smoke tester dynamic (elastic#23601) [TEST] Propertly cleans up failing restore test
2 parents 518f12e + f8b7ec2 commit 7480faf

File tree

44 files changed

+484
-424
lines changed

Some content is hidden

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

44 files changed

+484
-424
lines changed

buildSrc/build.gradle

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -96,23 +96,12 @@ dependencies {
9696
compile 'org.apache.rat:apache-rat:0.11'
9797
}
9898

99-
// Gradle version-specific options (allows build to run with Gradle 2.13 as well as 2.14+/3.+)
100-
if (GradleVersion.current() == GradleVersion.version("2.13")) {
101-
// ProgressLogger(-Factory) classes are part of the public Gradle API
102-
sourceSets.main.groovy.srcDir 'src/main/gradle-2.13-groovy'
99+
// Gradle 2.14+ removed ProgressLogger(-Factory) classes from the public APIs
100+
// Use logging dependency instead
103101

104-
dependencies {
105-
compile 'ru.vyarus:gradle-animalsniffer-plugin:1.0.1' // last version compatible with Gradle 2.13
106-
}
107-
} else {
108-
// Gradle 2.14+ removed ProgressLogger(-Factory) classes from the public APIs
109-
// Use logging dependency instead
110-
sourceSets.main.groovy.srcDir 'src/main/gradle-2.14-groovy'
111-
112-
dependencies {
113-
compileOnly "org.gradle:gradle-logging:${GradleVersion.current().getVersion()}"
114-
compile 'ru.vyarus:gradle-animalsniffer-plugin:1.2.0' // Gradle 2.14 requires a version > 1.0.1
115-
}
102+
dependencies {
103+
compileOnly "org.gradle:gradle-logging:${GradleVersion.current().getVersion()}"
104+
compile 'ru.vyarus:gradle-animalsniffer-plugin:1.2.0' // Gradle 2.14 requires a version > 1.0.1
116105
}
117106

118107
/*****************************************************************************

buildSrc/src/main/gradle-2.13-groovy/org/elasticsearch/gradle/ProgressLogger.groovy

Lines changed: 0 additions & 31 deletions
This file was deleted.

buildSrc/src/main/gradle-2.13-groovy/org/elasticsearch/gradle/ProgressLoggerFactoryInjection.groovy

Lines changed: 0 additions & 35 deletions
This file was deleted.

buildSrc/src/main/gradle-2.14-groovy/org/elasticsearch/gradle/ProgressLogger.groovy

Lines changed: 0 additions & 31 deletions
This file was deleted.

buildSrc/src/main/gradle-2.14-groovy/org/elasticsearch/gradle/ProgressLoggerFactoryInjection.groovy

Lines changed: 0 additions & 35 deletions
This file was deleted.

buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingTask.groovy

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import org.apache.tools.ant.BuildException
88
import org.apache.tools.ant.DefaultLogger
99
import org.apache.tools.ant.RuntimeConfigurable
1010
import org.apache.tools.ant.UnknownElement
11-
import org.elasticsearch.gradle.ProgressLoggerFactoryInjection
1211
import org.gradle.api.DefaultTask
1312
import org.gradle.api.file.FileCollection
1413
import org.gradle.api.file.FileTreeElement
@@ -20,9 +19,12 @@ import org.gradle.api.tasks.Optional
2019
import org.gradle.api.tasks.TaskAction
2120
import org.gradle.api.tasks.util.PatternFilterable
2221
import org.gradle.api.tasks.util.PatternSet
22+
import org.gradle.internal.logging.progress.ProgressLoggerFactory
2323
import org.gradle.util.ConfigureUtil
2424

25-
class RandomizedTestingTask extends DefaultTask implements ProgressLoggerFactoryInjection {
25+
import javax.inject.Inject
26+
27+
class RandomizedTestingTask extends DefaultTask {
2628

2729
// TODO: change to "executable" to match gradle test params?
2830
@Optional
@@ -92,6 +94,11 @@ class RandomizedTestingTask extends DefaultTask implements ProgressLoggerFactory
9294
listenersConfig.listeners.add(new TestReportLogger(logger: logger, config: testLoggingConfig))
9395
}
9496

97+
@Inject
98+
ProgressLoggerFactory getProgressLoggerFactory() {
99+
throw new UnsupportedOperationException()
100+
}
101+
95102
void jvmArgs(Iterable<String> arguments) {
96103
jvmArgs.addAll(arguments)
97104
}

buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/TestProgressLogger.groovy

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ import com.carrotsearch.ant.tasks.junit4.events.aggregated.AggregatedStartEvent
2525
import com.carrotsearch.ant.tasks.junit4.events.aggregated.AggregatedSuiteResultEvent
2626
import com.carrotsearch.ant.tasks.junit4.events.aggregated.AggregatedTestResultEvent
2727
import com.carrotsearch.ant.tasks.junit4.listeners.AggregatedEventListener
28-
import org.elasticsearch.gradle.ProgressLogger
28+
import org.gradle.internal.logging.progress.ProgressLogger
29+
import org.gradle.internal.logging.progress.ProgressLoggerFactory
2930

3031
import static com.carrotsearch.ant.tasks.junit4.FormattingUtils.formatDurationInSeconds
3132
import static com.carrotsearch.ant.tasks.junit4.events.aggregated.TestStatus.ERROR
@@ -51,6 +52,8 @@ import static java.lang.Math.max
5152
* quick.
5253
*/
5354
class TestProgressLogger implements AggregatedEventListener {
55+
/** Factory to build a progress logger when testing starts */
56+
ProgressLoggerFactory factory
5457
ProgressLogger progressLogger
5558
int totalSuites
5659
int totalSlaves
@@ -74,17 +77,14 @@ class TestProgressLogger implements AggregatedEventListener {
7477
/** Have we finished a whole suite yet? */
7578
volatile boolean suiteFinished = false
7679
/* Note that we probably overuse volatile here but it isn't hurting us and
77-
lets us move things around without worying about breaking things. */
78-
79-
TestProgressLogger(Map args) {
80-
progressLogger = new ProgressLogger(args.factory.newOperation(TestProgressLogger))
81-
progressLogger.setDescription('Randomized test runner')
82-
}
80+
lets us move things around without worrying about breaking things. */
8381

8482
@Subscribe
8583
void onStart(AggregatedStartEvent e) throws IOException {
8684
totalSuites = e.suiteCount
8785
totalSlaves = e.slaveCount
86+
progressLogger = factory.newOperation(TestProgressLogger)
87+
progressLogger.setDescription('Randomized test runner')
8888
progressLogger.started()
8989
progressLogger.progress(
9090
"Starting JUnit4 for ${totalSuites} suites on ${totalSlaves} jvms")

buildSrc/src/main/groovy/org/elasticsearch/gradle/test/RestIntegTestTask.groovy

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,15 @@ import com.carrotsearch.gradle.junit4.RandomizedTestingTask
2222
import org.elasticsearch.gradle.BuildPlugin
2323
import org.gradle.api.DefaultTask
2424
import org.gradle.api.Task
25+
import org.gradle.api.execution.TaskExecutionAdapter
2526
import org.gradle.api.internal.tasks.options.Option
2627
import org.gradle.api.plugins.JavaBasePlugin
2728
import org.gradle.api.tasks.Input
28-
import org.gradle.util.ConfigureUtil
29+
import org.gradle.api.tasks.TaskState
30+
31+
import java.nio.charset.StandardCharsets
32+
import java.nio.file.Files
33+
import java.util.stream.Stream
2934

3035
/**
3136
* A wrapper task around setting up a cluster and running rest tests.
@@ -71,6 +76,24 @@ public class RestIntegTestTask extends DefaultTask {
7176
// both as separate sysprops
7277
runner.systemProperty('tests.cluster', "${-> nodes[0].transportUri()}")
7378

79+
// dump errors and warnings from cluster log on failure
80+
TaskExecutionAdapter logDumpListener = new TaskExecutionAdapter() {
81+
@Override
82+
void afterExecute(Task task, TaskState state) {
83+
if (state.failure != null) {
84+
for (NodeInfo nodeInfo : nodes) {
85+
printLogExcerpt(nodeInfo)
86+
}
87+
}
88+
}
89+
}
90+
runner.doFirst {
91+
project.gradle.addListener(logDumpListener)
92+
}
93+
runner.doLast {
94+
project.gradle.removeListener(logDumpListener)
95+
}
96+
7497
// copy the rest spec/tests into the test resources
7598
RestSpecHack.configureDependencies(project)
7699
project.afterEvaluate {
@@ -126,4 +149,42 @@ public class RestIntegTestTask extends DefaultTask {
126149
public Task mustRunAfter(Object... tasks) {
127150
clusterInit.mustRunAfter(tasks)
128151
}
152+
153+
/** Print out an excerpt of the log from the given node. */
154+
protected static void printLogExcerpt(NodeInfo nodeInfo) {
155+
File logFile = new File(nodeInfo.homeDir, "logs/${nodeInfo.clusterName}.log")
156+
println("\nCluster ${nodeInfo.clusterName} - node ${nodeInfo.nodeNum} log excerpt:")
157+
println("(full log at ${logFile})")
158+
println('-----------------------------------------')
159+
Stream<String> stream = Files.lines(logFile.toPath(), StandardCharsets.UTF_8)
160+
try {
161+
boolean inStartup = true
162+
boolean inExcerpt = false
163+
int linesSkipped = 0
164+
for (String line : stream) {
165+
if (line.startsWith("[")) {
166+
inExcerpt = false // clear with the next log message
167+
}
168+
if (line =~ /(\[WARN\])|(\[ERROR\])/) {
169+
inExcerpt = true // show warnings and errors
170+
}
171+
if (inStartup || inExcerpt) {
172+
if (linesSkipped != 0) {
173+
println("... SKIPPED ${linesSkipped} LINES ...")
174+
}
175+
println(line)
176+
linesSkipped = 0
177+
} else {
178+
++linesSkipped
179+
}
180+
if (line =~ /recovered \[\d+\] indices into cluster_state/) {
181+
inStartup = false
182+
}
183+
}
184+
} finally {
185+
stream.close()
186+
}
187+
println('=========================================')
188+
189+
}
129190
}

buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/TapLoggerOutputStream.groovy

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,9 @@
1919
package org.elasticsearch.gradle.vagrant
2020

2121
import com.carrotsearch.gradle.junit4.LoggingOutputStream
22-
import groovy.transform.PackageScope
23-
import org.elasticsearch.gradle.ProgressLogger
2422
import org.gradle.api.GradleScriptException
2523
import org.gradle.api.logging.Logger
24+
import org.gradle.internal.logging.progress.ProgressLogger
2625

2726
import java.util.regex.Matcher
2827

@@ -48,7 +47,7 @@ public class TapLoggerOutputStream extends LoggingOutputStream {
4847

4948
TapLoggerOutputStream(Map args) {
5049
logger = args.logger
51-
progressLogger = new ProgressLogger(args.factory.newOperation(VagrantLoggerOutputStream))
50+
progressLogger = args.factory.newOperation(VagrantLoggerOutputStream)
5251
progressLogger.setDescription("TAP output for `${args.command}`")
5352
}
5453

buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/VagrantCommandTask.groovy

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,17 @@
1919
package org.elasticsearch.gradle.vagrant
2020

2121
import org.apache.commons.io.output.TeeOutputStream
22-
import org.elasticsearch.gradle.ProgressLoggerFactoryInjection
2322
import org.elasticsearch.gradle.LoggedExec
2423
import org.gradle.api.tasks.Input
24+
import org.gradle.internal.logging.progress.ProgressLoggerFactory
25+
26+
import javax.inject.Inject
2527

2628
/**
2729
* Runs a vagrant command. Pretty much like Exec task but with a nicer output
2830
* formatter and defaults to `vagrant` as first part of commandLine.
2931
*/
30-
public class VagrantCommandTask extends LoggedExec implements ProgressLoggerFactoryInjection {
32+
public class VagrantCommandTask extends LoggedExec {
3133

3234
@Input
3335
String boxName
@@ -47,6 +49,11 @@ public class VagrantCommandTask extends LoggedExec implements ProgressLoggerFact
4749
}
4850
}
4951

52+
@Inject
53+
ProgressLoggerFactory getProgressLoggerFactory() {
54+
throw new UnsupportedOperationException()
55+
}
56+
5057
protected OutputStream createLoggerOutputStream() {
5158
return new VagrantLoggerOutputStream(
5259
command: commandLine.join(' '),

0 commit comments

Comments
 (0)