Uploaded image for project: 'Couchbase Gateway'
  1. Couchbase Gateway
  2. CBG-1498

SG sent removed notification when the doc is still accessible via the other channel

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 3.0
    • 3.0
    • SyncGateway
    • Security Level: Public
    • None
    • CBG Sprint 75
    • 3

    Description

      Per discussion on slack that SG will only send both revoked and removed notifications in the changes message only when the document is no longer accessible by users. This seems to be working fine with the revoke cases but not for the removed cases. 

      Scenario:

      1. Create a document id = "userChannels" with 

      { "user": "user1", "userChannels": ["A", "B"] }

      2. Run a continuous push-pull replicator. Stop the replicator after IDLE.

      3. Create a document id = "doc" with

      { "channel": ["A", "B"] }

      4. Run the same continuous push-pull replicator. Stop the replicator after IDLE.

      5. Update document id = "doc" with

      { "channel": ["A"] }

      6. Run the same continuous push-pull replicator. Stop the replicator after IDLE. The doc is removed from channel B but it's still in channel A.

      The result in step 6 is that SG sent a notification that the doc is removed. The capture message is below:

      [[7,"doc","2-ff5bf9f59d844e8452f23c0eb6e55c877efd9c58",4]]

       

      Check all docs result from http://localhost:4984/db/_all_docs

      {"rows":[ {"key":"doc","id":"doc","value":{"rev":"2-ff5bf9f59d844e8452f23c0eb6e55c877efd9c58"}} ], "total_rows":1,"update_seq":7}
      

      SG Log:
      [https://gist.github.com/pasin/d602d3a43466b55d0e740663f8343e10

      ]SG Config:

      {
          "logging": {
              "console": {
                  "log_keys": [
                      "*"
                  ]
              }
          },
          "databases": {
              "db": {
                  "server": "walrus:",
                  "users": {
                      "user1": {
                          "password": "pass"
                      }
                  },
                  "sync":
                  `
                      function (doc, oldDoc) {
                          access(doc.user, doc.userChannels);
                          channel(doc.channels);
                  }
                  `
              }
          }
      }
      

      Attachments

        Activity

          People

            jacques.rascagneres Jacques Rascagneres
            pasin Pasin Suriyentrakorn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              PagerDuty