Update to forbidden-apis 1.4.1

Closes #5492
This commit is contained in:
Robert Muir 2014-03-22 14:43:28 -04:00
parent 699044bce9
commit 5babf59813
4 changed files with 20 additions and 20 deletions

View File

@ -1022,7 +1022,7 @@
<plugin>
<groupId>de.thetaphi</groupId>
<artifactId>forbiddenapis</artifactId>
<version>1.4</version>
<version>1.4.1</version>
<executions>
<execution>

View File

@ -38,6 +38,7 @@ import org.elasticsearch.node.Node;
import org.elasticsearch.search.aggregations.AggregationBuilders;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import static org.elasticsearch.client.Requests.createIndexRequest;
@ -266,9 +267,9 @@ public class TermsAggregationSearchBenchmark {
stats.add(termsStats("terms_stats_agg_sm_l_dv", Method.AGGREGATION, "sm_value_dv", "l_value_dv", null));
System.out.println("------------------ SUMMARY -------------------------------");
System.out.format("%25s%10s%10s\n", "name", "took", "millis");
System.out.format(Locale.ENGLISH, "%25s%10s%10s\n", "name", "took", "millis");
for (StatsResult stat : stats) {
System.out.format("%25s%10s%10d\n", stat.name, TimeValue.timeValueMillis(stat.took), (stat.took / QUERY_COUNT));
System.out.format(Locale.ENGLISH, "%25s%10s%10d\n", stat.name, TimeValue.timeValueMillis(stat.took), (stat.took / QUERY_COUNT));
}
System.out.println("------------------ SUMMARY -------------------------------");

View File

@ -31,6 +31,8 @@ import org.elasticsearch.node.Node;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.sort.SortOrder;
import java.util.Locale;
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS;
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS;
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
@ -78,7 +80,7 @@ public class ScrollSearchBenchmark {
}
int indexedDocs = counter - 1;
if (indexedDocs % 100000 == 0) {
System.out.printf("--> Indexed %d so far\n", indexedDocs);
System.out.printf(Locale.ENGLISH, "--> Indexed %d so far\n", indexedDocs);
}
bulkRequestBuilder.get();
}
@ -91,7 +93,7 @@ public class ScrollSearchBenchmark {
}
client.admin().indices().prepareRefresh(indexName).get();
System.out.printf("--> Number of docs in index: %d\n", client.prepareCount().get().getCount());
System.out.printf(Locale.ENGLISH, "--> Number of docs in index: %d\n", client.prepareCount().get().getCount());
Long counter = numDocs;
SearchResponse searchResponse = client.prepareSearch(indexName)
@ -100,16 +102,16 @@ public class ScrollSearchBenchmark {
.setScroll("10m").get();
if (searchResponse.getHits().getTotalHits() != numDocs) {
System.err.printf("Expected total hits [%d] but got [%d]\n", numDocs, searchResponse.getHits().getTotalHits());
System.err.printf(Locale.ENGLISH, "Expected total hits [%d] but got [%d]\n", numDocs, searchResponse.getHits().getTotalHits());
}
if (searchResponse.getHits().hits().length != requestSize) {
System.err.printf("Expected hits length [%d] but got [%d]\n", requestSize, searchResponse.getHits().hits().length);
System.err.printf(Locale.ENGLISH, "Expected hits length [%d] but got [%d]\n", requestSize, searchResponse.getHits().hits().length);
}
for (SearchHit hit : searchResponse.getHits()) {
if (!hit.sortValues()[0].equals(counter--)) {
System.err.printf("Expected sort value [%d] but got [%s]\n", counter + 1, hit.sortValues()[0]);
System.err.printf(Locale.ENGLISH, "Expected sort value [%d] but got [%s]\n", counter + 1, hit.sortValues()[0]);
}
}
String scrollId = searchResponse.getScrollId();
@ -121,30 +123,30 @@ public class ScrollSearchBenchmark {
sumTimeSpent += (System.currentTimeMillis() - timeSpent);
scrollRequestCounter++;
if (searchResponse.getHits().getTotalHits() != numDocs) {
System.err.printf("Expected total hits [%d] but got [%d]\n", numDocs, searchResponse.getHits().getTotalHits());
System.err.printf(Locale.ENGLISH, "Expected total hits [%d] but got [%d]\n", numDocs, searchResponse.getHits().getTotalHits());
}
if (scrollRequestCounter % 20 == 0) {
long avgTimeSpent = sumTimeSpent / 20;
JvmStats.Mem mem = JvmStats.jvmStats().mem();
System.out.printf("Cursor location=%d, avg time spent=%d ms\n", (requestSize * scrollRequestCounter), (avgTimeSpent));
System.out.printf("heap max=%s, used=%s, percentage=%d\n", mem.getHeapMax(), mem.getHeapUsed(), mem.getHeapUsedPrecent());
System.out.printf(Locale.ENGLISH, "Cursor location=%d, avg time spent=%d ms\n", (requestSize * scrollRequestCounter), (avgTimeSpent));
System.out.printf(Locale.ENGLISH, "heap max=%s, used=%s, percentage=%d\n", mem.getHeapMax(), mem.getHeapUsed(), mem.getHeapUsedPrecent());
sumTimeSpent = 0;
}
if (searchResponse.getHits().hits().length == 0) {
break;
}
if (searchResponse.getHits().hits().length != requestSize) {
System.err.printf("Expected hits length [%d] but got [%d]\n", requestSize, searchResponse.getHits().hits().length);
System.err.printf(Locale.ENGLISH, "Expected hits length [%d] but got [%d]\n", requestSize, searchResponse.getHits().hits().length);
}
for (SearchHit hit : searchResponse.getHits()) {
if (!hit.sortValues()[0].equals(counter--)) {
System.err.printf("Expected sort value [%d] but got [%s]\n", counter + 1, hit.sortValues()[0]);
System.err.printf(Locale.ENGLISH, "Expected sort value [%d] but got [%s]\n", counter + 1, hit.sortValues()[0]);
}
}
scrollId = searchResponse.getScrollId();
}
if (counter != 0) {
System.err.printf("Counter should be 0 because scroll has been consumed\n");
System.err.printf(Locale.ENGLISH, "Counter should be 0 because scroll has been consumed\n");
}
for (Node node : nodes) {

View File

@ -22,10 +22,7 @@ import com.google.common.base.Preconditions;
import com.google.common.collect.AbstractIterator;
import com.google.common.collect.Lists;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Iterator;
import java.util.List;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
/**
@ -366,10 +363,10 @@ public class GroupTree implements Iterable<GroupTree.Group> {
public void print(int depth) {
for (int i = 0; i < depth; i++) {
System.out.printf("| ");
System.out.print("| ");
}
int imbalance = Math.abs((left != null ? left.depth : 1) - (right != null ? right.depth : 1));
System.out.printf("%s%s, %d, %d, %d\n", (imbalance > 1 ? "* " : "") + (right != null && leaf.compareTo(right.first()) != 0 ? "+ " : ""), leaf, size, count, this.depth);
System.out.printf(Locale.ENGLISH, "%s%s, %d, %d, %d\n", (imbalance > 1 ? "* " : "") + (right != null && leaf.compareTo(right.first()) != 0 ? "+ " : ""), leaf, size, count, this.depth);
if (left != null) {
left.print(depth + 1);
right.print(depth + 1);