Closed tleyden closed 10 years ago
This looks like issue #382 et al, awaiting merge onto master via PR #410
_changes on admin port does not take into account the sequence that a user was added to a channel.
Getting all changes for the same user gives:
curl -H "Cookie: SyncGatewaySession=ee4b47d48f1b5119aa790dfd2fe0828257e473dc" http://demo.mobile.couchbase.com/todolite/_changes
{"results":[
{"seq":"8:7","id":"18C310FC-0D24-46EB-A2EF-BEFE02EC22E3","changes":[{"rev":"1-44ef16838352ee93d81d8365927e2402"}]}
,{"seq":8,"id":"874F540A-4DAA-4D6E-A7A0-FB4F4D03F1AB","changes":[{"rev":"1-37087a35558bbdb4c6a605c996f82384"}]}
,{"seq":91,"id":"06F58A30-11AE-4B86-A1DF-4B9AF4FECFF8","changes":[{"rev":"1-fcdfd38d452b101fa7c75a61fc48b649"}]}
,{"seq":"93:26","id":"02DD6B67-B18D-4C1A-BB47-A6DC54783349","changes":[{"rev":"1-8d1df0451b1e84f0db0a874581204f11"}]}
,{"seq":"93:92","id":"19465EEC-ABDB-4623-805A-FB4A07B88066","changes":[{"rev":"1-cd0f8324573687d633d930ed2d9a0131"}]}
,{"seq":93,"id":"4048A3D6-4BE3-4F58-8DAA-55628D671EBE","changes":[{"rev":"2-f463eda31e8f64e4d7fa437580d8e58f"}]}
,{"seq":132,"id":"C3A3A193-01A8-46E6-B158-EA49409BF059","changes":[{"rev":"1-2e9c1b236b01f54af6e6e2a099d75201"}]}
,{"seq":138,"id":"21061a3a-ed3f-4164-a226-fe4b3ef81095","changes":[{"rev":"2-6041705e-3c25-40c5-bdb8-a0d1ce8545f7"}]}
,{"seq":"143:142","id":"44DAD79A-93B3-4B6B-A185-3232528565C6","changes":[{"rev":"37-32c83eca2622cca075ce5a0f6ec476d4"}]}
,{"seq":143,"id":"5FC3F014-5EEB-4CF0-859D-F047C3C7AC5F","changes":[{"rev":"2-d61110c3-e87f-40fd-b9aa-3b9df11dc227"}]}
,{"seq":144,"id":"69cdba03-1daa-4d28-ae27-66c36e1bf169","changes":[{"rev":"32-8879cbc5-2c0f-4f92-acd7-9f90e17eb77c"}]}
,{"seq":145,"id":"06c36e62-200c-4d49-acdf-be440db34f27","changes":[{"rev":"32-31405e6d-b022-4862-bf74-a40b5ac41b95"}]}
,{"seq":146,"id":"1254C6A7-B531-4F58-89B1-B526AD8D26DC","changes":[{"rev":"10-d7867f0b-9e95-4e3e-87d1-f4c79dae3c48"}]}
,{"seq":147,"id":"2ff66698-1990-4c02-be6b-8b30ee8f5d6f","changes":[{"rev":"2-a23ad798-cb2c-4892-8451-bac3237852d7"}]}
,{"seq":148,"id":"D4C20499-82AD-438A-99E4-E18772207BCB","changes":[{"rev":"11-be02870a-ce4d-490d-8c81-8c840f5ef930"}]}
,{"seq":149,"id":"df4f2f96-5088-4549-80d9-64f2fdd7a927","changes":[{"rev":"13-1353b02d-3423-4ea4-9fbd-07d563914b5f"}]}
,{"seq":150,"id":"C20716E7-E716-4C57-B162-F0DF3923196E","changes":[{"rev":"5-3c2b4d9b-d80a-4db1-8533-5bfed58b191b"}]}
,{"seq":151,"id":"71EF5798-AF9B-4506-9041-08AD8F70BC01","changes":[{"rev":"36-47d377ef-06e5-460e-9759-ce33b46f16c7"}]}
,{"seq":652,"id":"90B8FEDE-9ABE-4582-B2E8-06F89D9658B4","changes":[{"rev":"2-6dc93e50fe7efb1cbfd34bfa56968288"}]}
,{"seq":653,"id":"78C6BAC7-E7A3-48A0-B952-F782AA774ABE","changes":[{"rev":"1-07cde7a00c9cc160daf0b6f1bc5738c1"}]}
,{"seq":724,"id":"2822E84A-A7A3-42ED-ABA4-E48CD1986F5F","changes":[{"rev":"4-395489da1e162a7096e33960aa08eaaa"}]}
],
"last_seq":"724"}
Nothing past 724, so above would be correct, if this is correct.
Is there a way to see which sequence that user traun.leyden@gmail.com was added to a channel 5cbee5d4-3220-4cfe-a795-618310c27018?
That list object (5cbee5d4-3220-4cfe-a795-618310c27018) was created a long time ago, and my user has always had access to it.
There is this handler, but it says the channel does not exist.
curl -X GET http://172.23.105.3:4985/todolite/_dumpchannel/5cbee5d4-3220-4cfe-a795-618310c27018
If I retrieve the the use record it is not showing the user mapped to the list channel:
curl -X GET http://172.23.105.3:4985/todolite/_user/traun.leyden@gmail.com {"name":"traun.leyden@gmail.com","all_channels":["list-21061a3a-ed3f-4164-a226-fe4b3ef81095","list-4048A3D6-4BE3-4F58-8DAA-55628D671EBE","list-5FC3F014-5EEB-4CF0-859D-F047C3C7AC5F","list-874F540A-4DAA-4D6E-A7A0-FB4F4D03F1AB","list-90B8FEDE-9ABE-4582-B2E8-06F89D9658B4","list-C3A3A193-01A8-46E6-B158-EA49409BF059"],"email":"traun.leyden@gmail.com"}
So if this really should be mapped there is a pretty fundamental bug in the channel mapping code.
Do all the channel names begin with 'list-', I was using them without above
I'm pretty sure they should start with list. Maybe we should check that the sync function didn't get changed accidentally. Eg diff current vs prev config in gist.
Sync function is correct, it still prefixes list doc id with 'list-', but I did notice that one of the members mapped to the list does not have a user record in SG, I'm just writing a test to see that could cause the whole access operation to fail.
@ajres Here's another data point.
This is a list that I created, and you can see I'm the owner:
$ curl -X GET http://172.23.105.4:4985/todolite/C4803925-7369-437D-AEEC-D65508585A70
{"_id":"C4803925-7369-437D-AEEC-D65508585A70","_rev":"1-47a3dcf7ee176a76169d29aaf7279ca9","created_at":"2014-08-28T08:06:10.679Z","owner":"p:traun.leyden@gmail.com","title":"Tokyo Expenses","type":"list"}
However, if I try to dump the corresponding channel for that list, it says it doesn't exist:
$ curl -X GET http://172.23.105.3:4985/todolite/_dumpchannel/list-C4803925-7369-437D-AEEC-D65508585A70
{"error":"not_found","reason":"no such channel"}
also, when I look at my _session
endpoint, that list is not listed as a channel:
$ curl -H "Cookie: SyncGatewaySession=..." http://demo.mobile.couchbase.com/todolite/_session
{"authentication_handlers":["default","cookie"],"ok":true,"userCtx":{"channels":{"list-21061a3a-ed3f-4164-a226-fe4b3ef81095":138,"list-4048A3D6-4BE3-4F58-8DAA-55628D671EBE":93,"list-5FC3F014-5EEB-4CF0-859D-F047C3C7AC5F":143,"list-874F540A-4DAA-4D6E-A7A0-FB4F4D03F1AB":8,"list-90B8FEDE-9ABE-4582-B2E8-06F89D9658B4":652,"list-C3A3A193-01A8-46E6-B158-EA49409BF059":132},"name":"traun.leyden@gmail.com"}}
I sync'd the remote db to a local db via sg-replicate using this config (and local sync gw db with this config)
And now if I query for that same channel mentioned in https://github.com/couchbase/sync_gateway/issues/417#issuecomment-55028773, I'm getting a non-empty result:
$ curl http://localhost:4985/todolite-democluster/_dumpchannel/list-C4803925-7369-437D-AEEC-D65508585A70
<!DOCTYPE html><html><head><title>/todolite-democluster: “list-C4803925-7369-437D-AEEC-D65508585A70” Channel</title></head><body>
<h1>/todolite-democluster: “list-C4803925-7369-437D-AEEC-D65508585A70” Channel</h1><code>
<p>Since = 216</p>
<table border=1>
<tr><th>Seq</th><th>Doc</th><th>Rev</th><th>Flags</th></tr>
<tr><td>217</td><td>C4803925-7369-437D-AEEC-D65508585A70</td><td>1-47a3dcf7ee176a76169d29aaf7279ca9</td><td>00000000</td></tr>
<tr><td>238</td><td>A8D0D841-3180-4393-8ED4-325710635BCC</td><td>1-f08bf09045c02c31c0c5c6051697323b</td><td>00000000</td></tr>
<tr><td>259</td><td>1382CC57-329F-4E68-8429-996A63E3159A</td><td>4-f42e82d3be96e8552eb243c08ccfe710</td><td>00000000</td></tr>
...
Full result here
Also, when I used TodoLite-Android to sync the data from my local Sync Gateway -> TodoLite, I'm seeing all of the data I'm expecting to see.
and my user has access to a lot more channels:
$ curl -H "Cookie: SyncGatewaySession=..." http://localhost:4984/todolite-democluster/_session
{"authentication_handlers":["default","cookie"],"ok":true,"userCtx":{"channels":{"list-014a40bd-28c7-4ce0-8017-7fcdf5899c04":113,"list-072ed1b1-88ba-4578-b35a-23df674d1ae6":386,"list-0919487F-1D3D-41CE-88A0-C3F08BEFFF0D":141,"list-21061a3a-ed3f-4164-a226-fe4b3ef81095":122,"list-2F64892B-3545-4F54-90B5-82D60B7056FD":37,"list-36672C1D-C440-4D99-948D-6211373B4C58":287,"list-4048A3D6-4BE3-4F58-8DAA-55628D671EBE":100,"list-48F3E447-6273-4D70-9DF7-ED38121BFF2F":70,"list-4F09DD50-19FE-4628-854B-6560D985121F":51,"list-5BBC5B6C-DA19-4FF7-817B-73738AA8051E":80,"list-5FC3F014-5EEB-4CF0-859D-F047C3C7AC5F":135,"list-5cbee5d4-3220-4cfe-a795-618310c27018":49,"list-60AF295A-4F7B-4FE5-8FA1-332D5327A62F":140,"list-6408C01A-8E2F-4301-93FC-35047BEC73F4":274,"list-84DEC4C6-D287-4062-8C9B-5692A2CA8929":103,"list-84E0486A-62E4-475D-AF28-A9BFDE18E7CD":318,"list-874F540A-4DAA-4D6E-A7A0-FB4F4D03F1AB":20,"list-8f30f544-0d82-4048-aaa4-3fea452dac3b":26,"list-90B8FEDE-9ABE-4582-B2E8-06F89D9658B4":280,"list-978C0101-B06E-41D5-B6AD-ED797F700676":29,"list-9B7A92E0-3C47-4652-BAEA-04050EE19ACA":88,"list-A1CFDAF4-49DA-41FE-A236-79B64443529C":3,"list-BACE6FBE-EAEC-4BFD-AF05-DC25C20E0B41":265,"list-C3A3A193-01A8-46E6-B158-EA49409BF059":127,"list-C4803925-7369-437D-AEEC-D65508585A70":217,"list-C5DA6F23-1E9D-4110-8FB3-E5CB7DA3086D":50,"list-D035A08C-BC9B-4E26-99F6-7A9F626C0510":90,"list-E16E7307-C846-4767-A9F4-F773C999CB76":273,"list-FA595B82-9961-4AED-94C6-502D81137228":251,"list-d16c08c8-a0c1-4a19-a303-db85e7dcb003":72,"profiles":5},"name":"traun.leyden@gmail.com"}}
Closing this issue, it is linked from #419 and will be tracked there
Closing this bug as not reproducible. I think it may still be lurking, but we need some sort of test suite that can reliably reproduce it before it is actionable.
For my user (traun.leyden@gmail.com) .. I'm having problems syncing data I entered before that _facebook session issue came up.
Here's a specific document which isn't showing up in my _changes feed, and I believe it should.
As root, if I get the changes since 10751, I get these docs
If I look at the first doc in the results:
I can see it belongs to the list: 5cbee..
And if I look at that list:
I see that my user is listed as a member.
However, when I use my most recent cookie and query the _changes feed as my user, I get no results:
Is this a duplicate of an existing bug or is it something entirely new? Or is my user account somehow messed up?