mirror of https://github.com/apache/lucene.git
SOLR-3131: "details" command fails when a replication is forced with a "fetchIndex" command on a non-slave server
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1245231 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
851f4f647b
commit
efa20a5149
|
@ -296,7 +296,9 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
|
|||
} catch (Exception e) {
|
||||
SolrException.log(LOG, "SnapPull failed ", e);
|
||||
} finally {
|
||||
tempSnapPuller = snapPuller;
|
||||
if (snapPuller != null) {
|
||||
tempSnapPuller = snapPuller;
|
||||
}
|
||||
snapPullLock.unlock();
|
||||
}
|
||||
return false;
|
||||
|
@ -444,6 +446,7 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
|
|||
}
|
||||
|
||||
boolean isPollingDisabled() {
|
||||
if (snapPuller == null) return true;
|
||||
return snapPuller.isPollingDisabled();
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ import org.apache.lucene.search.MatchAllDocsQuery;
|
|||
import org.apache.lucene.search.TopDocs;
|
||||
import org.apache.lucene.store.Directory;
|
||||
import org.apache.lucene.store.SimpleFSDirectory;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.apache.solr.SolrTestCaseJ4;
|
||||
import org.apache.solr.TestDistributedSearch;
|
||||
import org.apache.solr.client.solrj.SolrServer;
|
||||
|
@ -531,6 +530,29 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
|
|||
String cmp = TestDistributedSearch.compare(masterQueryResult, slaveQueryResult, 0, null);
|
||||
assertEquals(null, cmp);
|
||||
|
||||
System.out.println("replicate slave to master");
|
||||
// snappull from the slave to the master
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
index(slaveClient, "id", i, "name", "name = " + i);
|
||||
|
||||
slaveClient.commit();
|
||||
|
||||
masterUrl = "http://localhost:" + masterJetty.getLocalPort() + "/solr/replication?command=fetchindex&masterUrl=";
|
||||
masterUrl += "http://localhost:" + slaveJetty.getLocalPort() + "/solr/replication";
|
||||
url = new URL(masterUrl);
|
||||
stream = url.openStream();
|
||||
try {
|
||||
stream.close();
|
||||
} catch (IOException e) {
|
||||
//e.printStackTrace();
|
||||
}
|
||||
|
||||
// get the details
|
||||
// just ensures we don't get an exception
|
||||
NamedList<Object> details = getDetails(masterClient);
|
||||
//System.out.println("details:" + details);
|
||||
|
||||
// NOTE: at this point, the slave is not polling any more
|
||||
// restore it.
|
||||
slave.copyConfigFile(CONF_DIR + "solrconfig-slave.xml", "solrconfig.xml");
|
||||
|
|
Loading…
Reference in New Issue