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 2018/12/10 04:56:24 UTC
[2/3] lucene-solr:branch_7x: SOLR-12801: Try to harden
TestReplicatinHandler#doTestIndexFetchOnMasterRestart.
SOLR-12801: Try to harden TestReplicatinHandler#doTestIndexFetchOnMasterRestart.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/77bf9cd3
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/77bf9cd3
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/77bf9cd3
Branch: refs/heads/branch_7x
Commit: 77bf9cd3f98ce355acc4ac2027fcd27777cb32ea
Parents: 815f26d
Author: markrmiller <ma...@apache.org>
Authored: Sun Dec 9 22:18:37 2018 -0600
Committer: markrmiller <ma...@apache.org>
Committed: Sun Dec 9 22:18:59 2018 -0600
----------------------------------------------------------------------
.../solr/handler/TestReplicationHandler.java | 27 ++++++++++++++------
1 file changed, 19 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/77bf9cd3/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
----------------------------------------------------------------------
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 92304a0..318afc0 100644
--- a/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
+++ b/solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java
@@ -665,14 +665,23 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
String cmp = BaseDistributedSearchTestCase.compare(masterQueryResult, slaveQueryResult, 0, null);
assertEquals(null, cmp);
- int timesReplicated = Integer.parseInt(getSlaveDetails("timesIndexReplicated"));
- String timesFailed = getSlaveDetails("timesFailed");
- if (null == timesFailed) {
+ String timesReplicatedString = getSlaveDetails("timesIndexReplicated");
+ String timesFailed;
+ Integer previousTimesFailed = null;
+ if (timesReplicatedString == null) {
timesFailed = "0";
+ } else {
+ int timesReplicated = Integer.parseInt(timesReplicatedString);
+ timesFailed = getSlaveDetails("timesFailed");
+ if (null == timesFailed) {
+ timesFailed = "0";
+ }
+
+ previousTimesFailed = Integer.parseInt(timesFailed);
+ // Sometimes replication will fail because master's core is still loading; make sure there was one success
+ assertEquals(1, timesReplicated - previousTimesFailed);
+
}
- int previousTimesFailed = Integer.parseInt(timesFailed);
- // Sometimes replication will fail because master's core is still loading; make sure there was one success
- assertEquals(1, timesReplicated - previousTimesFailed);
masterJetty.stop();
@@ -690,7 +699,9 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
assertEquals(nDocs, numFound(slaveQueryRsp));
int failed = Integer.parseInt(getSlaveDetails("timesFailed"));
- assertTrue(failed > previousTimesFailed);
+ if (previousTimesFailed != null) {
+ assertTrue(failed > previousTimesFailed);
+ }
assertEquals(1, Integer.parseInt(getSlaveDetails("timesIndexReplicated")) - failed);
} finally {
resetFactory();
@@ -702,7 +713,7 @@ public class TestReplicationHandler extends SolrTestCaseJ4 {
params.set(CommonParams.QT, "/replication");
params.set("command", "details");
QueryResponse response = slaveClient.query(params);
- System.out.println("SHALIN: " + response.getResponse());
+
// details/slave/timesIndexReplicated
NamedList<Object> details = (NamedList<Object>) response.getResponse().get("details");
NamedList<Object> slave = (NamedList<Object>) details.get("slave");