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

restoreIndexMetaData ignores the HTTP argument

    XMLWordPrintable

Details

    • Untriaged
    • Unknown

    Description

      Background

      This is related to MB-27766, where cbbackupmgr has a option to restore a backup to a different bucket to that of the original backup.

      /opt/couchbase/bin/cbbackupmgr restore --archive /home/vagrant/backup --repo example --include-buckets "oldBucket" -c couchbase://127.0.0.1 -u Administrator -p password --map-buckets "oldBucket=newBucket" 
      

      cbbackupmgr tries not to interfere with the payloads from the different services. It blindly stores them and restores with looking inside. When using restoring using the --map-buckets oldBucket=newBucket option cbbackupmgr correctly updates the restore end point with the newBucket name:

      2018-05-25T15:13:46.819+01:00 (Rest) POST http://localhost:9102/restoreIndexMetadata?bucket=newBucket 200   
      

      Problem
      The Indexer service ignores the HTTP argument and instead uses the payload which has the bucket name in it:

      {
        "code": "success",
        "result": {
          "metadata": [
            {
              "definitions": [
                {
                  "bucket": "default",
                  "bucketUUID": "05bcff2c652a6c4f70ab68e9030565f2",
                  "defnId": 9044945596029277024,
                  "exprType": "N1QL",
                  "isPrimary": true,
                  "name": "#primary",
                  "partitionScheme": "SINGLE",
                  "using": "memory_optimized"
                }
              ],
              "indexerId": "1266ceedb9c70c6fa52ee0ad1696cf9d",
              "nodeUUID": "1266ceedb9c70c6fa52ee0ad1696cf9d",
              "storageMode": "memory_optimized",
              "topologies": [
                {
                  "bucket": "default",
                  "definitions": [
                    {
                      "bucket": "default",
                      "defnId": 9044945596029277024,
                      "instances": [
                        {
                          "instId": 3805643820950338859,
                          "numPartitions": 1,
                          "partitions": [
                            {
                              "keyPartition": {},
                              "singlePartition": {
                                "slices": [
                                  {
                                    "indexerId": "1266ceedb9c70c6fa52ee0ad1696cf9d"
                                  }
                                ]
                              }
                            }
                          ],
                          "state": 4,
                          "steamId": 1,
                          "storageMode": "memory_optimized"
                        }
                      ],
                      "name": "#primary"
                    }
                  ],
                  "version": 5
                }
              ]
            }
          ]
        }
      }
      

      This means one of the following happens:

      • If the bucket does not exist an error is thrown:

        2018-05-25T16:19:48.408+01:00 (Rest) POST http://localhost:9102/restoreIndexMetadata?bucket=test 500
        

      • If the bucket does exist then an index is created wrongly on that bucket.

      Expectation

      Ideally I would like the payload to not include the bucket and the indexer service uses the HTTP argument as the source of true with regards to the bucket. This way cbbackupmgr keeps to the "design" of not messing with the payloads of any or all services.

      If that is not possible then an error should be throw if the HTTP argument and the bucket in the payload is different.

      Please note that if the 1st option is not possible then that put a requirement on parts of the payload format not changing i.e the bucket field.

      Attachments

        Issue Links

          For Gerrit Dashboard: MB-29843
          # Subject Branch Project Status CR V

          Activity

            People

              amit.kulkarni Amit Kulkarni
              pvarley Patrick Varley (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty