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

Eventing functions can't deploy with SGW on source bucket with read-write bucket alias

    XMLWordPrintable

Details

    • 1

    Description

      I did a fresh install of couchbase-server GA 6.6.5
      couchbase-server Enterprise Edition 6.6.5 build 10080

      made two BUCKETS: metadata and primary

      Did a fresh install of SGW 2.7.3-3

      systemctl start sync_gateway

      And I tested it out (made some docs in "primary") via sync_gateway

      All work is done as full admin or user Administrator

      I also set "allow_interbucket_recursion": true

      curl -s -X GET -u "$CB_USERNAME:$CB_PASSWORD" 'http://localhost:8091/_p/event/api/v1/config' | jq .
      {
        "enable_debugger": false,
        "ram_quota": 256
      }
      curl -s -X POST -u "$CB_USERNAME:$CB_PASSWORD" 'http://localhost:8091/_p/event/api/v1/config' -d '{ "allow_interbucket_recursion":true }' | jq .
      {
        "restart": false
      }
      curl -s -X GET -u "$CB_USERNAME:$CB_PASSWORD" 'http://localhost:8091/_p/event/api/v1/config' | jq .
      {
        "allow_interbucket_recursion": true,
        "enable_debugger": false,
        "ram_quota": 256
      }

      =======
      CASE: #1 CREATE  FUNCTION WORKS - Create any function in the UI with an initial "Bucket Alias" of "src_bkt" to "primary" in mode read-only

      In the Evneting landing page hit "ADD FUNCTION" and fill in 
          primary
          metadata
          test_issue_a_ro
          Everything
          [ binding : bucket alias ]
              src_bkt, primary, read-only

      I get code editor, no change
          "< back to Eventing"

      The function saves just fine as expected (see image: 1_test_issue_ro.PNG)

      The Function "test_issue_a_ro" will DEPLOY (and run) and UNDEPLOY just fine.

      Now when UNDEPLOYED go to settings and change the alias of src_bkt to mode "read and write" and save the altered settings.

      Now try to DEPLOY the function "test_issue_a_ro"

      The DEPLOY test_issue_a_ro (FAILS) despite setting "allow_interbucket_recursion": true - you will see the below pop-up on 6.6.5 (Note this works just fine on version 6.6.4)

      deploy failed: with popup message:

         

      {"code":52,"info":"SyncGateway is enabled on: primary, deployement      of source bucket mutating handler will cause Intra Bucket Recursion"}

      note deployment is misspelled in the message  ^^^^^

      =======================
      CASE: #2 CREATE  FUNCTION FAILS- Create any function in the UI with an initial "Bucket Alias" of "src_bkt" to "primary" in mode read and write

      ADD FUNCTION
          primary
          metadata
          test_issue_a_rw
          Everything
          [ binding : bucket alias ]
              src_bkt, primary, read-only

      A) I get code editor, no change
          "< back to Eventing"
          
      We see "..." for 15 seconds and then the Function disappears or auto deletes (no user error message or feedback happens the user is left baffled)

      =======================
      CASE: #3 CREATE  FUNCTION FAILS- Create any function in the UI with an initial "Bucket Alias" of "src_bkt" to "primary" in mode read and write

      ADD FUNCTION
          primary
          metadata
          test_issue_a_rw
          Everything
          [ binding : bucket alias ]
              src_bkt, primary, read-only

      Change the code and try to hit "SAVE" nothing happens you are stuck in the code editor (no user error message or feedback happens again the user is left baffled)

      =======================

      CASE: #1 CASE: #2 and CASE #3 all happen sync_gateway is running and even if I stop SGW via:

      systemctl stop sync_gateway

      But if I also flush the SGW bucket "primary" (with sync_gateway down of course)  CASE: #1, CASE: #2 and CASE #3 are fine and all work as expected.

      =======================

      OTHER:

      Now in 6.6.5 you CAN deploy your function with a "read and write" alias to the bucket "primary" shared with SGW with an empty sync_gateway bucket and then start sync_gateway and it appears to work fine

      • systemctl stop sync_gateway
      • FLUSH primary bucket 
      • DEPLOY test_issue_a_rw
      • systemctl start sync_gateway

      Obviously you can not do the above in production as you need to NUKE the sync_gateway bucket every time.

      Attachments

        Issue Links

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

          Activity

            People

              abhishek.jindal Abhishek Jindal
              jon.strabala Jon Strabala
              Votes:
              0 Vote for this issue
              Watchers:
              15 Start watching this issue

              Dates

                Created:
                Updated:

                PagerDuty