You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by yo...@apache.org on 2012/01/11 23:45:33 UTC
svn commit: r1230301 -
/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/update/PeerSyncTest.java
Author: yonik
Date: Wed Jan 11 22:45:32 2012
New Revision: 1230301
URL: http://svn.apache.org/viewvc?rev=1230301&view=rev
Log:
tests: more peer sync tests
Modified:
lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/update/PeerSyncTest.java
Modified: lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/update/PeerSyncTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/update/PeerSyncTest.java?rev=1230301&r1=1230300&r2=1230301&view=diff
==============================================================================
--- lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/update/PeerSyncTest.java (original)
+++ lucene/dev/branches/solrcloud/solr/core/src/test/org/apache/solr/update/PeerSyncTest.java Wed Jan 11 22:45:32 2012
@@ -83,25 +83,46 @@ public class PeerSyncTest extends BaseDi
assertSync(client1, numVersions, true, shardsArr[0]);
// TODO: test that updates weren't necessary
-/**
- assertSync(client1, numVersions, true, shardsArr[0]);
- client0.commit();
- client1.commit();
- queryAndCompare(params("q", "*:*"), client0, client1);
+ client0.commit(); client1.commit(); queryAndCompare(params("q", "*:*"), client0, client1);
- for (int i=0; i<numVersions; i++) {
+ add(client0, seenLeader, addRandFields(sdoc("id","2","_version_",++v)));
- }
+ // now client1 has the context to sync
+ assertSync(client1, numVersions, true, shardsArr[0]);
+
+ client0.commit(); client1.commit(); queryAndCompare(params("q", "*:*"), client0, client1);
+
+ add(client0, seenLeader, addRandFields(sdoc("id","3","_version_",++v)));
+ add(client0, seenLeader, addRandFields(sdoc("id","4","_version_",++v)));
+ add(client0, seenLeader, addRandFields(sdoc("id","5","_version_",++v)));
+ add(client0, seenLeader, addRandFields(sdoc("id","6","_version_",++v)));
+ add(client0, seenLeader, addRandFields(sdoc("id","7","_version_",++v)));
+ add(client0, seenLeader, addRandFields(sdoc("id","8","_version_",++v)));
+ add(client0, seenLeader, addRandFields(sdoc("id","9","_version_",++v)));
+ add(client0, seenLeader, addRandFields(sdoc("id","10","_version_",++v)));
+
+ assertSync(client1, numVersions, true, shardsArr[0]);
+ client0.commit(); client1.commit(); queryAndCompare(params("q", "*:*"), client0, client1);
- * client0.add(addRandFields(sdoc("id",1)));
+ int toAdd = (int)(numVersions *.95);
+ for (int i=0; i<toAdd; i++) {
+ add(client0, seenLeader, sdoc("id",Integer.toString(i+11),"_version_",v+i+1));
+ }
- client0.add(addRandFields(sdoc("id",1)));
- client0.add(addRandFields(sdoc("id", 1)));
- client0.add(addRandFields(sdoc("id", 2)));
- **/
+ // sync should fail since there's not enough overlap to give us confidence
+ assertSync(client1, numVersions, false, shardsArr[0]);
+ // add some of the docs that were missing... just enough to give enough overlap
+ int toAdd2 = (int)(numVersions * .25);
+ for (int i=0; i<toAdd2; i++) {
+ add(client1, seenLeader, sdoc("id",Integer.toString(i+11),"_version_",v+i+1));
+ }
+
+ assertSync(client1, numVersions, true, shardsArr[0]);
+ client0.commit(); client1.commit(); queryAndCompare(params("q", "*:*", "sort","_version_ desc"), client0, client1);
+ v+= toAdd;
}