SOLR-6273: Cross Data Center Replication: Fix at least one test, un-Ignore tests

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1681839 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erick Erickson 2015-05-26 20:15:23 +00:00
parent a94d110aa4
commit f70464b15c
5 changed files with 27 additions and 3 deletions

View File

@ -80,6 +80,7 @@ import org.apache.solr.handler.ReplicationHandler.*;
import org.apache.solr.request.LocalSolrQueryRequest;
import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.search.SolrIndexSearcher;
import org.apache.solr.update.CdcrUpdateLog;
import org.apache.solr.update.CommitUpdateCommand;
import org.apache.solr.update.UpdateLog;
import org.apache.solr.util.DefaultSolrThreadFactory;
@ -808,7 +809,9 @@ public class IndexFetcher {
// this is called before copying the files to the original conf dir
// so that if there is an exception avoid corrupting the original files.
terminateAndWaitFsyncService();
((CdcrUpdateLog) ulog).reset(); // reset the update log before copying the new tlog directory
copyTmpTlogFiles2Tlog(tmpTlogDir, timestamp);
ulog.init(solrCore.getUpdateHandler(), solrCore); // re-initialise the update log with the new directory
} finally {
delTree(tmpTlogDir);
}

View File

@ -238,6 +238,30 @@ public class CdcrUpdateLog extends UpdateLog {
}
}
/**
* expert: Reset the update log before initialisation. This is needed by the IndexFetcher during a
* a Recovery operation in order to re-initialise the UpdateLog with a new set of tlog files.
*/
public void reset() {
synchronized (this) {
// Close readers
for (CdcrLogReader reader : new ArrayList<>(logPointers.keySet())) {
reader.close();
}
// Close and clear logs
for (TransactionLog log : logs) {
log.deleteOnClose = false;
log.decref();
log.forceClose();
}
logs.clear();
// reset lastDataDir for #init()
lastDataDir = null;
}
}
@Override
public void close(boolean committed, boolean deleteOnClose) {
for (CdcrLogReader reader : new ArrayList<>(logPointers.keySet())) {

View File

@ -27,7 +27,6 @@ import org.junit.Test;
import java.util.ArrayList;
import java.util.List;
@Ignore
@Slow
public class CdcrReplicationDistributedZkTest extends BaseCdcrDistributedZkTest {

View File

@ -32,7 +32,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Ignore
@Slow
public class CdcrReplicationHandlerTest extends BaseCdcrDistributedZkTest {

View File

@ -23,7 +23,6 @@ import org.apache.solr.handler.CdcrParams;
import org.junit.Ignore;
import org.junit.Test;
@Ignore
@Slow
public class CdcrRequestHandlerTest extends BaseCdcrDistributedZkTest {