[
https://issues.apache.org/jira/browse/SOLR-14971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17223746#comment-17223746
]
Jason Gerlowski commented on SOLR-14971:
----------------------------------------
It turns out this is a type problem, but not the one I guessed above. The
"existing document" values aren't Strings - they're Longs!
The code in question is the {{removeObj}} method here:
{code}
private void removeObj(@SuppressWarnings({"rawtypes"})Collection original,
Object toRemove, String fieldName) {
if(isChildDoc(toRemove)) {
removeChildDoc(original, (SolrInputDocument) toRemove);
} else {
original.remove(getNativeFieldValue(fieldName, toRemove));
}
}
{code}
When removing an int value, {{getNativeFieldValue}} is consistent in always
returning an integer. But the 'original' Collection of existing values has
different types depending on whether it was retrieved from the update log
(longs) or from the index (ints).
Java's Number classes declare {{equals()}} in such a way that a Long is never
equal to an Integer, even when the two represent the same numeric quantity. So
a type mismatch causes the {{remove}} attempt to fail when the existing doc is
retrieved from the tlog.
This cause has one upside - while it's like to affect int/long and
double/float, it seems specific to numerics and doesn't translate to other
types.
There's a couple ways we could address this:
# Make sure the tlog's SolrInputDocument has int values instead of longs where
appropriate.
# Special-case numeric values in {{AtomicUpdateDocumentMerger.removeObj}} and
add custom removal logic that handles the inconsistency in our input types.
Conceptually I like (1) much better - it'd be nice if the atomic-update code
(and anything else that pulls RTG values) didn't have to handle a bunch of
arbitrary variations in its input. But this is could be a big change and might
run afoul of whatever legitimate reasons there might be for storing the values
as Longs in the UpdateLog.
Anyway, I'll probably go with the admittedly-hackier custom logic approach,
despite not liking it. If anyone sees a better way forward though, please let
me know.
> AtomicUpdate 'remove' fails on 'pints' fields
> ---------------------------------------------
>
> Key: SOLR-14971
> URL: https://issues.apache.org/jira/browse/SOLR-14971
> Project: Solr
> Issue Type: Bug
> Security Level: Public(Default Security Level. Issues are Public)
> Components: update
> Affects Versions: 8.5.2
> Reporter: Jason Gerlowski
> Assignee: Jason Gerlowski
> Priority: Major
> Attachments: reproduce.sh
>
>
> The "remove" atomic update action on multivalued int fields fails if the
> document being changed is uncommitted.
> At first glance this appears to be a type-related issue.
> AtomicUpdateDocumentMerger attempts to handle multivalued int fields by
> processing the List<Integer> type, but in uncommitted docs int fields are
> still List<String> in the tlog. Conceptually this feels similar to
> SOLR-13331.
> It's likely this issue also affects other numeric and date fields.
> Attached is a simple script to reproduce, meant to be run from the root of a
> Solr install.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]