[MDEV-5539] Empty results in UNION with Sphinx engine Created: 2014-01-18 Updated: 2015-01-06 Resolved: 2014-12-30 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - SphinxSE |
| Affects Version/s: | 5.3.12, 5.5.34, 10.0.7 |
| Fix Version/s: | 10.0.15 |
| Type: | Bug | Priority: | Major |
| Reporter: | Laurent Lafage | Assignee: | Unassigned |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | sphinx, upstream-fixed | ||
| Environment: |
Debian wheezy |
||
| Description |
|
Hello, We have a strange behaviour with a query with 2 UNION.
The first UNION returns 439 rows. As a result of this 2 UNION we have an empty set instead of 439 rows. If we move the last query in first position, it's ok, we have our 439 rows.
|
| Comments |
| Comment by Sergei Golubchik [ 2014-01-20 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Can you try to create a test case for this? I suppose, your database is too large, but, perhaps, you could repeat the bug on a smaller dataset? Or without SphinxSE at all? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Laurent Lafage [ 2014-01-20 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hello, Here is a generic test case if you use sphinxsearch: This query returns around 500 results:
if we invert the 2 WHERE clauses, we have an empty result, the following query will return an empty result:
Hope this will help. With best regards | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2014-01-28 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
To reproduce in MTR, put the following test case into suite/sphinx folder:
The first query returns an empty set, and the second one returns 4 rows. EXPLAINs:
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2014-02-14 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
It's a bug in Sphinx. It can only handle one sphinx-query per connection at any given point in time. But in this UNION query you have two. So MariaDB
So, instead of performing two different sphinx searches and merging the results, it only performs one — whichever happens to be the last. Why it worked in 5.2? Perhaps in 5.2 the execution sequence was different, and the server 1) prepared the first part of the UNION, 2) executed it, 3) prepared the second part of the UNION 4) executed it, etc. That would've worked in SphinxSE. And in 5.3 MariaDB first prepares all parts in a UNION, and then executes them all. That doesn't work very well in SphinxSE. Anyway, this fix seem to require big changes in SphinxSE, we cannot do it. Please, report this bug to Sphinx developers — when they fix it, we will merge a fixed version into MariaDB. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2014-11-16 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Both upstream (Sphinx) issues were fixed in 2.1.10. We currently have 2.1.9, the latest downloadable release at sphinxsearch is 2.2.6. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Michael Widenius [ 2014-12-30 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Serg upgraded sphinx to 2.2.6 in MariaDB 10.0, which fixed the issue. |