From 7e6c8fa33b7c0831714a4b13fe394819b3352688 Mon Sep 17 00:00:00 2001 From: Yonik Seeley Date: Tue, 21 Feb 2012 15:07:39 +0000 Subject: [PATCH] tests: more reorder testing in peersync git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1291843 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/solr/update/PeerSyncTest.java | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/solr/core/src/test/org/apache/solr/update/PeerSyncTest.java b/solr/core/src/test/org/apache/solr/update/PeerSyncTest.java index 13dc55f8543..351395f5549 100644 --- a/solr/core/src/test/org/apache/solr/update/PeerSyncTest.java +++ b/solr/core/src/test/org/apache/solr/update/PeerSyncTest.java @@ -122,8 +122,6 @@ public class PeerSyncTest extends BaseDistributedSearchTestCase { assertSync(client1, numVersions, true, shardsArr[0]); client0.commit(); client1.commit(); queryAndCompare(params("q", "*:*", "sort","_version_ desc"), client0, client1); - - // test delete and deleteByQuery v=1000; add(client0, seenLeader, sdoc("id","1000","_version_",++v)); @@ -153,7 +151,31 @@ public class PeerSyncTest extends BaseDistributedSearchTestCase { add(client, seenLeader, sdoc("id","2002","_version_",++v)); del(client, params("leader","true","_version_",Long.toString(-++v)), "2000"); - // assertSync(client1, numVersions, true, shardsArr[0]); + assertSync(client1, numVersions, true, shardsArr[0]); + client0.commit(); client1.commit(); queryAndCompare(params("q", "*:*", "sort","_version_ desc"), client0, client1); + + + // + // Test that handling reorders work when applying docs retrieved from peer + // + + // this should cause us to retrieve the delete (but not the following add) + // the reorder in application shouldn't affect anything + add(client0, seenLeader, sdoc("id","3000","_version_",3001)); + add(client1, seenLeader, sdoc("id","3000","_version_",3001)); + del(client0, params("leader","true","_version_","3000"), "3000"); + + // this should cause us to retrieve an add tha was previously deleted + add(client0, seenLeader, sdoc("id","3001","_version_",3003)); + del(client0, params("leader","true","_version_","3001"), "3004"); + del(client1, params("leader","true","_version_","3001"), "3004"); + + // this should cause us to retrieve an older add that was overwritten + add(client0, seenLeader, sdoc("id","3002","_version_",3004)); + add(client0, seenLeader, sdoc("id","3002","_version_",3005)); + add(client1, seenLeader, sdoc("id","3002","_version_",3005)); + + assertSync(client1, numVersions, true, shardsArr[0]); client0.commit(); client1.commit(); queryAndCompare(params("q", "*:*", "sort","_version_ desc"), client0, client1); }