Uploaded image for project: 'Couchbase Server'
  1. Couchbase Server
  2. MB-56563

[BP to 7.1.5/7.2.1 MB-53903] - query regression using LIMIT keyword in 7.1.1



    • 1


      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 }


        1. cbcollect-7.1.0.zip
          2.51 MB
        2. cbcollect-7.1.0-1.zip
          2.52 MB
        3. cbcollect-7.1.1.zip
          2.56 MB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            pierre.regazzoni Pierre Regazzoni
            bingjie.miao Bingjie Miao
            0 Vote for this issue
            4 Start watching this issue



              Gerrit Reviews

                There are no open Gerrit changes