mirror of https://github.com/apache/lucene.git
SOLR-3938: prepareCommit command omits commitData
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1402373 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a74ae3ab2a
commit
a6ea83ac30
|
@ -107,6 +107,9 @@ Bug Fixes
|
|||
* SOLR-3920: Fix server list caching in CloudSolrServer when using more than one
|
||||
collection list with the same instance. (Grzegorz Sobczyk, Mark Miller)
|
||||
|
||||
* SOLR-3938: prepareCommit command omits commitData causing a failure to trigger
|
||||
replication to slaves. (yonik)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -447,7 +447,11 @@ public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState
|
|||
log.info("start "+cmd);
|
||||
RefCounted<IndexWriter> iw = solrCoreState.getIndexWriter(core);
|
||||
try {
|
||||
iw.get().prepareCommit();
|
||||
final Map<String,String> commitData = new HashMap<String,String>();
|
||||
commitData.put(SolrIndexWriter.COMMIT_TIME_MSEC_KEY,
|
||||
String.valueOf(System.currentTimeMillis()));
|
||||
|
||||
iw.get().prepareCommit(commitData);
|
||||
} finally {
|
||||
iw.decref();
|
||||
}
|
||||
|
|
|
@ -522,6 +522,17 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
|
|||
for (int i = 0; i < nDocs; i++)
|
||||
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
|
||||
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();
|
||||
}
|
||||
|
||||
masterClient.commit();
|
||||
|
||||
NamedList masterQueryRsp = rQuery(nDocs, "*:*", masterClient);
|
||||
|
@ -529,10 +540,10 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
|
|||
assertEquals(nDocs, masterQueryResult.getNumFound());
|
||||
|
||||
// snappull
|
||||
String masterUrl = "http://127.0.0.1:" + slaveJetty.getLocalPort() + "/solr/replication?command=fetchindex&masterUrl=";
|
||||
masterUrl = "http://127.0.0.1:" + slaveJetty.getLocalPort() + "/solr/replication?command=fetchindex&masterUrl=";
|
||||
masterUrl += "http://127.0.0.1:" + masterJetty.getLocalPort() + "/solr/replication";
|
||||
URL url = new URL(masterUrl);
|
||||
InputStream stream = url.openStream();
|
||||
url = new URL(masterUrl);
|
||||
stream = url.openStream();
|
||||
try {
|
||||
stream.close();
|
||||
} catch (IOException e) {
|
||||
|
|
Loading…
Reference in New Issue