shihchengwei-lab commented on PR #5391:
URL: https://github.com/apache/solr/pull/5391#issuecomment-7217646168
**Versioned DBQ replay deletes a newer child**
On `4889ce8059d4e4ba413c61b71ff529196d6c09f5`, I added this test to
`TestRecovery`. It uses the existing replay helper:
```java
@Test
public void testReplayOlderDbqAgainstNewerInPlaceChild() throws Exception {
testLogReplayWithReorderedDBQWrapper(
() -> {
updateJ(
jsonAdd(sdoc("id", "RDBQ8", "_version_", 1L, "kids",
sdocs(sdoc("id", "RDBQ8.0", "val_i_dvo", 1)))),
params(DISTRIB_UPDATE_PARAM, FROM_LEADER));
long childVersion =
addAndGetVersion(
sdoc("id", "RDBQ8.0", "_root_", "RDBQ8", "val_i_dvo",
map("set", 7)),
null);
assertTrue(childVersion > 2);
updateJ(
jsonDelQ("id:RDBQ8"),
params(DISTRIB_UPDATE_PARAM, FROM_LEADER, "_version_", "-2"));
},
() -> {
assertJQ(req("q", "id:RDBQ8.0"), "/response/numFound==1");
assertJQ(req("q", "id:RDBQ8"), "/response/numFound==1");
});
}
```
Run with `./gradlew :solr:core:test --tests
org.apache.solr.search.TestRecovery.testReplayOlderDbqAgainstNewerInPlaceChild`.
The child assertion fails: the query returns **0 documents instead of 1**,
although replay reports `errors=0`. In `DirectUpdateHandler2.getQuery()`, the
version filter applies before `WithDescendantsQuery` adds the child, so the
child's newer version does not protect it.
Could the version check also cover descendants, while retaining any
ancestors needed by a protected child?
AI assistance: AI helped review the code, design and run the reproduction,
and draft this comment.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]