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) {
|
} catch (Exception e) {
|
||||||
SolrException.log(LOG, "SnapPull failed ", e);
|
SolrException.log(LOG, "SnapPull failed ", e);
|
||||||
} finally {
|
} finally {
|
||||||
tempSnapPuller = snapPuller;
|
if (snapPuller != null) {
|
||||||
|
tempSnapPuller = snapPuller;
|
||||||
|
}
|
||||||
snapPullLock.unlock();
|
snapPullLock.unlock();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -444,6 +446,7 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isPollingDisabled() {
|
boolean isPollingDisabled() {
|
||||||
|
if (snapPuller == null) return true;
|
||||||
return snapPuller.isPollingDisabled();
|
return snapPuller.isPollingDisabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ import java.io.Writer;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.lucene.index.IndexReader;
|
import org.apache.lucene.index.IndexReader;
|
||||||
import org.apache.lucene.search.IndexSearcher;
|
import org.apache.lucene.search.IndexSearcher;
|
||||||
|
@ -35,7 +35,6 @@ import org.apache.lucene.search.MatchAllDocsQuery;
|
||||||
import org.apache.lucene.search.TopDocs;
|
import org.apache.lucene.search.TopDocs;
|
||||||
import org.apache.lucene.store.Directory;
|
import org.apache.lucene.store.Directory;
|
||||||
import org.apache.lucene.store.SimpleFSDirectory;
|
import org.apache.lucene.store.SimpleFSDirectory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.apache.solr.SolrTestCaseJ4;
|
import org.apache.solr.SolrTestCaseJ4;
|
||||||
import org.apache.solr.TestDistributedSearch;
|
import org.apache.solr.TestDistributedSearch;
|
||||||
import org.apache.solr.client.solrj.SolrServer;
|
import org.apache.solr.client.solrj.SolrServer;
|
||||||
|
@ -522,7 +521,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
//e.printStackTrace();
|
//e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
//get docs from slave and check if number is equal to master
|
//get docs from slave and check if number is equal to master
|
||||||
NamedList slaveQueryRsp = rQuery(nDocs, "*:*", slaveClient);
|
NamedList slaveQueryRsp = rQuery(nDocs, "*:*", slaveClient);
|
||||||
SolrDocumentList slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response");
|
SolrDocumentList slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response");
|
||||||
|
@ -531,6 +530,29 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
|
||||||
String cmp = TestDistributedSearch.compare(masterQueryResult, slaveQueryResult, 0, null);
|
String cmp = TestDistributedSearch.compare(masterQueryResult, slaveQueryResult, 0, null);
|
||||||
assertEquals(null, cmp);
|
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
|
// NOTE: at this point, the slave is not polling any more
|
||||||
// restore it.
|
// restore it.
|
||||||
slave.copyConfigFile(CONF_DIR + "solrconfig-slave.xml", "solrconfig.xml");
|
slave.copyConfigFile(CONF_DIR + "solrconfig-slave.xml", "solrconfig.xml");
|
||||||
|
|
Loading…
Reference in New Issue