You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2013/02/22 18:00:15 UTC
svn commit: r1449117 - in /lucene/dev/branches/branch_4x: ./ dev-tools/
lucene/ lucene/analysis/
lucene/analysis/icu/src/java/org/apache/lucene/collation/ lucene/backwards/
lucene/benchmark/ lucene/classification/ lucene/codecs/ lucene/core/
lucene/cor...
Author: markrmiller
Date: Fri Feb 22 17:00:13 2013
New Revision: 1449117
URL: http://svn.apache.org/r1449117
Log:
SOLR-4471: Replication occurs even when a slave is already up to date.
SOLR-4484: ReplicationHandler#loadReplicationProperties still uses Files rather than the Directory to try and read the replication properties files.
SOLR-4488: Return slave replication details for a master if the master has also acted like a slave.
Modified:
lucene/dev/branches/branch_4x/ (props changed)
lucene/dev/branches/branch_4x/dev-tools/ (props changed)
lucene/dev/branches/branch_4x/lucene/ (props changed)
lucene/dev/branches/branch_4x/lucene/BUILD.txt (props changed)
lucene/dev/branches/branch_4x/lucene/CHANGES.txt (props changed)
lucene/dev/branches/branch_4x/lucene/JRE_VERSION_MIGRATION.txt (props changed)
lucene/dev/branches/branch_4x/lucene/LICENSE.txt (props changed)
lucene/dev/branches/branch_4x/lucene/MIGRATE.txt (props changed)
lucene/dev/branches/branch_4x/lucene/NOTICE.txt (props changed)
lucene/dev/branches/branch_4x/lucene/README.txt (props changed)
lucene/dev/branches/branch_4x/lucene/SYSTEM_REQUIREMENTS.txt (props changed)
lucene/dev/branches/branch_4x/lucene/analysis/ (props changed)
lucene/dev/branches/branch_4x/lucene/analysis/icu/src/java/org/apache/lucene/collation/ICUCollationKeyFilterFactory.java (props changed)
lucene/dev/branches/branch_4x/lucene/backwards/ (props changed)
lucene/dev/branches/branch_4x/lucene/benchmark/ (props changed)
lucene/dev/branches/branch_4x/lucene/build.xml (props changed)
lucene/dev/branches/branch_4x/lucene/classification/ (props changed)
lucene/dev/branches/branch_4x/lucene/codecs/ (props changed)
lucene/dev/branches/branch_4x/lucene/common-build.xml (props changed)
lucene/dev/branches/branch_4x/lucene/core/ (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/index.40.cfs.zip (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/index.40.nocfs.zip (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/index.40.optimized.cfs.zip (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/index/index.40.optimized.nocfs.zip (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSort.java (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSortDocValues.java (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestSortRandom.java (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTopFieldCollector.java (props changed)
lucene/dev/branches/branch_4x/lucene/core/src/test/org/apache/lucene/search/TestTotalHitCountCollector.java (props changed)
lucene/dev/branches/branch_4x/lucene/demo/ (props changed)
lucene/dev/branches/branch_4x/lucene/facet/ (props changed)
lucene/dev/branches/branch_4x/lucene/grouping/ (props changed)
lucene/dev/branches/branch_4x/lucene/highlighter/ (props changed)
lucene/dev/branches/branch_4x/lucene/ivy-settings.xml (props changed)
lucene/dev/branches/branch_4x/lucene/join/ (props changed)
lucene/dev/branches/branch_4x/lucene/licenses/ (props changed)
lucene/dev/branches/branch_4x/lucene/memory/ (props changed)
lucene/dev/branches/branch_4x/lucene/misc/ (props changed)
lucene/dev/branches/branch_4x/lucene/module-build.xml (props changed)
lucene/dev/branches/branch_4x/lucene/queries/ (props changed)
lucene/dev/branches/branch_4x/lucene/queryparser/ (props changed)
lucene/dev/branches/branch_4x/lucene/sandbox/ (props changed)
lucene/dev/branches/branch_4x/lucene/site/ (props changed)
lucene/dev/branches/branch_4x/lucene/spatial/ (props changed)
lucene/dev/branches/branch_4x/lucene/suggest/ (props changed)
lucene/dev/branches/branch_4x/lucene/test-framework/ (props changed)
lucene/dev/branches/branch_4x/lucene/tools/ (props changed)
lucene/dev/branches/branch_4x/solr/ (props changed)
lucene/dev/branches/branch_4x/solr/CHANGES.txt (contents, props changed)
lucene/dev/branches/branch_4x/solr/LICENSE.txt (props changed)
lucene/dev/branches/branch_4x/solr/NOTICE.txt (props changed)
lucene/dev/branches/branch_4x/solr/README.txt (props changed)
lucene/dev/branches/branch_4x/solr/SYSTEM_REQUIREMENTS.txt (props changed)
lucene/dev/branches/branch_4x/solr/build.xml (props changed)
lucene/dev/branches/branch_4x/solr/cloud-dev/ (props changed)
lucene/dev/branches/branch_4x/solr/common-build.xml (props changed)
lucene/dev/branches/branch_4x/solr/contrib/ (props changed)
lucene/dev/branches/branch_4x/solr/core/ (props changed)
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/StandardDirectoryFactory.java
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/SnapPuller.java
lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/update/CommitUpdateCommand.java
lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
lucene/dev/branches/branch_4x/solr/example/ (props changed)
lucene/dev/branches/branch_4x/solr/licenses/ (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpclient-LICENSE-ASL.txt (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpclient-NOTICE.txt (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpcore-LICENSE-ASL.txt (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpcore-NOTICE.txt (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpmime-LICENSE-ASL.txt (props changed)
lucene/dev/branches/branch_4x/solr/licenses/httpmime-NOTICE.txt (props changed)
lucene/dev/branches/branch_4x/solr/scripts/ (props changed)
lucene/dev/branches/branch_4x/solr/site/ (props changed)
lucene/dev/branches/branch_4x/solr/solrj/ (props changed)
lucene/dev/branches/branch_4x/solr/test-framework/ (props changed)
lucene/dev/branches/branch_4x/solr/testlogging.properties (props changed)
lucene/dev/branches/branch_4x/solr/webapp/ (props changed)
Modified: lucene/dev/branches/branch_4x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/CHANGES.txt?rev=1449117&r1=1449116&r2=1449117&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/solr/CHANGES.txt Fri Feb 22 17:00:13 2013
@@ -60,6 +60,9 @@ New Features
* SOLR-4477: Add support for queries (match-only) against docvalues fields.
(Robert Muir)
+* SOLR-4488: Return slave replication details for a master if the master has
+ also acted like a slave. (Mark Miller)
+
Bug Fixes
----------------------
@@ -125,6 +128,13 @@ Bug Fixes
directory has changed and the previous SolrCore's state should not be
propagated. (Mark Miller, Gregg Donovan)
+* SOLR-4471: Replication occurs even when a slave is already up to date.
+ (Mark Miller, Andre Charton)
+
+* SOLR-4484: ReplicationHandler#loadReplicationProperties still uses Files
+ rather than the Directory to try and read the replication properties files.
+ (Mark Miller)
+
Optimizations
----------------------
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/StandardDirectoryFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/StandardDirectoryFactory.java?rev=1449117&r1=1449116&r2=1449117&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/StandardDirectoryFactory.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/core/StandardDirectoryFactory.java Fri Feb 22 17:00:13 2013
@@ -89,7 +89,7 @@ public class StandardDirectoryFactory ex
throws IOException {
Directory baseFromDir = getBaseDir(fromDir);
- Directory baseToDir = getBaseDir(fromDir);
+ Directory baseToDir = getBaseDir(toDir);
if (baseFromDir instanceof FSDirectory && baseToDir instanceof FSDirectory) {
File dir1 = ((FSDirectory) baseFromDir).getDirectory();
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java?rev=1449117&r1=1449116&r2=1449117&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/ReplicationHandler.java Fri Feb 22 17:00:13 2013
@@ -19,6 +19,7 @@ package org.apache.solr.handler;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.OutputStream;
import java.io.Writer;
import java.nio.ByteBuffer;
@@ -69,6 +70,7 @@ import org.apache.solr.response.SolrQuer
import org.apache.solr.search.SolrIndexSearcher;
import org.apache.solr.update.SolrIndexWriter;
import org.apache.solr.util.NumberUtils;
+import org.apache.solr.util.PropertiesInputStream;
import org.apache.solr.util.RefCounted;
import org.apache.solr.util.plugin.SolrCoreAware;
import org.slf4j.Logger;
@@ -473,7 +475,7 @@ public class ReplicationHandler extends
Directory dir;
long size = 0;
try {
- dir = core.getDirectoryFactory().get(core.getNewIndexDir(), DirContext.DEFAULT, core.getSolrConfig().indexConfig.lockType);
+ dir = core.getDirectoryFactory().get(core.getIndexDir(), DirContext.DEFAULT, core.getSolrConfig().indexConfig.lockType);
try {
size = DirectoryFactory.sizeOfDirectory(dir);
} finally {
@@ -593,14 +595,18 @@ public class ReplicationHandler extends
}
SnapPuller snapPuller = tempSnapPuller;
- if (showSlaveDetails && snapPuller != null) {
+ if (snapPuller != null) {
Properties props = loadReplicationProperties();
- try {
- NamedList nl = snapPuller.getDetails();
- slave.add("masterDetails", nl.get(CMD_DETAILS));
- } catch (Exception e) {
- LOG.warn("Exception while invoking 'details' method for replication on master ", e);
- slave.add(ERR_STATUS, "invalid_master");
+ if (showSlaveDetails) {
+ try {
+ NamedList nl = snapPuller.getDetails();
+ slave.add("masterDetails", nl.get(CMD_DETAILS));
+ } catch (Exception e) {
+ LOG.warn(
+ "Exception while invoking 'details' method for replication on master ",
+ e);
+ slave.add(ERR_STATUS, "invalid_master");
+ }
}
slave.add(MASTER_URL, snapPuller.getMasterUrl());
if (snapPuller.getPollInterval() != null) {
@@ -709,7 +715,7 @@ public class ReplicationHandler extends
if (isMaster)
details.add("master", master);
- if (isSlave && showSlaveDetails)
+ if (slave.size() > 0)
details.add("slave", slave);
NamedList snapshotStats = snapShootDetails;
@@ -759,20 +765,32 @@ public class ReplicationHandler extends
}
Properties loadReplicationProperties() {
- FileInputStream inFile = null;
- Properties props = new Properties();
+ Directory dir = null;
try {
- File f = new File(core.getDataDir(), SnapPuller.REPLICATION_PROPERTIES);
- if (f.exists()) {
- inFile = new FileInputStream(f);
- props.load(inFile);
+ try {
+ dir = core.getDirectoryFactory().get(core.getDataDir(),
+ DirContext.META_DATA, core.getSolrConfig().indexConfig.lockType);
+ if (!dir.fileExists(SnapPuller.REPLICATION_PROPERTIES)) {
+ return new Properties();
+ }
+ final IndexInput input = dir.openInput(
+ SnapPuller.REPLICATION_PROPERTIES, IOContext.DEFAULT);
+ try {
+ final InputStream is = new PropertiesInputStream(input);
+ Properties props = new Properties();
+ props.load(is);
+ return props;
+ } finally {
+ input.close();
+ }
+ } finally {
+ if (dir != null) {
+ core.getDirectoryFactory().release(dir);
+ }
}
- } catch (Exception e) {
- LOG.warn("Exception while reading " + SnapPuller.REPLICATION_PROPERTIES);
- } finally {
- IOUtils.closeQuietly(inFile);
+ } catch (IOException e) {
+ throw new SolrException(ErrorCode.SERVER_ERROR, e);
}
- return props;
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/SnapPuller.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/SnapPuller.java?rev=1449117&r1=1449116&r2=1449117&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/SnapPuller.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/handler/SnapPuller.java Fri Feb 22 17:00:13 2013
@@ -646,26 +646,20 @@ public class SnapPuller {
solrCore.getUpdateHandler().newIndexWriter(isFullCopyNeeded, false);
try {
- // first try to open an NRT searcher so that the new
+ // first try to open an NRT searcher so that the new
// IndexWriter is registered with the reader
Future[] waitSearcher = new Future[1];
solrCore.getSearcher(true, false, waitSearcher, true);
if (waitSearcher[0] != null) {
try {
- waitSearcher[0].get();
- } catch (InterruptedException e) {
- SolrException.log(LOG,e);
- } catch (ExecutionException e) {
- SolrException.log(LOG,e);
- }
- }
-
- // update our commit point to the right dir
- CommitUpdateCommand cuc = new CommitUpdateCommand(req, false);
- cuc.waitSearcher = false;
- cuc.openSearcher = false;
- solrCore.getUpdateHandler().commit(cuc);
-
+ waitSearcher[0].get();
+ } catch (InterruptedException e) {
+ SolrException.log(LOG, e);
+ } catch (ExecutionException e) {
+ SolrException.log(LOG, e);
+ }
+ }
+
} finally {
req.close();
}
@@ -741,7 +735,7 @@ public class SnapPuller {
dirFileFetcher.fetchFile();
filesDownloaded.add(new HashMap<String,Object>(file));
} else {
- LOG.info("Skipping download for " + file.get(NAME));
+ LOG.info("Skipping download for " + file.get(NAME) + " because it already exists");
}
}
} finally {
@@ -776,6 +770,7 @@ public class SnapPuller {
boolean success = false;
try {
if (indexDir.fileExists(fname)) {
+ LOG.info("Skipping move file - it already exists:" + fname);
return true;
}
} catch (IOException e) {
Modified: lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/update/CommitUpdateCommand.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/update/CommitUpdateCommand.java?rev=1449117&r1=1449116&r2=1449117&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/update/CommitUpdateCommand.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/java/org/apache/solr/update/CommitUpdateCommand.java Fri Feb 22 17:00:13 2013
@@ -54,6 +54,7 @@ public class CommitUpdateCommand extends
+",waitSearcher="+waitSearcher
+",expungeDeletes="+expungeDeletes
+",softCommit="+softCommit
+ +",prepareCommit="+prepareCommit
+'}';
}
}
Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java?rev=1449117&r1=1449116&r2=1449117&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java (original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java Fri Feb 22 17:00:13 2013
@@ -26,7 +26,9 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Writer;
+import java.net.MalformedURLException;
import java.net.URL;
+import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -530,15 +532,17 @@ public class TestReplicationHandler exte
index(masterClient, "id", i, "name", "name = " + i);
// make sure prepareCommit doesn't mess up commit (SOLR-3938)
+
// todo: make SolrJ easier to pass arbitrary params to
+ // TODO: precommit WILL screw with the rest of this test
String masterUrl = "http://127.0.0.1:" + masterJetty.getLocalPort() + "/solr/update?prepareCommit=true";
URL url = new URL(masterUrl);
- InputStream stream = url.openStream();
- try {
- stream.close();
- } catch (IOException e) {
- //e.printStackTrace();
- }
+// InputStream stream = url.openStream();
+// try {
+// stream.close();
+// } catch (IOException e) {
+// //e.printStackTrace();
+// }
masterClient.commit();
@@ -550,7 +554,7 @@ public class TestReplicationHandler exte
masterUrl = "http://127.0.0.1:" + slaveJetty.getLocalPort() + "/solr/replication?command=fetchindex&masterUrl=";
masterUrl += "http://127.0.0.1:" + masterJetty.getLocalPort() + "/solr/replication";
url = new URL(masterUrl);
- stream = url.openStream();
+ InputStream stream = url.openStream();
try {
stream.close();
} catch (IOException e) {
@@ -565,7 +569,6 @@ public class TestReplicationHandler exte
String cmp = BaseDistributedSearchTestCase.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++)
@@ -573,21 +576,73 @@ public class TestReplicationHandler exte
slaveClient.commit();
- masterUrl = "http://127.0.0.1:" + masterJetty.getLocalPort() + "/solr/replication?command=fetchindex&masterUrl=";
- masterUrl += "http://127.0.0.1:" + slaveJetty.getLocalPort() + "/solr/replication";
- url = new URL(masterUrl);
- stream = url.openStream();
- try {
- stream.close();
- } catch (IOException e) {
- //e.printStackTrace();
- }
+ pullFromSlaveToMaster();
+
+ //get docs from slave and check if number is equal to master
+ slaveQueryRsp = rQuery(nDocs, "*:*", slaveClient);
+ slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response");
+ assertEquals(nDocs, slaveQueryResult.getNumFound());
+ //compare results
+ masterQueryRsp = rQuery(nDocs, "*:*", masterClient);
+ masterQueryResult = (SolrDocumentList) masterQueryRsp.get("response");
+ cmp = BaseDistributedSearchTestCase.compare(masterQueryResult, slaveQueryResult, 0, null);
+ assertEquals(null, cmp);
// get the details
// just ensures we don't get an exception
- NamedList<Object> details = getDetails(masterClient);
- //System.out.println("details:" + details);
+ assertVersions();
+
+ pullFromSlaveToMaster();
+
+ //get docs from slave and check if number is equal to master
+ slaveQueryRsp = rQuery(nDocs, "*:*", slaveClient);
+ slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response");
+ assertEquals(nDocs, slaveQueryResult.getNumFound());
+ //compare results
+ masterQueryRsp = rQuery(nDocs, "*:*", masterClient);
+ masterQueryResult = (SolrDocumentList) masterQueryRsp.get("response");
+ cmp = BaseDistributedSearchTestCase.compare(masterQueryResult, slaveQueryResult, 0, null);
+ assertEquals(null, cmp);
+
+ assertVersions();
+
+ // now force a new index directory
+ for (int i = 0; i < 3; i++)
+ index(masterClient, "id", i, "name", "name = " + i);
+
+ masterClient.commit();
+
+ pullFromSlaveToMaster();
+
+ //get docs from slave and check if number is equal to master
+ slaveQueryRsp = rQuery(nDocs, "*:*", slaveClient);
+ slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response");
+ assertEquals(nDocs, slaveQueryResult.getNumFound());
+ //compare results
+ masterQueryRsp = rQuery(nDocs, "*:*", masterClient);
+ masterQueryResult = (SolrDocumentList) masterQueryRsp.get("response");
+ cmp = BaseDistributedSearchTestCase.compare(masterQueryResult, slaveQueryResult, 0, null);
+ assertEquals(null, cmp);
+
+ assertVersions();
+ pullFromSlaveToMaster();
+ //get docs from slave and check if number is equal to master
+ slaveQueryRsp = rQuery(nDocs, "*:*", slaveClient);
+ slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response");
+ assertEquals(nDocs, slaveQueryResult.getNumFound());
+ //compare results
+ masterQueryRsp = rQuery(nDocs, "*:*", masterClient);
+ masterQueryResult = (SolrDocumentList) masterQueryRsp.get("response");
+ cmp = BaseDistributedSearchTestCase.compare(masterQueryResult, slaveQueryResult, 0, null);
+ assertEquals(null, cmp);
+
+ assertVersions();
+
+ NamedList<Object> details = getDetails(masterClient);
+
+ details = getDetails(slaveClient);
+
// NOTE: at this point, the slave is not polling any more
// restore it.
slave.copyConfigFile(CONF_DIR + "solrconfig-slave.xml", "solrconfig.xml");
@@ -596,6 +651,42 @@ public class TestReplicationHandler exte
slaveClient = createNewSolrServer(slaveJetty.getLocalPort());
}
+ private void assertVersions() throws Exception {
+ NamedList<Object> details = getDetails(masterClient);
+ ArrayList<NamedList<Object>> commits = (ArrayList<NamedList<Object>>) details.get("commits");
+ Long maxVersionMaster = 0L;
+ for(NamedList<Object> commit : commits) {
+ Long version = (Long) commit.get("indexVersion");
+ maxVersionMaster = Math.max(version, maxVersionMaster);
+ }
+
+ details = getDetails(slaveClient);
+ commits = (ArrayList<NamedList<Object>>) details.get("commits");
+ Long maxVersionSlave= 0L;
+ for(NamedList<Object> commit : commits) {
+ Long version = (Long) commit.get("indexVersion");
+ maxVersionSlave = Math.max(version, maxVersionSlave);
+ }
+
+ assertEquals(maxVersionMaster, maxVersionSlave);
+ }
+
+ private void pullFromSlaveToMaster() throws MalformedURLException,
+ IOException {
+ String masterUrl;
+ URL url;
+ InputStream stream;
+ masterUrl = "http://127.0.0.1:" + masterJetty.getLocalPort() + "/solr/replication?command=fetchindex&masterUrl=";
+ masterUrl += "http://127.0.0.1:" + slaveJetty.getLocalPort() + "/solr/replication";
+ url = new URL(masterUrl);
+ stream = url.openStream();
+ try {
+ stream.close();
+ } catch (IOException e) {
+ //e.printStackTrace();
+ }
+ }
+
private void doTestReplicateAfterStartup() throws Exception {
//stop slave
@@ -660,8 +751,6 @@ public class TestReplicationHandler exte
}
private void doTestReplicateAfterStartupWithNoActivity() throws Exception {
- String factory = System.getProperty("solr.directoryFactory");
- System.out.println("factory:" + factory);
useFactory(null);
try {