Merge branch 'branch_6x' of https://git-wip-us.apache.org/repos/asf/lucene-solr into branch_6x

This commit is contained in:
Karl Wright 2016-05-03 15:30:20 -04:00
commit 7bf176313b
3 changed files with 36 additions and 1 deletions

View File

@ -144,6 +144,8 @@ Bug Fixes
* SOLR-9028: Fixed some test related bugs preventing SSL + ClientAuth from ever being tested (hossman)
* SOLR-9059: NPE in SolrClientCache following collection reload (Joel Bernstein, Ryan Yacyshyn)
Optimizations
----------------------
* SOLR-8722: Don't force a full ZkStateReader refresh on every Overseer operation.

View File

@ -30,6 +30,8 @@ import org.apache.solr.client.solrj.io.stream.ExceptionStream;
import org.apache.solr.client.solrj.io.stream.SolrStream;
import org.apache.solr.client.solrj.io.stream.TupleStream;
import org.apache.solr.cloud.AbstractFullDistribZkTestBase;
import org.apache.solr.common.cloud.DocCollection;
import org.apache.solr.common.cloud.Replica;
import org.apache.solr.common.params.CommonParams;
import org.junit.After;
import org.junit.AfterClass;
@ -424,6 +426,36 @@ public class TestSQLHandler extends AbstractFullDistribZkTestBase {
assert(tuple.getLong("myInt") == 7);
assert(tuple.get("myString").equals("a"));
//Test after reload SOLR-9059//
Replica leader = getShardLeader("collection1", "shard1", 30 /* timeout secs */);
// reload collection and wait to see the core report it has been reloaded
boolean wasReloaded = reloadCollection(leader, "collection1");
assertTrue(wasReloaded);
params = new HashMap();
params.put(CommonParams.QT, "/sql");
params.put("stmt", "select id as myId, field_i as myInt, str_s as myString from collection1 where text='XXXX' AND id='(1 2 3)' order by field_i desc");
solrStream = new SolrStream(jetty.url, params);
tuples = getTuples(solrStream);
assert(tuples.size() == 3);
tuple = tuples.get(0);
assert(tuple.getLong("myId") == 3);
assert(tuple.getLong("myInt") == 20);
assert(tuple.get("myString").equals("a"));
tuple = tuples.get(1);
assert(tuple.getLong("myId") == 2);
assert(tuple.getLong("myInt") == 8);
assert(tuple.get("myString").equals("b"));
tuple = tuples.get(2);
assert(tuple.getLong("myId") == 1);
assert(tuple.getLong("myInt") == 7);
assert(tuple.get("myString").equals("a"));
} finally {
delete();

View File

@ -66,7 +66,7 @@ public class SolrClientCache implements Serializable {
return client;
}
public void close() {
public synchronized void close() {
for(Map.Entry<String, SolrClient> entry : solrClients.entrySet()) {
try {
entry.getValue().close();
@ -74,5 +74,6 @@ public class SolrClientCache implements Serializable {
log.error("Error closing SolrClient for " + entry.getKey(), e);
}
}
solrClients.clear();
}
}