{"action":"opened","number":3,"pull_request":{"url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/pulls/3","id":29958164,"html_url":"https://github.com/couchbaselabs/couchbase-spark-connector/pull/3","diff_url":"https://github.com/couchbaselabs/couchbase-spark-connector/pull/3.diff","patch_url":"https://github.com/couchbaselabs/couchbase-spark-connector/pull/3.patch","issue_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/issues/3","number":3,"state":"open","locked":false,"title":"Fix some potential issues","user":{"login":"zsxwing","id":1000778,"avatar_url":"https://avatars.githubusercontent.com/u/1000778?v=3","gravatar_id":"","url":"https://api.github.com/users/zsxwing","html_url":"https://github.com/zsxwing","followers_url":"https://api.github.com/users/zsxwing/followers","following_url":"https://api.github.com/users/zsxwing/following{/other_user}","gists_url":"https://api.github.com/users/zsxwing/gists{/gist_id}","starred_url":"https://api.github.com/users/zsxwing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zsxwing/subscriptions","organizations_url":"https://api.github.com/users/zsxwing/orgs","repos_url":"https://api.github.com/users/zsxwing/repos","events_url":"https://api.github.com/users/zsxwing/events{/privacy}","received_events_url":"https://api.github.com/users/zsxwing/received_events","type":"User","site_admin":false},"body":"I found some potential issues during reviewing the codes.\r\n\r\n1. Scala Iterator.toIterable will cache all values of an Iterator after accessing it, so that it follows the Iterable contract: an Iterable can return an Iterator any time. However, that's not what we want. To avoid caching values, I create an special Iterable that can only be accessed once to avoid OOM.\r\n\r\n2. Because RxJava will subscribe when creating Iterator, there may be an OOM issue if Spark doesn't consume the Iterator in time. E.g., when calling rdd1.join(rdd2), Spark will do the following thing:\r\n```\r\nval iters = ListBuffer()\r\niters.add(rdd1.compute(...))\r\niters.add(rdd2.compute(...))\r\n\r\nwhile(iters.hasNext()) {\r\n  val i = iters.next()\r\n  process i\r\n}\r\n```\r\nSo rdd2's Iterator is created at the beginning, but its content will be consumed only after processing rdd1's Iterator. Considering the time gap may be huge, rdd2's Iterator should not generate data when creating it. Therefore I use LazyIterator to delay it.\r\n\r\nIn addition, I think DStreamFunctions can call `DocumentRDDFunctions.saveToCouchbase` directly.","created_at":"2015-02-25T03:16:44Z","updated_at":"2015-02-25T03:16:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/pulls/3/commits","review_comments_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/pulls/3/comments","review_comment_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/pulls/comments{/number}","comments_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/issues/3/comments","statuses_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/statuses/55df86ae5c57a770ddcd95221e48677fcbdc4978","head":{"label":"zsxwing:review","ref":"review","sha":"55df86ae5c57a770ddcd95221e48677fcbdc4978","user":{"login":"zsxwing","id":1000778,"avatar_url":"https://avatars.githubusercontent.com/u/1000778?v=3","gravatar_id":"","url":"https://api.github.com/users/zsxwing","html_url":"https://github.com/zsxwing","followers_url":"https://api.github.com/users/zsxwing/followers","following_url":"https://api.github.com/users/zsxwing/following{/other_user}","gists_url":"https://api.github.com/users/zsxwing/gists{/gist_id}","starred_url":"https://api.github.com/users/zsxwing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zsxwing/subscriptions","organizations_url":"https://api.github.com/users/zsxwing/orgs","repos_url":"https://api.github.com/users/zsxwing/repos","events_url":"https://api.github.com/users/zsxwing/events{/privacy}","received_events_url":"https://api.github.com/users/zsxwing/received_events","type":"User","site_admin":false},"repo":{"id":30737409,"name":"couchbase-spark-connector","full_name":"zsxwing/couchbase-spark-connector","owner":{"login":"zsxwing","id":1000778,"avatar_url":"https://avatars.githubusercontent.com/u/1000778?v=3","gravatar_id":"","url":"https://api.github.com/users/zsxwing","html_url":"https://github.com/zsxwing","followers_url":"https://api.github.com/users/zsxwing/followers","following_url":"https://api.github.com/users/zsxwing/following{/other_user}","gists_url":"https://api.github.com/users/zsxwing/gists{/gist_id}","starred_url":"https://api.github.com/users/zsxwing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zsxwing/subscriptions","organizations_url":"https://api.github.com/users/zsxwing/orgs","repos_url":"https://api.github.com/users/zsxwing/repos","events_url":"https://api.github.com/users/zsxwing/events{/privacy}","received_events_url":"https://api.github.com/users/zsxwing/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zsxwing/couchbase-spark-connector","description":"Connecting Couchbase with Spark for Fun and Profit since 2015","fork":true,"url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector","forks_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/forks","keys_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/teams","hooks_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/hooks","issue_events_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/issues/events{/number}","events_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/events","assignees_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/assignees{/user}","branches_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/branches{/branch}","tags_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/tags","blobs_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/git/refs{/sha}","trees_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/statuses/{sha}","languages_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/languages","stargazers_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/stargazers","contributors_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/contributors","subscribers_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/subscribers","subscription_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/subscription","commits_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/commits{/sha}","git_commits_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/git/commits{/sha}","comments_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/comments{/number}","issue_comment_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/issues/comments{/number}","contents_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/contents/{+path}","compare_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/merges","archive_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/downloads","issues_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/issues{/number}","pulls_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/pulls{/number}","milestones_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/milestones{/number}","notifications_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/labels{/name}","releases_url":"https://api.github.com/repos/zsxwing/couchbase-spark-connector/releases{/id}","created_at":"2015-02-13T02:53:21Z","updated_at":"2015-02-13T02:53:22Z","pushed_at":"2015-02-25T03:05:41Z","git_url":"git://github.com/zsxwing/couchbase-spark-connector.git","ssh_url":"git@github.com:zsxwing/couchbase-spark-connector.git","clone_url":"https://github.com/zsxwing/couchbase-spark-connector.git","svn_url":"https://github.com/zsxwing/couchbase-spark-connector","homepage":null,"size":199,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"couchbaselabs:master","ref":"master","sha":"6e24ac4c6e2b5dba606ccf95ecb879fe5defef78","user":{"login":"couchbaselabs","id":636956,"avatar_url":"https://avatars.githubusercontent.com/u/636956?v=3","gravatar_id":"","url":"https://api.github.com/users/couchbaselabs","html_url":"https://github.com/couchbaselabs","followers_url":"https://api.github.com/users/couchbaselabs/followers","following_url":"https://api.github.com/users/couchbaselabs/following{/other_user}","gists_url":"https://api.github.com/users/couchbaselabs/gists{/gist_id}","starred_url":"https://api.github.com/users/couchbaselabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/couchbaselabs/subscriptions","organizations_url":"https://api.github.com/users/couchbaselabs/orgs","repos_url":"https://api.github.com/users/couchbaselabs/repos","events_url":"https://api.github.com/users/couchbaselabs/events{/privacy}","received_events_url":"https://api.github.com/users/couchbaselabs/received_events","type":"Organization","site_admin":false},"repo":{"id":30601588,"name":"couchbase-spark-connector","full_name":"couchbaselabs/couchbase-spark-connector","owner":{"login":"couchbaselabs","id":636956,"avatar_url":"https://avatars.githubusercontent.com/u/636956?v=3","gravatar_id":"","url":"https://api.github.com/users/couchbaselabs","html_url":"https://github.com/couchbaselabs","followers_url":"https://api.github.com/users/couchbaselabs/followers","following_url":"https://api.github.com/users/couchbaselabs/following{/other_user}","gists_url":"https://api.github.com/users/couchbaselabs/gists{/gist_id}","starred_url":"https://api.github.com/users/couchbaselabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/couchbaselabs/subscriptions","organizations_url":"https://api.github.com/users/couchbaselabs/orgs","repos_url":"https://api.github.com/users/couchbaselabs/repos","events_url":"https://api.github.com/users/couchbaselabs/events{/privacy}","received_events_url":"https://api.github.com/users/couchbaselabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/couchbaselabs/couchbase-spark-connector","description":"The Official Couchbase Server <-> Apache Spark Connector","fork":false,"url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector","forks_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/forks","keys_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/keys{/key_id}","collaborators_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/teams","hooks_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/hooks","issue_events_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/issues/events{/number}","events_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/events","assignees_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/assignees{/user}","branches_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/branches{/branch}","tags_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/tags","blobs_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/git/refs{/sha}","trees_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/git/trees{/sha}","statuses_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/statuses/{sha}","languages_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/languages","stargazers_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/stargazers","contributors_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/contributors","subscribers_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/subscribers","subscription_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/subscription","commits_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/commits{/sha}","git_commits_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/git/commits{/sha}","comments_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/comments{/number}","issue_comment_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/issues/comments{/number}","contents_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/contents/{+path}","compare_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/compare/{base}...{head}","merges_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/merges","archive_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/downloads","issues_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/issues{/number}","pulls_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/pulls{/number}","milestones_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/milestones{/number}","notifications_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/labels{/name}","releases_url":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/releases{/id}","created_at":"2015-02-10T16:29:17Z","updated_at":"2015-02-20T12:45:21Z","pushed_at":"2015-02-20T12:45:21Z","git_url":"git://github.com/couchbaselabs/couchbase-spark-connector.git","ssh_url":"git@github.com:couchbaselabs/couchbase-spark-connector.git","clone_url":"https://github.com/couchbaselabs/couchbase-spark-connector.git","svn_url":"https://github.com/couchbaselabs/couchbase-spark-connector","homepage":"","size":494,"stargazers_count":3,"watchers_count":3,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/pulls/3"},"html":{"href":"https://github.com/couchbaselabs/couchbase-spark-connector/pull/3"},"issue":{"href":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/issues/3"},"comments":{"href":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/couchbaselabs/couchbase-spark-connector/statuses/55df86ae5c57a770ddcd95221e48677fcbdc4978"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":3,"additions":122,"deletions":43,"changed_files":8}}