{"action":"created","comment":{"url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/pulls/comments/52851989","id":52851989,"diff_hunk":"@@ -1623,27 +1625,14 @@ public Status do_GET_Document(Database _db, String docID, String _attachmentName\n                 String revID = getQuery(\"rev\");  // often null\n                 RevisionInternal rev = null;\n                 if (isLocalDoc) {\n+                    // query only -> not required synchronized\n                     rev = db.getLocalDocument(docID, revID);\n                 } else {\n-                    /*\n-                    rev = db.getDocument(docID, revID, options);\n-                    // Handle ?atts_since query by stubbing out older attachments:\n-                    //?atts_since parameter - value is a (URL-encoded) JSON array of one or more revision IDs.\n-                    // The response will include the content of only those attachments that changed since the given revision(s).\n-                    //(You can ask for this either in the default JSON or as multipart/related, as previously described.)\n-                    List<String> attsSince = (List<String>) getJSONQuery(\"atts_since\");\n-                    if (attsSince != null) {\n-                        String ancestorId = db.findCommonAncestorOf(rev, attsSince);\n-                        if (ancestorId != null) {\n-                            int generation = RevisionInternal.generationFromRevID(ancestorId);\n-                            db.stubOutAttachmentsIn(rev, generation + 1);\n-                        }\n-                    }\n-                    */\n                     boolean includeAttachments = options.contains(TDContentOptions.TDIncludeAttachments);\n                     if (includeAttachments) {\n                         options.remove(TDContentOptions.TDIncludeAttachments);\n                     }\n+                    // query only -> not required synchronized","path":"src/main/java/com/couchbase/lite/router/Router.java","position":94,"original_position":94,"commit_id":"2839fc7978e4ace5c67795c1df9b14653e65ae79","original_commit_id":"2839fc7978e4ace5c67795c1df9b14653e65ae79","user":{"login":"pasin","id":801454,"avatar_url":"https://avatars.githubusercontent.com/u/801454?v=3","gravatar_id":"","url":"https://api.github.com/users/pasin","html_url":"https://github.com/pasin","followers_url":"https://api.github.com/users/pasin/followers","following_url":"https://api.github.com/users/pasin/following{/other_user}","gists_url":"https://api.github.com/users/pasin/gists{/gist_id}","starred_url":"https://api.github.com/users/pasin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pasin/subscriptions","organizations_url":"https://api.github.com/users/pasin/orgs","repos_url":"https://api.github.com/users/pasin/repos","events_url":"https://api.github.com/users/pasin/events{/privacy}","received_events_url":"https://api.github.com/users/pasin/received_events","type":"User","site_admin":false},"body":"This comment might not be correct if want to make calling to the database object thread-safe.","created_at":"2016-02-15T00:23:09Z","updated_at":"2016-02-15T00:23:09Z","html_url":"https://github.com/couchbase/couchbase-lite-java-core/pull/1034#discussion_r52851989","pull_request_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/pulls/1034","_links":{"self":{"href":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/pulls/comments/52851989"},"html":{"href":"https://github.com/couchbase/couchbase-lite-java-core/pull/1034#discussion_r52851989"},"pull_request":{"href":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/pulls/1034"}}},"pull_request":{"url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/pulls/1034","id":59307930,"html_url":"https://github.com/couchbase/couchbase-lite-java-core/pull/1034","diff_url":"https://github.com/couchbase/couchbase-lite-java-core/pull/1034.diff","patch_url":"https://github.com/couchbase/couchbase-lite-java-core/pull/1034.patch","issue_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/issues/1034","number":1034,"state":"closed","locked":false,"title":"Fixed #1033 - Requests pending with POST _bulk_docs","user":{"login":"hideki","id":15889,"avatar_url":"https://avatars.githubusercontent.com/u/15889?v=3","gravatar_id":"","url":"https://api.github.com/users/hideki","html_url":"https://github.com/hideki","followers_url":"https://api.github.com/users/hideki/followers","following_url":"https://api.github.com/users/hideki/following{/other_user}","gists_url":"https://api.github.com/users/hideki/gists{/gist_id}","starred_url":"https://api.github.com/users/hideki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hideki/subscriptions","organizations_url":"https://api.github.com/users/hideki/orgs","repos_url":"https://api.github.com/users/hideki/repos","events_url":"https://api.github.com/users/hideki/events{/privacy}","received_events_url":"https://api.github.com/users/hideki/received_events","type":"User","site_admin":false},"body":"##### Problem:\r\n- _bulk_docs: Calling synchronized(db) in transaction wait for db lock with holding SQLite connection\r\n- other request: waiting for SQLConnection with holding db lock.\r\n\r\n##### Solution:\r\nRouter.java:\r\n- Eliminate all synchronized block from Router as most of database access are protected by Transaction.\r\n- Use runInTransaction for putLocalRevision() which is not inTransaction\r\n\r\nDatabase.java:\r\n- make compact() thread-safe\r\n\r\nConcern:\r\n- Database.delete() and Database.close()'s thread-safety. Need to review later.","created_at":"2016-02-14T22:20:35Z","updated_at":"2016-02-15T00:23:09Z","closed_at":"2016-02-14T22:47:40Z","merged_at":"2016-02-14T22:47:40Z","merge_commit_sha":"d94323b16546f11a4a510c7bb5ec0ef5db464356","assignee":{"login":"pasin","id":801454,"avatar_url":"https://avatars.githubusercontent.com/u/801454?v=3","gravatar_id":"","url":"https://api.github.com/users/pasin","html_url":"https://github.com/pasin","followers_url":"https://api.github.com/users/pasin/followers","following_url":"https://api.github.com/users/pasin/following{/other_user}","gists_url":"https://api.github.com/users/pasin/gists{/gist_id}","starred_url":"https://api.github.com/users/pasin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pasin/subscriptions","organizations_url":"https://api.github.com/users/pasin/orgs","repos_url":"https://api.github.com/users/pasin/repos","events_url":"https://api.github.com/users/pasin/events{/privacy}","received_events_url":"https://api.github.com/users/pasin/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/pulls/1034/commits","review_comments_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/pulls/1034/comments","review_comment_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/issues/1034/comments","statuses_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/statuses/2839fc7978e4ace5c67795c1df9b14653e65ae79","head":{"label":"couchbase:feature/issue_1033_Router_bulk_docs_hang","ref":"feature/issue_1033_Router_bulk_docs_hang","sha":"2839fc7978e4ace5c67795c1df9b14653e65ae79","user":{"login":"couchbase","id":605755,"avatar_url":"https://avatars.githubusercontent.com/u/605755?v=3","gravatar_id":"","url":"https://api.github.com/users/couchbase","html_url":"https://github.com/couchbase","followers_url":"https://api.github.com/users/couchbase/followers","following_url":"https://api.github.com/users/couchbase/following{/other_user}","gists_url":"https://api.github.com/users/couchbase/gists{/gist_id}","starred_url":"https://api.github.com/users/couchbase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/couchbase/subscriptions","organizations_url":"https://api.github.com/users/couchbase/orgs","repos_url":"https://api.github.com/users/couchbase/repos","events_url":"https://api.github.com/users/couchbase/events{/privacy}","received_events_url":"https://api.github.com/users/couchbase/received_events","type":"Organization","site_admin":false},"repo":{"id":12310030,"name":"couchbase-lite-java-core","full_name":"couchbase/couchbase-lite-java-core","owner":{"login":"couchbase","id":605755,"avatar_url":"https://avatars.githubusercontent.com/u/605755?v=3","gravatar_id":"","url":"https://api.github.com/users/couchbase","html_url":"https://github.com/couchbase","followers_url":"https://api.github.com/users/couchbase/followers","following_url":"https://api.github.com/users/couchbase/following{/other_user}","gists_url":"https://api.github.com/users/couchbase/gists{/gist_id}","starred_url":"https://api.github.com/users/couchbase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/couchbase/subscriptions","organizations_url":"https://api.github.com/users/couchbase/orgs","repos_url":"https://api.github.com/users/couchbase/repos","events_url":"https://api.github.com/users/couchbase/events{/privacy}","received_events_url":"https://api.github.com/users/couchbase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/couchbase/couchbase-lite-java-core","description":"Couchbase Lite Java core library","fork":false,"url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core","forks_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/forks","keys_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/teams","hooks_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/hooks","issue_events_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/issues/events{/number}","events_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/events","assignees_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/assignees{/user}","branches_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/branches{/branch}","tags_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/tags","blobs_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/statuses/{sha}","languages_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/languages","stargazers_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/stargazers","contributors_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/contributors","subscribers_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/subscribers","subscription_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/subscription","commits_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/contents/{+path}","compare_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/merges","archive_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/downloads","issues_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/issues{/number}","pulls_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/pulls{/number}","milestones_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/milestones{/number}","notifications_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/labels{/name}","releases_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/releases{/id}","deployments_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/deployments","created_at":"2013-08-22T23:13:23Z","updated_at":"2016-02-10T12:58:05Z","pushed_at":"2016-02-14T23:00:59Z","git_url":"git://github.com/couchbase/couchbase-lite-java-core.git","ssh_url":"git@github.com:couchbase/couchbase-lite-java-core.git","clone_url":"https://github.com/couchbase/couchbase-lite-java-core.git","svn_url":"https://github.com/couchbase/couchbase-lite-java-core","homepage":"","size":10020,"stargazers_count":37,"watchers_count":37,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":61,"mirror_url":null,"open_issues_count":151,"forks":61,"open_issues":151,"watchers":37,"default_branch":"master"}},"base":{"label":"couchbase:master","ref":"master","sha":"11712fdec6aeaa192c80a9d302794ad1cedca740","user":{"login":"couchbase","id":605755,"avatar_url":"https://avatars.githubusercontent.com/u/605755?v=3","gravatar_id":"","url":"https://api.github.com/users/couchbase","html_url":"https://github.com/couchbase","followers_url":"https://api.github.com/users/couchbase/followers","following_url":"https://api.github.com/users/couchbase/following{/other_user}","gists_url":"https://api.github.com/users/couchbase/gists{/gist_id}","starred_url":"https://api.github.com/users/couchbase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/couchbase/subscriptions","organizations_url":"https://api.github.com/users/couchbase/orgs","repos_url":"https://api.github.com/users/couchbase/repos","events_url":"https://api.github.com/users/couchbase/events{/privacy}","received_events_url":"https://api.github.com/users/couchbase/received_events","type":"Organization","site_admin":false},"repo":{"id":12310030,"name":"couchbase-lite-java-core","full_name":"couchbase/couchbase-lite-java-core","owner":{"login":"couchbase","id":605755,"avatar_url":"https://avatars.githubusercontent.com/u/605755?v=3","gravatar_id":"","url":"https://api.github.com/users/couchbase","html_url":"https://github.com/couchbase","followers_url":"https://api.github.com/users/couchbase/followers","following_url":"https://api.github.com/users/couchbase/following{/other_user}","gists_url":"https://api.github.com/users/couchbase/gists{/gist_id}","starred_url":"https://api.github.com/users/couchbase/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/couchbase/subscriptions","organizations_url":"https://api.github.com/users/couchbase/orgs","repos_url":"https://api.github.com/users/couchbase/repos","events_url":"https://api.github.com/users/couchbase/events{/privacy}","received_events_url":"https://api.github.com/users/couchbase/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/couchbase/couchbase-lite-java-core","description":"Couchbase Lite Java core library","fork":false,"url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core","forks_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/forks","keys_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/teams","hooks_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/hooks","issue_events_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/issues/events{/number}","events_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/events","assignees_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/assignees{/user}","branches_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/branches{/branch}","tags_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/tags","blobs_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/statuses/{sha}","languages_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/languages","stargazers_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/stargazers","contributors_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/contributors","subscribers_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/subscribers","subscription_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/subscription","commits_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/contents/{+path}","compare_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/merges","archive_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/downloads","issues_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/issues{/number}","pulls_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/pulls{/number}","milestones_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/milestones{/number}","notifications_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/labels{/name}","releases_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/releases{/id}","deployments_url":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/deployments","created_at":"2013-08-22T23:13:23Z","updated_at":"2016-02-10T12:58:05Z","pushed_at":"2016-02-14T23:00:59Z","git_url":"git://github.com/couchbase/couchbase-lite-java-core.git","ssh_url":"git@github.com:couchbase/couchbase-lite-java-core.git","clone_url":"https://github.com/couchbase/couchbase-lite-java-core.git","svn_url":"https://github.com/couchbase/couchbase-lite-java-core","homepage":"","size":10020,"stargazers_count":37,"watchers_count":37,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":61,"mirror_url":null,"open_issues_count":151,"forks":61,"open_issues":151,"watchers":37,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/pulls/1034"},"html":{"href":"https://github.com/couchbase/couchbase-lite-java-core/pull/1034"},"issue":{"href":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/issues/1034"},"comments":{"href":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/issues/1034/comments"},"review_comments":{"href":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/pulls/1034/comments"},"review_comment":{"href":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/pulls/1034/commits"},"statuses":{"href":"https://api.github.com/repos/couchbase/couchbase-lite-java-core/statuses/2839fc7978e4ace5c67795c1df9b14653e65ae79"}}}}