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

Using the couchbase-cli, cURL to import/deploy/export of a function will always reset the "worker_count" to 3

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • 6.5.0
    • 6.5.0
    • eventing
    • # /opt/couchbase/bin/couchbase-server -version
      Couchbase Server 6.5.0-4632 (EE)

      # uname -a
      Linux couch01 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2 (2019-08-28) x86_64 GNU/Linux
    • Untriaged
    • Unknown

    Description

      When working in the command line using the cURL to import/deploy/export an event handler the final export is wrong and the "worker_count" is always reset to the default of 3

      Details

      Set up eventing as per https://eventing-workshop.s3.amazonaws.com/Instructions.pdf then delete the function verifier and load the attached Eventing function in verifier_12.json which specifies 12 workers (instead of 3).  After the function is deployed and undeployed the workers will not export correctly and default down to  3.

      So we have no eventing functions lets look at our test function that will be imported

      # egrep 12 verifier_12.json\|worker_count
       "appname": "verifier_12",
       "worker_count": 12,
      

      Load our test function via the CLI

      # curl -X POST -s 'http://Administrator:password@localhost:8096/api/v1/functions/verifier_12' -d @verifier_12.json -H "Content-Type: application/json"
      {
       "code": 0,
       "info": {
        "status": "Stored function: 'verifier_12' in metakv",
        "warnings": null
       }
      

      Use the CLI and verify the number of workers (e.g. worker_count) (Optional use the GUI)

      # curl -X GET -s 'http://Administrator:password@localhost:8096/api/v1/functions/verifier_12' -H "Content-Type: application/json" | grep 12
       "appname": "verifier_12",
        "worker_count": 12,
      

      Deploy the function use CLI (optional use the GUI)

      #curl -X POST -d '\{"deployment_status":true,"processing_status":true}' -s 'http://Administrator:password@localhost:8096/api/v1/functions/verifier_12/settings'
      

      Verify the worker_count again via the CLI (optional use the GUI) once it is fully deployed the worker_count will drop from 12 to 3

      # curl -X GET -s 'http://Administrator:password@localhost:8096/api/v1/functions/verifier_12' -H "Content-Type: application/json" | egrep 12\|worker_count
       "appname": "verifier_12",
        "worker_count": 3,
      

      Export the full file and look at all the differences.

      # curl -X GET -s 'http://Administrator:password@localhost:8096/api/v1/functions/verifier_12' -H "Content-Type: application/json" --output verifier_12.json.bad
      # sdiff -s verifier_12.json verifier_12.json.bad
       "function_id": 337903247,                                    |  "function_id": 1043736880,
       "function_instance_id": "feLOE",                             |  "function_instance_id": "ce80L2",
        "deployment_status": false,                                 |   "deployment_status": true,
        "processing_status": false,                                 |   "processing_status": true,
        "worker_count": 12,                                         |   "worker_count": 3,
      }                       
      #
      

      If we undeply the differences will be as follows

      # curl -X GET -s 'http://Administrator:password@localhost:8096/api/v1/functions/verifier_12' -H "Content-Type: application/json" --output verifier_12.json.bad
      root@couch01:~/eventing# sdiff -s verifier_12.json verifier_12.json.bad
       "function_id": 337903247,                                    |  "function_id": 725647269,
       "function_instance_id": "feLOE",                             |  "function_instance_id": "xRS551",
        "worker_count": 12,                                         |   "worker_count": 3,
      }                                                             / }
      #
      

      Attachments

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

        Activity

          People

            suraj.naik Suraj Naik (Inactive)
            jon.strabala Jon Strabala
            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