SOLR-8937: bin/post (SimplePostTool) should tell JDK to stream stdin instead of fully buffer

This commit is contained in:
David Smiley 2016-04-14 13:51:57 -04:00
parent b36a6ecbe4
commit 037a40316c
2 changed files with 7 additions and 1 deletions

View File

@ -130,6 +130,8 @@ Optimizations
produced. This resulted in up to 3x throughput when small filter creation was the bottleneck, produced. This resulted in up to 3x throughput when small filter creation was the bottleneck,
as well as orders of magnitude less garbage. (Jeff Wartes, yonik) as well as orders of magnitude less garbage. (Jeff Wartes, yonik)
* SOLR-8937: bin/post (SimplePostTool) now streams the standard input instead of buffering fully.
(David Smiley)
Other Changes Other Changes
---------------------- ----------------------

View File

@ -890,7 +890,11 @@ public class SimplePostTool {
String encoding = DatatypeConverter.printBase64Binary(url.getUserInfo().getBytes(StandardCharsets.US_ASCII)); String encoding = DatatypeConverter.printBase64Binary(url.getUserInfo().getBytes(StandardCharsets.US_ASCII));
urlc.setRequestProperty("Authorization", "Basic " + encoding); urlc.setRequestProperty("Authorization", "Basic " + encoding);
} }
if (null != length) urlc.setFixedLengthStreamingMode(length); if (null != length) {
urlc.setFixedLengthStreamingMode(length);
} else {
urlc.setChunkedStreamingMode(-1);//use JDK default chunkLen, 4k in Java 8.
}
urlc.connect(); urlc.connect();
} catch (IOException e) { } catch (IOException e) {
fatal("Connection error (is Solr running at " + solrUrl + " ?): " + e); fatal("Connection error (is Solr running at " + solrUrl + " ?): " + e);