diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 87490d92921..468e46a4525 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -114,6 +114,9 @@ Optimizations * SOLR-5232: SolrCloud should distribute updates via streaming rather than buffering. (Mark Miller) + +* SOLR-5223: SolrCloud should use the JavaBin binary format for communication by default. + (Mark Miller) Security ---------------------- diff --git a/solr/core/src/java/org/apache/solr/update/StreamingSolrServers.java b/solr/core/src/java/org/apache/solr/update/StreamingSolrServers.java index a2573052813..9c1d2caafd0 100644 --- a/solr/core/src/java/org/apache/solr/update/StreamingSolrServers.java +++ b/solr/core/src/java/org/apache/solr/update/StreamingSolrServers.java @@ -83,7 +83,8 @@ public class StreamingSolrServers { errors.add(error); } }; - + server.setParser(new BinaryResponseParser()); + server.setRequestWriter(new BinaryRequestWriter()); server.setPollQueueTime(0); solrServers.put(url, server); } diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java index f43bb81b310..b6537be818b 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java @@ -44,6 +44,7 @@ import org.apache.solr.client.solrj.SolrServer; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.request.AbstractUpdateRequest; import org.apache.solr.client.solrj.request.IsUpdateRequest; +import org.apache.solr.client.solrj.request.RequestWriter; import org.apache.solr.client.solrj.request.UpdateRequest; import org.apache.solr.client.solrj.util.ClientUtils; import org.apache.solr.common.SolrException; @@ -122,6 +123,8 @@ public class CloudSolrServer extends SolrServer { this.zkHost = zkHost; this.myClient = HttpClientUtil.createClient(null); this.lbServer = new LBHttpSolrServer(myClient); + this.lbServer.setRequestWriter(new BinaryRequestWriter()); + this.lbServer.setParser(new BinaryResponseParser()); this.updatesToLeaders = true; shutdownLBHttpSolrServer = true; } @@ -131,6 +134,8 @@ public class CloudSolrServer extends SolrServer { this.zkHost = zkHost; this.myClient = HttpClientUtil.createClient(null); this.lbServer = new LBHttpSolrServer(myClient); + this.lbServer.setRequestWriter(new BinaryRequestWriter()); + this.lbServer.setParser(new BinaryResponseParser()); this.updatesToLeaders = updatesToLeaders; shutdownLBHttpSolrServer = true; } @@ -175,6 +180,14 @@ public class CloudSolrServer extends SolrServer { public void setParser(ResponseParser processor) { lbServer.setParser(processor); } + + public RequestWriter getRequestWriter() { + return lbServer.getRequestWriter(); + } + + public void setRequestWriter(RequestWriter requestWriter) { + lbServer.setRequestWriter(requestWriter); + } public ZkStateReader getZkStateReader() { return zkStateReader; diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java index 07a2257cf00..c68662ee2f9 100644 --- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java +++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java @@ -606,6 +606,10 @@ public class LBHttpSolrServer extends SolrServer { this.requestWriter = requestWriter; } + public RequestWriter getRequestWriter() { + return requestWriter; + } + @Override protected void finalize() throws Throwable { try {