From 35b5eea147d3acec70485af601b2629518e2bf90 Mon Sep 17 00:00:00 2001 From: Ishan Chattopadhyaya Date: Sat, 4 Jul 2020 14:31:23 +0530 Subject: [PATCH] SOLR-14537: Fix gradle precommit failures --- .../apache/solr/handler/export/ExportBuffers.java | 14 +++++++------- .../solr/handler/export/ExportWriterStream.java | 2 +- .../solr/handler/export/TestExportWriter.java | 10 +++------- 3 files changed, 11 insertions(+), 15 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/handler/export/ExportBuffers.java b/solr/core/src/java/org/apache/solr/handler/export/ExportBuffers.java index 393067a3cc5..c9d8f91b8ba 100644 --- a/solr/core/src/java/org/apache/solr/handler/export/ExportBuffers.java +++ b/solr/core/src/java/org/apache/solr/handler/export/ExportBuffers.java @@ -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); } diff --git a/solr/core/src/java/org/apache/solr/handler/export/ExportWriterStream.java b/solr/core/src/java/org/apache/solr/handler/export/ExportWriterStream.java index 9ec0f4a41a0..f096810f086 100644 --- a/solr/core/src/java/org/apache/solr/handler/export/ExportWriterStream.java +++ b/solr/core/src/java/org/apache/solr/handler/export/ExportWriterStream.java @@ -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) { diff --git a/solr/core/src/test/org/apache/solr/handler/export/TestExportWriter.java b/solr/core/src/test/org/apache/solr/handler/export/TestExportWriter.java index 935a364e7dd..a044d5b320c 100644 --- a/solr/core/src/test/org/apache/solr/handler/export/TestExportWriter.java +++ b/solr/core/src/test/org/apache/solr/handler/export/TestExportWriter.java @@ -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 rspMap = mapper.readValue(rsp, HashMap.class); - @SuppressWarnings({"unchecked"}) List> docs = (List>) 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 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();