Q: about sync gateway logs has `invalidates channels of xxxxx`

HI,
I post a json to to sg 4984 port, the json document and post command below:

json

 {
	"_id": "company1:doc11111",
	"channels": ["company1"],
	"className": "Company",
	"mobile": "13953128688",
	"pointName": "公司测试1",
	"pwd": "123456"
}

and curl command:

curl -X POST “http://company1:123456@localhost:4984/kitchen/” -H “accept: application/json” -H “Content-Type: application/json” -d “{ “_id”: “company1:doc11111”, “channels”: [“company1”], “className”: “Company”, “mobile”: “13953128688”, “pointName”: “公司测试1”, “pwd”: “123456”}”

sf code below:

function grantCompany(doc) {
    channel(doc.channels);
    access(CDD.companyUser, doc.channels);
}

the sf logs below:

2019-03-27T02:40:41.748Z [INF] CRUD: Doc “company1:doc11111” in channels “{company1}”
2019-03-27T02:40:41.748Z [INF] Access: Doc “company1:doc11111” grants channel access: map[company1:company1:159]
2019-03-27T02:40:41.748Z [INF] CRUD: Stored doc “company1:doc11111” / “1-ed5305231be018fb58cdde90b27ff314”
2019-03-27T02:40:41.748Z [INF] Access: Rev “company1:doc11111”/“1-ed5305231be018fb58cdde90b27ff314"invalidates channels of [company1]
2019-03-27T02:40:41.748Z [INF] Access: Invalidate access of "company1"
2019-03-27T02:40:41.749Z [INF] Cache: Received #159 after 0ms (“company1:doc11111” / “1-ed5305231be018fb58cdde90b27ff314”)
2019-03-27T02:40:41.749Z [INF] Cache: #159 ==> channel “company1”
2019-03-27T02:40:41.749Z [INF] Cache: #159 ==> channel “*”
2019-03-27T02:40:41.749Z [INF] Auth: Saved sync:user:company1: &{roleImpl:{Name:company1 ExplicitChannels_: Channels_: Sequence_:155 PreviousChannels_: vbNo:} userImplBody:{Email_: Disabled_:false PasswordHash_:[36 50 97 36 49 48 36 121 103 65 80 117 115 117 66 118 118 112 111 118 69 110 120 85 112 120 103 48 46 46 66 112 75 121 117 76 46 54 86 66 113 102 72 89 72 80 82 51 101 53 71 99 103 65 115 114 57 73 104 87] OldPasswordHash_: ExplicitRoles_: RolesSince_: OldExplicitRoles_:} auth:0xc4207671a0 roles:}
2019-03-27T02:40:41.749Z [INF] Cache: Received #155 (”_user/company1")
2019-03-27T02:40:41.793Z [INF] Access: Computed channels for “company1”: !:1,company1:159
2019-03-27T02:40:41.793Z [INF] HTTP+: #099: --> 200 (125.4 ms)
2019-03-27T02:40:41.794Z [INF] Cache: Received #155 ("_user/company1")

why the logs have invalidates channels of [company1] and Access: Invalidate access of "company1 prompt? It’s a message or a error?

best Regrades!

angular

{INF] means “info”, so it’s a message.
Do you see any related error marked as [ERR] or in error log file? You need to make sure there is a user created for this channel.

HI @eunice.huang,

thanks for your reply. no error marked in logs file.
I think this message means the sg need to clean the channels and access grant before creating a new revision, right?
every revision need assign the channels or roles channels; but access() is association sg user and channels, so if the association hasn’t changed, it will invoke once. Is my understanding correct?

Best Regrades!

angular

Yes, what you stated are correct, this invalidation only occurs when the set of access grants issued by a document changes. if rev 1 and rev 2 of a document were both doing access(“company1”), rev 2 wouldn’t trigger the ‘invalidate’ processing

HI @eunice.huang ,

I got it. thanks for your reply.

angular