{"action":"created","issue":{"url":"https://api.github.com/repos/share/sharedb/issues/33","labels_url":"https://api.github.com/repos/share/sharedb/issues/33/labels{/name}","comments_url":"https://api.github.com/repos/share/sharedb/issues/33/comments","events_url":"https://api.github.com/repos/share/sharedb/issues/33/events","html_url":"https://github.com/share/sharedb/pull/33","id":46184926,"number":33,"title":"Support expiring ops from oplog","user":{"login":"devongovett","id":19409,"avatar_url":"https://avatars.githubusercontent.com/u/19409?v=3","gravatar_id":"","url":"https://api.github.com/users/devongovett","html_url":"https://github.com/devongovett","followers_url":"https://api.github.com/users/devongovett/followers","following_url":"https://api.github.com/users/devongovett/following{/other_user}","gists_url":"https://api.github.com/users/devongovett/gists{/gist_id}","starred_url":"https://api.github.com/users/devongovett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devongovett/subscriptions","organizations_url":"https://api.github.com/users/devongovett/orgs","repos_url":"https://api.github.com/users/devongovett/repos","events_url":"https://api.github.com/users/devongovett/events{/privacy}","received_events_url":"https://api.github.com/users/devongovett/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":18,"created_at":"2014-10-18T19:25:03Z","updated_at":"2015-10-11T05:39:37Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/share/sharedb/pulls/33","html_url":"https://github.com/share/sharedb/pull/33","diff_url":"https://github.com/share/sharedb/pull/33.diff","patch_url":"https://github.com/share/sharedb/pull/33.patch"},"body":"This goes along with https://github.com/share/livedb-mongo/pull/12.  It handles emitting `Missing operations` errors when operations requested from the oplog are not there.  This happens in `submit` and `getOps` (and by extension `fetch`, since it calls `getOps`).\r\n\r\nThis error should occur if a client has been offline longer than the ttl and tries to submit/fetch some ops.  It should only occur if other edits have taken place while the user was offline, which have also expired.  Specifically:\r\n\r\n1. user 1 goes offline\r\n2. user 1 edits\r\n3. user 2 edits\r\n4. ops are dropped (user 2’s ops expire)\r\n5. user 1 comes back online and submits its ops\r\n6. ERROR\r\n\r\nIf 3 and 4 are swapped (i.e. user 2 doesn’t edit anything before the ops are dropped), the error shouldn't occur. Basically, it should be fairly rare.\r\n\r\nWhen the error happens, ShareJS sends it back to the client, which has an opportunity to notify the user that their changes could not be merged.  Not ideal, but necessary to keep the data size in mongo from growing forever.\r\n\r\nOne case I thought of but I'm not sure about is whether we need to get the snapshot version in `getOps` when `to` is null to determine whether ops are expected from the oplog.  Right now, the check for missing operations only occurs when there are ops returned (check `ops[0].v === from`).  If `to` is null, we may also need to check if ops were expected if `from < snapshot.v`, which means fetching the snapshot there.  I don't really like that, but it may be necessary.  In `submit` this is handled already.  What do you think?"},"comment":{"url":"https://api.github.com/repos/share/sharedb/issues/comments/147160199","html_url":"https://github.com/share/sharedb/pull/33#issuecomment-147160199","issue_url":"https://api.github.com/repos/share/sharedb/issues/33","id":147160199,"user":{"login":"nmai","id":4383203,"avatar_url":"https://avatars.githubusercontent.com/u/4383203?v=3","gravatar_id":"","url":"https://api.github.com/users/nmai","html_url":"https://github.com/nmai","followers_url":"https://api.github.com/users/nmai/followers","following_url":"https://api.github.com/users/nmai/following{/other_user}","gists_url":"https://api.github.com/users/nmai/gists{/gist_id}","starred_url":"https://api.github.com/users/nmai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nmai/subscriptions","organizations_url":"https://api.github.com/users/nmai/orgs","repos_url":"https://api.github.com/users/nmai/repos","events_url":"https://api.github.com/users/nmai/events{/privacy}","received_events_url":"https://api.github.com/users/nmai/received_events","type":"User","site_admin":false},"created_at":"2015-10-11T05:39:37Z","updated_at":"2015-10-11T05:39:37Z","body":"If a document is deleted, do the ops get purged as well? Not sure if this is implemented in the standard behavior already."}}