Skip to content

Commit

Permalink
Update to forbidden-apis 1.4.1
Browse files Browse the repository at this point in the history
Closes #5492
  • Loading branch information
Robert Muir committed Mar 22, 2014
1 parent 699044b commit 5babf59
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -1022,7 +1022,7 @@
<plugin>
<groupId>de.thetaphi</groupId>
<artifactId>forbiddenapis</artifactId>
<version>1.4</version>
<version>1.4.1</version>

<executions>
<execution>
Expand Down
Expand Up @@ -38,6 +38,7 @@
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;
Expand Down Expand Up @@ -266,9 +267,9 @@ public static void main(String[] args) throws Exception {
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 -------------------------------");

Expand Down
Expand Up @@ -31,6 +31,8 @@
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;
Expand Down Expand Up @@ -78,7 +80,7 @@ public static void main(String[] args) {
}
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();
}
Expand All @@ -91,7 +93,7 @@ public static void main(String[] args) {
}

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)
Expand All @@ -100,16 +102,16 @@ public static void main(String[] args) {
.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();
Expand All @@ -121,30 +123,30 @@ public static void main(String[] args) {
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) {
Expand Down
Expand Up @@ -22,10 +22,7 @@
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;

/**
Expand Down Expand Up @@ -366,10 +363,10 @@ public void checkBalance() {

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);
Expand Down

0 comments on commit 5babf59

Please sign in to comment.