You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2016/02/16 19:11:44 UTC
lucene-solr git commit: SOLR-8669: Non binary responses use chunked
encoding because we flush the outputstream early.
Repository: lucene-solr
Updated Branches:
refs/heads/master 44b58ee4f -> 13dda5deb
SOLR-8669: Non binary responses use chunked encoding because we flush the outputstream early.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/13dda5de
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/13dda5de
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/13dda5de
Branch: refs/heads/master
Commit: 13dda5debbb7998faa7b23a29a475963f19c5bc4
Parents: 44b58ee
Author: markrmiller <ma...@apache.org>
Authored: Tue Feb 16 13:11:37 2016 -0500
Committer: markrmiller <ma...@apache.org>
Committed: Tue Feb 16 13:11:37 2016 -0500
----------------------------------------------------------------------
solr/CHANGES.txt | 8 +++++++-
.../solr/response/QueryResponseWriterUtil.java | 15 ++++++++++++++-
.../java/org/apache/solr/servlet/HttpSolrCall.java | 1 -
3 files changed, 21 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/13dda5de/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index e00bf6b..7584f45 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -188,6 +188,9 @@ Optimizations
* SOLR-8532: Optimize GraphQuery when maxDepth is set by not collecting edges at the maxDepth level.
(Kevin Watters via yonik)
+* SOLR-8669: Non binary responses use chunked encoding because we flush the outputstream early.
+ (Mark Miller)
+
Other Changes
----------------------
@@ -533,7 +536,7 @@ Bug Fixes
* SOLR-8578: Successful or not, requests are not always fully consumed by Solrj clients and we
count on HttpClient or the JVM. (Mark Miller)
-
+
Optimizations
----------------------
@@ -544,6 +547,9 @@ Optimizations
* SOLR-7281: Add an overseer action to publish an entire node as 'down'. (Mark Miller, shalin)
+* SOLR-8669: Non binary responses use chunked encoding because we flush the outputstream early.
+ (Mark Miller)
+
Other Changes
----------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/13dda5de/solr/core/src/java/org/apache/solr/response/QueryResponseWriterUtil.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/response/QueryResponseWriterUtil.java b/solr/core/src/java/org/apache/solr/response/QueryResponseWriterUtil.java
index bd56141..6487537 100644
--- a/solr/core/src/java/org/apache/solr/response/QueryResponseWriterUtil.java
+++ b/solr/core/src/java/org/apache/solr/response/QueryResponseWriterUtil.java
@@ -48,7 +48,20 @@ public final class QueryResponseWriterUtil {
BinaryQueryResponseWriter binWriter = (BinaryQueryResponseWriter) responseWriter;
binWriter.write(outputStream, solrRequest, solrResponse);
} else {
- Writer writer = buildWriter(outputStream, ContentStreamBase.getCharsetFromContentType(contentType));
+ OutputStream out = new OutputStream() {
+ @Override
+ public void write(int b) throws IOException {
+ outputStream.write(b);
+ }
+ @Override
+ public void flush() throws IOException {
+ // We don't flush here, which allows us to flush below
+ // and only flush internal buffers, not the response.
+ // If we flush the response early, we trigger chunked encoding.
+ // See SOLR-8669.
+ }
+ };
+ Writer writer = buildWriter(out, ContentStreamBase.getCharsetFromContentType(contentType));
responseWriter.write(writer, solrRequest, solrResponse);
writer.flush();
}
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/13dda5de/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
index 3578cec..fa9d92a 100644
--- a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
+++ b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
@@ -580,7 +580,6 @@ public class HttpSolrCall {
OutputStream os = resp.getOutputStream();
IOUtils.copyLarge(is, os);
- os.flush();
}
} catch (IOException e) {