SOLR-14537: Fix gradle precommit failures

This commit is contained in:
Ishan Chattopadhyaya 2020-07-04 14:31:23 +05:30
parent 05324e7b18
commit 35b5eea147
3 changed files with 11 additions and 15 deletions

View File

@ -95,16 +95,16 @@ class ExportBuffers {
barrier = new CyclicBarrier(2, () -> swapBuffers());
filler = () -> {
try {
log.debug("--- filler start {}", Thread.currentThread());
// log.debug("--- filler start {}", Thread.currentThread());
SortDoc sortDoc = exportWriter.getSortDoc(searcher, sort.getSort());
Buffer buffer = getFillBuffer();
SortQueue queue = new SortQueue(queueSize, sortDoc);
long lastOutputCounter = 0;
for (int count = 0; count < totalHits; ) {
log.debug("--- filler fillOutDocs in {}", fillBuffer);
// log.debug("--- filler fillOutDocs in {}", fillBuffer);
exportWriter.fillOutDocs(leaves, sortDoc, queue, buffer);
count += (buffer.outDocsIndex + 1);
log.debug("--- filler count={}, exchange buffer from {}", count, buffer);
// log.debug("--- filler count={}, exchange buffer from {}", count, buffer);
Timer.Context timerContext = getFillerWaitTimer().time();
try {
exchangeBuffers();
@ -116,10 +116,10 @@ class ExportBuffers {
lastOutputCounter = outputCounter.longValue();
flushOutput();
}
log.debug("--- filler got empty buffer {}", buffer);
// log.debug("--- filler got empty buffer {}", buffer);
}
buffer.outDocsIndex = Buffer.NO_MORE_DOCS;
log.debug("--- filler final exchange buffer from {}", buffer);
// log.debug("--- filler final exchange buffer from {}", buffer);
Timer.Context timerContext = getFillerWaitTimer().time();
try {
exchangeBuffers();
@ -127,7 +127,7 @@ class ExportBuffers {
timerContext.stop();
}
buffer = getFillBuffer();
log.debug("--- filler final got buffer {}", buffer);
// log.debug("--- filler final got buffer {}", buffer);
} catch (Throwable e) {
log.error("filler", e);
error(e);
@ -140,7 +140,7 @@ class ExportBuffers {
}
public void exchangeBuffers() throws Exception {
log.debug("---- wait exchangeBuffers from {}", Thread.currentThread());
// log.debug("---- wait exchangeBuffers from {}", Thread.currentThread());
barrier.await(EXCHANGE_TIMEOUT_SECONDS, TimeUnit.SECONDS);
}

View File

@ -196,7 +196,7 @@ public class ExportWriterStream extends TupleStream implements Expressible {
res = Tuple.EOF();
} else {
pos = buffer.outDocsIndex;
log.debug("--- ews new pos=" + pos);
log.debug("--- ews new pos={}", pos);
}
}
if (pos < 0) {

View File

@ -729,6 +729,7 @@ public class TestExportWriter extends SolrTestCaseJ4 {
assertU(commit());
}
@SuppressWarnings("unchecked")
@Test
public void testExpr() throws Exception {
assertU(delQ("*:*"));
@ -742,9 +743,7 @@ public class TestExportWriter extends SolrTestCaseJ4 {
);
req = req("q", "*:*", "qt", "/export", "fl", "id,sortabledv_udvas", "sort", "sortabledv_udvas asc", "expr", "unique(input(),over=\"sortabledv_udvas\")");
String rsp = h.query(req);
@SuppressWarnings({"unchecked"})
Map<String, Object> rspMap = mapper.readValue(rsp, HashMap.class);
@SuppressWarnings({"unchecked"})
List<Map<String, Object>> docs = (List<Map<String, Object>>) Utils.getObjectByPath(rspMap, false, "/response/docs");
assertNotNull("missing document results: " + rspMap, docs);
assertEquals("wrong number of unique docs", 100, docs.size());
@ -785,6 +784,7 @@ public class TestExportWriter extends SolrTestCaseJ4 {
assertTrue("wrong exception message", doc.get(StreamParams.EXCEPTION).toString().contains("Must have useDocValuesAsStored='true'"));
}
@SuppressWarnings("rawtypes")
private void validateSort(int numDocs) throws Exception {
// 10 fields
List<String> fieldNames = new ArrayList<>(Arrays.asList("floatdv", "intdv", "stringdv", "longdv", "doubledv",
@ -806,22 +806,18 @@ public class TestExportWriter extends SolrTestCaseJ4 {
String fieldsStr = String.join(",", fieldStrs); // fl : field1, field2
String resp = h.query(req("q", "*:*", "qt", "/export", "fl", "id," + fieldsStr, "sort", sortStr));
@SuppressWarnings({"rawtypes"})
HashMap respMap = mapper.readValue(resp, HashMap.class);
@SuppressWarnings({"rawtypes"})
List docs = (ArrayList) ((HashMap) respMap.get("response")).get("docs");
SolrQueryRequest selectReq = req("q", "*:*", "qt", "/select", "fl", "id," + fieldsStr, "sort", sortStr, "rows", Integer.toString(numDocs), "wt", "json");
String response = h.query(selectReq);
@SuppressWarnings({"rawtypes"})
Map rsp = (Map)Utils.fromJSONString(response);
@SuppressWarnings({"rawtypes"})
List doclist = (List)(((Map)rsp.get("response")).get("docs"));
assert docs.size() == numDocs;
for (int i = 0; i < docs.size() - 1; i++) { // docs..
assertEquals("Position:" + i + " has different id value" , ((LinkedHashMap)doclist.get(i)).get("id"), String.valueOf(((HashMap) docs.get(i)).get("id")));
assertEquals("Position:" + i + " has different id value" , ((LinkedHashMap)doclist.get(i)).get("id"), String.valueOf(((HashMap<?,?>) docs.get(i)).get("id")));
for (int j = 0; j < fieldSorts.length; j++) { // fields ..
String field = fieldSorts[j].getField();