From aa3a9b692784dad3f03bfae996d9246dee850bc2 Mon Sep 17 00:00:00 2001 From: Shalin Shekhar Mangar Date: Wed, 17 Dec 2008 09:19:26 +0000 Subject: [PATCH] SOLR-821 -- Add support for replication to copy conf file to slave with a different name. This allows replication of solrconfig.xml git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@727319 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES.txt | 4 + .../solr/handler/ReplicationHandler.java | 100 ++-- .../org/apache/solr/handler/SnapPuller.java | 65 +-- .../solr/handler/TestReplicationHandler.java | 120 +++-- .../solr/conf/schema-replication1.xml | 425 +---------------- .../solr/conf/schema-replication2.xml | 427 +----------------- .../solr/conf/solrconfig-master.xml | 343 +------------- .../solr/conf/solrconfig-master1.xml | 98 ++++ .../test-files/solr/conf/solrconfig-slave.xml | 342 +------------- 9 files changed, 312 insertions(+), 1612 deletions(-) create mode 100644 src/test/test-files/solr/conf/solrconfig-master1.xml diff --git a/CHANGES.txt b/CHANGES.txt index 702a16902bd..3904d05e55f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -108,6 +108,10 @@ New Features also deprecated and replaced with "count" and "lex". (Lars Kotthoff via yonik) +23. SOLR-821: Add support for replication to copy conf file to slave with a different name. This allows replication + of solrconfig.xml + (Noble Paul, Akshay Ukey via shalin) + Optimizations ---------------------- 1. SOLR-374: Use IndexReader.reopen to save resources by re-using parts of the diff --git a/src/java/org/apache/solr/handler/ReplicationHandler.java b/src/java/org/apache/solr/handler/ReplicationHandler.java index 69430d84d82..a6a44c82548 100644 --- a/src/java/org/apache/solr/handler/ReplicationHandler.java +++ b/src/java/org/apache/solr/handler/ReplicationHandler.java @@ -16,7 +16,6 @@ */ package org.apache.solr.handler; -import org.apache.commons.httpclient.HttpClient; import org.apache.lucene.index.IndexCommit; import org.apache.solr.common.params.CommonParams; import org.apache.solr.common.params.ModifiableSolrParams; @@ -48,27 +47,16 @@ import java.util.zip.Checksum; import java.util.zip.DeflaterOutputStream; /** - *

A Handler which provides a REST API for replication and serves replication requests from Slaves. - *

- *

- *

When running on the master, it provides the following commands - *

    - *
  1. Get the current replicatable index version (command=indexversion)
  2. - *
  3. Get the list of files for a given index version (command=filelist&indexversion=<VERSION>)
  4. - *
  5. Get full or a part (chunk) of a given index or a config file (command=filecontent&file=<FILE_NAME>) - * You can optionally specify an offset and length to get that chunk of the file. - * You can request a configuration file by using "cf" parameter instead of the "file" parameter.
  6. - *
  7. Get status/statistics (command=details)
  8. - *
- *

- *

When running on the slave, it provides the following commands - *

    - *
  1. Perform a snap pull now (command=snappull)
  2. - *
  3. Get status/statistics (command=details)
  4. - *
  5. Abort a snap pull (command=abort)
  6. - *
  7. Enable/Disable polling the master for new versions (command=enablepoll or command=disablepoll)
  8. - *
- *

+ *

A Handler which provides a REST API for replication and serves replication requests from Slaves.

+ *

When running on the master, it provides the following commands

  1. Get the current replicatable index version + * (command=indexversion)
  2. Get the list of files for a given index version + * (command=filelist&indexversion=<VERSION>)
  3. Get full or a part (chunk) of a given index or a config + * file (command=filecontent&file=<FILE_NAME>) You can optionally specify an offset and length to get that + * chunk of the file. You can request a configuration file by using "cf" parameter instead of the "file" parameter.
  4. + *
  5. Get status/statistics (command=details)

When running on the slave, it provides the following + * commands

  1. Perform a snap pull now (command=snappull)
  2. Get status/statistics (command=details)
  3. + *
  4. Abort a snap pull (command=abort)
  5. Enable/Disable polling the master for new versions (command=enablepoll + * or command=disablepoll)

* * @version $Id$ * @since solr 1.4 @@ -81,7 +69,9 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw private ReentrantLock snapPullLock = new ReentrantLock(); - private List includeConfFiles; + private String includeConfFiles; + + private NamedList confFileNameAlias = new NamedList(); private boolean isMaster = false; @@ -239,8 +229,8 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw } /** - * This method adds an Object of FileStream to the resposnse . - * The FileStream implements a custom protocol which is understood by SnapPuller.FileFetcher + * This method adds an Object of FileStream to the resposnse . The FileStream implements a custom protocol which is + * understood by SnapPuller.FileFetcher * * @see org.apache.solr.handler.SnapPuller.FileFetcher */ @@ -281,27 +271,28 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw + version, e); } rsp.add(CMD_GET_FILE_LIST, result); - if (includeConfFiles == null) + if (confFileNameAlias.size() < 1) return; LOG.debug("Adding config files to list: " + includeConfFiles); //if configuration files need to be included get their details - List> confFiles = getConfFileCache(includeConfFiles); - rsp.add(CONF_FILES, confFiles); + rsp.add(CONF_FILES, getConfFileInfoFromCache(confFileNameAlias, confFileInfoCache)); } /** - * For configuration files, checksum of the file is included - * because, unlike index files, they may have same content but different timestamps. + * For configuration files, checksum of the file is included because, unlike index files, they may have same content + * but different timestamps. *

- * The local conf files information is cached so that everytime it does not have to - * compute the checksum. The cache is refreshed only if the lastModified of the file changes + * The local conf files information is cached so that everytime it does not have to compute the checksum. The cache is + * refreshed only if the lastModified of the file changes */ - List> getConfFileCache(Collection filenames) { + List> getConfFileInfoFromCache(NamedList nameAndAlias, + final Map confFileInfoCache) { List> confFiles = new ArrayList>(); synchronized (confFileInfoCache) { File confDir = new File(core.getResourceLoader().getConfigDir()); Checksum checksum = null; - for (String cf : filenames) { + for (int i = 0; i < nameAndAlias.size(); i++) { + String cf = nameAndAlias.getName(i); File f = new File(confDir, cf); if (!f.exists() || f.isDirectory()) continue; //must not happen FileInfo info = confFileInfoCache.get(cf); @@ -310,13 +301,15 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw info = new FileInfo(f.lastModified(), cf, f.length(), getCheckSum(checksum, f)); confFileInfoCache.put(cf, info); } - confFiles.add(info.getAsMap()); + Map m = info.getAsMap(); + if (nameAndAlias.getVal(i) != null) m.put(ALIAS, nameAndAlias.getVal(i)); + confFiles.add(m); } } return confFiles; } - private static class FileInfo { + static class FileInfo { long lastmodified; String name; long size; @@ -329,7 +322,7 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw this.checksum = checksum; } - public Map getAsMap() { + Map getAsMap() { Map map = new HashMap(); map.put(NAME, name); map.put(SIZE, size); @@ -453,7 +446,8 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw list.add("isReplicating", String.valueOf(isReplicating())); } if (isMaster) { - list.add("confFilesToReplicate", includeConfFiles.toString()); + if (includeConfFiles != null) + list.add("confFilesToReplicate", includeConfFiles); if (replicateOnCommit) list.add(REPLICATE_AFTER, "commit"); if (replicateOnOptimize) @@ -611,7 +605,8 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw totalPercent = (bytesDownloaded * 100) / bytesToDownload; if (timeElapsed > 0) downloadSpeed = (bytesDownloaded / timeElapsed); - details.add("currentFile", currFile); + if (currFile != null) + details.add("currentFile", currFile); details.add("currentFileSize", readableSize(currFileSize)); details.add("currentFileSizeDownloaded", readableSize(currFileSizeDownloaded)); details.add("currentFileSizePercent", String.valueOf(percentDownloaded)); @@ -627,7 +622,8 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw } if (isMaster) { - details.add(CONF_FILES, includeConfFiles.toString()); + if (includeConfFiles != null) + details.add(CONF_FILES, includeConfFiles); if (replicateOnCommit) details.add(REPLICATE_AFTER, "commit"); if (replicateOnOptimize) @@ -649,9 +645,15 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw } NamedList master = (NamedList) initArgs.get("master"); if (master != null) { - String includeFiles = (String) master.get(CONF_FILES); - if (includeFiles != null && !includeFiles.trim().equals("")) { - includeConfFiles = Arrays.asList(includeFiles.split(",")); + includeConfFiles = (String) master.get(CONF_FILES); + if (includeConfFiles != null && includeConfFiles.trim().length() > 0) { + List files = Arrays.asList(includeConfFiles.split(",")); + for (String file : files) { + if (file.trim().length() == 0) continue; + String[] strs = file.split(":"); + // if there is an alias add it or it is null + confFileNameAlias.add(strs[0], strs.length > 1 ? strs[1] : null); + } LOG.info("Replication enabled for following config files: " + includeConfFiles); } List snapshot = master.getAll("snapshot"); @@ -701,9 +703,8 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw } /** - * A ResponseWriter is registered automatically for wt=filestream - * This response writer is used to transfer index files in a block-by-block manner within - * the same HTTP response. + * A ResponseWriter is registered automatically for wt=filestream This response writer is used to transfer index files + * in a block-by-block manner within the same HTTP response. */ private void registerFileStreamResponseWriter() { core.registerResponseWriter(FILE_STREAM, new BinaryQueryResponseWriter() { @@ -730,6 +731,7 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw * * @param snapshoot do a snapshoot * @param getCommit get a commitpoint also + * * @return an instance of the eventlistener */ private SolrEventListener getEventListener(final boolean snapshoot, final boolean getCommit) { @@ -786,9 +788,9 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw String sChecksum = params.get(CHECKSUM); String sindexVersion = params.get(CMD_INDEX_VERSION); if (sindexVersion != null) indexVersion = Long.parseLong(sindexVersion); - if (Boolean.parseBoolean(compress)) { + if (Boolean.parseBoolean(compress)) { fos = new FastOutputStream(new DeflaterOutputStream(out)); - } else { + } else { fos = new FastOutputStream(out); } FileInputStream inputStream = null; @@ -912,6 +914,8 @@ public class ReplicationHandler extends RequestHandlerBase implements SolrCoreAw public static final String CHECKSUM = "checksum"; + public static final String ALIAS = "alias"; + public static final String CONF_CHECKSUM = "confchecksum"; public static final String CONF_FILES = "confFiles"; diff --git a/src/java/org/apache/solr/handler/SnapPuller.java b/src/java/org/apache/solr/handler/SnapPuller.java index e69bf766719..11962584f29 100644 --- a/src/java/org/apache/solr/handler/SnapPuller.java +++ b/src/java/org/apache/solr/handler/SnapPuller.java @@ -48,9 +48,8 @@ import java.util.zip.GZIPInputStream; import java.util.zip.InflaterInputStream; /** - *

Provides functionality equivalent to the snappull script as well as a - * timer for scheduling pulls from the master. - *

+ *

Provides functionality equivalent to the snappull script as well as a timer for scheduling pulls from the + * master.

* * @version $Id$ * @since solr 1.4 @@ -189,12 +188,13 @@ public class SnapPuller { } /** - * This command downloads all the necessary files from master to install a - * index commit point. Only changed files are downloaded. It also downloads the - * conf files (if they are modified). + * This command downloads all the necessary files from master to install a index commit point. Only changed files are + * downloaded. It also downloads the conf files (if they are modified). * * @param core the SolrCore + * * @return true on success, false if slave is already in sync + * * @throws IOException if an exception occurs */ @SuppressWarnings("unchecked") @@ -290,8 +290,8 @@ public class SnapPuller { } /** - * Helper method to record the last replication's details so that we can show them on the - * statistics page across restarts. + * Helper method to record the last replication's details so that we can show them on the statistics page across + * restarts. */ private void logReplicationTimeAndConfFiles(Collection> modifiedConfFiles) { FileOutputStream outFile = null; @@ -392,7 +392,8 @@ public class SnapPuller { "Failed to create temporary config folder: " + tmpconfDir.getName()); } for (Map file : confFilesToDownload) { - fileFetcher = new FileFetcher(tmpconfDir, file, (String) file.get(NAME), true, latestVersion); + String saveAs = (String) (file.get(ALIAS) == null ? file.get(NAME) : file.get(ALIAS)); + fileFetcher = new FileFetcher(tmpconfDir, file, saveAs, true, latestVersion); currentFile = file; fileFetcher.fetchFile(); confFilesDownloaded.add(new HashMap(file)); @@ -422,8 +423,8 @@ public class SnapPuller { } /** - * All the files which are common between master and slave must have - * same timestamp and size else we assume they are not compatible (stale). + * All the files which are common between master and slave must have same timestamp and size else we assume they are + * not compatible (stale). * * @return true if the index stale and we need to download a fresh copy, false otherwise. */ @@ -442,8 +443,7 @@ public class SnapPuller { } /** - * Copy a file by the File#renameTo() method. If it fails, it is considered - * a failure + * Copy a file by the File#renameTo() method. If it fails, it is considered a failure *

* Todo may be we should try a simple copy if it fails */ @@ -466,8 +466,7 @@ public class SnapPuller { } /** - * Copy all index files from the temp index dir to the actual index. - * The segments_N file is copied last. + * Copy all index files from the temp index dir to the actual index. The segments_N file is copied last. */ private boolean copyIndexFiles(File snapDir, File indexDir) { String segmentsFile = null; @@ -494,8 +493,7 @@ public class SnapPuller { } /** - * The conf files are copied to the tmp dir to the conf dir. - * A backup of the old file is maintained + * The conf files are copied to the tmp dir to the conf dir. A backup of the old file is maintained */ private void copyTmpConfFiles2Conf(File tmpconfDir) throws IOException { File confDir = new File(solrCore.getResourceLoader().getConfigDir()); @@ -556,26 +554,36 @@ public class SnapPuller { } } + private final Map confFileInfoCache = new HashMap(); + /** - * The local conf files are compared with the conf files in the master. If they are - * same (by checksum) do not copy. + * The local conf files are compared with the conf files in the master. If they are same (by checksum) do not copy. + * + * @param confFilesToDownload The list of files obtained from master * * @return a list of configuration files which have changed on the master and need to be downloaded. */ private Collection> getModifiedConfFiles(List> confFilesToDownload) { if (confFilesToDownload == null || confFilesToDownload.isEmpty()) return Collections.EMPTY_LIST; + //build a map with alias/name as the key Map> nameVsFile = new HashMap>(); + NamedList names = new NamedList(); for (Map map : confFilesToDownload) { - nameVsFile.put((String) map.get(NAME), map); + //if alias is present that is the name the file may have in the slave + String name = (String) (map.get(ALIAS) == null ? map.get(NAME) : map.get(ALIAS)); + nameVsFile.put(name, map); + names.add(name, null); } - List> localFilesInfo = replicationHandler.getConfFileCache(nameVsFile.keySet()); + //get the details of the local conf files with the same alias/name + List> localFilesInfo = replicationHandler.getConfFileInfoFromCache(names, confFileInfoCache); + //compare their size/checksum to see if for (Map fileInfo : localFilesInfo) { String name = (String) fileInfo.get(NAME); Map m = nameVsFile.get(name); - if (m == null) continue; + if (m == null) continue; // the file is not even present locally (so must be downloaded) if (m.get(CHECKSUM).equals(fileInfo.get(CHECKSUM))) { - nameVsFile.remove(name); + nameVsFile.remove(name); //checksums are same so the file need not be downloaded } } return nameVsFile.isEmpty() ? Collections.EMPTY_LIST : nameVsFile.values(); @@ -685,8 +693,7 @@ public class SnapPuller { } /** - * The class acts as a client for ReplicationHandler.FileStream. - * It understands the protocol of wt=filestream + * The class acts as a client for ReplicationHandler.FileStream. It understands the protocol of wt=filestream * * @see org.apache.solr.handler.ReplicationHandler.FileStream */ @@ -826,9 +833,8 @@ public class SnapPuller { } /** - * The webcontainer flushes the data only after it fills the buffer size. - * So, all data has to be read as readFully() other wise it fails. So read - * everything as bytes and then extract an integer out of it + * The webcontainer flushes the data only after it fills the buffer size. So, all data has to be read as readFully() + * other wise it fails. So read everything as bytes and then extract an integer out of it */ private int readInt(byte[] b) { return (((b[0] & 0xff) << 24) | ((b[1] & 0xff) << 16) @@ -858,7 +864,8 @@ public class SnapPuller { } try { post.releaseConnection(); - } catch (Exception e) {} + } catch (Exception e) { + } if (bytesDownloaded != size) { //if the download is not complete then //delete the file being downloaded diff --git a/src/test/org/apache/solr/handler/TestReplicationHandler.java b/src/test/org/apache/solr/handler/TestReplicationHandler.java index 32a0b1a2281..541d28e8fb7 100644 --- a/src/test/org/apache/solr/handler/TestReplicationHandler.java +++ b/src/test/org/apache/solr/handler/TestReplicationHandler.java @@ -122,7 +122,7 @@ public class TestReplicationHandler extends TestCase { //add 500 docs to master for (int i = 0; i < 500; i++) - index(masterClient, "id", i, "name", "name = " + String.valueOf(i)); + index(masterClient, "id", i, "name", "name = " + i); masterClient.commit(); @@ -130,9 +130,9 @@ public class TestReplicationHandler extends TestCase { SolrDocumentList masterQueryResult = (SolrDocumentList) masterQueryRsp.get("response"); assertEquals(500, masterQueryResult.getNumFound()); - //sleep for pollinterval time, 4s for letting slave to pull data. - Thread.sleep(4000); - //get docs from slave and check equal to master + //sleep for pollinterval time 4s, to let slave pull data. + Thread.sleep(3000); + //get docs from slave and check if number is equal to master NamedList slaveQueryRsp = query("*:*", slaveClient); SolrDocumentList slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response"); assertEquals(500, slaveQueryResult.getNumFound()); @@ -145,9 +145,10 @@ public class TestReplicationHandler extends TestCase { masterClient.deleteByQuery("*:*"); masterClient.commit(); - copyFile(new File("." + System.getProperty("file.separator") + - "solr" + System.getProperty("file.separator") + - "conf" + System.getProperty("file.separator") + "schema-replication2.xml"), + //change the schema on master + copyFile(new File("." + File.separator + + "solr" + File.separator + + "conf" + File.separator + "schema-replication2.xml"), new File(master.getConfDir(), "schema.xml")); masterJetty.stop(); @@ -156,11 +157,11 @@ public class TestReplicationHandler extends TestCase { masterClient = createNewSolrServer(masterJetty.getLocalPort()); //add a doc with new field and commit on master to trigger snappull from slave. - index(masterClient, "id", "2000", "name", "name = " + String.valueOf(2000), "newname", "newname = " + String.valueOf(2000)); + index(masterClient, "id", "2000", "name", "name = " + 2000, "newname", "newname = " + 2000); masterClient.commit(); //sleep for 4s for replication to happen. - Thread.sleep(4000); + Thread.sleep(3000); slaveQueryRsp = query("*:*", slaveClient); SolrDocument d = ((SolrDocumentList) slaveQueryRsp.get("response")).get(0); @@ -168,6 +169,73 @@ public class TestReplicationHandler extends TestCase { } + public void testIndexAndConfigAliasReplication() throws Exception { + + //add 500 docs to master + for (int i = 0; i < 500; i++) + index(masterClient, "id", i, "name", "name = " + i); + + masterClient.commit(); + + NamedList masterQueryRsp = query("*:*", masterClient); + SolrDocumentList masterQueryResult = (SolrDocumentList) masterQueryRsp.get("response"); + assertEquals(500, masterQueryResult.getNumFound()); + + //sleep for pollinterval time 3s, to let slave pull data. + Thread.sleep(3000); + //get docs from slave and check if number is equal to master + NamedList slaveQueryRsp = query("*:*", slaveClient); + SolrDocumentList slaveQueryResult = (SolrDocumentList) slaveQueryRsp.get("response"); + assertEquals(500, slaveQueryResult.getNumFound()); + + //compare results + String cmp = TestDistributedSearch.compare(masterQueryResult, slaveQueryResult, 0, null); + assertEquals(null, cmp); + + //start config files replication test + //clear master index + masterClient.deleteByQuery("*:*"); + masterClient.commit(); + + //change solrconfig on master + copyFile(new File("." + File.separator + + "solr" + File.separator + + "conf" + File.separator + "solrconfig-master1.xml"), + new File(master.getConfDir(), "solrconfig.xml")); + + //change schema on master + copyFile(new File("." + File.separator + + "solr" + File.separator + + "conf" + File.separator + "schema-replication2.xml"), + new File(master.getConfDir(), "schema.xml")); + + //keep a copy of the new schema + copyFile(new File("." + File.separator + + "solr" + File.separator + + "conf" + File.separator + "schema-replication2.xml"), + new File(master.getConfDir(), "schema-replication2.xml")); + + masterJetty.stop(); + + masterJetty = createJetty(master, 9999); + masterClient = createNewSolrServer(masterJetty.getLocalPort()); + + //add a doc with new field and commit on master to trigger snappull from slave. + index(masterClient, "id", "2000", "name", "name = " + 2000, "newname", "newname = " + 2000); + masterClient.commit(); + + //sleep for 3s for replication to happen. + Thread.sleep(3000); + + index(slaveClient, "id", "2000", "name", "name = " + 2001, "newname", "newname = " + 2001); + slaveClient.commit(); + + slaveQueryRsp = query("*:*", slaveClient); + SolrDocument d = ((SolrDocumentList) slaveQueryRsp.get("response")).get(0); + assertEquals("newname = 2001", (String) d.getFieldValue("newname")); + + } + void copyFile(File src, File dst) throws IOException { InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dst); @@ -193,29 +261,30 @@ public class TestReplicationHandler extends TestCase { } public String getHomeDir() { - return homeDir.toString() + System.getProperty("file.separator"); + return homeDir.toString(); } @Override public String getSchemaFile() { - return "." + System.getProperty("file.separator") + "solr" + System.getProperty("file.separator") + "conf" + System.getProperty("file.separator") + "schema-replication1.xml"; + return "." + File.separator + "solr" + File.separator + "conf" + File.separator + "schema-replication1.xml"; } public String getConfDir() { - return confDir.toString() + System.getProperty("file.separator"); + return confDir.toString(); } public String getDataDir() { - return dataDir.toString() + System.getProperty("file.separator"); + return dataDir.toString(); } @Override public String getSolrConfigFile() { String fname = ""; if (type == 1) - fname = "." + System.getProperty("file.separator") + "solr" + System.getProperty("file.separator") + "conf" + System.getProperty("file.separator") + "solrconfig-master.xml"; + fname = "." + File.separator + "solr" + File.separator + "conf" + File.separator + "solrconfig-master.xml"; if (type == 0) - fname = "." + System.getProperty("file.separator") + "solr" + System.getProperty("file.separator") + "conf" + System.getProperty("file.separator") + "solrconfig-slave.xml"; + fname = "." + File.separator + "solr" + File.separator + "conf" + File.separator + "solrconfig-slave.xml"; + System.out.println(fname); return fname; } @@ -224,18 +293,18 @@ public class TestReplicationHandler extends TestCase { System.setProperty("solr.test.sys.prop2", "proptwo"); String home = System.getProperty("java.io.tmpdir") - + System.getProperty("file.separator") - + getClass().getName() + "-" + System.currentTimeMillis() + System.getProperty("file.separator"); + + File.separator + + getClass().getName() + "-" + System.currentTimeMillis(); if (type == 1) { - homeDir = new File(home + "master" + System.getProperty("file.separator")); - dataDir = new File(home + "master" + System.getProperty("file.separator") + "data" + System.getProperty("file.separator")); - confDir = new File(home + "master" + System.getProperty("file.separator") + "conf" + System.getProperty("file.separator")); + homeDir = new File(home + "master"); + dataDir = new File(home + "master", "data"); + confDir = new File(home + "master", "conf"); } if (type == 0) { - homeDir = new File(home + "slave" + System.getProperty("file.separator")); - dataDir = new File(home + "slave" + System.getProperty("file.separator") + "data" + System.getProperty("file.separator")); - confDir = new File(home + "slave" + System.getProperty("file.separator") + "conf" + System.getProperty("file.separator")); + homeDir = new File(home + "slave"); + dataDir = new File(home + "slave", "data"); + confDir = new File(home + "slave", "conf"); } homeDir.mkdirs(); @@ -253,7 +322,4 @@ public class TestReplicationHandler extends TestCase { AbstractSolrTestCase.recurseDelete(homeDir); } } -} - - - +} \ No newline at end of file diff --git a/src/test/test-files/solr/conf/schema-replication1.xml b/src/test/test-files/solr/conf/schema-replication1.xml index 35bfff68daa..b8e205c2355 100644 --- a/src/test/test-files/solr/conf/schema-replication1.xml +++ b/src/test/test-files/solr/conf/schema-replication1.xml @@ -31,432 +31,19 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + + + - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text - id - - - - - - - - - - - - - - - - is there an echo? - + id diff --git a/src/test/test-files/solr/conf/schema-replication2.xml b/src/test/test-files/solr/conf/schema-replication2.xml index 964866b362e..548fb60174a 100644 --- a/src/test/test-files/solr/conf/schema-replication2.xml +++ b/src/test/test-files/solr/conf/schema-replication2.xml @@ -31,433 +31,22 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text - id - - - - - - - - - - - - - - - - is there an echo? - + id diff --git a/src/test/test-files/solr/conf/solrconfig-master.xml b/src/test/test-files/solr/conf/solrconfig-master.xml index c27bf15f755..ff634b25ee1 100644 --- a/src/test/test-files/solr/conf/solrconfig-master.xml +++ b/src/test/test-files/solr/conf/solrconfig-master.xml @@ -24,61 +24,19 @@ - - - ${solr.data.dir:./solr/data} - - false 10 - - - 32 2147483647 10000 1000 10000 - - false - - org.apache.lucene.index.LogByteSizeMergePolicy - - org.apache.lucene.index.ConcurrentMergeScheduler - 1000 10000 @@ -86,7 +44,6 @@ - false 10 32 @@ -97,201 +54,18 @@ - - - - - - - - - - - - 1024 - - - - - - - - - - - true - - - - - true - - 10 - - - - - - - - - - - - - - - - - - - - - - - - true - - - - 0.01 - - text^0.5 features_t^1.0 subject^1.4 title_stemmed^2.0 - - - text^0.2 features_t^1.1 subject^1.4 title_stemmed^2.0 title^1.5 - - - ord(weight)^0.5 recip(rord(iind),1,1000,1000)^0.3 - - - 3<-1 5<-2 6<90% - - 100 + true - + - commit - schema.xml,stopwords.txt - - - - - - *:* - 0.01 - - text^0.5 features_t^1.0 subject^1.4 title_stemmed^2.0 - - - text^0.2 features_t^1.1 subject^1.4 title_stemmed^2.0 title^1.5 - - - ord(weight)^0.5 recip(rord(iind),1,1000,1000)^0.3 - - - 3<-1 5<-2 6<90% - - 100 + commit + schema.xml - - 1000 - 1.4142135 - 12 - foo - - - sqrt 2 - log 10 - - - @@ -311,115 +85,14 @@ - - - false - - - - - - - - explicit - - - - - - - - lowerfilt - - - default - lowerfilt - spellchecker1 - true - - - - jarowinkler - lowerfilt - - org.apache.lucene.search.spell.JaroWinklerDistance - spellchecker2 - - - - solr.FileBasedSpellChecker - external - spellings.txt - UTF-8 - spellchecker3 - - - - - - - - - false - - false - - 1 - - - spellcheck - - - - - - - - 100 - - - - - - 70 - - - - - - - ]]> - ]]> - - - - + - - + + max-age=30, public - - solr - solrconfig.xml scheam.xml admin-extra.html - - - - prefix-${solr.test.sys.prop2}-suffix - - - - - - + \ No newline at end of file diff --git a/src/test/test-files/solr/conf/solrconfig-master1.xml b/src/test/test-files/solr/conf/solrconfig-master1.xml new file mode 100644 index 00000000000..90699643011 --- /dev/null +++ b/src/test/test-files/solr/conf/solrconfig-master1.xml @@ -0,0 +1,98 @@ + + + + + + + + + ${solr.data.dir:./solr/data} + + + false + 10 + 32 + 2147483647 + 10000 + 1000 + 10000 + false + + org.apache.lucene.index.ConcurrentMergeScheduler + 1000 + 10000 + + single + + + + false + 10 + 32 + 2147483647 + 10000 + + true + + + + + + + true + + + + + commit + schema-replication2.xml:schema.xml + + + + + + + 4 + true + text,name,subject,title,whitetok + + + + + + + 4 + true + text,name,subject,title,whitetok + + + + + + + + + + max-age=30, public + + + + diff --git a/src/test/test-files/solr/conf/solrconfig-slave.xml b/src/test/test-files/solr/conf/solrconfig-slave.xml index bc20deb5913..f6463b3d8f5 100644 --- a/src/test/test-files/solr/conf/solrconfig-slave.xml +++ b/src/test/test-files/solr/conf/solrconfig-slave.xml @@ -24,61 +24,17 @@ - - - ${solr.data.dir:./solr/data} - - false 10 - - - 32 2147483647 10000 1000 10000 - - false - - - org.apache.lucene.index.LogByteSizeMergePolicy - - - org.apache.lucene.index.ConcurrentMergeScheduler - 1000 10000 @@ -86,7 +42,6 @@ - false 10 32 @@ -97,193 +52,11 @@ - - - - - - - - - - - - 1024 - - - - - - - - - - - true - - - - - true - - 10 - - - - - - - - - - - - - - - - - - - - - - - - true + true - - - 0.01 - - text^0.5 features_t^1.0 subject^1.4 title_stemmed^2.0 - - - text^0.2 features_t^1.1 subject^1.4 title_stemmed^2.0 title^1.5 - - - ord(weight)^0.5 recip(rord(iind),1,1000,1000)^0.3 - - - 3<-1 5<-2 6<90% - - 100 - - - - *:* - 0.01 - - text^0.5 features_t^1.0 subject^1.4 title_stemmed^2.0 - - - text^0.2 features_t^1.1 subject^1.4 title_stemmed^2.0 title^1.5 - - - ord(weight)^0.5 recip(rord(iind),1,1000,1000)^0.3 - - - 3<-1 5<-2 6<90% - - 100 - - - - 1000 - 1.4142135 - 12 - foo - - - sqrt 2 - log 10 - - - @@ -303,123 +76,22 @@ - - - false - + - - - - - - explicit - - - - - - - - lowerfilt - - - default - lowerfilt - spellchecker1 - true - - - - jarowinkler - lowerfilt - - org.apache.lucene.search.spell.JaroWinklerDistance - spellchecker2 - - - - solr.FileBasedSpellChecker - external - spellings.txt - UTF-8 - spellchecker3 - - - - - - + - http://localhost:9999/solr/replication - 00:00:01 - - - - - - - - false - - false - - 1 + http://localhost:9999/solr/replication + 00:00:01 - - spellcheck - - - - - - 100 - - - - - - 70 - - - - - - - ]]> - ]]> - - - - - - + + max-age=30, public - - solr - solrconfig.xml scheam.xml admin-extra.html - - - - prefix-${solr.test.sys.prop2}-suffix - - - - -