tests: make sure dropped buffered docs don't interfere with new additions

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1292553 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2012-02-22 22:28:06 +00:00
parent 7568962777
commit 5d0f1c4f0e
1 changed files with 29 additions and 0 deletions

View File

@ -409,6 +409,35 @@ public class TestRecovery extends SolrTestCaseJ4 {
,"=={'versions':[206,205,201,200,105,104]}" ,"=={'versions':[206,205,201,200,105,104]}"
); );
ulog.bufferUpdates();
assertEquals(UpdateLog.State.BUFFERING, ulog.getState());
updateJ(jsonAdd(sdoc("id","C301", "_version_","998")), params(SEEN_LEADER,SEEN_LEADER_VAL));
updateJ(jsonAdd(sdoc("id","C302", "_version_","999")), params(SEEN_LEADER,SEEN_LEADER_VAL));
assertTrue(ulog.dropBufferedUpdates());
// make sure we can overwrite with a lower version
// TODO: is this functionality needed?
updateJ(jsonAdd(sdoc("id","C301", "_version_","301")), params(SEEN_LEADER,SEEN_LEADER_VAL));
updateJ(jsonAdd(sdoc("id","C302", "_version_","302")), params(SEEN_LEADER,SEEN_LEADER_VAL));
assertU(commit());
assertJQ(req("qt","/get", "getVersions","2")
,"=={'versions':[302,301]}"
);
assertJQ(req("q", "*:*", "sort","_version_ desc", "fl","id,_version_", "rows","2")
, "/response/docs==["
+ "{'id':'C302','_version_':302}"
+ ",{'id':'C301','_version_':301}"
+"]"
);
updateJ(jsonAdd(sdoc("id","C2", "_version_","302")), params(SEEN_LEADER,SEEN_LEADER_VAL));
assertEquals(UpdateLog.State.ACTIVE, ulog.getState()); // leave each test method in a good state assertEquals(UpdateLog.State.ACTIVE, ulog.getState()); // leave each test method in a good state
} finally { } finally {