You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by da...@apache.org on 2017/10/20 11:11:23 UTC
lucene-solr:master: SOLR-11452: Delay between open new searcher and
copy over updates can cause the test to fail.
Repository: lucene-solr
Updated Branches:
refs/heads/master f47221002 -> 32ed8520c
SOLR-11452: Delay between open new searcher and copy over updates can cause the test to fail.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/32ed8520
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/32ed8520
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/32ed8520
Branch: refs/heads/master
Commit: 32ed8520c706a865b94e03644ae4e4435e0f7d35
Parents: f472210
Author: Cao Manh Dat <da...@apache.org>
Authored: Fri Oct 20 18:11:13 2017 +0700
Committer: Cao Manh Dat <da...@apache.org>
Committed: Fri Oct 20 18:11:13 2017 +0700
----------------------------------------------------------------------
.../org/apache/solr/cloud/TestTlogReplica.java | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/32ed8520/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java b/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java
index c978a5f..b79ae73 100644
--- a/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java
+++ b/solr/core/src/test/org/apache/solr/cloud/TestTlogReplica.java
@@ -487,7 +487,16 @@ public class TestTlogReplica extends SolrCloudTestCase {
.commit(cloudClient, collectionName);
waitForNumDocsInAllActiveReplicas(2);
- assertCopyOverOldUpdates(1, timeCopyOverPerCores);
+ // There are a small delay between new searcher and copy over old updates operation
+ TimeOut timeOut = new TimeOut(5, TimeUnit.SECONDS);
+ while (!timeOut.hasTimedOut()) {
+ if (assertCopyOverOldUpdates(1, timeCopyOverPerCores)) {
+ break;
+ } else {
+ Thread.sleep(500);
+ }
+ }
+ assertTrue("Expect only one copy over updates per cores", assertCopyOverOldUpdates(1, timeCopyOverPerCores));
boolean firstCommit = true;
// UpdateLog copy over old updates
@@ -498,7 +507,7 @@ public class TestTlogReplica extends SolrCloudTestCase {
// because tlog replicas periodically ask leader for new segments,
// therefore the copy over old updates action must not be triggered until
// tlog replicas actually get new segments
- assertCopyOverOldUpdates(1, timeCopyOverPerCores);
+ assertTrue("Expect only one copy over updates per cores", assertCopyOverOldUpdates(1, timeCopyOverPerCores));
firstCommit = false;
}
cloudClient.commit(collectionName);
@@ -911,10 +920,11 @@ public class TestTlogReplica extends SolrCloudTestCase {
}
- private void assertCopyOverOldUpdates(long delta, Map<SolrCore, Long> timesPerCore) {
+ private boolean assertCopyOverOldUpdates(long delta, Map<SolrCore, Long> timesPerCore) {
for (SolrCore core : timesPerCore.keySet()) {
- assertEquals(timesPerCore.get(core) + delta, getTimesCopyOverOldUpdates(core));
+ if (timesPerCore.get(core) + delta != getTimesCopyOverOldUpdates(core)) return false;
}
+ return true;
}
private Map<SolrCore, Long> getTimesCopyOverOldUpdates(List<SolrCore> cores) {