Details
-
Bug
-
Resolution: Fixed
-
Major
-
7.1.1
-
1
Description
Issue | Resolution |
A query with multiple filters on an index key, one of which was a parameter, could produce incorrect results. This was caused by incorrectly composing the exact index spans to support the query. | The way in which exact spans are set has been modified to correct this issue. |
This issue cropped up in Sync Gateway test environment, only when using docker image 7.1.1. It does not occur in 7.1.0 or 7.0.3.
I've created a golang application to demonstrate the issue here: https://github.com/torcolvin/limit711 which uses the state of the database from our test environment. Using ./run_7.1.1.sh will produce only 3 users from the query while ./run_7.1.0.sh produces the expected results.
- Running the same query in the workbench produces the expected 5 results
- After running the query in the workbench, the go program produce the expected results
- Using the go SDK, running EXPLAIN before making the query will return the expected 5 results
The query is
SELECT META(sgQueryKeyspaceAlias).id
|
FROM `sg_int_0`.`_default`.`_default` AS sgQueryKeyspaceAlias USE INDEX(sg_syncDocs_1)
|
WHERE META(sgQueryKeyspaceAlias).id LIKE '\\_sync:%'
|
AND (META(sgQueryKeyspaceAlias).id LIKE '\\_sync:user:%'
|
OR META(sgQueryKeyspaceAlias).id LIKE '\\_sync:role:%')
|
AND META(sgQueryKeyspaceAlias).id >= ''
|
ORDER BY META(sgQueryKeyspaceAlias).id
|
and the index is:
CREATE INDEX `sg_syncDocs_1` ON `sg_int_0`((meta().`id`)) WHERE ((meta().`id`) like "\\_sync:%") WITH { "defer_build":true }
|