From 41139c6b15bac39f8decfb2a5cb90462e5f9a3f5 Mon Sep 17 00:00:00 2001 From: Zachary Tong Date: Fri, 18 Dec 2015 14:59:16 -0500 Subject: [PATCH 1/3] Ensure profile results are immutable after serialization --- .../search/profile/InternalProfileShardResults.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/org/elasticsearch/search/profile/InternalProfileShardResults.java b/core/src/main/java/org/elasticsearch/search/profile/InternalProfileShardResults.java index e6052ff5095..e55a27be86e 100644 --- a/core/src/main/java/org/elasticsearch/search/profile/InternalProfileShardResults.java +++ b/core/src/main/java/org/elasticsearch/search/profile/InternalProfileShardResults.java @@ -62,8 +62,9 @@ public final class InternalProfileShardResults implements Writeable> getShardResults() { From 4700cb94097945d3a0087c6746746d662ea27f3e Mon Sep 17 00:00:00 2001 From: Zachary Tong Date: Fri, 18 Dec 2015 15:16:51 -0500 Subject: [PATCH 2/3] [TEST] Check length of profiled results in tests --- .../elasticsearch/search/profile/QueryProfilerIT.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/src/test/java/org/elasticsearch/search/profile/QueryProfilerIT.java b/core/src/test/java/org/elasticsearch/search/profile/QueryProfilerIT.java index bb33364a751..22772ff4a15 100644 --- a/core/src/test/java/org/elasticsearch/search/profile/QueryProfilerIT.java +++ b/core/src/test/java/org/elasticsearch/search/profile/QueryProfilerIT.java @@ -73,6 +73,7 @@ public class QueryProfilerIT extends ESIntegTestCase { .execute().actionGet(); assertNotNull("Profile response element should not be null", resp.getProfileResults()); + assertThat("Profile response should not be an empty array", resp.getProfileResults().size(), not(0)); for (Map.Entry> shard : resp.getProfileResults().entrySet()) { for (ProfileShardResult searchProfiles : shard.getValue()) { for (ProfileResult result : searchProfiles.getQueryResults()) { @@ -195,6 +196,7 @@ public class QueryProfilerIT extends ESIntegTestCase { Map> p = resp.getProfileResults(); assertNotNull(p); + assertThat("Profile response should not be an empty array", resp.getProfileResults().size(), not(0)); for (Map.Entry> shardResult : resp.getProfileResults().entrySet()) { for (ProfileShardResult searchProfiles : shardResult.getValue()) { @@ -240,6 +242,7 @@ public class QueryProfilerIT extends ESIntegTestCase { Map> p = resp.getProfileResults(); assertNotNull(p); + assertThat("Profile response should not be an empty array", resp.getProfileResults().size(), not(0)); for (Map.Entry> shardResult : resp.getProfileResults().entrySet()) { for (ProfileShardResult searchProfiles : shardResult.getValue()) { @@ -307,6 +310,7 @@ public class QueryProfilerIT extends ESIntegTestCase { .execute().actionGet(); assertNotNull("Profile response element should not be null", resp.getProfileResults()); + assertThat("Profile response should not be an empty array", resp.getProfileResults().size(), not(0)); for (Map.Entry> shardResult : resp.getProfileResults().entrySet()) { for (ProfileShardResult searchProfiles : shardResult.getValue()) { @@ -358,6 +362,7 @@ public class QueryProfilerIT extends ESIntegTestCase { .execute().actionGet(); assertNotNull("Profile response element should not be null", resp.getProfileResults()); + assertThat("Profile response should not be an empty array", resp.getProfileResults().size(), not(0)); for (Map.Entry> shardResult : resp.getProfileResults().entrySet()) { for (ProfileShardResult searchProfiles : shardResult.getValue()) { @@ -404,6 +409,7 @@ public class QueryProfilerIT extends ESIntegTestCase { .execute().actionGet(); assertNotNull("Profile response element should not be null", resp.getProfileResults()); + assertThat("Profile response should not be an empty array", resp.getProfileResults().size(), not(0)); for (Map.Entry> shardResult : resp.getProfileResults().entrySet()) { for (ProfileShardResult searchProfiles : shardResult.getValue()) { @@ -450,6 +456,7 @@ public class QueryProfilerIT extends ESIntegTestCase { .execute().actionGet(); assertNotNull("Profile response element should not be null", resp.getProfileResults()); + assertThat("Profile response should not be an empty array", resp.getProfileResults().size(), not(0)); for (Map.Entry> shardResult : resp.getProfileResults().entrySet()) { for (ProfileShardResult searchProfiles : shardResult.getValue()) { @@ -495,6 +502,7 @@ public class QueryProfilerIT extends ESIntegTestCase { .execute().actionGet(); assertNotNull("Profile response element should not be null", resp.getProfileResults()); + assertThat("Profile response should not be an empty array", resp.getProfileResults().size(), not(0)); for (Map.Entry> shardResult : resp.getProfileResults().entrySet()) { for (ProfileShardResult searchProfiles : shardResult.getValue()) { @@ -549,6 +557,7 @@ public class QueryProfilerIT extends ESIntegTestCase { } assertNotNull("Profile response element should not be null", resp.getProfileResults()); + assertThat("Profile response should not be an empty array", resp.getProfileResults().size(), not(0)); for (Map.Entry> shardResult : resp.getProfileResults().entrySet()) { for (ProfileShardResult searchProfiles : shardResult.getValue()) { From d0a10b337ed414eaf8ef3c60452d1a2f92be6ae8 Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Fri, 18 Dec 2015 13:16:37 -0800 Subject: [PATCH 3/3] Fix silly typo in variable name... --- .../src/main/groovy/org/elasticsearch/gradle/AntTask.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/AntTask.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/AntTask.groovy index b713c00ed8d..f86846ac6dd 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/AntTask.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/AntTask.groovy @@ -52,7 +52,7 @@ public class AntTask extends DefaultTask { // remove existing loggers, we add our own List toRemove = new ArrayList<>(); for (BuildListener listener : ant.project.getBuildListeners()) { - if (l instanceof BuildLogger) { + if (listener instanceof BuildLogger) { toRemove.add(listener); } }