mirror of https://github.com/apache/lucene.git
SOLR-3809: Fixed config file replication when subdirectories are used
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1384492 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7a51f2aefe
commit
4fdd830ffd
|
@ -155,6 +155,9 @@ Bug Fixes
|
|||
* SOLR-3827: Fix shareSchema=true in solr.xml
|
||||
(Tomás Fernández Löbbe via hossman)
|
||||
|
||||
* SOLR-3809: Fixed config file replication when subdirectories are used
|
||||
(Emmanuel Espina via hossman)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -979,6 +979,14 @@ public class SnapPuller {
|
|||
|
||||
this.file = new File(copy2Dir, saveAs);
|
||||
|
||||
File parentDir = this.file.getParentFile();
|
||||
if( ! parentDir.exists() ){
|
||||
if ( ! parentDir.mkdirs() ) {
|
||||
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
|
||||
"Failed to create (sub)directory for file: " + saveAs);
|
||||
}
|
||||
}
|
||||
|
||||
this.fileOutputStream = new FileOutputStream(file);
|
||||
this.fileChannel = this.fileOutputStream.getChannel();
|
||||
|
||||
|
|
|
@ -41,7 +41,10 @@
|
|||
<requestHandler name="/replication" class="solr.ReplicationHandler">
|
||||
<lst name="master">
|
||||
<str name="replicateAfter">commit</str>
|
||||
<str name="confFiles">schema.xml</str>
|
||||
<!-- we don't really need dummy.xsl, but we want to be sure subdir
|
||||
files replicate (see SOLR-3809)
|
||||
-->
|
||||
<str name="confFiles">schema.xml,xslt/dummy.xsl</str>
|
||||
</lst>
|
||||
</requestHandler>
|
||||
|
||||
|
|
|
@ -411,6 +411,17 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
|
|||
slave.copyConfigFile(slave.getSolrConfigFile(), "solrconfig.xml");
|
||||
|
||||
slaveJetty.stop();
|
||||
|
||||
// setup an xslt dir to force subdir file replication
|
||||
File masterXsltDir = new File(master.getConfDir() + File.separator + "xslt");
|
||||
File masterXsl = new File(masterXsltDir, "dummy.xsl");
|
||||
assertTrue(masterXsltDir.mkdir());
|
||||
assertTrue(masterXsl.createNewFile());
|
||||
|
||||
File slaveXsltDir = new File(slave.getConfDir() + File.separator + "xslt");
|
||||
File slaveXsl = new File(slaveXsltDir, "dummy.xsl");
|
||||
assertFalse(slaveXsltDir.exists());
|
||||
|
||||
slaveJetty = createJetty(slave);
|
||||
slaveClient = createNewSolrServer(slaveJetty.getLocalPort());
|
||||
|
||||
|
@ -426,6 +437,9 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
|
|||
SolrDocument d = ((SolrDocumentList) slaveQueryRsp.get("response")).get(0);
|
||||
assertEquals("newname = 2000", (String) d.getFieldValue("newname"));
|
||||
|
||||
assertTrue(slaveXsltDir.isDirectory());
|
||||
assertTrue(slaveXsl.exists());
|
||||
|
||||
}
|
||||
|
||||
private void doTestStopPoll() throws Exception {
|
||||
|
|
Loading…
Reference in New Issue