From 29012070bf25ca534a6d6bbdc31eb8de15fa33b0 Mon Sep 17 00:00:00 2001 From: Sami Siren Date: Wed, 5 Sep 2012 07:33:07 +0000 Subject: [PATCH] SOLR-3789: Fix bug in SnapPuller that caused 'internal' compression to fail git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1381043 13f79535-47bb-0310-9956-ffa450edef68 --- solr/CHANGES.txt | 3 +++ .../src/java/org/apache/solr/handler/SnapPuller.java | 2 +- .../solr/collection1/conf/solrconfig-slave.xml | 3 ++- .../apache/solr/handler/TestReplicationHandler.java | 12 ++++++------ 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index d5317a585c9..f9fa09de810 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -113,6 +113,9 @@ Bug Fixes * SOLR-3611: We do not show ZooKeeper data in the UI for a node that has children. (Mark Miller) +* SOLR-3789: Fix bug in SnapPuller that caused "internal" compression to fail. + (siren) + Other Changes ---------------------- diff --git a/solr/core/src/java/org/apache/solr/handler/SnapPuller.java b/solr/core/src/java/org/apache/solr/handler/SnapPuller.java index 6b9291fcecd..42806d07786 100644 --- a/solr/core/src/java/org/apache/solr/handler/SnapPuller.java +++ b/solr/core/src/java/org/apache/solr/handler/SnapPuller.java @@ -1151,7 +1151,7 @@ public class SnapPuller { params.set(FILE, fileName); } if (useInternal) { - params.set(COMPRESSION, "internal"); + params.set(COMPRESSION, "true"); } //use checksum if (this.includeChecksum) { diff --git a/solr/core/src/test-files/solr/collection1/conf/solrconfig-slave.xml b/solr/core/src/test-files/solr/collection1/conf/solrconfig-slave.xml index 5ee5459212a..0ff8f87680d 100644 --- a/solr/core/src/test-files/solr/collection1/conf/solrconfig-slave.xml +++ b/solr/core/src/test-files/solr/collection1/conf/solrconfig-slave.xml @@ -53,7 +53,8 @@ http://localhost:TEST_PORT/solr 00:00:01 - + COMPRESSION + diff --git a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java index 88bf5e7b26b..d3b254685bc 100644 --- a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java +++ b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java @@ -41,7 +41,6 @@ import org.apache.lucene.store.SimpleFSDirectory; import org.apache.lucene.util.LuceneTestCase.Slow; import org.apache.solr.BaseDistributedSearchTestCase; import org.apache.solr.SolrTestCaseJ4; -import org.apache.solr.TestDistributedSearch; import org.apache.solr.client.solrj.SolrServer; import org.apache.solr.client.solrj.SolrServerException; import org.apache.solr.client.solrj.embedded.JettySolrRunner; @@ -57,7 +56,6 @@ import org.apache.solr.common.util.SimpleOrderedMap; import org.apache.solr.util.AbstractSolrTestCase; import org.junit.AfterClass; import org.junit.BeforeClass; -import org.junit.Ignore; /** * Test for ReplicationHandler @@ -928,13 +926,13 @@ public class TestReplicationHandler extends SolrTestCaseJ4 { /* character copy of file using UTF-8 */ private static void copyFile(File src, File dst) throws IOException { - copyFile(src, dst, null); + copyFile(src, dst, null, false); } /** * character copy of file using UTF-8. If port is non-null, will be substituted any time "TEST_PORT" is found. */ - private static void copyFile(File src, File dst, Integer port) throws IOException { + private static void copyFile(File src, File dst, Integer port, boolean internalCompression) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(src), "UTF-8")); Writer out = new OutputStreamWriter(new FileOutputStream(dst), "UTF-8"); @@ -942,6 +940,9 @@ public class TestReplicationHandler extends SolrTestCaseJ4 { if (null != port) line = line.replace("TEST_PORT", port.toString()); + + line = line.replace("COMPRESSION", internalCompression?"internal":"false"); + out.write(line); } in.close(); @@ -1020,10 +1021,9 @@ public class TestReplicationHandler extends SolrTestCaseJ4 { public void copyConfigFile(String srcFile, String destFile) throws IOException { - copyFile(getFile(srcFile), new File(confDir, destFile), - testPort); + testPort, random().nextBoolean()); } }