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

Query fails with No index available when Dynamic Index is available on the bucket

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Critical
    • 4.6.2, 5.0.0
    • 5.0.0
    • query
    • None
    • Build: 5.0.0-1884

      Cluster:
      Node 1: kv:index:n1ql

    Description

      Steps:
      1. Create and configure bucket
      2. Create and load bucket "simple_table_db_879_simple_table" with 1000 documents
      3. Create dynamic Index

      CREATE INDEX idx_simple_table_db_879_simple_table ON simple_table_db_879_simple_table(DISTINCT ARRAY v FOR v IN PAIRS(SELF) END)
      

      4. Query run:

      SELECT DISTINCT(char_field1) FROM  simple_table_db_879_simple_table   WHERE  (bool_field1 OR int_field1  IN [  5 , 35 , 45 , 47 , 107  ])    ORDER BY  char_field1
      
      

      Error observed:

      error 404 reason: unknown {
          "requestID": "33c2cac9-3b46-422c-88d1-b6670189e9fb",
          "errors": [
              {
                  "code": 4000,
                  "msg": "No index available on keyspace simple_table_db_879_simple_table that matches your query. Use CREATE INDEX or CREATE PRIMARY INDEX to create an index, or check that your expected index is online."
              }
          ],
          "status": "fatal",
          "metrics": {
              "elapsedTime": "3.992797ms",
              "executionTime": "3.971838ms",
              "resultCount": 0,
              "resultSize": 0,
              "errorCount": 1
          }
      }
      

      5. Error is returned in case, query is executed with USE INDEX syntax:

      SELECT DISTINCT(char_field1) FROM  simple_table_db_879_simple_table USE INDEX(idx_simple_table_db_879_simple_table)  WHERE  (bool_field1 OR int_field1  IN [  5 , 35 , 45 , 47 , 107  ])    ORDER BY  char_field1
      

      Error:

      [
        {
          "code": 4000,
          "msg": "No index available on keyspace simple_table_db_879_simple_table that matches your query. Use CREATE INDEX or CREATE PRIMARY INDEX to create an index, or check that your expected index is online.",
          "query_from_user": "SELECT DISTINCT(char_field1) FROM  simple_table_db_879_simple_table USE INDEX(idx_simple_table_db_879_simple_table)  WHERE  (bool_field1 OR int_field1  IN [  5 , 35 , 45 , 47 , 107  ])    ORDER BY  char_field1"
        }
      ]
      
      

      Few points:
      1. This is a part of RQG testing -
      testrunner logs: http://qa.sc.couchbase.com/job/cen006-n1ql-vset02-03-rqg-fields-only-simple-table-primary-secondary-tests/418/console
      2. There is no primary index available on the bucket.
      3. Logs: https://s3.amazonaws.com/bugdb/jira/dynamic_index/collectinfo-2017-02-06T113833-ns_1%40127.0.0.1.zip

      Attachments

        Issue Links

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

          Activity

            People

              prasanna.gholap Prasanna Gholap [X] (Inactive)
              prasanna.gholap Prasanna Gholap [X] (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty