[ 
https://issues.apache.org/jira/browse/SOLR-10159?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15873373#comment-15873373
 ] 

Ishan Chattopadhyaya commented on SOLR-10159:
---------------------------------------------

Similarly, instead of all the changes in BufferedUpdatesStream, just changing
{{final Weight weight = searcher.createNormalizedWeight(query, false);}} to
{{final Weight weight = searcher.createNormalizedWeight(query, true);}}
also passes the test reliably. 

bq. My hunch is that this is a Lucene bug related to index sorting.
So, maybe this has nothing to do with Index sorting, but perhaps something to 
do with how BooleanQueries are processed?

[~mikemccand], [~shaie], [~hossman], does anything jump out to you? I shall 
continue to dig, but so far my attempts at writing a lucene level test to 
reproduce this have produced no results. (So far, this: 
https://paste.fedoraproject.org/paste/rAtcbOpqKFGJG57-lWQ58F5M1UNdIGYhyRLivL9gydE=/,
 but the test passes)

> DBQ, where query is based on updated value, reordered with the update doesn't 
> work
> ----------------------------------------------------------------------------------
>
>                 Key: SOLR-10159
>                 URL: https://issues.apache.org/jira/browse/SOLR-10159
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>            Reporter: Ishan Chattopadhyaya
>         Attachments: SOLR-10159.patch
>
>
> h2. Background/History
> If a recently updated (in-place) value is used for DBQ, the DBQ doesn't work 
> at Lucene level, unless there's an explicit commit between the update and the 
> DBQ, due to LUCENE-7344. To work around this, Yonik suggested that we use 
> ulog.openRealtimeSearcher() just before the DBQ is performed. This worked 
> fine.
> Example:
> {code}
> ADD: [id=0, dv=200, title="mytitle", _version_=100]
> UPD: [id=0, dv=300, _version_=200]
> DBQ: q="dv:300", _version_=300
> {code}
> h2. Problem discovered now
> Suppose, in the above example, the last two commands are reordered at the 
> replica. What would happen is: \(i\) the full document (\_version\_ 100) is 
> received and indexed, (ii) the DBQ is received (out of ordered) and applied, 
> and no document is deleted \[so far so good\] and this DBQ is buffered in 
> ulog.deleteByQueries map, (iii) the in-place update arrives (_version 200), 
> it is applied to the document that was added in step i. After that, the 
> buffered DBQ is applied (at DUH2.addAndDelete()). This buffered DBQ, based on 
> a value updated immediately before (step ii), fails to delete the document.
> h2. What happens exactly?
> The initial DBQ query is {{"dv:300"}}, but when it is applied, it is expanded 
> to {{"\+dv:\[300 TO 300\] -ConstantScore(frange(long(\_version\_)):\[300 TO 
> *\])"}}. In spite of doing a ulog.openRealtimeSearcher() just before the DBQ, 
> it doesn't work. 
> A different version of the query, i.e. {{"\+dv:\[300 TO 300\] 
> \+\_version\_:\[200 TO 200\]"}} also doesn't work. As I found out, *this 
> happened due to the presence of two clauses*! {{"\+dv:\[300 TO 300\]"}} 
> works, and so does {{"\+\_version\_:\[200 TO 200\]"}}, but both clauses don't 
> work together. Also, surprisingly, even {{"\+dv:\[300 TO 300\] \+dv:\[300 TO 
> 300\]"}} doesn't work (same clause repeated).
> h2. Investigation at Lucene level
> Upon some tedious investigation into the internals of Lucene, I discovered 
> that if I change the internal search (at BufferedUpdates) to use 
> Sort.RELEVANCE instead of Sort.INDEXORDER (which, I think is the default when 
> using weight/scorer), the DBQ is applied correctly.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to