weixin_39966644
weixin_39966644
2020-12-25 20:55

Sync Gateway delete not being sent on changes feed

From https://forums.couchbase.com/t/serious-delete-issue/13614 - in some cases a document being tombstoned through Sync Gateway isn't appearing on the changes feed. Need additional logging to dig into what's going on.

该提问来源于开源项目:couchbase/sync_gateway

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

4条回答

  • weixin_39936134 weixin_39936134 4月前

    We have had an active ticket with support on this issue for over 2 months. I can provide the ticket number if needed(We've uploaded multiple GB of logs at this point). What we ultimately see is that when the device requests the change it gets a 404 from the sync gateway with the logs looking something like this:

    
    8/9/2017 9:16 AM|Sync: Giving up on {DOCID-1601856 #2-722e63100efacb678892b0a8e784f56a}: CBLHTTP[404, "not_found"] 
    8/9/2017 9:16 AM|Sync: CBLRestPuller[https://URL:4984/mobile_gateway]: postProgressChanged (10/56, active=1 (batch=0, net=42), lastSeq=111379626, online=1, error=(null)) 
    8/9/2017 9:16 AM|Sync: CBLBulkDownloader[/mobile_gateway/_bulk_get]: Starting new document; ID="(null)" 
    8/9/2017 9:16 AM|Sync: CBLBulkDownloader[/mobile_gateway/_bulk_get]: Finished document 
    8/9/2017 9:16 AM|Sync: CBLMultipartDocumentReader[_id="(null)"]: Finished loading (0 attachments) 
    8/9/2017 9:16 AM|Sync: Giving up on {DOCID-1601857 #2-f54535da47b459261abd21df2d14d84d}: CBLHTTP[404, "not_found"] 
    

    which correspond to sync gateway errors that look like this: 2017-08-09T09:15:50.399-05:00 WARNING: Changes feed: error getting doc "DOCID"/"2-722e63100efacb678892b0a8e784f56a": 404 missing -- db.(Database).AddDocInstanceToChangeEntry() at changes.go:138 2017-08-09T09:15:50.400-05:00 WARNING: Changes feed: error getting doc "DOCID-1601857"/"2-f54535da47b459261abd21df2d14d84d": 404 missing -- db.(Database).AddDocInstanceToChangeEntry() at changes.go:138 2017-08-09T09:15:50.401-05:00 WARNING: Changes feed: error getting doc "DOCID"/"2-4ad1e930839ce9cc36f92a588ee764b8": 404 missing -- db.(*Database).AddDocInstanceToChangeEntry() at changes.go:138

    点赞 评论 复制链接分享
  • weixin_39966644 weixin_39966644 4月前

    The '404 missing' suggests that the revision in question actually doesn't exist in the revision tree (even as a tombstoned revision). Are you able to share the document metadata (_sync) for one of the documents raising an error in the Sync Gateway log, to help understand the state of the revision tree?

    点赞 评论 复制链接分享
  • weixin_39936134 weixin_39936134 4月前

    Sure, here's one.

    
    {
      "_deleted": false,
      "_sync": {
        "rev": "3-c5289857d947b305bd5b39d4c0dfb9f5",
        "sequence": 111383210,
        "recent_sequences": [
          111360069,
          111382986,
          111383210
        ],
        "history": {
          "revs": [
            "2-4ad1e930839ce9cc36f92a588ee764b8",
            "1-88c55d59bafa0aeea1bbb12449b8b387",
            "3-c5289857d947b305bd5b39d4c0dfb9f5"
          ],
          "parents": [
            1,
            -1,
            0
          ],
          "deleted": [
            0
          ],
          "channels": [
            null,
            [
              "env_77_GOLSOCEC",
              "env_77_schedule_16225"
            ],
            [
              "env_77_SANCHALE",
              "env_77_schedule_29521"
            ]
          ]
        },
        "channels": {
          "env_77_GOLSOCEC": {
            "seq": 111382986,
            "rev": "2-4ad1e930839ce9cc36f92a588ee764b8",
            "del": true
          },
          "env_77_SANCHALE": null,
          "env_77_schedule_16225": {
            "seq": 111382986,
            "rev": "2-4ad1e930839ce9cc36f92a588ee764b8",
            "del": true
          },
          "env_77_schedule_29521": null
        },
        "time_saved": "2017-08-09T09:03:21.2803134-05:00"
      },
      "channels": [
        "env_77_SANCHALE",
        "env_77_schedule_29521"
      ],
      "content": "Our document stuff",
      "keyid": 11781,
      "search": {
        "BeginDate": "2017-08-16T00:00:00"
      },
      "type": "CondensedSchedule"
    }
    
    点赞 评论 复制链接分享
  • weixin_39966644 weixin_39966644 4月前

    Potential steps to repro:

    1. Create doc rev-1 in channel A
    2. Tombstone doc (rev-2)
    3. Get doc, rev-2 as user with channel A access
    4. Resurrect doc (rev-3) in channel B
    5. Get doc, rev-2 as user with channel A access

    Steps 3 and 5 should return the same result, but in this case it sounds like it's not. (getting 404 missing in step 5)

    Potentially related to https://github.com/couchbase/sync_gateway/blob/master/db/crud.go#L436

    点赞 评论 复制链接分享

相关推荐