{"action":"created","issue":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4642","labels_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4642/labels{/name}","comments_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4642/comments","events_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4642/events","html_url":"https://github.com/pouchdb/pouchdb/issues/4642","id":121038511,"number":4642,"title":"Make _rev generation deterministic (similar to CouchDB)","user":{"login":"willholley","id":97787,"avatar_url":"https://avatars.githubusercontent.com/u/97787?v=3","gravatar_id":"","url":"https://api.github.com/users/willholley","html_url":"https://github.com/willholley","followers_url":"https://api.github.com/users/willholley/followers","following_url":"https://api.github.com/users/willholley/following{/other_user}","gists_url":"https://api.github.com/users/willholley/gists{/gist_id}","starred_url":"https://api.github.com/users/willholley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willholley/subscriptions","organizations_url":"https://api.github.com/users/willholley/orgs","repos_url":"https://api.github.com/users/willholley/repos","events_url":"https://api.github.com/users/willholley/events{/privacy}","received_events_url":"https://api.github.com/users/willholley/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-12-08T16:02:05Z","updated_at":"2015-12-21T19:11:16Z","closed_at":null,"body":"PouchDB currently generates _rev values using a uuid. This presents problems when, for instance, an application has conflict resolution logic which might run on different devices concurrently (because they would both resolve the conflict but, in doing so, generate a new one).\r\n\r\nCouchDB has an optimisation here where the _rev is deterministic, based on the contents of the document, attachments, deleted flag and rev history (see http://stackoverflow.com/questions/5954864/how-does-couchdb-calculate-the-revision-number).\r\n\r\nIt would be useful for PouchDB to have a similarly deterministic rev generation, though it's not really necessary to match the CouchDB one."},"comment":{"url":"https://api.github.com/repos/pouchdb/pouchdb/issues/comments/166393641","html_url":"https://github.com/pouchdb/pouchdb/issues/4642#issuecomment-166393641","issue_url":"https://api.github.com/repos/pouchdb/pouchdb/issues/4642","id":166393641,"user":{"login":"willholley","id":97787,"avatar_url":"https://avatars.githubusercontent.com/u/97787?v=3","gravatar_id":"","url":"https://api.github.com/users/willholley","html_url":"https://github.com/willholley","followers_url":"https://api.github.com/users/willholley/followers","following_url":"https://api.github.com/users/willholley/following{/other_user}","gists_url":"https://api.github.com/users/willholley/gists{/gist_id}","starred_url":"https://api.github.com/users/willholley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willholley/subscriptions","organizations_url":"https://api.github.com/users/willholley/orgs","repos_url":"https://api.github.com/users/willholley/repos","events_url":"https://api.github.com/users/willholley/events{/privacy}","received_events_url":"https://api.github.com/users/willholley/received_events","type":"User","site_admin":false},"created_at":"2015-12-21T19:11:16Z","updated_at":"2015-12-21T19:11:16Z","body":"I opened the ticket following a discussion in Slack where a user had this\nproblem. The workaround is to try and elect a device to perform the\nconflict resolution but that in itself is a tricky problem. I expect this\nis going to pop up more as users discover conflicts (experience with\nCloudant suggests that lots of users don't handle them well).\n\nOn Mon, 21 Dec 2015 18:50 Nolan Lawson <notifications@github.com> wrote:\n\n> if we have 2 (or more) clients who are both trying to do automated\n> conflict resolution then our current strategy can have them race possibly\n> infinitely (they both see the change, both create a new doc to fix it, both\n> those new docs conflict).\n>\n> I'll also point out that this is an entirely theoretical outcome, and I've\n> never heard a user report that this kind of situation has actually occurred.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/pouchdb/pouchdb/issues/4642#issuecomment-166387992>.\n>\n"}}