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

indexer is returning a document key even when no qualifying document exists.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 4.0.0
    • 4.0.0
    • secondary-index
    • Security Level: Public
    • Untriaged
    • Unknown

    Description

      In a composite index scenario, GSI index returns one qualified document even when no document qualifies for the specified keys.

      Query then retrieves the document, applies the filter and rejects the document.

      We should investigate why ONE document key qualifies for this predicate... Thanks.

      Repro scenario:
      – create and load beer-sample

      create index idx_beer_abv_id on `beer-sample`(style, abv, brewery_id);

      cbq> select abv, brewery_id from `beer-sample` where style = "Imperial or Double India Pale Ale" and abv = 100 and brewery_id = 49484;
      {
      "requestID": "e8ff8829-b476-493c-a10b-c601bb4e1e30",
      "signature":

      { "abv": "json", "brewery_id": "json" }

      ,
      "results": [
      ],
      "status": "success",
      "metrics":

      { "elapsedTime": "8.230323ms", "executionTime": "8.010973ms", "resultCount": 0, "resultSize": 0 }

      }

      -----------
      For this query, index should NOT return any qualified document.
      But, it does return ONE document key resulting in query fetching the doc from KV and applying the filter on it...

      _time=2015-07-14T14:21:19-07:00 _level=DEBUG _msg=Authenticating for keyspace beer-sample
      _time=2015-07-14T14:21:19-07:00 _level=DEBUG _msg= Authenticating for bucket beer-sample username beer-sample password
      _time=2015-07-14T14:21:19-07:00 _level=DEBUG _msg=Fetched 1 keys
      _time=2015-07-14T14:21:19-07:00 _level=TRACE _msg=Phase aggregates _id=9469b431-da74-46c9-996a-1daa3819f670 plan=2.122015ms parse=2.799979ms instantiate=177.92µs authorize=222.103µs scan=187ns fetch=540.306µs run=2.754862ms
      ----------

      cbq> explain select abv, brewery_id from `beer-sample` where style = "Imperial or Double India Pale Ale" and abv = 100 and brewery_id = 49484;
      {
      "requestID": "48a9c421-2408-488d-b628-e5fa1d4359c1",
      "signature": "json",
      "results": [
      {
      "#operator": "Sequence",
      "~children": [
      {
      "#operator": "IndexScan",
      "index": "idx_beer_abv_id",
      "keyspace": "beer-sample",
      "limit": 9.223372036854776e+18,
      "namespace": "default",
      "spans": [
      {
      "Range":

      { "High": [ "\"Imperial or Double India Pale Ale\"", "100", "49484" ], "Inclusion": 3, "Low": [ "\"Imperial or Double India Pale Ale\"", "100", "49484" ] }

      ,
      "Seek": null
      }
      ],
      "using": "gsi"
      },
      {
      "#operator": "Parallel",
      "~child": {
      "#operator": "Sequence",
      "~children": [

      { "#operator": "Fetch", "keyspace": "beer-sample", "namespace": "default" }

      ,

      { "#operator": "Filter", "condition": "((((`beer-sample`.`style`) = \"Imperial or Double India Pale Ale\") and ((`beer-sample`.`abv`) = 100)) and ((`beer-sample`.`brewery_id`) = 49484))" }

      ,
      {
      "#operator": "InitialProject",
      "result_terms": [

      { "expr": "(`beer-sample`.`abv`)" }

      ,

      { "expr": "(`beer-sample`.`brewery_id`)" }

      ]
      },

      { "#operator": "FinalProject" }

      ]
      }
      }
      ]
      }
      ],
      "status": "success",
      "metrics":

      { "elapsedTime": "6.814271ms", "executionTime": "6.586538ms", "resultCount": 1, "resultSize": 2563 }

      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sarath Sarath Lakshman
            keshav Keshav Murthy
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty