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

ALTER INDEX for replica count never builds the index when executed from a query plan

    XMLWordPrintable

Details

    • Untriaged
    • 1
    • Unknown

    Description

      When using ALTER INDEX with "action": "replica_count" to add an index replica, i.e.:

      ALTER INDEX `def_inventory_hotel_url` ON `travel-sample`.`inventory`.`hotel` WITH {"action":"replica_count","num_replica":1}
      

      Typically, the newly added replica is automatically built and becomes ready. However, I was recently testing an upgrade of couchbase-index-manager to use the 4.x release of the NodeJS SDK. This version of the SDK, by default, executes queries with a prepared query plan. So a query plan is generated, and then the query plan is executed, rather than executing the queries directly.

      In this case, where a query plan is used, the replica is not being built automatically. It just remains in the "created" state in the UI. Additionally, attempting to use a BUILD INDEX command to build the index manually doesn't work because the primary replica is already built.

      The workaround, in the case of the NodeJS SDK, is to ensure that

      {adhoc: true}

      is passed with the ALTER INDEX query so it doesn't create a query plan and instead executes the query directly. However, this seems like something that may easily trip up others and a bug on the server side.

      Attachments

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

        Activity

          People

            amit.kulkarni Amit Kulkarni
            btburnett3 Brant Burnett
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes

                PagerDuty