Hi all,
Facing issues with delete by ID in Solr 5.5.5 (but it looks like it
affects version as high as 7.5.x and possibly newer). Collection uses
composite router with routing field set to field *other than* unique key.
In the above set-up the SolrJ .deleteByQuery works fine albeit is very
slow (high load, large index, etc). However the .deleteById is not
working correctly. The delete by ID, even when "route" param is provided
yields: "missing _version_ on update from leader".
That does correlate with https://issues.apache.org/jira/browse/SOLR-7384.
In the org.apache.solr.cloud.FullSolrCloudDistribCmdsTest (5.5.5 release
tag)
these tests are commented out:
// See SOLR-7384
// testDeleteByIdImplicitRouter();
// testDeleteByIdCompositeRouterWithRouterField();
I followed suggestion from
https://issues.apache.org/jira/browse/SOLR-12694 and arrived at this in:
org.apache.solr.client.solrj.request.JavaBinUpdateRequestCodec (starting
from line #220)
if (params != null) {
Long version = getVersion(params);
if (params.containsKey(UpdateRequest.ROUTE)) {
// WAS updateRequest.deleteById(entry.getKey(), (String)
params.get(UpdateRequest.ROUTE));
updateRequest.deleteById(entry.getKey(), (String)
params.get(UpdateRequest.ROUTE), version);
} else {
updateRequest.deleteById(entry.getKey(), version);
}
} else {
updateRequest.deleteById(entry.getKey());
}
With the above, by setting version on deserialized UpdateRequest the
previously commented out tests pass once again.
Now, the question is: *Is this correct approach?*
If I am reading this correctly, this change means that the version
deleted on the leader is passed to the replicas. But should it? Is the
version always consistent between leader and replica (except for out of
sync state)?
Thanks,
Jaroslaw
--
Jaroslaw Rozanski | e: m...@jarekrozanski.eu