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

_changes with include_docs=true errors on _user pseudo docs

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.1.1
    • Fix Version/s: 2.5.0
    • Component/s: SyncGateway
    • Security Level: Public
    • Labels:
      None
    • Sprint:
      CBG Sprint 13, CBG Sprint 14
    • Story Points:
      3

      Description

      A user reported an issue we thought we'd fixed since SG 1.5, but is actually easily reproducible in at least 2.1.2, and Iridium.

      Forum post:

      GitHub Issues:

      GitHub PR for prior fix:

      Tasks

      1. Add a unit test for the steps below, and assert that we see no error
      2. Find out why these user documents have entry.pseudoDoc == false, when the above fix implies _user documents should be marked as pseudo docs.

      Steps to reproduce

      1. Create a new SG user
      2. Run a _changes request with include_docs=true
      3. See "400 Invalid doc ID" error message for _user doc

      Example log

      2019-02-12T14:43:15.150Z [INF] HTTP:  #001: POST /db/_user/ (as ADMIN)
      2019-02-12T14:43:15.150Z [TRC] Bucket: Update("_sync:user:alice1", 0, ...) --> Cancel update [2.809µs]
      2019-02-12T14:43:15.150Z [TRC] Bucket: ViewQuery("sync_gateway_2.1", "access", ...) [218.284µs]
      2019-02-12T14:43:15.150Z [INF] Access: Computed channels for "alice1": !:1
      2019-02-12T14:43:15.150Z [TRC] Bucket: ViewQuery("sync_gateway_2.1", "role_access", ...) [124.072µs]
      2019-02-12T14:43:15.150Z [INF] Access: Computed roles for "alice1": 
      2019-02-12T14:43:15.226Z [TRC] Bucket: Incr("_sync:seq", 1, 1, 0) [9.956µs]
      2019-02-12T14:43:15.226Z [TRC] Bucket: WriteCas("_sync:user:alice1", 0x0, 0, 0, ..., 0x0) [50.796µs]
      2019-02-12T14:43:15.226Z [DBG] Changes+: Notifying that "db" changed (keys="{_sync:user:alice1}") count=4
      2019-02-12T14:43:15.226Z [INF] Auth: Saved _sync:user:alice1: &{roleImpl:{Name_:alice1 ExplicitChannels_: Channels_:!:1 Sequence_:2 PreviousChannels_: vbNo:<nil> cas:6} userImplBody:{Email_: Disabled_:false PasswordHash_:[36 50 97 36 49 48 36 97 77 111 100 52 107 52 87 87 76 67 122 55 110 71 120 68 87 77 99 98 117 106 86 116 66 97 85 75 46 106 118 67 116 66 110 82 102 52 47 57 112 116 111 85 121 56 49 90 78 85 108 54] OldPasswordHash_:<nil> ExplicitRoles_: RolesSince_: OldExplicitRoles_:[]} auth:0xc000794330 roles:[]}
      2019-02-12T14:43:15.226Z [INF] HTTP+: #001:     --> 201 Created  (76.3 ms)
      2019-02-12T14:43:15.226Z [INF] Cache: Received #2 ("_user/alice1")
      2019-02-12T14:43:15.226Z [DBG] Cache+: Pruned 0 entries from channel "*"
      2019-02-12T14:43:15.226Z [INF] Cache: #2 ==> channels [*]
      2019-02-12T14:43:15.226Z [DBG] Changes+: Notifying that "db" changed (keys="{*}") count=5
       
       
       
      2019-02-12T14:43:34.704Z [INF] HTTP:  #004: POST /db/_changes?include_docs=true (as ADMIN)
      2019-02-12T14:43:34.705Z [DBG] Changes+: Changes POST request.  URL: /db/_changes?include_docs=true, feed: , options: {Since:0 Limit:0 Conflicts:false IncludeDocs:true Wait:false Continuous:false Terminator:<nil> HeartbeatMs:0 TimeoutMs:300000 ActiveOnly:false Ctx:<nil>}, filter: , bychannel: [], docIds: [] 
      2019-02-12T14:43:34.705Z [DBG] Changes+: c:#004 Int sequence multi changes feed...
      2019-02-12T14:43:34.705Z [INF] Changes: c:#004 MultiChangesFeed(channels: {*}, options: {Since:0 Limit:0 Conflicts:false IncludeDocs:true Wait:false Continuous:false Terminator:0xc00002c3c0 HeartbeatMs:0 TimeoutMs:300000 ActiveOnly:false Ctx:<nil>}) ... 
      2019-02-12T14:43:34.705Z [DBG] Changes+: c:#004 MultiChangesFeed: channels expand to "" ... 
      2019-02-12T14:43:34.705Z [INF] Cache: getCachedChanges("*", 0) --> 2 changes valid from #1
      2019-02-12T14:43:34.705Z [DBG] Changes+: c:#004 [changesFeed] Found 2 changes for channel *
      2019-02-12T14:43:34.705Z [DBG] Changes+: c:#004 Channel feed processing seq:1 in channel * 
      2019-02-12T14:43:34.705Z [DBG] Changes+: c:#004 Channel feed processing seq:2 in channel * 
      2019-02-12T14:43:34.705Z [WRN] c:#004 Changes feed: error getting revision body for "_user/admin" (): 400 Invalid doc ID -- db.(*Database).addDocToChangeEntry() at changes.go:127
      2019-02-12T14:43:34.705Z [DBG] Changes+: c:#004 MultiChangesFeed sending {Seq:1, ID:_user/admin, Changes:[map[rev:]]} 
      2019-02-12T14:43:34.705Z [WRN] c:#004 Changes feed: error getting revision body for "_user/alice1" (): 400 Invalid doc ID -- db.(*Database).addDocToChangeEntry() at changes.go:127
      2019-02-12T14:43:34.705Z [DBG] Changes+: c:#004 MultiChangesFeed sending {Seq:2, ID:_user/alice1, Changes:[map[rev:]]} 
      2019-02-12T14:43:34.705Z [INF] Changes: c:#004 MultiChangesFeed done 
      2019-02-12T14:43:34.705Z [INF] HTTP+: #004:     --> 200 OK  (0.3 ms)
      

        Attachments

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

          Activity

          Hide
          adamf Adam Fraser added a comment - - edited

          From some initial testing, it looks like this is only reproducible when running as admin.  The same request over the public port doesn't log the warning.  for changes feeds based on the star channel (admin, user with star channel access).   

          Show
          adamf Adam Fraser added a comment - - edited From some initial testing, it looks like this is only reproducible when running as admin.  The same request over the public port doesn't log the warning.   for changes feeds based on the star channel (admin, user with star channel access).   
          Hide
          adamf Adam Fraser added a comment -

          I don't believe the user/role changes entries should be getting included in star channel queries.  The log entries are only intended for sequence buffering, and the versions that are created by appendUserFeed are used to track user-driven backfills for the active user.  Neither of these require principal doc change entries to be included in star channel queries.  

          Show
          adamf Adam Fraser added a comment - I don't believe the user/role changes entries should be getting included in star channel queries.  The log entries are only intended for sequence buffering, and the versions that are created by appendUserFeed are used to track user-driven backfills for the active user.  Neither of these require principal doc change entries to be included in star channel queries.  
          Show
          adamf Adam Fraser added a comment - Fixed w/  https://github.com/couchbase/sync_gateway/pull/3988
          Hide
          daniel.petersen Daniel Petersen added a comment -

          Release is out. Closing.

          Show
          daniel.petersen Daniel Petersen added a comment - Release is out. Closing.
          Hide
          daniel.petersen Daniel Petersen added a comment -

          had to reopen to remove releasenote label

          Show
          daniel.petersen Daniel Petersen added a comment - had to reopen to remove releasenote label

            People

            • Assignee:
              adamf Adam Fraser
              Reporter:
              ben.brooks Ben Brooks
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Gerrit Reviews

                There are no open Gerrit changes

                  PagerDuty

                  Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.