{"action":"created","issue":{"url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/728","labels_url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/728/labels{/name}","comments_url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/728/comments","events_url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/728/events","html_url":"https://github.com/couchbase/couchbase-lite-ios/issues/728","id":79084270,"number":728,"title":"Checkpoint ID shared by distinct pull replications","user":{"login":"nl","id":35510,"avatar_url":"https://avatars.githubusercontent.com/u/35510?v=3","gravatar_id":"","url":"https://api.github.com/users/nl","html_url":"https://github.com/nl","followers_url":"https://api.github.com/users/nl/followers","following_url":"https://api.github.com/users/nl/following{/other_user}","gists_url":"https://api.github.com/users/nl/gists{/gist_id}","starred_url":"https://api.github.com/users/nl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nl/subscriptions","organizations_url":"https://api.github.com/users/nl/orgs","repos_url":"https://api.github.com/users/nl/repos","events_url":"https://api.github.com/users/nl/events{/privacy}","received_events_url":"https://api.github.com/users/nl/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/labels/bug","name":"bug","color":"e11d21"},{"url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/labels/f:%20Replication","name":"f: Replication","color":"f8e100"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-05-21T17:08:55Z","updated_at":"2015-05-21T18:56:47Z","closed_at":null,"body":"I create a pull replication (`CBLReplication`) on a single database (`CBLDatabase`), and ask it to fetch a channel from a remote Sync Gateway (`replication.channels = @[ @\"A\" ]`). It fetches the documents from sequence 0 to sequence N, and stores the last sequence ID (N) under a hash that matches this replication's DNA. The replication stops.\r\n\r\nA minute later, I create a pull replication on that same database (and same remote URL), and ask it to fetch another set of channels (`replication.channels = @[ @\"A\", @\"B\" ]`).\r\n\r\nExpected behavior: the checkpoint ID for this new replication is different from the first replication.\r\nObserved behavior: the checkpoint IDs are identical\r\nBug: the replication reuses the 'since' parameter from the previous channel-A pull, and fails to get all documents in channel B whose sequence ID are less than N.\r\n\r\nSome logs right before calling `-start` on replications:\r\n``\r\nremoteCheckpointDocID = 4f1d55a06f4707736e263b2df7d55e533bd91ff5 | filterParameters = { channels = \"a\"; }\r\n``\r\n\r\nAnd later:\r\n``\r\nremoteCheckpointDocID = 4f1d55a06f4707736e263b2df7d55e533bd91ff5 | filterParameters = { channels = \"a,b\"; }\r\n``\r\n\r\nIf I use the `reset` option in all my replications, which forces the replication to use `since=0`, the channel-B-only seqID-less-than-N documents finally appear.\r\n\r\nAm I overlooking something? Or is this a major issue?"},"comment":{"url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/comments/104388512","html_url":"https://github.com/couchbase/couchbase-lite-ios/issues/728#issuecomment-104388512","issue_url":"https://api.github.com/repos/couchbase/couchbase-lite-ios/issues/728","id":104388512,"user":{"login":"nl","id":35510,"avatar_url":"https://avatars.githubusercontent.com/u/35510?v=3","gravatar_id":"","url":"https://api.github.com/users/nl","html_url":"https://github.com/nl","followers_url":"https://api.github.com/users/nl/followers","following_url":"https://api.github.com/users/nl/following{/other_user}","gists_url":"https://api.github.com/users/nl/gists{/gist_id}","starred_url":"https://api.github.com/users/nl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nl/subscriptions","organizations_url":"https://api.github.com/users/nl/orgs","repos_url":"https://api.github.com/users/nl/repos","events_url":"https://api.github.com/users/nl/events{/privacy}","received_events_url":"https://api.github.com/users/nl/received_events","type":"User","site_admin":false},"created_at":"2015-05-21T18:56:47Z","updated_at":"2015-05-21T18:56:47Z","body":"The replicator is asking for the remoteCheckpointDocID way before the filter can be set, at CBL_Replicator:123.\r\n\r\n``\r\n        _cookieStorage = [[CBLCookieStorage alloc] initWithDB: db\r\n                                                   storageKey: self.remoteCheckpointDocID];\r\n``"}}