mirror of https://github.com/apache/lucene.git
SOLR-10114: fix flakey TestRecovery
This commit is contained in:
parent
6cbda02663
commit
7a45f1015e
|
@ -292,10 +292,10 @@ public class TestRecovery extends SolrTestCaseJ4 {
|
|||
@Test
|
||||
public void testLogReplayWithReorderedDBQ() throws Exception {
|
||||
testLogReplayWithReorderedDBQWrapper(() -> {
|
||||
updateJ(jsonAdd(sdoc("id", "B1", "_version_", "1010")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
updateJ(jsonDelQ("id:B2"), params(DISTRIB_UPDATE_PARAM, FROM_LEADER, "_version_", "-1017")); // This should've arrived after the 1015th update
|
||||
updateJ(jsonAdd(sdoc("id", "B2", "_version_", "1015")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
updateJ(jsonAdd(sdoc("id", "B3", "_version_", "1020")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
updateJ(jsonAdd(sdoc("id", "RDBQ1_1", "_version_", "1010")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
updateJ(jsonDelQ("id:RDBQ1_2"), params(DISTRIB_UPDATE_PARAM, FROM_LEADER, "_version_", "-1017")); // This should've arrived after the 1015th update
|
||||
updateJ(jsonAdd(sdoc("id", "RDBQ1_2", "_version_", "1015")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
updateJ(jsonAdd(sdoc("id", "RDBQ1_3", "_version_", "1020")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
},
|
||||
() -> assertJQ(req("q", "*:*"), "/response/numFound==2")
|
||||
);
|
||||
|
@ -305,15 +305,15 @@ public class TestRecovery extends SolrTestCaseJ4 {
|
|||
public void testLogReplayWithReorderedDBQByAsterixAndChildDocs() throws Exception {
|
||||
testLogReplayWithReorderedDBQWrapper(() -> {
|
||||
// 1010 - will be deleted
|
||||
updateJ(jsonAdd(sdocWithChildren("B1", "1010")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
updateJ(jsonAdd(sdocWithChildren("RDBQ2_1", "1010")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
// 1018 - should be kept, including child docs
|
||||
updateJ(jsonAdd(sdocWithChildren("B2", "1018")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
updateJ(jsonAdd(sdocWithChildren("RDBQ2_2", "1018")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
// 1017 - delete should affect only 1010
|
||||
updateJ(jsonDelQ("id:*"), params(DISTRIB_UPDATE_PARAM, FROM_LEADER, "_version_", "-1017")); // This should've arrived after the 1015th update
|
||||
updateJ(jsonDelQ("_root_:RDBQ2_1 _root_:RDBQ2_2 id:RDBQ2_3 _root_:RDBQ2_4"), params(DISTRIB_UPDATE_PARAM, FROM_LEADER, "_version_", "-1017")); // This should've arrived after the 1015th update
|
||||
// 1012 - will be deleted
|
||||
updateJ(jsonAdd(sdoc("id", "B3", "_version_", "1012")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
updateJ(jsonAdd(sdoc("id", "RDBQ2_3", "_version_", "1012")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
// 1020 - should be untouched
|
||||
updateJ(jsonAdd(sdocWithChildren("B4", "1020")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
updateJ(jsonAdd(sdocWithChildren("RDBQ2_4", "1020")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
},
|
||||
() -> assertJQ(req("q", "*:*"), "/response/numFound==6")
|
||||
);
|
||||
|
@ -323,29 +323,29 @@ public class TestRecovery extends SolrTestCaseJ4 {
|
|||
public void testLogReplayWithReorderedDBQByIdAndChildDocs() throws Exception {
|
||||
testLogReplayWithReorderedDBQWrapper(() -> {
|
||||
// 1010 - will be deleted
|
||||
updateJ(jsonAdd(sdocWithChildren("B1", "1010")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
updateJ(jsonAdd(sdocWithChildren("RDBQ3_1", "1010")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
// 1018 - should be kept, including child docs
|
||||
updateJ(jsonAdd(sdocWithChildren("B2", "1018")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
updateJ(jsonAdd(sdocWithChildren("RDBQ3_2", "1018")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
// 1017 - delete should affect only 1010
|
||||
updateJ(jsonDelQ("id:B1 id:B2 id:B3 id:B4"), params(DISTRIB_UPDATE_PARAM, FROM_LEADER, "_version_", "-1017")); // This should've arrived after the 1015th update
|
||||
updateJ(jsonDelQ("id:RDBQ3_1 id:RDBQ3_2 id:RDBQ3_3 id:RDBQ3_4"), params(DISTRIB_UPDATE_PARAM, FROM_LEADER, "_version_", "-1017")); // This should've arrived after the 1015th update
|
||||
// 1012 - will be deleted
|
||||
updateJ(jsonAdd(sdoc("id", "B3", "_version_", "1012")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
updateJ(jsonAdd(sdoc("id", "RDBQ3_3", "_version_", "1012")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
// 1020 - should be untouched
|
||||
updateJ(jsonAdd(sdocWithChildren("B4", "1020")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
updateJ(jsonAdd(sdocWithChildren("RDBQ3_4", "1020")), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
},
|
||||
() -> assertJQ(req("q", "*:*"), "/response/numFound==8") // B2, B4 and 6 children docs (delete by id does not delete child docs)
|
||||
() -> assertJQ(req("q", "*:*"), "/response/numFound==8") // RDBQ3_2, RDBQ3_4 and 6 children docs (delete by id does not delete child docs)
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLogReplayWithReorderedDBQInsertingChildnodes() throws Exception {
|
||||
testLogReplayWithReorderedDBQWrapper(() -> {
|
||||
updateJ(jsonDelQ("id:B2"), params(DISTRIB_UPDATE_PARAM, FROM_LEADER, "_version_", "-1017"));
|
||||
updateJ(jsonDelQ("id:RDBQ4_2"), params(DISTRIB_UPDATE_PARAM, FROM_LEADER, "_version_", "-1017"));
|
||||
// test doc: B1
|
||||
// 1013 - will be inserted with 3 children
|
||||
updateJ(jsonAdd(sdocWithChildren("B1", "1013", 3)), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
updateJ(jsonAdd(sdocWithChildren("RDBQ4_1", "1013", 3)), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
},
|
||||
() -> assertJQ(req("q", "*:*"), "/response/numFound==4") // B1 and B2, plus 2x 3 children
|
||||
() -> assertJQ(req("q", "*:*"), "/response/numFound==4") // RDBQ4_1 and RDBQ4_2, plus 2x 3 children
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -355,17 +355,17 @@ public class TestRecovery extends SolrTestCaseJ4 {
|
|||
testLogReplayWithReorderedDBQWrapper(() -> {
|
||||
// control
|
||||
// 1013 - will be inserted with 3 children
|
||||
updateJ(jsonAdd(sdocWithChildren("B1", "1011", 2)), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
updateJ(jsonAdd(sdocWithChildren("RDBQ5_1", "1011", 2)), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
// 1018 - this should be the final
|
||||
updateJ(jsonAdd(sdocWithChildren("B1", "1012", 3)), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
updateJ(jsonAdd(sdocWithChildren("RDBQ5_1", "1012", 3)), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
|
||||
// 1013 - will be inserted with 3 children
|
||||
updateJ(jsonAdd(sdocWithChildren("B2", "1013", 2)), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
updateJ(jsonDelQ("id:B3"), params(DISTRIB_UPDATE_PARAM, FROM_LEADER, "_version_", "-1019"));
|
||||
updateJ(jsonAdd(sdocWithChildren("RDBQ5_2", "1013", 2)), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
updateJ(jsonDelQ("id:RDBQ5_3"), params(DISTRIB_UPDATE_PARAM, FROM_LEADER, "_version_", "-1019"));
|
||||
// 1018 - this should be the final
|
||||
updateJ(jsonAdd(sdocWithChildren("B2", "1018", 3)), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
updateJ(jsonAdd(sdocWithChildren("RDBQ5_2", "1018", 3)), params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
|
||||
},
|
||||
() -> assertJQ(req("q", "*:*"), "/response/numFound==8") // B1+3children+B2+3children
|
||||
() -> assertJQ(req("q", "*:*"), "/response/numFound==8") // RDBQ5_1+3children+RDBQ5_2+3children
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue