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

incorrect error message on "build index" for an already built/online gsi index.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 4.0.0
    • 4.0.0
    • secondary-index
    • Security Level: Public
    • None
    • 400-1637
    • Untriaged
    • Unknown

    Description

      1. create index with defer_build=true - success
      cbq> CREATE INDEX ind2 ON default(SequenceNumber) USING GSI WITH `

      {"nodes": ["127.0.0.1:8091"], "defer_build": true}

      `;
      {
      "requestID": "0b2e42f0-aa11-4989-9f90-23536c135829",
      "signature": null,
      "results": [
      ],
      "status": "success",
      "metrics":

      { "elapsedTime": "88.194851ms", "executionTime": "87.418092ms", "resultCount": 0, "resultSize": 0 }

      }
      2. build index =-- success
      cbq> BUILD INDEX ON default(ind2) USING GSI;
      {
      "requestID": "275e2ffb-8dbf-476a-bb7b-948e026aa49c",
      "signature": null,
      "results": [
      ],
      "status": "success",
      "metrics":

      { "elapsedTime": "475.899839ms", "executionTime": "474.950418ms", "resultCount": 0, "resultSize": 0 }

      }

      3. select * from system:indexes – shows the index is online

      cbq> select * from system:indexes;
      ...

      {
      "indexes":

      { "datastore_id": "http://127.0.0.1:8091", "id": "4e91a5c226a8ca28", "index_key": [ "`SequenceNumber`" ], "keyspace_id": "default", "name": "ind2", "namespace_id": "default", "state": "online", "using": "gsi" }

      },
      4. accidentally issue build index again,the error message should be "index already online/built" or so, instead it displays the index is not in Ready state.

      cbq> BUILD INDEX ON default(ind2) USING GSI;
      {
      "requestID": "7cb10bf6-c117-4d8a-b902-71fdd782a493",
      "signature": null,
      "results": [
      ],
      "errors": [

      { "code": 5000, "msg": "BuildIndexes - cause: Index ind2 is not in READY state." }

      ],
      "status": "errors",
      "metrics":

      { "elapsedTime": "22.994577ms", "executionTime": "22.086024ms", "resultCount": 0, "resultSize": 0, "errorCount": 1 }

      }

      I assume this is a incorrect error and not actual state of index, since I get the right results on further queries using the same index. example below.
      cbq> explain select * from default where SequenceNumber=252;
      {
      "requestID": "6f2b5509-ff4d-451e-8a22-9c9bf0077f8a",
      "signature": "json",
      "results": [
      {
      "#operator": "Sequence",
      "~children": [
      {
      "#operator": "IndexScan",
      "index": "ind2",
      "keyspace": "default",
      "limit": 9.223372036854776e+18,
      "namespace": "default",
      "spans": [
      {
      "Range":

      { "High": [ "252.000001" ], "Inclusion": 1, "Low": [ "252" ] }

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

      { "#operator": "Fetch", "keyspace": "default", "namespace": "default" }

      ,

      { "#operator": "Filter", "condition": "((`default`.`SequenceNumber`) = 252)" }

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

      { "star": true }

      ]
      },

      { "#operator": "FinalProject" }

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

      { "elapsedTime": "73.602244ms", "executionTime": "72.807628ms", "resultCount": 1, "resultSize": 2022 }

      }

      Attachments

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

        Activity

          People

            jliang John Liang
            ketaki Ketaki Gangal (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty